@oneie/sdk 0.17.4 → 0.17.6
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.
- package/README.md +4 -0
- package/dist/.build-fingerprint +1 -0
- package/dist/age.d.ts +96 -0
- package/dist/age.d.ts.map +1 -0
- package/dist/age.js +487 -0
- package/dist/age.js.map +1 -0
- package/dist/billing.d.ts +244 -14
- package/dist/billing.d.ts.map +1 -1
- package/dist/billing.js +374 -55
- package/dist/billing.js.map +1 -1
- package/dist/blocks.d.ts +8 -4
- package/dist/blocks.d.ts.map +1 -1
- package/dist/blocks.js +17 -5
- package/dist/blocks.js.map +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +8 -1
- package/dist/client.js.map +1 -1
- package/dist/edge/solve.d.ts +38 -0
- package/dist/edge/solve.d.ts.map +1 -0
- package/dist/edge/solve.js +334 -0
- package/dist/edge/solve.js.map +1 -0
- package/dist/edge/types.d.ts +216 -0
- package/dist/edge/types.d.ts.map +1 -0
- package/dist/edge/types.js +21 -0
- package/dist/edge/types.js.map +1 -0
- package/dist/edge/validate.d.ts +19 -0
- package/dist/edge/validate.d.ts.map +1 -0
- package/dist/edge/validate.js +89 -0
- package/dist/edge/validate.js.map +1 -0
- package/dist/edge.d.ts +9 -0
- package/dist/edge.d.ts.map +1 -0
- package/dist/edge.js +8 -0
- package/dist/edge.js.map +1 -0
- package/dist/fn-allowlist.d.ts +1 -1
- package/dist/fn-allowlist.d.ts.map +1 -1
- package/dist/fn-allowlist.js +14 -0
- package/dist/fn-allowlist.js.map +1 -1
- package/dist/gateway.d.ts +18 -1
- package/dist/gateway.d.ts.map +1 -1
- package/dist/gateway.js +77 -3
- package/dist/gateway.js.map +1 -1
- package/dist/generated/fn-map.d.ts +2 -2
- package/dist/generated/fn-map.d.ts.map +1 -1
- package/dist/generated/fn-map.js +114 -13
- package/dist/generated/fn-map.js.map +1 -1
- package/dist/generated/schemas/index.d.ts +2 -2
- package/dist/generated/schemas.d.ts +65 -23
- package/dist/generated/schemas.d.ts.map +1 -1
- package/dist/generated/schemas.js +32 -1
- package/dist/generated/schemas.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/market.d.ts.map +1 -1
- package/dist/market.js +6 -0
- package/dist/market.js.map +1 -1
- package/dist/message-key.d.ts +20 -0
- package/dist/message-key.d.ts.map +1 -0
- package/dist/message-key.js +46 -0
- package/dist/message-key.js.map +1 -0
- package/dist/message-lock.d.ts +56 -0
- package/dist/message-lock.d.ts.map +1 -0
- package/dist/message-lock.js +157 -0
- package/dist/message-lock.js.map +1 -0
- package/dist/meta.d.ts +13 -0
- package/dist/meta.d.ts.map +1 -1
- package/dist/meta.js +11 -0
- package/dist/meta.js.map +1 -1
- package/dist/prices/vendors.d.ts +7 -0
- package/dist/prices/vendors.d.ts.map +1 -0
- package/dist/prices/vendors.js +229 -0
- package/dist/prices/vendors.js.map +1 -0
- package/dist/prices.d.ts +41 -0
- package/dist/prices.d.ts.map +1 -0
- package/dist/prices.js +79 -0
- package/dist/prices.js.map +1 -0
- package/dist/receiver-layers.d.ts +27 -1
- package/dist/receiver-layers.d.ts.map +1 -1
- package/dist/receiver-layers.js +85 -5
- package/dist/receiver-layers.js.map +1 -1
- package/dist/receivers.d.ts +1773 -103
- package/dist/receivers.d.ts.map +1 -1
- package/dist/receivers.js +1910 -179
- package/dist/receivers.js.map +1 -1
- package/dist/secrets-give.d.ts +120 -0
- package/dist/secrets-give.d.ts.map +1 -0
- package/dist/secrets-give.js +160 -0
- package/dist/secrets-give.js.map +1 -0
- package/dist/secrets-grant.d.ts +52 -0
- package/dist/secrets-grant.d.ts.map +1 -0
- package/dist/secrets-grant.js +55 -0
- package/dist/secrets-grant.js.map +1 -0
- package/dist/secrets-key.d.ts +20 -0
- package/dist/secrets-key.d.ts.map +1 -0
- package/dist/secrets-key.js +47 -0
- package/dist/secrets-key.js.map +1 -0
- package/dist/secrets-list.d.ts +169 -0
- package/dist/secrets-list.d.ts.map +1 -0
- package/dist/secrets-list.js +13 -0
- package/dist/secrets-list.js.map +1 -0
- package/dist/secrets-one-vault.d.ts +53 -0
- package/dist/secrets-one-vault.d.ts.map +1 -0
- package/dist/secrets-one-vault.js +78 -0
- package/dist/secrets-one-vault.js.map +1 -0
- package/dist/secrets.d.ts +204 -0
- package/dist/secrets.d.ts.map +1 -0
- package/dist/secrets.js +389 -0
- package/dist/secrets.js.map +1 -0
- package/dist/templates.js +6 -6
- package/dist/templates.js.map +1 -1
- package/dist/work-contract-grammar.json +77 -5
- package/dist/work-contract.d.ts +24 -0
- package/dist/work-contract.d.ts.map +1 -1
- package/dist/work-contract.js +55 -0
- package/dist/work-contract.js.map +1 -1
- package/package.json +42 -3
- package/src/generated/funs.json +1 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/** What the web resolver hands the opener's `list` door — from ctx and D1, never from `data`. */
|
|
2
|
+
export interface ListInput {
|
|
3
|
+
/** The attested caller (`callerOf(ctx)`). */
|
|
4
|
+
actor: string;
|
|
5
|
+
/** An agent caller's D1 owner (`actor_owners`, D22) — the walk's rung 2. Absent for a person. */
|
|
6
|
+
owner?: string;
|
|
7
|
+
/** The caller's D26 chain, bare slugs, as `groupChainFor` builds it. At most 64. */
|
|
8
|
+
groups: string[];
|
|
9
|
+
/** The members of `groups` whose keys the caller may manage (`mayGiveForGroup`). */
|
|
10
|
+
gives: string[];
|
|
11
|
+
}
|
|
12
|
+
/** One row of the opener's call log. Nothing else is ever logged: no path, body, header or status body. */
|
|
13
|
+
export interface ListCall {
|
|
14
|
+
/** ISO-8601, when the opener counted it. */
|
|
15
|
+
at: string;
|
|
16
|
+
/** The grant's ref (record hash), or `none` (step one, ONE's Composio key with no grant) or `session` (the owner's own UI, step two). */
|
|
17
|
+
grant: string;
|
|
18
|
+
actor: string;
|
|
19
|
+
/** The catalogue entry id, or the Composio tool slug. */
|
|
20
|
+
entry: string;
|
|
21
|
+
outcome: 'counted' | 'over_limit';
|
|
22
|
+
}
|
|
23
|
+
export interface ListGrant {
|
|
24
|
+
id: string;
|
|
25
|
+
ref: string;
|
|
26
|
+
to: {
|
|
27
|
+
kind: 'actor' | 'group';
|
|
28
|
+
id: string;
|
|
29
|
+
agents?: string[];
|
|
30
|
+
};
|
|
31
|
+
for: {
|
|
32
|
+
paths?: string[];
|
|
33
|
+
models?: string[];
|
|
34
|
+
tools?: string[];
|
|
35
|
+
};
|
|
36
|
+
perDay: number;
|
|
37
|
+
until: string;
|
|
38
|
+
/** `store.count(ref, today)` — the opener's meter. */
|
|
39
|
+
today: number;
|
|
40
|
+
stopped: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface ListKey {
|
|
43
|
+
vault: string;
|
|
44
|
+
name: string;
|
|
45
|
+
provider: string;
|
|
46
|
+
last4: string;
|
|
47
|
+
flagged: string | null;
|
|
48
|
+
subject: {
|
|
49
|
+
kind: 'actor' | 'group';
|
|
50
|
+
id: string;
|
|
51
|
+
};
|
|
52
|
+
/** What a Rotate signs as `replaces` (D18). */
|
|
53
|
+
sigHash: string;
|
|
54
|
+
givenAt: string | null;
|
|
55
|
+
grants: ListGrant[];
|
|
56
|
+
/** The opener's log for this key, newest first, at most 50. */
|
|
57
|
+
calls: ListCall[];
|
|
58
|
+
}
|
|
59
|
+
/** A key lent TO the caller. Never the lender's last4, vault or sigHash. */
|
|
60
|
+
export interface LentToMe {
|
|
61
|
+
ref: string;
|
|
62
|
+
name: string;
|
|
63
|
+
provider: string;
|
|
64
|
+
/** The key record's subject id — who lends it (secrets.md:769). */
|
|
65
|
+
from: string | null;
|
|
66
|
+
to: {
|
|
67
|
+
kind: 'actor' | 'group';
|
|
68
|
+
id: string;
|
|
69
|
+
agents?: string[];
|
|
70
|
+
};
|
|
71
|
+
left_today: number;
|
|
72
|
+
until: string;
|
|
73
|
+
perDay: number;
|
|
74
|
+
for: {
|
|
75
|
+
paths?: string[];
|
|
76
|
+
models?: string[];
|
|
77
|
+
tools?: string[];
|
|
78
|
+
};
|
|
79
|
+
/** The caller (or its owner, or its group) accepted this exact grant. */
|
|
80
|
+
accepted: boolean;
|
|
81
|
+
/** The lender is in the caller's family — it runs without an acceptance. */
|
|
82
|
+
family: boolean;
|
|
83
|
+
stopped: boolean;
|
|
84
|
+
}
|
|
85
|
+
export interface ListComposio {
|
|
86
|
+
group: string;
|
|
87
|
+
requireGrants: {
|
|
88
|
+
vault: string;
|
|
89
|
+
on: string;
|
|
90
|
+
} | null;
|
|
91
|
+
/** Calls on ONE's key with no grant today (step one). */
|
|
92
|
+
noGrantToday: number;
|
|
93
|
+
/** The newest calls on ONE's key with no grant (`none`) or by the owner's session (`session`). */
|
|
94
|
+
noGrantCalls: ListCall[];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* fresh: read within 60 s · held: the last list kept while the RPC is down (D3) · unavailable: none ·
|
|
98
|
+
* events: the person's own vault that holds no key yet, its list taken from the chain's events (the D1
|
|
99
|
+
* projection — display only, ruling 3), so its pending proposal can be accepted (D46).
|
|
100
|
+
*/
|
|
101
|
+
export type VaultState = 'fresh' | 'held' | 'unavailable' | 'events';
|
|
102
|
+
export interface ListVault {
|
|
103
|
+
vault: string;
|
|
104
|
+
grantSigners: string[];
|
|
105
|
+
state: VaultState;
|
|
106
|
+
}
|
|
107
|
+
/** What the `list` door answers. */
|
|
108
|
+
export type ListAnswer = {
|
|
109
|
+
ok: true;
|
|
110
|
+
keys: ListKey[];
|
|
111
|
+
lentToMe: LentToMe[];
|
|
112
|
+
composio: ListComposio[];
|
|
113
|
+
vaults: ListVault[];
|
|
114
|
+
/** A cut answer says so and names what was cut. */
|
|
115
|
+
capped: boolean;
|
|
116
|
+
cut?: string[];
|
|
117
|
+
} | {
|
|
118
|
+
ok: false;
|
|
119
|
+
refused: 'malformed';
|
|
120
|
+
detail?: string;
|
|
121
|
+
};
|
|
122
|
+
/** One VaultGrantSignersSet, as the desk shows it (from the D1 projection, display only). */
|
|
123
|
+
export interface SignerHistory {
|
|
124
|
+
who: string;
|
|
125
|
+
added: boolean;
|
|
126
|
+
sender: string;
|
|
127
|
+
after: string[];
|
|
128
|
+
at: number;
|
|
129
|
+
}
|
|
130
|
+
export interface SignerAlert {
|
|
131
|
+
level: 'alarm' | 'red' | 'flag';
|
|
132
|
+
code: 'transfer_cleared' | 'transfers_close' | 'seeded_by_owner' | 'withdrawn_unasked';
|
|
133
|
+
text: string;
|
|
134
|
+
/** The transaction it came from — the desk recognises a withdrawal its own button sent. */
|
|
135
|
+
digest?: string;
|
|
136
|
+
}
|
|
137
|
+
/** What the web resolver adds to each vault, from the projection — display only (ruling 3). */
|
|
138
|
+
export interface ListVaultView extends ListVault {
|
|
139
|
+
history: SignerHistory[];
|
|
140
|
+
pending: Array<{
|
|
141
|
+
who: string;
|
|
142
|
+
by: string;
|
|
143
|
+
}>;
|
|
144
|
+
pendingReset: {
|
|
145
|
+
readyAt: number;
|
|
146
|
+
text: string;
|
|
147
|
+
} | null;
|
|
148
|
+
alerts: SignerAlert[];
|
|
149
|
+
}
|
|
150
|
+
/** The page's own vault (D33/D38): born by the person, and `anchored` once a registered passkey accepted onto its list. */
|
|
151
|
+
export interface OwnVault {
|
|
152
|
+
vault: string;
|
|
153
|
+
anchored: boolean;
|
|
154
|
+
}
|
|
155
|
+
/** What `secrets:list` answers the page. */
|
|
156
|
+
export type DeskAnswer = (Omit<Extract<ListAnswer, {
|
|
157
|
+
ok: true;
|
|
158
|
+
}>, 'vaults'> & {
|
|
159
|
+
vaults: ListVaultView[];
|
|
160
|
+
ownVault: OwnVault | null;
|
|
161
|
+
}) | {
|
|
162
|
+
ok: false;
|
|
163
|
+
error?: string;
|
|
164
|
+
refused?: string;
|
|
165
|
+
detail?: string;
|
|
166
|
+
};
|
|
167
|
+
/** The require-grants OFF document's grant id (ruling 5): a Stop on the record's vault naming the group and the record's `on` — a re-ON makes every older OFF `stale`. */
|
|
168
|
+
export declare const requireGrantsOffId: (group: string, on: string) => string;
|
|
169
|
+
//# sourceMappingURL=secrets-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets-list.d.ts","sourceRoot":"","sources":["../src/secrets-list.ts"],"names":[],"mappings":"AAWA,iGAAiG;AACjG,MAAM,WAAW,SAAS;IACxB,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAA;IACb,iGAAiG;IACjG,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oFAAoF;IACpF,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,oFAAoF;IACpF,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB;AAED,2GAA2G;AAC3G,MAAM,WAAW,QAAQ;IACvB,4CAA4C;IAC5C,EAAE,EAAE,MAAM,CAAA;IACV,yIAAyI;IACzI,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,SAAS,GAAG,YAAY,CAAA;CAClC;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,EAAE,EAAE;QAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAA;IAC9D,GAAG,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAA;IAC9D,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,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;AAC/F,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC9C,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,OAAO,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC3C,YAAY,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IACtD,MAAM,EAAE,WAAW,EAAE,CAAA;CACtB;AAED,2HAA2H;AAC3H,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED,4CAA4C;AAC5C,MAAM,MAAM,UAAU,GAClB,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,CAAC,EAAE,QAAQ,CAAC,GAAG;IAAE,MAAM,EAAE,aAAa,EAAE,CAAC;IAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAA;CAAE,CAAC,GAC5G;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAEpE,0KAA0K;AAC1K,eAAO,MAAM,kBAAkB,GAAI,OAAO,MAAM,EAAE,IAAI,MAAM,KAAG,MAAyC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// secrets-list.ts — the owner's desk, as the opener answers it (text/secrets.md deliverable 14;
|
|
2
|
+
// text/secrets-plan.md § Signals, § Authority, § UI; D3, D9, D13–D15, D18–D20, D22–D26; C15).
|
|
3
|
+
// Import via the `@oneie/sdk/secrets-list` subpath (never the bare barrel); never secrets.ts
|
|
4
|
+
// (Interface Contract #1 — the contract file is C0's).
|
|
5
|
+
//
|
|
6
|
+
// `secrets:list` answers names and meters, never values: a key's name, its last four characters,
|
|
7
|
+
// who uses it through which grant, calls today, the opener's own call log (D9 — the meter the owner
|
|
8
|
+
// reads comes from the opener, so a caller that skips `secrets:used` cannot hide a call), what is lent
|
|
9
|
+
// to the caller, the Composio groups running without a grant, and each vault's grant-signer list.
|
|
10
|
+
// Never `sealed`, `sig`, a value or a body.
|
|
11
|
+
/** The require-grants OFF document's grant id (ruling 5): a Stop on the record's vault naming the group and the record's `on` — a re-ON makes every older OFF `stale`. */
|
|
12
|
+
export const requireGrantsOffId = (group, on) => `require-grants:${group}:${on}`;
|
|
13
|
+
//# sourceMappingURL=secrets-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets-list.js","sourceRoot":"","sources":["../src/secrets-list.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,8FAA8F;AAC9F,6FAA6F;AAC7F,uDAAuD;AACvD,EAAE;AACF,iGAAiG;AACjG,oGAAoG;AACpG,uGAAuG;AACvG,kGAAkG;AAClG,4CAA4C;AAgJ5C,0KAA0K;AAC1K,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAa,EAAE,EAAU,EAAU,EAAE,CAAC,kBAAkB,KAAK,IAAI,EAAE,EAAE,CAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** ONE's vault as a giver reads it: `readers` (`0x` + 64 hex each) and `sealedHash` (64 hex, or null). */
|
|
2
|
+
export interface OneVault {
|
|
3
|
+
readers: string[];
|
|
4
|
+
sealedHash: string | null;
|
|
5
|
+
}
|
|
6
|
+
/** Reads ONE's vault. Throws (or rejects) when it cannot be reached — a caller refuses, it never guesses. */
|
|
7
|
+
export type OneVaultReader = () => Promise<OneVault>;
|
|
8
|
+
/** The Interface Contract #7 fixture: ONE's lock (`age1…`) and the seal page's sha256. */
|
|
9
|
+
export interface OneVaultFixture {
|
|
10
|
+
oneLock: string | null;
|
|
11
|
+
sealPageHash: string | null;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The MIRROR of ONE's testnet vault, for the one reader that cannot reach a chain at build time: the
|
|
15
|
+
* seal page build bakes `oneLock` into the page (build-page.ts), and writes `sealPageHash` here. C14
|
|
16
|
+
* published 2026-11-08: ONE's vault (ONE_VAULT_ID.testnet) holds exactly this lock as its single
|
|
17
|
+
* reader and exactly this hash as its sealed_hash — tests/unit/secrets/one-vault-chain.test.ts reads
|
|
18
|
+
* the chain and fails the moment the two disagree. Every giver that CAN reach the chain reads it
|
|
19
|
+
* (`chainReader`), never this.
|
|
20
|
+
*/
|
|
21
|
+
export declare const ONE_VAULT_FIXTURE: Readonly<OneVaultFixture>;
|
|
22
|
+
/**
|
|
23
|
+
* ONE's vault per network (D5): a `Vault<USDC>` on the pinned vault package, line 0, owned by the
|
|
24
|
+
* dedicated `one-lock-owner` key, readers = [ONE's lock], sealed_hash = the seal page's sha256.
|
|
25
|
+
* Testnet: created tx BSbbBKyV…5k8, readers tx FKZoCf6N…WUYj, sealed_hash tx 7z4e13dv…jv52 (2026-11-08; re-set after the last page build).
|
|
26
|
+
*/
|
|
27
|
+
export declare const ONE_VAULT_ID: Readonly<Record<'testnet' | 'mainnet', string | null>>;
|
|
28
|
+
/** The part of Mysten's SuiGrpcClient this reader needs — injected, so the SDK carries no Sui dependency. */
|
|
29
|
+
export interface VaultJsonClient {
|
|
30
|
+
getObject(input: {
|
|
31
|
+
objectId: string;
|
|
32
|
+
include: {
|
|
33
|
+
json: true;
|
|
34
|
+
};
|
|
35
|
+
}): Promise<{
|
|
36
|
+
object?: {
|
|
37
|
+
json?: Record<string, unknown> | null;
|
|
38
|
+
} | null;
|
|
39
|
+
}>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* ONE's vault read from the chain (D5). `sealed_hash` arrives as base64 over gRPC JSON (or a byte
|
|
43
|
+
* array); `readers` as `0x` addresses. Throws when the vault cannot be read — a giver refuses, it never
|
|
44
|
+
* falls back to a constant.
|
|
45
|
+
*/
|
|
46
|
+
export declare function chainReader(client: VaultJsonClient, vaultId: string): OneVaultReader;
|
|
47
|
+
/** An `age1…` lock as the vault stores it: its 32 public bytes as an address (`0x` + 64 hex). */
|
|
48
|
+
export declare function lockToReader(lock: string): string;
|
|
49
|
+
/** A `readers` entry back to the `age1…` lock it is. Throws on anything but `0x` + 64 hex. */
|
|
50
|
+
export declare function readerToLock(entry: string): string;
|
|
51
|
+
/** The fixture as a reader of ONE's vault — `readers` holds the lock (or nothing), `sealedHash` the page hash. */
|
|
52
|
+
export declare function fixtureReader(f?: OneVaultFixture): OneVaultReader;
|
|
53
|
+
//# sourceMappingURL=secrets-one-vault.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets-one-vault.d.ts","sourceRoot":"","sources":["../src/secrets-one-vault.ts"],"names":[],"mappings":"AAgBA,0GAA0G;AAC1G,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B;AAED,6GAA6G;AAC7G,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAA;AAEpD,0FAA0F;AAC1F,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,eAAe,CAAkL,CAAA;AAE1O;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC,CAG9E,CAAA;AAEF,6GAA6G;AAC7G,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE;YAAE,IAAI,EAAE,IAAI,CAAA;SAAE,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,MAAM,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;SAAE,GAAG,IAAI,CAAA;KAAE,CAAC,CAAA;CACxI;AASD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CAUpF;AAID,iGAAiG;AACjG,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIjD;AAED,8FAA8F;AAC9F,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKlD;AAED,kHAAkH;AAClH,wBAAgB,aAAa,CAAC,CAAC,GAAE,eAAmC,GAAG,cAAc,CAEpF"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// secrets-one-vault.ts — what ONE's own vault says, read by every giver (text/secrets-plan.md D5;
|
|
2
|
+
// text/secrets-todo.md Interface Contract #7). Import via `@oneie/sdk/secrets-give`, which
|
|
3
|
+
// re-exports it.
|
|
4
|
+
//
|
|
5
|
+
// Ruled 2026-10-26 (C8 card): ONE's lock is the SINGLE entry in ONE's vault `readers`
|
|
6
|
+
// (schema/sui.tql — readers are "the keys a sealed file is wrapped to"; Move `vector<address>`,
|
|
7
|
+
// so ONE's 32-byte X25519 public key is one address-sized entry), and ONE's `sealed_hash` is
|
|
8
|
+
// the seal page's fingerprint. No new Move field.
|
|
9
|
+
//
|
|
10
|
+
// Until C14 publishes the vault package on testnet, the reader is a FIXTURE of the same shape —
|
|
11
|
+
// `{ oneLock, sealPageHash }` — behind the injectable `OneVaultReader`, so the day the chain
|
|
12
|
+
// answers, only the reader changes. The fixture's lock is null until ONE's lock is published:
|
|
13
|
+
// a reader with no lock gives `no_one_lock`, and no caller ever falls back to a constant.
|
|
14
|
+
import { decodeRecipient, encodeRecipient } from './age.js';
|
|
15
|
+
/**
|
|
16
|
+
* The MIRROR of ONE's testnet vault, for the one reader that cannot reach a chain at build time: the
|
|
17
|
+
* seal page build bakes `oneLock` into the page (build-page.ts), and writes `sealPageHash` here. C14
|
|
18
|
+
* published 2026-11-08: ONE's vault (ONE_VAULT_ID.testnet) holds exactly this lock as its single
|
|
19
|
+
* reader and exactly this hash as its sealed_hash — tests/unit/secrets/one-vault-chain.test.ts reads
|
|
20
|
+
* the chain and fails the moment the two disagree. Every giver that CAN reach the chain reads it
|
|
21
|
+
* (`chainReader`), never this.
|
|
22
|
+
*/
|
|
23
|
+
export const ONE_VAULT_FIXTURE = Object.freeze({ oneLock: 'age1wrs2zgfz8n8h0pt8aqfun37a0kkglhhakeu3ehq5853hhep90duqww5hnc', sealPageHash: 'dca7a16153467c9dd04d945f1823e5e1bd7265fa0bb6ebb52b05863f1efa1d4e' });
|
|
24
|
+
/**
|
|
25
|
+
* ONE's vault per network (D5): a `Vault<USDC>` on the pinned vault package, line 0, owned by the
|
|
26
|
+
* dedicated `one-lock-owner` key, readers = [ONE's lock], sealed_hash = the seal page's sha256.
|
|
27
|
+
* Testnet: created tx BSbbBKyV…5k8, readers tx FKZoCf6N…WUYj, sealed_hash tx 7z4e13dv…jv52 (2026-11-08; re-set after the last page build).
|
|
28
|
+
*/
|
|
29
|
+
export const ONE_VAULT_ID = Object.freeze({
|
|
30
|
+
testnet: '0x7f529460a8202adf73edd939a80fb17909204206248a12aab78d6ea8c162e4d6',
|
|
31
|
+
mainnet: null,
|
|
32
|
+
});
|
|
33
|
+
const b64ToHex = (s) => {
|
|
34
|
+
const bin = atob(s);
|
|
35
|
+
let hex = '';
|
|
36
|
+
for (let i = 0; i < bin.length; i++)
|
|
37
|
+
hex += bin.charCodeAt(i).toString(16).padStart(2, '0');
|
|
38
|
+
return hex;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* ONE's vault read from the chain (D5). `sealed_hash` arrives as base64 over gRPC JSON (or a byte
|
|
42
|
+
* array); `readers` as `0x` addresses. Throws when the vault cannot be read — a giver refuses, it never
|
|
43
|
+
* falls back to a constant.
|
|
44
|
+
*/
|
|
45
|
+
export function chainReader(client, vaultId) {
|
|
46
|
+
return async () => {
|
|
47
|
+
const r = await client.getObject({ objectId: vaultId, include: { json: true } });
|
|
48
|
+
const j = r.object?.json;
|
|
49
|
+
if (!j)
|
|
50
|
+
throw new Error('ONE’s vault is not on chain');
|
|
51
|
+
const readers = Array.isArray(j['readers']) ? j['readers'].filter((x) => typeof x === 'string' && READER_RE.test(x)).map((x) => x.toLowerCase()) : [];
|
|
52
|
+
const raw = j['sealed_hash'];
|
|
53
|
+
const hex = typeof raw === 'string' ? (/^[0-9a-f]{64}$/i.test(raw) ? raw.toLowerCase() : b64ToHex(raw)) : Array.isArray(raw) ? raw.map((b) => b.toString(16).padStart(2, '0')).join('') : '';
|
|
54
|
+
return { readers, sealedHash: /^[0-9a-f]{64}$/.test(hex) ? hex : null };
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const READER_RE = /^0x[0-9a-f]{64}$/i;
|
|
58
|
+
/** An `age1…` lock as the vault stores it: its 32 public bytes as an address (`0x` + 64 hex). */
|
|
59
|
+
export function lockToReader(lock) {
|
|
60
|
+
let hex = '0x';
|
|
61
|
+
for (const b of decodeRecipient(lock))
|
|
62
|
+
hex += b.toString(16).padStart(2, '0');
|
|
63
|
+
return hex;
|
|
64
|
+
}
|
|
65
|
+
/** A `readers` entry back to the `age1…` lock it is. Throws on anything but `0x` + 64 hex. */
|
|
66
|
+
export function readerToLock(entry) {
|
|
67
|
+
if (!READER_RE.test(entry))
|
|
68
|
+
throw new Error('a readers entry is 0x and 64 hex characters');
|
|
69
|
+
const bytes = new Uint8Array(32);
|
|
70
|
+
for (let i = 0; i < 32; i++)
|
|
71
|
+
bytes[i] = parseInt(entry.slice(2 + i * 2, 4 + i * 2), 16);
|
|
72
|
+
return encodeRecipient(bytes);
|
|
73
|
+
}
|
|
74
|
+
/** The fixture as a reader of ONE's vault — `readers` holds the lock (or nothing), `sealedHash` the page hash. */
|
|
75
|
+
export function fixtureReader(f = ONE_VAULT_FIXTURE) {
|
|
76
|
+
return async () => ({ readers: f.oneLock ? [lockToReader(f.oneLock)] : [], sealedHash: f.sealPageHash });
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=secrets-one-vault.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets-one-vault.js","sourceRoot":"","sources":["../src/secrets-one-vault.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,2FAA2F;AAC3F,iBAAiB;AACjB,EAAE;AACF,sFAAsF;AACtF,gGAAgG;AAChG,6FAA6F;AAC7F,kDAAkD;AAClD,EAAE;AACF,gGAAgG;AAChG,6FAA6F;AAC7F,8FAA8F;AAC9F,0FAA0F;AAE1F,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAiB3D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAA8B,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,gEAAgE,EAAE,YAAY,EAAE,kEAAkE,EAAE,CAAC,CAAA;AAE1O;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAA2D,MAAM,CAAC,MAAM,CAAC;IAChG,OAAO,EAAE,oEAAoE;IAC7E,OAAO,EAAE,IAAI;CACd,CAAC,CAAA;AAOF,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAU,EAAE;IACrC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;IACnB,IAAI,GAAG,GAAG,EAAE,CAAA;IACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAA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C,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,YAAY,EAAE,CAAC,CAAA;AAC1G,CAAC"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A key given to ONE (C8): sealed on the giver's side to ONE's lock, signed by a key on the
|
|
3
|
+
* vault's grant-signers. Names stay readable; `last4` is the only hint of the value. There is
|
|
4
|
+
* no `owner`: the VAULT is the authority (plan D14) — the opener holds `verify` to it — and an
|
|
5
|
+
* owner nobody checks would be a caller-chosen claim riding on a genuine signature.
|
|
6
|
+
*/
|
|
7
|
+
export interface SealedKey {
|
|
8
|
+
/** The Sui vault whose grant-signers decide who may give (and later lend) this key. */
|
|
9
|
+
vault: string;
|
|
10
|
+
name: string;
|
|
11
|
+
provider: string;
|
|
12
|
+
sealed: string;
|
|
13
|
+
sig: string;
|
|
14
|
+
last4: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A signed lending of one secret: who may use it, for what, how often, until when. Who may
|
|
18
|
+
* sign it is the vault's grant-signers list and nothing in the document (plan D14) — there is
|
|
19
|
+
* no `owner` field, because a field nobody checks is a second caller-chosen claim.
|
|
20
|
+
*/
|
|
21
|
+
export interface Grant {
|
|
22
|
+
id: string;
|
|
23
|
+
secret: string;
|
|
24
|
+
/** The Sui vault whose grant-signers list decides who may sign this grant (plan D14, D15). */
|
|
25
|
+
vault: string;
|
|
26
|
+
to: {
|
|
27
|
+
kind: 'actor' | 'group';
|
|
28
|
+
id: string;
|
|
29
|
+
agents?: string[];
|
|
30
|
+
};
|
|
31
|
+
for: {
|
|
32
|
+
models?: string[];
|
|
33
|
+
paths?: string[];
|
|
34
|
+
tools?: string[];
|
|
35
|
+
};
|
|
36
|
+
perDay: number;
|
|
37
|
+
/** ISO-8601 expiry. Required: a grant with no end is not a grant. */
|
|
38
|
+
until: string;
|
|
39
|
+
/** The owner's signature over `canonicalSigned({ type: 'grant', vault, body: grant })`. Absent until signed. */
|
|
40
|
+
sig?: string;
|
|
41
|
+
}
|
|
42
|
+
/** The owner's signed stop for one grant. */
|
|
43
|
+
export interface Stop {
|
|
44
|
+
grantId: string;
|
|
45
|
+
at: string;
|
|
46
|
+
sig: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Every reason a use is refused. Closed: the ten, no more. `cannot_verify` is the verifier's
|
|
50
|
+
* second answer (C7): the chain could not vouch for a signer it has never seen — not a no,
|
|
51
|
+
* not a yes, and never open (plan D3). `bad_key` (C6 repair 3) is the opener's answer to a
|
|
52
|
+
* sealed value it cannot send as-is — a byte outside printable ASCII, a CR/LF, a space the
|
|
53
|
+
* transport would trim — refused after the meter with no value and no length in the answer.
|
|
54
|
+
*/
|
|
55
|
+
export declare const REFUSALS: readonly ["no_key", "bad_signature", "cannot_verify", "stopped", "expired", "over_limit", "path_not_allowed", "redirect", "unknown_provider", "bad_key"];
|
|
56
|
+
export type Refusal = (typeof REFUSALS)[number];
|
|
57
|
+
/**
|
|
58
|
+
* The web side's own answers — what the `secrets:call` resolver refuses before, or instead of,
|
|
59
|
+
* the opener: a workflow step (never spends a lent grant), no `OPENER` binding, a binding that
|
|
60
|
+
* threw. Each is carried to `secrets:used` as `refused` and closed with a warn. `vault_not_yours`
|
|
61
|
+
* is `secrets:give`'s (C9 repair 2): a key is given only to a vault the session's own address
|
|
62
|
+
* holds — its owner, an active signer, or bound to it at birth.
|
|
63
|
+
*/
|
|
64
|
+
export declare const OPENER_ERRORS: readonly ["not_in_workflow", "opener_unbound", "opener_unreachable", "vault_not_yours"];
|
|
65
|
+
export type OpenerError = (typeof OPENER_ERRORS)[number];
|
|
66
|
+
/** Everything `secrets:used.refused` may carry: the opener's REFUSALS, then the web side's own. One list. */
|
|
67
|
+
export declare const USED_REFUSALS: readonly ["no_key", "bad_signature", "cannot_verify", "stopped", "expired", "over_limit", "path_not_allowed", "redirect", "unknown_provider", "bad_key", "not_in_workflow", "opener_unbound", "opener_unreachable", "vault_not_yours"];
|
|
68
|
+
export type UsedRefusal = (typeof USED_REFUSALS)[number];
|
|
69
|
+
/**
|
|
70
|
+
* The providers a key may be lent for — one name per row of secrets/src/providers.ts, which
|
|
71
|
+
* holds each row's host, header and paths. Closed HERE so there is one list: the z.enum on
|
|
72
|
+
* `secrets:call` and `secrets:used`, the opener's rows, and the resolver's in-process check
|
|
73
|
+
* (zod runs only at the HTTP edge) all read it. A name that is not here never becomes a path
|
|
74
|
+
* `actor → provider:<name>`.
|
|
75
|
+
*/
|
|
76
|
+
export declare const PROVIDER_NAMES: readonly ["openai", "anthropic", "stripe", "github", "dataforseo", "composio"];
|
|
77
|
+
export type ProviderName = (typeof PROVIDER_NAMES)[number];
|
|
78
|
+
export declare const isProviderName: (v: unknown) => v is ProviderName;
|
|
79
|
+
export interface UseRequest {
|
|
80
|
+
actor: string;
|
|
81
|
+
groups: string[];
|
|
82
|
+
provider: string;
|
|
83
|
+
secret?: string;
|
|
84
|
+
request: {
|
|
85
|
+
method: string;
|
|
86
|
+
path: string;
|
|
87
|
+
body?: unknown;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* "Unlimited calls a day" (D51, Tony 2026-11-08). The signed grant keeps `perDay` an integer the
|
|
92
|
+
* opener counts against — no format change, no unmetered door — so an unlimited lend carries this
|
|
93
|
+
* ceiling, and every surface that shows it says the ceiling is there (D35: show only what is enforced).
|
|
94
|
+
*/
|
|
95
|
+
export declare const UNLIMITED_PER_DAY = 1000000;
|
|
96
|
+
export declare const isUnlimited: (perDay: number) => boolean;
|
|
97
|
+
/** `50 a day`, or `no daily limit (ceiling 1,000,000 a day)` — the words the seal page signs and every desk shows. */
|
|
98
|
+
export declare function perDayWords(perDay: number): string;
|
|
99
|
+
export type UseResult = {
|
|
100
|
+
ok: true;
|
|
101
|
+
status: number;
|
|
102
|
+
body: unknown;
|
|
103
|
+
used: {
|
|
104
|
+
secret: string;
|
|
105
|
+
grant: string;
|
|
106
|
+
today: number;
|
|
107
|
+
perDay: number;
|
|
108
|
+
};
|
|
109
|
+
} | {
|
|
110
|
+
ok: false;
|
|
111
|
+
refused: Refusal;
|
|
112
|
+
detail?: string;
|
|
113
|
+
};
|
|
114
|
+
/** The three kinds of document an owner signs. Closed. */
|
|
115
|
+
export declare const SIGNED_TYPES: readonly ["grant", "stop", "give"];
|
|
116
|
+
export type SignedType = (typeof SIGNED_TYPES)[number];
|
|
117
|
+
/**
|
|
118
|
+
* What a signature is over (plan D15): the kind of document, the vault whose grant-signers
|
|
119
|
+
* decide who may sign it, and the document itself. The verifier builds the bytes from this
|
|
120
|
+
* shape and nothing else, so a signature over one vault, or over a stop, never reads as a
|
|
121
|
+
* grant on another vault.
|
|
122
|
+
*/
|
|
123
|
+
export interface Signed<T = unknown> {
|
|
124
|
+
type: SignedType;
|
|
125
|
+
vault: string;
|
|
126
|
+
body: T;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The bytes a grant is signed over: JSON with keys sorted at every depth, no whitespace, `sig` excluded.
|
|
130
|
+
* Same grant, same bytes, whatever the order its keys were written in. Array order is kept (it is data).
|
|
131
|
+
*/
|
|
132
|
+
export declare function canonicalGrant(g: Omit<Grant, 'sig'>): string;
|
|
133
|
+
/**
|
|
134
|
+
* The bytes any signed document is over: `{ body, type, vault }` with keys sorted at every depth,
|
|
135
|
+
* no whitespace, and the body's own `sig` left out so signing does not change what was signed.
|
|
136
|
+
* One function for the signer and the verifier — the only way the two can agree.
|
|
137
|
+
*/
|
|
138
|
+
export declare function canonicalSigned(s: Signed): string;
|
|
139
|
+
/** An id a route or a record key may carry: letters, digits, `:` `.` `_` `-`; 1–256 characters. */
|
|
140
|
+
export declare const SAFE_ID_RE: RegExp;
|
|
141
|
+
export declare const SAFE_ID_MAX = 256;
|
|
142
|
+
/** The workspace (and general id) rule — `safeId` in the web app, `whoOf` in the opener's endpoint door. */
|
|
143
|
+
export declare function isSafeId(v: unknown): v is string;
|
|
144
|
+
/**
|
|
145
|
+
* What an endpoint credential may be: printable ASCII, no control character (a CR/LF would split
|
|
146
|
+
* the header), no leading or trailing space (the transport trims it, so what is sent would not be
|
|
147
|
+
* what is scrubbed). Interior spaces are allowed — `Bearer <token>` under `Authorization`.
|
|
148
|
+
*/
|
|
149
|
+
export declare const ENDPOINT_VALUE_RE: RegExp;
|
|
150
|
+
export declare const COMPOSIO_OPS: readonly ["connectedAccounts.list", "connectedAccounts.get", "connectedAccounts.initiate", "connectedAccounts.link", "connectedAccounts.delete", "authConfigs.list", "authConfigs.create", "toolkits.getToolkits", "toolkits.get", "toolkits.getToolkitBySlug", "tools.getTools", "tools.execute", "session.toolkits"];
|
|
151
|
+
export type ComposioOp = (typeof COMPOSIO_OPS)[number];
|
|
152
|
+
export declare const isComposioOp: (v: unknown) => v is ComposioOp;
|
|
153
|
+
/**
|
|
154
|
+
* Who is calling the Composio door — built by the web facade from ctx / the session, never from
|
|
155
|
+
* a request body. `workspace` is the Composio user id; `session` says a person is acting in a
|
|
156
|
+
* signed-in UI; `groups` is the chain the walk climbs (empty until C13).
|
|
157
|
+
*/
|
|
158
|
+
export interface ComposioCaller {
|
|
159
|
+
actor: string;
|
|
160
|
+
kind: 'person' | 'agent';
|
|
161
|
+
/** A person acting in a signed-in UI — false for a key principal and inside a workflow step. */
|
|
162
|
+
session: boolean;
|
|
163
|
+
workspace: string;
|
|
164
|
+
groups: string[];
|
|
165
|
+
/** For a session person: the facade's `callerControlsWorkspace(env, ownerSlug, workspace)` — the owner-session checks read this, never `workspace === actor`. False for everyone else. */
|
|
166
|
+
controls: boolean;
|
|
167
|
+
/** Inside a workflow step (`ctx.workflowStep` / `workflowRunId`): no lent-grant walk, and no_key once require-grants is on. */
|
|
168
|
+
workflow: boolean;
|
|
169
|
+
}
|
|
170
|
+
export declare const COMPOSIO_HOST = "backend.composio.dev";
|
|
171
|
+
export declare const COMPOSIO_PREFIX = "/api/v3.1";
|
|
172
|
+
/** The name a grant on ONE's own Composio key carries as its `secret` (there is no sealed record for it: it is a wrangler secret on `one-secrets`). */
|
|
173
|
+
export declare const ONE_COMPOSIO_SECRET = "one/composio";
|
|
174
|
+
/** One path segment — an account or session id, a toolkit slug. A cursor is a query value, never a segment (`cursor` below). */
|
|
175
|
+
export declare const COMPOSIO_SEGMENT_RE: RegExp;
|
|
176
|
+
/** A tool slug: upper-case letters, digits and underscores — `/tools/execute/proxy` is never one. */
|
|
177
|
+
export declare const COMPOSIO_SLUG_RE: RegExp;
|
|
178
|
+
export interface ComposioPlan {
|
|
179
|
+
method: 'GET' | 'POST' | 'DELETE';
|
|
180
|
+
/** The path under `COMPOSIO_PREFIX`, every segment already checked. */
|
|
181
|
+
path: string;
|
|
182
|
+
query?: Record<string, string>;
|
|
183
|
+
body?: Record<string, unknown>;
|
|
184
|
+
}
|
|
185
|
+
export type ComposioBuild = {
|
|
186
|
+
ok: true;
|
|
187
|
+
plan: ComposioPlan;
|
|
188
|
+
follow?: 'session.toolkits';
|
|
189
|
+
} | {
|
|
190
|
+
ok: false;
|
|
191
|
+
why: string;
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* The one request an op is — method, path and query / JSON body — for `workspace`, from `args`
|
|
195
|
+
* the caller chose. Every segment that comes from `args` is one checked segment; the user id is
|
|
196
|
+
* `workspace`; a key the op does not name is ignored, never forwarded. The opener re-checks the
|
|
197
|
+
* result against the providers row (exact template, named query keys, body keys) before sending.
|
|
198
|
+
*/
|
|
199
|
+
export declare function composioRequest(op: ComposioOp, workspace: string, args: Record<string, unknown>): ComposioBuild;
|
|
200
|
+
/** The tool slug a `tools.execute` names, or null: `COMPOSIO_SLUG_RE`, and never `proxy` in any case. */
|
|
201
|
+
export declare function composioToolSlug(args: Record<string, unknown>): string | null;
|
|
202
|
+
/** The second request of `session.toolkits`: the session's toolkits, from the first answer's `session_id`. Null when that answer names no session. */
|
|
203
|
+
export declare function composioFollow(op: ComposioOp, first: unknown): Compos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