@clagentic/console 1.10.0-beta.1 → 1.10.0-beta.3

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 (94) hide show
  1. package/README.md +1 -1
  2. package/bin/cli.js +10 -0
  3. package/lib/activity-clock.js +23 -0
  4. package/lib/agent-dispatch-tool.js +20 -0
  5. package/lib/build-changes.js +79 -0
  6. package/lib/build-identity.js +192 -0
  7. package/lib/build-monitor.js +125 -0
  8. package/lib/build-sha.json +2 -2
  9. package/lib/build-update-offer.js +141 -0
  10. package/lib/build-update-restart.js +142 -0
  11. package/lib/build-update-standing.js +184 -0
  12. package/lib/cli/daemon-launch.js +8 -5
  13. package/lib/cli/ipc-subcommands.js +6 -0
  14. package/lib/cli/session-subcommands.js +122 -0
  15. package/lib/cli-sessions.js +8 -1
  16. package/lib/cli-transcript-title.js +131 -0
  17. package/lib/codex-defaults.js +8 -2
  18. package/lib/daemon-projects.js +19 -0
  19. package/lib/daemon.js +166 -127
  20. package/lib/debug-log.js +17 -0
  21. package/lib/exit-flush.js +44 -0
  22. package/lib/grant-keys.js +179 -0
  23. package/lib/log-field.js +34 -0
  24. package/lib/memory-shed.js +13 -32
  25. package/lib/project-connection.js +14 -0
  26. package/lib/project-external-trigger.js +91 -123
  27. package/lib/project-http.js +2 -0
  28. package/lib/project-loop.js +5 -4
  29. package/lib/project-notifications.js +4 -0
  30. package/lib/project-prompt-responses.js +7 -5
  31. package/lib/project-session-grants.js +73 -0
  32. package/lib/project-sessions.js +55 -68
  33. package/lib/project-user-message.js +13 -25
  34. package/lib/project.js +25 -5
  35. package/lib/prompt-kinds/permission.js +18 -0
  36. package/lib/prompt-label.js +60 -0
  37. package/lib/prompt-registry.js +123 -13
  38. package/lib/prompt-source.js +65 -0
  39. package/lib/public/css/diagnostics.css +30 -0
  40. package/lib/public/css/notifications-center.css +15 -0
  41. package/lib/public/css/overlays.css +18 -0
  42. package/lib/public/css/rewind.css +8 -0
  43. package/lib/public/modules/agent-dispatch-tool.js +9 -0
  44. package/lib/public/modules/app-messages.js +10 -2
  45. package/lib/public/modules/app-notifications.js +9 -1
  46. package/lib/public/modules/app-panels.js +0 -1
  47. package/lib/public/modules/build-update-detail.js +54 -0
  48. package/lib/public/modules/diagnostics.js +126 -20
  49. package/lib/public/modules/prompt-banner.js +12 -0
  50. package/lib/public/modules/prompt-kinds/permission-choices.js +6 -1
  51. package/lib/public/modules/prompt-kinds/permission.js +15 -0
  52. package/lib/public/modules/prompt-label.js +44 -0
  53. package/lib/public/modules/prompts.js +9 -0
  54. package/lib/public/modules/session-grants.js +131 -0
  55. package/lib/public/modules/sidebar-sessions.js +11 -0
  56. package/lib/public/modules/tools.js +14 -2
  57. package/lib/public/modules/vendor-picker.js +2 -2
  58. package/lib/public/modules/vendor-registry.js +11 -2
  59. package/lib/runtime-env.js +1 -1
  60. package/lib/sdk-bridge.js +114 -115
  61. package/lib/sdk-message-processor.js +25 -87
  62. package/lib/sdk-skill-discovery.js +65 -60
  63. package/lib/server.js +15 -2
  64. package/lib/session-ai-title.js +80 -0
  65. package/lib/session-id.js +33 -0
  66. package/lib/session-input-ipc.js +32 -0
  67. package/lib/session-input.js +409 -0
  68. package/lib/session-reclaim.js +284 -0
  69. package/lib/session-resume.js +172 -0
  70. package/lib/sessions.js +31 -21
  71. package/lib/supervisor.js +39 -0
  72. package/lib/turn-initiator.js +108 -0
  73. package/lib/utils.js +9 -47
  74. package/lib/vendor-registry-message.js +1 -0
  75. package/lib/ws-schema.js +9 -4
  76. package/lib/yoke/adapters/claude-vendor.js +0 -1
  77. package/lib/yoke/adapters/claude-worker.js +6 -4
  78. package/lib/yoke/adapters/claude.js +29 -86
  79. package/lib/yoke/adapters/codex-capabilities.js +9 -6
  80. package/lib/yoke/adapters/codex-vendor.js +15 -15
  81. package/lib/yoke/adapters/codex.js +125 -136
  82. package/lib/yoke/auth-checks.js +8 -21
  83. package/lib/yoke/codex-app-server.js +27 -71
  84. package/lib/yoke/codex-binary.js +254 -0
  85. package/lib/yoke/codex-command.js +122 -0
  86. package/lib/yoke/codex-protocol.js +96 -0
  87. package/lib/yoke/codex-version.js +135 -0
  88. package/lib/yoke/index.js +20 -4
  89. package/lib/yoke/install-probe.js +21 -6
  90. package/lib/yoke/interface.js +14 -12
  91. package/lib/yoke/registry.js +41 -4
  92. package/package.json +1 -2
  93. package/scripts/verify-installed-build.js +59 -17
  94. package/lib/lore-attestation.js +0 -73
@@ -16,6 +16,7 @@ var modelCatalog = require("../../model-catalog");
16
16
  var permissionRelay = require("./permission-relay");
17
17
  var effortControl = require("./effort-control");
18
18
  var runtimeEnv = require("../../runtime-env");
19
+ var turnInitiator = require("../../turn-initiator");
19
20
  var claudeCapabilities = require("./claude-capabilities").claudeCapabilities;
20
21
 
21
22
  // --- SDK loading ---
@@ -342,6 +343,22 @@ function flattenEvent(raw) {
342
343
  return base;
343
344
  }
344
345
 
346
+ // The streamed user message for one turn, stamped with who initiated it. Shared
347
+ // by the in-process and worker handles so both deliver the same provenance.
348
+ function buildUserMessage(text, images, initiator) {
349
+ var content = [];
350
+ if (images && images.length > 0) {
351
+ for (var i = 0; i < images.length; i++) {
352
+ content.push({
353
+ type: "image",
354
+ source: { type: "base64", media_type: images[i].mediaType, data: images[i].data },
355
+ });
356
+ }
357
+ }
358
+ if (text) content.push({ type: "text", text: text });
359
+ return turnInitiator.stampClaudeUserMessage({ type: "user", message: { role: "user", content: content } }, initiator);
360
+ }
361
+
345
362
  // --- QueryHandle ---
346
363
  // Wraps a raw SDK query object with the YOKE QueryHandle interface.
347
364
  // Events are flattened via flattenEvent before yielding.
@@ -363,18 +380,8 @@ function createQueryHandle(rawQuery, messageQueue, abortController) {
363
380
  };
364
381
  },
365
382
 
366
- pushMessage: function(text, images) {
367
- var content = [];
368
- if (images && images.length > 0) {
369
- for (var i = 0; i < images.length; i++) {
370
- content.push({
371
- type: "image",
372
- source: { type: "base64", media_type: images[i].mediaType, data: images[i].data },
373
- });
374
- }
375
- }
376
- if (text) content.push({ type: "text", text: text });
377
- messageQueue.push({ type: "user", message: { role: "user", content: content } });
383
+ pushMessage: function(text, images, initiator) {
384
+ messageQueue.push(buildUserMessage(text, images, initiator));
378
385
  },
379
386
 
380
387
  setModel: function(model) {
@@ -1097,19 +1104,8 @@ function createWorkerQueryHandle(worker, canUseTool, onElicitation, callMcpTool)
1097
1104
  };
1098
1105
  },
1099
1106
 
1100
- pushMessage: function(text, images) {
1101
- var content = [];
1102
- if (images && images.length > 0) {
1103
- for (var i = 0; i < images.length; i++) {
1104
- content.push({
1105
- type: "image",
1106
- source: { type: "base64", media_type: images[i].mediaType, data: images[i].data },
1107
- });
1108
- }
1109
- }
1110
- if (text) content.push({ type: "text", text: text });
1111
- var userMsg = { type: "user", message: { role: "user", content: content } };
1112
- worker.send({ type: "push_message", content: userMsg });
1107
+ pushMessage: function(text, images, initiator) {
1108
+ worker.send({ type: "push_message", content: buildUserMessage(text, images, initiator) });
1113
1109
  },
1114
1110
 
1115
1111
  // lr-f22787: correlated by requestId (mirrors rewindFiles below) so the
@@ -1651,69 +1647,16 @@ function createClaudeAdapter(opts) {
1651
1647
  if (co.resumeSessionAt) sdkOptions.resumeSessionAt = co.resumeSessionAt;
1652
1648
  if (co.settings) sdkOptions.settings = co.settings;
1653
1649
 
1654
- // options.env REPLACES the subprocess environment, so a query with
1655
- // Settings variables is handed the whole environment, not the additions.
1656
- if (runtimeEnv.hasOverlay(queryOpts.runtimeEnv)) {
1657
- sdkOptions.env = runtimeEnv.composeRuntimeEnv(process.env, queryOpts.runtimeEnv);
1658
- }
1650
+ // options.env REPLACES the subprocess environment, so the query is handed
1651
+ // the whole environment (the process's own, the Settings variables, and
1652
+ // the product identity), not the additions. queryOpts.initiator is the
1653
+ // initiator of the turn that starts this process.
1654
+ sdkOptions.env = turnInitiator.claudeProcessEnv(process.env, queryOpts.runtimeEnv, queryOpts.initiator);
1659
1655
 
1660
1656
  var rawQuery = sdk.query({ prompt: mq, options: sdkOptions });
1661
1657
  return createQueryHandle(rawQuery, mq, ac);
1662
1658
  },
1663
1659
 
1664
- // --- Title generation ---
1665
- generateTitle: async function(messages, opts) {
1666
- console.log("[auto-title/claude] generateTitle called with " + messages.length + " messages");
1667
- var systemPrompt = "You are a title generator. Output only a short title (3-8 words). No quotes, no punctuation at the end, no explanation.";
1668
- var prompt = "Below is a conversation between a user and an AI assistant. Generate a short, descriptive title (3-8 words) that captures the main topic. Reply with ONLY the title, nothing else.\n\n";
1669
- for (var i = 0; i < messages.length; i++) {
1670
- prompt += "User message " + (i + 1) + ": " + messages[i] + "\n";
1671
- }
1672
- var ac = new AbortController();
1673
- console.log("[auto-title/claude] Creating query with model=haiku...");
1674
- var handle = await adapter.createQuery({
1675
- cwd: (opts && opts.cwd) || _cwd,
1676
- systemPrompt: systemPrompt,
1677
- model: "haiku",
1678
- adapterOptions: {
1679
- CLAUDE: {
1680
- settingSources: ["user"],
1681
- permissionMode: "bypassPermissions",
1682
- }
1683
- },
1684
- abortController: ac,
1685
- runtimeEnv: opts && opts.runtimeEnv,
1686
- });
1687
- console.log("[auto-title/claude] Query created, pushing message...");
1688
- handle.pushMessage(prompt);
1689
- var title = "";
1690
- var streamed = false;
1691
- try {
1692
- for await (var msg of handle) {
1693
- if (msg.yokeType === "text_delta" && msg.text) {
1694
- streamed = true;
1695
- title += msg.text;
1696
- } else if (msg.yokeType === "message" && msg.messageRole === "assistant" && !streamed && msg.content) {
1697
- // Fallback: extract text from non-streamed message content
1698
- var content = msg.content;
1699
- if (Array.isArray(content)) {
1700
- for (var ci = 0; ci < content.length; ci++) {
1701
- if (content[ci].type === "text" && content[ci].text) {
1702
- title += content[ci].text;
1703
- }
1704
- }
1705
- }
1706
- } else if (msg.yokeType === "result") {
1707
- break;
1708
- }
1709
- }
1710
- } finally {
1711
- handle.close();
1712
- }
1713
- console.log("[auto-title/claude] Generated: " + title.substring(0, 80));
1714
- return title.replace(/[\r\n]+/g, " ").replace(/^["'\s]+|["'\s.]+$/g, "").trim();
1715
- },
1716
-
1717
1660
  // --- Session management ---
1718
1661
  // These delegate to SDK module-level functions.
1719
1662
 
@@ -1825,6 +1768,8 @@ function createClaudeAdapter(opts) {
1825
1768
  // The worker lays these over its own environment (the OS user's), then
1826
1769
  // hands the SDK the complete result.
1827
1770
  if (runtimeEnv.hasOverlay(queryOpts.runtimeEnv)) queryOptions.runtimeEnv = queryOpts.runtimeEnv;
1771
+ // The worker builds the environment (see applyRuntimeEnv in claude-worker.js).
1772
+ if (queryOpts.initiator) queryOptions.initiator = queryOpts.initiator;
1828
1773
 
1829
1774
  if (queryOpts.toolServerDescriptors) queryOptions.mcpServerDescriptors = queryOpts.toolServerDescriptors;
1830
1775
  if (queryOpts.model) queryOptions.model = queryOpts.model;
@@ -1874,9 +1819,7 @@ function createClaudeAdapter(opts) {
1874
1819
  warmupOptions.allowDangerouslySkipPermissions = true;
1875
1820
  }
1876
1821
  // The warmup starts the same CLI a query does, so it gets the same environment.
1877
- if (initOpts && runtimeEnv.hasOverlay(initOpts.runtimeEnv)) {
1878
- warmupOptions.env = runtimeEnv.composeRuntimeEnv(process.env, initOpts.runtimeEnv);
1879
- }
1822
+ warmupOptions.env = turnInitiator.claudeProcessEnv(process.env, initOpts && initOpts.runtimeEnv);
1880
1823
 
1881
1824
  var result = {
1882
1825
  models: [],
@@ -2,11 +2,14 @@
2
2
 
3
3
  // What a Codex session can do: the declaration the Codex adapter registers and
4
4
  // the capabilities its init advertises. Every key is one of the YOKE
5
- // capability ledger (lib/yoke/interface.js). A Codex thread is resumed,
6
- // forked and rolled back through the app-server; it has no thinking budget,
7
- // file checkpoints, beta switches or subagents, and no permission modes beyond
8
- // the approval policy Codex owns, so those are declared off and the UI shows
9
- // them disabled.
5
+ // capability ledger (lib/yoke/interface.js). A Codex thread is resumed and
6
+ // forked through the app-server; it has no thinking budget, file checkpoints,
7
+ // beta switches or subagents, and no permission modes beyond the approval
8
+ // policy Codex owns, so those are declared off and the UI shows them disabled.
9
+ //
10
+ // Rewinding a thread in place (rewind, rollback) is not offered: the app-server
11
+ // call the console used was removed from the supported releases, and its
12
+ // replacement cannot be made safe against a turn appended while it runs.
10
13
 
11
14
  function codexCapabilities() {
12
15
  return {
@@ -15,7 +18,7 @@ function codexCapabilities() {
15
18
  effort: true,
16
19
  rewind: false,
17
20
  fork: true,
18
- rollback: true,
21
+ rollback: false,
19
22
  sessionResume: true,
20
23
  sessionList: false,
21
24
  sessionRename: false,
@@ -2,24 +2,17 @@
2
2
  // that asking the registry which agents exist does not load the adapter; it is
3
3
  // required only when an adapter is actually created.
4
4
 
5
- var fs = require("fs");
6
5
  var registry = require("../registry");
7
6
  var authChecks = require("../auth-checks");
7
+ var codexBinary = require("../codex-binary");
8
8
  var codexCapabilities = require("./codex-capabilities").codexCapabilities;
9
9
 
10
- // A bundled app-server binary counts as installed even when no `codex`
11
- // executable is on PATH.
12
- function probeCodexInstalled(ctx) {
13
- var appServer = require("../codex-app-server");
14
- try {
15
- var bundled = appServer.findCodexPath();
16
- if (bundled && fs.existsSync(bundled)) return true;
17
- } catch (e) {
18
- // Only an absent bundle falls through to the PATH lookup; anything else is
19
- // a defect and reaches the probe, which reports it as a failed check.
20
- if (!appServer.isBundleAbsent(e)) throw e;
21
- }
22
- return ctx.lookupBinary("codex");
10
+ // The console ships no Codex: the agent is installed when the user's own Codex
11
+ // resolves and is new enough. When it does not, the picker shows the reason
12
+ // (not installed, too old, an override that points nowhere) and, when one is
13
+ // usable, which binary and version will run.
14
+ function probeCodexInstalled() {
15
+ return codexBinary.describe(codexBinary.resolveCached());
23
16
  }
24
17
 
25
18
  registry.register({
@@ -29,18 +22,25 @@ registry.register({
29
22
  priority: 20,
30
23
  binaryNames: ["codex"],
31
24
  probeInstalled: probeCodexInstalled,
25
+ recheck: codexBinary.invalidate,
32
26
  checkAuth: authChecks.checkCodexAuth,
33
27
  installHint: "Install the Codex CLI (npm install -g @openai/codex), then sign in.",
34
28
  loginCommand: "codex login --device-auth",
29
+ // The app-server is not started per OS user, so under per-user isolation the
30
+ // agent is disabled (yoke/index.js, install-probe.js) and never started.
35
31
  osUsersSupported: false,
36
32
  needsRuntimeEnv: true,
37
33
  perProjectRuntime: true,
38
34
  activityTokens: true,
39
- attestsHumanSessions: true,
40
35
  ownedEnvNames: ["OPENAI_API_KEY", "OPENAI_BASE_URL"],
41
36
  credentialGroups: [{ id: "openai-endpoint", envNames: ["OPENAI_API_KEY", "OPENAI_BASE_URL"] }],
42
37
  nativeInstructionFiles: ["AGENTS.md"],
43
38
  interruptMessage: "■ Conversation interrupted - tell the model what to do differently.",
39
+ // Rewinding a Codex thread in place is not offered yet.
40
+ capabilityReasons: {
41
+ rewind: "Rewind is not available for Codex sessions yet",
42
+ rollback: "Rewind is not available for Codex sessions yet",
43
+ },
44
44
  capabilities: codexCapabilities(),
45
45
  createAdapter: function(opts) { return require("./codex").createCodexAdapter(opts); },
46
46
  });