@zixt/host 0.0.17 → 0.0.18

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 (2) hide show
  1. package/dist/index.js +28 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ import { homedir } from "node:os";
31
31
  // package.json
32
32
  var package_default = {
33
33
  name: "@zixt/host",
34
- version: "0.0.17",
34
+ version: "0.0.18",
35
35
  type: "module",
36
36
  exports: {
37
37
  ".": "./src/client.ts",
@@ -17964,9 +17964,17 @@ var TaskAssign = external_exports.object({
17964
17964
  /** True on continuation runs — the runner resumes instead of starting fresh. */
17965
17965
  resume: external_exports.boolean().optional(),
17966
17966
  /**
17967
- * The Task still carries its derived first-message name and wants an
17968
- * AI-minted one (TS-12). The host answers with one `task.title` frame;
17969
- * absence (older host, demo runner) simply keeps the derived name.
17967
+ * Cloud-authored, trust-preserving copy of the opening request. A Host
17968
+ * uses it only when a continuation cannot resume the local CLI session
17969
+ * and must start a new one (Machine loss, runner switch, or missing local
17970
+ * transcript). Optional for rolling upgrades and first runs.
17971
+ */
17972
+ recoveryContext: external_exports.string().max(12e4).optional(),
17973
+ /**
17974
+ * Execution epoch 1 still carries its derived first-message name and
17975
+ * wants one AI-minted replacement (TS-12). Later executions never ask to
17976
+ * rename the Task; absence (older host, demo runner) keeps the derived
17977
+ * name permanently.
17970
17978
  */
17971
17979
  titleWanted: external_exports.boolean().optional(),
17972
17980
  /** Advisory Ask / Plan / Act snapshot for this attempt (TS-12). */
@@ -33601,9 +33609,9 @@ function createCliRunner(adapter, opts = {}) {
33601
33609
  };
33602
33610
  }
33603
33611
  if (task.cancelledNow()) return cancelledBeforeRun();
33604
- const runPrompt = attachmentSection ? `${prepared.prompt}
33612
+ const promptWithAttachments = (prompt) => attachmentSection ? `${prompt}
33605
33613
 
33606
- ${attachmentSection}` : prepared.prompt;
33614
+ ${attachmentSection}` : prompt;
33607
33615
  let activeWorkingContextReport = null;
33608
33616
  let previousWorkingContext = "";
33609
33617
  const workingContextAbort = new AbortController();
@@ -33717,7 +33725,9 @@ ${attachmentSection}` : prepared.prompt;
33717
33725
  },
33718
33726
  cwd,
33719
33727
  env: runEnv,
33720
- prompt: runPrompt,
33728
+ prompt: promptWithAttachments(
33729
+ task.spec.resume && mode2 === "new" ? prepared.recoveryPrompt ?? prepared.prompt : prepared.prompt
33730
+ ),
33721
33731
  ...maxWallTimeMs === void 0 ? {} : { maxWallTimeMs },
33722
33732
  clockPaused: () => pendingAsks > 0,
33723
33733
  cancelled: task.cancelled,
@@ -33993,15 +34003,14 @@ function trustedWorkspaceSystemPrompt(existing, workspace, taskRoot) {
33993
34003
 
33994
34004
  ${guidance}` : guidance;
33995
34005
  }
33996
- function buildRunnerPrompt(task) {
33997
- if (task.spec.origin?.trust === "external") {
33998
- return `# Task: External-origin task
34006
+ function buildRunnerPrompt(task, recoverContinuation = false) {
34007
+ const current = task.spec.origin?.trust === "external" ? `# Task: External-origin task
33999
34008
 
34000
- ${task.spec.instructions}`;
34001
- }
34002
- return `# Task: ${task.spec.title}
34009
+ ${task.spec.instructions}` : `# Task: ${task.spec.title}
34003
34010
 
34004
34011
  ${task.spec.instructions}`;
34012
+ if (!recoverContinuation || !task.spec.recoveryContext) return current;
34013
+ return [task.spec.recoveryContext, "", "## Current request", "", current].join("\n");
34005
34014
  }
34006
34015
  function runnerGuardianEnv(inherited = process.env, containmentGateNonce) {
34007
34016
  const allowed = /* @__PURE__ */ new Set([
@@ -34479,6 +34488,7 @@ var claudeCodeAdapter = {
34479
34488
  ...mode === "resume" ? ["--resume", sessionId] : ["--session-id", sessionId]
34480
34489
  ],
34481
34490
  prompt: buildRunnerPrompt(input.task),
34491
+ recoveryPrompt: buildRunnerPrompt(input.task, true),
34482
34492
  createParser: (onStream) => createStreamParser(onStream, { onSessionModel: observeRuntime }),
34483
34493
  // Self-heal both directions: a crashed first run leaves a transcript
34484
34494
  // (new → conflict), a lost workspace breaks resume (resume → not
@@ -34796,11 +34806,13 @@ function createCodexAdapter(threadIndexRoot) {
34796
34806
  task.siblingTasks(),
34797
34807
  input.gitDetected
34798
34808
  );
34799
- const prompt = platformInstructions ? `<zixt_platform_instructions>
34809
+ const withPlatformInstructions = (prompt2) => platformInstructions ? `<zixt_platform_instructions>
34800
34810
  ${platformInstructions}
34801
34811
  </zixt_platform_instructions>
34802
34812
 
34803
- ${buildRunnerPrompt(task)}` : buildRunnerPrompt(task);
34813
+ ${prompt2}` : prompt2;
34814
+ const prompt = withPlatformInstructions(buildRunnerPrompt(task));
34815
+ const recoveryPrompt = withPlatformInstructions(buildRunnerPrompt(task, true));
34804
34816
  const sessionKey = task.spec.sessionKey;
34805
34817
  const indexPath = sessionKey ? threadIndexPath(threadIndexRoot, task.agentId, sessionKey) : null;
34806
34818
  const recordedThreadId = indexPath ? await readThreadId(indexPath) : null;
@@ -34820,6 +34832,7 @@ ${buildRunnerPrompt(task)}` : buildRunnerPrompt(task);
34820
34832
  return ["exec", ...flags, "-"];
34821
34833
  },
34822
34834
  prompt,
34835
+ recoveryPrompt,
34823
34836
  env,
34824
34837
  createParser: (onStream) => createCodexStreamParser(onStream, {
34825
34838
  onThreadStarted: (threadId) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zixt/host",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/client.ts",