@trinaryex/mcp 3.9.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,422 @@
1
+ import { z } from 'zod';
2
+ import { ok } from '../result.js';
3
+ import { big, cursorPagingShape, objectId, suiAddress, u64, } from '../schemas.js';
4
+ import { plain } from './orgCommon.js';
5
+ /**
6
+ * Armature organization reads: identity, governance, treasury and shared
7
+ * storage.
8
+ *
9
+ * A note that shapes several of these tools. An organization is a TREE of DAOs
10
+ * — a root plus its units — and almost every question about one is really a
11
+ * question about a specific unit: which board votes, whose treasury, whose
12
+ * shared storage. Any unit id resolves the whole tree, so `orgId` is forgiving,
13
+ * but the ANSWERS are per-unit and the tools say which unit they answered for.
14
+ *
15
+ * `address` appears on the unit-scoped tools because a seat is per-caller: this
16
+ * server is keyless and multi-tenant, so it cannot read an address off client
17
+ * configuration the way the SDK does.
18
+ */
19
+ const orgIdShape = {
20
+ orgId: objectId.describe('Organization object id — the root or ANY unit in its tree; the whole tree is returned either way.'),
21
+ };
22
+ const actingShape = {
23
+ ...orgIdShape,
24
+ address: suiAddress.describe('The acting address. Seats are per-caller and this server holds no identity, so it must be named.'),
25
+ seat: objectId
26
+ .optional()
27
+ .describe('Unit id to act through. Defaults to the caller’s highest-authority seat.'),
28
+ };
29
+ /** Open a handle for a unit-scoped read. */
30
+ const handle = (ctx, args) => ctx.writeClient(args.address).org(args.orgId, { seat: args.seat });
31
+ export const orgTools = [
32
+ {
33
+ name: 'org_get',
34
+ title: 'Get an organization',
35
+ description: 'Resolve an organization to its full unit tree: name, metadata, treasury, capability vault, board members per unit, and any trading account. Any unit id returns the top-level organization.',
36
+ kind: 'read',
37
+ sdkPath: 'orgs.get',
38
+ inputShape: { ...orgIdShape },
39
+ handler: async (ctx, args) => ok(await ctx.readClient().orgs.get(args.orgId)),
40
+ },
41
+ {
42
+ name: 'org_batch',
43
+ title: 'Batch-get organizations',
44
+ description: 'Resolve up to 200 organization ids at once, in request order. Ids that do not resolve come back with null fields and metadata.errorReason = "unresolved" rather than being dropped, so results stay index-aligned with the request.',
45
+ kind: 'read',
46
+ sdkPath: 'orgs.batch',
47
+ inputShape: {
48
+ orgIds: z
49
+ .array(objectId)
50
+ .min(1)
51
+ .max(200)
52
+ .describe('Organization object ids (max 200).'),
53
+ },
54
+ handler: async (ctx, args) => ok(await ctx.readClient().orgs.batch(args.orgIds)),
55
+ },
56
+ {
57
+ name: 'org_directory',
58
+ title: 'Browse organizations',
59
+ description: 'One page of the discovery directory — top-level organizations only, largest first by member count unless sorted by name. Page with the returned nextCursor.',
60
+ kind: 'read',
61
+ sdkPath: 'orgs.directory',
62
+ inputShape: {
63
+ limit: z.number().int().min(1).max(50).optional(),
64
+ cursor: cursorPagingShape.cursor,
65
+ sort: z.enum(['members', 'name']).optional(),
66
+ },
67
+ handler: async (ctx, args) => ok(await ctx.readClient().orgs.directory({
68
+ limit: args.limit,
69
+ cursor: args.cursor,
70
+ sort: args.sort,
71
+ })),
72
+ },
73
+ {
74
+ name: 'org_for_player',
75
+ title: 'Organizations an address governs',
76
+ description: 'Every organization the address is a current governance member of, each as a full unit tree. Use org_seats to find where within a tree the address actually sits.',
77
+ kind: 'read',
78
+ sdkPath: 'orgs.forPlayer',
79
+ inputShape: {
80
+ address: suiAddress.describe('Player wallet address.'),
81
+ },
82
+ handler: async (ctx, args) => ok(await ctx.readClient().orgs.forPlayer(args.address)),
83
+ },
84
+ {
85
+ name: 'org_search',
86
+ title: 'Search organizations',
87
+ description: 'Search organization UNITS by name, organization id, or treasury id. A hit may be a unit deep in a tree, so each carries rootOrgId/rootName for labelling.',
88
+ kind: 'read',
89
+ sdkPath: 'orgs.search',
90
+ inputShape: {
91
+ q: z
92
+ .string()
93
+ .min(1)
94
+ .describe('Partial name, or an exact org / treasury id.'),
95
+ limit: z.number().int().min(1).max(50).optional(),
96
+ enrich: z
97
+ .boolean()
98
+ .optional()
99
+ .describe('Resolve icons and descriptions; costs a metadata lookup per hit.'),
100
+ },
101
+ handler: async (ctx, args) => ok(await ctx
102
+ .readClient()
103
+ .orgs.search(args.q, { limit: args.limit, enrich: args.enrich })),
104
+ },
105
+ {
106
+ name: 'org_proposals',
107
+ title: 'List an organization’s proposals',
108
+ description: 'Governance proposals for an organization, newest first, from the indexer — including executed and expired ones, which cycle 7 deletes on-chain. Each carries the config snapshotted at submission (null if unindexed), createdMs and metadataIpfs, but NO snapshot weight, so yesWeight/noWeight have no denominator here: read org_proposal for the live tally. "pending" INCLUDES a lapsed voting window nobody cleaned up — such a proposal can only be deleted (org_expired_proposals, prepare_org_delete_expired_proposals), not voted on.',
109
+ kind: 'read',
110
+ sdkPath: 'orgs.proposals',
111
+ inputShape: { ...orgIdShape },
112
+ handler: async (ctx, args) => ok(await ctx.readClient().orgs.proposals(args.orgId)),
113
+ },
114
+ {
115
+ name: 'org_seats',
116
+ title: 'Board seats an address holds',
117
+ description: 'Every unit of an organization whose board the address sits on, highest authority first. An empty result means the address governs nothing there. This is what decides which actions are available and whether they execute immediately.',
118
+ kind: 'read',
119
+ sdkPath: 'orgs.seats',
120
+ inputShape: {
121
+ ...orgIdShape,
122
+ address: suiAddress.describe('The address whose seats to resolve.'),
123
+ },
124
+ handler: async (ctx, args) => ok(await ctx.readClient().orgs.seats(args.orgId, args.address)),
125
+ },
126
+ {
127
+ name: 'org_trading_account',
128
+ title: 'An organization’s trading account',
129
+ description: 'The organization’s shared TradingAccount and the unit that holds it, or null when trading was never set up. Feed the id to orders_open / orders_fills / orders_trades / account_sweepable — those take a trading account id and do not care who owns it.',
130
+ kind: 'read',
131
+ sdkPath: 'orgs.tradingAccount',
132
+ inputShape: { ...orgIdShape },
133
+ handler: async (ctx, args) => ok(await ctx.readClient().orgs.tradingAccount(args.orgId)),
134
+ },
135
+ {
136
+ name: 'org_accessible_keyspaces',
137
+ title: 'Keyspaces an address can reach, with roles',
138
+ description: 'Every keyspace the address can reach and HOW: created by one of their organizations, granted to them directly, or granted to one of their organizations — plus the roles held on each. Richer than keyspace_list_accessible, which returns ids only. Metadata only; decrypting needs a wallet-signed Seal session key this server cannot produce.',
139
+ kind: 'read',
140
+ sdkPath: 'orgs.accessibleKeyspaces',
141
+ inputShape: {
142
+ address: suiAddress.describe('Player wallet address.'),
143
+ role: z.enum(['grant', 'read', 'write']).optional(),
144
+ },
145
+ handler: async (ctx, args) => ok(await ctx
146
+ .readClient()
147
+ .orgs.accessibleKeyspaces(args.address, args.role)),
148
+ },
149
+ {
150
+ name: 'org_vaults_at_hub',
151
+ title: 'Shared storage at a trade hub',
152
+ description: 'Active organization receipt vaults registered at a trade hub, each with its current member set per role (deposit / withdraw / edit). Note a vault is keyed by (storage unit, ORGANIZATION) — several organizations can each have one at the same hub, and one of them being here does not make it yours.',
153
+ kind: 'read',
154
+ sdkPath: 'orgs.vaultsAtHub',
155
+ inputShape: {
156
+ hubId: objectId.describe('Trade hub / storage unit object id.'),
157
+ },
158
+ handler: async (ctx, args) => ok(await ctx.readClient().orgs.vaultsAtHub(args.hubId)),
159
+ },
160
+ // ─── unit-scoped reads ─────────────────────────────────────────────────────
161
+ {
162
+ name: 'org_governance',
163
+ title: 'A unit’s governance rules',
164
+ description: 'Which proposal types a unit has enabled and the voting rules for each: quorum and approval in basis points, expiry, execution delay, composability, permission bits and borrow scope; plus every slot keyed by Move type (with its last execution), the unit’s lifecycle and pause flags (state: migrating, executionPaused, controllerPaused, memberCount, encryptEpoch) and its freeze state. This is what decides whether an action executes in one transaction or becomes a proposal — a lone vote clears quorum only when boardSize × quorum ≤ 10000 and the execution delay is zero.',
165
+ kind: 'read',
166
+ sdkPath: 'org.governance.read',
167
+ inputShape: { ...actingShape },
168
+ syntheticParams: {
169
+ orgId: 'Names the organization whose handle is opened; the SDK reads it from client.org(id).',
170
+ address: 'The acting address; per-request because this server is keyless and multi-tenant.',
171
+ seat: 'Which unit to answer for; the SDK takes it from the handle.',
172
+ },
173
+ derivedParams: {
174
+ daoId: 'Defaults to the acting seat’s unit.',
175
+ },
176
+ handler: async (ctx, args) => {
177
+ const org = await handle(ctx, args);
178
+ const gov = await org.governance.read();
179
+ return ok({
180
+ unitDaoId: org.seat?.daoId ?? null,
181
+ enabledTypes: [...gov.enabledTypes],
182
+ configs: plain(gov.configs),
183
+ typeBindings: plain(gov.typeBindings),
184
+ slots: plain(gov.slots ?? null),
185
+ state: plain(gov.state ?? null),
186
+ freeze: plain(gov.freeze ?? null),
187
+ });
188
+ },
189
+ },
190
+ {
191
+ name: 'org_treasury_balances',
192
+ title: 'A unit’s treasury coin balances',
193
+ description: 'Every coin the unit’s treasury holds, enumerated from the vault’s own coin-type set. Cycle 7 drops a coin from that set when it is drained, so an absent coin means a zero balance. Coins TRANSFERRED to the treasury’s address are not counted until claimed (prepare_org_treasury_claim).',
194
+ kind: 'read',
195
+ sdkPath: 'org.treasury.balances',
196
+ inputShape: {
197
+ ...actingShape,
198
+ treasuryVaultId: objectId.optional(),
199
+ },
200
+ syntheticParams: {
201
+ orgId: 'Names the organization whose handle is opened.',
202
+ address: 'The acting address; per-request because this server is keyless.',
203
+ seat: 'Which unit to answer for; the SDK takes it from the handle.',
204
+ },
205
+ handler: async (ctx, args) => {
206
+ const org = await handle(ctx, args);
207
+ return ok(await org.treasury.balances(args.treasuryVaultId));
208
+ },
209
+ },
210
+ {
211
+ name: 'org_treasury_balance',
212
+ title: 'One coin’s treasury balance',
213
+ description: 'A single coin balance in the unit’s treasury (defaults to CRED), or 0.',
214
+ kind: 'read',
215
+ sdkPath: 'org.treasury.balance',
216
+ inputShape: {
217
+ ...actingShape,
218
+ coinType: z.string().optional().describe('Defaults to CRED.'),
219
+ treasuryVaultId: objectId.optional(),
220
+ },
221
+ syntheticParams: {
222
+ orgId: 'Names the organization whose handle is opened.',
223
+ address: 'The acting address; per-request because this server is keyless.',
224
+ seat: 'Which unit to answer for; the SDK takes it from the handle.',
225
+ },
226
+ handler: async (ctx, args) => {
227
+ const org = await handle(ctx, args);
228
+ return ok({
229
+ coinType: args.coinType ?? 'CRED',
230
+ amount: await org.treasury.balance(args.coinType, args.treasuryVaultId),
231
+ });
232
+ },
233
+ },
234
+ {
235
+ name: 'org_vault_resolve',
236
+ title: 'Find this organization’s shared storage at a hub',
237
+ description: 'The vault THIS organization registered at a storage unit, or null. Vaults are keyed by (storage unit, organization), so there is no such thing as "the vault at this hub" — resolving by hub alone would return a stranger’s. Defaults the registrant to the acting seat, then walks the rest of the tree.',
238
+ kind: 'read',
239
+ sdkPath: 'org.vault.resolve',
240
+ inputShape: {
241
+ ...actingShape,
242
+ storageUnitId: objectId,
243
+ registrantOrgId: objectId
244
+ .optional()
245
+ .describe('Pin the registering unit instead of searching the tree.'),
246
+ },
247
+ syntheticParams: {
248
+ orgId: 'Names the organization whose handle is opened.',
249
+ address: 'The acting address; per-request because this server is keyless.',
250
+ seat: 'Which unit to search from; the SDK takes it from the handle.',
251
+ },
252
+ handler: async (ctx, args) => {
253
+ const org = await handle(ctx, args);
254
+ return ok({
255
+ vaultId: await org.vault.resolve({
256
+ storageUnitId: args.storageUnitId,
257
+ registrantOrgId: args.registrantOrgId,
258
+ }),
259
+ });
260
+ },
261
+ },
262
+ {
263
+ name: 'org_vault_info',
264
+ title: 'Read a shared-storage vault',
265
+ description: 'A vault’s live identity, access grants, and non-empty asset count, read on-chain. Prefer org_vaults_at_hub for listing; use this when the answer must be head-current — deciding whether a grant has landed, for instance, where the indexer’s 30-second cache is exactly long enough to mislead.',
266
+ kind: 'read',
267
+ sdkPath: 'org.vault.info',
268
+ inputShape: { ...actingShape, vaultId: objectId },
269
+ syntheticParams: {
270
+ orgId: 'Names the organization whose handle is opened.',
271
+ address: 'The acting address; per-request because this server is keyless.',
272
+ seat: 'Unused for this read; accepted so the acting shape is uniform.',
273
+ },
274
+ handler: async (ctx, args) => {
275
+ const org = await handle(ctx, args);
276
+ return ok(await org.vault.info(args.vaultId));
277
+ },
278
+ },
279
+ {
280
+ name: 'org_vault_balance',
281
+ title: 'One item’s balance in shared storage',
282
+ description: 'A single asset’s balance held in a vault, or 0.',
283
+ kind: 'read',
284
+ sdkPath: 'org.vault.balance',
285
+ inputShape: {
286
+ ...actingShape,
287
+ vaultId: objectId,
288
+ assetId: u64.describe('Item asset id as a decimal string.'),
289
+ },
290
+ syntheticParams: {
291
+ orgId: 'Names the organization whose handle is opened.',
292
+ address: 'The acting address; per-request because this server is keyless.',
293
+ seat: 'Unused for this read; accepted so the acting shape is uniform.',
294
+ },
295
+ handler: async (ctx, args) => {
296
+ const org = await handle(ctx, args);
297
+ return ok({
298
+ assetId: args.assetId,
299
+ amount: await org.vault.balance(args.vaultId, big(args.assetId)),
300
+ });
301
+ },
302
+ },
303
+ {
304
+ name: 'org_vaults_at_hub_for_org',
305
+ title: 'Shared storage at a hub (via the handle)',
306
+ description: 'Same listing as org_vaults_at_hub, reached through an organization handle. Prefer org_vaults_at_hub — it needs no acting address.',
307
+ kind: 'read',
308
+ sdkPath: 'org.vault.atHub',
309
+ inputShape: { ...actingShape, hubId: objectId },
310
+ syntheticParams: {
311
+ orgId: 'Names the organization whose handle is opened.',
312
+ address: 'The acting address; per-request because this server is keyless.',
313
+ seat: 'Unused for this read; accepted so the acting shape is uniform.',
314
+ },
315
+ handler: async (ctx, args) => {
316
+ const org = await handle(ctx, args);
317
+ return ok(await org.vault.atHub(args.hubId));
318
+ },
319
+ },
320
+ // ─── cycle-7 unit-scoped reads ─────────────────────────────────────────────
321
+ {
322
+ name: 'org_proposal',
323
+ title: 'One proposal’s live on-chain state',
324
+ description: 'A proposal’s LIVE state read from the chain: snapshot weight (the quorum denominator), votes cast by voter, yes/no weight, decoded payload, the config snapshotted at submission, status (active / passed), and its deadlines — votingDeadlineMs, executableFromMs, and when a passed proposal’s execution window closes. null when the object no longer exists: cycle 7 deletes a proposal on execution and on expiry cleanup, and org_proposals then has the outcome.',
325
+ kind: 'read',
326
+ sdkPath: 'org.governance.proposal',
327
+ inputShape: { ...actingShape, proposalId: objectId },
328
+ syntheticParams: {
329
+ orgId: 'Names the organization whose handle is opened.',
330
+ address: 'The acting address; per-request because this server is keyless.',
331
+ seat: 'Unused for this read; accepted so the acting shape is uniform.',
332
+ },
333
+ handler: async (ctx, args) => {
334
+ const org = await handle(ctx, args);
335
+ return ok(plain(await org.governance.proposal(args.proposalId)));
336
+ },
337
+ },
338
+ {
339
+ name: 'org_expired_proposals',
340
+ title: 'Proposals ready for deletion',
341
+ description: 'The organization’s proposals that prepare_org_delete_expired_proposals would accept RIGHT NOW: every indexed pending/passed proposal, hydrated from the chain and kept if its voting window (active) or execution window (passed) has closed. One chain read per open proposal.',
342
+ kind: 'read',
343
+ sdkPath: 'org.governance.expired',
344
+ inputShape: { ...actingShape },
345
+ syntheticParams: {
346
+ orgId: 'Names the organization whose handle is opened.',
347
+ address: 'The acting address; per-request because this server is keyless.',
348
+ seat: 'Unused for this read; accepted so the acting shape is uniform.',
349
+ },
350
+ handler: async (ctx, args) => {
351
+ const org = await handle(ctx, args);
352
+ return ok(plain(await org.governance.expired()));
353
+ },
354
+ },
355
+ {
356
+ name: 'org_freeze',
357
+ title: 'A unit’s emergency-freeze state',
358
+ description: 'Which payload Move types are frozen on a unit and until when (epoch ms), which types are exempt from freezing, and the maximum freeze duration. A frozen type cannot execute by any path until it lapses or is lifted.',
359
+ kind: 'read',
360
+ sdkPath: 'org.freeze.read',
361
+ inputShape: {
362
+ ...actingShape,
363
+ unitId: objectId
364
+ .optional()
365
+ .describe('Unit to read; defaults to the acting seat.'),
366
+ },
367
+ syntheticParams: {
368
+ orgId: 'Names the organization whose handle is opened.',
369
+ address: 'The acting address; per-request because this server is keyless.',
370
+ seat: 'The default unit when unitId is omitted.',
371
+ },
372
+ handler: async (ctx, args) => {
373
+ const org = await handle(ctx, args);
374
+ return ok(plain(await org.freeze.read(args.unitId)));
375
+ },
376
+ },
377
+ {
378
+ name: 'org_entries',
379
+ title: 'A unit’s encrypted entries',
380
+ description: 'Every encrypted entry a unit’s board has published: where its ciphertext lives, a description, who created it, the epoch it was encrypted under, and stale=true when the unit’s epoch has since rotated (re-encrypt and prepare_org_entry_update). METADATA ONLY — decrypting needs a wallet-signed Seal session key, which lives in @trinaryex/keyspace and which this server cannot produce.',
381
+ kind: 'read',
382
+ sdkPath: 'org.entries.list',
383
+ inputShape: {
384
+ ...actingShape,
385
+ unitId: objectId
386
+ .optional()
387
+ .describe('Unit to read; defaults to the acting seat.'),
388
+ },
389
+ syntheticParams: {
390
+ orgId: 'Names the organization whose handle is opened.',
391
+ address: 'The acting address; per-request because this server is keyless.',
392
+ seat: 'The default unit when unitId is omitted.',
393
+ },
394
+ handler: async (ctx, args) => {
395
+ const org = await handle(ctx, args);
396
+ return ok(plain(await org.entries.list(args.unitId)));
397
+ },
398
+ },
399
+ {
400
+ name: 'org_capabilities',
401
+ title: 'What a unit’s capability vault holds',
402
+ description: 'A unit’s capability vault by Move type: SubOUControl caps over its children, TreasuryCap<T>s of adopted currencies, ExternalExecutionCap<P>s (bypass), UpgradeCaps, a stored FreezeAdminCap, trading custody caps. The cap ids here are what the unit, currency, upgrade and bypass prepare tools take.',
403
+ kind: 'read',
404
+ sdkPath: 'org.capabilities.list',
405
+ inputShape: {
406
+ ...actingShape,
407
+ unitId: objectId
408
+ .optional()
409
+ .describe('Unit to read; defaults to the acting seat.'),
410
+ },
411
+ syntheticParams: {
412
+ orgId: 'Names the organization whose handle is opened.',
413
+ address: 'The acting address; per-request because this server is keyless.',
414
+ seat: 'The default unit when unitId is omitted.',
415
+ },
416
+ handler: async (ctx, args) => {
417
+ const org = await handle(ctx, args);
418
+ return ok(plain(await org.capabilities.list(args.unitId)));
419
+ },
420
+ },
421
+ ];
422
+ //# sourceMappingURL=org.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"org.js","sourceRoot":"","sources":["../../src/tools/org.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAA;AACjC,OAAO,EACL,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ACD,eAAe,EAAE;YACf,KAAK,EAAE,gDAAgD;YACvD,OAAO,EACL,iEAAiE;YACnE,IAAI,EAAE,0CAA0C;SACjD;QACD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;YAC3B,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;YACnC,OAAO,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QACvD,CAAC;KACF;IACD;QACE,IAAI,EAAE,kBAAkB;QACxB,KAAK,EAAE,sCAAsC;QAC7C,WAAW,EACT,ySAAyS;QAC3S,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,uBAAuB;QAChC,UAAU,EAAE;YACV,GAAG,WAAW;YACd,MAAM,EAAE,QAAQ;iBACb,QAAQ,EAAE;iBACV,QAAQ,CAAC,4CAA4C,CAAC;SAC1D;QACD,eAAe,EAAE;YACf,KAAK,EAAE,gDAAgD;YACvD,OAAO,EACL,iEAAiE;YACnE,IAAI,EAAE,0CAA0C;SACjD;QACD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;YAC3B,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;YACnC,OAAO,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QAC5D,CAAC;KACF;CACF,CAAA"}
@@ -0,0 +1,144 @@
1
+ import { z } from 'zod';
2
+ import type { RequestContext } from '../context.js';
3
+ import type { ToolResponse } from '../result.js';
4
+ /**
5
+ * Shared plumbing for the Armature prepare tools (`orgPrepare.ts`,
6
+ * `orgLifecycle.ts`).
7
+ *
8
+ * A governance action does not have a fixed outcome. The SAME call executes in
9
+ * one transaction for an officer whose lone vote clears quorum, creates a
10
+ * proposal for someone whose does not, and is refused outright for a third
11
+ * caller who holds no seat. The prepared bytes therefore carry an `outcome`
12
+ * saying which of those the bytes will do, and a `blocked` result returns
13
+ * `prepared: false` with the reason rather than an error.
14
+ */
15
+ export declare const PREPARE_SUFFIX = " Returns unsigned transaction bytes \u2014 this server never signs or submits. Verify the returned intent against the bytes, then sponsor, sign and submit with your own key.";
16
+ export declare const actingShape: {
17
+ orgId: z.ZodString;
18
+ sender: z.ZodString;
19
+ seat: z.ZodOptional<z.ZodString>;
20
+ };
21
+ export declare const ACTING_SYNTHETIC: {
22
+ orgId: string;
23
+ sender: string;
24
+ seat: string;
25
+ };
26
+ /**
27
+ * `RunOptions` — what every cycle-7 governance write accepts beside its own
28
+ * parameters.
29
+ */
30
+ export declare const runOptionsShape: {
31
+ unitId: z.ZodOptional<z.ZodString>;
32
+ metadataIpfs: z.ZodOptional<z.ZodString>;
33
+ };
34
+ /** Pick the `RunOptions` out of a tool's arguments. */
35
+ export declare const runOptions: (args: {
36
+ unitId?: string;
37
+ metadataIpfs?: string;
38
+ }) => {
39
+ unitId?: string;
40
+ metadataIpfs?: string;
41
+ };
42
+ /** `ProposalConfigInput` — one type's voting rules, as a nested object. */
43
+ export declare const proposalConfig: z.ZodObject<{
44
+ quorum: z.ZodNumber;
45
+ approvalThreshold: z.ZodNumber;
46
+ proposeThreshold: z.ZodNumber;
47
+ expiryMs: z.ZodNumber;
48
+ executionDelayMs: z.ZodNumber;
49
+ cooldownMs: z.ZodNumber;
50
+ composableAllowed: z.ZodOptional<z.ZodBoolean>;
51
+ permissions: z.ZodOptional<z.ZodNumber>;
52
+ borrowScope: z.ZodOptional<z.ZodArray<z.ZodString>>;
53
+ }, z.core.$strip>;
54
+ /**
55
+ * The same rules FLATTENED onto the tool input, for the tools whose SDK method
56
+ * takes a required nested `config`. A flat schema is materially easier for a
57
+ * tool caller to get right than a nested one.
58
+ */
59
+ export declare const flatConfigShape: {
60
+ quorum: z.ZodNumber;
61
+ approvalThreshold: z.ZodNumber;
62
+ proposeThreshold: z.ZodDefault<z.ZodNumber>;
63
+ expiryMs: z.ZodNumber;
64
+ executionDelayMs: z.ZodDefault<z.ZodNumber>;
65
+ cooldownMs: z.ZodDefault<z.ZodNumber>;
66
+ permissions: z.ZodOptional<z.ZodNumber>;
67
+ borrowScope: z.ZodOptional<z.ZodArray<z.ZodString>>;
68
+ };
69
+ export declare const FLAT_CONFIG_SYNTHETIC: {
70
+ quorum: string;
71
+ approvalThreshold: string;
72
+ proposeThreshold: string;
73
+ expiryMs: string;
74
+ executionDelayMs: string;
75
+ cooldownMs: string;
76
+ permissions: string;
77
+ borrowScope: string;
78
+ };
79
+ /** Reassemble {@link flatConfigShape} inputs into a `ProposalConfigInput`. */
80
+ export declare function assembleConfig(args: {
81
+ quorum: number;
82
+ approvalThreshold: number;
83
+ proposeThreshold?: number;
84
+ expiryMs: number;
85
+ executionDelayMs?: number;
86
+ cooldownMs?: number;
87
+ composableAllowed?: boolean;
88
+ permissions?: number;
89
+ borrowScope?: string[];
90
+ }): {
91
+ borrowScope?: string[] | undefined;
92
+ permissions?: number | undefined;
93
+ quorum: number;
94
+ approvalThreshold: number;
95
+ proposeThreshold: number;
96
+ expiryMs: number;
97
+ executionDelayMs: number;
98
+ cooldownMs: number;
99
+ };
100
+ /** A vault ACL subject. `machine` is checked like `player` but is a distinct value. */
101
+ export declare const vaultPrincipal: z.ZodObject<{
102
+ kind: z.ZodEnum<{
103
+ player: "player";
104
+ machine: "machine";
105
+ ou: "ou";
106
+ }>;
107
+ value: z.ZodString;
108
+ }, z.core.$strip>;
109
+ /** Open the organization handle a prepare tool acts through. */
110
+ export declare const openOrg: (ctx: RequestContext, args: {
111
+ orgId: string;
112
+ sender: string;
113
+ seat?: string;
114
+ }) => any;
115
+ /**
116
+ * What a prepared governance transaction will do, read off the bytes.
117
+ *
118
+ * The SDK's `run()` decides between executing and proposing, but under the
119
+ * capture executor it never returns — the build is intercepted before the
120
+ * `RunOutcome` is shaped — so the answer is taken from the transaction itself.
121
+ * That is the stronger evidence anyway: it is what the signer will commit to.
122
+ */
123
+ export declare function outcomeOf(targets: string[]): 'executed' | 'proposed';
124
+ type Outcome = {
125
+ status: string;
126
+ code?: string;
127
+ reason?: string;
128
+ };
129
+ /**
130
+ * Run a governance write with the capture executor and serialize the result.
131
+ *
132
+ * The SDK returns `RunOutcome` rather than throwing on a refusal, so a blocked
133
+ * action produces no transaction at all — reported as `prepared: false`, the
134
+ * same shape the trading tools use for "nothing to do". Non-governance writes
135
+ * (permissionless, cap-holder or member-gated) go through here too and always
136
+ * report `executed`.
137
+ */
138
+ export declare function preparedGovernance(ctx: RequestContext, sender: string, action: string, params: Record<string, unknown>, run: () => Promise<Outcome | unknown>): Promise<ToolResponse>;
139
+ /**
140
+ * Deep-convert SDK values JSON cannot carry: `Map` → object, `Set` → array.
141
+ * Bigints are left for `toJsonText`, which renders them as decimal strings.
142
+ */
143
+ export declare function plain(value: unknown): unknown;
144
+ export {};