@themoltnet/pi-extension 0.8.0 → 0.10.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/dist/index.d.ts +57 -1
- package/dist/index.js +3934 -155
- package/package.json +6 -7
package/dist/index.d.ts
CHANGED
|
@@ -94,7 +94,14 @@ export declare interface ExecutePiTaskOptions {
|
|
|
94
94
|
extraAllowedHosts?: string[];
|
|
95
95
|
/** Sandbox overrides (env, VFS shadows, resources). */
|
|
96
96
|
sandboxConfig?: SandboxConfig;
|
|
97
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* Forwarded to `buildPromptForTask` for per-type builders. Static
|
|
99
|
+
* across tasks. Today no built-in builder needs per-task `extras` —
|
|
100
|
+
* judges fetch their own dependent data via MoltNet tools
|
|
101
|
+
* (`moltnet_get_task`, `moltnet_list_task_attempts`, etc.) at run
|
|
102
|
+
* time, which keeps this layer task-type-agnostic. Field is kept
|
|
103
|
+
* for forward compat with custom prompt builders that might want it.
|
|
104
|
+
*/
|
|
98
105
|
promptExtras?: Record<string, unknown>;
|
|
99
106
|
/** Snapshot progress callback; defaults to stderr logging. */
|
|
100
107
|
onSnapshotProgress?: (message: string) => void;
|
|
@@ -133,6 +140,26 @@ declare type MoltNetAgent = Awaited<ReturnType<typeof connect>>;
|
|
|
133
140
|
declare function moltnetExtension(pi: ExtensionAPI): void;
|
|
134
141
|
export default moltnetExtension;
|
|
135
142
|
|
|
143
|
+
/**
|
|
144
|
+
* Active-task context. When present, `moltnet_create_entry` is forced to
|
|
145
|
+
* land entries in `diaryId` (the task diary), regardless of the env-derived
|
|
146
|
+
* diary, and auto-injects provenance tags (`task:<id>`, `task_type:<type>`,
|
|
147
|
+
* `task_attempt:<n>`, and `correlation:<id>` when the task carries one).
|
|
148
|
+
* See issue #979.
|
|
149
|
+
*/
|
|
150
|
+
declare interface MoltNetTaskContext {
|
|
151
|
+
taskId: string;
|
|
152
|
+
taskType: string;
|
|
153
|
+
attemptN: number;
|
|
154
|
+
diaryId: string;
|
|
155
|
+
/**
|
|
156
|
+
* Optional correlation id. When set, propagated as a `correlation:<id>`
|
|
157
|
+
* provenance tag so all entries from a multi-task workflow can be
|
|
158
|
+
* grouped without enumerating individual task ids.
|
|
159
|
+
*/
|
|
160
|
+
correlationId: string | null;
|
|
161
|
+
}
|
|
162
|
+
|
|
136
163
|
declare interface MoltNetToolsConfig {
|
|
137
164
|
getAgent(): MoltNetAgent | null;
|
|
138
165
|
getDiaryId(): string | null;
|
|
@@ -148,6 +175,13 @@ declare interface MoltNetToolsConfig {
|
|
|
148
175
|
* Defaults to HOST_EXEC_DEFAULT_BASE_ENV when omitted.
|
|
149
176
|
*/
|
|
150
177
|
hostExecBaseEnv?: ReadonlySet<string>;
|
|
178
|
+
/**
|
|
179
|
+
* Active-task context, populated by the agent-daemon path. When set,
|
|
180
|
+
* `moltnet_create_entry` enforces `diaryId === taskContext.diaryId` and
|
|
181
|
+
* injects provenance tags. When absent (interactive pi-extension / TUI),
|
|
182
|
+
* entry creation behaves as before (env-derived diary, no auto-tags).
|
|
183
|
+
*/
|
|
184
|
+
getTaskContext?(): MoltNetTaskContext | null;
|
|
151
185
|
}
|
|
152
186
|
|
|
153
187
|
declare interface PiJudgeRecipeCid {
|
|
@@ -281,6 +315,8 @@ declare const Task: TObject< {
|
|
|
281
315
|
cancelledByHumanId: TUnion<[TString, TNull]>;
|
|
282
316
|
cancelReason: TUnion<[TString, TNull]>;
|
|
283
317
|
maxAttempts: TNumber;
|
|
318
|
+
dispatchTimeoutSec: TUnion<[TInteger, TNull]>;
|
|
319
|
+
runningTimeoutSec: TUnion<[TInteger, TNull]>;
|
|
284
320
|
}>;
|
|
285
321
|
|
|
286
322
|
declare type Task = Static<typeof Task>;
|
|
@@ -364,6 +400,26 @@ declare interface TaskReporter {
|
|
|
364
400
|
finalize(usage: TaskUsage): Promise<void>;
|
|
365
401
|
/** Flush buffers + release resources. Called once. Idempotent. */
|
|
366
402
|
close(): Promise<void>;
|
|
403
|
+
/**
|
|
404
|
+
* Signal that aborts when the task is cancelled by the imposer (or a
|
|
405
|
+
* diary writer) while the executor is running. `ApiTaskReporter`
|
|
406
|
+
* aborts this on the next heartbeat that observes `cancelled: true`
|
|
407
|
+
* in the response (#938). Local reporters (`StdoutReporter`,
|
|
408
|
+
* `JsonlTaskReporter`) never abort — there's no remote cancel
|
|
409
|
+
* channel for `FileTaskSource`.
|
|
410
|
+
*
|
|
411
|
+
* Executors should pass this signal into long-running work
|
|
412
|
+
* (LLM calls, sandbox execution, file ops) and surface a
|
|
413
|
+
* `status: 'cancelled'` output when it fires. The runtime also
|
|
414
|
+
* checks the signal post-execute and converts any output to
|
|
415
|
+
* `cancelled` if the executor returned without honoring it.
|
|
416
|
+
*/
|
|
417
|
+
readonly cancelSignal: AbortSignal;
|
|
418
|
+
/**
|
|
419
|
+
* The reason supplied to `/tasks/:id/cancel` by the canceller, if
|
|
420
|
+
* cancellation has been observed. Null until `cancelSignal` aborts.
|
|
421
|
+
*/
|
|
422
|
+
readonly cancelReason: string | null;
|
|
367
423
|
}
|
|
368
424
|
|
|
369
425
|
/**
|