@loopingai/core 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.
- package/LICENSE +674 -0
- package/README.md +279 -0
- package/dist/a2a/agent-stub.d.ts +61 -0
- package/dist/a2a/agent-stub.d.ts.map +1 -0
- package/dist/a2a/agent-stub.js +2 -0
- package/dist/a2a/agent-stub.js.map +1 -0
- package/dist/a2a/card.d.ts +119 -0
- package/dist/a2a/card.d.ts.map +1 -0
- package/dist/a2a/card.js +115 -0
- package/dist/a2a/card.js.map +1 -0
- package/dist/a2a/context.d.ts +14 -0
- package/dist/a2a/context.d.ts.map +1 -0
- package/dist/a2a/context.js +55 -0
- package/dist/a2a/context.js.map +1 -0
- package/dist/a2a/executor.d.ts +85 -0
- package/dist/a2a/executor.d.ts.map +1 -0
- package/dist/a2a/executor.js +107 -0
- package/dist/a2a/executor.js.map +1 -0
- package/dist/a2a/index.d.ts +18 -0
- package/dist/a2a/index.d.ts.map +1 -0
- package/dist/a2a/index.js +17 -0
- package/dist/a2a/index.js.map +1 -0
- package/dist/a2a/notify.d.ts +75 -0
- package/dist/a2a/notify.d.ts.map +1 -0
- package/dist/a2a/notify.js +161 -0
- package/dist/a2a/notify.js.map +1 -0
- package/dist/a2a/parts.d.ts +46 -0
- package/dist/a2a/parts.d.ts.map +1 -0
- package/dist/a2a/parts.js +95 -0
- package/dist/a2a/parts.js.map +1 -0
- package/dist/a2a/task-store.d.ts +45 -0
- package/dist/a2a/task-store.d.ts.map +1 -0
- package/dist/a2a/task-store.js +100 -0
- package/dist/a2a/task-store.js.map +1 -0
- package/dist/a2a/task.d.ts +86 -0
- package/dist/a2a/task.d.ts.map +1 -0
- package/dist/a2a/task.js +16 -0
- package/dist/a2a/task.js.map +1 -0
- package/dist/a2a/verify.d.ts +64 -0
- package/dist/a2a/verify.d.ts.map +1 -0
- package/dist/a2a/verify.js +122 -0
- package/dist/a2a/verify.js.map +1 -0
- package/dist/agent/budget.d.ts +47 -0
- package/dist/agent/budget.d.ts.map +1 -0
- package/dist/agent/budget.js +43 -0
- package/dist/agent/budget.js.map +1 -0
- package/dist/agent/control.d.ts +110 -0
- package/dist/agent/control.d.ts.map +1 -0
- package/dist/agent/control.js +115 -0
- package/dist/agent/control.js.map +1 -0
- package/dist/agent/final-reply.d.ts +49 -0
- package/dist/agent/final-reply.d.ts.map +1 -0
- package/dist/agent/final-reply.js +52 -0
- package/dist/agent/final-reply.js.map +1 -0
- package/dist/agent/history.d.ts +83 -0
- package/dist/agent/history.d.ts.map +1 -0
- package/dist/agent/history.js +117 -0
- package/dist/agent/history.js.map +1 -0
- package/dist/agent/index.d.ts +17 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +17 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/inference.d.ts +52 -0
- package/dist/agent/inference.d.ts.map +1 -0
- package/dist/agent/inference.js +79 -0
- package/dist/agent/inference.js.map +1 -0
- package/dist/agent/model.d.ts +75 -0
- package/dist/agent/model.d.ts.map +1 -0
- package/dist/agent/model.js +62 -0
- package/dist/agent/model.js.map +1 -0
- package/dist/agent/session.d.ts +92 -0
- package/dist/agent/session.d.ts.map +1 -0
- package/dist/agent/session.js +80 -0
- package/dist/agent/session.js.map +1 -0
- package/dist/config.d.ts +159 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +92 -0
- package/dist/config.js.map +1 -0
- package/dist/contract/index.d.ts +10 -0
- package/dist/contract/index.d.ts.map +1 -0
- package/dist/contract/index.js +9 -0
- package/dist/contract/index.js.map +1 -0
- package/dist/contract/plugin.d.ts +163 -0
- package/dist/contract/plugin.d.ts.map +1 -0
- package/dist/contract/plugin.js +39 -0
- package/dist/contract/plugin.js.map +1 -0
- package/dist/contract/recipe.d.ts +170 -0
- package/dist/contract/recipe.d.ts.map +1 -0
- package/dist/contract/recipe.js +2 -0
- package/dist/contract/recipe.js.map +1 -0
- package/dist/contract/validation.d.ts +86 -0
- package/dist/contract/validation.d.ts.map +1 -0
- package/dist/contract/validation.js +76 -0
- package/dist/contract/validation.js.map +1 -0
- package/dist/db/db.d.ts +131 -0
- package/dist/db/db.d.ts.map +1 -0
- package/dist/db/db.js +91 -0
- package/dist/db/db.js.map +1 -0
- package/dist/db/index.d.ts +9 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +9 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/migrations/index.d.ts +21 -0
- package/dist/db/migrations/index.d.ts.map +1 -0
- package/dist/db/migrations/index.js +54 -0
- package/dist/db/migrations/index.js.map +1 -0
- package/dist/db/models/subtasks.d.ts +102 -0
- package/dist/db/models/subtasks.d.ts.map +1 -0
- package/dist/db/models/subtasks.js +285 -0
- package/dist/db/models/subtasks.js.map +1 -0
- package/dist/db/models/tasks.d.ts +92 -0
- package/dist/db/models/tasks.d.ts.map +1 -0
- package/dist/db/models/tasks.js +212 -0
- package/dist/db/models/tasks.js.map +1 -0
- package/dist/db/schema.d.ts +488 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +91 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/env.d.ts +46 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +40 -0
- package/dist/env.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/platform.d.ts +47 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.js +47 -0
- package/dist/platform.js.map +1 -0
- package/dist/runtime/index.d.ts +86 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +123 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/tool-families.d.ts +33 -0
- package/dist/runtime/tool-families.d.ts.map +1 -0
- package/dist/runtime/tool-families.js +62 -0
- package/dist/runtime/tool-families.js.map +1 -0
- package/dist/subagent/fingerprint.d.ts +38 -0
- package/dist/subagent/fingerprint.d.ts.map +1 -0
- package/dist/subagent/fingerprint.js +97 -0
- package/dist/subagent/fingerprint.js.map +1 -0
- package/dist/subagent/index.d.ts +147 -0
- package/dist/subagent/index.d.ts.map +1 -0
- package/dist/subagent/index.js +299 -0
- package/dist/subagent/index.js.map +1 -0
- package/dist/subagent/prompt.d.ts +34 -0
- package/dist/subagent/prompt.d.ts.map +1 -0
- package/dist/subagent/prompt.js +46 -0
- package/dist/subagent/prompt.js.map +1 -0
- package/dist/subagent/run.d.ts +151 -0
- package/dist/subagent/run.d.ts.map +1 -0
- package/dist/subagent/run.js +491 -0
- package/dist/subagent/run.js.map +1 -0
- package/dist/subagent/workspace.d.ts +65 -0
- package/dist/subagent/workspace.d.ts.map +1 -0
- package/dist/subagent/workspace.js +53 -0
- package/dist/subagent/workspace.js.map +1 -0
- package/dist/subtasks/catalog.d.ts +40 -0
- package/dist/subtasks/catalog.d.ts.map +1 -0
- package/dist/subtasks/catalog.js +36 -0
- package/dist/subtasks/catalog.js.map +1 -0
- package/dist/subtasks/decomposition.d.ts +90 -0
- package/dist/subtasks/decomposition.d.ts.map +1 -0
- package/dist/subtasks/decomposition.js +205 -0
- package/dist/subtasks/decomposition.js.map +1 -0
- package/dist/subtasks/delegate.d.ts +77 -0
- package/dist/subtasks/delegate.d.ts.map +1 -0
- package/dist/subtasks/delegate.js +102 -0
- package/dist/subtasks/delegate.js.map +1 -0
- package/dist/subtasks/index.d.ts +11 -0
- package/dist/subtasks/index.d.ts.map +1 -0
- package/dist/subtasks/index.js +11 -0
- package/dist/subtasks/index.js.map +1 -0
- package/dist/subtasks/scheduler.d.ts +49 -0
- package/dist/subtasks/scheduler.d.ts.map +1 -0
- package/dist/subtasks/scheduler.js +48 -0
- package/dist/subtasks/scheduler.js.map +1 -0
- package/dist/subtasks/subtask-types.d.ts +100 -0
- package/dist/subtasks/subtask-types.d.ts.map +1 -0
- package/dist/subtasks/subtask-types.js +111 -0
- package/dist/subtasks/subtask-types.js.map +1 -0
- package/dist/subtasks/types.d.ts +321 -0
- package/dist/subtasks/types.d.ts.map +1 -0
- package/dist/subtasks/types.js +16 -0
- package/dist/subtasks/types.js.map +1 -0
- package/dist/testing/auth.d.ts +12 -0
- package/dist/testing/auth.d.ts.map +1 -0
- package/dist/testing/auth.js +25 -0
- package/dist/testing/auth.js.map +1 -0
- package/dist/testing/do.d.ts +30 -0
- package/dist/testing/do.d.ts.map +1 -0
- package/dist/testing/do.js +26 -0
- package/dist/testing/do.js.map +1 -0
- package/dist/testing/fake-session.d.ts +27 -0
- package/dist/testing/fake-session.d.ts.map +1 -0
- package/dist/testing/fake-session.js +38 -0
- package/dist/testing/fake-session.js.map +1 -0
- package/dist/testing/fixtures.d.ts +27 -0
- package/dist/testing/fixtures.d.ts.map +1 -0
- package/dist/testing/fixtures.js +67 -0
- package/dist/testing/fixtures.js.map +1 -0
- package/dist/testing/index.d.ts +31 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +31 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/mock-model.d.ts +43 -0
- package/dist/testing/mock-model.d.ts.map +1 -0
- package/dist/testing/mock-model.js +62 -0
- package/dist/testing/mock-model.js.map +1 -0
- package/dist/testing/node.d.ts +24 -0
- package/dist/testing/node.d.ts.map +1 -0
- package/dist/testing/node.js +24 -0
- package/dist/testing/node.js.map +1 -0
- package/dist/testing/vcr-global-setup.d.ts +3 -0
- package/dist/testing/vcr-global-setup.d.ts.map +1 -0
- package/dist/testing/vcr-global-setup.js +9 -0
- package/dist/testing/vcr-global-setup.js.map +1 -0
- package/dist/testing/vcr-shared.d.ts +21 -0
- package/dist/testing/vcr-shared.d.ts.map +1 -0
- package/dist/testing/vcr-shared.js +21 -0
- package/dist/testing/vcr-shared.js.map +1 -0
- package/dist/testing/vcr-spec.d.ts +17 -0
- package/dist/testing/vcr-spec.d.ts.map +1 -0
- package/dist/testing/vcr-spec.js +72 -0
- package/dist/testing/vcr-spec.js.map +1 -0
- package/dist/testing/vcr.d.ts +81 -0
- package/dist/testing/vcr.d.ts.map +1 -0
- package/dist/testing/vcr.js +211 -0
- package/dist/testing/vcr.js.map +1 -0
- package/dist/worker/index.d.ts +62 -0
- package/dist/worker/index.d.ts.map +1 -0
- package/dist/worker/index.js +194 -0
- package/dist/worker/index.js.map +1 -0
- package/eslint-rules/index.js +31 -0
- package/eslint-rules/no-deprecated-object-properties.js +81 -0
- package/package.json +147 -0
- package/scripts/generate-keys.mjs +53 -0
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core's two tables. Both live in the caller's agent DO SQLite
|
|
3
|
+
* (`this.ctx.storage`), so a row is unreachable from any other caller by
|
|
4
|
+
* construction.
|
|
5
|
+
*
|
|
6
|
+
* A plugin's tables are **not** here and never will be: drizzle's durable-sqlite
|
|
7
|
+
* migrator keeps one flat integer journal and one global `__drizzle_migrations`
|
|
8
|
+
* table, which independently-versioned packages cannot share. Plugins own their
|
|
9
|
+
* storage through `PluginStore` — idempotent `CREATE TABLE IF NOT EXISTS` plus
|
|
10
|
+
* their own version bookkeeping, outside this journal entirely. See
|
|
11
|
+
* {@link file://./db.ts}.
|
|
12
|
+
*
|
|
13
|
+
* Indexes are declared in each table's config callback rather than as standalone
|
|
14
|
+
* `index(...)` exports: only the callback form is recorded in the drizzle-kit
|
|
15
|
+
* snapshot, so the standalone form makes every later `generate` diff propose
|
|
16
|
+
* dropping the index it can no longer see.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Durable state for async A2A tasks (the accept + notify lifecycle).
|
|
20
|
+
*
|
|
21
|
+
* One row per task: written by the Worker's accept path (`beginTask`, keyed by
|
|
22
|
+
* `message_id` for gateway dedupe) and mutated by the turn workflow via DO RPC
|
|
23
|
+
* (`markWorking`, `saveTask`, `cancelTask`). `GetTask` / `ListTasks` read it
|
|
24
|
+
* through `DurableTaskStore`.
|
|
25
|
+
*/
|
|
26
|
+
export declare const notifyTasks: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
27
|
+
name: "notify_tasks";
|
|
28
|
+
schema: undefined;
|
|
29
|
+
columns: {
|
|
30
|
+
taskId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
31
|
+
name: "task_id";
|
|
32
|
+
tableName: "notify_tasks";
|
|
33
|
+
dataType: "string";
|
|
34
|
+
columnType: "SQLiteText";
|
|
35
|
+
data: string;
|
|
36
|
+
driverParam: string;
|
|
37
|
+
notNull: true;
|
|
38
|
+
hasDefault: false;
|
|
39
|
+
isPrimaryKey: true;
|
|
40
|
+
isAutoincrement: false;
|
|
41
|
+
hasRuntimeDefault: false;
|
|
42
|
+
enumValues: [string, ...string[]];
|
|
43
|
+
baseColumn: never;
|
|
44
|
+
identity: undefined;
|
|
45
|
+
generated: undefined;
|
|
46
|
+
}, {}, {
|
|
47
|
+
length: number | undefined;
|
|
48
|
+
}>;
|
|
49
|
+
messageId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
50
|
+
name: "message_id";
|
|
51
|
+
tableName: "notify_tasks";
|
|
52
|
+
dataType: "string";
|
|
53
|
+
columnType: "SQLiteText";
|
|
54
|
+
data: string;
|
|
55
|
+
driverParam: string;
|
|
56
|
+
notNull: false;
|
|
57
|
+
hasDefault: false;
|
|
58
|
+
isPrimaryKey: false;
|
|
59
|
+
isAutoincrement: false;
|
|
60
|
+
hasRuntimeDefault: false;
|
|
61
|
+
enumValues: [string, ...string[]];
|
|
62
|
+
baseColumn: never;
|
|
63
|
+
identity: undefined;
|
|
64
|
+
generated: undefined;
|
|
65
|
+
}, {}, {
|
|
66
|
+
length: number | undefined;
|
|
67
|
+
}>;
|
|
68
|
+
contextId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
69
|
+
name: "context_id";
|
|
70
|
+
tableName: "notify_tasks";
|
|
71
|
+
dataType: "string";
|
|
72
|
+
columnType: "SQLiteText";
|
|
73
|
+
data: string;
|
|
74
|
+
driverParam: string;
|
|
75
|
+
notNull: true;
|
|
76
|
+
hasDefault: true;
|
|
77
|
+
isPrimaryKey: false;
|
|
78
|
+
isAutoincrement: false;
|
|
79
|
+
hasRuntimeDefault: false;
|
|
80
|
+
enumValues: [string, ...string[]];
|
|
81
|
+
baseColumn: never;
|
|
82
|
+
identity: undefined;
|
|
83
|
+
generated: undefined;
|
|
84
|
+
}, {}, {
|
|
85
|
+
length: number | undefined;
|
|
86
|
+
}>;
|
|
87
|
+
state: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
88
|
+
name: "state";
|
|
89
|
+
tableName: "notify_tasks";
|
|
90
|
+
dataType: "string";
|
|
91
|
+
columnType: "SQLiteText";
|
|
92
|
+
data: string;
|
|
93
|
+
driverParam: string;
|
|
94
|
+
notNull: true;
|
|
95
|
+
hasDefault: false;
|
|
96
|
+
isPrimaryKey: false;
|
|
97
|
+
isAutoincrement: false;
|
|
98
|
+
hasRuntimeDefault: false;
|
|
99
|
+
enumValues: [string, ...string[]];
|
|
100
|
+
baseColumn: never;
|
|
101
|
+
identity: undefined;
|
|
102
|
+
generated: undefined;
|
|
103
|
+
}, {}, {
|
|
104
|
+
length: number | undefined;
|
|
105
|
+
}>;
|
|
106
|
+
taskJson: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
107
|
+
name: "task_json";
|
|
108
|
+
tableName: "notify_tasks";
|
|
109
|
+
dataType: "string";
|
|
110
|
+
columnType: "SQLiteText";
|
|
111
|
+
data: string;
|
|
112
|
+
driverParam: string;
|
|
113
|
+
notNull: true;
|
|
114
|
+
hasDefault: false;
|
|
115
|
+
isPrimaryKey: false;
|
|
116
|
+
isAutoincrement: false;
|
|
117
|
+
hasRuntimeDefault: false;
|
|
118
|
+
enumValues: [string, ...string[]];
|
|
119
|
+
baseColumn: never;
|
|
120
|
+
identity: undefined;
|
|
121
|
+
generated: undefined;
|
|
122
|
+
}, {}, {
|
|
123
|
+
length: number | undefined;
|
|
124
|
+
}>;
|
|
125
|
+
createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
126
|
+
name: "created_at";
|
|
127
|
+
tableName: "notify_tasks";
|
|
128
|
+
dataType: "number";
|
|
129
|
+
columnType: "SQLiteInteger";
|
|
130
|
+
data: number;
|
|
131
|
+
driverParam: number;
|
|
132
|
+
notNull: true;
|
|
133
|
+
hasDefault: false;
|
|
134
|
+
isPrimaryKey: false;
|
|
135
|
+
isAutoincrement: false;
|
|
136
|
+
hasRuntimeDefault: false;
|
|
137
|
+
enumValues: undefined;
|
|
138
|
+
baseColumn: never;
|
|
139
|
+
identity: undefined;
|
|
140
|
+
generated: undefined;
|
|
141
|
+
}, {}, {}>;
|
|
142
|
+
updatedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
143
|
+
name: "updated_at";
|
|
144
|
+
tableName: "notify_tasks";
|
|
145
|
+
dataType: "number";
|
|
146
|
+
columnType: "SQLiteInteger";
|
|
147
|
+
data: number;
|
|
148
|
+
driverParam: number;
|
|
149
|
+
notNull: true;
|
|
150
|
+
hasDefault: false;
|
|
151
|
+
isPrimaryKey: false;
|
|
152
|
+
isAutoincrement: false;
|
|
153
|
+
hasRuntimeDefault: false;
|
|
154
|
+
enumValues: undefined;
|
|
155
|
+
baseColumn: never;
|
|
156
|
+
identity: undefined;
|
|
157
|
+
generated: undefined;
|
|
158
|
+
}, {}, {}>;
|
|
159
|
+
};
|
|
160
|
+
dialect: "sqlite";
|
|
161
|
+
}>;
|
|
162
|
+
/**
|
|
163
|
+
* Durable subtasks: the units a parent A2A task is decomposed into.
|
|
164
|
+
*
|
|
165
|
+
* The integer primary key assigns a caller-local, monotonically increasing
|
|
166
|
+
* `SubtaskId` (autoincrement, so ids are never reused after cleanup deletes
|
|
167
|
+
* rows). References, dependency edges, and result parts are stored as JSON text
|
|
168
|
+
* and parsed back into the `Subtask` contract by `models/subtasks.ts`.
|
|
169
|
+
* `recipe_id`/`recipe_version` are null until execution starts, then record the
|
|
170
|
+
* resolved recipe after the fact.
|
|
171
|
+
*/
|
|
172
|
+
export declare const subtasks: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
173
|
+
name: "subtasks";
|
|
174
|
+
schema: undefined;
|
|
175
|
+
columns: {
|
|
176
|
+
id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
177
|
+
name: "id";
|
|
178
|
+
tableName: "subtasks";
|
|
179
|
+
dataType: "number";
|
|
180
|
+
columnType: "SQLiteInteger";
|
|
181
|
+
data: number;
|
|
182
|
+
driverParam: number;
|
|
183
|
+
notNull: true;
|
|
184
|
+
hasDefault: true;
|
|
185
|
+
isPrimaryKey: true;
|
|
186
|
+
isAutoincrement: false;
|
|
187
|
+
hasRuntimeDefault: false;
|
|
188
|
+
enumValues: undefined;
|
|
189
|
+
baseColumn: never;
|
|
190
|
+
identity: undefined;
|
|
191
|
+
generated: undefined;
|
|
192
|
+
}, {}, {}>;
|
|
193
|
+
taskId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
194
|
+
name: "task_id";
|
|
195
|
+
tableName: "subtasks";
|
|
196
|
+
dataType: "string";
|
|
197
|
+
columnType: "SQLiteText";
|
|
198
|
+
data: string;
|
|
199
|
+
driverParam: string;
|
|
200
|
+
notNull: true;
|
|
201
|
+
hasDefault: false;
|
|
202
|
+
isPrimaryKey: false;
|
|
203
|
+
isAutoincrement: false;
|
|
204
|
+
hasRuntimeDefault: false;
|
|
205
|
+
enumValues: [string, ...string[]];
|
|
206
|
+
baseColumn: never;
|
|
207
|
+
identity: undefined;
|
|
208
|
+
generated: undefined;
|
|
209
|
+
}, {}, {
|
|
210
|
+
length: number | undefined;
|
|
211
|
+
}>;
|
|
212
|
+
round: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
213
|
+
name: "round";
|
|
214
|
+
tableName: "subtasks";
|
|
215
|
+
dataType: "number";
|
|
216
|
+
columnType: "SQLiteInteger";
|
|
217
|
+
data: number;
|
|
218
|
+
driverParam: number;
|
|
219
|
+
notNull: true;
|
|
220
|
+
hasDefault: false;
|
|
221
|
+
isPrimaryKey: false;
|
|
222
|
+
isAutoincrement: false;
|
|
223
|
+
hasRuntimeDefault: false;
|
|
224
|
+
enumValues: undefined;
|
|
225
|
+
baseColumn: never;
|
|
226
|
+
identity: undefined;
|
|
227
|
+
generated: undefined;
|
|
228
|
+
}, {}, {}>;
|
|
229
|
+
ordinal: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
230
|
+
name: "ordinal";
|
|
231
|
+
tableName: "subtasks";
|
|
232
|
+
dataType: "number";
|
|
233
|
+
columnType: "SQLiteInteger";
|
|
234
|
+
data: number;
|
|
235
|
+
driverParam: number;
|
|
236
|
+
notNull: true;
|
|
237
|
+
hasDefault: false;
|
|
238
|
+
isPrimaryKey: false;
|
|
239
|
+
isAutoincrement: false;
|
|
240
|
+
hasRuntimeDefault: false;
|
|
241
|
+
enumValues: undefined;
|
|
242
|
+
baseColumn: never;
|
|
243
|
+
identity: undefined;
|
|
244
|
+
generated: undefined;
|
|
245
|
+
}, {}, {}>;
|
|
246
|
+
type: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
247
|
+
name: "type";
|
|
248
|
+
tableName: "subtasks";
|
|
249
|
+
dataType: "string";
|
|
250
|
+
columnType: "SQLiteText";
|
|
251
|
+
data: string;
|
|
252
|
+
driverParam: string;
|
|
253
|
+
notNull: true;
|
|
254
|
+
hasDefault: false;
|
|
255
|
+
isPrimaryKey: false;
|
|
256
|
+
isAutoincrement: false;
|
|
257
|
+
hasRuntimeDefault: false;
|
|
258
|
+
enumValues: [string, ...string[]];
|
|
259
|
+
baseColumn: never;
|
|
260
|
+
identity: undefined;
|
|
261
|
+
generated: undefined;
|
|
262
|
+
}, {}, {
|
|
263
|
+
length: number | undefined;
|
|
264
|
+
}>;
|
|
265
|
+
recipeId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
266
|
+
name: "recipe_id";
|
|
267
|
+
tableName: "subtasks";
|
|
268
|
+
dataType: "string";
|
|
269
|
+
columnType: "SQLiteText";
|
|
270
|
+
data: string;
|
|
271
|
+
driverParam: string;
|
|
272
|
+
notNull: false;
|
|
273
|
+
hasDefault: false;
|
|
274
|
+
isPrimaryKey: false;
|
|
275
|
+
isAutoincrement: false;
|
|
276
|
+
hasRuntimeDefault: false;
|
|
277
|
+
enumValues: [string, ...string[]];
|
|
278
|
+
baseColumn: never;
|
|
279
|
+
identity: undefined;
|
|
280
|
+
generated: undefined;
|
|
281
|
+
}, {}, {
|
|
282
|
+
length: number | undefined;
|
|
283
|
+
}>;
|
|
284
|
+
recipeVersion: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
285
|
+
name: "recipe_version";
|
|
286
|
+
tableName: "subtasks";
|
|
287
|
+
dataType: "number";
|
|
288
|
+
columnType: "SQLiteInteger";
|
|
289
|
+
data: number;
|
|
290
|
+
driverParam: number;
|
|
291
|
+
notNull: false;
|
|
292
|
+
hasDefault: false;
|
|
293
|
+
isPrimaryKey: false;
|
|
294
|
+
isAutoincrement: false;
|
|
295
|
+
hasRuntimeDefault: false;
|
|
296
|
+
enumValues: undefined;
|
|
297
|
+
baseColumn: never;
|
|
298
|
+
identity: undefined;
|
|
299
|
+
generated: undefined;
|
|
300
|
+
}, {}, {}>;
|
|
301
|
+
prompt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
302
|
+
name: "prompt";
|
|
303
|
+
tableName: "subtasks";
|
|
304
|
+
dataType: "string";
|
|
305
|
+
columnType: "SQLiteText";
|
|
306
|
+
data: string;
|
|
307
|
+
driverParam: string;
|
|
308
|
+
notNull: true;
|
|
309
|
+
hasDefault: false;
|
|
310
|
+
isPrimaryKey: false;
|
|
311
|
+
isAutoincrement: false;
|
|
312
|
+
hasRuntimeDefault: false;
|
|
313
|
+
enumValues: [string, ...string[]];
|
|
314
|
+
baseColumn: never;
|
|
315
|
+
identity: undefined;
|
|
316
|
+
generated: undefined;
|
|
317
|
+
}, {}, {
|
|
318
|
+
length: number | undefined;
|
|
319
|
+
}>;
|
|
320
|
+
referencesJson: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
321
|
+
name: "references_json";
|
|
322
|
+
tableName: "subtasks";
|
|
323
|
+
dataType: "string";
|
|
324
|
+
columnType: "SQLiteText";
|
|
325
|
+
data: string;
|
|
326
|
+
driverParam: string;
|
|
327
|
+
notNull: true;
|
|
328
|
+
hasDefault: false;
|
|
329
|
+
isPrimaryKey: false;
|
|
330
|
+
isAutoincrement: false;
|
|
331
|
+
hasRuntimeDefault: false;
|
|
332
|
+
enumValues: [string, ...string[]];
|
|
333
|
+
baseColumn: never;
|
|
334
|
+
identity: undefined;
|
|
335
|
+
generated: undefined;
|
|
336
|
+
}, {}, {
|
|
337
|
+
length: number | undefined;
|
|
338
|
+
}>;
|
|
339
|
+
dependsOnJson: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
340
|
+
name: "depends_on_json";
|
|
341
|
+
tableName: "subtasks";
|
|
342
|
+
dataType: "string";
|
|
343
|
+
columnType: "SQLiteText";
|
|
344
|
+
data: string;
|
|
345
|
+
driverParam: string;
|
|
346
|
+
notNull: true;
|
|
347
|
+
hasDefault: false;
|
|
348
|
+
isPrimaryKey: false;
|
|
349
|
+
isAutoincrement: false;
|
|
350
|
+
hasRuntimeDefault: false;
|
|
351
|
+
enumValues: [string, ...string[]];
|
|
352
|
+
baseColumn: never;
|
|
353
|
+
identity: undefined;
|
|
354
|
+
generated: undefined;
|
|
355
|
+
}, {}, {
|
|
356
|
+
length: number | undefined;
|
|
357
|
+
}>;
|
|
358
|
+
paramsJson: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
359
|
+
name: "params_json";
|
|
360
|
+
tableName: "subtasks";
|
|
361
|
+
dataType: "string";
|
|
362
|
+
columnType: "SQLiteText";
|
|
363
|
+
data: string;
|
|
364
|
+
driverParam: string;
|
|
365
|
+
notNull: true;
|
|
366
|
+
hasDefault: true;
|
|
367
|
+
isPrimaryKey: false;
|
|
368
|
+
isAutoincrement: false;
|
|
369
|
+
hasRuntimeDefault: false;
|
|
370
|
+
enumValues: [string, ...string[]];
|
|
371
|
+
baseColumn: never;
|
|
372
|
+
identity: undefined;
|
|
373
|
+
generated: undefined;
|
|
374
|
+
}, {}, {
|
|
375
|
+
length: number | undefined;
|
|
376
|
+
}>;
|
|
377
|
+
status: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
378
|
+
name: "status";
|
|
379
|
+
tableName: "subtasks";
|
|
380
|
+
dataType: "string";
|
|
381
|
+
columnType: "SQLiteText";
|
|
382
|
+
data: string;
|
|
383
|
+
driverParam: string;
|
|
384
|
+
notNull: true;
|
|
385
|
+
hasDefault: false;
|
|
386
|
+
isPrimaryKey: false;
|
|
387
|
+
isAutoincrement: false;
|
|
388
|
+
hasRuntimeDefault: false;
|
|
389
|
+
enumValues: [string, ...string[]];
|
|
390
|
+
baseColumn: never;
|
|
391
|
+
identity: undefined;
|
|
392
|
+
generated: undefined;
|
|
393
|
+
}, {}, {
|
|
394
|
+
length: number | undefined;
|
|
395
|
+
}>;
|
|
396
|
+
resultPartsJson: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
397
|
+
name: "result_parts_json";
|
|
398
|
+
tableName: "subtasks";
|
|
399
|
+
dataType: "string";
|
|
400
|
+
columnType: "SQLiteText";
|
|
401
|
+
data: string;
|
|
402
|
+
driverParam: string;
|
|
403
|
+
notNull: false;
|
|
404
|
+
hasDefault: false;
|
|
405
|
+
isPrimaryKey: false;
|
|
406
|
+
isAutoincrement: false;
|
|
407
|
+
hasRuntimeDefault: false;
|
|
408
|
+
enumValues: [string, ...string[]];
|
|
409
|
+
baseColumn: never;
|
|
410
|
+
identity: undefined;
|
|
411
|
+
generated: undefined;
|
|
412
|
+
}, {}, {
|
|
413
|
+
length: number | undefined;
|
|
414
|
+
}>;
|
|
415
|
+
error: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
416
|
+
name: "error";
|
|
417
|
+
tableName: "subtasks";
|
|
418
|
+
dataType: "string";
|
|
419
|
+
columnType: "SQLiteText";
|
|
420
|
+
data: string;
|
|
421
|
+
driverParam: string;
|
|
422
|
+
notNull: false;
|
|
423
|
+
hasDefault: false;
|
|
424
|
+
isPrimaryKey: false;
|
|
425
|
+
isAutoincrement: false;
|
|
426
|
+
hasRuntimeDefault: false;
|
|
427
|
+
enumValues: [string, ...string[]];
|
|
428
|
+
baseColumn: never;
|
|
429
|
+
identity: undefined;
|
|
430
|
+
generated: undefined;
|
|
431
|
+
}, {}, {
|
|
432
|
+
length: number | undefined;
|
|
433
|
+
}>;
|
|
434
|
+
createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
435
|
+
name: "created_at";
|
|
436
|
+
tableName: "subtasks";
|
|
437
|
+
dataType: "number";
|
|
438
|
+
columnType: "SQLiteInteger";
|
|
439
|
+
data: number;
|
|
440
|
+
driverParam: number;
|
|
441
|
+
notNull: true;
|
|
442
|
+
hasDefault: false;
|
|
443
|
+
isPrimaryKey: false;
|
|
444
|
+
isAutoincrement: false;
|
|
445
|
+
hasRuntimeDefault: false;
|
|
446
|
+
enumValues: undefined;
|
|
447
|
+
baseColumn: never;
|
|
448
|
+
identity: undefined;
|
|
449
|
+
generated: undefined;
|
|
450
|
+
}, {}, {}>;
|
|
451
|
+
updatedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
452
|
+
name: "updated_at";
|
|
453
|
+
tableName: "subtasks";
|
|
454
|
+
dataType: "number";
|
|
455
|
+
columnType: "SQLiteInteger";
|
|
456
|
+
data: number;
|
|
457
|
+
driverParam: number;
|
|
458
|
+
notNull: true;
|
|
459
|
+
hasDefault: false;
|
|
460
|
+
isPrimaryKey: false;
|
|
461
|
+
isAutoincrement: false;
|
|
462
|
+
hasRuntimeDefault: false;
|
|
463
|
+
enumValues: undefined;
|
|
464
|
+
baseColumn: never;
|
|
465
|
+
identity: undefined;
|
|
466
|
+
generated: undefined;
|
|
467
|
+
}, {}, {}>;
|
|
468
|
+
completedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
469
|
+
name: "completed_at";
|
|
470
|
+
tableName: "subtasks";
|
|
471
|
+
dataType: "number";
|
|
472
|
+
columnType: "SQLiteInteger";
|
|
473
|
+
data: number;
|
|
474
|
+
driverParam: number;
|
|
475
|
+
notNull: false;
|
|
476
|
+
hasDefault: false;
|
|
477
|
+
isPrimaryKey: false;
|
|
478
|
+
isAutoincrement: false;
|
|
479
|
+
hasRuntimeDefault: false;
|
|
480
|
+
enumValues: undefined;
|
|
481
|
+
baseColumn: never;
|
|
482
|
+
identity: undefined;
|
|
483
|
+
generated: undefined;
|
|
484
|
+
}, {}, {}>;
|
|
485
|
+
};
|
|
486
|
+
dialect: "sqlite";
|
|
487
|
+
}>;
|
|
488
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/db/schema.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBvB,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCpB,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { sqliteTable, text, integer, index, uniqueIndex } from "drizzle-orm/sqlite-core";
|
|
2
|
+
/**
|
|
3
|
+
* Core's two tables. Both live in the caller's agent DO SQLite
|
|
4
|
+
* (`this.ctx.storage`), so a row is unreachable from any other caller by
|
|
5
|
+
* construction.
|
|
6
|
+
*
|
|
7
|
+
* A plugin's tables are **not** here and never will be: drizzle's durable-sqlite
|
|
8
|
+
* migrator keeps one flat integer journal and one global `__drizzle_migrations`
|
|
9
|
+
* table, which independently-versioned packages cannot share. Plugins own their
|
|
10
|
+
* storage through `PluginStore` — idempotent `CREATE TABLE IF NOT EXISTS` plus
|
|
11
|
+
* their own version bookkeeping, outside this journal entirely. See
|
|
12
|
+
* {@link file://./db.ts}.
|
|
13
|
+
*
|
|
14
|
+
* Indexes are declared in each table's config callback rather than as standalone
|
|
15
|
+
* `index(...)` exports: only the callback form is recorded in the drizzle-kit
|
|
16
|
+
* snapshot, so the standalone form makes every later `generate` diff propose
|
|
17
|
+
* dropping the index it can no longer see.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Durable state for async A2A tasks (the accept + notify lifecycle).
|
|
21
|
+
*
|
|
22
|
+
* One row per task: written by the Worker's accept path (`beginTask`, keyed by
|
|
23
|
+
* `message_id` for gateway dedupe) and mutated by the turn workflow via DO RPC
|
|
24
|
+
* (`markWorking`, `saveTask`, `cancelTask`). `GetTask` / `ListTasks` read it
|
|
25
|
+
* through `DurableTaskStore`.
|
|
26
|
+
*/
|
|
27
|
+
export const notifyTasks = sqliteTable("notify_tasks", {
|
|
28
|
+
taskId: text("task_id").primaryKey(),
|
|
29
|
+
/** Gateway-assigned dedupe key — null for tasks created outside `beginTask`. */
|
|
30
|
+
messageId: text("message_id").unique(),
|
|
31
|
+
/** A2A context id, denormalized out of `task_json` so `ListTasks` can filter on it. */
|
|
32
|
+
contextId: text("context_id").notNull().default(""),
|
|
33
|
+
/** Human-readable `TaskState` (`working`, `input-required`, …) — see `taskStateLabel`. */
|
|
34
|
+
state: text("state").notNull(),
|
|
35
|
+
/**
|
|
36
|
+
* The task in its **A2A wire form** (`Task.toJSON`), not the in-memory proto
|
|
37
|
+
* object. Storing the wire form means what is on disk is exactly what goes
|
|
38
|
+
* on the wire, and both survive a change to the SDK's class shape;
|
|
39
|
+
* `JSON.stringify(task)` would persist in-memory internals instead.
|
|
40
|
+
*/
|
|
41
|
+
taskJson: text("task_json").notNull(),
|
|
42
|
+
createdAt: integer("created_at").notNull(),
|
|
43
|
+
updatedAt: integer("updated_at").notNull()
|
|
44
|
+
}, (table) => [
|
|
45
|
+
index("idx_notify_tasks_created_at").on(table.createdAt),
|
|
46
|
+
index("idx_notify_tasks_context").on(table.contextId),
|
|
47
|
+
index("idx_notify_tasks_state").on(table.state)
|
|
48
|
+
]);
|
|
49
|
+
/**
|
|
50
|
+
* Durable subtasks: the units a parent A2A task is decomposed into.
|
|
51
|
+
*
|
|
52
|
+
* The integer primary key assigns a caller-local, monotonically increasing
|
|
53
|
+
* `SubtaskId` (autoincrement, so ids are never reused after cleanup deletes
|
|
54
|
+
* rows). References, dependency edges, and result parts are stored as JSON text
|
|
55
|
+
* and parsed back into the `Subtask` contract by `models/subtasks.ts`.
|
|
56
|
+
* `recipe_id`/`recipe_version` are null until execution starts, then record the
|
|
57
|
+
* resolved recipe after the fact.
|
|
58
|
+
*/
|
|
59
|
+
export const subtasks = sqliteTable("subtasks", {
|
|
60
|
+
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
61
|
+
taskId: text("task_id").notNull(),
|
|
62
|
+
/** Main-agent round that delegated this subtask (0-based). */
|
|
63
|
+
round: integer("round").notNull(),
|
|
64
|
+
/** Position within the parent task, increasing across every round. */
|
|
65
|
+
ordinal: integer("ordinal").notNull(),
|
|
66
|
+
type: text("type").notNull(),
|
|
67
|
+
/** Resolved recipe key, written only at execution start. */
|
|
68
|
+
recipeId: text("recipe_id"),
|
|
69
|
+
/** Resolved recipe version, written only at execution start. */
|
|
70
|
+
recipeVersion: integer("recipe_version"),
|
|
71
|
+
prompt: text("prompt").notNull(),
|
|
72
|
+
/** JSON `SubtaskReference[]` — verbatim role+text snapshots from decomposition. */
|
|
73
|
+
referencesJson: text("references_json").notNull(),
|
|
74
|
+
/** JSON `SubtaskId[]` — resolved dependency edges. */
|
|
75
|
+
dependsOnJson: text("depends_on_json").notNull(),
|
|
76
|
+
/** JSON `SubtaskParams` — the type's required inputs, validated at delegation. */
|
|
77
|
+
paramsJson: text("params_json").notNull().default("{}"),
|
|
78
|
+
status: text("status").notNull(),
|
|
79
|
+
/** JSON `SubtaskResultPart[]` — text-only terminal output; null until complete. */
|
|
80
|
+
resultPartsJson: text("result_parts_json"),
|
|
81
|
+
error: text("error"),
|
|
82
|
+
createdAt: integer("created_at").notNull(),
|
|
83
|
+
updatedAt: integer("updated_at").notNull(),
|
|
84
|
+
completedAt: integer("completed_at")
|
|
85
|
+
}, (table) => [
|
|
86
|
+
uniqueIndex("idx_subtasks_task_ordinal").on(table.taskId, table.ordinal),
|
|
87
|
+
index("idx_subtasks_task_round").on(table.taskId, table.round),
|
|
88
|
+
index("idx_subtasks_status").on(table.status),
|
|
89
|
+
index("idx_subtasks_created_at").on(table.createdAt)
|
|
90
|
+
]);
|
|
91
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/db/schema.ts"],"names":[],"mappings":"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"}
|
package/dist/env.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Worker `env` slices core reads, declared structurally.
|
|
3
|
+
*
|
|
4
|
+
* A published package cannot reference the ambient `Env` that `wrangler types`
|
|
5
|
+
* generates into a consumer's `worker-configuration.d.ts` — that interface only
|
|
6
|
+
* exists inside the app. So core never names `Env`. Every function that needs a
|
|
7
|
+
* binding either takes it as a parameter, or takes an object satisfying one of
|
|
8
|
+
* the slices below, and a consumer's generated `Env` satisfies them structurally
|
|
9
|
+
* with no cast.
|
|
10
|
+
*
|
|
11
|
+
* The two secrets are the zero-trust contract and are the only names core
|
|
12
|
+
* insists on; everything else is passed in. `createA2AWorker` lets a consumer
|
|
13
|
+
* rename even these — see {@link file://./worker/index.ts}.
|
|
14
|
+
*/
|
|
15
|
+
/** Workers AI, backing both the chat loop and embeddings. */
|
|
16
|
+
export interface AiEnv {
|
|
17
|
+
AI: Ai;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The two secrets every Looping agent must carry.
|
|
21
|
+
*
|
|
22
|
+
* - `A2A_SIGNING_KEY` — Ed25519 private JWK (JSON, **must** include `kid`). Signs
|
|
23
|
+
* the AgentCard and every push-notification callback JWT. Its public half is
|
|
24
|
+
* served at the agent's JWKS path and pinned by the gateway on first
|
|
25
|
+
* registration (Trust-On-First-Use).
|
|
26
|
+
* - `GATEWAY_ORIGINS` — JSON array of origins allowed to call this agent. The
|
|
27
|
+
* allowlist a gateway JWT's `jku` and `iss` are checked against; see
|
|
28
|
+
* {@link file://./a2a/verify.ts}.
|
|
29
|
+
*
|
|
30
|
+
* No shared secret ever crosses the boundary in either direction: the agent
|
|
31
|
+
* verifies the gateway with the gateway's public JWKS, and the gateway verifies
|
|
32
|
+
* the agent with the agent's.
|
|
33
|
+
*/
|
|
34
|
+
export interface A2ASecretsEnv {
|
|
35
|
+
A2A_SIGNING_KEY: string;
|
|
36
|
+
GATEWAY_ORIGINS: string;
|
|
37
|
+
}
|
|
38
|
+
/** The minimum an agent Worker must bind for core to function. */
|
|
39
|
+
export type CoreEnv = AiEnv & A2ASecretsEnv;
|
|
40
|
+
/**
|
|
41
|
+
* Parse `GATEWAY_ORIGINS`. Accepts a JSON array (the documented form) or a
|
|
42
|
+
* single bare origin, so a misconfigured secret fails with a readable message
|
|
43
|
+
* rather than as an empty allowlist that rejects every caller identically.
|
|
44
|
+
*/
|
|
45
|
+
export declare function parseGatewayOrigins(raw: string): string[];
|
|
46
|
+
//# sourceMappingURL=env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,6DAA6D;AAC7D,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,EAAE,CAAC;CACR;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,aAAa;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,kEAAkE;AAClE,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,aAAa,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAiBzD"}
|
package/dist/env.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Worker `env` slices core reads, declared structurally.
|
|
3
|
+
*
|
|
4
|
+
* A published package cannot reference the ambient `Env` that `wrangler types`
|
|
5
|
+
* generates into a consumer's `worker-configuration.d.ts` — that interface only
|
|
6
|
+
* exists inside the app. So core never names `Env`. Every function that needs a
|
|
7
|
+
* binding either takes it as a parameter, or takes an object satisfying one of
|
|
8
|
+
* the slices below, and a consumer's generated `Env` satisfies them structurally
|
|
9
|
+
* with no cast.
|
|
10
|
+
*
|
|
11
|
+
* The two secrets are the zero-trust contract and are the only names core
|
|
12
|
+
* insists on; everything else is passed in. `createA2AWorker` lets a consumer
|
|
13
|
+
* rename even these — see {@link file://./worker/index.ts}.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Parse `GATEWAY_ORIGINS`. Accepts a JSON array (the documented form) or a
|
|
17
|
+
* single bare origin, so a misconfigured secret fails with a readable message
|
|
18
|
+
* rather than as an empty allowlist that rejects every caller identically.
|
|
19
|
+
*/
|
|
20
|
+
export function parseGatewayOrigins(raw) {
|
|
21
|
+
const trimmed = raw.trim();
|
|
22
|
+
if (!trimmed)
|
|
23
|
+
throw new Error("GATEWAY_ORIGINS is empty");
|
|
24
|
+
if (!trimmed.startsWith("["))
|
|
25
|
+
return [trimmed];
|
|
26
|
+
let parsed;
|
|
27
|
+
try {
|
|
28
|
+
parsed = JSON.parse(trimmed);
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
throw new Error(`GATEWAY_ORIGINS is not valid JSON: ${err.message}`);
|
|
32
|
+
}
|
|
33
|
+
if (!Array.isArray(parsed) || parsed.some((o) => typeof o !== "string")) {
|
|
34
|
+
throw new Error("GATEWAY_ORIGINS must be a JSON array of origin strings");
|
|
35
|
+
}
|
|
36
|
+
if (parsed.length === 0)
|
|
37
|
+
throw new Error("GATEWAY_ORIGINS is empty");
|
|
38
|
+
return parsed;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=env.js.map
|
package/dist/env.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AA8BH;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC7C,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAC3B,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC1D,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/C,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,sCAAuC,GAAa,CAAC,OAAO,EAAE,CAC/D,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC5E,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IACrE,OAAO,MAAkB,CAAC;AAC5B,CAAC"}
|