@executor-js/sdk 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/README.md +125 -107
  2. package/dist/blob.d.ts +48 -0
  3. package/dist/blob.d.ts.map +1 -0
  4. package/dist/blob.test.d.ts +2 -0
  5. package/dist/blob.test.d.ts.map +1 -0
  6. package/dist/chunk-2WV7VSNL.js +4440 -0
  7. package/dist/chunk-2WV7VSNL.js.map +1 -0
  8. package/dist/client.d.ts +135 -0
  9. package/dist/client.d.ts.map +1 -0
  10. package/dist/client.js +87 -0
  11. package/dist/client.js.map +1 -0
  12. package/dist/client.test.d.ts +2 -0
  13. package/dist/client.test.d.ts.map +1 -0
  14. package/dist/config.d.ts +24 -0
  15. package/dist/config.d.ts.map +1 -0
  16. package/dist/connections.d.ts +107 -0
  17. package/dist/connections.d.ts.map +1 -0
  18. package/dist/connections.test.d.ts +2 -0
  19. package/dist/connections.test.d.ts.map +1 -0
  20. package/dist/core-schema.d.ts +372 -0
  21. package/dist/core-schema.d.ts.map +1 -0
  22. package/dist/core.js +296 -57
  23. package/dist/core.js.map +1 -1
  24. package/dist/elicitation.d.ts +18 -34
  25. package/dist/elicitation.d.ts.map +1 -1
  26. package/dist/error-handling.test.d.ts +2 -0
  27. package/dist/error-handling.test.d.ts.map +1 -0
  28. package/dist/errors.d.ts +95 -24
  29. package/dist/errors.d.ts.map +1 -1
  30. package/dist/executor.d.ts +107 -48
  31. package/dist/executor.d.ts.map +1 -1
  32. package/dist/executor.test.d.ts +2 -0
  33. package/dist/executor.test.d.ts.map +1 -0
  34. package/dist/ids.d.ts +6 -4
  35. package/dist/ids.d.ts.map +1 -1
  36. package/dist/index.d.ts +24 -16
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +80 -308
  39. package/dist/index.js.map +1 -1
  40. package/dist/oauth-discovery.d.ts +138 -0
  41. package/dist/oauth-discovery.d.ts.map +1 -0
  42. package/dist/oauth-discovery.test.d.ts +2 -0
  43. package/dist/oauth-discovery.test.d.ts.map +1 -0
  44. package/dist/oauth-helpers.d.ts +89 -0
  45. package/dist/oauth-helpers.d.ts.map +1 -0
  46. package/dist/oauth-helpers.test.d.ts +2 -0
  47. package/dist/oauth-helpers.test.d.ts.map +1 -0
  48. package/dist/oauth-popup-types.d.ts +14 -0
  49. package/dist/oauth-popup-types.d.ts.map +1 -0
  50. package/dist/oauth-service.d.ts +33 -0
  51. package/dist/oauth-service.d.ts.map +1 -0
  52. package/dist/oauth.d.ts +275 -0
  53. package/dist/oauth.d.ts.map +1 -0
  54. package/dist/plugin.d.ts +318 -28
  55. package/dist/plugin.d.ts.map +1 -1
  56. package/dist/policies.d.ts +56 -64
  57. package/dist/policies.d.ts.map +1 -1
  58. package/dist/policies.test.d.ts +2 -0
  59. package/dist/policies.test.d.ts.map +1 -0
  60. package/dist/promise-executor.d.ts +26 -128
  61. package/dist/promise-executor.d.ts.map +1 -1
  62. package/dist/promise.d.ts +12 -6
  63. package/dist/promise.d.ts.map +1 -1
  64. package/dist/promise.test.d.ts +2 -0
  65. package/dist/promise.test.d.ts.map +1 -0
  66. package/dist/schema-types.d.ts +6 -5
  67. package/dist/schema-types.d.ts.map +1 -1
  68. package/dist/scope.d.ts +5 -15
  69. package/dist/scope.d.ts.map +1 -1
  70. package/dist/scoped-adapter.d.ts +13 -0
  71. package/dist/scoped-adapter.d.ts.map +1 -0
  72. package/dist/scoped-adapter.test.d.ts +2 -0
  73. package/dist/scoped-adapter.test.d.ts.map +1 -0
  74. package/dist/secret-backed-value.d.ts +27 -0
  75. package/dist/secret-backed-value.d.ts.map +1 -0
  76. package/dist/secrets.d.ts +52 -106
  77. package/dist/secrets.d.ts.map +1 -1
  78. package/dist/testing.d.ts +5 -3
  79. package/dist/testing.d.ts.map +1 -1
  80. package/dist/types.d.ts +84 -0
  81. package/dist/types.d.ts.map +1 -0
  82. package/package.json +28 -4
  83. package/dist/chunk-D7CT3UMO.js +0 -1386
  84. package/dist/chunk-D7CT3UMO.js.map +0 -1
  85. package/dist/in-memory/policy-engine.d.ts +0 -10
  86. package/dist/in-memory/policy-engine.d.ts.map +0 -1
  87. package/dist/in-memory/secret-store.d.ts +0 -16
  88. package/dist/in-memory/secret-store.d.ts.map +0 -1
  89. package/dist/in-memory/tool-registry.d.ts +0 -35
  90. package/dist/in-memory/tool-registry.d.ts.map +0 -1
  91. package/dist/index.test.d.ts +0 -2
  92. package/dist/index.test.d.ts.map +0 -1
  93. package/dist/plugin-kv.d.ts +0 -48
  94. package/dist/plugin-kv.d.ts.map +0 -1
  95. package/dist/plugins/in-memory-tools.d.ts +0 -42
  96. package/dist/plugins/in-memory-tools.d.ts.map +0 -1
  97. package/dist/runtime-tools.d.ts +0 -41
  98. package/dist/runtime-tools.d.ts.map +0 -1
  99. package/dist/sources.d.ts +0 -130
  100. package/dist/sources.d.ts.map +0 -1
  101. package/dist/tools.d.ts +0 -219
  102. package/dist/tools.d.ts.map +0 -1
@@ -0,0 +1,372 @@
1
+ import type { InferDBFieldsOutput } from "@executor-js/storage-core";
2
+ export declare const coreSchema: {
3
+ readonly source: {
4
+ readonly fields: {
5
+ readonly id: {
6
+ readonly type: "string";
7
+ readonly required: true;
8
+ };
9
+ readonly scope_id: {
10
+ readonly type: "string";
11
+ readonly required: true;
12
+ readonly index: true;
13
+ };
14
+ readonly plugin_id: {
15
+ readonly type: "string";
16
+ readonly required: true;
17
+ readonly index: true;
18
+ };
19
+ readonly kind: {
20
+ readonly type: "string";
21
+ readonly required: true;
22
+ };
23
+ readonly name: {
24
+ readonly type: "string";
25
+ readonly required: true;
26
+ };
27
+ readonly url: {
28
+ readonly type: "string";
29
+ readonly required: false;
30
+ };
31
+ readonly can_remove: {
32
+ readonly type: "boolean";
33
+ readonly required: true;
34
+ readonly defaultValue: true;
35
+ };
36
+ readonly can_refresh: {
37
+ readonly type: "boolean";
38
+ readonly required: true;
39
+ readonly defaultValue: false;
40
+ };
41
+ readonly can_edit: {
42
+ readonly type: "boolean";
43
+ readonly required: true;
44
+ readonly defaultValue: false;
45
+ };
46
+ readonly created_at: {
47
+ readonly type: "date";
48
+ readonly required: true;
49
+ };
50
+ readonly updated_at: {
51
+ readonly type: "date";
52
+ readonly required: true;
53
+ };
54
+ };
55
+ };
56
+ readonly tool: {
57
+ readonly fields: {
58
+ readonly id: {
59
+ readonly type: "string";
60
+ readonly required: true;
61
+ };
62
+ readonly scope_id: {
63
+ readonly type: "string";
64
+ readonly required: true;
65
+ readonly index: true;
66
+ };
67
+ readonly source_id: {
68
+ readonly type: "string";
69
+ readonly required: true;
70
+ readonly index: true;
71
+ };
72
+ readonly plugin_id: {
73
+ readonly type: "string";
74
+ readonly required: true;
75
+ readonly index: true;
76
+ };
77
+ readonly name: {
78
+ readonly type: "string";
79
+ readonly required: true;
80
+ };
81
+ readonly description: {
82
+ readonly type: "string";
83
+ readonly required: true;
84
+ };
85
+ readonly input_schema: {
86
+ readonly type: "json";
87
+ readonly required: false;
88
+ };
89
+ readonly output_schema: {
90
+ readonly type: "json";
91
+ readonly required: false;
92
+ };
93
+ readonly created_at: {
94
+ readonly type: "date";
95
+ readonly required: true;
96
+ };
97
+ readonly updated_at: {
98
+ readonly type: "date";
99
+ readonly required: true;
100
+ };
101
+ };
102
+ };
103
+ readonly definition: {
104
+ readonly fields: {
105
+ readonly id: {
106
+ readonly type: "string";
107
+ readonly required: true;
108
+ };
109
+ readonly scope_id: {
110
+ readonly type: "string";
111
+ readonly required: true;
112
+ readonly index: true;
113
+ };
114
+ readonly source_id: {
115
+ readonly type: "string";
116
+ readonly required: true;
117
+ readonly index: true;
118
+ };
119
+ readonly plugin_id: {
120
+ readonly type: "string";
121
+ readonly required: true;
122
+ readonly index: true;
123
+ };
124
+ readonly name: {
125
+ readonly type: "string";
126
+ readonly required: true;
127
+ };
128
+ readonly schema: {
129
+ readonly type: "json";
130
+ readonly required: true;
131
+ };
132
+ readonly created_at: {
133
+ readonly type: "date";
134
+ readonly required: true;
135
+ };
136
+ };
137
+ };
138
+ readonly secret: {
139
+ readonly fields: {
140
+ readonly id: {
141
+ readonly type: "string";
142
+ readonly required: true;
143
+ };
144
+ readonly scope_id: {
145
+ readonly type: "string";
146
+ readonly required: true;
147
+ readonly index: true;
148
+ };
149
+ readonly name: {
150
+ readonly type: "string";
151
+ readonly required: true;
152
+ };
153
+ readonly provider: {
154
+ readonly type: "string";
155
+ readonly required: true;
156
+ readonly index: true;
157
+ };
158
+ readonly owned_by_connection_id: {
159
+ readonly type: "string";
160
+ readonly required: false;
161
+ readonly index: true;
162
+ };
163
+ readonly created_at: {
164
+ readonly type: "date";
165
+ readonly required: true;
166
+ };
167
+ };
168
+ };
169
+ readonly connection: {
170
+ readonly fields: {
171
+ readonly id: {
172
+ readonly type: "string";
173
+ readonly required: true;
174
+ };
175
+ readonly scope_id: {
176
+ readonly type: "string";
177
+ readonly required: true;
178
+ readonly index: true;
179
+ };
180
+ /** Routing key into `plugin.connectionProviders`. Typical shape
181
+ * is `${pluginId}:${kind}` (e.g. `openapi:oauth2`, `mcp:oauth2`,
182
+ * `google-discovery:google`). Mirrors `secret.provider`. */
183
+ readonly provider: {
184
+ readonly type: "string";
185
+ readonly required: true;
186
+ readonly index: true;
187
+ };
188
+ /** Display label shown in the Connections UI. Usually the account
189
+ * email / handle / org name the user signed in as. */
190
+ readonly identity_label: {
191
+ readonly type: "string";
192
+ readonly required: false;
193
+ };
194
+ /** Stable id of the access-token secret. Always present. */
195
+ readonly access_token_secret_id: {
196
+ readonly type: "string";
197
+ readonly required: true;
198
+ };
199
+ /** Stable id of the refresh-token secret. Null for flows that
200
+ * don't mint a refresh token (client_credentials, etc.). */
201
+ readonly refresh_token_secret_id: {
202
+ readonly type: "string";
203
+ readonly required: false;
204
+ };
205
+ /** Epoch ms when the access token expires. Null if the provider
206
+ * didn't declare an expiry. Used as the refresh trigger. Stored as
207
+ * `bigint` because `Date.now()` overflows int32. */
208
+ readonly expires_at: {
209
+ readonly type: "number";
210
+ readonly required: false;
211
+ readonly bigint: true;
212
+ };
213
+ /** Scope string as returned by the token endpoint. */
214
+ readonly scope: {
215
+ readonly type: "string";
216
+ readonly required: false;
217
+ };
218
+ /** Opaque plugin-owned JSON — token endpoint URL, scopes list,
219
+ * discovery hints, etc. Never sensitive. */
220
+ readonly provider_state: {
221
+ readonly type: "json";
222
+ readonly required: false;
223
+ };
224
+ readonly created_at: {
225
+ readonly type: "date";
226
+ readonly required: true;
227
+ };
228
+ readonly updated_at: {
229
+ readonly type: "date";
230
+ readonly required: true;
231
+ };
232
+ };
233
+ };
234
+ readonly oauth2_session: {
235
+ readonly fields: {
236
+ readonly id: {
237
+ readonly type: "string";
238
+ readonly required: true;
239
+ };
240
+ readonly scope_id: {
241
+ readonly type: "string";
242
+ readonly required: true;
243
+ readonly index: true;
244
+ };
245
+ readonly plugin_id: {
246
+ readonly type: "string";
247
+ readonly required: true;
248
+ readonly index: true;
249
+ };
250
+ readonly strategy: {
251
+ readonly type: "string";
252
+ readonly required: true;
253
+ };
254
+ readonly connection_id: {
255
+ readonly type: "string";
256
+ readonly required: true;
257
+ readonly index: true;
258
+ };
259
+ readonly token_scope: {
260
+ readonly type: "string";
261
+ readonly required: true;
262
+ };
263
+ readonly redirect_url: {
264
+ readonly type: "string";
265
+ readonly required: true;
266
+ };
267
+ readonly payload: {
268
+ readonly type: "json";
269
+ readonly required: true;
270
+ };
271
+ readonly expires_at: {
272
+ readonly type: "number";
273
+ readonly required: true;
274
+ readonly bigint: true;
275
+ };
276
+ readonly created_at: {
277
+ readonly type: "date";
278
+ readonly required: true;
279
+ };
280
+ };
281
+ };
282
+ readonly tool_policy: {
283
+ readonly fields: {
284
+ readonly id: {
285
+ readonly type: "string";
286
+ readonly required: true;
287
+ };
288
+ readonly scope_id: {
289
+ readonly type: "string";
290
+ readonly required: true;
291
+ readonly index: true;
292
+ };
293
+ readonly pattern: {
294
+ readonly type: "string";
295
+ readonly required: true;
296
+ };
297
+ /** "approve" | "require_approval" | "block". */
298
+ readonly action: {
299
+ readonly type: "string";
300
+ readonly required: true;
301
+ };
302
+ /** Fractional-indexing key (Jira lexorank style). Lower lex order =
303
+ * higher precedence. New rules default to a key generated above
304
+ * the current minimum. Strings instead of numbers so we can
305
+ * always lengthen the key to insert between two adjacent rows
306
+ * without precision loss; see `fractional-indexing` in
307
+ * `policies.ts`. */
308
+ readonly position: {
309
+ readonly type: "string";
310
+ readonly required: true;
311
+ readonly index: true;
312
+ };
313
+ readonly created_at: {
314
+ readonly type: "date";
315
+ readonly required: true;
316
+ };
317
+ readonly updated_at: {
318
+ readonly type: "date";
319
+ readonly required: true;
320
+ };
321
+ };
322
+ };
323
+ };
324
+ export type CoreSchema = typeof coreSchema;
325
+ export type SourceRow = InferDBFieldsOutput<CoreSchema["source"]["fields"]> & Record<string, unknown>;
326
+ export type ToolRow = InferDBFieldsOutput<CoreSchema["tool"]["fields"]> & Record<string, unknown>;
327
+ export type DefinitionRow = InferDBFieldsOutput<CoreSchema["definition"]["fields"]> & Record<string, unknown>;
328
+ export type SecretRow = InferDBFieldsOutput<CoreSchema["secret"]["fields"]> & Record<string, unknown>;
329
+ export type ConnectionRow = InferDBFieldsOutput<CoreSchema["connection"]["fields"]> & Record<string, unknown>;
330
+ export type ToolPolicyRow = InferDBFieldsOutput<CoreSchema["tool_policy"]["fields"]> & Record<string, unknown>;
331
+ export type ToolPolicyAction = "approve" | "require_approval" | "block";
332
+ export declare const TOOL_POLICY_ACTIONS: readonly ["approve", "require_approval", "block"];
333
+ export declare const isToolPolicyAction: (value: unknown) => value is ToolPolicyAction;
334
+ export interface ToolAnnotations {
335
+ /** If true, the executor will call the invoke-time elicitation handler
336
+ * before running the tool and abort if the user declines. */
337
+ readonly requiresApproval?: boolean;
338
+ /** Free-text message shown in the approval prompt. Falls back to the
339
+ * tool's id / description if unset. */
340
+ readonly approvalDescription?: string;
341
+ /** Hint for UI — tool may suspend to ask the user for input mid-invocation.
342
+ * Not enforced by the executor; purely a UI signal. */
343
+ readonly mayElicit?: boolean;
344
+ }
345
+ export interface SourceInputTool {
346
+ readonly name: string;
347
+ readonly description: string;
348
+ readonly inputSchema?: unknown;
349
+ readonly outputSchema?: unknown;
350
+ }
351
+ export interface SourceInput {
352
+ readonly id: string;
353
+ /** Scope id this source belongs to. Must be one of the executor's
354
+ * configured scopes. Callers (plugins) pick the target scope
355
+ * explicitly — typically the scope the source was authored against. */
356
+ readonly scope: string;
357
+ readonly kind: string;
358
+ readonly name: string;
359
+ readonly url?: string;
360
+ readonly canRemove?: boolean;
361
+ readonly canRefresh?: boolean;
362
+ readonly canEdit?: boolean;
363
+ readonly tools: readonly SourceInputTool[];
364
+ }
365
+ export interface DefinitionsInput {
366
+ readonly sourceId: string;
367
+ /** Scope id these definitions belong to — should match the scope of
368
+ * the source they're registered under. */
369
+ readonly scope: string;
370
+ readonly definitions: Record<string, unknown>;
371
+ }
372
+ //# sourceMappingURL=core-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-schema.d.ts","sourceRoot":"","sources":["../src/core-schema.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAEV,mBAAmB,EACpB,MAAM,2BAA2B,CAAC;AAEnC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA6GjB;;yEAE6D;;;;;;YAE7D;mEACuD;;;;;YAEvD,4DAA4D;;;;;YAE5D;yEAC6D;;;;;YAE7D;;iEAEqD;;;;;;YAErD,sDAAsD;;;;;YAEtD;yDAC6C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAyC7C,gDAAgD;;;;;YAEh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