@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
package/dist/secrets.js
ADDED
|
@@ -0,0 +1,389 @@
|
|
|
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
|
+
/**
|
|
44
|
+
* "Unlimited calls a day" (D51, Tony 2026-11-08). The signed grant keeps `perDay` an integer the
|
|
45
|
+
* opener counts against — no format change, no unmetered door — so an unlimited lend carries this
|
|
46
|
+
* ceiling, and every surface that shows it says the ceiling is there (D35: show only what is enforced).
|
|
47
|
+
*/
|
|
48
|
+
export const UNLIMITED_PER_DAY = 1_000_000;
|
|
49
|
+
export const isUnlimited = (perDay) => perDay === UNLIMITED_PER_DAY; // exactly the D51 ceiling: any other number shows as itself (C15 review finding 5)
|
|
50
|
+
const grouped = (n) => String(n).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
51
|
+
/** `50 a day`, or `no daily limit (ceiling 1,000,000 a day)` — the words the seal page signs and every desk shows. */
|
|
52
|
+
export function perDayWords(perDay) {
|
|
53
|
+
return isUnlimited(perDay) ? `no daily limit (ceiling ${grouped(perDay)} a day)` : `${perDay} a day`;
|
|
54
|
+
}
|
|
55
|
+
/** The three kinds of document an owner signs. Closed. */
|
|
56
|
+
export const SIGNED_TYPES = ['grant', 'stop', 'give'];
|
|
57
|
+
function sortKeys(v) {
|
|
58
|
+
if (Array.isArray(v))
|
|
59
|
+
return v.map(sortKeys);
|
|
60
|
+
if (v && typeof v === 'object') {
|
|
61
|
+
const o = v;
|
|
62
|
+
// No prototype: a body from JSON.parse may carry its own `__proto__` key at any depth, and
|
|
63
|
+
// on a plain `{}` that assignment would set the prototype instead of copying the key, so
|
|
64
|
+
// JSON.stringify would drop it — an unsigned field the signature still covered. Every own
|
|
65
|
+
// key of the body lands in the bytes, `__proto__` included.
|
|
66
|
+
const out = Object.create(null);
|
|
67
|
+
for (const k of Object.keys(o).sort())
|
|
68
|
+
out[k] = sortKeys(o[k]);
|
|
69
|
+
return out;
|
|
70
|
+
}
|
|
71
|
+
return v;
|
|
72
|
+
}
|
|
73
|
+
function withoutSig(v) {
|
|
74
|
+
if (!v || typeof v !== 'object' || Array.isArray(v))
|
|
75
|
+
return v;
|
|
76
|
+
const { sig: _sig, ...rest } = v;
|
|
77
|
+
return rest;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The bytes a grant is signed over: JSON with keys sorted at every depth, no whitespace, `sig` excluded.
|
|
81
|
+
* Same grant, same bytes, whatever the order its keys were written in. Array order is kept (it is data).
|
|
82
|
+
*/
|
|
83
|
+
export function canonicalGrant(g) {
|
|
84
|
+
return JSON.stringify(sortKeys(withoutSig(g)));
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The bytes any signed document is over: `{ body, type, vault }` with keys sorted at every depth,
|
|
88
|
+
* no whitespace, and the body's own `sig` left out so signing does not change what was signed.
|
|
89
|
+
* One function for the signer and the verifier — the only way the two can agree.
|
|
90
|
+
*/
|
|
91
|
+
export function canonicalSigned(s) {
|
|
92
|
+
return JSON.stringify(sortKeys({ type: s.type, vault: s.vault, body: withoutSig(s.body) }));
|
|
93
|
+
}
|
|
94
|
+
// ── shared rules for the opener's endpoint door (C10 repair) ─────────────────
|
|
95
|
+
//
|
|
96
|
+
// One definition, imported by both sides, so the opener can never accept a workspace the web app
|
|
97
|
+
// refuses (or the reverse): `secrets/src/endpoint.ts` checks the binding-attested workspace with
|
|
98
|
+
// `isSafeId`, and `one.ie/web/src/lib/resolvers/_shared.ts` builds `safeId` on it. The re-seal and
|
|
99
|
+
// the opener's `put` read the same `ENDPOINT_VALUE_RE`, so a legacy value the opener would refuse is
|
|
100
|
+
// counted by the re-seal (`bad_value`) instead of being sent.
|
|
101
|
+
/** An id a route or a record key may carry: letters, digits, `:` `.` `_` `-`; 1–256 characters. */
|
|
102
|
+
export const SAFE_ID_RE = /^[A-Za-z0-9:._-]+$/;
|
|
103
|
+
export const SAFE_ID_MAX = 256;
|
|
104
|
+
/** The workspace (and general id) rule — `safeId` in the web app, `whoOf` in the opener's endpoint door. */
|
|
105
|
+
export function isSafeId(v) {
|
|
106
|
+
return typeof v === 'string' && v.length > 0 && v.length <= SAFE_ID_MAX && SAFE_ID_RE.test(v);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* What an endpoint credential may be: printable ASCII, no control character (a CR/LF would split
|
|
110
|
+
* the header), no leading or trailing space (the transport trims it, so what is sent would not be
|
|
111
|
+
* what is scrubbed). Interior spaces are allowed — `Bearer <token>` under `Authorization`.
|
|
112
|
+
*/
|
|
113
|
+
export const ENDPOINT_VALUE_RE = /^[\x21-\x7e](?:[\x20-\x7e]{0,8190}[\x21-\x7e])?$/;
|
|
114
|
+
// ── the Composio door's op surface (secrets C11a) ────────────────────────────
|
|
115
|
+
//
|
|
116
|
+
// One definition, read by two callers: the opener's `composio` door (`secrets/src/composio.ts`),
|
|
117
|
+
// which checks what it builds against the `composio` providers row before anything is sent, and
|
|
118
|
+
// the web facade's fallback (`one.ie/web/src/lib/composio.ts`, reached only while `env.OPENER`
|
|
119
|
+
// is unbound — plan D19), which sends the same request with the web app's own key, exactly the
|
|
120
|
+
// authority it has today. The op is a closed set of thirteen — the methods the web app was
|
|
121
|
+
// measured calling on the Composio SDK — and each is ONE method and ONE path template on the
|
|
122
|
+
// row (`session.toolkits` is the one op that is two requests: the session, then its toolkits).
|
|
123
|
+
// The Composio user id is ALWAYS the caller's workspace: an `args.user_id` / `user_ids` is not
|
|
124
|
+
// read. Nothing here imports the Composio SDK (card decision K1: REST on a row, never the SDK).
|
|
125
|
+
export const COMPOSIO_OPS = [
|
|
126
|
+
'connectedAccounts.list',
|
|
127
|
+
'connectedAccounts.get',
|
|
128
|
+
'connectedAccounts.initiate',
|
|
129
|
+
'connectedAccounts.link',
|
|
130
|
+
'connectedAccounts.delete',
|
|
131
|
+
'authConfigs.list',
|
|
132
|
+
'authConfigs.create',
|
|
133
|
+
'toolkits.getToolkits',
|
|
134
|
+
'toolkits.get',
|
|
135
|
+
'toolkits.getToolkitBySlug',
|
|
136
|
+
'tools.getTools',
|
|
137
|
+
'tools.execute',
|
|
138
|
+
'session.toolkits',
|
|
139
|
+
];
|
|
140
|
+
export const isComposioOp = (v) => typeof v === 'string' && COMPOSIO_OPS.includes(v);
|
|
141
|
+
export const COMPOSIO_HOST = 'backend.composio.dev';
|
|
142
|
+
export const COMPOSIO_PREFIX = '/api/v3.1';
|
|
143
|
+
/** 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`). */
|
|
144
|
+
export const ONE_COMPOSIO_SECRET = 'one/composio';
|
|
145
|
+
/** One path segment — an account or session id, a toolkit slug. A cursor is a query value, never a segment (`cursor` below). */
|
|
146
|
+
export const COMPOSIO_SEGMENT_RE = /^[A-Za-z0-9_-]{1,128}$/;
|
|
147
|
+
/** A tool slug: upper-case letters, digits and underscores — `/tools/execute/proxy` is never one. */
|
|
148
|
+
export const COMPOSIO_SLUG_RE = /^[A-Z0-9_]{1,128}$/;
|
|
149
|
+
const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
150
|
+
const seg = (v) => (typeof v === 'string' && COMPOSIO_SEGMENT_RE.test(v) ? v : null);
|
|
151
|
+
/**
|
|
152
|
+
* A paging cursor — a QUERY VALUE: Composio's is base64 (`Mi01MDA=` is "2-500"), so `=` and `+` are
|
|
153
|
+
* in. `/` stays out: the opener's resolveOperation refuses a `/` in the decoded query (the path-smuggle
|
|
154
|
+
* rule), so a cursor carrying one is refused here first — the named residual (C11 repair 1).
|
|
155
|
+
*/
|
|
156
|
+
const cursor = (v) => (typeof v === 'string' && /^[A-Za-z0-9_+=-]{1,256}$/.test(v) ? v : null);
|
|
157
|
+
const lower = (v) => (typeof v === 'string' && /^[a-z0-9_-]{1,128}$/.test(v) ? v : null);
|
|
158
|
+
const slugs = (v) => {
|
|
159
|
+
const list = Array.isArray(v) ? v : typeof v === 'string' ? v.split(',') : null;
|
|
160
|
+
if (!list || list.length === 0 || list.length > 50)
|
|
161
|
+
return null;
|
|
162
|
+
const out = [];
|
|
163
|
+
for (const x of list) {
|
|
164
|
+
if (typeof x !== 'string' || !/^[A-Za-z0-9_-]{1,128}$/.test(x))
|
|
165
|
+
return null;
|
|
166
|
+
out.push(x);
|
|
167
|
+
}
|
|
168
|
+
return out.join(',');
|
|
169
|
+
};
|
|
170
|
+
const statuses = (v) => {
|
|
171
|
+
if (!Array.isArray(v) || v.length === 0 || v.length > 7)
|
|
172
|
+
return null;
|
|
173
|
+
for (const x of v)
|
|
174
|
+
if (typeof x !== 'string' || !/^[A-Z_]{1,16}$/.test(x))
|
|
175
|
+
return null;
|
|
176
|
+
return v.join(',');
|
|
177
|
+
};
|
|
178
|
+
const limit = (v) => (Number.isInteger(v) && v >= 1 && v <= 500 ? String(v) : null);
|
|
179
|
+
const httpsUrl = (v) => {
|
|
180
|
+
if (typeof v !== 'string' || v.length > 2048)
|
|
181
|
+
return null;
|
|
182
|
+
try {
|
|
183
|
+
const u = new URL(v);
|
|
184
|
+
return u.protocol === 'https:' && !u.username && !u.password ? v : null;
|
|
185
|
+
}
|
|
186
|
+
catch {
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
const str = (v, max = 256) => (typeof v === 'string' && v.length > 0 && v.length <= max && !/[\x00-\x1f\x7f]/.test(v) ? v : null);
|
|
191
|
+
/** Each optional query key: present → checked and copied, absent → nothing; a bad value refuses the whole request. */
|
|
192
|
+
function pick(args, rules) {
|
|
193
|
+
const q = {};
|
|
194
|
+
for (const [k, rule] of Object.entries(rules)) {
|
|
195
|
+
if (args[k] === undefined)
|
|
196
|
+
continue;
|
|
197
|
+
const v = rule(args[k]);
|
|
198
|
+
if (v === null)
|
|
199
|
+
return k;
|
|
200
|
+
q[k] = v;
|
|
201
|
+
}
|
|
202
|
+
return q;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* The one request an op is — method, path and query / JSON body — for `workspace`, from `args`
|
|
206
|
+
* the caller chose. Every segment that comes from `args` is one checked segment; the user id is
|
|
207
|
+
* `workspace`; a key the op does not name is ignored, never forwarded. The opener re-checks the
|
|
208
|
+
* result against the providers row (exact template, named query keys, body keys) before sending.
|
|
209
|
+
*/
|
|
210
|
+
export function composioRequest(op, workspace, args) {
|
|
211
|
+
if (!isSafeId(workspace))
|
|
212
|
+
return { ok: false, why: 'workspace' };
|
|
213
|
+
const bad = (why) => ({ ok: false, why });
|
|
214
|
+
switch (op) {
|
|
215
|
+
case 'connectedAccounts.list': {
|
|
216
|
+
const q = pick(args, { statuses, toolkit_slugs: slugs, auth_config_ids: slugs, limit, cursor });
|
|
217
|
+
if (typeof q === 'string')
|
|
218
|
+
return bad(q);
|
|
219
|
+
return { ok: true, plan: { method: 'GET', path: '/connected_accounts', query: { user_ids: workspace, ...q } } };
|
|
220
|
+
}
|
|
221
|
+
case 'connectedAccounts.get':
|
|
222
|
+
case 'connectedAccounts.delete': {
|
|
223
|
+
const id = seg(args['id']);
|
|
224
|
+
if (!id)
|
|
225
|
+
return bad('id');
|
|
226
|
+
return { ok: true, plan: { method: op === 'connectedAccounts.get' ? 'GET' : 'DELETE', path: `/connected_accounts/${id}` } };
|
|
227
|
+
}
|
|
228
|
+
case 'connectedAccounts.initiate': {
|
|
229
|
+
const authConfigId = seg(args['auth_config_id']);
|
|
230
|
+
if (!authConfigId)
|
|
231
|
+
return bad('auth_config_id');
|
|
232
|
+
const connection = { user_id: workspace };
|
|
233
|
+
if (args['callback_url'] !== undefined) {
|
|
234
|
+
const u = httpsUrl(args['callback_url']);
|
|
235
|
+
if (!u)
|
|
236
|
+
return bad('callback_url');
|
|
237
|
+
connection['callback_url'] = u;
|
|
238
|
+
}
|
|
239
|
+
if (args['state'] !== undefined) {
|
|
240
|
+
if (!isObj(args['state']))
|
|
241
|
+
return bad('state');
|
|
242
|
+
connection['state'] = args['state'];
|
|
243
|
+
}
|
|
244
|
+
if (args['alias'] !== undefined) {
|
|
245
|
+
const a = str(args['alias'], 128);
|
|
246
|
+
if (!a)
|
|
247
|
+
return bad('alias');
|
|
248
|
+
connection['alias'] = a;
|
|
249
|
+
}
|
|
250
|
+
return { ok: true, plan: { method: 'POST', path: '/connected_accounts', body: { auth_config: { id: authConfigId }, connection } } };
|
|
251
|
+
}
|
|
252
|
+
case 'connectedAccounts.link': {
|
|
253
|
+
const authConfigId = seg(args['auth_config_id']);
|
|
254
|
+
if (!authConfigId)
|
|
255
|
+
return bad('auth_config_id');
|
|
256
|
+
const body = { auth_config_id: authConfigId, user_id: workspace };
|
|
257
|
+
if (args['callback_url'] !== undefined) {
|
|
258
|
+
const u = httpsUrl(args['callback_url']);
|
|
259
|
+
if (!u)
|
|
260
|
+
return bad('callback_url');
|
|
261
|
+
body['callback_url'] = u;
|
|
262
|
+
}
|
|
263
|
+
if (args['alias'] !== undefined) {
|
|
264
|
+
const a = str(args['alias'], 128);
|
|
265
|
+
if (!a)
|
|
266
|
+
return bad('alias');
|
|
267
|
+
body['alias'] = a;
|
|
268
|
+
}
|
|
269
|
+
return { ok: true, plan: { method: 'POST', path: '/connected_accounts/link', body } };
|
|
270
|
+
}
|
|
271
|
+
case 'authConfigs.list': {
|
|
272
|
+
const q = pick(args, { toolkit_slug: lower, limit, cursor });
|
|
273
|
+
if (typeof q === 'string')
|
|
274
|
+
return bad(q);
|
|
275
|
+
return { ok: true, plan: { method: 'GET', path: '/auth_configs', query: q } };
|
|
276
|
+
}
|
|
277
|
+
case 'authConfigs.create': {
|
|
278
|
+
const toolkit = lower(args['toolkit_slug']);
|
|
279
|
+
if (!toolkit)
|
|
280
|
+
return bad('toolkit_slug');
|
|
281
|
+
const ac = args['auth_config'];
|
|
282
|
+
if (!isObj(ac))
|
|
283
|
+
return bad('auth_config');
|
|
284
|
+
const type = ac['type'];
|
|
285
|
+
if (type !== 'use_composio_managed_auth' && type !== 'use_custom_auth')
|
|
286
|
+
return bad('auth_config.type');
|
|
287
|
+
const out = { type };
|
|
288
|
+
for (const k of Object.keys(ac)) {
|
|
289
|
+
if (k === 'type')
|
|
290
|
+
continue;
|
|
291
|
+
if (k === 'name') {
|
|
292
|
+
const n = str(ac[k], 128);
|
|
293
|
+
if (!n)
|
|
294
|
+
return bad('auth_config.name');
|
|
295
|
+
out[k] = n;
|
|
296
|
+
}
|
|
297
|
+
else if (k === 'authScheme' && type === 'use_custom_auth') {
|
|
298
|
+
const a = typeof ac[k] === 'string' && /^[A-Z0-9_]{1,32}$/.test(ac[k]) ? ac[k] : null;
|
|
299
|
+
if (!a)
|
|
300
|
+
return bad('auth_config.authScheme');
|
|
301
|
+
out[k] = a;
|
|
302
|
+
}
|
|
303
|
+
else if (k === 'credentials') {
|
|
304
|
+
if (!isObj(ac[k]))
|
|
305
|
+
return bad('auth_config.credentials');
|
|
306
|
+
out[k] = ac[k];
|
|
307
|
+
}
|
|
308
|
+
else
|
|
309
|
+
return bad(`auth_config.${k}`);
|
|
310
|
+
}
|
|
311
|
+
return { ok: true, plan: { method: 'POST', path: '/auth_configs', body: { toolkit: { slug: toolkit }, auth_config: out } } };
|
|
312
|
+
}
|
|
313
|
+
case 'toolkits.getToolkits': {
|
|
314
|
+
const q = pick(args, { category: lower, limit, cursor });
|
|
315
|
+
if (typeof q === 'string')
|
|
316
|
+
return bad(q);
|
|
317
|
+
return { ok: true, plan: { method: 'GET', path: '/toolkits', query: q } };
|
|
318
|
+
}
|
|
319
|
+
case 'toolkits.get':
|
|
320
|
+
case 'toolkits.getToolkitBySlug': {
|
|
321
|
+
const slug = seg(args['slug']);
|
|
322
|
+
if (!slug)
|
|
323
|
+
return bad('slug');
|
|
324
|
+
return { ok: true, plan: { method: 'GET', path: `/toolkits/${slug}` } };
|
|
325
|
+
}
|
|
326
|
+
case 'tools.getTools': {
|
|
327
|
+
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) });
|
|
328
|
+
if (typeof q === 'string')
|
|
329
|
+
return bad(q);
|
|
330
|
+
if (!q['toolkit_slug'] && !q['tool_slugs'])
|
|
331
|
+
return bad('toolkit_slug');
|
|
332
|
+
return { ok: true, plan: { method: 'GET', path: '/tools', query: q } };
|
|
333
|
+
}
|
|
334
|
+
case 'tools.execute': {
|
|
335
|
+
const slug = composioToolSlug(args);
|
|
336
|
+
if (!slug)
|
|
337
|
+
return bad('slug');
|
|
338
|
+
const body = { user_id: workspace };
|
|
339
|
+
if (args['arguments'] !== undefined) {
|
|
340
|
+
if (!isObj(args['arguments']))
|
|
341
|
+
return bad('arguments');
|
|
342
|
+
body['arguments'] = args['arguments'];
|
|
343
|
+
}
|
|
344
|
+
if (args['connected_account_id'] !== undefined) {
|
|
345
|
+
const id = seg(args['connected_account_id']);
|
|
346
|
+
if (!id)
|
|
347
|
+
return bad('connected_account_id');
|
|
348
|
+
body['connected_account_id'] = id;
|
|
349
|
+
}
|
|
350
|
+
if (args['version'] !== undefined) {
|
|
351
|
+
const v = typeof args['version'] === 'string' && /^[A-Za-z0-9_.-]{1,32}$/.test(args['version']) ? args['version'] : null;
|
|
352
|
+
if (!v)
|
|
353
|
+
return bad('version');
|
|
354
|
+
body['version'] = v;
|
|
355
|
+
}
|
|
356
|
+
return { ok: true, plan: { method: 'POST', path: `/tools/execute/${slug}`, body } };
|
|
357
|
+
}
|
|
358
|
+
case 'session.toolkits': {
|
|
359
|
+
const list = args['toolkits'] === undefined ? [] : args['toolkits'];
|
|
360
|
+
if (!Array.isArray(list) || list.length > 50)
|
|
361
|
+
return bad('toolkits');
|
|
362
|
+
for (const x of list)
|
|
363
|
+
if (typeof x !== 'string' || !/^[A-Za-z0-9_-]{1,128}$/.test(x))
|
|
364
|
+
return bad('toolkits');
|
|
365
|
+
return {
|
|
366
|
+
ok: true,
|
|
367
|
+
follow: 'session.toolkits',
|
|
368
|
+
plan: { method: 'POST', path: '/tool_router/session', body: { user_id: workspace, toolkits: { enable: list }, manage_connections: { enable: true } } },
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
/** The tool slug a `tools.execute` names, or null: `COMPOSIO_SLUG_RE`, and never `proxy` in any case. */
|
|
374
|
+
export function composioToolSlug(args) {
|
|
375
|
+
const v = args['slug'];
|
|
376
|
+
if (typeof v !== 'string' || !COMPOSIO_SLUG_RE.test(v) || v.toLowerCase() === 'proxy')
|
|
377
|
+
return null;
|
|
378
|
+
return v;
|
|
379
|
+
}
|
|
380
|
+
/** The second request of `session.toolkits`: the session's toolkits, from the first answer's `session_id`. Null when that answer names no session. */
|
|
381
|
+
export function composioFollow(op, first) {
|
|
382
|
+
if (op !== 'session.toolkits' || !isObj(first))
|
|
383
|
+
return null;
|
|
384
|
+
const id = seg(first['session_id']);
|
|
385
|
+
if (!id)
|
|
386
|
+
return null;
|
|
387
|
+
return { method: 'GET', path: `/tool_router/session/${id}/toolkits` };
|
|
388
|
+
}
|
|
389
|
+
//# 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,MAAM,cAAc,GAAG,CAAC,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,CAAU,CAAA;AAI5G,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAU,EAAqB,EAAE,CAC9D,OAAO,CAAC,KAAK,QAAQ,IAAK,cAAoC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;AAU5E;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,SAAS,CAAA;AAC1C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAc,EAAW,EAAE,CAAC,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IAClG,OAAO,CAAC,CAAA;AACV,CAAC;AAED,sJAAsJ;AACtJ,MAAM,UAAU,cAAc,CAAC,EAAc,EAAE,KAAc;IAC3D,IAAI,EAAE,KAAK,kBAAkB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IAC3D,MAAM,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAA;IACnC,IAAI,CAAC,EAAE;QAAE,OAAO,IAAI,CAAA;IACpB,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,wBAAwB,EAAE,WAAW,EAAE,CAAA;AACvE,CAAC"}
|
package/dist/templates.js
CHANGED
|
@@ -248,7 +248,7 @@ export const TEMPLATES = {
|
|
|
248
248
|
key: "contacts", label: "Contacts", dimension: "actors", type: "contact", icon: "UserRound",
|
|
249
249
|
columns: [
|
|
250
250
|
{ field: "name", label: "Name", kind: "text", required: true },
|
|
251
|
-
{ field: "lifecycle", label: "Stage", kind: "select", options: ["lead", "
|
|
251
|
+
{ field: "lifecycle", label: "Stage", kind: "select", options: ["lead", "identify", "engage", "customer", "churned"] },
|
|
252
252
|
{ field: "company", label: "Company", kind: "relation", options: ["companies"] },
|
|
253
253
|
],
|
|
254
254
|
fields: [
|
|
@@ -256,11 +256,11 @@ export const TEMPLATES = {
|
|
|
256
256
|
{ field: "email", label: "Email", kind: "text" },
|
|
257
257
|
{ field: "phone", label: "Phone", kind: "text" },
|
|
258
258
|
{ field: "title", label: "Job title", kind: "text" },
|
|
259
|
-
{ field: "lifecycle", label: "Lifecycle", kind: "select", options: ["lead", "
|
|
259
|
+
{ field: "lifecycle", label: "Lifecycle", kind: "select", options: ["lead", "identify", "engage", "customer", "churned"] },
|
|
260
260
|
{ field: "tags", label: "Tags", kind: "tags" },
|
|
261
261
|
{ field: "company", label: "Company", kind: "relation", options: ["companies"] },
|
|
262
262
|
],
|
|
263
|
-
filters: [{ field: "lifecycle", label: "Stage", kind: "select", options: ["lead", "
|
|
263
|
+
filters: [{ field: "lifecycle", label: "Stage", kind: "select", options: ["lead", "identify", "engage", "customer", "churned"] }],
|
|
264
264
|
actions: ACTOR_ACTIONS,
|
|
265
265
|
},
|
|
266
266
|
{
|
|
@@ -508,19 +508,19 @@ export const TEMPLATES = {
|
|
|
508
508
|
key: "leads", label: "Leads", dimension: "actors", type: "lead", icon: "UserPlus",
|
|
509
509
|
columns: [
|
|
510
510
|
{ field: "name", label: "Name", kind: "text", required: true },
|
|
511
|
-
{ field: "lifecycle", label: "Lifecycle", kind: "select", options: ["anonymous", "lead", "
|
|
511
|
+
{ field: "lifecycle", label: "Lifecycle", kind: "select", options: ["anonymous", "lead", "identify", "engage", "customer", "advocate", "churned"] },
|
|
512
512
|
{ field: "ltv", label: "LTV", kind: "currency" },
|
|
513
513
|
],
|
|
514
514
|
fields: [
|
|
515
515
|
{ field: "name", label: "Name", kind: "text", required: true },
|
|
516
|
-
{ field: "lifecycle", label: "Lifecycle", kind: "select", options: ["anonymous", "lead", "
|
|
516
|
+
{ field: "lifecycle", label: "Lifecycle", kind: "select", options: ["anonymous", "lead", "identify", "engage", "customer", "advocate", "churned"] },
|
|
517
517
|
{ field: "ltv", label: "Lifetime value", kind: "currency" },
|
|
518
518
|
{ field: "cac", label: "Acquisition cost", kind: "currency" },
|
|
519
519
|
{ field: "fit_score", label: "Fit score", kind: "number" },
|
|
520
520
|
{ field: "consent", label: "Consent", kind: "tags" },
|
|
521
521
|
{ field: "audience", label: "Audience", kind: "relation", options: ["audiences"] },
|
|
522
522
|
],
|
|
523
|
-
filters: [{ field: "lifecycle", label: "Lifecycle", kind: "select", options: ["anonymous", "lead", "
|
|
523
|
+
filters: [{ field: "lifecycle", label: "Lifecycle", kind: "select", options: ["anonymous", "lead", "identify", "engage", "customer", "advocate", "churned"] }],
|
|
524
524
|
actions: ACTOR_ACTIONS,
|
|
525
525
|
},
|
|
526
526
|
{
|