@surething/cockpit 1.0.283 → 1.0.285

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 (49) hide show
  1. package/.next-prod/BUILD_ID +1 -1
  2. package/.next-prod/app-path-routes-manifest.json +3 -3
  3. package/.next-prod/build-manifest.json +2 -2
  4. package/.next-prod/cockpit-build.json +1 -1
  5. package/.next-prod/prerender-manifest.json +3 -3
  6. package/.next-prod/server/app/_global-error/page_client-reference-manifest.js +1 -1
  7. package/.next-prod/server/app/_global-error.html +1 -1
  8. package/.next-prod/server/app/_global-error.rsc +1 -1
  9. package/.next-prod/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/.next-prod/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  11. package/.next-prod/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  12. package/.next-prod/server/app/_not-found/page_client-reference-manifest.js +1 -1
  13. package/.next-prod/server/app/_not-found.html +2 -2
  14. package/.next-prod/server/app/_not-found.rsc +2 -2
  15. package/.next-prod/server/app/_not-found.segments/_full.segment.rsc +2 -2
  16. package/.next-prod/server/app/_not-found.segments/_index.segment.rsc +2 -2
  17. package/.next-prod/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  18. package/.next-prod/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  19. package/.next-prod/server/app/api/chat/route.js +1 -1
  20. package/.next-prod/server/app/api/scheduled-tasks/route.js +1 -1
  21. package/.next-prod/server/app/api/session/[sessionId]/fork/route.js +1 -1
  22. package/.next-prod/server/app/api/session/[sessionId]/history/route.js +1 -1
  23. package/.next-prod/server/app/api/session/[sessionId]/turn/route.js +1 -1
  24. package/.next-prod/server/app/m/page_client-reference-manifest.js +1 -1
  25. package/.next-prod/server/app/page_client-reference-manifest.js +1 -1
  26. package/.next-prod/server/app/project/page_client-reference-manifest.js +1 -1
  27. package/.next-prod/server/app-paths-manifest.json +3 -3
  28. package/.next-prod/server/chunks/2493.js +4 -4
  29. package/.next-prod/server/chunks/6495.js +1 -1
  30. package/.next-prod/server/chunks/7438.js +10 -10
  31. package/.next-prod/server/chunks/9830.js +1 -1
  32. package/.next-prod/server/middleware-build-manifest.js +1 -1
  33. package/.next-prod/server/pages/404.html +2 -2
  34. package/.next-prod/server/pages/500.html +1 -1
  35. package/.next-prod/server/server-reference-manifest.json +1 -1
  36. package/.next-prod/static/chunks/{2550-eb5beeffe90c8632.js → 2550-8c7decb785b92fbf.js} +4 -4
  37. package/.next-prod/static/chunks/{5313-da9f9a2ce9c5ba34.js → 5313-8a3e790e11b63d64.js} +5 -5
  38. package/.next-prod/trace +14 -14
  39. package/.next-prod/trace-build +1 -1
  40. package/bin/instanceLock.mjs +23 -1
  41. package/dist/auth.mjs +7 -2
  42. package/dist/{chunk-BE235BMW.mjs → chunk-7YQK3TY5.mjs} +157 -37
  43. package/dist/{chunk-TOVSUPTJ.mjs → chunk-EMTH733G.mjs} +1 -1
  44. package/dist/httpApi.mjs +2 -2
  45. package/dist/scheduledTasks.mjs +3 -1
  46. package/dist/wsServer.mjs +2 -2
  47. package/package.json +3 -3
  48. /package/.next-prod/static/{UM1QtmCsp6wKOKw_z_UEq → SHzF6HEOUD5ikVkZI6v3E}/_buildManifest.js +0 -0
  49. /package/.next-prod/static/{UM1QtmCsp6wKOKw_z_UEq → SHzF6HEOUD5ikVkZI6v3E}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- [{"name":"run-webpack","duration":16307887,"timestamp":244657357,"id":14,"parentId":1,"tags":{},"startTime":1791724161039,"traceId":"f436ebbec7d8f5bc"},{"name":"run-typescript","duration":5544261,"timestamp":260969441,"id":1445,"parentId":1,"tags":{},"startTime":1791724177351,"traceId":"f436ebbec7d8f5bc"},{"name":"static-check","duration":1396614,"timestamp":266552731,"id":1448,"parentId":1,"tags":{},"startTime":1791724182935,"traceId":"f436ebbec7d8f5bc"},{"name":"static-generation","duration":5801222,"timestamp":268096401,"id":1760,"parentId":1,"tags":{},"startTime":1791724184478,"traceId":"f436ebbec7d8f5bc"},{"name":"collect-build-traces","duration":26388764,"timestamp":267950026,"id":1757,"parentId":1,"tags":{},"startTime":1791724184332,"traceId":"f436ebbec7d8f5bc"},{"name":"telemetry-flush","duration":51,"timestamp":294342728,"id":1769,"parentId":1,"tags":{},"startTime":1791724210725,"traceId":"f436ebbec7d8f5bc"},{"name":"next-build","duration":49956617,"timestamp":244386174,"id":1,"tags":{"buildMode":"default","version":"16.3.0","bundler":"webpack","has-custom-webpack-config":"true","use-build-worker":"false"},"startTime":1791724160768,"traceId":"f436ebbec7d8f5bc"}]
1
+ [{"name":"run-webpack","duration":12146956,"timestamp":130103221,"id":14,"parentId":1,"tags":{},"startTime":1791911075160,"traceId":"8603caefd03508ae"},{"name":"run-typescript","duration":3651874,"timestamp":142253375,"id":1445,"parentId":1,"tags":{},"startTime":1791911087310,"traceId":"8603caefd03508ae"},{"name":"static-check","duration":875129,"timestamp":145942539,"id":1448,"parentId":1,"tags":{},"startTime":1791911090999,"traceId":"8603caefd03508ae"},{"name":"static-generation","duration":3894636,"timestamp":146884339,"id":1760,"parentId":1,"tags":{},"startTime":1791911091941,"traceId":"8603caefd03508ae"},{"name":"collect-build-traces","duration":16075264,"timestamp":146818306,"id":1757,"parentId":1,"tags":{},"startTime":1791911091875,"traceId":"8603caefd03508ae"},{"name":"telemetry-flush","duration":32,"timestamp":162896156,"id":1769,"parentId":1,"tags":{},"startTime":1791911107953,"traceId":"8603caefd03508ae"},{"name":"next-build","duration":33221237,"timestamp":129674958,"id":1,"tags":{"buildMode":"default","version":"16.3.0","bundler":"webpack","has-custom-webpack-config":"true","use-build-worker":"false"},"startTime":1791911074732,"traceId":"8603caefd03508ae"}]
@@ -38,6 +38,23 @@ function isStale(rec) {
38
38
  return !pidAlive(rec.pid);
39
39
  }
40
40
 
41
+ /**
42
+ * renameSync that rides out Windows sharing violations: a contender reading the lock at
43
+ * that instant makes the rename fail with EPERM / EACCES / EBUSY. The read is brief, so
44
+ * retry with a short (synchronous — this runs before anything else boots) backoff.
45
+ */
46
+ function renameOver(from, to) {
47
+ for (let attempt = 0; ; attempt++) {
48
+ try {
49
+ return renameSync(from, to);
50
+ } catch (e) {
51
+ const blocked = e.code === 'EPERM' || e.code === 'EACCES' || e.code === 'EBUSY';
52
+ if (!blocked || attempt >= 20) throw e;
53
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 10);
54
+ }
55
+ }
56
+ }
57
+
41
58
  /**
42
59
  * Create `path` holding `body`, failing if it exists. The content is written to a temp
43
60
  * file first and published with link() — which, like O_EXCL, refuses an existing target —
@@ -95,7 +112,12 @@ export function acquireInstanceLock(home) {
95
112
  if (readText(path) !== seen) continue;
96
113
  const tmp = `${path}.${process.pid}.${randomUUID()}.tmp`;
97
114
  writeFileSync(tmp, body, { mode: 0o600 });
98
- renameSync(tmp, path);
115
+ try {
116
+ renameOver(tmp, path);
117
+ } catch (e) {
118
+ try { unlinkSync(tmp); } catch { /* gone */ }
119
+ throw e;
120
+ }
99
121
  return won();
100
122
  } finally {
101
123
  try { unlinkSync(claim); } catch { /* gone */ }
package/dist/auth.mjs CHANGED
@@ -129,12 +129,17 @@ function checkOriginGate(input) {
129
129
  if (mutating && input.origin !== void 0) {
130
130
  if (!input.host) return { action: "deny", reason: "missing host" };
131
131
  let originHost;
132
+ let defaultPort;
132
133
  try {
133
- originHost = new URL(input.origin).host;
134
+ const o = new URL(input.origin);
135
+ originHost = o.host;
136
+ defaultPort = o.protocol === "https:" ? ":443" : o.protocol === "http:" ? ":80" : "";
134
137
  } catch {
135
138
  return { action: "deny", reason: "unparseable origin" };
136
139
  }
137
- if (!originHost || originHost.toLowerCase() !== input.host.trim().toLowerCase()) {
140
+ let selfHost = input.host.trim().toLowerCase();
141
+ if (defaultPort && selfHost.endsWith(defaultPort)) selfHost = selfHost.slice(0, -defaultPort.length);
142
+ if (!originHost || originHost.toLowerCase() !== selfHost) {
138
143
  return { action: "deny", reason: "cross-origin" };
139
144
  }
140
145
  }
@@ -28977,6 +28977,21 @@ async function readJsonFileForUpdate(filePath, defaultValue) {
28977
28977
  );
28978
28978
  }
28979
28979
  }
28980
+ var isRenameBlocked = (err) => {
28981
+ const code = err?.code;
28982
+ return code === "EPERM" || code === "EACCES" || code === "EBUSY";
28983
+ };
28984
+ async function renameOver(from, to) {
28985
+ if (process.platform !== "win32") return rename(from, to);
28986
+ for (let attempt = 0; ; attempt++) {
28987
+ try {
28988
+ return renameSync(from, to);
28989
+ } catch (err) {
28990
+ if (attempt >= 12 || !isRenameBlocked(err)) throw err;
28991
+ await new Promise((r) => setTimeout(r, Math.min(10 * (attempt + 1), 150)));
28992
+ }
28993
+ }
28994
+ }
28980
28995
  async function writeJsonFile(filePath, data) {
28981
28996
  await ensureParentDir(filePath);
28982
28997
  const body = JSON.stringify(data, null, 2);
@@ -28985,12 +29000,11 @@ async function writeJsonFile(filePath, data) {
28985
29000
  try {
28986
29001
  await writeFile(tmp, body, secret3 ? { encoding: "utf-8", mode: OWNER_ONLY } : "utf-8");
28987
29002
  if (secret3) await chmod(tmp, OWNER_ONLY);
28988
- await rename(tmp, filePath);
29003
+ await renameOver(tmp, filePath);
28989
29004
  } catch (err) {
28990
29005
  await unlink(tmp).catch(() => {
28991
29006
  });
28992
- const code = err.code;
28993
- if (code !== "EPERM" && code !== "EACCES" && code !== "EBUSY") throw err;
29007
+ if (!isRenameBlocked(err)) throw err;
28994
29008
  await writeFile(filePath, body, secret3 ? { encoding: "utf-8", mode: OWNER_ONLY } : "utf-8");
28995
29009
  if (secret3) await chmod(filePath, OWNER_ONLY);
28996
29010
  }
@@ -29179,6 +29193,26 @@ function getRunInfo(key) {
29179
29193
  if (!r) return null;
29180
29194
  return { cwd: r.cwd, sessionId: r.sessionId ?? null, engine: r.engine ?? null };
29181
29195
  }
29196
+ function setRunInjector(key, injector) {
29197
+ const r = registry.get(key);
29198
+ if (!r) return;
29199
+ if (injector) r.injector = injector;
29200
+ else delete r.injector;
29201
+ }
29202
+ function injectRun(key, input, runId) {
29203
+ const r = registry.get(key);
29204
+ if (!r || r.status !== "running") return "idle";
29205
+ if (!r.injector) return "unsupported";
29206
+ if (!r.injector(input)) return "closed";
29207
+ appendRun(key, {
29208
+ type: "user",
29209
+ _human: true,
29210
+ _turnId: runId,
29211
+ _ts: Date.now(),
29212
+ message: { role: "user", content: input.text ?? "" }
29213
+ });
29214
+ return "ok";
29215
+ }
29182
29216
  function setRunAbort(key, abort) {
29183
29217
  const r = registry.get(key);
29184
29218
  if (r) r.abort = abort;
@@ -32030,6 +32064,18 @@ function isHumanTurnStart(entry) {
32030
32064
  if (!Array.isArray(content)) return false;
32031
32065
  return content.some((block) => block?.type === "text");
32032
32066
  }
32067
+ function queuedPromptAsUserEntry(entry) {
32068
+ const a = entry.attachment;
32069
+ if (entry.type !== "attachment" || a?.type !== "queued_command" || a.commandMode !== "prompt") return null;
32070
+ if (!(typeof a.prompt === "string" || Array.isArray(a.prompt)) || a.prompt.length === 0) return null;
32071
+ return {
32072
+ type: "user",
32073
+ uuid: entry.uuid,
32074
+ timestamp: entry.timestamp ?? a.timestamp,
32075
+ sessionId: entry.sessionId,
32076
+ message: { role: "user", content: a.prompt }
32077
+ };
32078
+ }
32033
32079
 
32034
32080
  // packages/feature/agent/src/shared/subagentTask.ts
32035
32081
  var TERMINAL = /* @__PURE__ */ new Set(["completed", "failed", "stopped"]);
@@ -32729,7 +32775,8 @@ async function parseTranscriptFile(filePath, page = {}) {
32729
32775
  let lastUsage;
32730
32776
  for await (const line of rl) {
32731
32777
  try {
32732
- const obj = JSON.parse(line);
32778
+ const parsed = JSON.parse(line);
32779
+ const obj = queuedPromptAsUserEntry(parsed) ?? parsed;
32733
32780
  if (obj.type === "user" || obj.type === "assistant") {
32734
32781
  if (obj.type === "user" && rawMessages.length > 0) {
32735
32782
  const prev = rawMessages[rawMessages.length - 1];
@@ -33551,10 +33598,11 @@ var SessionSearchServiceLive = Layer_exports.effect(
33551
33598
  // packages/feature/agent/src/effect/delegationLive.ts
33552
33599
  import { open as open2, stat as stat6 } from "fs/promises";
33553
33600
  import { basename as basename4, isAbsolute as isAbsolute3 } from "path";
33554
- import { randomUUID as randomUUID5 } from "crypto";
33601
+ import { randomUUID as randomUUID6 } from "crypto";
33555
33602
 
33556
33603
  // packages/feature/agent/src/server/engines/shared/sdkLoop.ts
33557
33604
  import { query as query2 } from "@anthropic-ai/claude-agent-sdk";
33605
+ import { randomUUID as randomUUID3 } from "crypto";
33558
33606
  var CHILD_EXIT_TIMEOUT_MS = 5e3;
33559
33607
  async function waitForSdkChildExit(response, timeoutMs = CHILD_EXIT_TIMEOUT_MS) {
33560
33608
  const transport = response?.transport;
@@ -33573,6 +33621,7 @@ async function waitForSdkChildExit(response, timeoutMs = CHILD_EXIT_TIMEOUT_MS)
33573
33621
  clearTimeout(timer);
33574
33622
  }
33575
33623
  var MAX_COMPACTION_RETRIES = 1;
33624
+ var MAX_RESULTS_BEFORE_START = 3;
33576
33625
  var STDERR_LOG_BUDGET_BYTES = 1e4;
33577
33626
  function makeStderrForwarder() {
33578
33627
  let spent = 0;
@@ -33591,23 +33640,28 @@ function follow(ctx) {
33591
33640
  return ac;
33592
33641
  }
33593
33642
  async function runSdkLoop(ctx, buildOptions2) {
33594
- const hasImages = !!(ctx.images && ctx.images.length > 0);
33595
- const content = [];
33596
- if (ctx.images) {
33597
- for (const img of ctx.images) {
33598
- content.push({ type: "image", source: { type: "base64", media_type: img.media_type, data: img.data } });
33599
- }
33600
- }
33601
- if (ctx.prompt) content.push({ type: "text", text: ctx.prompt });
33602
- const firstContent = hasImages ? content : ctx.prompt ?? "";
33643
+ const firstContent = userContent(ctx.prompt, ctx.images);
33603
33644
  const pendingTasks = /* @__PURE__ */ new Set();
33645
+ const awaitingStart = /* @__PURE__ */ new Set();
33646
+ let resultsSinceStart = 0;
33647
+ let turnActive = false;
33604
33648
  let closeInput = () => {
33605
33649
  };
33650
+ let gateClosed = false;
33606
33651
  if (!ctx.signal.aborted) {
33607
33652
  ctx.signal.addEventListener("abort", () => closeInput(), { once: true });
33608
33653
  }
33654
+ const injected = [];
33655
+ let wakeInput = () => {
33656
+ };
33657
+ ctx.acceptInput((input) => {
33658
+ if (gateClosed || ctx.signal.aborted) return false;
33659
+ injected.push({ content: userContent(input.text, input.images) });
33660
+ wakeInput();
33661
+ return true;
33662
+ });
33609
33663
  for (let attempt = 0; attempt <= MAX_COMPACTION_RETRIES; attempt++) {
33610
- let gateClosed = false;
33664
+ gateClosed = false;
33611
33665
  const gateOpen = new Promise((resolve3) => {
33612
33666
  closeInput = () => {
33613
33667
  if (!gateClosed) {
@@ -33618,8 +33672,13 @@ async function runSdkLoop(ctx, buildOptions2) {
33618
33672
  });
33619
33673
  if (ctx.signal.aborted) closeInput();
33620
33674
  const isRetry2 = attempt > 0;
33675
+ const firstUuid = randomUUID3();
33676
+ awaitingStart.clear();
33677
+ resultsSinceStart = 0;
33678
+ awaitingStart.add(firstUuid);
33621
33679
  const firstYield = {
33622
33680
  type: "user",
33681
+ uuid: firstUuid,
33623
33682
  // A compaction retry resumes the same session with 'continue'; the first attempt sends the
33624
33683
  // user turn (text ∪ images).
33625
33684
  message: { role: "user", content: isRetry2 ? "continue" : firstContent },
@@ -33628,7 +33687,25 @@ async function runSdkLoop(ctx, buildOptions2) {
33628
33687
  };
33629
33688
  const input = (async function* () {
33630
33689
  yield firstYield;
33631
- await gateOpen;
33690
+ for (; ; ) {
33691
+ for (let next4 = injected.shift(); next4; next4 = injected.shift()) {
33692
+ const uuid3 = randomUUID3();
33693
+ if (!turnActive) awaitingStart.add(uuid3);
33694
+ yield {
33695
+ type: "user",
33696
+ uuid: uuid3,
33697
+ message: { role: "user", content: next4.content },
33698
+ parent_tool_use_id: null,
33699
+ session_id: ctx.currentKey(),
33700
+ priority: "next"
33701
+ };
33702
+ }
33703
+ if (gateClosed) return;
33704
+ await new Promise((resolve3) => {
33705
+ wakeInput = resolve3;
33706
+ void gateOpen.then(resolve3);
33707
+ });
33708
+ }
33632
33709
  })();
33633
33710
  const attemptAbort = follow(ctx);
33634
33711
  const resume2 = isRetry2 ? ctx.currentKey() : ctx.sessionId;
@@ -33642,6 +33719,10 @@ async function runSdkLoop(ctx, buildOptions2) {
33642
33719
  break;
33643
33720
  }
33644
33721
  const msg = message;
33722
+ if (msg.type === "system" && msg.subtype === "init") turnActive = true;
33723
+ for (const uuid3 of msg.user_message_uuids ?? (msg.user_message_uuid ? [msg.user_message_uuid] : [])) {
33724
+ if (awaitingStart.delete(uuid3)) resultsSinceStart = 0;
33725
+ }
33645
33726
  if (msg.type === "system" && msg.subtype === "init" && msg.session_id) {
33646
33727
  ctx.rekey(msg.session_id);
33647
33728
  }
@@ -33655,14 +33736,28 @@ async function runSdkLoop(ctx, buildOptions2) {
33655
33736
  if (msg.type === "system" && msg.subtype === "task_notification" && msg.task_id) {
33656
33737
  pendingTasks.delete(msg.task_id);
33657
33738
  }
33658
- if (msg.type === "result") receivedResult = true;
33739
+ if (msg.type === "result") {
33740
+ receivedResult = true;
33741
+ turnActive = false;
33742
+ if (awaitingStart.size > 0 && ++resultsSinceStart >= MAX_RESULTS_BEFORE_START) awaitingStart.clear();
33743
+ }
33659
33744
  ctx.emit(message);
33660
- if (msg.type === "result" && pendingTasks.size === 0) closeInput();
33745
+ if (msg.type === "result" && pendingTasks.size === 0 && awaitingStart.size === 0) closeInput();
33661
33746
  }
33662
33747
  closeInput();
33663
33748
  await waitForSdkChildExit(response);
33664
33749
  if (receivedResult || ctx.signal.aborted) break;
33665
33750
  }
33751
+ ctx.acceptInput(null);
33752
+ }
33753
+ function userContent(text, images) {
33754
+ if (!images || images.length === 0) return text ?? "";
33755
+ const content = images.map((img) => ({
33756
+ type: "image",
33757
+ source: { type: "base64", media_type: img.media_type, data: img.data }
33758
+ }));
33759
+ if (text) content.push({ type: "text", text });
33760
+ return content;
33666
33761
  }
33667
33762
 
33668
33763
  // packages/feature/agent/src/server/engines/shared/noHistoryTranscript.ts
@@ -33879,6 +33974,11 @@ function buildClaudeOptions(ctx, independent) {
33879
33974
  canUseTool: async (toolName, input, opts) => planPermission(toolName, input, opts)
33880
33975
  },
33881
33976
  includePartialMessages: true,
33977
+ // Predicted next user prompt, shown as the composer's placeholder. The CLI emits one
33978
+ // `prompt_suggestion` after the turn's `result` and still delivers it when the input closes
33979
+ // on that result (sdkLoop), so nothing downstream waits for it. Suppressed by the CLI on a
33980
+ // session's first turn, in plan mode, and when the user disabled it in settings.json.
33981
+ promptSuggestions: true,
33882
33982
  abortController: abort,
33883
33983
  // env is ALWAYS passed: without it the SDK inherits process.env verbatim,
33884
33984
  // handing the agent this server's NODE_ENV=production. See sanitizedSpawnEnv.
@@ -33929,7 +34029,7 @@ var glmApiKey = createApiKeyStore(GLM_CREDENTIALS_FILE);
33929
34029
 
33930
34030
  // packages/feature/agent/src/server/engines/builtinAgent/index.ts
33931
34031
  import { streamText as streamText2, stepCountIs } from "ai";
33932
- import { randomUUID as randomUUID3 } from "crypto";
34032
+ import { randomUUID as randomUUID4 } from "crypto";
33933
34033
 
33934
34034
  // packages/feature/agent/src/server/engines/builtinAgent/prompt.ts
33935
34035
  function buildSystemPrompt(cwd, outputStyle) {
@@ -48499,7 +48599,7 @@ async function runBuiltinAgent(ctx, config3) {
48499
48599
  const noHistory = ctx.params.noHistory === true;
48500
48600
  const existing = noHistory ? [] : readSessionMessages(sessionsRoot, cwd, sid);
48501
48601
  const messages = [...existing, { role: "user", content: prompt }];
48502
- appendUserText(sessionsRoot, cwd, sid, prompt, { uuid: randomUUID3(), timestamp: (/* @__PURE__ */ new Date()).toISOString() });
48602
+ appendUserText(sessionsRoot, cwd, sid, prompt, { uuid: randomUUID4(), timestamp: (/* @__PURE__ */ new Date()).toISOString() });
48503
48603
  emit2(`data: ${JSON.stringify({ type: "system", subtype: "init", session_id: sid })}
48504
48604
 
48505
48605
  `);
@@ -48529,7 +48629,7 @@ async function runBuiltinAgent(ctx, config3) {
48529
48629
  for (const [toolUseId] of pendingToolCalls) {
48530
48630
  try {
48531
48631
  appendToolResult(sessionsRoot, cwd, sid, toolUseId, reason, {
48532
- uuid: randomUUID3(),
48632
+ uuid: randomUUID4(),
48533
48633
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
48534
48634
  is_error: true
48535
48635
  });
@@ -48563,7 +48663,7 @@ async function runBuiltinAgent(ctx, config3) {
48563
48663
  cwd,
48564
48664
  sid,
48565
48665
  [{ type: "tool_use", id: toolUseId, name: toolName, input }],
48566
- { uuid: randomUUID3(), timestamp: (/* @__PURE__ */ new Date()).toISOString() }
48666
+ { uuid: randomUUID4(), timestamp: (/* @__PURE__ */ new Date()).toISOString() }
48567
48667
  );
48568
48668
  } catch {
48569
48669
  }
@@ -48572,7 +48672,7 @@ async function runBuiltinAgent(ctx, config3) {
48572
48672
  try {
48573
48673
  pendingToolCalls.delete(toolUseId);
48574
48674
  appendToolResult(sessionsRoot, cwd, sid, toolUseId, content, {
48575
- uuid: randomUUID3(),
48675
+ uuid: randomUUID4(),
48576
48676
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
48577
48677
  is_error: Boolean(isError)
48578
48678
  });
@@ -48582,7 +48682,7 @@ async function runBuiltinAgent(ctx, config3) {
48582
48682
  onTextFlush: (flushedText) => {
48583
48683
  try {
48584
48684
  appendAssistantMessage(sessionsRoot, cwd, sid, [{ type: "text", text: flushedText }], {
48585
- uuid: randomUUID3(),
48685
+ uuid: randomUUID4(),
48586
48686
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
48587
48687
  });
48588
48688
  } catch {
@@ -48594,7 +48694,7 @@ async function runBuiltinAgent(ctx, config3) {
48594
48694
  emitResultMessage(usage.inputTokens || 0, usage.outputTokens || 0, emit2);
48595
48695
  if (!ctx.signal.aborted) {
48596
48696
  appendAssistantMessage(sessionsRoot, cwd, sid, text ? [{ type: "text", text }] : [], {
48597
- uuid: randomUUID3(),
48697
+ uuid: randomUUID4(),
48598
48698
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
48599
48699
  usage: {
48600
48700
  input_tokens: usage.inputTokens || 0,
@@ -48616,7 +48716,7 @@ async function runBuiltinAgent(ctx, config3) {
48616
48716
  cwd,
48617
48717
  sid,
48618
48718
  [{ type: "text", text: `\u26A0\uFE0F ${formatProviderError(error48)}` }],
48619
- { uuid: randomUUID3(), timestamp: (/* @__PURE__ */ new Date()).toISOString() }
48719
+ { uuid: randomUUID4(), timestamp: (/* @__PURE__ */ new Date()).toISOString() }
48620
48720
  );
48621
48721
  } catch {
48622
48722
  }
@@ -49312,7 +49412,7 @@ var CodexEventShim = class {
49312
49412
  };
49313
49413
 
49314
49414
  // packages/feature/agent/src/server/engines/codex.ts
49315
- import { randomUUID as randomUUID4 } from "crypto";
49415
+ import { randomUUID as randomUUID5 } from "crypto";
49316
49416
  import { writeFileSync as writeFileSync6, unlinkSync as unlinkSync4, mkdirSync as mkdirSync5, existsSync as existsSync6, statSync as statSync4, openSync as openSync2, readSync as readSync2, closeSync as closeSync2 } from "fs";
49317
49417
  import { StringDecoder as StringDecoder2 } from "string_decoder";
49318
49418
  import { join as join14 } from "path";
@@ -49537,7 +49637,7 @@ function writeImagesToTemp(images) {
49537
49637
  });
49538
49638
  }
49539
49639
  function codexToolUseId(item) {
49540
- return item.call_id || item.id || `tool-${randomUUID4()}`;
49640
+ return item.call_id || item.id || `tool-${randomUUID5()}`;
49541
49641
  }
49542
49642
  function parseCallLines(text, spawns, reports) {
49543
49643
  for (const line of text.split("\n")) {
@@ -49759,7 +49859,7 @@ function createCodexEventAdapter(ctx) {
49759
49859
  if (event.type !== "thread.started") syncSubAgents();
49760
49860
  switch (event.type) {
49761
49861
  case "thread.started": {
49762
- const threadId = event.thread_id || `codex-${randomUUID4()}`;
49862
+ const threadId = event.thread_id || `codex-${randomUUID5()}`;
49763
49863
  ctx.rekey(threadId);
49764
49864
  ctx.emit({ type: "system", subtype: "init", session_id: threadId });
49765
49865
  break;
@@ -50330,7 +50430,7 @@ var DelegationServiceLive = Layer_exports.effect(
50330
50430
  const spec = getEngineSpec(request2.engine);
50331
50431
  if (!spec) return yield* Effect_exports.fail(invalid("engine", `no engine spec for ${request2.engine}`));
50332
50432
  const parent = yield* resolveParent(parentRunId);
50333
- const presetId = randomUUID5();
50433
+ const presetId = randomUUID6();
50334
50434
  const dispatchParams = {
50335
50435
  prompt: buildChildPrompt(request2, parent),
50336
50436
  cwd: request2.cwd,
@@ -50376,7 +50476,7 @@ var DelegationServiceLive = Layer_exports.effect(
50376
50476
  );
50377
50477
 
50378
50478
  // packages/feature/agent/src/effect/botRegistryLive.ts
50379
- import { randomUUID as randomUUID6 } from "crypto";
50479
+ import { randomUUID as randomUUID7 } from "crypto";
50380
50480
  import { readFileSync as readFileSync8, realpathSync as realpathSync3 } from "fs";
50381
50481
  import path3 from "path";
50382
50482
 
@@ -50721,7 +50821,7 @@ var addBot = (inputPath) => Effect_exports.gen(function* () {
50721
50821
  if (existing) return { kind: "existing", bot: resolveBot(path3, existing, readManifest) };
50722
50822
  const clash = findNameClash(mergeBuiltins(resolveRegisteredBots(registry3)), manifest.name, dir);
50723
50823
  if (clash) return { kind: "clash", bot: clash };
50724
- const record2 = { id: `bot-${randomUUID6()}`, path: dir, addedAt: (/* @__PURE__ */ new Date()).toISOString() };
50824
+ const record2 = { id: `bot-${randomUUID7()}`, path: dir, addedAt: (/* @__PURE__ */ new Date()).toISOString() };
50725
50825
  await writeJsonFile(BOTS_FILE, { bots: [...registry3.bots, record2] });
50726
50826
  return { kind: "added", record: record2 };
50727
50827
  }),
@@ -51166,7 +51266,7 @@ function substitute(text, baseUrl) {
51166
51266
  }
51167
51267
 
51168
51268
  // packages/feature/agent/src/server/engines/orchestrator.ts
51169
- import { randomUUID as randomUUID7 } from "crypto";
51269
+ import { randomUUID as randomUUID8 } from "crypto";
51170
51270
 
51171
51271
  // packages/feature/agent/src/server/lib/outputStyles.ts
51172
51272
  var MAX_OUTPUT_STYLE_LENGTH = 8e3;
@@ -51217,7 +51317,7 @@ ${content}
51217
51317
  var WRITER_RELEASE_TIMEOUT_MS = 1e4;
51218
51318
  async function dispatchChat2(spec, body, request2) {
51219
51319
  const { sessionId, images, cwd, language } = body;
51220
- if (sessionId && isRunActive(sessionId)) {
51320
+ if (sessionId && isRunActive(sessionId) && !body.inject) {
51221
51321
  return { ok: false, status: 409, error: "session is already running" };
51222
51322
  }
51223
51323
  const rawPrompt = body.prompt;
@@ -51226,6 +51326,20 @@ async function dispatchChat2(spec, body, request2) {
51226
51326
  if (!hasContent) {
51227
51327
  return { ok: false, status: 400, error: "Missing prompt or images" };
51228
51328
  }
51329
+ const runId = typeof body.runId === "string" && body.runId || randomUUID8();
51330
+ let joinsWindingDownRun = false;
51331
+ if (sessionId && body.inject) {
51332
+ const injected = injectRun(
51333
+ sessionId,
51334
+ { text: typeof prompt === "string" ? prompt : void 0, images },
51335
+ runId
51336
+ );
51337
+ if (injected === "ok") return { ok: true, runKey: sessionId, sessionId, injected: true };
51338
+ if (injected === "unsupported") {
51339
+ return { ok: false, status: 409, error: "session is already running" };
51340
+ }
51341
+ joinsWindingDownRun = injected === "closed";
51342
+ }
51229
51343
  if (spec.preflight) {
51230
51344
  const pre = await spec.preflight(body);
51231
51345
  if (!pre.ok) return pre;
@@ -51234,15 +51348,18 @@ async function dispatchChat2(spec, body, request2) {
51234
51348
  const outputStyleText = await resolveOutputStyleText(body.outputStyleId);
51235
51349
  const outputStyle = outputStyleText ? formatOutputStyleSection(outputStyleText) : void 0;
51236
51350
  const abort = new AbortController();
51237
- const runId = typeof body.runId === "string" && body.runId || randomUUID7();
51238
51351
  let currentKey = sessionId || runId;
51239
51352
  let actualSessionId = sessionId;
51240
51353
  let isClosed = false;
51241
- if (isRunActive(currentKey)) {
51354
+ if (!joinsWindingDownRun && isRunActive(currentKey)) {
51242
51355
  return { ok: false, status: 409, error: "run already active" };
51243
51356
  }
51244
51357
  if (!await waitForWriter(currentKey, WRITER_RELEASE_TIMEOUT_MS)) {
51245
- return { ok: false, status: 409, error: "previous run is still stopping" };
51358
+ return {
51359
+ ok: false,
51360
+ status: 409,
51361
+ error: joinsWindingDownRun ? "the current run no longer takes messages; send again once it finishes" : "previous run is still stopping"
51362
+ };
51246
51363
  }
51247
51364
  if (!startRun(currentKey, cwd || "", promptText, runId, spec.name)) {
51248
51365
  return { ok: false, status: 409, error: "run already active" };
@@ -51281,6 +51398,9 @@ async function dispatchChat2(spec, body, request2) {
51281
51398
  },
51282
51399
  currentKey() {
51283
51400
  return currentKey;
51401
+ },
51402
+ acceptInput(sink) {
51403
+ setRunInjector(currentKey, sink);
51284
51404
  }
51285
51405
  };
51286
51406
  void (async () => {
@@ -17,7 +17,7 @@ import {
17
17
  readJsonFile,
18
18
  withFileLock,
19
19
  writeJsonFile
20
- } from "./chunk-BE235BMW.mjs";
20
+ } from "./chunk-7YQK3TY5.mjs";
21
21
 
22
22
  // packages/feature/console/src/server/plugins/browser/BrowserBridge.ts
23
23
  import { WebSocket } from "ws";
package/dist/httpApi.mjs CHANGED
@@ -29,11 +29,11 @@ import {
29
29
  unregisterBrowser,
30
30
  unregisterTerminal,
31
31
  writeStdinToCommand
32
- } from "./chunk-TOVSUPTJ.mjs";
32
+ } from "./chunk-EMTH733G.mjs";
33
33
  import {
34
34
  getTerminalHistoryPath,
35
35
  tightenSecretFiles
36
- } from "./chunk-BE235BMW.mjs";
36
+ } from "./chunk-7YQK3TY5.mjs";
37
37
  import "./chunk-7P6ASYW6.mjs";
38
38
 
39
39
  // src/lib/httpApi.ts
@@ -22,7 +22,7 @@ import {
22
22
  updateGlobalState,
23
23
  withFileLock,
24
24
  writeJsonFile
25
- } from "./chunk-BE235BMW.mjs";
25
+ } from "./chunk-7YQK3TY5.mjs";
26
26
  import "./chunk-7P6ASYW6.mjs";
27
27
 
28
28
  // packages/feature/agent/src/server/scheduledTasks.ts
@@ -624,6 +624,7 @@ var en_default = {
624
624
  codexResumeFailedNew: "New session",
625
625
  placeholder: "Type a message, Enter to send (Shift+Enter for new line, paste images; start a line with / (skill), /@ (skill in a subagent) or @ (bot in a subagent), multiple allowed)",
626
626
  placeholderDisabled: "Generating... you can keep typing (ESC to cancel; if stuck, cancel and resend 'continue')",
627
+ placeholderRunning: "Generating... Enter sends now: it joins the current reply at its next step (ESC to stop)",
627
628
  imageSizeLimit: "Image size exceeds limit (max 5MB), current: {{size}}MB",
628
629
  viewGitChanges: "View Git changes",
629
630
  viewAllComments: "View all comments",
@@ -1941,6 +1942,7 @@ var zh_default = {
1941
1942
  codexResumeFailedNew: "\u65B0\u4F1A\u8BDD",
1942
1943
  placeholder: "\u8F93\u5165\u6D88\u606F\uFF0CEnter \u53D1\u9001\uFF08Shift+Enter \u6362\u884C\uFF0C\u53EF\u7C98\u8D34\u56FE\u7247\uFF1B\u884C\u9996 /\uFF08skill\uFF09\u3001/@\uFF08\u5B50\u4EE3\u7406\u6267\u884C skill\uFF09\u6216 @\uFF08\u5B50\u4EE3\u7406\u6267\u884C\u673A\u5668\u4EBA\uFF09\uFF0C\u652F\u6301\u591A\u884C\u591A\u547D\u4EE4\uFF09",
1943
1944
  placeholderDisabled: "\u751F\u6210\u4E2D... \u53EF\u7EE7\u7EED\u8F93\u5165 (ESC \u53D6\u6D88;\u5361\u4F4F\u592A\u4E45\u53EF\u53D6\u6D88\u540E\u91CD\u53D1\u300C\u7EE7\u7EED\u300D)",
1945
+ placeholderRunning: "\u751F\u6210\u4E2D... \u56DE\u8F66\u5373\u53D1\u9001\uFF0C\u4F1A\u5728\u5F53\u524D\u56DE\u590D\u7684\u4E0B\u4E00\u6B65\u63D2\u5165\uFF08ESC \u505C\u6B62\uFF09",
1944
1946
  imageSizeLimit: "\u56FE\u7247\u5927\u5C0F\u8D85\u8FC7\u9650\u5236\uFF08\u6700\u5927 5MB\uFF09\uFF0C\u5F53\u524D\u5927\u5C0F: {{size}}MB",
1945
1947
  viewGitChanges: "\u67E5\u770B Git \u53D8\u66F4",
1946
1948
  viewAllComments: "\u67E5\u770B\u6240\u6709\u8BC4\u8BBA",
package/dist/wsServer.mjs CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  spawnPtyInHost,
22
22
  unregisterBrowser,
23
23
  writeStdinToCommand
24
- } from "./chunk-TOVSUPTJ.mjs";
24
+ } from "./chunk-EMTH733G.mjs";
25
25
  import {
26
26
  Effect_exports,
27
27
  FSError,
@@ -39,7 +39,7 @@ import {
39
39
  recoverStashedCodexRollouts,
40
40
  recoverStashedTranscripts,
41
41
  sanitizedSpawnEnv
42
- } from "./chunk-BE235BMW.mjs";
42
+ } from "./chunk-7YQK3TY5.mjs";
43
43
  import {
44
44
  registerWatcherSubscriber,
45
45
  subscribeBuildProgress
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@surething/cockpit",
3
- "version": "1.0.283",
3
+ "version": "1.0.285",
4
4
  "description": "OpenCockpit — the open Claude Code GUI for any LLM (Claude, Codex, DeepSeek, GLM, Kimi, Ollama). Cockpit IDE: parallel projects, terminal, browser & DB bubbles, code review. Self-host, local-first, MIT.",
5
5
  "author": "Robert",
6
6
  "license": "MIT",
@@ -113,9 +113,9 @@
113
113
  },
114
114
  "dependencies": {
115
115
  "@ai-sdk/openai": "^3.0.52",
116
- "@anthropic-ai/claude-agent-sdk": "0.3.293",
116
+ "@anthropic-ai/claude-agent-sdk": "0.3.296",
117
117
  "@dagrejs/dagre": "^3.0.0",
118
- "@openai/codex": "0.161.0",
118
+ "@openai/codex": "0.162.1",
119
119
  "@tanstack/react-virtual": "^3.13.18",
120
120
  "@tiptap/extension-link": "^3.19.0",
121
121
  "@tiptap/extension-placeholder": "^3.19.0",