supertag-ai 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 +21 -0
- package/README.md +51 -0
- package/dist/chunk-B3EVEGNZ.js +13 -0
- package/dist/chunk-B3EVEGNZ.js.map +1 -0
- package/dist/chunk-ES42FTPC.js +1068 -0
- package/dist/chunk-ES42FTPC.js.map +1 -0
- package/dist/chunk-L7S2TKUG.js +656 -0
- package/dist/chunk-L7S2TKUG.js.map +1 -0
- package/dist/connectors.d.ts +45 -0
- package/dist/connectors.js +39 -0
- package/dist/connectors.js.map +1 -0
- package/dist/core.d.ts +721 -0
- package/dist/core.js +3 -0
- package/dist/core.js.map +1 -0
- package/dist/environments/e2b.d.ts +69 -0
- package/dist/environments/e2b.js +268 -0
- package/dist/environments/e2b.js.map +1 -0
- package/dist/gateway.d.ts +59 -0
- package/dist/gateway.js +1215 -0
- package/dist/gateway.js.map +1 -0
- package/dist/harnesses/claude-code.d.ts +67 -0
- package/dist/harnesses/claude-code.js +565 -0
- package/dist/harnesses/claude-code.js.map +1 -0
- package/dist/harnesses/codex.d.ts +68 -0
- package/dist/harnesses/codex.js +690 -0
- package/dist/harnesses/codex.js.map +1 -0
- package/dist/index.d.ts +100 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/resources/github.d.ts +80 -0
- package/dist/resources/github.js +374 -0
- package/dist/resources/github.js.map +1 -0
- package/dist/resources/linear.d.ts +25 -0
- package/dist/resources/linear.js +92 -0
- package/dist/resources/linear.js.map +1 -0
- package/dist/resources/slack.d.ts +25 -0
- package/dist/resources/slack.js +98 -0
- package/dist/resources/slack.js.map +1 -0
- package/dist/resources/teams.d.ts +27 -0
- package/dist/resources/teams.js +101 -0
- package/dist/resources/teams.js.map +1 -0
- package/dist/transport.d.ts +5 -0
- package/dist/transport.js +3 -0
- package/dist/transport.js.map +1 -0
- package/dist/worker.d.ts +634 -0
- package/dist/worker.js +3 -0
- package/dist/worker.js.map +1 -0
- package/package.json +127 -0
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,721 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const tagIdSchema: z.core.$ZodBranded<z.ZodString, "TagId", "out">;
|
|
4
|
+
type TagId = z.infer<typeof tagIdSchema>;
|
|
5
|
+
type DatabaseProvider = "sqlite" | "postgresql";
|
|
6
|
+
type ConnectorProvider = "github" | "lark" | "linear" | "slack" | "teams";
|
|
7
|
+
/** Immutable reference to one revision of a Worker execution profile. */
|
|
8
|
+
interface WorkerProfileRef {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly revision: string;
|
|
11
|
+
}
|
|
12
|
+
interface CreateTagInput {
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly workerProfile?: WorkerProfileRef;
|
|
15
|
+
}
|
|
16
|
+
/** SuperTag's stable non-human IAM principal and policy anchor. */
|
|
17
|
+
interface Tag {
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly name: string;
|
|
20
|
+
readonly workerProfile: WorkerProfileRef;
|
|
21
|
+
readonly status: "active";
|
|
22
|
+
readonly createdAt: string;
|
|
23
|
+
readonly updatedAt: string;
|
|
24
|
+
}
|
|
25
|
+
interface AddTagPresenceInput {
|
|
26
|
+
readonly tagId: string;
|
|
27
|
+
readonly connectorAccountId: string;
|
|
28
|
+
readonly scope: string;
|
|
29
|
+
readonly enabled?: boolean;
|
|
30
|
+
readonly createdBy?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* One Tag's durable, unambiguous presence at a connector-account scope.
|
|
34
|
+
* A presence provides only the baseline invocation lifecycle; Context and
|
|
35
|
+
* Permission Set activations independently equip and authorize admitted Tasks.
|
|
36
|
+
*/
|
|
37
|
+
interface TagPresence {
|
|
38
|
+
readonly id: string;
|
|
39
|
+
readonly tagId: string;
|
|
40
|
+
readonly connectorAccountId: string;
|
|
41
|
+
readonly scope: string;
|
|
42
|
+
readonly enabled: boolean;
|
|
43
|
+
readonly createdBy?: string;
|
|
44
|
+
readonly createdAt: string;
|
|
45
|
+
readonly updatedAt: string;
|
|
46
|
+
}
|
|
47
|
+
interface TagPresenceListFilter {
|
|
48
|
+
readonly tagId?: string;
|
|
49
|
+
readonly connectorAccountId?: string;
|
|
50
|
+
readonly enabled?: boolean;
|
|
51
|
+
}
|
|
52
|
+
interface CreateTagPermissionSetInput {
|
|
53
|
+
readonly tagId: string;
|
|
54
|
+
readonly name: string;
|
|
55
|
+
readonly createdBy?: string;
|
|
56
|
+
}
|
|
57
|
+
interface TagPermissionSet {
|
|
58
|
+
readonly id: string;
|
|
59
|
+
readonly tagId: string;
|
|
60
|
+
readonly name: string;
|
|
61
|
+
readonly createdBy?: string;
|
|
62
|
+
readonly createdAt: string;
|
|
63
|
+
readonly updatedAt: string;
|
|
64
|
+
}
|
|
65
|
+
interface TagPermissionSetListFilter {
|
|
66
|
+
readonly tagId?: string;
|
|
67
|
+
}
|
|
68
|
+
interface AddTagPermissionInput {
|
|
69
|
+
readonly permissionSetId: string;
|
|
70
|
+
readonly connectorAccountId: string;
|
|
71
|
+
readonly scope: string;
|
|
72
|
+
/** Canonical, non-secret resource locator used for request-time target selection. */
|
|
73
|
+
readonly reference?: string;
|
|
74
|
+
readonly action: string;
|
|
75
|
+
readonly createdBy?: string;
|
|
76
|
+
}
|
|
77
|
+
interface TagPermission {
|
|
78
|
+
readonly id: string;
|
|
79
|
+
readonly permissionSetId: string;
|
|
80
|
+
readonly connectorAccountId: string;
|
|
81
|
+
readonly scope: string;
|
|
82
|
+
readonly reference?: string;
|
|
83
|
+
readonly action: string;
|
|
84
|
+
readonly createdBy?: string;
|
|
85
|
+
readonly createdAt: string;
|
|
86
|
+
}
|
|
87
|
+
interface TagPermissionListFilter {
|
|
88
|
+
readonly permissionSetId?: string;
|
|
89
|
+
readonly tagId?: string;
|
|
90
|
+
readonly connectorAccountId?: string;
|
|
91
|
+
readonly scope?: string;
|
|
92
|
+
}
|
|
93
|
+
interface ActivateTagPermissionSetInput {
|
|
94
|
+
readonly permissionSetId: string;
|
|
95
|
+
readonly tagPresenceId: string;
|
|
96
|
+
readonly createdBy?: string;
|
|
97
|
+
}
|
|
98
|
+
interface TagPermissionActivation {
|
|
99
|
+
readonly id: string;
|
|
100
|
+
readonly permissionSetId: string;
|
|
101
|
+
readonly tagPresenceId: string;
|
|
102
|
+
readonly createdBy?: string;
|
|
103
|
+
readonly createdAt: string;
|
|
104
|
+
}
|
|
105
|
+
interface TagPermissionActivationListFilter {
|
|
106
|
+
readonly permissionSetId?: string;
|
|
107
|
+
readonly tagPresenceId?: string;
|
|
108
|
+
}
|
|
109
|
+
interface CreateTagContextSetInput {
|
|
110
|
+
readonly tagId: string;
|
|
111
|
+
readonly name: string;
|
|
112
|
+
readonly createdBy?: string;
|
|
113
|
+
}
|
|
114
|
+
/** A Tag-owned, permission-neutral collection of Task-composition items. */
|
|
115
|
+
interface TagContextSet {
|
|
116
|
+
readonly id: string;
|
|
117
|
+
readonly tagId: string;
|
|
118
|
+
readonly name: string;
|
|
119
|
+
readonly createdBy?: string;
|
|
120
|
+
readonly createdAt: string;
|
|
121
|
+
readonly updatedAt: string;
|
|
122
|
+
}
|
|
123
|
+
interface TagContextSetListFilter {
|
|
124
|
+
readonly tagId?: string;
|
|
125
|
+
}
|
|
126
|
+
interface TagSkillConfiguration {
|
|
127
|
+
readonly digest?: string;
|
|
128
|
+
readonly version?: string;
|
|
129
|
+
}
|
|
130
|
+
interface TagWorkSelectionPolicy {
|
|
131
|
+
readonly match: "shared-resource";
|
|
132
|
+
readonly maxAgeDays: number;
|
|
133
|
+
readonly limit: number;
|
|
134
|
+
}
|
|
135
|
+
interface AddTagContextItemBase {
|
|
136
|
+
readonly contextSetId: string;
|
|
137
|
+
/** Stable identity used to make adding an item idempotent. */
|
|
138
|
+
readonly itemKey: string;
|
|
139
|
+
readonly createdBy?: string;
|
|
140
|
+
}
|
|
141
|
+
type AddTagContextItemInput = (AddTagContextItemBase & {
|
|
142
|
+
readonly kind: "skill";
|
|
143
|
+
readonly reference: string;
|
|
144
|
+
readonly configuration?: TagSkillConfiguration;
|
|
145
|
+
}) | (AddTagContextItemBase & {
|
|
146
|
+
readonly kind: "work";
|
|
147
|
+
/** Exact Tag presence from which completed Work Records may be selected. */
|
|
148
|
+
readonly sourcePresenceId: string;
|
|
149
|
+
readonly selection: TagWorkSelectionPolicy;
|
|
150
|
+
});
|
|
151
|
+
interface TagContextItemBase {
|
|
152
|
+
readonly id: string;
|
|
153
|
+
readonly contextSetId: string;
|
|
154
|
+
readonly itemKey: string;
|
|
155
|
+
readonly createdBy?: string;
|
|
156
|
+
readonly createdAt: string;
|
|
157
|
+
}
|
|
158
|
+
type TagContextItem = (TagContextItemBase & {
|
|
159
|
+
readonly kind: "skill";
|
|
160
|
+
readonly reference: string;
|
|
161
|
+
readonly configuration?: TagSkillConfiguration;
|
|
162
|
+
}) | (TagContextItemBase & {
|
|
163
|
+
readonly kind: "work";
|
|
164
|
+
readonly sourcePresenceId: string;
|
|
165
|
+
readonly selection: TagWorkSelectionPolicy;
|
|
166
|
+
});
|
|
167
|
+
interface TagContextItemListFilter {
|
|
168
|
+
readonly contextSetId?: string;
|
|
169
|
+
}
|
|
170
|
+
interface ActivateTagContextSetInput {
|
|
171
|
+
readonly contextSetId: string;
|
|
172
|
+
readonly tagPresenceId: string;
|
|
173
|
+
readonly createdBy?: string;
|
|
174
|
+
}
|
|
175
|
+
/** Makes one Context Set eligible when the Tag is invoked from one configured location. */
|
|
176
|
+
interface TagContextActivation {
|
|
177
|
+
readonly id: string;
|
|
178
|
+
readonly contextSetId: string;
|
|
179
|
+
readonly tagPresenceId: string;
|
|
180
|
+
readonly createdBy?: string;
|
|
181
|
+
readonly createdAt: string;
|
|
182
|
+
}
|
|
183
|
+
interface TagContextActivationListFilter {
|
|
184
|
+
readonly contextSetId?: string;
|
|
185
|
+
readonly tagPresenceId?: string;
|
|
186
|
+
}
|
|
187
|
+
/** Explains whether access comes from the invocation location or an explicit Permission Set. */
|
|
188
|
+
type TagAuthorizationSource = "origin" | "permission-set";
|
|
189
|
+
interface TagAuthorizationResource {
|
|
190
|
+
readonly connectorAccountId: string;
|
|
191
|
+
readonly provider: ConnectorProvider;
|
|
192
|
+
readonly scope: string;
|
|
193
|
+
/** Canonical, non-secret locator when the Connector can provide one. */
|
|
194
|
+
readonly reference?: string;
|
|
195
|
+
readonly actions: readonly string[];
|
|
196
|
+
readonly sources: readonly TagAuthorizationSource[];
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Immutable collaboration authorization captured when the Gateway admits a Task.
|
|
200
|
+
* The Worker Host uses the selected profile and this policy to provision the
|
|
201
|
+
* harness, workspace, and MCP environment without routing tool calls through
|
|
202
|
+
* the Gateway.
|
|
203
|
+
*/
|
|
204
|
+
interface TagAuthorizationSnapshot {
|
|
205
|
+
readonly version: 2;
|
|
206
|
+
readonly capturedAt: string;
|
|
207
|
+
readonly tag: {
|
|
208
|
+
readonly id: string;
|
|
209
|
+
readonly name: string;
|
|
210
|
+
readonly workerProfile: WorkerProfileRef;
|
|
211
|
+
};
|
|
212
|
+
readonly origin: {
|
|
213
|
+
readonly tagPresenceId: string;
|
|
214
|
+
readonly connectorAccountId: string;
|
|
215
|
+
readonly provider: ConnectorProvider;
|
|
216
|
+
readonly scope: string;
|
|
217
|
+
};
|
|
218
|
+
readonly requester: InboundEventActor;
|
|
219
|
+
readonly permissionSets: readonly {
|
|
220
|
+
readonly id: string;
|
|
221
|
+
readonly name: string;
|
|
222
|
+
}[];
|
|
223
|
+
readonly resources: readonly TagAuthorizationResource[];
|
|
224
|
+
}
|
|
225
|
+
interface TagContextPlanItemBase {
|
|
226
|
+
readonly id: string;
|
|
227
|
+
readonly itemKey: string;
|
|
228
|
+
}
|
|
229
|
+
type TagContextPlanItem = (TagContextPlanItemBase & {
|
|
230
|
+
readonly kind: "skill";
|
|
231
|
+
readonly reference: string;
|
|
232
|
+
readonly configuration?: TagSkillConfiguration;
|
|
233
|
+
}) | (TagContextPlanItemBase & {
|
|
234
|
+
readonly kind: "work";
|
|
235
|
+
readonly source: {
|
|
236
|
+
readonly tagPresenceId: string;
|
|
237
|
+
readonly connectorAccountId: string;
|
|
238
|
+
readonly provider: ConnectorProvider;
|
|
239
|
+
readonly scope: string;
|
|
240
|
+
};
|
|
241
|
+
readonly selection: TagWorkSelectionPolicy;
|
|
242
|
+
/** Gateway-resolved, immutable cross-Session work admitted for this Task. */
|
|
243
|
+
readonly workRecords: readonly WorkRecord[];
|
|
244
|
+
});
|
|
245
|
+
interface TagContextPlanSet {
|
|
246
|
+
readonly id: string;
|
|
247
|
+
readonly name: string;
|
|
248
|
+
readonly items: readonly TagContextPlanItem[];
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Immutable selection of shared Work Records and skills for a Task.
|
|
252
|
+
* This does not authorize access: Worker Hosts enforce authorization separately.
|
|
253
|
+
*/
|
|
254
|
+
interface TagContextPlan {
|
|
255
|
+
readonly version: 4;
|
|
256
|
+
readonly capturedAt: string;
|
|
257
|
+
readonly sets: readonly TagContextPlanSet[];
|
|
258
|
+
}
|
|
259
|
+
declare function emptyTagContextPlan(capturedAt: string): TagContextPlan;
|
|
260
|
+
type JsonRecord = Readonly<Record<string, unknown>>;
|
|
261
|
+
type WorkReferenceRelationship = "changed" | "inspected" | "mentioned" | "originated-in" | "produced";
|
|
262
|
+
/** Stable, provider-aware identity used for deterministic Work Record matching. */
|
|
263
|
+
interface WorkReference {
|
|
264
|
+
readonly provider: ConnectorProvider;
|
|
265
|
+
readonly connectorAccountId?: string;
|
|
266
|
+
readonly resourceType: "artifact" | "channel" | "file" | "issue" | "project" | "pull-request" | "repository" | "thread";
|
|
267
|
+
readonly resourceId?: string;
|
|
268
|
+
readonly reference: string;
|
|
269
|
+
readonly relationship: WorkReferenceRelationship;
|
|
270
|
+
}
|
|
271
|
+
interface TaskResult {
|
|
272
|
+
readonly summary: string;
|
|
273
|
+
readonly decisions: readonly {
|
|
274
|
+
readonly text: string;
|
|
275
|
+
readonly status?: "accepted" | "proposed";
|
|
276
|
+
}[];
|
|
277
|
+
readonly changes: readonly {
|
|
278
|
+
readonly summary: string;
|
|
279
|
+
readonly reference?: string;
|
|
280
|
+
}[];
|
|
281
|
+
readonly unresolved: readonly string[];
|
|
282
|
+
readonly references: readonly WorkReference[];
|
|
283
|
+
readonly artifacts: readonly {
|
|
284
|
+
readonly uri: string;
|
|
285
|
+
readonly mediaType?: string;
|
|
286
|
+
readonly digest?: string;
|
|
287
|
+
}[];
|
|
288
|
+
}
|
|
289
|
+
interface Session {
|
|
290
|
+
readonly id: string;
|
|
291
|
+
readonly tagId: string;
|
|
292
|
+
readonly workerProfile: WorkerProfileRef;
|
|
293
|
+
readonly sessionKey: string;
|
|
294
|
+
readonly origin: JsonRecord;
|
|
295
|
+
readonly state: "open";
|
|
296
|
+
readonly lastInteractionAt: string;
|
|
297
|
+
readonly createdAt: string;
|
|
298
|
+
readonly updatedAt: string;
|
|
299
|
+
}
|
|
300
|
+
interface OpenSessionInput {
|
|
301
|
+
readonly tagId: string;
|
|
302
|
+
readonly workerProfile: WorkerProfileRef;
|
|
303
|
+
readonly sessionKey: string;
|
|
304
|
+
readonly origin: JsonRecord;
|
|
305
|
+
readonly at: string;
|
|
306
|
+
}
|
|
307
|
+
type TaskStatus = "cancelled" | "completed" | "failed" | "pending" | "running";
|
|
308
|
+
interface TaskWorkspaceTarget {
|
|
309
|
+
readonly provider: ConnectorProvider;
|
|
310
|
+
readonly connectorAccountId: string;
|
|
311
|
+
readonly scope: string;
|
|
312
|
+
readonly reference?: string;
|
|
313
|
+
readonly actions: readonly string[];
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Immutable operational workspace decision captured when a Task is admitted.
|
|
317
|
+
* It is intentionally separate from Context Sets: Context equips a Task, while
|
|
318
|
+
* this plan identifies the repository in which the Worker should operate.
|
|
319
|
+
*/
|
|
320
|
+
type TaskWorkspacePlan = {
|
|
321
|
+
readonly version: 1;
|
|
322
|
+
readonly status: "none";
|
|
323
|
+
} | {
|
|
324
|
+
readonly version: 1;
|
|
325
|
+
readonly status: "selected";
|
|
326
|
+
readonly selectedBy: "default" | "origin" | "request";
|
|
327
|
+
readonly target: TaskWorkspaceTarget;
|
|
328
|
+
} | {
|
|
329
|
+
readonly version: 1;
|
|
330
|
+
readonly status: "selection-required";
|
|
331
|
+
readonly choices: readonly TaskWorkspaceTarget[];
|
|
332
|
+
} | {
|
|
333
|
+
readonly version: 1;
|
|
334
|
+
readonly status: "unavailable";
|
|
335
|
+
readonly requested: readonly string[];
|
|
336
|
+
};
|
|
337
|
+
/** One durable unit of user intent admitted for a Tag within a Session. */
|
|
338
|
+
interface Task {
|
|
339
|
+
readonly id: string;
|
|
340
|
+
readonly inboundEventId: string;
|
|
341
|
+
readonly tagId: string;
|
|
342
|
+
readonly sessionId: string;
|
|
343
|
+
readonly workerProfile: WorkerProfileRef;
|
|
344
|
+
readonly actor: InboundEventActor;
|
|
345
|
+
readonly trigger: JsonRecord;
|
|
346
|
+
readonly workspacePlan: TaskWorkspacePlan;
|
|
347
|
+
/** Immutable, automatic continuity captured from earlier Tasks in this Session. */
|
|
348
|
+
readonly sessionHistory: readonly WorkRecord[];
|
|
349
|
+
readonly authorizationSnapshot: TagAuthorizationSnapshot;
|
|
350
|
+
readonly contextPlan: TagContextPlan;
|
|
351
|
+
readonly status: TaskStatus;
|
|
352
|
+
readonly startedAt?: string;
|
|
353
|
+
readonly endedAt?: string;
|
|
354
|
+
readonly outcome?: JsonRecord;
|
|
355
|
+
readonly createdAt: string;
|
|
356
|
+
readonly updatedAt: string;
|
|
357
|
+
}
|
|
358
|
+
interface OpenTaskInput {
|
|
359
|
+
readonly inboundEventId: string;
|
|
360
|
+
readonly tagId: string;
|
|
361
|
+
readonly sessionId: string;
|
|
362
|
+
readonly workerProfile: WorkerProfileRef;
|
|
363
|
+
readonly actor: InboundEventActor;
|
|
364
|
+
readonly trigger: JsonRecord;
|
|
365
|
+
readonly workspacePlan: TaskWorkspacePlan;
|
|
366
|
+
readonly sessionHistory: readonly WorkRecord[];
|
|
367
|
+
readonly authorizationSnapshot: TagAuthorizationSnapshot;
|
|
368
|
+
readonly contextPlan: TagContextPlan;
|
|
369
|
+
readonly createdAt: string;
|
|
370
|
+
}
|
|
371
|
+
interface StartTaskInput {
|
|
372
|
+
readonly taskId: string;
|
|
373
|
+
readonly startedAt: string;
|
|
374
|
+
}
|
|
375
|
+
interface CloseTaskInput {
|
|
376
|
+
readonly taskId: string;
|
|
377
|
+
readonly status: Exclude<TaskStatus, "pending" | "running">;
|
|
378
|
+
readonly outcome?: JsonRecord;
|
|
379
|
+
readonly endedAt: string;
|
|
380
|
+
}
|
|
381
|
+
type TaskAttemptStatus = "cancelled" | "completed" | "failed" | "running";
|
|
382
|
+
/** One concrete Worker execution or retry of a Task. */
|
|
383
|
+
interface TaskAttempt {
|
|
384
|
+
readonly id: string;
|
|
385
|
+
readonly taskId: string;
|
|
386
|
+
readonly attemptNumber: number;
|
|
387
|
+
readonly workerSnapshot: JsonRecord;
|
|
388
|
+
readonly status: TaskAttemptStatus;
|
|
389
|
+
readonly startedAt: string;
|
|
390
|
+
readonly endedAt?: string;
|
|
391
|
+
readonly outcome?: JsonRecord;
|
|
392
|
+
readonly createdAt: string;
|
|
393
|
+
readonly updatedAt: string;
|
|
394
|
+
}
|
|
395
|
+
interface CreateTaskAttemptInput {
|
|
396
|
+
readonly taskId: string;
|
|
397
|
+
readonly attemptNumber: number;
|
|
398
|
+
readonly workerSnapshot: JsonRecord;
|
|
399
|
+
readonly startedAt: string;
|
|
400
|
+
}
|
|
401
|
+
interface CloseTaskAttemptInput {
|
|
402
|
+
readonly attemptId: string;
|
|
403
|
+
readonly status: Exclude<TaskAttemptStatus, "running">;
|
|
404
|
+
readonly outcome?: JsonRecord;
|
|
405
|
+
readonly endedAt: string;
|
|
406
|
+
}
|
|
407
|
+
interface TaskEvent {
|
|
408
|
+
readonly id: string;
|
|
409
|
+
readonly taskId: string;
|
|
410
|
+
readonly attemptId?: string;
|
|
411
|
+
readonly sequence: number;
|
|
412
|
+
readonly type: string;
|
|
413
|
+
readonly payload?: JsonRecord;
|
|
414
|
+
readonly createdAt: string;
|
|
415
|
+
}
|
|
416
|
+
declare const WORK_RECORD_ARTIFACT_KIND = "supertag.work-record.v1";
|
|
417
|
+
/**
|
|
418
|
+
* Safe, durable continuity record produced from observable Task inputs and
|
|
419
|
+
* outputs. It deliberately excludes hidden reasoning and raw tool logs.
|
|
420
|
+
*/
|
|
421
|
+
interface WorkRecord {
|
|
422
|
+
readonly version: 1;
|
|
423
|
+
readonly taskId: string;
|
|
424
|
+
readonly sessionId: string;
|
|
425
|
+
readonly tagId: string;
|
|
426
|
+
readonly intent?: string;
|
|
427
|
+
readonly result: TaskResult;
|
|
428
|
+
readonly origin: {
|
|
429
|
+
readonly tagPresenceId: string;
|
|
430
|
+
readonly provider: ConnectorProvider;
|
|
431
|
+
readonly connectorAccountId: string;
|
|
432
|
+
readonly scope: string;
|
|
433
|
+
readonly sessionKey: string;
|
|
434
|
+
readonly source: JsonRecord;
|
|
435
|
+
};
|
|
436
|
+
readonly requester: InboundEventActor;
|
|
437
|
+
readonly resources: readonly {
|
|
438
|
+
readonly provider: ConnectorProvider;
|
|
439
|
+
readonly connectorAccountId: string;
|
|
440
|
+
readonly scope: string;
|
|
441
|
+
readonly reference?: string;
|
|
442
|
+
readonly actions: readonly string[];
|
|
443
|
+
}[];
|
|
444
|
+
readonly references: readonly WorkReference[];
|
|
445
|
+
readonly citation: {
|
|
446
|
+
readonly label: string;
|
|
447
|
+
readonly uri: string;
|
|
448
|
+
};
|
|
449
|
+
readonly completedAt: string;
|
|
450
|
+
}
|
|
451
|
+
interface Artifact {
|
|
452
|
+
readonly id: string;
|
|
453
|
+
readonly taskId: string;
|
|
454
|
+
readonly kind: string;
|
|
455
|
+
readonly location: string;
|
|
456
|
+
readonly contentHash?: string;
|
|
457
|
+
readonly sourceReferences?: readonly JsonRecord[];
|
|
458
|
+
readonly metadata?: JsonRecord;
|
|
459
|
+
readonly references: readonly WorkReference[];
|
|
460
|
+
readonly createdAt: string;
|
|
461
|
+
}
|
|
462
|
+
interface CreateArtifactInput {
|
|
463
|
+
readonly taskId: string;
|
|
464
|
+
readonly kind: string;
|
|
465
|
+
readonly location: string;
|
|
466
|
+
readonly contentHash?: string;
|
|
467
|
+
readonly sourceReferences?: readonly JsonRecord[];
|
|
468
|
+
readonly metadata?: JsonRecord;
|
|
469
|
+
readonly references?: readonly WorkReference[];
|
|
470
|
+
readonly createdAt: string;
|
|
471
|
+
}
|
|
472
|
+
interface ArtifactListFilter {
|
|
473
|
+
readonly taskId?: string;
|
|
474
|
+
readonly sessionId?: string;
|
|
475
|
+
readonly tagId?: string;
|
|
476
|
+
readonly kind?: string;
|
|
477
|
+
readonly relatedTo?: readonly Pick<WorkReference, "provider" | "resourceType" | "resourceId" | "reference">[];
|
|
478
|
+
readonly originSurfaces?: readonly {
|
|
479
|
+
readonly provider: ConnectorProvider;
|
|
480
|
+
readonly connectorAccountId: string;
|
|
481
|
+
readonly scope: string;
|
|
482
|
+
}[];
|
|
483
|
+
readonly createdAfter?: string;
|
|
484
|
+
readonly limit?: number;
|
|
485
|
+
}
|
|
486
|
+
interface AppendTaskEventInput {
|
|
487
|
+
readonly taskId: string;
|
|
488
|
+
readonly attemptId?: string;
|
|
489
|
+
readonly type: string;
|
|
490
|
+
readonly payload?: JsonRecord;
|
|
491
|
+
readonly createdAt?: string;
|
|
492
|
+
}
|
|
493
|
+
type InboundEventKind = "issue" | "issue_comment" | "mention" | "message" | "pull_request";
|
|
494
|
+
interface InboundEventActor {
|
|
495
|
+
readonly id: string;
|
|
496
|
+
readonly displayName?: string;
|
|
497
|
+
readonly kind: "bot" | "user" | "unknown";
|
|
498
|
+
}
|
|
499
|
+
interface CallbackRoute {
|
|
500
|
+
readonly provider: ConnectorProvider;
|
|
501
|
+
readonly mode: "github_issue_comment" | "lark_thread" | "linear_issue_comment" | "slack_thread" | "teams_thread";
|
|
502
|
+
readonly threadKey: string;
|
|
503
|
+
readonly target: Readonly<Record<string, string>>;
|
|
504
|
+
}
|
|
505
|
+
interface InboundConnectorEvent {
|
|
506
|
+
readonly eventId: string;
|
|
507
|
+
readonly logicalEventId: string;
|
|
508
|
+
readonly provider: ConnectorProvider;
|
|
509
|
+
readonly externalAccountId: string;
|
|
510
|
+
readonly kind: InboundEventKind;
|
|
511
|
+
readonly scope: string;
|
|
512
|
+
readonly sessionKey: string;
|
|
513
|
+
readonly actor: InboundEventActor;
|
|
514
|
+
readonly text?: string;
|
|
515
|
+
readonly occurredAt: string;
|
|
516
|
+
readonly callback: CallbackRoute;
|
|
517
|
+
readonly source: Readonly<Record<string, string>>;
|
|
518
|
+
readonly metadata: Readonly<Record<string, string | number | boolean | null>>;
|
|
519
|
+
}
|
|
520
|
+
interface InboundEventClaimInput {
|
|
521
|
+
readonly connectorAccountId: string;
|
|
522
|
+
readonly eventId: string;
|
|
523
|
+
readonly claimedAt: string;
|
|
524
|
+
}
|
|
525
|
+
type DurableInboundEventStatus = "completed" | "failed" | "pending" | "processing";
|
|
526
|
+
interface DurableInboundEvent {
|
|
527
|
+
readonly id: string;
|
|
528
|
+
readonly connectorAccountId: string;
|
|
529
|
+
readonly tagPresenceId: string;
|
|
530
|
+
readonly tagId: string;
|
|
531
|
+
readonly authorization: TagAuthorizationSnapshot;
|
|
532
|
+
readonly contextPlan: TagContextPlan;
|
|
533
|
+
readonly event: InboundConnectorEvent;
|
|
534
|
+
readonly status: DurableInboundEventStatus;
|
|
535
|
+
readonly attemptCount: number;
|
|
536
|
+
readonly maxAttempts: number;
|
|
537
|
+
readonly availableAt: string;
|
|
538
|
+
readonly leaseOwner?: string;
|
|
539
|
+
readonly leaseExpiresAt?: string;
|
|
540
|
+
readonly lastError?: string;
|
|
541
|
+
readonly completedAt?: string;
|
|
542
|
+
readonly failedAt?: string;
|
|
543
|
+
readonly createdAt: string;
|
|
544
|
+
readonly updatedAt: string;
|
|
545
|
+
}
|
|
546
|
+
interface AdmitInboundEventInput {
|
|
547
|
+
readonly connectorAccountId: string;
|
|
548
|
+
readonly tagPresenceId: string;
|
|
549
|
+
readonly tagId: string;
|
|
550
|
+
readonly authorization: TagAuthorizationSnapshot;
|
|
551
|
+
readonly contextPlan: TagContextPlan;
|
|
552
|
+
readonly event: InboundConnectorEvent;
|
|
553
|
+
readonly availableAt?: string;
|
|
554
|
+
readonly maxAttempts?: number;
|
|
555
|
+
}
|
|
556
|
+
type AdmitInboundEventResult = {
|
|
557
|
+
readonly status: "admitted";
|
|
558
|
+
readonly work: DurableInboundEvent;
|
|
559
|
+
} | {
|
|
560
|
+
readonly status: "duplicate";
|
|
561
|
+
readonly work: DurableInboundEvent;
|
|
562
|
+
};
|
|
563
|
+
interface ClaimDueWorkInput {
|
|
564
|
+
readonly leaseOwner: string;
|
|
565
|
+
readonly now: string;
|
|
566
|
+
readonly leaseExpiresAt: string;
|
|
567
|
+
}
|
|
568
|
+
interface CompleteInboundEventInput {
|
|
569
|
+
readonly inboundEventId: string;
|
|
570
|
+
readonly leaseOwner: string;
|
|
571
|
+
readonly workerId: string;
|
|
572
|
+
readonly responseText: string;
|
|
573
|
+
readonly completedAt: string;
|
|
574
|
+
}
|
|
575
|
+
interface RetryInboundEventInput {
|
|
576
|
+
readonly inboundEventId: string;
|
|
577
|
+
readonly leaseOwner: string;
|
|
578
|
+
readonly error: string;
|
|
579
|
+
readonly retryAt: string;
|
|
580
|
+
readonly failedAt: string;
|
|
581
|
+
}
|
|
582
|
+
type OutboundReplyStatus = "delivered" | "delivering" | "failed" | "pending";
|
|
583
|
+
type OutboundPresentation = "acknowledgement" | "error" | "final-result" | "status";
|
|
584
|
+
interface OutboundReply {
|
|
585
|
+
readonly id: string;
|
|
586
|
+
readonly inboundEventId: string;
|
|
587
|
+
readonly connectorAccountId: string;
|
|
588
|
+
readonly workerId: string;
|
|
589
|
+
readonly event: InboundConnectorEvent;
|
|
590
|
+
readonly callback: CallbackRoute;
|
|
591
|
+
readonly presentation: OutboundPresentation;
|
|
592
|
+
/** Stable idempotency key within one inbound event, such as acknowledgement or final. */
|
|
593
|
+
readonly deliveryKey: string;
|
|
594
|
+
/** Canonical Markdown. The destination connector renders it immediately before delivery. */
|
|
595
|
+
readonly text: string;
|
|
596
|
+
readonly status: OutboundReplyStatus;
|
|
597
|
+
readonly attemptCount: number;
|
|
598
|
+
readonly maxAttempts: number;
|
|
599
|
+
readonly availableAt: string;
|
|
600
|
+
readonly leaseOwner?: string;
|
|
601
|
+
readonly leaseExpiresAt?: string;
|
|
602
|
+
readonly lastError?: string;
|
|
603
|
+
readonly deliveredAt?: string;
|
|
604
|
+
readonly failedAt?: string;
|
|
605
|
+
readonly createdAt: string;
|
|
606
|
+
readonly updatedAt: string;
|
|
607
|
+
}
|
|
608
|
+
interface CompleteOutboundReplyInput {
|
|
609
|
+
readonly outboundReplyId: string;
|
|
610
|
+
readonly leaseOwner: string;
|
|
611
|
+
readonly deliveredAt: string;
|
|
612
|
+
}
|
|
613
|
+
interface EnqueueOutboundReplyInput {
|
|
614
|
+
readonly inboundEventId: string;
|
|
615
|
+
readonly workerId: string;
|
|
616
|
+
readonly presentation: OutboundPresentation;
|
|
617
|
+
readonly deliveryKey: string;
|
|
618
|
+
readonly text: string;
|
|
619
|
+
readonly createdAt: string;
|
|
620
|
+
}
|
|
621
|
+
interface RetryOutboundReplyInput {
|
|
622
|
+
readonly outboundReplyId: string;
|
|
623
|
+
readonly leaseOwner: string;
|
|
624
|
+
readonly error: string;
|
|
625
|
+
readonly retryAt: string;
|
|
626
|
+
readonly failedAt: string;
|
|
627
|
+
}
|
|
628
|
+
interface ConnectorAccountInput {
|
|
629
|
+
readonly provider: ConnectorProvider;
|
|
630
|
+
readonly externalAccountId: string;
|
|
631
|
+
readonly displayName: string;
|
|
632
|
+
readonly authMethod: string;
|
|
633
|
+
/** Stable logical identifier; the configured credential vault owns its physical location. */
|
|
634
|
+
readonly credentialId: string;
|
|
635
|
+
readonly status: "connected";
|
|
636
|
+
readonly configuration: Readonly<Record<string, unknown>>;
|
|
637
|
+
readonly verifiedAt: string;
|
|
638
|
+
}
|
|
639
|
+
interface ConnectorAccount extends ConnectorAccountInput {
|
|
640
|
+
readonly id: string;
|
|
641
|
+
readonly createdAt: string;
|
|
642
|
+
readonly updatedAt: string;
|
|
643
|
+
}
|
|
644
|
+
type CredentialValue = Readonly<Record<string, string>>;
|
|
645
|
+
/**
|
|
646
|
+
* Gateway-owned credential persistence. Identifiers are logical and stable across providers;
|
|
647
|
+
* implementations decide whether values live in a local file or an external secret service.
|
|
648
|
+
*/
|
|
649
|
+
interface GatewayCredentialVault {
|
|
650
|
+
store(credentialId: string, value: CredentialValue): Promise<void>;
|
|
651
|
+
resolve(credentialId: string): Promise<CredentialValue | undefined>;
|
|
652
|
+
delete(credentialId: string): Promise<void>;
|
|
653
|
+
}
|
|
654
|
+
interface Store {
|
|
655
|
+
readonly provider: DatabaseProvider;
|
|
656
|
+
connect(): Promise<void>;
|
|
657
|
+
disconnect(): Promise<void>;
|
|
658
|
+
createTag(input: CreateTagInput): Promise<Tag>;
|
|
659
|
+
findTagById(id: string): Promise<Tag | undefined>;
|
|
660
|
+
findTagByName(name: string): Promise<Tag | undefined>;
|
|
661
|
+
listTags(): Promise<readonly Tag[]>;
|
|
662
|
+
addTagPresence(input: AddTagPresenceInput): Promise<TagPresence>;
|
|
663
|
+
findTagPresenceById(id: string): Promise<TagPresence | undefined>;
|
|
664
|
+
listTagPresences(filter?: TagPresenceListFilter): Promise<readonly TagPresence[]>;
|
|
665
|
+
removeTagPresence(id: string): Promise<boolean>;
|
|
666
|
+
resolveTagPresence(connectorAccountId: string, scope: string): Promise<TagPresence | undefined>;
|
|
667
|
+
addTagPermission(input: AddTagPermissionInput): Promise<TagPermission>;
|
|
668
|
+
createTagPermissionSet(input: CreateTagPermissionSetInput): Promise<TagPermissionSet>;
|
|
669
|
+
findTagPermissionSetById(id: string): Promise<TagPermissionSet | undefined>;
|
|
670
|
+
findTagPermissionSetByName(tagId: string, name: string): Promise<TagPermissionSet | undefined>;
|
|
671
|
+
listTagPermissionSets(filter?: TagPermissionSetListFilter): Promise<readonly TagPermissionSet[]>;
|
|
672
|
+
removeTagPermissionSet(id: string): Promise<boolean>;
|
|
673
|
+
listTagPermissions(filter?: TagPermissionListFilter): Promise<readonly TagPermission[]>;
|
|
674
|
+
removeTagPermission(id: string): Promise<boolean>;
|
|
675
|
+
activateTagPermissionSet(input: ActivateTagPermissionSetInput): Promise<TagPermissionActivation>;
|
|
676
|
+
listTagPermissionActivations(filter?: TagPermissionActivationListFilter): Promise<readonly TagPermissionActivation[]>;
|
|
677
|
+
deactivateTagPermissionSet(permissionSetId: string, tagPresenceId: string): Promise<boolean>;
|
|
678
|
+
createTagContextSet(input: CreateTagContextSetInput): Promise<TagContextSet>;
|
|
679
|
+
findTagContextSetById(id: string): Promise<TagContextSet | undefined>;
|
|
680
|
+
findTagContextSetByName(tagId: string, name: string): Promise<TagContextSet | undefined>;
|
|
681
|
+
listTagContextSets(filter?: TagContextSetListFilter): Promise<readonly TagContextSet[]>;
|
|
682
|
+
removeTagContextSet(id: string): Promise<boolean>;
|
|
683
|
+
addTagContextItem(input: AddTagContextItemInput): Promise<TagContextItem>;
|
|
684
|
+
listTagContextItems(filter?: TagContextItemListFilter): Promise<readonly TagContextItem[]>;
|
|
685
|
+
removeTagContextItem(id: string): Promise<boolean>;
|
|
686
|
+
activateTagContextSet(input: ActivateTagContextSetInput): Promise<TagContextActivation>;
|
|
687
|
+
listTagContextActivations(filter?: TagContextActivationListFilter): Promise<readonly TagContextActivation[]>;
|
|
688
|
+
deactivateTagContextSet(contextSetId: string, tagPresenceId: string): Promise<boolean>;
|
|
689
|
+
openSession(input: OpenSessionInput): Promise<Session>;
|
|
690
|
+
findSessionById(id: string): Promise<Session | undefined>;
|
|
691
|
+
findSessionByTagAndKey(tagId: string, sessionKey: string): Promise<Session | undefined>;
|
|
692
|
+
openTask(input: OpenTaskInput): Promise<Task>;
|
|
693
|
+
startTask(input: StartTaskInput): Promise<Task>;
|
|
694
|
+
closeTask(input: CloseTaskInput): Promise<Task>;
|
|
695
|
+
findTaskById(id: string): Promise<Task | undefined>;
|
|
696
|
+
createTaskAttempt(input: CreateTaskAttemptInput): Promise<TaskAttempt>;
|
|
697
|
+
closeTaskAttempt(input: CloseTaskAttemptInput): Promise<TaskAttempt>;
|
|
698
|
+
listTaskAttempts(taskId: string): Promise<readonly TaskAttempt[]>;
|
|
699
|
+
appendTaskEvent(input: AppendTaskEventInput): Promise<TaskEvent>;
|
|
700
|
+
listTaskEvents(taskId: string): Promise<readonly TaskEvent[]>;
|
|
701
|
+
createArtifact(input: CreateArtifactInput): Promise<Artifact>;
|
|
702
|
+
findArtifactById(id: string): Promise<Artifact | undefined>;
|
|
703
|
+
listArtifacts(filter?: ArtifactListFilter): Promise<readonly Artifact[]>;
|
|
704
|
+
saveConnectorAccount(input: ConnectorAccountInput): Promise<ConnectorAccount>;
|
|
705
|
+
findConnectorAccount(provider: ConnectorProvider, externalAccountId: string): Promise<ConnectorAccount | undefined>;
|
|
706
|
+
findConnectorAccountById(id: string): Promise<ConnectorAccount | undefined>;
|
|
707
|
+
listConnectorAccounts(): Promise<readonly ConnectorAccount[]>;
|
|
708
|
+
admitInboundEvent(input: AdmitInboundEventInput): Promise<AdmitInboundEventResult>;
|
|
709
|
+
claimNextInboundEvent(input: ClaimDueWorkInput): Promise<DurableInboundEvent | undefined>;
|
|
710
|
+
completeInboundEvent(input: CompleteInboundEventInput): Promise<OutboundReply>;
|
|
711
|
+
enqueueOutboundReply(input: EnqueueOutboundReplyInput): Promise<OutboundReply>;
|
|
712
|
+
retryInboundEvent(input: RetryInboundEventInput): Promise<"failed" | "pending">;
|
|
713
|
+
claimNextOutboundReply(input: ClaimDueWorkInput): Promise<OutboundReply | undefined>;
|
|
714
|
+
completeOutboundReply(input: CompleteOutboundReplyInput): Promise<void>;
|
|
715
|
+
retryOutboundReply(input: RetryOutboundReplyInput): Promise<"failed" | "pending">;
|
|
716
|
+
claimInboundEvent(input: InboundEventClaimInput): Promise<boolean>;
|
|
717
|
+
releaseInboundEventClaim(connectorAccountId: string, eventId: string): Promise<void>;
|
|
718
|
+
}
|
|
719
|
+
declare const CORE_VERSION = "0.0.0";
|
|
720
|
+
|
|
721
|
+
export { type ActivateTagContextSetInput, type ActivateTagPermissionSetInput, type AddTagContextItemInput, type AddTagPermissionInput, type AddTagPresenceInput, type AdmitInboundEventInput, type AdmitInboundEventResult, type AppendTaskEventInput, type Artifact, type ArtifactListFilter, CORE_VERSION, type CallbackRoute, type ClaimDueWorkInput, type CloseTaskAttemptInput, type CloseTaskInput, type CompleteInboundEventInput, type CompleteOutboundReplyInput, type ConnectorAccount, type ConnectorAccountInput, type ConnectorProvider, type CreateArtifactInput, type CreateTagContextSetInput, type CreateTagInput, type CreateTagPermissionSetInput, type CreateTaskAttemptInput, type CredentialValue, type DatabaseProvider, type DurableInboundEvent, type DurableInboundEventStatus, type EnqueueOutboundReplyInput, type GatewayCredentialVault, type InboundConnectorEvent, type InboundEventActor, type InboundEventClaimInput, type InboundEventKind, type JsonRecord, type OpenSessionInput, type OpenTaskInput, type OutboundPresentation, type OutboundReply, type OutboundReplyStatus, type RetryInboundEventInput, type RetryOutboundReplyInput, type Session, type StartTaskInput, type Store, type Tag, type TagAuthorizationResource, type TagAuthorizationSnapshot, type TagAuthorizationSource, type TagContextActivation, type TagContextActivationListFilter, type TagContextItem, type TagContextItemListFilter, type TagContextPlan, type TagContextPlanItem, type TagContextPlanSet, type TagContextSet, type TagContextSetListFilter, type TagId, type TagPermission, type TagPermissionActivation, type TagPermissionActivationListFilter, type TagPermissionListFilter, type TagPermissionSet, type TagPermissionSetListFilter, type TagPresence, type TagPresenceListFilter, type TagSkillConfiguration, type TagWorkSelectionPolicy, type Task, type TaskAttempt, type TaskAttemptStatus, type TaskEvent, type TaskResult, type TaskStatus, type TaskWorkspacePlan, type TaskWorkspaceTarget, WORK_RECORD_ARTIFACT_KIND, type WorkRecord, type WorkReference, type WorkReferenceRelationship, type WorkerProfileRef, emptyTagContextPlan, tagIdSchema };
|