@themoltnet/pi-extension 0.9.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +35 -1
  2. package/dist/index.js +3840 -132
  3. 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
- /** Forwarded to `buildPromptForTask` for per-type builders. */
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 {