diff --git a/docs/typescript.md b/docs/typescript.md
index 71ea63bc8f2..7e5aa98114e 100644
--- a/docs/typescript.md
+++ b/docs/typescript.md
@@ -6,7 +6,44 @@ Our use of TypeScript has to accomodate both .js development in agoric-sdk (whic
- package entrypoint(s) exports explicit types
- for packages upon which other packages expect ambient types:
- - `exported.d.ts` exports the explicit types and ambient re-exports
+ - `exported.js` exports the explicit types and ambient re-exports
+
+## exported.js
+
+The `exported.js` re-exports types into global namespace, for consumers that expect these to
+be ambient. This could be called "ambient.js" but we retain the filename for backwards compatibility.
+
+The pattern is to make these two files like this at package root:
+
+
+`exported.js`
+
+```ts
+// Dummy file for .d.ts twin to declare ambients
+export {};
+```
+
+`exported.d.ts`
+
+```ts
+/** @file Ambient exports until https://github.com/Agoric/agoric-sdk/issues/6512 */
+/** @see {@link /docs/typescript.md} */
+/* eslint-disable -- doesn't understand .d.ts */
+import {
+ SomeType as _SomeType,
+} from './src/types.js';
+
+declare global {
+ export {
+ _SomeType as SomeType,
+ };
+}
+```
+
+Why the _ prefix? Because without it TS gets confused between the
+import and export symbols. ([h/t](https://stackoverflow.com/a/66588974))
+Note one downside vs ambients is that these types will appear to be on `globalThis`.
+
## Generating API docs
diff --git a/packages/ERTP/exported.d.ts b/packages/ERTP/exported.d.ts
index 45d5d6528db..176ac2c51b9 100644
--- a/packages/ERTP/exported.d.ts
+++ b/packages/ERTP/exported.d.ts
@@ -1,12 +1,10 @@
+/** @file Ambient exports until https://github.com/Agoric/agoric-sdk/issues/6512 */
+/** @see {@link /docs/typescript.md} */
/* eslint-disable -- doesn't understand .d.ts */
+// XXX also explicit exports because `@agoric/ertp` top level confuses the type and value of `AssetKind`
export * from './src/types.js';
-// XXX re-export types into global namespace, for consumers that expect these to
-// be ambient. Why the _ prefix? Because without it TS gets confused between the
-// import and export symbols. h/t https://stackoverflow.com/a/66588974
-// Note one big downside vs ambients is that these types will appear to be on `globalThis`.
-// UNTIL https://github.com/Agoric/agoric-sdk/issues/6512
import {
Amount as _Amount,
Brand as _Brand,
diff --git a/packages/ERTP/exported.js b/packages/ERTP/exported.js
index 469002eeeed..ff54cc24a93 100644
--- a/packages/ERTP/exported.js
+++ b/packages/ERTP/exported.js
@@ -1 +1,2 @@
// Dummy file for .d.ts twin to declare ambients
+export {};
diff --git a/packages/ERTP/src/legacy-payment-helpers.js b/packages/ERTP/src/legacy-payment-helpers.js
index d22bb452d64..af53e22a628 100644
--- a/packages/ERTP/src/legacy-payment-helpers.js
+++ b/packages/ERTP/src/legacy-payment-helpers.js
@@ -4,7 +4,10 @@ import { mustMatch } from '@agoric/store';
import { E } from '@endo/far';
import { AmountMath } from './amountMath.js';
-/** @import {Amount, AssetKind, AmountValue, AssetKindForValue, Payment, Brand, Purse} from './types.js' */
+/**
+ * @import {ERef} from '@endo/far');
+ * @import {Amount, AssetKind, AmountValue, AssetKindForValue, Payment, Brand, Purse} from './types.js'
+ */
const { Fail } = assert;
diff --git a/packages/ERTP/src/paymentLedger.js b/packages/ERTP/src/paymentLedger.js
index fe5362d511b..5b9645f7e06 100644
--- a/packages/ERTP/src/paymentLedger.js
+++ b/packages/ERTP/src/paymentLedger.js
@@ -7,7 +7,9 @@ import { AmountMath } from './amountMath.js';
import { preparePaymentKind } from './payment.js';
import { preparePurseKind } from './purse.js';
+// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
import '@agoric/store/exported.js';
+
import { BrandI, makeIssuerInterfaces } from './typeGuards.js';
/**
diff --git a/packages/ERTP/src/transientNotifier.js b/packages/ERTP/src/transientNotifier.js
index 990f5b93472..a01eaeb28c1 100644
--- a/packages/ERTP/src/transientNotifier.js
+++ b/packages/ERTP/src/transientNotifier.js
@@ -4,7 +4,10 @@ import { makeScalarBigWeakMapStore } from '@agoric/vat-data';
import { provideLazy } from '@agoric/store';
import { makeNotifierKit } from '@agoric/notifier';
-/** @import {Purse} from './types.js' */
+/**
+ * @import {Purse} from './types.js';
+ * @import {LatestTopic, NotifierRecord} from '@agoric/notifier');
+ */
// Note: Virtual for high cardinality, but *not* durable, and so
// broken across an upgrade.
diff --git a/packages/ERTP/src/types.js b/packages/ERTP/src/types.js
index fa107d94baa..91a97b288b1 100644
--- a/packages/ERTP/src/types.js
+++ b/packages/ERTP/src/types.js
@@ -5,8 +5,9 @@ export {};
///
/**
- * @import {Passable} from '@endo/pass-style')
- * @import {CopySet, Key} from '@endo/patterns')
+ * @import {ERef} from '@endo/far');
+ * @import {CopySet, Key} from '@endo/patterns');
+ * @import {LatestTopic, NotifierRecord} from '@agoric/notifier');
*/
/**
diff --git a/packages/SwingSet/src/types-ambient.js b/packages/SwingSet/src/types-ambient.js
index 5c83a481c2a..352630af64b 100644
--- a/packages/SwingSet/src/types-ambient.js
+++ b/packages/SwingSet/src/types-ambient.js
@@ -1,87 +1,10 @@
+// XXX this file builds empty when `tsc --build` is run
+
+// XXX all on one line because otherwise tsc puts the `*` in the type name
/**
- * @import {
- * Bundle,
- * BundleCap,
- * BundleFormat,
- * BundleID,
- * BundleRef,
- * BundleSpec,
- * DeviceInvocation,
- * DeviceInvocationResult,
- * DeviceInvocationResultError,
- * DeviceInvocationResultOk,
- * EndoZipBase64Bundle,
- * GetExportBundle,
- * KernelDeliveryBringOutYourDead,
- * KernelDeliveryChangeVatOptions,
- * KernelDeliveryDropExports,
- * KernelDeliveryMessage,
- * KernelDeliveryNotify,
- * KernelDeliveryObject,
- * KernelDeliveryOneNotify,
- * KernelDeliveryRetireExports,
- * KernelDeliveryRetireImports,
- * KernelDeliveryStartVat,
- * KernelKeeper,
- * KernelOneResolution,
- * KernelOptions,
- * KernelSlog,
- * KernelSyscallDropImports,
- * KernelSyscallExit,
- * KernelSyscallInvoke,
- * KernelSyscallObject,
- * KernelSyscallResolve,
- * KernelSyscallResult,
- * KernelSyscallResultError,
- * KernelSyscallResultOk,
- * KernelSyscallRetireExports,
- * KernelSyscallRetireImports,
- * KernelSyscallSend,
- * KernelSyscallSubscribe,
- * KernelSyscallVatstoreDelete,
- * KernelSyscallVatstoreGet,
- * KernelSyscallVatstoreGetNextKey,
- * KernelSyscallVatstoreSet,
- * ManagerType,
- * Message,
- * MeteringVatPowers,
- * NestedEvaluateBundle,
- * PolicyInput,
- * PolicyInputCrankComplete,
- * PolicyInputCrankFailed,
- * PolicyInputCreateVat,
- * PolicyInputNone,
- * PolicyOutput,
- * ResolutionPolicy,
- * RunPolicy,
- * SlogFinishDelivery,
- * SlogFinishSyscall,
- * SnapshotResult,
- * SnapStore,
- * SourceOfBundle,
- * SourceSpec,
- * StaticVatPowers,
- * SwingSetCapData,
- * SwingSetConfig,
- * SwingSetConfigDescriptor,
- * SwingSetConfigProperties,
- * SwingSetKernelConfig,
- * TerminationVatPowers,
- * VatKeeper,
- * VatPowers,
- * VatSlog,
- * VatStats,
- * WaitUntilQuiescent,
- * XSnap,
- * } from './types-external.js')
+ * @import { Bundle, BundleCap, BundleFormat, BundleID, BundleRef, BundleSpec, DeviceInvocation, DeviceInvocationResult, DeviceInvocationResultError, DeviceInvocationResultOk, EndoZipBase64Bundle, GetExportBundle, KernelDeliveryBringOutYourDead, KernelDeliveryChangeVatOptions, KernelDeliveryDropExports, KernelDeliveryMessage, KernelDeliveryNotify, KernelDeliveryObject, KernelDeliveryOneNotify, KernelDeliveryRetireExports, KernelDeliveryRetireImports, KernelDeliveryStartVat, KernelKeeper, KernelOneResolution, KernelOptions, KernelSlog, KernelSyscallDropImports, KernelSyscallExit, KernelSyscallInvoke, KernelSyscallObject, KernelSyscallResolve, KernelSyscallResult, KernelSyscallResultError, KernelSyscallResultOk, KernelSyscallRetireExports, KernelSyscallRetireImports, KernelSyscallSend, KernelSyscallSubscribe, KernelSyscallVatstoreDelete, KernelSyscallVatstoreGet, KernelSyscallVatstoreGetNextKey, KernelSyscallVatstoreSet, ManagerType, Message, MeteringVatPowers, NestedEvaluateBundle, PolicyInput, PolicyInputCrankComplete, PolicyInputCrankFailed, PolicyInputCreateVat, PolicyInputNone, PolicyOutput, ResolutionPolicy, RunPolicy, SlogFinishDelivery, SlogFinishSyscall, SnapshotResult, SnapStore, SourceOfBundle, SourceSpec, StaticVatPowers, SwingSetCapData, SwingSetConfig, SwingSetConfigDescriptor, SwingSetConfigProperties, SwingSetKernelConfig, TerminationVatPowers, VatAdminSvc, VatKeeper, VatPowers, VatSlog, VatStats, WaitUntilQuiescent, XSnap, } from './types-external.js';
*/
/**
- * @import {
- * KVStore,
- * TranscriptStore,
- * SwingStore,
- * SwingStoreKernelStorage,
- * SwingStoreHostStorage,
- * } from '@agoric/swing-store'
+ * @import { KVStore, TranscriptStore, SwingStore, SwingStoreKernelStorage, SwingStoreHostStorage, } from '@agoric/swing-store';
*/
diff --git a/packages/base-zone/src/index.js b/packages/base-zone/src/index.js
index 5815984e058..a7b2ee98e34 100644
--- a/packages/base-zone/src/index.js
+++ b/packages/base-zone/src/index.js
@@ -1,5 +1,8 @@
// @jessie-check
+// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
+import '@agoric/store/exported.js';
+
// eslint-disable-next-line import/export
export * from './exports.js';
diff --git a/packages/benchmark/src/benchmarkerator.js b/packages/benchmark/src/benchmarkerator.js
index cb76b26d1e4..499717b6046 100644
--- a/packages/benchmark/src/benchmarkerator.js
+++ b/packages/benchmark/src/benchmarkerator.js
@@ -4,7 +4,7 @@ import fs from 'node:fs';
import '@endo/init/pre-bundle-source.js';
import '@endo/init';
-// XXX The following four imports are present only to make `tsc` shut up. They do no actual work.
+// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
import '@agoric/vats/exported.js';
import '@agoric/inter-protocol/exported.js';
import '@agoric/zoe/exported.js';
diff --git a/packages/boot/test/bootstrapTests/ibcClientMock.js b/packages/boot/test/bootstrapTests/ibcClientMock.js
index 33458da604e..9578d6dfe41 100644
--- a/packages/boot/test/bootstrapTests/ibcClientMock.js
+++ b/packages/boot/test/bootstrapTests/ibcClientMock.js
@@ -3,6 +3,10 @@
import { Far } from '@endo/far';
import { V as E } from '@agoric/vat-data/vow.js';
+/**
+ * @import {ListenHandler, PortAllocator} from '@agoric/network';
+ */
+
/**
* @param {ZCF} zcf
* @param {{
diff --git a/packages/boot/test/bootstrapTests/ibcServerMock.js b/packages/boot/test/bootstrapTests/ibcServerMock.js
index 1370146c65e..11367cbf3fb 100644
--- a/packages/boot/test/bootstrapTests/ibcServerMock.js
+++ b/packages/boot/test/bootstrapTests/ibcServerMock.js
@@ -7,6 +7,10 @@ import { V as E } from '@agoric/vat-data/vow.js';
const { quote: q, Fail } = assert;
const { log } = console;
+/**
+ * @import {ListenHandler, PortAllocator} from '@agoric/network';
+ */
+
/**
*
* @param {ZCF} zcf
diff --git a/packages/boot/test/bootstrapTests/zcfProbe.js b/packages/boot/test/bootstrapTests/zcfProbe.js
index 16ab4fd1fa9..0addf85a667 100644
--- a/packages/boot/test/bootstrapTests/zcfProbe.js
+++ b/packages/boot/test/bootstrapTests/zcfProbe.js
@@ -1,3 +1,4 @@
+// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
import '@agoric/zoe/exported.js';
import { makeTracer } from '@agoric/internal';
diff --git a/packages/boot/tools/supports.ts b/packages/boot/tools/supports.ts
index 64c83f98858..0939fad575e 100644
--- a/packages/boot/tools/supports.ts
+++ b/packages/boot/tools/supports.ts
@@ -17,7 +17,10 @@ import { initSwingStore } from '@agoric/swing-store';
import { loadSwingsetConfigFile } from '@agoric/swingset-vat';
import { makeSlogSender } from '@agoric/telemetry';
import { TimeMath, Timestamp } from '@agoric/time';
+
+// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
import '@agoric/vats/exported.js';
+
import {
boardSlottingMarshaller,
slotToBoardRemote,
diff --git a/packages/cache/src/main.js b/packages/cache/src/main.js
index 9ec4164ff9f..f13abd7ef3f 100644
--- a/packages/cache/src/main.js
+++ b/packages/cache/src/main.js
@@ -1,5 +1,8 @@
// @jessie-check
+// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
+import '@agoric/internal/exported.js';
+
// eslint-disable-next-line import/export
export * from './types.js';
export * from './store.js';
diff --git a/packages/casting/src/main.js b/packages/casting/src/main.js
index 994755f3165..c4ea270603c 100644
--- a/packages/casting/src/main.js
+++ b/packages/casting/src/main.js
@@ -1,5 +1,7 @@
// @jessie-check
+import '@agoric/internal/exported.js';
+
// eslint-disable-next-line import/export
export * from './types.js'; // no named exports
export * from './defaults.js';
diff --git a/packages/casting/src/types.js b/packages/casting/src/types.js
index 43d32c571e8..017f80ec199 100644
--- a/packages/casting/src/types.js
+++ b/packages/casting/src/types.js
@@ -1,11 +1,11 @@
// @jessie-check
-// Make this a module.
-import '@agoric/notifier';
-
+// Ensure this is a module.
export {};
-/** @import { ERef } from '@endo/far' */
+/**
+ * @import {Notifier, Subscription} from '@agoric/notifier';
+ */
/**
* @typedef {object} LeaderOptions
diff --git a/packages/deploy-script-support/src/coreProposalBehavior.js b/packages/deploy-script-support/src/coreProposalBehavior.js
index f473edf2a94..6551b0dfb92 100644
--- a/packages/deploy-script-support/src/coreProposalBehavior.js
+++ b/packages/deploy-script-support/src/coreProposalBehavior.js
@@ -1,6 +1,10 @@
// @ts-check
const t = 'makeCoreProposalBehavior';
+/**
+ * @import {Installation} from '@agoric/zoe/src/zoeService/utils.js';
+ */
+
/**
* TODO import these from @agoric/vats when the types are better managed
*
diff --git a/packages/governance/exported.d.ts b/packages/governance/exported.d.ts
index 1cc353ee415..a3336ac36dd 100644
--- a/packages/governance/exported.d.ts
+++ b/packages/governance/exported.d.ts
@@ -1,12 +1,7 @@
+/** @file Ambient exports until https://github.com/Agoric/agoric-sdk/issues/6512 */
+/** @see {@link /docs/typescript.md} */
/* eslint-disable -- doesn't understand .d.ts */
-export * from './src/types.js';
-
-// XXX re-export types into global namespace, for consumers that expect these to
-// be ambient. Why the _ prefix? Because without it TS gets confused between the
-// import and export symbols. h/t https://stackoverflow.com/a/66588974
-// Note one big downside vs ambients is that these types will appear to be on `globalThis`.
-// UNTIL https://github.com/Agoric/agoric-sdk/issues/6512
import {
GovernanceFacetKit as _GovernanceFacetKit,
GovernanceTerms as _GovernanceTerms,
diff --git a/packages/governance/src/contractGovernance/governParam.js b/packages/governance/src/contractGovernance/governParam.js
index 003877c0ae3..f06c7d4bb19 100644
--- a/packages/governance/src/contractGovernance/governParam.js
+++ b/packages/governance/src/contractGovernance/governParam.js
@@ -9,6 +9,7 @@ import {
QuorumRule,
} from '../question.js';
import { ParamChangesQuestionDetailsShape } from '../typeGuards.js';
+
/**
* @import {ParamValue, ParamChangePositions, QuestionSpec, ChangeParamsPosition, ParamChangeIssue, ParamGovernor, ParamManagerRetriever, PoserFacet, VoteOnParamChanges} from '../types.js';
*/
diff --git a/packages/governance/src/index.js b/packages/governance/src/index.js
index 7c527d3789f..b3e2cc5a24d 100644
--- a/packages/governance/src/index.js
+++ b/packages/governance/src/index.js
@@ -1,8 +1,7 @@
// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
+import '@agoric/internal/exported.js';
import '@agoric/ertp/exported.js';
-import '@agoric/zoe/src/contractFacet/types-ambient.js';
-import '@agoric/zoe/tools/types-ambient.js';
-import '@agoric/zoe/src/types.js';
+import '@agoric/zoe/exported.js';
///
diff --git a/packages/governance/src/types.js b/packages/governance/src/types.js
index 23c8e3ddec7..cced1b34245 100644
--- a/packages/governance/src/types.js
+++ b/packages/governance/src/types.js
@@ -1,3 +1,5 @@
+import '@agoric/zoe/src/zoeService/types-ambient.js';
+
export {};
/** @import {ContractStartFunction} from '@agoric/zoe/src/zoeService/utils.js' */
diff --git a/packages/governance/test/unitTests/test-binaryballotCount.js b/packages/governance/test/unitTests/test-binaryballotCount.js
index 7e8197e1721..b726078fe58 100644
--- a/packages/governance/test/unitTests/test-binaryballotCount.js
+++ b/packages/governance/test/unitTests/test-binaryballotCount.js
@@ -1,6 +1,9 @@
/* eslint @typescript-eslint/no-floating-promises: "warn" */
import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js';
+
+// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
import '@agoric/zoe/exported.js';
+
import { E } from '@endo/eventual-send';
import buildManualTimer from '@agoric/zoe/tools/manualTimer.js';
import { makeHandle } from '@agoric/zoe/src/makeHandle.js';
diff --git a/packages/governance/test/unitTests/test-committee.js b/packages/governance/test/unitTests/test-committee.js
index d525cf01d7a..5672490b267 100644
--- a/packages/governance/test/unitTests/test-committee.js
+++ b/packages/governance/test/unitTests/test-committee.js
@@ -1,5 +1,6 @@
import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js';
+// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
import '@agoric/zoe/exported.js';
import { makeMockChainStorageRoot } from '@agoric/internal/src/storage-test-utils.js';
diff --git a/packages/inter-protocol/src/auction/auctionBook.js b/packages/inter-protocol/src/auction/auctionBook.js
index 47f00e0e1c2..e819fe8f53c 100644
--- a/packages/inter-protocol/src/auction/auctionBook.js
+++ b/packages/inter-protocol/src/auction/auctionBook.js
@@ -1,3 +1,5 @@
+// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
+import '@agoric/internal/exported.js';
import '@agoric/governance/exported.js';
import '@agoric/zoe/exported.js';
import '@agoric/zoe/src/contracts/exported.js';
diff --git a/packages/inter-protocol/src/proposals/econ-behaviors.js b/packages/inter-protocol/src/proposals/econ-behaviors.js
index a63685a9017..ed220917ee4 100644
--- a/packages/inter-protocol/src/proposals/econ-behaviors.js
+++ b/packages/inter-protocol/src/proposals/econ-behaviors.js
@@ -1,9 +1,11 @@
// @jessie-check
+// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
import '../../exported.js';
+import '@agoric/governance/exported.js';
+import '@agoric/vats/src/core/types-ambient.js';
import { AmountMath } from '@agoric/ertp';
-import '@agoric/governance/exported.js';
import { deeplyFulfilledObject, makeTracer } from '@agoric/internal';
import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js';
import { E } from '@endo/far';
diff --git a/packages/inter-protocol/src/provisionPoolKit.js b/packages/inter-protocol/src/provisionPoolKit.js
index 7e2ee30f192..179c562b281 100644
--- a/packages/inter-protocol/src/provisionPoolKit.js
+++ b/packages/inter-protocol/src/provisionPoolKit.js
@@ -26,6 +26,7 @@ const { details: X, quote: q, Fail } = assert;
/**
* @import {ERef} from '@endo/far'
* @import {Amount} from '@agoric/ertp/src/types.js'
+ * @import {Bank, BankManager} from '@agoric/vats/src/vat-bank.js'
*/
/**
@@ -59,7 +60,6 @@ const { details: X, quote: q, Fail } = assert;
*
* @param {(depositBank: ERef) => Promise} sendInitialPayment
* @param {() => void} onProvisioned
- * @import {Bank} from '@agoric/vats/src/vat-bank.js'
*/
export const makeBridgeProvisionTool = (sendInitialPayment, onProvisioned) => {
/** @param {ProvisionPoolKitReferences} refs */
diff --git a/packages/inter-protocol/src/psm/psm.js b/packages/inter-protocol/src/psm/psm.js
index 6fb61a83ffd..fbd44b7d496 100644
--- a/packages/inter-protocol/src/psm/psm.js
+++ b/packages/inter-protocol/src/psm/psm.js
@@ -1,5 +1,6 @@
// @jessie-check
+// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
import '@agoric/governance/exported.js';
import '@agoric/zoe/exported.js';
import '@agoric/zoe/src/contracts/exported.js';
diff --git a/packages/inter-protocol/src/vaultFactory/burn.js b/packages/inter-protocol/src/vaultFactory/burn.js
index 9cfc83b7f7a..c8e5aee9f48 100644
--- a/packages/inter-protocol/src/vaultFactory/burn.js
+++ b/packages/inter-protocol/src/vaultFactory/burn.js
@@ -1,5 +1,6 @@
// @jessie-check
+// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
import '@agoric/zoe/exported.js';
import { E } from '@endo/eventual-send';
diff --git a/packages/inter-protocol/src/vaultFactory/vault.js b/packages/inter-protocol/src/vaultFactory/vault.js
index fe303209988..17ee452ccc7 100644
--- a/packages/inter-protocol/src/vaultFactory/vault.js
+++ b/packages/inter-protocol/src/vaultFactory/vault.js
@@ -13,6 +13,7 @@ import { calculateCurrentDebt, reverseInterest } from '../interest-math.js';
import { calculateDebtCosts } from './math.js';
import { prepareVaultKit } from './vaultKit.js';
+// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
import '@agoric/zoe/exported.js';
const { quote: q, Fail } = assert;
diff --git a/packages/inter-protocol/src/vaultFactory/vaultFactory.js b/packages/inter-protocol/src/vaultFactory/vaultFactory.js
index 3627675c8a9..e7ae15ff652 100644
--- a/packages/inter-protocol/src/vaultFactory/vaultFactory.js
+++ b/packages/inter-protocol/src/vaultFactory/vaultFactory.js
@@ -1,5 +1,6 @@
// @jessie-check
+// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
import '@agoric/governance/exported.js';
import '@agoric/zoe/exported.js';
import '@agoric/zoe/src/contracts/exported.js';
diff --git a/packages/internal/exported.d.ts b/packages/internal/exported.d.ts
new file mode 100644
index 00000000000..043f11db074
--- /dev/null
+++ b/packages/internal/exported.d.ts
@@ -0,0 +1,27 @@
+/** @file Ambient exports until https://github.com/Agoric/agoric-sdk/issues/6512 */
+/** @see {@link /docs/typescript.md} */
+/* eslint-disable -- doesn't understand .d.ts */
+import { ERef as _ERef } from '@endo/far';
+import { Passable as _Passable } from '@endo/pass-style';
+import {
+ PromiseKit as _PromiseKit,
+ PromiseRecord as _PromiseRecord,
+} from '@endo/promise-kit';
+import {
+ Marshaller as _Marshaller,
+ StorageNode as _StorageNode,
+ Unserializer as _Unserializer,
+ VStorageKey as _VStorageKey,
+} from './src/lib-chainStorage.js';
+
+declare global {
+ export {
+ _ERef as ERef,
+ _Marshaller as Marshaller,
+ _PromiseKit as PromiseKit,
+ _PromiseRecord as PromiseRecord,
+ _StorageNode as StorageNode,
+ _Unserializer as Unserializer,
+ _VStorageKey as VStorageKey,
+ };
+}
diff --git a/packages/internal/exported.js b/packages/internal/exported.js
new file mode 100644
index 00000000000..ff54cc24a93
--- /dev/null
+++ b/packages/internal/exported.js
@@ -0,0 +1,2 @@
+// Dummy file for .d.ts twin to declare ambients
+export {};
diff --git a/packages/internal/package.json b/packages/internal/package.json
index 6d6401f8284..b07150362f0 100755
--- a/packages/internal/package.json
+++ b/packages/internal/package.json
@@ -26,6 +26,7 @@
"@endo/far": "^1.1.1",
"@endo/init": "^1.1.1",
"@endo/marshal": "^1.4.1",
+ "@endo/pass-style": "^1.3.1",
"@endo/patterns": "^1.3.1",
"@endo/promise-kit": "^1.1.1",
"@endo/stream": "^1.2.1",
@@ -45,7 +46,8 @@
"author": "Agoric",
"license": "Apache-2.0",
"files": [
- "src"
+ "src",
+ "exported.js"
],
"publishConfig": {
"access": "public"
diff --git a/packages/internal/src/netstring.js b/packages/internal/src/netstring.js
index 1e938bd3507..dffb05f58b1 100644
--- a/packages/internal/src/netstring.js
+++ b/packages/internal/src/netstring.js
@@ -43,10 +43,13 @@ export function netstringEncoderStream() {
return new Transform({ transform, writableObjectMode: true });
}
-// Input is a Buffer containing zero or more netstrings and maybe some
-// leftover bytes. Output is zero or more decoded Buffers, one per netstring,
-// plus a Buffer of leftover bytes.
-//
+/**
+ *
+ * @param {Buffer} data containing zero or more netstrings and maybe some
+ * leftover bytes
+ * @param {number} [optMaxChunkSize]
+ * @returns {{ leftover: Buffer, payloads: Buffer[] }} zero or more decoded Buffers, one per netstring,
+ */
export function decode(data, optMaxChunkSize) {
// TODO: it would be more efficient to accumulate pending data in an array,
// rather than doing a concat each time
@@ -81,6 +84,11 @@ export function decode(data, optMaxChunkSize) {
return { leftover, payloads };
}
+/**
+ *
+ * @param {number} [optMaxChunkSize ]
+ * @returns {Transform}
+ */
// input is a byte pipe, output is a sequence of Buffers
export function netstringDecoderStream(optMaxChunkSize) {
let buffered = Buffer.from('');
diff --git a/packages/network/src/bytes.js b/packages/network/src/bytes.js
index f37082127bc..547d0dd5cd8 100644
--- a/packages/network/src/bytes.js
+++ b/packages/network/src/bytes.js
@@ -3,6 +3,10 @@
import { Fail } from '@agoric/assert';
import { encodeBase64, decodeBase64 } from '@endo/base64';
+/**
+ * @import {Bytes} from './types.js';
+ */
+
/** @typedef {Bytes | Buffer | Uint8Array | Iterable} ByteSource */
/**
diff --git a/packages/network/src/index.js b/packages/network/src/index.js
index 2bf1e45eacd..794df3a6b79 100644
--- a/packages/network/src/index.js
+++ b/packages/network/src/index.js
@@ -3,3 +3,5 @@ export * from './shapes.js';
export { prepareRouter, prepareRouterProtocol } from './router.js';
export * from './multiaddr.js';
export * from './bytes.js';
+// eslint-disable-next-line import/export -- doesn't know types
+export * from './types.js';
diff --git a/packages/network/src/network.js b/packages/network/src/network.js
index 2a09b56b33e..a5d4136ae10 100644
--- a/packages/network/src/network.js
+++ b/packages/network/src/network.js
@@ -8,6 +8,9 @@ import { Shape } from './shapes.js';
import '@agoric/store/exported.js';
///
+/**
+ * @import {AttemptDescription, Bytes, Closable, CloseReason, Connection, ConnectionHandler, Endpoint, ListenHandler, Port, Protocol, ProtocolHandler, ProtocolImpl} from './types.js';
+ */
/**
* Compatibility note: this must match what our peers use, so don't change it
@@ -409,7 +412,7 @@ const preparePort = (zone, powers) => {
* @param {MapStore>} opts.currentConnections
* @param {MapStore} opts.boundPorts
* @param {import('@agoric/vow').Remote} opts.protocolHandler
- * @param {Remote} opts.protocolImpl
+ * @param {import('@agoric/vow').Remote} opts.protocolImpl
*/
const initPort = ({
localAddr,
@@ -454,7 +457,9 @@ const preparePort = (zone, powers) => {
}
listening.set(localAddr, [
this.facets.port,
- /** @type {Remote>} */ (listenHandler),
+ /** @type {import('@agoric/vow').Remote>} */ (
+ listenHandler
+ ),
]);
E(lhandler).onRemove(lport, lhandler).catch(rethrowUnlessMissing);
} else {
@@ -462,7 +467,9 @@ const preparePort = (zone, powers) => {
localAddr,
harden([
this.facets.port,
- /** @type {Remote>} */ (listenHandler),
+ /** @type {import('@agoric/vow').Remote>} */ (
+ listenHandler
+ ),
]),
);
}
@@ -481,7 +488,7 @@ const preparePort = (zone, powers) => {
);
return watch(innerVow, this.facets.rethrowUnlessMissingWatcher);
},
- /** @param {Remote} listenHandler */
+ /** @param {import('@agoric/vow').Remote} listenHandler */
async removeListener(listenHandler) {
const { listening, localAddr, protocolHandler } = this.state;
listening.has(localAddr) || Fail`Port ${localAddr} is not listening`;
@@ -503,11 +510,11 @@ const preparePort = (zone, powers) => {
},
/**
* @param {Endpoint} remotePort
- * @param {Remote} [connectionHandler]
+ * @param {import('@agoric/vow').Remote} [connectionHandler]
*/
async connect(
remotePort,
- connectionHandler = /** @type {Remote} */ (
+ connectionHandler = /** @type {import('@agoric/vow').Remote} */ (
makeIncapable()
),
) {
@@ -724,8 +731,8 @@ const prepareBinder = (zone, powers) => {
* @param {object} opts
* @param {MapStore>} opts.currentConnections
* @param {MapStore} opts.boundPorts
- * @param {MapStore>]>} opts.listening
- * @param {Remote} opts.protocolHandler
+ * @param {MapStore>]>} opts.listening
+ * @param {import('@agoric/vow').Remote} opts.protocolHandler
*/
({ currentConnections, boundPorts, listening, protocolHandler }) => {
/** @type {SetStore} */
@@ -771,7 +778,7 @@ const prepareBinder = (zone, powers) => {
const innerVow = watch(
E(
- /** @type {Remote>} */ (
+ /** @type {import('@agoric/vow').Remote>} */ (
protocolHandler
),
).onInstantiate(
@@ -813,7 +820,7 @@ const prepareBinder = (zone, powers) => {
// Allocate a local address.
const instantiateInnerVow = watch(
E(
- /** @type {Remote>} */ (
+ /** @type {import('@agoric/vow').Remote>} */ (
protocolHandler
),
).onInstantiate(port, localAddr, remoteAddr, protocolHandler),
@@ -939,7 +946,7 @@ const prepareBinder = (zone, powers) => {
const innerVow = watch(
E(
- /** @type {Remote>} */ (
+ /** @type {import('@agoric/vow').Remote>} */ (
protocolHandler
),
).onInstantiate(
@@ -1169,7 +1176,7 @@ export const prepareNetworkProtocol = (zone, powers) => {
const makeBinderKit = prepareBinder(zone, powers);
/**
- * @param {Remote} protocolHandler
+ * @param {import('@agoric/vow').Remote} protocolHandler
* @returns {Protocol}
*/
const makeNetworkProtocol = protocolHandler => {
@@ -1181,7 +1188,7 @@ export const prepareNetworkProtocol = (zone, powers) => {
/** @type {MapStore} */
const boundPorts = detached.mapStore('addrToPort');
- /** @type {MapStore>]>} */
+ /** @type {MapStore>]>} */
const listening = detached.mapStore('listening');
const { binder, protocolImpl } = makeBinderKit({
@@ -1293,7 +1300,7 @@ export function prepareLoopbackProtocolHandler(zone, { watch, allVows }) {
/** @param {string} [instancePrefix] */
const initHandler = (instancePrefix = 'nonce/') => {
- /** @type {MapStore, Remote>]>} */
+ /** @type {MapStore, import('@agoric/vow').Remote>]>} */
const listeners = detached.mapStore('localAddr');
return {
@@ -1325,7 +1332,7 @@ export function prepareLoopbackProtocolHandler(zone, { watch, allVows }) {
* @param {*} _port
* @param {Endpoint} localAddr
* @param {Endpoint} remoteAddr
- * @returns {PromiseVow}}
+ * @returns {import('@agoric/vow').PromiseVow}}
*/
async onConnect(_port, localAddr, remoteAddr) {
const { listeners } = this.state;
@@ -1372,7 +1379,7 @@ export function prepareLoopbackProtocolHandler(zone, { watch, allVows }) {
localAddr,
harden([
port,
- /** @type {Remote>} */ (
+ /** @type {import('@agoric/vow').Remote>} */ (
listenHandler
),
]),
@@ -1383,15 +1390,17 @@ export function prepareLoopbackProtocolHandler(zone, { watch, allVows }) {
localAddr,
harden([
port,
- /** @type {Remote>} */ (listenHandler),
+ /** @type {import('@agoric/vow').Remote>} */ (
+ listenHandler
+ ),
]),
);
}
},
/**
- * @param {Remote} port
+ * @param {import('@agoric/vow').Remote} port
* @param {Endpoint} localAddr
- * @param {Remote} listenHandler
+ * @param {import('@agoric/vow').Remote} listenHandler
* @param {*} _protocolHandler
*/
async onListenRemove(port, localAddr, listenHandler, _protocolHandler) {
diff --git a/packages/network/src/router.js b/packages/network/src/router.js
index 919e1fe8fbf..477a23f4f35 100644
--- a/packages/network/src/router.js
+++ b/packages/network/src/router.js
@@ -5,8 +5,13 @@ import { Fail } from '@agoric/assert';
import { ENDPOINT_SEPARATOR, prepareNetworkProtocol } from './network.js';
import { Shape } from './shapes.js';
+// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
import '@agoric/store/exported.js';
///
+/**
+ * @import {AttemptDescription, Bytes, Closable, CloseReason, Connection, ConnectionHandler, Endpoint, ListenHandler, Port, Protocol, ProtocolHandler, ProtocolImpl} from './types.js';
+ * @import {PromiseVow, Remote, VowKit, VowResolver, VowTools} from '@agoric/vow';
+ */
/**
* @template T
diff --git a/packages/network/src/types.js b/packages/network/src/types.js
index 43e0e90c366..204a8a4fcaf 100644
--- a/packages/network/src/types.js
+++ b/packages/network/src/types.js
@@ -1,5 +1,8 @@
// @ts-check
+// Ensure this is a module.
+export {};
+
/** @import {PromiseVow, Remote} from '@agoric/vow' */
/**
diff --git a/packages/network/test/test-network-misc.js b/packages/network/test/test-network-misc.js
index 9c23e443b4d..e406e720f16 100644
--- a/packages/network/test/test-network-misc.js
+++ b/packages/network/test/test-network-misc.js
@@ -17,7 +17,9 @@ import {
preparePortAllocator,
} from '../src/index.js';
-import '../src/types.js';
+/**
+ * @import {ListenHandler} from '../src/types.js';
+ */
// eslint-disable-next-line no-constant-condition
const log = false ? console.log : () => {};
diff --git a/packages/notifier/exported.d.ts b/packages/notifier/exported.d.ts
new file mode 100644
index 00000000000..4709364a419
--- /dev/null
+++ b/packages/notifier/exported.d.ts
@@ -0,0 +1,42 @@
+/** @file Ambient exports until https://github.com/Agoric/agoric-sdk/issues/6512 */
+/** @see {@link /docs/typescript.md} */
+/* eslint-disable -- doesn't understand .d.ts */
+import {
+ EachTopic as _EachTopic,
+ IterableEachTopic as _IterableEachTopic,
+ IterationObserver as _IterationObserver,
+ LatestTopic as _LatestTopic,
+ Notifier as _Notifier,
+ NotifierRecord as _NotifierRecord,
+ PublicationRecord as _PublicationRecord,
+ Publisher as _Publisher,
+ PublishKit as _PublishKit,
+ StoredPublishKit as _StoredPublishKit,
+ StoredSubscriber as _StoredSubscriber,
+ StoredSubscription as _StoredSubscription,
+ Subscriber as _Subscriber,
+ Subscription as _Subscription,
+ SubscriptionRecord as _SubscriptionRecord,
+ UpdateRecord as _UpdateRecord,
+} from './src/types.js';
+
+declare global {
+ export {
+ _EachTopic as EachTopic,
+ _IterableEachTopic as IterableEachTopic,
+ _IterationObserver as IterationObserver,
+ _LatestTopic as LatestTopic,
+ _Notifier as Notifier,
+ _NotifierRecord as NotifierRecord,
+ _PublicationRecord as PublicationRecord,
+ _Publisher as Publisher,
+ _PublishKit as PublishKit,
+ _StoredPublishKit as StoredPublishKit,
+ _StoredSubscriber as StoredSubscriber,
+ _StoredSubscription as StoredSubscription,
+ _Subscriber as Subscriber,
+ _Subscription as Subscription,
+ _SubscriptionRecord as SubscriptionRecord,
+ _UpdateRecord as UpdateRecord,
+ };
+}
diff --git a/packages/notifier/exported.js b/packages/notifier/exported.js
index c320ce55c37..ff54cc24a93 100644
--- a/packages/notifier/exported.js
+++ b/packages/notifier/exported.js
@@ -1,3 +1,2 @@
-// @jessie-check
-
-import './src/types-ambient.js';
+// Dummy file for .d.ts twin to declare ambients
+export {};
diff --git a/packages/notifier/package.json b/packages/notifier/package.json
index 0953a2e5ce4..df54287d709 100644
--- a/packages/notifier/package.json
+++ b/packages/notifier/package.json
@@ -9,7 +9,7 @@
},
"scripts": {
"build": "exit 0",
- "prepack": "echo \"export {}; \" | cat - src/types-ambient.js > src/types.js && tsc --build tsconfig.build.json",
+ "prepack": "tsc --build tsconfig.build.json",
"postpack": "git clean -f '*.d.ts*' src/types.js",
"test": "ava",
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js",
diff --git a/packages/notifier/src/asyncIterableAdaptor.js b/packages/notifier/src/asyncIterableAdaptor.js
index b8ab685496d..65e266e2baf 100644
--- a/packages/notifier/src/asyncIterableAdaptor.js
+++ b/packages/notifier/src/asyncIterableAdaptor.js
@@ -3,7 +3,10 @@
import { E } from '@endo/far';
import { subscribeLatest } from './subscribe.js';
-import './types-ambient.js';
+/**
+ * @import {ERef} from '@endo/far';
+ * @import {BaseNotifier, IterationObserver, LatestTopic} from '../src/types.js';
+ */
/**
* @deprecated Use `subscribeLatest` from `@agoric/notifier/subscribe.js` instead.
diff --git a/packages/notifier/src/index.js b/packages/notifier/src/index.js
index 6374f5c7b18..2a5f7fd6723 100644
--- a/packages/notifier/src/index.js
+++ b/packages/notifier/src/index.js
@@ -1,5 +1,8 @@
// @jessie-check
+// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
+import '@agoric/internal/exported.js';
+
export {
makePublishKit,
prepareDurablePublishKit,
@@ -26,3 +29,6 @@ export {
} from './asyncIterableAdaptor.js';
export * from './storesub.js';
export * from './stored-notifier.js';
+
+// eslint-disable-next-line import/export -- doesn't know types
+export * from './types.js';
diff --git a/packages/notifier/src/notifier.js b/packages/notifier/src/notifier.js
index 7dab8342038..f2f50d4ea05 100644
--- a/packages/notifier/src/notifier.js
+++ b/packages/notifier/src/notifier.js
@@ -3,10 +3,13 @@
import { assert } from '@agoric/assert';
import { E, Far } from '@endo/far';
-import './types-ambient.js';
import { makePublishKit } from './publish-kit.js';
import { subscribeLatest } from './subscribe.js';
+/**
+ * @import {LatestTopic, Notifier, NotifierRecord, PublishKit, Subscriber, UpdateRecord} from './types.js';
+ */
+
/**
* @template T
* @param {ERef>} sharableInternalsP
diff --git a/packages/notifier/src/publish-kit.js b/packages/notifier/src/publish-kit.js
index e3ab7496c68..7efff5b45df 100644
--- a/packages/notifier/src/publish-kit.js
+++ b/packages/notifier/src/publish-kit.js
@@ -5,7 +5,10 @@ import { E, Far } from '@endo/far';
import { M, getInterfaceGuardPayload } from '@endo/patterns';
import { makePromiseKit } from '@endo/promise-kit';
-import './types-ambient.js';
+/**
+ * @import {ERef} from '@endo/far';
+ * @import {DurablePublishKitState, DurablePublishKitValueDurability, LatestTopic, Notifier, NotifierRecord, PublicationRecord, Publisher, PublishKit, Subscriber, UpdateRecord} from '../src/types.js';
+ */
const { Fail, quote: q } = assert;
diff --git a/packages/notifier/src/stored-notifier.js b/packages/notifier/src/stored-notifier.js
index 24b639b89b1..ef36fd952c4 100644
--- a/packages/notifier/src/stored-notifier.js
+++ b/packages/notifier/src/stored-notifier.js
@@ -5,6 +5,12 @@ import { makeSerializeToStorage } from '@agoric/internal/src/lib-chainStorage.js
import { E, Far } from '@endo/far';
import { observeNotifier } from './asyncIterableAdaptor.js';
+/**
+ * @import {ERef} from '@endo/far';
+ * @import {BaseNotifier, Notifier} from './types.js';
+ * @import {Marshaller, StoredFacet, StorageNode, Unserializer} from '@agoric/internal/src/lib-chainStorage.js';
+ */
+
/**
* @template T
* @typedef {BaseNotifier & Omit} StoredNotifier
diff --git a/packages/notifier/src/storesub.js b/packages/notifier/src/storesub.js
index 3389b2b6cb9..bed0f4e9185 100644
--- a/packages/notifier/src/storesub.js
+++ b/packages/notifier/src/storesub.js
@@ -7,6 +7,12 @@ import { makePublishKit } from './publish-kit.js';
import { makeSubscriptionKit } from './subscriber.js';
import { subscribeEach } from './subscribe.js';
+/**
+ * @import {ERef} from '@endo/far';
+ * @import {IterationObserver, LatestTopic, Notifier, NotifierRecord, PublicationRecord, Publisher, PublishKit, StoredPublishKit, StoredSubscription, StoredSubscriber, Subscriber, Subscription, UpdateRecord} from '../src/types.js';
+ * @import {Marshaller, StorageNode, Unserializer} from '@agoric/internal/src/lib-chainStorage.js';
+ */
+
/**
* NB: does not yet survive upgrade https://github.com/Agoric/agoric-sdk/issues/6893
*
@@ -97,7 +103,7 @@ export const makeStoredSubscription = (
serializeBodyFormat: 'smallcaps',
}),
) => {
- /** @type {Unserializer} */
+ /** @type {import('@agoric/internal/src/lib-chainStorage.js').Unserializer} */
const unserializer = Far('unserializer', {
fromCapData: data => E(marshaller).fromCapData(data),
unserialize: data => E(marshaller).fromCapData(data),
diff --git a/packages/notifier/src/subscribe.js b/packages/notifier/src/subscribe.js
index e35fa153cfa..2265bb21fbb 100644
--- a/packages/notifier/src/subscribe.js
+++ b/packages/notifier/src/subscribe.js
@@ -2,7 +2,10 @@ import { E, Far } from '@endo/far';
import { isObject } from '@endo/marshal';
import { isUpgradeDisconnection } from '@agoric/internal/src/upgrade-api.js';
-import './types-ambient.js';
+/**
+ * @import {ERef} from '@endo/far';
+ * @import {IterationObserver, LatestTopic, Notifier, NotifierRecord, PublicationRecord, Publisher, PublishKit, StoredPublishKit, StoredSubscription, StoredSubscriber, Subscriber, Subscription, UpdateRecord, EachTopic, ForkableAsyncIterableIterator} from '../src/types.js';
+ */
const { details: X, Fail } = assert;
const sink = () => {};
@@ -50,7 +53,7 @@ const reconnectAsNeeded = async (getter, seed = []) => {
X`Attempting to recover from disconnection: ${disconnection}`,
);
} catch (_err) {
- // eslint-disable-next-line no-empty
+ // noop
}
}
throw err;
diff --git a/packages/notifier/src/subscriber.js b/packages/notifier/src/subscriber.js
index cafdad40877..6d33758754d 100644
--- a/packages/notifier/src/subscriber.js
+++ b/packages/notifier/src/subscriber.js
@@ -8,7 +8,9 @@ import { makePublishKit } from './publish-kit.js';
import { makePinnedHistoryTopic } from './topic.js';
-import './types-ambient.js';
+/**
+ * @import {EachTopic, IterationObserver, LatestTopic, Notifier, NotifierRecord, SubscriptionRecord, Publisher, PublishKit, StoredPublishKit, StoredSubscription, StoredSubscriber, Subscriber, Subscription, UpdateRecord} from '../src/types.js';
+ */
/**
* @template T
diff --git a/packages/notifier/src/topic.js b/packages/notifier/src/topic.js
index b8a7a575d39..a3a0c35747d 100644
--- a/packages/notifier/src/topic.js
+++ b/packages/notifier/src/topic.js
@@ -1,7 +1,10 @@
// @jessie-check
import { Far } from '@endo/far';
-import './types-ambient.js';
+
+/**
+ * @import {EachTopic, LatestTopic} from '../src/types.js';
+ */
/**
* @deprecated A pinned-history topic preserves all of its published values in
diff --git a/packages/notifier/src/types-ambient.js b/packages/notifier/src/types.js
similarity index 82%
rename from packages/notifier/src/types-ambient.js
rename to packages/notifier/src/types.js
index f1c070592f5..d8594fb07ee 100644
--- a/packages/notifier/src/types-ambient.js
+++ b/packages/notifier/src/types.js
@@ -1,11 +1,12 @@
// @jessie-check
-/** @import { ERef } from '@endo/far' */
-
/**
- * @import {PromiseKit, PromiseRecord} from '@endo/promise-kit'
+ * @import {StoredFacet, Unserializer} from '@agoric/internal/src/lib-chainStorage.js';
*/
+// Ensure this is a module.
+export {};
+
/**
* @template T
* @template [TReturn=any]
@@ -46,7 +47,7 @@
/**
* @template T
- * @typedef {object} IterationObserver
+ * @typedef {object} IterationObserver
* A valid sequence of calls to the methods of an `IterationObserver`
* represents an iteration. A valid sequence consists of any number of calls
* to `updateState` with the successive non-final values, followed by a
@@ -155,14 +156,14 @@
/**
* @template T
- * @typedef {object} PublishKit
+ * @typedef {object} PublishKit
* @property {Publisher} publisher
* @property {Subscriber} subscriber
*/
/**
* @template T
- * @typedef {object} StoredPublishKit
+ * @typedef {object} StoredPublishKit
* @property {Publisher} publisher
* @property {StoredSubscriber} subscriber
*/
@@ -210,7 +211,7 @@
/**
* @template T
- * @typedef {object} UpdateRecord
+ * @typedef {object} UpdateRecord
* @property {T} value is whatever state the service wants to publish
* @property {bigint} [updateCount] is a value that identifies the update. For
* the last update, it is `undefined`.
@@ -228,7 +229,7 @@
* @typedef {NotifierInternals &
* ForkableAsyncIterable &
* SharableNotifier
- * } Notifier an object that can be used to get the current state or updates
+ * } Notifier an object that can be used to get the current state or updates
*/
/**
@@ -247,7 +248,7 @@
/**
* @template T
- * @typedef {object} NotifierRecord the produced notifier/updater pair
+ * @typedef {object} NotifierRecord the produced notifier/updater pair
* @property {IterationObserver} updater the (closely-held) notifier producer
* @property {Notifier} notifier the (widely-held) notifier consumer
*/
@@ -257,7 +258,7 @@
/**
* @template T
* @typedef {IterableEachTopic & EachTopic &
- * SharableSubscription} Subscription
+ * SharableSubscription} Subscription
* A form of AsyncIterable supporting distributed and multicast usage.
*/
@@ -277,49 +278,13 @@
/**
* @template T
- * @typedef {object} SubscriptionRecord
+ * @typedef {object} SubscriptionRecord
* @property {IterationObserver} publication
* @property {Subscription} subscription
*/
// /////////////////////////////////////////////////////////////////////////////
-/** @template [Slot=unknown] @typedef {import('@endo/marshal').Marshal} Marshaller */
-/** @typedef {Pick} Unserializer */
-
-/**
- * Defined by vstorageStoreKey in vstorage.go
- *
- * @typedef VStorageKey
- * @property {string} storeName
- * @property {string} storeSubkey
- * @property {string} dataPrefixBytes
- * @property {string} [noDataValue]
- */
-
-/**
- * This represents a node in an IAVL tree.
- *
- * The active implementation is x/vstorage, an Agoric extension of the Cosmos SDK.
- *
- * Vstorage is a hierarchical externally-reachable storage structure that
- * identifies children by restricted ASCII name and is associated with arbitrary
- * string-valued data for each node, defaulting to the empty string.
- *
- * @typedef {object} StorageNode
- * @property {(data: string) => Promise} setValue publishes some data (append to the node)
- * @property {() => string} getPath the chain storage path at which the node was constructed
- * @property {() => Promise} getStoreKey DEPRECATED use getPath
- * @property {(subPath: string, options?: {sequence?: boolean}) => StorageNode} makeChildNode
- */
-
-/**
- * @typedef {object} StoredFacet
- * @property {() => Promise} getPath the chain storage path at which the node was constructed
- * @property {StorageNode['getStoreKey']} getStoreKey DEPRECATED use getPath
- * @property {() => Unserializer} getUnserializer get the unserializer for the stored data
- */
-
/**
* @deprecated use StoredSubscriber
* @template T
diff --git a/packages/notifier/test/iterable-testing-tools.js b/packages/notifier/test/iterable-testing-tools.js
index 4bde033fb7c..6849cd80704 100644
--- a/packages/notifier/test/iterable-testing-tools.js
+++ b/packages/notifier/test/iterable-testing-tools.js
@@ -2,7 +2,11 @@ import { E } from '@endo/far';
import { makePromiseKit } from '@endo/promise-kit';
import { observeIteration, observeIterator } from '../src/index.js';
-import '../src/types-ambient.js';
+/**
+ * @import {ERef} from '@endo/far';
+ * @import {BaseNotifier, ForkableAsyncIterator, IterationObserver, Notifier, StoredFacet, Subscription} from '../src/types.js';
+ * @import {PromiseKit} from '@endo/promise-kit';
+ */
export const invertPromiseSettlement = promise =>
promise.then(
diff --git a/packages/notifier/test/test-notifier-examples.js b/packages/notifier/test/test-notifier-examples.js
index c734ed81d44..296cd95819f 100644
--- a/packages/notifier/test/test-notifier-examples.js
+++ b/packages/notifier/test/test-notifier-examples.js
@@ -9,7 +9,7 @@ import {
} from '../src/index.js';
import { paula, alice, bob } from './iterable-testing-tools.js';
-import '../src/types-ambient.js';
+import '../src/types.js';
const last = array => array[array.length - 1];
diff --git a/packages/notifier/test/test-notifier.js b/packages/notifier/test/test-notifier.js
index 18fc62d567d..0d5bac94f98 100644
--- a/packages/notifier/test/test-notifier.js
+++ b/packages/notifier/test/test-notifier.js
@@ -1,6 +1,9 @@
import { test } from './prepare-test-env-ava.js';
import { makeNotifierKit } from '../src/index.js';
-import '../src/types-ambient.js';
+
+/**
+ * @import {IterationObserver, LatestTopic, Notifier, NotifierRecord, PublicationRecord, Publisher, PublishKit, StoredPublishKit, StoredSubscription, StoredSubscriber, Subscriber, Subscription, UpdateRecord} from '../src/types.js';
+ */
test('notifier - initial state', async t => {
/** @type {NotifierRecord<1>} */
diff --git a/packages/notifier/test/test-publish-kit.js b/packages/notifier/test/test-publish-kit.js
index f87d0ae9a41..8f931b934c9 100644
--- a/packages/notifier/test/test-publish-kit.js
+++ b/packages/notifier/test/test-publish-kit.js
@@ -17,10 +17,13 @@ import {
subscribeLatest,
prepareDurablePublishKit,
} from '../src/index.js';
-import '../src/types-ambient.js';
+import '../src/types.js';
import { invertPromiseSettlement } from './iterable-testing-tools.js';
-/** @import {makePublishKit as MakePublishKit} from '../src/index.js' */
+/**
+ * @import {makePublishKit as MakePublishKit} from '../src/index.js';
+ * @import {PublicationRecord} from '../src/types.js';
+ */
const { ownKeys } = Reflect;
const { quote: q } = assert;
diff --git a/packages/notifier/test/test-stored-subscription.js b/packages/notifier/test/test-stored-subscription.js
index 7b21545ae9a..a334ea6cd77 100644
--- a/packages/notifier/test/test-stored-subscription.js
+++ b/packages/notifier/test/test-stored-subscription.js
@@ -17,7 +17,6 @@ import {
makeFakeMarshaller,
} from '../tools/testSupports.js';
-import '../src/types-ambient.js';
import { jsonPairs } from './marshal-corpus.js';
test('stored subscription', async t => {
diff --git a/packages/notifier/test/test-subscriber-examples.js b/packages/notifier/test/test-subscriber-examples.js
index 9ee099d2426..4bac5c2bb25 100644
--- a/packages/notifier/test/test-subscriber-examples.js
+++ b/packages/notifier/test/test-subscriber-examples.js
@@ -9,7 +9,7 @@ import {
} from '../src/index.js';
import { paula, alice, bob, carol } from './iterable-testing-tools.js';
-import '../src/types-ambient.js';
+import '../src/types.js';
test('subscription for-await-of success example', async t => {
const { publication, subscription } = makeSubscriptionKit();
diff --git a/packages/notifier/tools/testSupports.js b/packages/notifier/tools/testSupports.js
index d8f7ce05719..c89ccd438e8 100644
--- a/packages/notifier/tools/testSupports.js
+++ b/packages/notifier/tools/testSupports.js
@@ -1,6 +1,9 @@
import { Far, makeMarshal } from '@endo/marshal';
-import '../src/types-ambient.js';
+/**
+ * @import {IterationObserver} from '../src/types.js';
+ * @import {StorageNode} from '@agoric/internal/src/lib-chainStorage.js';
+ */
export { eventLoopIteration } from '@agoric/internal/src/testing-utils.js';
diff --git a/packages/notifier/tsconfig.json b/packages/notifier/tsconfig.json
index fcd55e9a555..1e246e687b1 100644
--- a/packages/notifier/tsconfig.json
+++ b/packages/notifier/tsconfig.json
@@ -6,7 +6,7 @@
},
"include": [
"src/**/*.js",
- "*.js",
+ // exclude exported.js so that stub doesn't overwrite exportd.d.ts
"test/**/*.js",
"tools/**/*.js",
],
diff --git a/packages/orchestration/src/proposals/orchestration-proposal.js b/packages/orchestration/src/proposals/orchestration-proposal.js
index c889383bcda..c48eb0a4ef6 100644
--- a/packages/orchestration/src/proposals/orchestration-proposal.js
+++ b/packages/orchestration/src/proposals/orchestration-proposal.js
@@ -2,6 +2,7 @@
import { V as E } from '@agoric/vat-data/vow.js';
/**
+ * @import {Connection, Port, PortAllocator} from '@agoric/network';
* @import { OrchestrationService } from '../service.js'
* @import { OrchestrationVat } from '../vat-orchestration.js'
*/
diff --git a/packages/orchestration/src/service.js b/packages/orchestration/src/service.js
index ced55999021..a4443dd665d 100644
--- a/packages/orchestration/src/service.js
+++ b/packages/orchestration/src/service.js
@@ -2,7 +2,10 @@
/** @file Orchestration service */
import { NonNullish } from '@agoric/assert';
import { makeTracer } from '@agoric/internal';
+
+// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
import '@agoric/network/exported.js';
+
import { V as E } from '@agoric/vat-data/vow.js';
import { M } from '@endo/patterns';
import { PaymentShape, PurseShape } from '@agoric/ertp';
@@ -11,11 +14,12 @@ import { makeICAConnectionAddress, parseAddress } from './utils/address.js';
import { makeTxPacket, parsePacketAck } from './utils/tx.js';
/**
- * @import { ChainAccount, ChainAddress } from './types.js';
+ * @import {Connection, Port, PortAllocator} from '@agoric/network';
+ * @import {Remote} from '@agoric/vow';
* @import { IBCConnectionID } from '@agoric/vats';
* @import { Zone } from '@agoric/base-zone';
* @import { TxBody } from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
- *
+ * @import { AttenuatedNetwork, ChainAccount, ChainAddress } from './types.js';
*/
const { Fail, bare } = assert;
diff --git a/packages/pegasus/src/courier.js b/packages/pegasus/src/courier.js
index 8ddd587ccfc..59eed5b1858 100644
--- a/packages/pegasus/src/courier.js
+++ b/packages/pegasus/src/courier.js
@@ -8,6 +8,8 @@ import { makeOncePromiseKit } from './once-promise-kit.js';
/**
* @import {DepositFacet} from '@agoric/ertp/exported.js'
+ * @import {Connection} from '@agoric/network';
+ * @import {Remote} from '@agoric/vow';
*/
/**
diff --git a/packages/pegasus/src/pegasus.js b/packages/pegasus/src/pegasus.js
index b9ca77220fb..649eb4d40e7 100644
--- a/packages/pegasus/src/pegasus.js
+++ b/packages/pegasus/src/pegasus.js
@@ -17,6 +17,11 @@ import { IBCSourceTraceDenomTransformer } from './ibc-trace.js';
import { ICS20TransferProtocol } from './ics20.js';
import { makeCourierMaker, getCourierPK } from './courier.js';
+/**
+ * @import {CloseReason, Connection} from '@agoric/network';
+ * @import {Remote} from '@agoric/vow';
+ */
+
const DEFAULT_DENOM_TRANSFORMER = IBCSourceTraceDenomTransformer;
const DEFAULT_TRANSFER_PROTOCOL = ICS20TransferProtocol;
diff --git a/packages/pegasus/src/proposals/core-proposal.js b/packages/pegasus/src/proposals/core-proposal.js
index dde255ccad1..0bbfe5f71b3 100644
--- a/packages/pegasus/src/proposals/core-proposal.js
+++ b/packages/pegasus/src/proposals/core-proposal.js
@@ -3,6 +3,10 @@ import { E, Far } from '@endo/far';
import { makeNameHubKit } from '@agoric/vats/src/nameHub.js';
import { observeIteration, subscribeEach } from '@agoric/notifier';
+/**
+ * @import {Connection, Port, PortAllocator} from '@agoric/network';
+ */
+
export const CONTRACT_NAME = 'Pegasus';
const t = 'pegasus';
diff --git a/packages/pegasus/src/types.js b/packages/pegasus/src/types.js
index 0747712963b..921139ce8f8 100644
--- a/packages/pegasus/src/types.js
+++ b/packages/pegasus/src/types.js
@@ -1,6 +1,9 @@
// @ts-check
///
+/**
+ * @import {Bytes, ConnectionHandler} from '@agoric/network';
+ */
/**
* @typedef {string} Denom
diff --git a/packages/smart-wallet/src/invitations.js b/packages/smart-wallet/src/invitations.js
index 5acd5e7d428..34d34a6d872 100644
--- a/packages/smart-wallet/src/invitations.js
+++ b/packages/smart-wallet/src/invitations.js
@@ -4,6 +4,9 @@ import { InvitationHandleShape } from '@agoric/zoe/src/typeGuards.js';
import { E } from '@endo/far';
import { shape } from './typeGuards.js';
+// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
+import '@agoric/zoe/exported.js';
+
const { Fail } = assert;
// A safety limit
diff --git a/packages/smart-wallet/src/offers.js b/packages/smart-wallet/src/offers.js
index 6c78021ff9c..bd4b73c0f01 100644
--- a/packages/smart-wallet/src/offers.js
+++ b/packages/smart-wallet/src/offers.js
@@ -1,3 +1,6 @@
+// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
+import '@agoric/zoe/src/zoeService/types-ambient.js';
+
/**
* @typedef {number | string} OfferId
*/
diff --git a/packages/smart-wallet/src/proposals/upgrade-wallet-factory2-proposal.js b/packages/smart-wallet/src/proposals/upgrade-wallet-factory2-proposal.js
index 60252d54616..2ebb86e3fc5 100644
--- a/packages/smart-wallet/src/proposals/upgrade-wallet-factory2-proposal.js
+++ b/packages/smart-wallet/src/proposals/upgrade-wallet-factory2-proposal.js
@@ -2,6 +2,9 @@
import { E } from '@endo/far';
import { makeStorageNodeChild } from '@agoric/internal/src/lib-chainStorage.js';
+// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
+import '@agoric/vats/src/core/types-ambient.js';
+
/**
* @param {BootstrapPowers & ChainBootstrapSpace} powers
* @param {object} options
diff --git a/packages/smart-wallet/src/smartWallet.js b/packages/smart-wallet/src/smartWallet.js
index 270edb892e0..9ef0da19135 100644
--- a/packages/smart-wallet/src/smartWallet.js
+++ b/packages/smart-wallet/src/smartWallet.js
@@ -42,6 +42,9 @@ import { shape } from './typeGuards.js';
import { objectMapStoragePath } from './utils.js';
import { prepareOfferWatcher, watchOfferOutcomes } from './offerWatcher.js';
+// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
+import '@agoric/zoe/exported.js';
+
const { Fail, quote: q } = assert;
const trace = makeTracer('SmrtWlt');
diff --git a/packages/smart-wallet/src/types.d.ts b/packages/smart-wallet/src/types.d.ts
index f12822df490..fbce32281a6 100644
--- a/packages/smart-wallet/src/types.d.ts
+++ b/packages/smart-wallet/src/types.d.ts
@@ -9,6 +9,7 @@ import type { ERef } from '@endo/far';
import type { CapData } from '@endo/marshal';
import type { agoric } from '@agoric/cosmic-proto';
import type { AgoricNamesRemotes } from '@agoric/vats/tools/board-utils.js';
+import type { StoredFacet } from '@agoric/internal/src/lib-chainStorage.js';
import type { OfferSpec } from './offers.js';
declare const CapDataShape: unique symbol;
diff --git a/packages/smart-wallet/src/utils.js b/packages/smart-wallet/src/utils.js
index 9740bda9405..39dee3cbbd2 100644
--- a/packages/smart-wallet/src/utils.js
+++ b/packages/smart-wallet/src/utils.js
@@ -2,6 +2,10 @@ import { deeplyFulfilledObject, objectMap, makeTracer } from '@agoric/internal';
import { observeIteration, subscribeEach } from '@agoric/notifier';
import { E } from '@endo/far';
+// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
+import '@agoric/internal/exported.js';
+import '@agoric/notifier/exported.js';
+
export const NO_SMART_WALLET_ERROR = 'no smart wallet';
const trace = makeTracer('WUTIL', false);
diff --git a/packages/smart-wallet/test/supports.js b/packages/smart-wallet/test/supports.js
index 867dfa5860f..429be3242db 100644
--- a/packages/smart-wallet/test/supports.js
+++ b/packages/smart-wallet/test/supports.js
@@ -18,6 +18,10 @@ import { makeRatio } from '@agoric/zoe/src/contractSupport/ratio.js';
import { setUpZoeForTest } from '@agoric/zoe/tools/setup-zoe.js';
import { E, Far } from '@endo/far';
+/**
+ * @import {StoredFacet} from '@agoric/internal/src/lib-chainStorage.js';
+ */
+
export { ActionType };
/**
diff --git a/packages/store/exported.d.ts b/packages/store/exported.d.ts
index eb3dc666582..09575b61327 100644
--- a/packages/store/exported.d.ts
+++ b/packages/store/exported.d.ts
@@ -1,12 +1,6 @@
+/** @file Ambient exports until https://github.com/Agoric/agoric-sdk/issues/6512 */
+/** @see {@link /docs/typescript.md} */
/* eslint-disable -- doesn't understand .d.ts */
-
-export * from './src/types.js';
-
-// XXX re-export types into global namespace, for consumers that expect these to
-// be ambient. Why the _ prefix? Because without it TS gets confused between the
-// import and export symbols. h/t https://stackoverflow.com/a/66588974
-// Note one big downside vs ambients is that these types will appear to be on `globalThis`.
-// UNTIL https://github.com/Agoric/agoric-sdk/issues/6512
import {
LegacyMap as _LegacyMap,
LegacyWeakMap as _LegacyWeakMap,
diff --git a/packages/store/src/index.js b/packages/store/src/index.js
index 92188765007..cbfe2aa7aa6 100755
--- a/packages/store/src/index.js
+++ b/packages/store/src/index.js
@@ -67,3 +67,5 @@ export {
export { makeLegacyMap } from './legacy/legacyMap.js';
export { makeLegacyWeakMap } from './legacy/legacyWeakMap.js';
+// eslint-disable-next-line import/export
+export * from './types.js';
diff --git a/packages/store/src/legacy/legacyMap.js b/packages/store/src/legacy/legacyMap.js
index 9b40a0f2492..6c07685c9fa 100644
--- a/packages/store/src/legacy/legacyMap.js
+++ b/packages/store/src/legacy/legacyMap.js
@@ -1,4 +1,4 @@
-import '../types.js';
+/** @import {LegacyMap, LegacyWeakMap} from '../types.js'; */
// TODO, once migrated to endo, import from @endo/errors instead
const { Fail, quote: q } = assert;
diff --git a/packages/store/src/legacy/legacyWeakMap.js b/packages/store/src/legacy/legacyWeakMap.js
index e7167137927..56ff91718b3 100644
--- a/packages/store/src/legacy/legacyWeakMap.js
+++ b/packages/store/src/legacy/legacyWeakMap.js
@@ -1,4 +1,4 @@
-import '../types.js';
+/** @import {LegacyWeakMap} from '../types.js'; */
// TODO, once migrated to endo, import from @endo/errors instead
const { Fail, quote: q } = assert;
diff --git a/packages/store/src/stores/scalarMapStore.js b/packages/store/src/stores/scalarMapStore.js
index 8560c65f4d0..63ee0354485 100644
--- a/packages/store/src/stores/scalarMapStore.js
+++ b/packages/store/src/stores/scalarMapStore.js
@@ -15,13 +15,14 @@ import {
import { makeWeakMapStoreMethods } from './scalarWeakMapStore.js';
import { makeCurrentKeysKit } from './store-utils.js';
-const { quote: q } = assert;
-
/**
- * @import {Passable} from '@endo/pass-style')
- * @import {Key} from '@endo/patterns')
+ * @import {Passable} from '@endo/pass-style');
+ * @import {Key, Pattern} from '@endo/patterns');
+ * @import {MapStore, StoreOptions} from '../types.js';
*/
+const { quote: q } = assert;
+
/**
* @template {Key} K
* @template {Passable} V
diff --git a/packages/store/src/stores/scalarSetStore.js b/packages/store/src/stores/scalarSetStore.js
index 11146e5f28c..e7698954cd9 100644
--- a/packages/store/src/stores/scalarSetStore.js
+++ b/packages/store/src/stores/scalarSetStore.js
@@ -10,6 +10,11 @@ import {
import { makeWeakSetStoreMethods } from './scalarWeakSetStore.js';
import { makeCurrentKeysKit } from './store-utils.js';
+/**
+ * @import {Key, Pattern} from '@endo/patterns');
+ * @import {SetStore, StoreOptions} from '../types.js';
+ */
+
const { quote: q } = assert;
/**
diff --git a/packages/store/src/stores/scalarWeakMapStore.js b/packages/store/src/stores/scalarWeakMapStore.js
index 1062ac554b8..ebfee6b9aa6 100644
--- a/packages/store/src/stores/scalarWeakMapStore.js
+++ b/packages/store/src/stores/scalarWeakMapStore.js
@@ -6,6 +6,8 @@ import {
isCopyMap,
} from '@endo/patterns';
+/** @import {WeakMapStore, StoreOptions} from '../types.js'; */
+
const { quote: q, Fail } = assert;
/**
diff --git a/packages/store/src/stores/scalarWeakSetStore.js b/packages/store/src/stores/scalarWeakSetStore.js
index 67cbb0dbcfa..8bc8cab8a9c 100644
--- a/packages/store/src/stores/scalarWeakSetStore.js
+++ b/packages/store/src/stores/scalarWeakSetStore.js
@@ -8,7 +8,7 @@ import {
const { quote: q, Fail } = assert;
-/** @import {WeakSetStore} from '@agoric/store/exported.js'; */
+/** @import {StoreOptions, WeakSetStore} from '@agoric/store'; */
/**
* @template K
diff --git a/packages/store/src/stores/store-utils.js b/packages/store/src/stores/store-utils.js
index 46ed412836b..953386589fd 100644
--- a/packages/store/src/stores/store-utils.js
+++ b/packages/store/src/stores/store-utils.js
@@ -1,6 +1,9 @@
import { Far } from '@endo/marshal';
-/** @import {RankCompare} from '@endo/marshal' */
+/**
+ * @import {RankCompare} from '@endo/marshal';
+ * @import {MapStore, WeakMapStore} from '../types.js';
+ */
const { Fail, quote: q } = assert;
diff --git a/packages/store/test/perf-patterns.js b/packages/store/test/perf-patterns.js
index 22ea462e3af..734560057fa 100644
--- a/packages/store/test/perf-patterns.js
+++ b/packages/store/test/perf-patterns.js
@@ -16,8 +16,10 @@ import {
PaymentShape,
ProposalShape,
} from './borrow-guards.js';
-import '../src/types.js';
-/** @import {Passable} from '@endo/pass-style' */
+/**
+ * @import {Passable} from '@endo/pass-style';
+ * @import {Pattern} from '@endo/patterns';
+ */
const gcAndFinalize = makeGcAndFinalize(engineGC);
diff --git a/packages/swingset-liveslots/src/index.js b/packages/swingset-liveslots/src/index.js
index 3139cc36d32..14f3b84af5d 100644
--- a/packages/swingset-liveslots/src/index.js
+++ b/packages/swingset-liveslots/src/index.js
@@ -1,3 +1,6 @@
+// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
+import '@agoric/store/exported.js';
+
/* eslint-disable import/export -- types files have no named runtime exports */
export { makeLiveSlots, makeMarshaller } from './liveslots.js';
diff --git a/packages/vat-data/src/vat-data-bindings.js b/packages/vat-data/src/vat-data-bindings.js
index b1fd9803391..39e3b5b759a 100644
--- a/packages/vat-data/src/vat-data-bindings.js
+++ b/packages/vat-data/src/vat-data-bindings.js
@@ -85,7 +85,7 @@ export const partialAssign = (target, source) => {
};
harden(partialAssign);
-/** @import {StoreOptions} from '@agoric/store/exported.js' */
+/** @import {StoreOptions} from '@agoric/store' */
/**
* Unlike `provideLazy`, `provide` should be called at most once
diff --git a/packages/vat-data/test/test-scalar-only-keys.js b/packages/vat-data/test/test-scalar-only-keys.js
index e3cebfaf941..179550ecb29 100644
--- a/packages/vat-data/test/test-scalar-only-keys.js
+++ b/packages/vat-data/test/test-scalar-only-keys.js
@@ -16,7 +16,7 @@ test('scalar maps should reject non-scalar keys', t => {
test('scalar big maps should reject non-scalar keys', t => {
const bigMap = makeScalarBigMapStore('dummy', { keyShape: M.key() });
- t.throws(() => bigMap.init(harden({ label: 'not a scalar' })), {
+ t.throws(() => bigMap.init(harden({ label: 'not a scalar' }), null), {
message:
/A "copyRecord" cannot be a scalar key: \{"label":"not a scalar"\}/,
});
diff --git a/packages/vats/src/ibc.js b/packages/vats/src/ibc.js
index a48718bc8cc..a1e0e1c9486 100644
--- a/packages/vats/src/ibc.js
+++ b/packages/vats/src/ibc.js
@@ -14,7 +14,10 @@ import {
encodeRemoteIbcAddress,
} from '../tools/ibc-utils.js';
-/** @import {LocalIbcAddress, RemoteIbcAddress} from '../tools/ibc-utils.js' */
+/**
+ * @import {LocalIbcAddress, RemoteIbcAddress} from '../tools/ibc-utils.js';
+ * @import {AttemptDescription} from '@agoric/network';
+ */
// CAVEAT: IBC acks cannot be empty, as the Cosmos IAVL tree cannot represent
// empty acknowledgements as distinct from unacknowledged packets.
@@ -24,9 +27,10 @@ const DEFAULT_ACKNOWLEDGEMENT = '\x00';
const DEFAULT_PACKET_TIMEOUT_NS = 60n * 60n * 1_000_000_000n;
/**
+ * @import {Endpoint, Connection, ConnectionHandler, InboundAttempt, Bytes, ProtocolHandler, ProtocolImpl} from '@agoric/network';
* @import {BridgeHandler, ScopedBridgeManager, ConnectingInfo, IBCChannelID, IBCChannelOrdering, IBCEvent, IBCPacket, IBCPortID, IBCDowncallPacket, IBCDowncallMethod, IBCDowncall, IBCBridgeEvent} from './types.js';
* @import {Zone} from '@agoric/base-zone';
- * @import {Remote, VowKit, VowResolver, VowTools} from '@agoric/vow';
+ * @import {PromiseVow, Remote, VowKit, VowResolver, VowTools} from '@agoric/vow';
*/
/** @typedef {VowKit} OnConnectP */
diff --git a/packages/vats/src/proposals/network-proposal.js b/packages/vats/src/proposals/network-proposal.js
index 7b88b855ae4..cd3f2587bb9 100644
--- a/packages/vats/src/proposals/network-proposal.js
+++ b/packages/vats/src/proposals/network-proposal.js
@@ -11,6 +11,11 @@ import { makeScalarBigMapStore } from '@agoric/vat-data';
// bootstrap vat can't yet be upgraded.
import { when } from '@agoric/vat-data/vow.js';
+/**
+ * @import {ProtocolHandler} from '@agoric/network';
+ * @import {Remote} from '@agoric/vow';
+ */
+
const NUM_IBC_PORTS_PER_CLIENT = 3;
/**
diff --git a/packages/zoe/exported.js b/packages/zoe/exported.js
index 03fb20ed65f..e3828978f72 100644
--- a/packages/zoe/exported.js
+++ b/packages/zoe/exported.js
@@ -1,10 +1,10 @@
// @jessie-check
import './src/contractFacet/types-ambient.js';
-import './src/zoeService/types.js';
-import './src/contractSupport/types.js';
+import './src/zoeService/types-ambient.js';
+import './src/contractSupport/types-ambient.js';
import './src/contracts/exported.js';
-import './src/types.js';
+import './src/types-ambient.js';
import './tools/types-ambient.js';
import '@agoric/notifier/exported.js';
import '@agoric/ertp/exported.js';
diff --git a/packages/zoe/src/contractFacet/rightsConservation.js b/packages/zoe/src/contractFacet/rightsConservation.js
index 4f7fe3c2f3f..23b5a946907 100644
--- a/packages/zoe/src/contractFacet/rightsConservation.js
+++ b/packages/zoe/src/contractFacet/rightsConservation.js
@@ -4,7 +4,7 @@ import { AmountMath } from '@agoric/ertp';
import '../internal-types.js';
/**
- * @import {MapStore} from '@agoric/store/exported.js'
+ * @import {MapStore} from '@agoric/store';
*/
/**
diff --git a/packages/zoe/src/contractFacet/zcfSeat.js b/packages/zoe/src/contractFacet/zcfSeat.js
index ee4ef6f3f33..9658f66512f 100644
--- a/packages/zoe/src/contractFacet/zcfSeat.js
+++ b/packages/zoe/src/contractFacet/zcfSeat.js
@@ -25,7 +25,16 @@ import { TransferPartShape } from '../contractSupport/atomicTransfer.js';
const { Fail } = assert;
-/** @type {CreateSeatManager} */
+/**
+ * The SeatManager holds the active zcfSeats and can reallocate and
+ * make new zcfSeats.
+ *
+ * @param {ERef} zoeInstanceAdmin
+ * @param {GetAssetKindByBrand} getAssetKindByBrand
+ * @param {import('@agoric/swingset-vat').ShutdownWithFailure} shutdownWithFailure
+ * @param {import('@agoric/vat-data').Baggage} zcfBaggage
+ * @returns {{ seatManager: ZcfSeatManager, zcfMintReallocator: ZcfMintReallocator }}
+ */
export const createSeatManager = (
zoeInstanceAdmin,
getAssetKindByBrand,
diff --git a/packages/zoe/src/contractSupport/ratio.js b/packages/zoe/src/contractSupport/ratio.js
index f01f259941b..c4659aa968b 100644
--- a/packages/zoe/src/contractSupport/ratio.js
+++ b/packages/zoe/src/contractSupport/ratio.js
@@ -1,4 +1,4 @@
-///
+///
import { q, Fail } from '@agoric/assert';
import { AmountMath } from '@agoric/ertp';
import { assertRecord } from '@endo/marshal';
diff --git a/packages/zoe/src/contractSupport/types.js b/packages/zoe/src/contractSupport/types-ambient.js
similarity index 100%
rename from packages/zoe/src/contractSupport/types.js
rename to packages/zoe/src/contractSupport/types-ambient.js
diff --git a/packages/zoe/src/contracts/priceAggregator.js b/packages/zoe/src/contracts/priceAggregator.js
index 555f5002f98..857ba9352a8 100644
--- a/packages/zoe/src/contracts/priceAggregator.js
+++ b/packages/zoe/src/contracts/priceAggregator.js
@@ -32,7 +32,7 @@ import {
} from '../contractSupport/ratio.js';
/**
- * @import {LegacyMap} from '@agoric/store/exported.js'
+ * @import {LegacyMap} from '@agoric/store'
*/
/** @typedef {bigint | number | string} ParsableNumber */
/**
diff --git a/packages/zoe/src/internal-types.js b/packages/zoe/src/internal-types.js
index 0216b9fdcb1..7de031ab808 100644
--- a/packages/zoe/src/internal-types.js
+++ b/packages/zoe/src/internal-types.js
@@ -281,19 +281,6 @@
* @property {(zcfSeat: ZCFSeat, newAllocation: Allocation) => void} reallocate
*/
-/**
- * @callback CreateSeatManager
- *
- * The SeatManager holds the active zcfSeats and can reallocate and
- * make new zcfSeats.
- *
- * @param {ERef} zoeInstanceAdmin
- * @param {GetAssetKindByBrand} getAssetKindByBrand
- * @param {import('@agoric/swingset-vat').ShutdownWithFailure} shutdownWithFailure
- * @param {import('@agoric/vat-data').Baggage} zcfBaggage
- * @returns {{ seatManager: ZcfSeatManager, zcfMintReallocator: ZcfMintReallocator }}
- */
-
/**
* @callback InstanceStateAddIssuer
*
@@ -305,44 +292,13 @@
* @returns {void}
*/
-/**
- * @callback InstanceStateGetTerms
- * @returns {AnyTerms}
- */
-
-/**
- * @callback InstanceStateGetInstallation
- * @returns {Installation}
- */
-
-/**
- * @callback InstanceRecordGetIssuers
- * @returns {IssuerKeywordRecord}
- */
-
-/**
- * @callback InstanceRecordGetBrands
- * @returns {BrandKeywordRecord}
- */
-
/**
* @typedef {object} InstanceState
* @property {InstanceStateAddIssuer} addIssuer
- * @property {GetInstanceRecord} getInstanceRecord
- * @property {InstanceStateGetTerms} getTerms
- * @property {InstanceStateGetInstallation} getInstallation
- * @property {InstanceRecordGetIssuers} getIssuers
- * @property {InstanceRecordGetBrands} getBrands
+ * @property {() => InstanceRecord} getInstanceRecord
+ * @property {() => AnyTerms} getTerms
+ * @property {() => Installation} getInstallation
+ * @property {() => IssuerKeywordRecord} getIssuers
+ * @property {() => BrandKeywordRecord} getBrands
* @property {(keyword: Keyword) => void} assertUniqueKeyword
*/
-
-/**
- * @callback GetInstanceRecord
- * @returns {InstanceRecord}
- */
-
-/**
- * @callback IssuerStorageGetIssuerRecords
- * @param {Issuer[]} issuers
- * @returns {IssuerRecords}
- */
diff --git a/packages/zoe/src/issuerStorage.js b/packages/zoe/src/issuerStorage.js
index b49bbc03555..55f776d35e5 100644
--- a/packages/zoe/src/issuerStorage.js
+++ b/packages/zoe/src/issuerStorage.js
@@ -170,7 +170,10 @@ export const provideIssuerStorage = zcfBaggage => {
return brandToIssuerRecord.get(brand).issuer;
};
- /** @type {IssuerStorageGetIssuerRecords} */
+ /**
+ * @param {Issuer[]} issuers
+ * @returns {IssuerRecords}
+ */
const getIssuerRecords = issuers => {
assertInstantiated();
return issuers.map(issuerToIssuerRecord.get);
diff --git a/packages/zoe/src/types.js b/packages/zoe/src/types-ambient.js
similarity index 100%
rename from packages/zoe/src/types.js
rename to packages/zoe/src/types-ambient.js
diff --git a/packages/zoe/src/zoeService/internal-types.js b/packages/zoe/src/zoeService/internal-types.js
index fbf1938a2e4..eeb1f09281b 100644
--- a/packages/zoe/src/zoeService/internal-types.js
+++ b/packages/zoe/src/zoeService/internal-types.js
@@ -76,13 +76,13 @@
/**
* @typedef {object} ZoeInstanceStorageManager
- * @property {InstanceStateGetTerms} getTerms
- * @property {InstanceRecordGetIssuers} getIssuers
- * @property {InstanceRecordGetBrands} getBrands
+ * @property {() => AnyTerms} getTerms
+ * @property {() => IssuerKeywordRecord} getIssuers
+ * @property {() => BrandKeywordRecord} getBrands
* @property {ZCF['saveIssuer']} saveIssuer
* @property {MakeZoeMint} makeZoeMint
* @property {RegisterFeeMint} registerFeeMint
- * @property {GetInstanceRecord} getInstanceRecord
+ * @property {() => InstanceRecord} getInstanceRecord
* @property {GetIssuerRecords} getIssuerRecords
* @property {InitInstanceAdmin} initInstanceAdmin
* @property {DeleteInstanceAdmin} deleteInstanceAdmin
diff --git a/packages/zoe/src/zoeService/originalZoeSeat.js b/packages/zoe/src/zoeService/originalZoeSeat.js
index 0187d07dcd3..97e4660851d 100644
--- a/packages/zoe/src/zoeService/originalZoeSeat.js
+++ b/packages/zoe/src/zoeService/originalZoeSeat.js
@@ -6,7 +6,7 @@ import { deeplyFulfilled } from '@endo/marshal';
import { makePromiseKit } from '@endo/promise-kit';
import { satisfiesWant } from '../contractFacet/offerSafety.js';
-import '../types.js';
+import '../types-ambient.js';
import '../internal-types.js';
import {
AmountKeywordRecordShape,
diff --git a/packages/zoe/src/zoeService/types.js b/packages/zoe/src/zoeService/types-ambient.js
similarity index 99%
rename from packages/zoe/src/zoeService/types.js
rename to packages/zoe/src/zoeService/types-ambient.js
index 8d9b2c863fe..17d9f7a31e1 100644
--- a/packages/zoe/src/zoeService/types.js
+++ b/packages/zoe/src/zoeService/types-ambient.js
@@ -274,10 +274,6 @@
* @typedef {import('./utils.js').Instance} Instance
*/
-/**
- * @import {VatAdminSvc} from '@agoric/swingset-vat'
- */
-
/**
* @typedef {{bundleCap: import('@agoric/swingset-vat').BundleCap } | {name: string} | {id: BundleID}} ZCFSpec
*/
diff --git a/packages/zoe/src/zoeService/utils.d.ts b/packages/zoe/src/zoeService/utils.d.ts
index e10f2ad5308..a94b16b491b 100644
--- a/packages/zoe/src/zoeService/utils.d.ts
+++ b/packages/zoe/src/zoeService/utils.d.ts
@@ -1,8 +1,7 @@
import type { Callable } from '@agoric/internal/src/utils.js';
import type { VatUpgradeResults } from '@agoric/swingset-vat';
import type { Baggage } from '@agoric/swingset-liveslots';
-
-import type { IssuerKeywordRecord, Payment } from './types.js';
+import type { Issuer } from '@agoric/ertp/exported.js';
// XXX https://github.com/Agoric/agoric-sdk/issues/4565
type SourceBundle = Record;
@@ -71,7 +70,7 @@ export type ContractOf = StartParams & StartResult;
type StartContractInstance = (
installation: Installation,
- issuerKeywordRecord?: IssuerKeywordRecord,
+ issuerKeywordRecord?: Record>,
terms?: object,
privateArgs?: object,
) => Promise<{
@@ -113,7 +112,7 @@ export type StartedInstanceKit = {
*/
export type StartInstance = (
installation: Installation | PromiseLike>,
- issuerKeywordRecord?: IssuerKeywordRecord,
+ issuerKeywordRecord?: Record>,
// 'brands' and 'issuers' need not be passed in; Zoe provides them as StandardTerms
terms?: Omit['terms'], 'brands' | 'issuers'>,
privateArgs?: Parameters[1],
diff --git a/packages/zoe/src/zoeService/zoe.js b/packages/zoe/src/zoeService/zoe.js
index 6234f1696c6..5a83d08bf0a 100644
--- a/packages/zoe/src/zoeService/zoe.js
+++ b/packages/zoe/src/zoeService/zoe.js
@@ -26,6 +26,10 @@ import { getZcfBundleCap } from './createZCFVat.js';
import { defaultFeeIssuerConfig, prepareFeeMint } from './feeMint.js';
import { ZoeServiceI } from '../typeGuards.js';
+// XXX ambient types runtime imports until https://github.com/Agoric/agoric-sdk/issues/6512
+import '@agoric/internal/exported.js';
+import '@agoric/notifier/exported.js';
+
/** @import {Baggage} from '@agoric/vat-data' */
const { Fail } = assert;
diff --git a/packages/zoe/src/zoeService/zoeSeat.js b/packages/zoe/src/zoeService/zoeSeat.js
index 363932fb89b..688dcbb6a52 100644
--- a/packages/zoe/src/zoeService/zoeSeat.js
+++ b/packages/zoe/src/zoeService/zoeSeat.js
@@ -6,7 +6,7 @@ import { deeplyFulfilled } from '@endo/marshal';
import { makePromiseKit } from '@endo/promise-kit';
import { satisfiesWant } from '../contractFacet/offerSafety.js';
-import '../types.js';
+import '../types-ambient.js';
import '../internal-types.js';
import {
declareOldZoeSeatAdminKind,
diff --git a/packages/zoe/test/swingsetTests/runMint/vat-alice.js b/packages/zoe/test/swingsetTests/runMint/vat-alice.js
index e3b778f35be..9fdc73127bf 100644
--- a/packages/zoe/test/swingsetTests/runMint/vat-alice.js
+++ b/packages/zoe/test/swingsetTests/runMint/vat-alice.js
@@ -14,7 +14,7 @@ const build = async (log, zoe, installations, feeMintAccess) => {
const { instance } = await E(zoe).startInstance(
installations.offerArgsUsageContract,
harden({
- RUN: E(zoe).getFeeIssuer(),
+ RUN: await E(zoe).getFeeIssuer(),
}),
undefined,
);
diff --git a/packages/zoe/test/unitTests/contractSupport/test-ratio.js b/packages/zoe/test/unitTests/contractSupport/test-ratio.js
index f229f19e2a2..69a3febe1b6 100644
--- a/packages/zoe/test/unitTests/contractSupport/test-ratio.js
+++ b/packages/zoe/test/unitTests/contractSupport/test-ratio.js
@@ -1,6 +1,6 @@
import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js';
-import '../../../src/contractSupport/types.js';
+import '../../../src/contractSupport/types-ambient.js';
import { makeIssuerKit, AmountMath } from '@agoric/ertp';
import {
diff --git a/packages/zoe/test/unitTests/test-zoe-startInstance.js b/packages/zoe/test/unitTests/test-zoe-startInstance.js
index 318e237e48c..fb13072e98c 100644
--- a/packages/zoe/test/unitTests/test-zoe-startInstance.js
+++ b/packages/zoe/test/unitTests/test-zoe-startInstance.js
@@ -96,6 +96,7 @@ test('terms, issuerKeywordRecord switched', async t => {
() =>
E(zoe).startInstance(
installation,
+ // @ts-expect-error intentional error
{ something: 2 },
{ Moola: moolaKit.issuer },
),
@@ -121,6 +122,7 @@ test('bad issuer, makeEmptyPurse throws', async t => {
getBrand: () => brand,
});
await t.throwsAsync(
+ // @ts-expect-error intentional error
() => E(zoe).startInstance(installation, { Money: badIssuer }),
{
message:
diff --git a/packages/zoe/typedoc.json b/packages/zoe/typedoc.json
index e5a2997cfc2..bdab322c101 100644
--- a/packages/zoe/typedoc.json
+++ b/packages/zoe/typedoc.json
@@ -6,9 +6,9 @@
"src/contractFacet/internal-types.js",
"src/contractFacet/types-ambient.d.ts",
"src/contractSupport/index.js",
- "src/contractSupport/types.js",
+ "src/contractSupport/types-ambient.js",
"src/types.js",
- "src/zoeService/types.js",
+ "src/zoeService/types-ambient.js",
"src/zoeService/utils.d.ts",
"src/zoeService/zoe.js",
"tools/internal-types.js",