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/worker.d.ts
ADDED
|
@@ -0,0 +1,634 @@
|
|
|
1
|
+
import { JsonRecord, InboundEventActor, TagAuthorizationSnapshot, TagContextPlan, TaskWorkspacePlan, WorkerProfileRef as WorkerProfileRef$1, WorkRecord, TaskResult as TaskResult$1, TagContextPlanItem } from './core.js';
|
|
2
|
+
import 'zod';
|
|
3
|
+
|
|
4
|
+
type TaskResult = TaskResult$1;
|
|
5
|
+
interface CapabilityIdentifier {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly version: number;
|
|
8
|
+
}
|
|
9
|
+
declare const TASK_ATTEMPT_EVENT_STREAM_CAPABILITY: CapabilityIdentifier;
|
|
10
|
+
declare const TASK_ATTEMPT_CANCELLATION_CAPABILITY: CapabilityIdentifier;
|
|
11
|
+
declare const LOCAL_PROCESS_CAPABILITY: CapabilityIdentifier;
|
|
12
|
+
type WorkerProfileRef = WorkerProfileRef$1;
|
|
13
|
+
interface TaskOrigin {
|
|
14
|
+
/** Namespaced collaboration surface type, such as slack or github. */
|
|
15
|
+
readonly surface: string;
|
|
16
|
+
readonly accountId: string;
|
|
17
|
+
readonly scope: string;
|
|
18
|
+
readonly sessionKey: string;
|
|
19
|
+
readonly occurredAt: string;
|
|
20
|
+
readonly source?: JsonRecord;
|
|
21
|
+
readonly metadata?: JsonRecord;
|
|
22
|
+
}
|
|
23
|
+
interface TaskMessage {
|
|
24
|
+
readonly id: string;
|
|
25
|
+
readonly role: "requester" | "teammate" | "system";
|
|
26
|
+
readonly text: string;
|
|
27
|
+
readonly actor?: InboundEventActor;
|
|
28
|
+
}
|
|
29
|
+
interface ResourceRef {
|
|
30
|
+
readonly uri: string;
|
|
31
|
+
readonly mediaType?: string;
|
|
32
|
+
readonly digest?: string;
|
|
33
|
+
readonly provenance?: JsonRecord;
|
|
34
|
+
}
|
|
35
|
+
interface ArtifactRef extends ResourceRef {
|
|
36
|
+
readonly id: string;
|
|
37
|
+
readonly name?: string;
|
|
38
|
+
}
|
|
39
|
+
interface CheckpointRef extends ResourceRef {
|
|
40
|
+
readonly id: string;
|
|
41
|
+
readonly format: string;
|
|
42
|
+
}
|
|
43
|
+
interface TaskInput {
|
|
44
|
+
readonly origin: TaskOrigin;
|
|
45
|
+
readonly messages: readonly TaskMessage[];
|
|
46
|
+
readonly attachments?: readonly ResourceRef[];
|
|
47
|
+
}
|
|
48
|
+
interface TaskAttemptSessionContext {
|
|
49
|
+
readonly id: string;
|
|
50
|
+
/**
|
|
51
|
+
* Opaque checkpoint produced by the last successfully completed Task in
|
|
52
|
+
* this Session. The Gateway admits only checkpoints whose security and
|
|
53
|
+
* compatibility envelope is valid for this Attempt; the harness still
|
|
54
|
+
* decides whether it understands the checkpoint format.
|
|
55
|
+
*/
|
|
56
|
+
readonly checkpoint?: CheckpointRef;
|
|
57
|
+
/** Canonical, bounded replay fallback from completed Tasks in this Session. */
|
|
58
|
+
readonly history?: readonly WorkRecord[];
|
|
59
|
+
}
|
|
60
|
+
/** Immutable, connector-neutral input admitted by the Gateway for one attempt. */
|
|
61
|
+
interface TaskAttemptSpec {
|
|
62
|
+
readonly version: 1;
|
|
63
|
+
readonly taskId: string;
|
|
64
|
+
readonly attemptId: string;
|
|
65
|
+
readonly tag: {
|
|
66
|
+
readonly id: string;
|
|
67
|
+
readonly name: string;
|
|
68
|
+
};
|
|
69
|
+
readonly input: TaskInput;
|
|
70
|
+
readonly authorization: TagAuthorizationSnapshot;
|
|
71
|
+
readonly contextPlan: TagContextPlan;
|
|
72
|
+
readonly workspacePlan: TaskWorkspacePlan;
|
|
73
|
+
readonly workerProfile: WorkerProfileRef;
|
|
74
|
+
readonly session?: TaskAttemptSessionContext;
|
|
75
|
+
}
|
|
76
|
+
interface TaskAttemptEventBase {
|
|
77
|
+
readonly taskId: string;
|
|
78
|
+
readonly attemptId: string;
|
|
79
|
+
readonly at: string;
|
|
80
|
+
}
|
|
81
|
+
type TaskAttemptEvent = (TaskAttemptEventBase & {
|
|
82
|
+
readonly type: "execution.started";
|
|
83
|
+
readonly workerId: string;
|
|
84
|
+
}) | (TaskAttemptEventBase & {
|
|
85
|
+
readonly type: "materialization.completed";
|
|
86
|
+
readonly manifest: MaterializationManifest;
|
|
87
|
+
}) | (TaskAttemptEventBase & {
|
|
88
|
+
readonly type: "output.delta";
|
|
89
|
+
readonly text: string;
|
|
90
|
+
}) | (TaskAttemptEventBase & {
|
|
91
|
+
readonly type: "output.message";
|
|
92
|
+
readonly message: {
|
|
93
|
+
readonly role: "teammate";
|
|
94
|
+
readonly text: string;
|
|
95
|
+
};
|
|
96
|
+
}) | (TaskAttemptEventBase & {
|
|
97
|
+
readonly type: "result";
|
|
98
|
+
readonly result: TaskResult;
|
|
99
|
+
}) | (TaskAttemptEventBase & {
|
|
100
|
+
readonly type: "artifact.created";
|
|
101
|
+
readonly artifact: ArtifactRef;
|
|
102
|
+
}) | (TaskAttemptEventBase & {
|
|
103
|
+
readonly type: "checkpoint.created";
|
|
104
|
+
readonly checkpoint: CheckpointRef;
|
|
105
|
+
}) | (TaskAttemptEventBase & {
|
|
106
|
+
readonly type: "approval.requested";
|
|
107
|
+
readonly request: {
|
|
108
|
+
readonly id: string;
|
|
109
|
+
readonly description: string;
|
|
110
|
+
readonly data?: JsonRecord;
|
|
111
|
+
};
|
|
112
|
+
}) | (TaskAttemptEventBase & {
|
|
113
|
+
readonly type: "execution.completed";
|
|
114
|
+
}) | (TaskAttemptEventBase & {
|
|
115
|
+
readonly type: "execution.failed";
|
|
116
|
+
readonly error: {
|
|
117
|
+
readonly name: string;
|
|
118
|
+
readonly message: string;
|
|
119
|
+
};
|
|
120
|
+
});
|
|
121
|
+
interface WorkerDescriptor {
|
|
122
|
+
readonly id: string;
|
|
123
|
+
readonly type: string;
|
|
124
|
+
readonly capabilities: readonly CapabilityIdentifier[];
|
|
125
|
+
readonly profiles: readonly WorkerProfileRef[];
|
|
126
|
+
readonly maxConcurrency?: number;
|
|
127
|
+
}
|
|
128
|
+
interface WorkerHostDescriptor {
|
|
129
|
+
readonly id: string;
|
|
130
|
+
readonly protocolVersion: 1;
|
|
131
|
+
readonly workers: readonly WorkerDescriptor[];
|
|
132
|
+
}
|
|
133
|
+
/** Logical runtime capable of executing one or more Worker Profiles. */
|
|
134
|
+
interface Worker {
|
|
135
|
+
describe(): Promise<WorkerDescriptor>;
|
|
136
|
+
execute(spec: TaskAttemptSpec, signal?: AbortSignal): AsyncIterable<TaskAttemptEvent>;
|
|
137
|
+
}
|
|
138
|
+
/** Persistent process/node boundary consumed by Gateway transports. */
|
|
139
|
+
interface WorkerHost {
|
|
140
|
+
readonly id: string;
|
|
141
|
+
describe(): Promise<WorkerHostDescriptor>;
|
|
142
|
+
execute(spec: TaskAttemptSpec, signal?: AbortSignal): AsyncIterable<TaskAttemptEvent>;
|
|
143
|
+
}
|
|
144
|
+
interface ProviderConfiguration {
|
|
145
|
+
readonly provider: string;
|
|
146
|
+
readonly configuration?: JsonRecord;
|
|
147
|
+
}
|
|
148
|
+
type EnvironmentLifetime = {
|
|
149
|
+
readonly scope: "attempt";
|
|
150
|
+
} | {
|
|
151
|
+
readonly scope: "session";
|
|
152
|
+
readonly idleTimeoutSeconds: number;
|
|
153
|
+
} | {
|
|
154
|
+
readonly scope: "host";
|
|
155
|
+
};
|
|
156
|
+
interface WorkerProfile {
|
|
157
|
+
readonly ref: WorkerProfileRef;
|
|
158
|
+
readonly workerType: string;
|
|
159
|
+
readonly harness: ProviderConfiguration;
|
|
160
|
+
readonly execution: ProviderConfiguration & {
|
|
161
|
+
readonly lifetime: EnvironmentLifetime;
|
|
162
|
+
};
|
|
163
|
+
/** Trusted, non-secret policy instructions supplied by this immutable profile. */
|
|
164
|
+
readonly instructions?: readonly InstructionContribution[];
|
|
165
|
+
readonly limits?: {
|
|
166
|
+
readonly timeoutMs?: number;
|
|
167
|
+
readonly cpu?: number;
|
|
168
|
+
readonly memoryMb?: number;
|
|
169
|
+
readonly diskMb?: number;
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
interface ExecutionContributionBase {
|
|
173
|
+
readonly id: string;
|
|
174
|
+
readonly required: boolean;
|
|
175
|
+
readonly sourceItemKey?: string;
|
|
176
|
+
}
|
|
177
|
+
type ExecutionContribution = (ExecutionContributionBase & {
|
|
178
|
+
readonly kind: "instruction";
|
|
179
|
+
readonly content: string;
|
|
180
|
+
readonly scope: "task" | "workspace" | "project";
|
|
181
|
+
readonly priority: number;
|
|
182
|
+
}) | (ExecutionContributionBase & {
|
|
183
|
+
readonly kind: "skill";
|
|
184
|
+
readonly source: ResourceRef;
|
|
185
|
+
}) | (ExecutionContributionBase & {
|
|
186
|
+
readonly kind: "tool";
|
|
187
|
+
readonly transport: "mcp-stdio" | "mcp-http" | "native";
|
|
188
|
+
readonly configuration: JsonRecord;
|
|
189
|
+
readonly secretRefs?: readonly string[];
|
|
190
|
+
/**
|
|
191
|
+
* Attempt-scoped values resolved by the Worker Host. They are never part
|
|
192
|
+
* of a Permission Set, Task authorization snapshot, or materialization manifest.
|
|
193
|
+
*/
|
|
194
|
+
readonly runtimeEnvironment?: Readonly<Record<string, string>>;
|
|
195
|
+
readonly runtimeHeaders?: Readonly<Record<string, string>>;
|
|
196
|
+
}) | (ExecutionContributionBase & {
|
|
197
|
+
readonly kind: "workspace";
|
|
198
|
+
readonly source: ResourceRef;
|
|
199
|
+
readonly mountPath?: string;
|
|
200
|
+
readonly readOnly: boolean;
|
|
201
|
+
}) | (ExecutionContributionBase & {
|
|
202
|
+
readonly kind: "resource";
|
|
203
|
+
readonly source: ResourceRef;
|
|
204
|
+
}) | (ExecutionContributionBase & {
|
|
205
|
+
readonly kind: "work-context";
|
|
206
|
+
readonly content: string;
|
|
207
|
+
readonly source: ResourceRef;
|
|
208
|
+
readonly trust: "untrusted-history";
|
|
209
|
+
}) | (ExecutionContributionBase & {
|
|
210
|
+
readonly kind: "secret";
|
|
211
|
+
readonly secretRef: string;
|
|
212
|
+
readonly target: string;
|
|
213
|
+
}) | (ExecutionContributionBase & {
|
|
214
|
+
readonly kind: "checkpoint";
|
|
215
|
+
readonly checkpoint: CheckpointRef;
|
|
216
|
+
}) | (ExecutionContributionBase & {
|
|
217
|
+
readonly kind: "harness-specific";
|
|
218
|
+
readonly harness: string;
|
|
219
|
+
readonly schemaVersion: number;
|
|
220
|
+
readonly configuration: JsonRecord;
|
|
221
|
+
});
|
|
222
|
+
type InstructionContribution = Extract<ExecutionContribution, {
|
|
223
|
+
readonly kind: "instruction";
|
|
224
|
+
}>;
|
|
225
|
+
type SkillContribution = Extract<ExecutionContribution, {
|
|
226
|
+
readonly kind: "skill";
|
|
227
|
+
}>;
|
|
228
|
+
type WorkspaceContribution = Extract<ExecutionContribution, {
|
|
229
|
+
readonly kind: "workspace";
|
|
230
|
+
}>;
|
|
231
|
+
type WorkContextContribution = Extract<ExecutionContribution, {
|
|
232
|
+
readonly kind: "work-context";
|
|
233
|
+
}>;
|
|
234
|
+
type ResourceContribution = Extract<ExecutionContribution, {
|
|
235
|
+
readonly kind: "resource";
|
|
236
|
+
}>;
|
|
237
|
+
type SecretContribution = Extract<ExecutionContribution, {
|
|
238
|
+
readonly kind: "secret";
|
|
239
|
+
}>;
|
|
240
|
+
type CheckpointContribution = Extract<ExecutionContribution, {
|
|
241
|
+
readonly kind: "checkpoint";
|
|
242
|
+
}>;
|
|
243
|
+
type HarnessSpecificContribution = Extract<ExecutionContribution, {
|
|
244
|
+
readonly kind: "harness-specific";
|
|
245
|
+
}>;
|
|
246
|
+
type ContextInputContribution = InstructionContribution | SkillContribution | WorkContextContribution | ResourceContribution;
|
|
247
|
+
type WorkspaceMaterialization = InstructionContribution | WorkspaceContribution;
|
|
248
|
+
interface ResolvedSkillPackage {
|
|
249
|
+
readonly contributionId: string;
|
|
250
|
+
readonly name: string;
|
|
251
|
+
readonly source: ResourceRef;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Resolves portable Skill contributions into individual, read-only Skill directories.
|
|
255
|
+
* Harnesses still decide where and how those directories are projected.
|
|
256
|
+
*/
|
|
257
|
+
declare function resolveSkillPackages(contributions: readonly SkillContribution[]): Promise<readonly ResolvedSkillPackage[]>;
|
|
258
|
+
interface MaterializationContext {
|
|
259
|
+
readonly task: TaskAttemptSpec;
|
|
260
|
+
readonly profile: WorkerProfile;
|
|
261
|
+
}
|
|
262
|
+
interface ContextMaterializer<TItem extends TagContextPlanItem = TagContextPlanItem> {
|
|
263
|
+
supports(item: TagContextPlanItem): item is TItem;
|
|
264
|
+
materialize(item: TItem, context: MaterializationContext): Promise<ContextInputContribution | readonly ContextInputContribution[] | undefined>;
|
|
265
|
+
}
|
|
266
|
+
declare class ContextMaterializerRegistry {
|
|
267
|
+
#private;
|
|
268
|
+
constructor(materializers: readonly ContextMaterializer[]);
|
|
269
|
+
materialize(context: MaterializationContext): Promise<readonly ExecutionContribution[]>;
|
|
270
|
+
}
|
|
271
|
+
type WorkSelectionPlanItem = Extract<TagContextPlanItem, {
|
|
272
|
+
readonly kind: "work";
|
|
273
|
+
}>;
|
|
274
|
+
/** Materializes Gateway-admitted cross-Session Work Records without store access. */
|
|
275
|
+
declare class WorkRecordMaterializer implements ContextMaterializer<WorkSelectionPlanItem> {
|
|
276
|
+
supports(item: TagContextPlanItem): item is WorkSelectionPlanItem;
|
|
277
|
+
materialize(item: WorkSelectionPlanItem): Promise<ContextInputContribution | undefined>;
|
|
278
|
+
}
|
|
279
|
+
type SkillContextPlanItem = Extract<TagContextPlanItem, {
|
|
280
|
+
readonly kind: "skill";
|
|
281
|
+
}>;
|
|
282
|
+
interface FileSkillCatalogEntry {
|
|
283
|
+
/** Opaque Context Item reference used by the Gateway and CLI. */
|
|
284
|
+
readonly id: string;
|
|
285
|
+
/** Absolute path or path relative to the catalog file. */
|
|
286
|
+
readonly path: string;
|
|
287
|
+
readonly version?: string;
|
|
288
|
+
}
|
|
289
|
+
interface FileSkillCatalog {
|
|
290
|
+
readonly version: 1;
|
|
291
|
+
readonly skills: readonly FileSkillCatalogEntry[];
|
|
292
|
+
}
|
|
293
|
+
interface FileSkillMaterializerOptions {
|
|
294
|
+
readonly catalogPath: string;
|
|
295
|
+
readonly maxFiles?: number;
|
|
296
|
+
readonly maxBytes?: number;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Resolves Skill references through an explicit Worker-local allowlist.
|
|
300
|
+
* The Gateway never receives Skill paths or contents, and a Skill never
|
|
301
|
+
* gains connector authority merely because it was selected by a Context Set.
|
|
302
|
+
*/
|
|
303
|
+
declare class FileSkillMaterializer implements ContextMaterializer<SkillContextPlanItem> {
|
|
304
|
+
#private;
|
|
305
|
+
private constructor();
|
|
306
|
+
static load(options: FileSkillMaterializerOptions): Promise<FileSkillMaterializer>;
|
|
307
|
+
supports(item: TagContextPlanItem): item is SkillContextPlanItem;
|
|
308
|
+
materialize(item: SkillContextPlanItem): Promise<ContextInputContribution>;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Resolves an operational target from the admitted request and its authorization
|
|
312
|
+
* snapshot. Unlike a Context Materializer, this does not read Context Sets:
|
|
313
|
+
* it is the extension seam for resources such as a named repository.
|
|
314
|
+
*/
|
|
315
|
+
interface WorkspaceMaterializer {
|
|
316
|
+
materialize(context: MaterializationContext): Promise<WorkspaceMaterialization | readonly WorkspaceMaterialization[] | undefined>;
|
|
317
|
+
}
|
|
318
|
+
declare class WorkspaceMaterializerRegistry {
|
|
319
|
+
#private;
|
|
320
|
+
constructor(materializers: readonly WorkspaceMaterializer[]);
|
|
321
|
+
materialize(context: MaterializationContext): Promise<readonly ExecutionContribution[]>;
|
|
322
|
+
}
|
|
323
|
+
type ToolContribution = Extract<ExecutionContribution, {
|
|
324
|
+
readonly kind: "tool";
|
|
325
|
+
}>;
|
|
326
|
+
/** A Worker-local set of tools derived from one provider's admitted permissions. */
|
|
327
|
+
interface ToolBundle {
|
|
328
|
+
readonly provider: string;
|
|
329
|
+
readonly contributions: readonly ToolContribution[];
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Converts a captured authorization snapshot into tools for one Task Attempt.
|
|
333
|
+
* Implementations resolve credentials on the Worker Host, never through the Gateway.
|
|
334
|
+
*/
|
|
335
|
+
interface ToolProvisioner {
|
|
336
|
+
readonly provider: string;
|
|
337
|
+
provision(context: MaterializationContext): Promise<ToolBundle | undefined>;
|
|
338
|
+
}
|
|
339
|
+
declare class ToolProvisionerRegistry {
|
|
340
|
+
#private;
|
|
341
|
+
constructor(provisioners: readonly ToolProvisioner[]);
|
|
342
|
+
provision(context: MaterializationContext): Promise<readonly ToolContribution[]>;
|
|
343
|
+
}
|
|
344
|
+
interface McpStdioToolConfiguration {
|
|
345
|
+
readonly transport: "mcp-stdio";
|
|
346
|
+
readonly serverName: string;
|
|
347
|
+
readonly command: string;
|
|
348
|
+
readonly args: readonly string[];
|
|
349
|
+
readonly toolNames: readonly string[];
|
|
350
|
+
}
|
|
351
|
+
interface McpHttpToolConfiguration {
|
|
352
|
+
readonly transport: "mcp-http";
|
|
353
|
+
readonly serverName: string;
|
|
354
|
+
readonly url: string;
|
|
355
|
+
readonly toolNames: readonly string[];
|
|
356
|
+
}
|
|
357
|
+
type McpToolConfiguration = McpStdioToolConfiguration | McpHttpToolConfiguration;
|
|
358
|
+
/** Validates the portable MCP stdio contract before a harness projects it. */
|
|
359
|
+
declare function readMcpToolConfiguration(contribution: ToolContribution): McpToolConfiguration;
|
|
360
|
+
interface StagedFile {
|
|
361
|
+
readonly path: string;
|
|
362
|
+
readonly content: string | Uint8Array;
|
|
363
|
+
readonly mode?: number;
|
|
364
|
+
}
|
|
365
|
+
interface MountSpec {
|
|
366
|
+
readonly source: ResourceRef;
|
|
367
|
+
readonly destination: string;
|
|
368
|
+
readonly readOnly: boolean;
|
|
369
|
+
}
|
|
370
|
+
interface SecretBinding {
|
|
371
|
+
readonly secretRef: string;
|
|
372
|
+
readonly target: string;
|
|
373
|
+
}
|
|
374
|
+
interface ProcessSpec {
|
|
375
|
+
readonly command: string;
|
|
376
|
+
readonly args?: readonly string[];
|
|
377
|
+
readonly cwd?: string;
|
|
378
|
+
readonly environment?: Readonly<Record<string, string>>;
|
|
379
|
+
readonly stdin?: string;
|
|
380
|
+
readonly timeoutMs?: number;
|
|
381
|
+
}
|
|
382
|
+
interface ProcessResult {
|
|
383
|
+
readonly exitCode: number | null;
|
|
384
|
+
readonly signal?: NodeJS.Signals;
|
|
385
|
+
readonly stdout: string;
|
|
386
|
+
readonly stderr: string;
|
|
387
|
+
}
|
|
388
|
+
interface ProcessHandle {
|
|
389
|
+
readonly pid?: number;
|
|
390
|
+
wait(): Promise<ProcessResult>;
|
|
391
|
+
kill(signal?: NodeJS.Signals): void;
|
|
392
|
+
}
|
|
393
|
+
interface HarnessPlan {
|
|
394
|
+
readonly files: readonly StagedFile[];
|
|
395
|
+
readonly mounts: readonly MountSpec[];
|
|
396
|
+
readonly environmentVariables: Readonly<Record<string, string>>;
|
|
397
|
+
readonly secretBindings: readonly SecretBinding[];
|
|
398
|
+
readonly network: {
|
|
399
|
+
readonly mode: "none" | "allowlist" | "unrestricted";
|
|
400
|
+
readonly allowedHosts?: readonly string[];
|
|
401
|
+
};
|
|
402
|
+
readonly metadata?: JsonRecord;
|
|
403
|
+
}
|
|
404
|
+
interface ExecutionEnvironmentSpec {
|
|
405
|
+
readonly task: TaskAttemptSpec;
|
|
406
|
+
readonly profile: WorkerProfile;
|
|
407
|
+
readonly plan: HarnessPlan;
|
|
408
|
+
}
|
|
409
|
+
interface ExecutionEnvironment {
|
|
410
|
+
readonly id: string;
|
|
411
|
+
readonly placement: "local" | "remote" | "managed";
|
|
412
|
+
readonly rootDirectory: string;
|
|
413
|
+
prepare(plan: HarnessPlan): Promise<void>;
|
|
414
|
+
resolvePath(path: string): string;
|
|
415
|
+
read(path: string): Promise<string>;
|
|
416
|
+
spawn(process: ProcessSpec, signal?: AbortSignal): Promise<ProcessHandle>;
|
|
417
|
+
checkpoint?(): Promise<CheckpointRef>;
|
|
418
|
+
dispose(reason: "completed" | "failed" | "cancelled"): Promise<void>;
|
|
419
|
+
}
|
|
420
|
+
interface ExecutionEnvironmentProvider {
|
|
421
|
+
readonly id: string;
|
|
422
|
+
readonly capabilities: readonly CapabilityIdentifier[];
|
|
423
|
+
provision(spec: ExecutionEnvironmentSpec, signal?: AbortSignal): Promise<ExecutionEnvironment>;
|
|
424
|
+
}
|
|
425
|
+
interface HarnessCapabilities {
|
|
426
|
+
readonly id: string;
|
|
427
|
+
readonly version: string;
|
|
428
|
+
readonly contributionKinds: readonly ExecutionContribution["kind"][];
|
|
429
|
+
readonly streaming: boolean;
|
|
430
|
+
readonly cancellation: boolean;
|
|
431
|
+
readonly checkpointing: "none" | "native" | "filesystem";
|
|
432
|
+
/** Placements this Harness can currently drive without weakening its execution model. */
|
|
433
|
+
readonly executionPlacements?: readonly ExecutionEnvironment["placement"][];
|
|
434
|
+
readonly requiresPty?: boolean;
|
|
435
|
+
}
|
|
436
|
+
type SessionReplayContribution = Extract<ExecutionContribution, {
|
|
437
|
+
readonly kind: "work-context";
|
|
438
|
+
}>;
|
|
439
|
+
interface HarnessContinuity {
|
|
440
|
+
readonly sessionId: string;
|
|
441
|
+
readonly priorCheckpoint?: CheckpointRef;
|
|
442
|
+
readonly replayContribution?: SessionReplayContribution;
|
|
443
|
+
}
|
|
444
|
+
interface StoredHarnessCheckpoint {
|
|
445
|
+
readonly ref: CheckpointRef;
|
|
446
|
+
readonly harnessId: string;
|
|
447
|
+
readonly data: JsonRecord;
|
|
448
|
+
}
|
|
449
|
+
/** Worker-owned storage for opaque, harness-native continuity metadata. */
|
|
450
|
+
interface CheckpointStore {
|
|
451
|
+
load(ref: CheckpointRef): Promise<StoredHarnessCheckpoint | undefined>;
|
|
452
|
+
save(checkpoint: StoredHarnessCheckpoint): Promise<void>;
|
|
453
|
+
delete?(ref: CheckpointRef): Promise<void>;
|
|
454
|
+
}
|
|
455
|
+
declare class InMemoryCheckpointStore implements CheckpointStore {
|
|
456
|
+
#private;
|
|
457
|
+
load(ref: CheckpointRef): Promise<StoredHarnessCheckpoint | undefined>;
|
|
458
|
+
save(checkpoint: StoredHarnessCheckpoint): Promise<void>;
|
|
459
|
+
delete(ref: CheckpointRef): Promise<void>;
|
|
460
|
+
}
|
|
461
|
+
declare class FileCheckpointStore implements CheckpointStore {
|
|
462
|
+
#private;
|
|
463
|
+
constructor(directory: string);
|
|
464
|
+
load(ref: CheckpointRef): Promise<StoredHarnessCheckpoint | undefined>;
|
|
465
|
+
save(checkpoint: StoredHarnessCheckpoint): Promise<void>;
|
|
466
|
+
delete(ref: CheckpointRef): Promise<void>;
|
|
467
|
+
}
|
|
468
|
+
/** Fully resolved, Worker-local input passed to a Harness. */
|
|
469
|
+
interface ExecutionContext {
|
|
470
|
+
readonly attempt: TaskAttemptSpec;
|
|
471
|
+
readonly profile: WorkerProfile;
|
|
472
|
+
readonly context: {
|
|
473
|
+
readonly instructions: readonly InstructionContribution[];
|
|
474
|
+
readonly skills: readonly SkillContribution[];
|
|
475
|
+
readonly priorWork: readonly WorkContextContribution[];
|
|
476
|
+
readonly resources: readonly ResourceContribution[];
|
|
477
|
+
};
|
|
478
|
+
readonly workspace?: WorkspaceContribution;
|
|
479
|
+
readonly tools: readonly ToolContribution[];
|
|
480
|
+
readonly continuity?: HarnessContinuity;
|
|
481
|
+
readonly secrets: readonly SecretContribution[];
|
|
482
|
+
readonly checkpoints: readonly CheckpointContribution[];
|
|
483
|
+
readonly extensions: readonly HarnessSpecificContribution[];
|
|
484
|
+
readonly checkpointStore: CheckpointStore;
|
|
485
|
+
}
|
|
486
|
+
/** Flattens a resolved Execution Context for generic projection and manifest helpers. */
|
|
487
|
+
declare function executionContributions(context: ExecutionContext): readonly ExecutionContribution[];
|
|
488
|
+
type HarnessContinuityResolution = {
|
|
489
|
+
readonly mode: "fresh";
|
|
490
|
+
readonly sessionId?: string;
|
|
491
|
+
} | {
|
|
492
|
+
readonly mode: "resume";
|
|
493
|
+
readonly sessionId: string;
|
|
494
|
+
readonly checkpoint: CheckpointRef;
|
|
495
|
+
/** Available if native resume fails after compile-time compatibility checks. */
|
|
496
|
+
readonly replayContribution?: SessionReplayContribution;
|
|
497
|
+
} | {
|
|
498
|
+
readonly mode: "replay";
|
|
499
|
+
readonly sessionId: string;
|
|
500
|
+
readonly replayContribution: SessionReplayContribution;
|
|
501
|
+
};
|
|
502
|
+
/**
|
|
503
|
+
* Resolves a Harness's checkpoint-format decision without discarding the
|
|
504
|
+
* canonical Session replay contribution.
|
|
505
|
+
*/
|
|
506
|
+
declare function resolveHarnessContinuity(continuity: HarnessContinuity | undefined, acceptsCheckpoint: (checkpoint: CheckpointRef) => boolean): HarnessContinuityResolution;
|
|
507
|
+
type HarnessEvent = {
|
|
508
|
+
readonly type: "output.delta";
|
|
509
|
+
readonly text: string;
|
|
510
|
+
} | {
|
|
511
|
+
readonly type: "output.message";
|
|
512
|
+
readonly text: string;
|
|
513
|
+
} | {
|
|
514
|
+
readonly type: "result";
|
|
515
|
+
readonly result: TaskResult;
|
|
516
|
+
} | {
|
|
517
|
+
readonly type: "artifact.created";
|
|
518
|
+
readonly artifact: ArtifactRef;
|
|
519
|
+
} | {
|
|
520
|
+
readonly type: "checkpoint.created";
|
|
521
|
+
readonly checkpoint: CheckpointRef;
|
|
522
|
+
} | {
|
|
523
|
+
readonly type: "approval.requested";
|
|
524
|
+
readonly request: {
|
|
525
|
+
readonly id: string;
|
|
526
|
+
readonly description: string;
|
|
527
|
+
readonly data?: JsonRecord;
|
|
528
|
+
};
|
|
529
|
+
};
|
|
530
|
+
interface HarnessExecution {
|
|
531
|
+
run(signal?: AbortSignal): AsyncIterable<HarnessEvent>;
|
|
532
|
+
/** Called only after `run` finishes successfully; the result is promoted via `checkpoint.created`. */
|
|
533
|
+
checkpoint?(): Promise<CheckpointRef | undefined>;
|
|
534
|
+
close(): Promise<void>;
|
|
535
|
+
}
|
|
536
|
+
interface Harness {
|
|
537
|
+
readonly id: string;
|
|
538
|
+
describe(): Promise<HarnessCapabilities>;
|
|
539
|
+
plan(context: ExecutionContext): Promise<HarnessPlan>;
|
|
540
|
+
start(plan: HarnessPlan, environment: ExecutionEnvironment, context: ExecutionContext): Promise<HarnessExecution>;
|
|
541
|
+
}
|
|
542
|
+
interface MaterializedContribution {
|
|
543
|
+
readonly id: string;
|
|
544
|
+
readonly kind: ExecutionContribution["kind"];
|
|
545
|
+
readonly sourceItemKey?: string;
|
|
546
|
+
readonly resource?: {
|
|
547
|
+
readonly mediaType?: string;
|
|
548
|
+
readonly digest?: string;
|
|
549
|
+
readonly provenance?: JsonRecord;
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
interface OmittedContribution extends MaterializedContribution {
|
|
553
|
+
readonly reason: string;
|
|
554
|
+
}
|
|
555
|
+
interface MaterializationManifest {
|
|
556
|
+
readonly workerProfile: WorkerProfileRef;
|
|
557
|
+
readonly harness: {
|
|
558
|
+
readonly id: string;
|
|
559
|
+
readonly version: string;
|
|
560
|
+
};
|
|
561
|
+
readonly environment: {
|
|
562
|
+
readonly provider: string;
|
|
563
|
+
readonly placement: "local" | "remote" | "managed";
|
|
564
|
+
};
|
|
565
|
+
readonly contributions: readonly MaterializedContribution[];
|
|
566
|
+
readonly omitted: readonly OmittedContribution[];
|
|
567
|
+
}
|
|
568
|
+
interface WorkerRuntimeOptions {
|
|
569
|
+
readonly id: string;
|
|
570
|
+
readonly profiles: readonly WorkerProfile[];
|
|
571
|
+
readonly harnesses: readonly Harness[];
|
|
572
|
+
readonly environments: readonly ExecutionEnvironmentProvider[];
|
|
573
|
+
readonly contextMaterializers?: ContextMaterializerRegistry;
|
|
574
|
+
readonly workspaceMaterializers?: WorkspaceMaterializerRegistry;
|
|
575
|
+
readonly toolProvisioners?: ToolProvisionerRegistry;
|
|
576
|
+
readonly checkpointStore?: CheckpointStore;
|
|
577
|
+
readonly maxConcurrency?: number;
|
|
578
|
+
}
|
|
579
|
+
/** Common policy-aware lifecycle used by shipped and third-party Harness implementations. */
|
|
580
|
+
declare class WorkerRuntime implements Worker {
|
|
581
|
+
#private;
|
|
582
|
+
constructor(options: WorkerRuntimeOptions);
|
|
583
|
+
describe(): Promise<WorkerDescriptor>;
|
|
584
|
+
execute(spec: TaskAttemptSpec, signal?: AbortSignal): AsyncIterable<TaskAttemptEvent>;
|
|
585
|
+
}
|
|
586
|
+
declare class LocalWorkerHost implements WorkerHost {
|
|
587
|
+
#private;
|
|
588
|
+
readonly id: string;
|
|
589
|
+
constructor(id: string, workers: readonly Worker[]);
|
|
590
|
+
describe(): Promise<WorkerHostDescriptor>;
|
|
591
|
+
execute(spec: TaskAttemptSpec, signal?: AbortSignal): AsyncIterable<TaskAttemptEvent>;
|
|
592
|
+
}
|
|
593
|
+
interface StaticWorkerOptions {
|
|
594
|
+
readonly id?: string;
|
|
595
|
+
readonly profile?: WorkerProfileRef;
|
|
596
|
+
readonly text?: string;
|
|
597
|
+
}
|
|
598
|
+
declare class StaticWorker implements Worker {
|
|
599
|
+
#private;
|
|
600
|
+
constructor(options?: StaticWorkerOptions);
|
|
601
|
+
describe(): Promise<WorkerDescriptor>;
|
|
602
|
+
execute(spec: TaskAttemptSpec): AsyncIterable<TaskAttemptEvent>;
|
|
603
|
+
}
|
|
604
|
+
interface LocalProcessEnvironmentProviderOptions {
|
|
605
|
+
readonly temporaryDirectory?: string;
|
|
606
|
+
readonly inheritedEnvironment?: Readonly<Record<string, string | undefined>>;
|
|
607
|
+
readonly maxOutputCharacters?: number;
|
|
608
|
+
}
|
|
609
|
+
declare class LocalProcessEnvironmentProvider implements ExecutionEnvironmentProvider {
|
|
610
|
+
#private;
|
|
611
|
+
readonly id = "local-process";
|
|
612
|
+
readonly capabilities: CapabilityIdentifier[];
|
|
613
|
+
constructor(options?: LocalProcessEnvironmentProviderOptions);
|
|
614
|
+
provision(spec: ExecutionEnvironmentSpec): Promise<ExecutionEnvironment>;
|
|
615
|
+
}
|
|
616
|
+
declare function collectTaskAttemptEvents(events: AsyncIterable<TaskAttemptEvent>): Promise<readonly TaskAttemptEvent[]>;
|
|
617
|
+
declare function terminalOutputText(events: readonly TaskAttemptEvent[]): string;
|
|
618
|
+
declare function terminalTaskResult(events: readonly TaskAttemptEvent[]): TaskResult;
|
|
619
|
+
declare function defaultTaskResult(summary: string): TaskResult;
|
|
620
|
+
declare function executeToTerminalOutput(worker: Worker | WorkerHost, spec: TaskAttemptSpec, signal?: AbortSignal): Promise<string>;
|
|
621
|
+
declare function isTagActionAllowed(task: TaskAttemptSpec, input: {
|
|
622
|
+
readonly connectorAccountId: string;
|
|
623
|
+
readonly scope: string;
|
|
624
|
+
readonly action: string;
|
|
625
|
+
}): boolean;
|
|
626
|
+
declare function assertTagActionAllowed(task: TaskAttemptSpec, input: {
|
|
627
|
+
readonly connectorAccountId: string;
|
|
628
|
+
readonly scope: string;
|
|
629
|
+
readonly action: string;
|
|
630
|
+
}): void;
|
|
631
|
+
declare function isTagContextItemEligible(task: TaskAttemptSpec, itemKey: string): boolean;
|
|
632
|
+
declare function assertTagContextItemEligible(task: TaskAttemptSpec, itemKey: string): void;
|
|
633
|
+
|
|
634
|
+
export { type ArtifactRef, type CapabilityIdentifier, type CheckpointContribution, type CheckpointRef, type CheckpointStore, type ContextInputContribution, type ContextMaterializer, ContextMaterializerRegistry, type EnvironmentLifetime, type ExecutionContext, type ExecutionContribution, type ExecutionEnvironment, type ExecutionEnvironmentProvider, type ExecutionEnvironmentSpec, FileCheckpointStore, type FileSkillCatalog, type FileSkillCatalogEntry, FileSkillMaterializer, type FileSkillMaterializerOptions, type Harness, type HarnessCapabilities, type HarnessContinuity, type HarnessContinuityResolution, type HarnessEvent, type HarnessExecution, type HarnessPlan, type HarnessSpecificContribution, InMemoryCheckpointStore, type InstructionContribution, LOCAL_PROCESS_CAPABILITY, LocalProcessEnvironmentProvider, type LocalProcessEnvironmentProviderOptions, LocalWorkerHost, type MaterializationContext, type MaterializationManifest, type MaterializedContribution, type McpHttpToolConfiguration, type McpStdioToolConfiguration, type McpToolConfiguration, type MountSpec, type OmittedContribution, type ProcessHandle, type ProcessResult, type ProcessSpec, type ProviderConfiguration, type ResolvedSkillPackage, type ResourceContribution, type ResourceRef, type SecretBinding, type SecretContribution, type SessionReplayContribution, type SkillContribution, type StagedFile, StaticWorker, type StaticWorkerOptions, type StoredHarnessCheckpoint, TASK_ATTEMPT_CANCELLATION_CAPABILITY, TASK_ATTEMPT_EVENT_STREAM_CAPABILITY, type TaskAttemptEvent, type TaskAttemptSessionContext, type TaskAttemptSpec, type TaskInput, type TaskMessage, type TaskOrigin, type TaskResult, type ToolBundle, type ToolContribution, type ToolProvisioner, ToolProvisionerRegistry, type WorkContextContribution, WorkRecordMaterializer, type Worker, type WorkerDescriptor, type WorkerHost, type WorkerHostDescriptor, type WorkerProfile, type WorkerProfileRef, WorkerRuntime, type WorkerRuntimeOptions, type WorkspaceContribution, type WorkspaceMaterialization, type WorkspaceMaterializer, WorkspaceMaterializerRegistry, assertTagActionAllowed, assertTagContextItemEligible, collectTaskAttemptEvents, defaultTaskResult, executeToTerminalOutput, executionContributions, isTagActionAllowed, isTagContextItemEligible, readMcpToolConfiguration, resolveHarnessContinuity, resolveSkillPackages, terminalOutputText, terminalTaskResult };
|
package/dist/worker.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { ContextMaterializerRegistry, FileCheckpointStore, FileSkillMaterializer, InMemoryCheckpointStore, LOCAL_PROCESS_CAPABILITY, LocalProcessEnvironmentProvider, LocalWorkerHost, StaticWorker, TASK_ATTEMPT_CANCELLATION_CAPABILITY, TASK_ATTEMPT_EVENT_STREAM_CAPABILITY, ToolProvisionerRegistry, WorkRecordMaterializer, WorkerRuntime, WorkspaceMaterializerRegistry, assertTagActionAllowed, assertTagContextItemEligible, collectTaskAttemptEvents, defaultTaskResult, executeToTerminalOutput, executionContributions, isTagActionAllowed, isTagContextItemEligible, readMcpToolConfiguration, resolveHarnessContinuity, resolveSkillPackages, terminalOutputText, terminalTaskResult } from './chunk-ES42FTPC.js';
|
|
2
|
+
//# sourceMappingURL=worker.js.map
|
|
3
|
+
//# sourceMappingURL=worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"worker.js"}
|