@oneie/sdk 0.17.3 → 0.17.5
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/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/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.d.ts +56 -14
- 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/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/receiver-layers.d.ts +1 -1
- package/dist/receiver-layers.d.ts.map +1 -1
- package/dist/receiver-layers.js +36 -0
- package/dist/receiver-layers.js.map +1 -1
- package/dist/receivers.d.ts +1397 -50
- package/dist/receivers.d.ts.map +1 -1
- package/dist/receivers.js +1423 -62
- 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-one-vault.d.ts +21 -0
- package/dist/secrets-one-vault.d.ts.map +1 -0
- package/dist/secrets-one-vault.js +38 -0
- package/dist/secrets-one-vault.js.map +1 -0
- package/dist/secrets.d.ts +195 -0
- package/dist/secrets.d.ts.map +1 -0
- package/dist/secrets.js +377 -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 +41 -0
- package/package.json +37 -2
- package/src/generated/funs.json +1 -0
|
@@ -0,0 +1,195 @@
|
|
|
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
|
+
export type UseResult = {
|
|
91
|
+
ok: true;
|
|
92
|
+
status: number;
|
|
93
|
+
body: unknown;
|
|
94
|
+
used: {
|
|
95
|
+
secret: string;
|
|
96
|
+
grant: string;
|
|
97
|
+
today: number;
|
|
98
|
+
perDay: number;
|
|
99
|
+
};
|
|
100
|
+
} | {
|
|
101
|
+
ok: false;
|
|
102
|
+
refused: Refusal;
|
|
103
|
+
detail?: string;
|
|
104
|
+
};
|
|
105
|
+
/** The three kinds of document an owner signs. Closed. */
|
|
106
|
+
export declare const SIGNED_TYPES: readonly ["grant", "stop", "give"];
|
|
107
|
+
export type SignedType = (typeof SIGNED_TYPES)[number];
|
|
108
|
+
/**
|
|
109
|
+
* What a signature is over (plan D15): the kind of document, the vault whose grant-signers
|
|
110
|
+
* decide who may sign it, and the document itself. The verifier builds the bytes from this
|
|
111
|
+
* shape and nothing else, so a signature over one vault, or over a stop, never reads as a
|
|
112
|
+
* grant on another vault.
|
|
113
|
+
*/
|
|
114
|
+
export interface Signed<T = unknown> {
|
|
115
|
+
type: SignedType;
|
|
116
|
+
vault: string;
|
|
117
|
+
body: T;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* The bytes a grant is signed over: JSON with keys sorted at every depth, no whitespace, `sig` excluded.
|
|
121
|
+
* Same grant, same bytes, whatever the order its keys were written in. Array order is kept (it is data).
|
|
122
|
+
*/
|
|
123
|
+
export declare function canonicalGrant(g: Omit<Grant, 'sig'>): string;
|
|
124
|
+
/**
|
|
125
|
+
* The bytes any signed document is over: `{ body, type, vault }` with keys sorted at every depth,
|
|
126
|
+
* no whitespace, and the body's own `sig` left out so signing does not change what was signed.
|
|
127
|
+
* One function for the signer and the verifier — the only way the two can agree.
|
|
128
|
+
*/
|
|
129
|
+
export declare function canonicalSigned(s: Signed): string;
|
|
130
|
+
/** An id a route or a record key may carry: letters, digits, `:` `.` `_` `-`; 1–256 characters. */
|
|
131
|
+
export declare const SAFE_ID_RE: RegExp;
|
|
132
|
+
export declare const SAFE_ID_MAX = 256;
|
|
133
|
+
/** The workspace (and general id) rule — `safeId` in the web app, `whoOf` in the opener's endpoint door. */
|
|
134
|
+
export declare function isSafeId(v: unknown): v is string;
|
|
135
|
+
/**
|
|
136
|
+
* What an endpoint credential may be: printable ASCII, no control character (a CR/LF would split
|
|
137
|
+
* the header), no leading or trailing space (the transport trims it, so what is sent would not be
|
|
138
|
+
* what is scrubbed). Interior spaces are allowed — `Bearer <token>` under `Authorization`.
|
|
139
|
+
*/
|
|
140
|
+
export declare const ENDPOINT_VALUE_RE: RegExp;
|
|
141
|
+
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"];
|
|
142
|
+
export type ComposioOp = (typeof COMPOSIO_OPS)[number];
|
|
143
|
+
export declare const isComposioOp: (v: unknown) => v is ComposioOp;
|
|
144
|
+
/**
|
|
145
|
+
* Who is calling the Composio door — built by the web facade from ctx / the session, never from
|
|
146
|
+
* a request body. `workspace` is the Composio user id; `session` says a person is acting in a
|
|
147
|
+
* signed-in UI; `groups` is the chain the walk climbs (empty until C13).
|
|
148
|
+
*/
|
|
149
|
+
export interface ComposioCaller {
|
|
150
|
+
actor: string;
|
|
151
|
+
kind: 'person' | 'agent';
|
|
152
|
+
/** A person acting in a signed-in UI — false for a key principal and inside a workflow step. */
|
|
153
|
+
session: boolean;
|
|
154
|
+
workspace: string;
|
|
155
|
+
groups: string[];
|
|
156
|
+
/** For a session person: the facade's `callerControlsWorkspace(env, ownerSlug, workspace)` — the owner-session checks read this, never `workspace === actor`. False for everyone else. */
|
|
157
|
+
controls: boolean;
|
|
158
|
+
/** Inside a workflow step (`ctx.workflowStep` / `workflowRunId`): no lent-grant walk, and no_key once require-grants is on. */
|
|
159
|
+
workflow: boolean;
|
|
160
|
+
}
|
|
161
|
+
export declare const COMPOSIO_HOST = "backend.composio.dev";
|
|
162
|
+
export declare const COMPOSIO_PREFIX = "/api/v3.1";
|
|
163
|
+
/** 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`). */
|
|
164
|
+
export declare const ONE_COMPOSIO_SECRET = "one/composio";
|
|
165
|
+
/** One path segment — an account or session id, a toolkit slug. A cursor is a query value, never a segment (`cursor` below). */
|
|
166
|
+
export declare const COMPOSIO_SEGMENT_RE: RegExp;
|
|
167
|
+
/** A tool slug: upper-case letters, digits and underscores — `/tools/execute/proxy` is never one. */
|
|
168
|
+
export declare const COMPOSIO_SLUG_RE: RegExp;
|
|
169
|
+
export interface ComposioPlan {
|
|
170
|
+
method: 'GET' | 'POST' | 'DELETE';
|
|
171
|
+
/** The path under `COMPOSIO_PREFIX`, every segment already checked. */
|
|
172
|
+
path: string;
|
|
173
|
+
query?: Record<string, string>;
|
|
174
|
+
body?: Record<string, unknown>;
|
|
175
|
+
}
|
|
176
|
+
export type ComposioBuild = {
|
|
177
|
+
ok: true;
|
|
178
|
+
plan: ComposioPlan;
|
|
179
|
+
follow?: 'session.toolkits';
|
|
180
|
+
} | {
|
|
181
|
+
ok: false;
|
|
182
|
+
why: string;
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* The one request an op is — method, path and query / JSON body — for `workspace`, from `args`
|
|
186
|
+
* the caller chose. Every segment that comes from `args` is one checked segment; the user id is
|
|
187
|
+
* `workspace`; a key the op does not name is ignored, never forwarded. The opener re-checks the
|
|
188
|
+
* result against the providers row (exact template, named query keys, body keys) before sending.
|
|
189
|
+
*/
|
|
190
|
+
export declare function composioRequest(op: ComposioOp, workspace: string, args: Record<string, unknown>): ComposioBuild;
|
|
191
|
+
/** The tool slug a `tools.execute` names, or null: `COMPOSIO_SLUG_RE`, and never `proxy` in any case. */
|
|
192
|
+
export declare function composioToolSlug(args: Record<string, unknown>): string | null;
|
|
193
|
+
/** The second request of `session.toolkits`: the session's toolkits, from the first answer's `session_id`. Null when that answer names no session. */
|
|
194
|
+
export declare function composioFollow(op: ComposioOp, first: unknown): ComposioPlan | null;
|
|
195
|
+
//# sourceMappingURL=secrets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../src/secrets.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,uFAAuF;IACvF,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;;GAIG;AACH,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,8FAA8F;IAC9F,KAAK,EAAE,MAAM,CAAA;IACb,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,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE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O,CAAC,GAAG,aAAa,CAiI/G;AAED,yGAAyG;AACzG,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,CAI7E;AAED,sJAAsJ;AACtJ,wBAAgB,cAAc,CAAC,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI,CAKlF"}
|
package/dist/secrets.js
ADDED
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
// secrets.ts — the contract every secrets cycle codes against (text/secrets.md, text/secrets-todo.md
|
|
2
|
+
// Interface Contract #1). Types plus two pure functions. Import via the `@oneie/sdk/secrets` subpath
|
|
3
|
+
// (never the bare barrel). Receivers are NOT declared here: each lands with its resolver
|
|
4
|
+
// (secrets:call/used C6, secrets:give C8, secrets:grant/revoke C12, secrets:list C15).
|
|
5
|
+
/**
|
|
6
|
+
* Every reason a use is refused. Closed: the ten, no more. `cannot_verify` is the verifier's
|
|
7
|
+
* second answer (C7): the chain could not vouch for a signer it has never seen — not a no,
|
|
8
|
+
* not a yes, and never open (plan D3). `bad_key` (C6 repair 3) is the opener's answer to a
|
|
9
|
+
* sealed value it cannot send as-is — a byte outside printable ASCII, a CR/LF, a space the
|
|
10
|
+
* transport would trim — refused after the meter with no value and no length in the answer.
|
|
11
|
+
*/
|
|
12
|
+
export const REFUSALS = [
|
|
13
|
+
'no_key',
|
|
14
|
+
'bad_signature',
|
|
15
|
+
'cannot_verify',
|
|
16
|
+
'stopped',
|
|
17
|
+
'expired',
|
|
18
|
+
'over_limit',
|
|
19
|
+
'path_not_allowed',
|
|
20
|
+
'redirect',
|
|
21
|
+
'unknown_provider',
|
|
22
|
+
'bad_key',
|
|
23
|
+
];
|
|
24
|
+
/**
|
|
25
|
+
* The web side's own answers — what the `secrets:call` resolver refuses before, or instead of,
|
|
26
|
+
* the opener: a workflow step (never spends a lent grant), no `OPENER` binding, a binding that
|
|
27
|
+
* threw. Each is carried to `secrets:used` as `refused` and closed with a warn. `vault_not_yours`
|
|
28
|
+
* is `secrets:give`'s (C9 repair 2): a key is given only to a vault the session's own address
|
|
29
|
+
* holds — its owner, an active signer, or bound to it at birth.
|
|
30
|
+
*/
|
|
31
|
+
export const OPENER_ERRORS = ['not_in_workflow', 'opener_unbound', 'opener_unreachable', 'vault_not_yours'];
|
|
32
|
+
/** Everything `secrets:used.refused` may carry: the opener's REFUSALS, then the web side's own. One list. */
|
|
33
|
+
export const USED_REFUSALS = [...REFUSALS, ...OPENER_ERRORS];
|
|
34
|
+
/**
|
|
35
|
+
* The providers a key may be lent for — one name per row of secrets/src/providers.ts, which
|
|
36
|
+
* holds each row's host, header and paths. Closed HERE so there is one list: the z.enum on
|
|
37
|
+
* `secrets:call` and `secrets:used`, the opener's rows, and the resolver's in-process check
|
|
38
|
+
* (zod runs only at the HTTP edge) all read it. A name that is not here never becomes a path
|
|
39
|
+
* `actor → provider:<name>`.
|
|
40
|
+
*/
|
|
41
|
+
export const PROVIDER_NAMES = ['openai', 'anthropic', 'stripe', 'github', 'dataforseo', 'composio'];
|
|
42
|
+
export const isProviderName = (v) => typeof v === 'string' && PROVIDER_NAMES.includes(v);
|
|
43
|
+
/** The three kinds of document an owner signs. Closed. */
|
|
44
|
+
export const SIGNED_TYPES = ['grant', 'stop', 'give'];
|
|
45
|
+
function sortKeys(v) {
|
|
46
|
+
if (Array.isArray(v))
|
|
47
|
+
return v.map(sortKeys);
|
|
48
|
+
if (v && typeof v === 'object') {
|
|
49
|
+
const o = v;
|
|
50
|
+
// No prototype: a body from JSON.parse may carry its own `__proto__` key at any depth, and
|
|
51
|
+
// on a plain `{}` that assignment would set the prototype instead of copying the key, so
|
|
52
|
+
// JSON.stringify would drop it — an unsigned field the signature still covered. Every own
|
|
53
|
+
// key of the body lands in the bytes, `__proto__` included.
|
|
54
|
+
const out = Object.create(null);
|
|
55
|
+
for (const k of Object.keys(o).sort())
|
|
56
|
+
out[k] = sortKeys(o[k]);
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
return v;
|
|
60
|
+
}
|
|
61
|
+
function withoutSig(v) {
|
|
62
|
+
if (!v || typeof v !== 'object' || Array.isArray(v))
|
|
63
|
+
return v;
|
|
64
|
+
const { sig: _sig, ...rest } = v;
|
|
65
|
+
return rest;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The bytes a grant is signed over: JSON with keys sorted at every depth, no whitespace, `sig` excluded.
|
|
69
|
+
* Same grant, same bytes, whatever the order its keys were written in. Array order is kept (it is data).
|
|
70
|
+
*/
|
|
71
|
+
export function canonicalGrant(g) {
|
|
72
|
+
return JSON.stringify(sortKeys(withoutSig(g)));
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The bytes any signed document is over: `{ body, type, vault }` with keys sorted at every depth,
|
|
76
|
+
* no whitespace, and the body's own `sig` left out so signing does not change what was signed.
|
|
77
|
+
* One function for the signer and the verifier — the only way the two can agree.
|
|
78
|
+
*/
|
|
79
|
+
export function canonicalSigned(s) {
|
|
80
|
+
return JSON.stringify(sortKeys({ type: s.type, vault: s.vault, body: withoutSig(s.body) }));
|
|
81
|
+
}
|
|
82
|
+
// ── shared rules for the opener's endpoint door (C10 repair) ─────────────────
|
|
83
|
+
//
|
|
84
|
+
// One definition, imported by both sides, so the opener can never accept a workspace the web app
|
|
85
|
+
// refuses (or the reverse): `secrets/src/endpoint.ts` checks the binding-attested workspace with
|
|
86
|
+
// `isSafeId`, and `one.ie/web/src/lib/resolvers/_shared.ts` builds `safeId` on it. The re-seal and
|
|
87
|
+
// the opener's `put` read the same `ENDPOINT_VALUE_RE`, so a legacy value the opener would refuse is
|
|
88
|
+
// counted by the re-seal (`bad_value`) instead of being sent.
|
|
89
|
+
/** An id a route or a record key may carry: letters, digits, `:` `.` `_` `-`; 1–256 characters. */
|
|
90
|
+
export const SAFE_ID_RE = /^[A-Za-z0-9:._-]+$/;
|
|
91
|
+
export const SAFE_ID_MAX = 256;
|
|
92
|
+
/** The workspace (and general id) rule — `safeId` in the web app, `whoOf` in the opener's endpoint door. */
|
|
93
|
+
export function isSafeId(v) {
|
|
94
|
+
return typeof v === 'string' && v.length > 0 && v.length <= SAFE_ID_MAX && SAFE_ID_RE.test(v);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* What an endpoint credential may be: printable ASCII, no control character (a CR/LF would split
|
|
98
|
+
* the header), no leading or trailing space (the transport trims it, so what is sent would not be
|
|
99
|
+
* what is scrubbed). Interior spaces are allowed — `Bearer <token>` under `Authorization`.
|
|
100
|
+
*/
|
|
101
|
+
export const ENDPOINT_VALUE_RE = /^[\x21-\x7e](?:[\x20-\x7e]{0,8190}[\x21-\x7e])?$/;
|
|
102
|
+
// ── the Composio door's op surface (secrets C11a) ────────────────────────────
|
|
103
|
+
//
|
|
104
|
+
// One definition, read by two callers: the opener's `composio` door (`secrets/src/composio.ts`),
|
|
105
|
+
// which checks what it builds against the `composio` providers row before anything is sent, and
|
|
106
|
+
// the web facade's fallback (`one.ie/web/src/lib/composio.ts`, reached only while `env.OPENER`
|
|
107
|
+
// is unbound — plan D19), which sends the same request with the web app's own key, exactly the
|
|
108
|
+
// authority it has today. The op is a closed set of thirteen — the methods the web app was
|
|
109
|
+
// measured calling on the Composio SDK — and each is ONE method and ONE path template on the
|
|
110
|
+
// row (`session.toolkits` is the one op that is two requests: the session, then its toolkits).
|
|
111
|
+
// The Composio user id is ALWAYS the caller's workspace: an `args.user_id` / `user_ids` is not
|
|
112
|
+
// read. Nothing here imports the Composio SDK (card decision K1: REST on a row, never the SDK).
|
|
113
|
+
export const COMPOSIO_OPS = [
|
|
114
|
+
'connectedAccounts.list',
|
|
115
|
+
'connectedAccounts.get',
|
|
116
|
+
'connectedAccounts.initiate',
|
|
117
|
+
'connectedAccounts.link',
|
|
118
|
+
'connectedAccounts.delete',
|
|
119
|
+
'authConfigs.list',
|
|
120
|
+
'authConfigs.create',
|
|
121
|
+
'toolkits.getToolkits',
|
|
122
|
+
'toolkits.get',
|
|
123
|
+
'toolkits.getToolkitBySlug',
|
|
124
|
+
'tools.getTools',
|
|
125
|
+
'tools.execute',
|
|
126
|
+
'session.toolkits',
|
|
127
|
+
];
|
|
128
|
+
export const isComposioOp = (v) => typeof v === 'string' && COMPOSIO_OPS.includes(v);
|
|
129
|
+
export const COMPOSIO_HOST = 'backend.composio.dev';
|
|
130
|
+
export const COMPOSIO_PREFIX = '/api/v3.1';
|
|
131
|
+
/** 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`). */
|
|
132
|
+
export const ONE_COMPOSIO_SECRET = 'one/composio';
|
|
133
|
+
/** One path segment — an account or session id, a toolkit slug. A cursor is a query value, never a segment (`cursor` below). */
|
|
134
|
+
export const COMPOSIO_SEGMENT_RE = /^[A-Za-z0-9_-]{1,128}$/;
|
|
135
|
+
/** A tool slug: upper-case letters, digits and underscores — `/tools/execute/proxy` is never one. */
|
|
136
|
+
export const COMPOSIO_SLUG_RE = /^[A-Z0-9_]{1,128}$/;
|
|
137
|
+
const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
138
|
+
const seg = (v) => (typeof v === 'string' && COMPOSIO_SEGMENT_RE.test(v) ? v : null);
|
|
139
|
+
/**
|
|
140
|
+
* A paging cursor — a QUERY VALUE: Composio's is base64 (`Mi01MDA=` is "2-500"), so `=` and `+` are
|
|
141
|
+
* in. `/` stays out: the opener's resolveOperation refuses a `/` in the decoded query (the path-smuggle
|
|
142
|
+
* rule), so a cursor carrying one is refused here first — the named residual (C11 repair 1).
|
|
143
|
+
*/
|
|
144
|
+
const cursor = (v) => (typeof v === 'string' && /^[A-Za-z0-9_+=-]{1,256}$/.test(v) ? v : null);
|
|
145
|
+
const lower = (v) => (typeof v === 'string' && /^[a-z0-9_-]{1,128}$/.test(v) ? v : null);
|
|
146
|
+
const slugs = (v) => {
|
|
147
|
+
const list = Array.isArray(v) ? v : typeof v === 'string' ? v.split(',') : null;
|
|
148
|
+
if (!list || list.length === 0 || list.length > 50)
|
|
149
|
+
return null;
|
|
150
|
+
const out = [];
|
|
151
|
+
for (const x of list) {
|
|
152
|
+
if (typeof x !== 'string' || !/^[A-Za-z0-9_-]{1,128}$/.test(x))
|
|
153
|
+
return null;
|
|
154
|
+
out.push(x);
|
|
155
|
+
}
|
|
156
|
+
return out.join(',');
|
|
157
|
+
};
|
|
158
|
+
const statuses = (v) => {
|
|
159
|
+
if (!Array.isArray(v) || v.length === 0 || v.length > 7)
|
|
160
|
+
return null;
|
|
161
|
+
for (const x of v)
|
|
162
|
+
if (typeof x !== 'string' || !/^[A-Z_]{1,16}$/.test(x))
|
|
163
|
+
return null;
|
|
164
|
+
return v.join(',');
|
|
165
|
+
};
|
|
166
|
+
const limit = (v) => (Number.isInteger(v) && v >= 1 && v <= 500 ? String(v) : null);
|
|
167
|
+
const httpsUrl = (v) => {
|
|
168
|
+
if (typeof v !== 'string' || v.length > 2048)
|
|
169
|
+
return null;
|
|
170
|
+
try {
|
|
171
|
+
const u = new URL(v);
|
|
172
|
+
return u.protocol === 'https:' && !u.username && !u.password ? v : null;
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
const str = (v, max = 256) => (typeof v === 'string' && v.length > 0 && v.length <= max && !/[\x00-\x1f\x7f]/.test(v) ? v : null);
|
|
179
|
+
/** Each optional query key: present → checked and copied, absent → nothing; a bad value refuses the whole request. */
|
|
180
|
+
function pick(args, rules) {
|
|
181
|
+
const q = {};
|
|
182
|
+
for (const [k, rule] of Object.entries(rules)) {
|
|
183
|
+
if (args[k] === undefined)
|
|
184
|
+
continue;
|
|
185
|
+
const v = rule(args[k]);
|
|
186
|
+
if (v === null)
|
|
187
|
+
return k;
|
|
188
|
+
q[k] = v;
|
|
189
|
+
}
|
|
190
|
+
return q;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* The one request an op is — method, path and query / JSON body — for `workspace`, from `args`
|
|
194
|
+
* the caller chose. Every segment that comes from `args` is one checked segment; the user id is
|
|
195
|
+
* `workspace`; a key the op does not name is ignored, never forwarded. The opener re-checks the
|
|
196
|
+
* result against the providers row (exact template, named query keys, body keys) before sending.
|
|
197
|
+
*/
|
|
198
|
+
export function composioRequest(op, workspace, args) {
|
|
199
|
+
if (!isSafeId(workspace))
|
|
200
|
+
return { ok: false, why: 'workspace' };
|
|
201
|
+
const bad = (why) => ({ ok: false, why });
|
|
202
|
+
switch (op) {
|
|
203
|
+
case 'connectedAccounts.list': {
|
|
204
|
+
const q = pick(args, { statuses, toolkit_slugs: slugs, auth_config_ids: slugs, limit, cursor });
|
|
205
|
+
if (typeof q === 'string')
|
|
206
|
+
return bad(q);
|
|
207
|
+
return { ok: true, plan: { method: 'GET', path: '/connected_accounts', query: { user_ids: workspace, ...q } } };
|
|
208
|
+
}
|
|
209
|
+
case 'connectedAccounts.get':
|
|
210
|
+
case 'connectedAccounts.delete': {
|
|
211
|
+
const id = seg(args['id']);
|
|
212
|
+
if (!id)
|
|
213
|
+
return bad('id');
|
|
214
|
+
return { ok: true, plan: { method: op === 'connectedAccounts.get' ? 'GET' : 'DELETE', path: `/connected_accounts/${id}` } };
|
|
215
|
+
}
|
|
216
|
+
case 'connectedAccounts.initiate': {
|
|
217
|
+
const authConfigId = seg(args['auth_config_id']);
|
|
218
|
+
if (!authConfigId)
|
|
219
|
+
return bad('auth_config_id');
|
|
220
|
+
const connection = { user_id: workspace };
|
|
221
|
+
if (args['callback_url'] !== undefined) {
|
|
222
|
+
const u = httpsUrl(args['callback_url']);
|
|
223
|
+
if (!u)
|
|
224
|
+
return bad('callback_url');
|
|
225
|
+
connection['callback_url'] = u;
|
|
226
|
+
}
|
|
227
|
+
if (args['state'] !== undefined) {
|
|
228
|
+
if (!isObj(args['state']))
|
|
229
|
+
return bad('state');
|
|
230
|
+
connection['state'] = args['state'];
|
|
231
|
+
}
|
|
232
|
+
if (args['alias'] !== undefined) {
|
|
233
|
+
const a = str(args['alias'], 128);
|
|
234
|
+
if (!a)
|
|
235
|
+
return bad('alias');
|
|
236
|
+
connection['alias'] = a;
|
|
237
|
+
}
|
|
238
|
+
return { ok: true, plan: { method: 'POST', path: '/connected_accounts', body: { auth_config: { id: authConfigId }, connection } } };
|
|
239
|
+
}
|
|
240
|
+
case 'connectedAccounts.link': {
|
|
241
|
+
const authConfigId = seg(args['auth_config_id']);
|
|
242
|
+
if (!authConfigId)
|
|
243
|
+
return bad('auth_config_id');
|
|
244
|
+
const body = { auth_config_id: authConfigId, user_id: workspace };
|
|
245
|
+
if (args['callback_url'] !== undefined) {
|
|
246
|
+
const u = httpsUrl(args['callback_url']);
|
|
247
|
+
if (!u)
|
|
248
|
+
return bad('callback_url');
|
|
249
|
+
body['callback_url'] = u;
|
|
250
|
+
}
|
|
251
|
+
if (args['alias'] !== undefined) {
|
|
252
|
+
const a = str(args['alias'], 128);
|
|
253
|
+
if (!a)
|
|
254
|
+
return bad('alias');
|
|
255
|
+
body['alias'] = a;
|
|
256
|
+
}
|
|
257
|
+
return { ok: true, plan: { method: 'POST', path: '/connected_accounts/link', body } };
|
|
258
|
+
}
|
|
259
|
+
case 'authConfigs.list': {
|
|
260
|
+
const q = pick(args, { toolkit_slug: lower, limit, cursor });
|
|
261
|
+
if (typeof q === 'string')
|
|
262
|
+
return bad(q);
|
|
263
|
+
return { ok: true, plan: { method: 'GET', path: '/auth_configs', query: q } };
|
|
264
|
+
}
|
|
265
|
+
case 'authConfigs.create': {
|
|
266
|
+
const toolkit = lower(args['toolkit_slug']);
|
|
267
|
+
if (!toolkit)
|
|
268
|
+
return bad('toolkit_slug');
|
|
269
|
+
const ac = args['auth_config'];
|
|
270
|
+
if (!isObj(ac))
|
|
271
|
+
return bad('auth_config');
|
|
272
|
+
const type = ac['type'];
|
|
273
|
+
if (type !== 'use_composio_managed_auth' && type !== 'use_custom_auth')
|
|
274
|
+
return bad('auth_config.type');
|
|
275
|
+
const out = { type };
|
|
276
|
+
for (const k of Object.keys(ac)) {
|
|
277
|
+
if (k === 'type')
|
|
278
|
+
continue;
|
|
279
|
+
if (k === 'name') {
|
|
280
|
+
const n = str(ac[k], 128);
|
|
281
|
+
if (!n)
|
|
282
|
+
return bad('auth_config.name');
|
|
283
|
+
out[k] = n;
|
|
284
|
+
}
|
|
285
|
+
else if (k === 'authScheme' && type === 'use_custom_auth') {
|
|
286
|
+
const a = typeof ac[k] === 'string' && /^[A-Z0-9_]{1,32}$/.test(ac[k]) ? ac[k] : null;
|
|
287
|
+
if (!a)
|
|
288
|
+
return bad('auth_config.authScheme');
|
|
289
|
+
out[k] = a;
|
|
290
|
+
}
|
|
291
|
+
else if (k === 'credentials') {
|
|
292
|
+
if (!isObj(ac[k]))
|
|
293
|
+
return bad('auth_config.credentials');
|
|
294
|
+
out[k] = ac[k];
|
|
295
|
+
}
|
|
296
|
+
else
|
|
297
|
+
return bad(`auth_config.${k}`);
|
|
298
|
+
}
|
|
299
|
+
return { ok: true, plan: { method: 'POST', path: '/auth_configs', body: { toolkit: { slug: toolkit }, auth_config: out } } };
|
|
300
|
+
}
|
|
301
|
+
case 'toolkits.getToolkits': {
|
|
302
|
+
const q = pick(args, { category: lower, limit, cursor });
|
|
303
|
+
if (typeof q === 'string')
|
|
304
|
+
return bad(q);
|
|
305
|
+
return { ok: true, plan: { method: 'GET', path: '/toolkits', query: q } };
|
|
306
|
+
}
|
|
307
|
+
case 'toolkits.get':
|
|
308
|
+
case 'toolkits.getToolkitBySlug': {
|
|
309
|
+
const slug = seg(args['slug']);
|
|
310
|
+
if (!slug)
|
|
311
|
+
return bad('slug');
|
|
312
|
+
return { ok: true, plan: { method: 'GET', path: `/toolkits/${slug}` } };
|
|
313
|
+
}
|
|
314
|
+
case 'tools.getTools': {
|
|
315
|
+
const q = pick(args, { toolkit_slug: slugs, tool_slugs: slugs, limit, cursor, important: (v) => (v === true || v === 'true' ? 'true' : v === false || v === 'false' ? 'false' : null) });
|
|
316
|
+
if (typeof q === 'string')
|
|
317
|
+
return bad(q);
|
|
318
|
+
if (!q['toolkit_slug'] && !q['tool_slugs'])
|
|
319
|
+
return bad('toolkit_slug');
|
|
320
|
+
return { ok: true, plan: { method: 'GET', path: '/tools', query: q } };
|
|
321
|
+
}
|
|
322
|
+
case 'tools.execute': {
|
|
323
|
+
const slug = composioToolSlug(args);
|
|
324
|
+
if (!slug)
|
|
325
|
+
return bad('slug');
|
|
326
|
+
const body = { user_id: workspace };
|
|
327
|
+
if (args['arguments'] !== undefined) {
|
|
328
|
+
if (!isObj(args['arguments']))
|
|
329
|
+
return bad('arguments');
|
|
330
|
+
body['arguments'] = args['arguments'];
|
|
331
|
+
}
|
|
332
|
+
if (args['connected_account_id'] !== undefined) {
|
|
333
|
+
const id = seg(args['connected_account_id']);
|
|
334
|
+
if (!id)
|
|
335
|
+
return bad('connected_account_id');
|
|
336
|
+
body['connected_account_id'] = id;
|
|
337
|
+
}
|
|
338
|
+
if (args['version'] !== undefined) {
|
|
339
|
+
const v = typeof args['version'] === 'string' && /^[A-Za-z0-9_.-]{1,32}$/.test(args['version']) ? args['version'] : null;
|
|
340
|
+
if (!v)
|
|
341
|
+
return bad('version');
|
|
342
|
+
body['version'] = v;
|
|
343
|
+
}
|
|
344
|
+
return { ok: true, plan: { method: 'POST', path: `/tools/execute/${slug}`, body } };
|
|
345
|
+
}
|
|
346
|
+
case 'session.toolkits': {
|
|
347
|
+
const list = args['toolkits'] === undefined ? [] : args['toolkits'];
|
|
348
|
+
if (!Array.isArray(list) || list.length > 50)
|
|
349
|
+
return bad('toolkits');
|
|
350
|
+
for (const x of list)
|
|
351
|
+
if (typeof x !== 'string' || !/^[A-Za-z0-9_-]{1,128}$/.test(x))
|
|
352
|
+
return bad('toolkits');
|
|
353
|
+
return {
|
|
354
|
+
ok: true,
|
|
355
|
+
follow: 'session.toolkits',
|
|
356
|
+
plan: { method: 'POST', path: '/tool_router/session', body: { user_id: workspace, toolkits: { enable: list }, manage_connections: { enable: true } } },
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
/** The tool slug a `tools.execute` names, or null: `COMPOSIO_SLUG_RE`, and never `proxy` in any case. */
|
|
362
|
+
export function composioToolSlug(args) {
|
|
363
|
+
const v = args['slug'];
|
|
364
|
+
if (typeof v !== 'string' || !COMPOSIO_SLUG_RE.test(v) || v.toLowerCase() === 'proxy')
|
|
365
|
+
return null;
|
|
366
|
+
return v;
|
|
367
|
+
}
|
|
368
|
+
/** The second request of `session.toolkits`: the session's toolkits, from the first answer's `session_id`. Null when that answer names no session. */
|
|
369
|
+
export function composioFollow(op, first) {
|
|
370
|
+
if (op !== 'session.toolkits' || !isObj(first))
|
|
371
|
+
return null;
|
|
372
|
+
const id = seg(first['session_id']);
|
|
373
|
+
if (!id)
|
|
374
|
+
return null;
|
|
375
|
+
return { method: 'GET', path: `/tool_router/session/${id}/toolkits` };
|
|
376
|
+
}
|
|
377
|
+
//# sourceMappingURL=secrets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets.js","sourceRoot":"","sources":["../src/secrets.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,qGAAqG;AACrG,yFAAyF;AACzF,uFAAuF;AA4CvF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,QAAQ;IACR,eAAe;IACf,eAAe;IACf,SAAS;IACT,SAAS;IACT,YAAY;IACZ,kBAAkB;IAClB,UAAU;IACV,kBAAkB;IAClB,SAAS;CACD,CAAA;AAIV;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,iBAAiB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,iBAAiB,CAAU,CAAA;AAIpH,6GAA6G;AAC7G,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAG,QAAQ,EAAE,GAAG,aAAa,CAAU,CAAA;AAIrE;;;;;;GAMG;AACH,MAAM,CAAC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