@gkorepanov/ccodex 0.4.13 → 0.4.15

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 (73) hide show
  1. package/README.md +1 -1
  2. package/config/compatibility.json +3 -3
  3. package/dist/claude/service.d.ts +1 -0
  4. package/dist/claude/service.js +102 -22
  5. package/dist/claude/service.js.map +1 -1
  6. package/dist/claude/session/commands.d.ts +2 -0
  7. package/dist/claude/session/providerRuntimeFactory.d.ts +1 -0
  8. package/dist/claude/session/providerRuntimeFactory.js +5 -0
  9. package/dist/claude/session/providerRuntimeFactory.js.map +1 -1
  10. package/dist/claude/session/session.d.ts +2 -0
  11. package/dist/claude/session/session.js +51 -12
  12. package/dist/claude/session/session.js.map +1 -1
  13. package/dist/claude/streamingFilePreview.d.ts +16 -0
  14. package/dist/claude/streamingFilePreview.js +206 -0
  15. package/dist/claude/streamingFilePreview.js.map +1 -0
  16. package/dist/claude/toolMapper.d.ts +1 -0
  17. package/dist/claude/toolMapper.js +2 -2
  18. package/dist/claude/toolMapper.js.map +1 -1
  19. package/dist/codex/generated/ClientRequest.d.ts +5 -0
  20. package/dist/codex/generated/PathUri.d.ts +3 -2
  21. package/dist/codex/generated/PlanType.d.ts +1 -1
  22. package/dist/codex/generated/ResponseItemRuntimeSchema.js +1 -1
  23. package/dist/codex/generated/v2/AppMetadata.d.ts +0 -1
  24. package/dist/codex/generated/v2/AppToolSummary.d.ts +3 -0
  25. package/dist/codex/generated/v2/BrowserUseRequirements.d.ts +3 -0
  26. package/dist/codex/generated/v2/BrowserUseRequirements.js +3 -0
  27. package/dist/codex/generated/v2/BrowserUseRequirements.js.map +1 -0
  28. package/dist/codex/generated/v2/ConfigBatchWriteParams.d.ts +3 -1
  29. package/dist/codex/generated/v2/ConfigRequirements.d.ts +11 -0
  30. package/dist/codex/generated/v2/ExternalAgentConfigDetectParams.d.ts +8 -0
  31. package/dist/codex/generated/v2/ExternalAgentConfigImportHistory.d.ts +1 -0
  32. package/dist/codex/generated/v2/ExternalAgentConfigImportHistoryRecordParams.d.ts +11 -0
  33. package/dist/codex/generated/v2/ExternalAgentConfigImportHistoryRecordParams.js +3 -0
  34. package/dist/codex/generated/v2/ExternalAgentConfigImportHistoryRecordParams.js.map +1 -0
  35. package/dist/codex/generated/v2/ExternalAgentConfigImportHistoryRecordResponse.d.ts +3 -0
  36. package/dist/codex/generated/v2/ExternalAgentConfigImportHistoryRecordResponse.js +3 -0
  37. package/dist/codex/generated/v2/ExternalAgentConfigImportHistoryRecordResponse.js.map +1 -0
  38. package/dist/codex/generated/v2/ExternalAgentConfigImportParams.d.ts +5 -0
  39. package/dist/codex/generated/v2/FeedbackRequirements.d.ts +3 -0
  40. package/dist/codex/generated/v2/FeedbackRequirements.js +3 -0
  41. package/dist/codex/generated/v2/FeedbackRequirements.js.map +1 -0
  42. package/dist/codex/generated/v2/PluginListParams.d.ts +4 -0
  43. package/dist/codex/generated/v2/PluginShareContext.d.ts +1 -0
  44. package/dist/codex/generated/v2/PluginShareSaveResponse.d.ts +1 -0
  45. package/dist/codex/generated/v2/SkillInterface.d.ts +8 -0
  46. package/dist/codex/generated/v2/Thread.d.ts +4 -0
  47. package/dist/codex/generated/v2/ThreadItem.d.ts +8 -0
  48. package/dist/codex/generated/v2/ThreadListParams.d.ts +4 -0
  49. package/dist/codex/generated/v2/ThreadMetadataUpdateParams.d.ts +4 -0
  50. package/dist/codex/generated/v2/ThreadRealtimeStartParams.d.ts +7 -0
  51. package/dist/codex/generated/v2/index.d.ts +4 -0
  52. package/dist/daemon/probe.js +1 -1
  53. package/dist/gateway/threadList.js +6 -2
  54. package/dist/gateway/threadList.js.map +1 -1
  55. package/dist/handoff/lineageStore.d.ts +9 -2
  56. package/dist/handoff/lineageStore.js +29 -10
  57. package/dist/handoff/lineageStore.js.map +1 -1
  58. package/dist/handoff/providerEpochs.js +5 -1
  59. package/dist/handoff/providerEpochs.js.map +1 -1
  60. package/dist/handoff/service.js +49 -12
  61. package/dist/handoff/service.js.map +1 -1
  62. package/dist/runtime/dependencies.js +1 -1
  63. package/dist/store/HybridStore.d.ts +2 -0
  64. package/dist/store/HybridStore.js +4 -0
  65. package/dist/store/HybridStore.js.map +1 -1
  66. package/dist/store/sqliteStore.js +11 -1
  67. package/dist/store/sqliteStore.js.map +1 -1
  68. package/dist/store/threadFilter.d.ts +1 -0
  69. package/dist/store/threadFilter.js +14 -2
  70. package/dist/store/threadFilter.js.map +1 -1
  71. package/legal/LICENSES.md +1 -1
  72. package/legal/THIRD_PARTY_NOTICES.md +97 -96
  73. package/package.json +5 -5
@@ -3,7 +3,7 @@ import { AsyncLocalStorage } from "node:async_hooks";
3
3
  import { MetricsRegistry } from "../../observability/metrics.js";
4
4
  import { invalidParams } from "../../protocol/errors.js";
5
5
  import { classifyClaudeResult, classifyClaudeRuntimeError, } from "../resultClassifier.js";
6
- import { settingsGeneration, withSettingsFrom } from "../../store/HybridStore.js";
6
+ import { runtimeWorkspaceRoots, settingsGeneration, withSettingsFrom } from "../../store/HybridStore.js";
7
7
  import { addUsage } from "./usage.js";
8
8
  import { ClaudeMailbox, createDeferred, } from "./mailbox.js";
9
9
  import { remapBoundaries } from "./repository.js";
@@ -27,6 +27,7 @@ import { StaleClaudeRuntimeSettingsError, createProviderRuntime, providerPermiss
27
27
  import { isRetryableClaudeRuntimeStartupError, } from "./providerRuntime.js";
28
28
  import { assistantHasTools, backgroundOutputFile, backgroundTaskId, isNoQueryAcknowledgement, serverToolResult, toolResults, } from "./providerFacts.js";
29
29
  import { normalizeClaudeModelIdentifier } from "../modelSelection.js";
30
+ import { StreamingFileChangePreview } from "../streamingFilePreview.js";
30
31
  const nullSource = { providerEventId: null, providerEventType: null };
31
32
  const providerJournalMaxEvents = 20_000;
32
33
  const providerJournalMaxBytes = 256 * 1_024 * 1_024;
@@ -564,6 +565,7 @@ export class ClaudeSession {
564
565
  providerSessionId: record.claudeSessionId,
565
566
  resume: resumeOverride ?? record.lastClaudeMessageUuid !== null,
566
567
  cwd: record.thread.cwd,
568
+ runtimeWorkspaceRoots: runtimeWorkspaceRoots(record),
567
569
  ephemeral: record.thread.ephemeral,
568
570
  persistSession: !record.thread.ephemeral || Boolean(this.runtimeDependencies.persistUserSideSessions
569
571
  && !record.thread.parentThreadId
@@ -593,6 +595,7 @@ export class ClaudeSession {
593
595
  const projection = {
594
596
  context: new AsyncLocalStorage(),
595
597
  processEpoch: uuidv7(),
598
+ filePreviews: new Map(),
596
599
  providerSequence: 0,
597
600
  };
598
601
  try {
@@ -1761,6 +1764,37 @@ export class ClaudeSession {
1761
1764
  fact,
1762
1765
  });
1763
1766
  }
1767
+ async applyProviderToolInput(projection, runtimeGeneration, index, delta, ownerThreadId = this.threadId) {
1768
+ const projected = await this.applyProviderMainStream(projection, runtimeGeneration, {
1769
+ kind: "toolInput", index, delta,
1770
+ }, ownerThreadId);
1771
+ const tool = projected?.tool;
1772
+ if (tool?.name !== "Write" && tool?.name !== "Edit")
1773
+ return;
1774
+ const key = `${ownerThreadId}\0${index}`;
1775
+ let state = projection.filePreviews.get(key);
1776
+ if (!state) {
1777
+ state = { providerId: tool.providerId, preview: new StreamingFileChangePreview(tool.name, tool.cwd) };
1778
+ projection.filePreviews.set(key, state);
1779
+ }
1780
+ const change = await state.preview.push(delta);
1781
+ if (change)
1782
+ await this.applyProviderMainStream(projection, runtimeGeneration, {
1783
+ kind: "toolFiles", providerId: state.providerId, changes: [change],
1784
+ }, ownerThreadId);
1785
+ }
1786
+ async finishProviderToolInput(projection, runtimeGeneration, index, ownerThreadId = this.threadId) {
1787
+ const key = `${ownerThreadId}\0${index}`;
1788
+ const state = projection.filePreviews.get(key);
1789
+ if (!state)
1790
+ return;
1791
+ projection.filePreviews.delete(key);
1792
+ const change = await state.preview.finish();
1793
+ if (change)
1794
+ await this.applyProviderMainStream(projection, runtimeGeneration, {
1795
+ kind: "toolFiles", providerId: state.providerId, changes: [change],
1796
+ }, ownerThreadId);
1797
+ }
1764
1798
  async canUseProviderTool(projection, runtimeGeneration, name, input, options) {
1765
1799
  const context = await this.providerCallbackContext(runtimeGeneration);
1766
1800
  if (!context)
@@ -2182,15 +2216,12 @@ export class ClaudeSession {
2182
2216
  }, childThreadId);
2183
2217
  }
2184
2218
  else if (event.delta.type === "input_json_delta") {
2185
- await this.applyProviderMainStream(projection, runtimeGeneration, {
2186
- kind: "toolInput",
2187
- index: event.index,
2188
- delta: event.delta.partial_json,
2189
- }, childThreadId);
2219
+ await this.applyProviderToolInput(projection, runtimeGeneration, event.index, event.delta.partial_json, childThreadId);
2190
2220
  }
2191
2221
  return;
2192
2222
  }
2193
2223
  if (event.type === "content_block_stop") {
2224
+ await this.finishProviderToolInput(projection, runtimeGeneration, event.index, childThreadId);
2194
2225
  await this.applyProviderMainStream(projection, runtimeGeneration, { kind: "blockStop", index: event.index }, childThreadId);
2195
2226
  }
2196
2227
  }
@@ -2509,15 +2540,12 @@ export class ClaudeSession {
2509
2540
  });
2510
2541
  }
2511
2542
  else if (event.delta.type === "input_json_delta") {
2512
- await this.applyProviderMainStream(projection, runtimeGeneration, {
2513
- kind: "toolInput",
2514
- index: event.index,
2515
- delta: event.delta.partial_json,
2516
- });
2543
+ await this.applyProviderToolInput(projection, runtimeGeneration, event.index, event.delta.partial_json);
2517
2544
  }
2518
2545
  return;
2519
2546
  }
2520
2547
  if (event.type === "content_block_stop") {
2548
+ await this.finishProviderToolInput(projection, runtimeGeneration, event.index);
2521
2549
  await this.applyProviderMainStream(projection, runtimeGeneration, { kind: "blockStop", index: event.index });
2522
2550
  }
2523
2551
  }
@@ -4034,6 +4062,7 @@ export class ClaudeSession {
4034
4062
  reason: command.runtimeGeneration === this.runtimeGeneration ? "settings" : "runtime",
4035
4063
  settings: {
4036
4064
  cwd: record.thread.cwd,
4065
+ runtimeWorkspaceRoots: runtimeWorkspaceRoots(record),
4037
4066
  model: record.claudeModelValue,
4038
4067
  settingsGeneration: settingsGeneration(record),
4039
4068
  approvalPolicy: record.approvalPolicy,
@@ -4546,6 +4575,8 @@ export class ClaudeSession {
4546
4575
  const item = {
4547
4576
  type: "commandExecution",
4548
4577
  id: uuidv7(),
4578
+ pluginId: null,
4579
+ scriptPath: null,
4549
4580
  command,
4550
4581
  cwd: record.thread.cwd,
4551
4582
  processId: null,
@@ -5772,6 +5803,9 @@ export class ClaudeSession {
5772
5803
  throw invalidParams(`Claude thread '${this.threadId}' has an active ${this.adminOperation.kind} operation.`);
5773
5804
  }
5774
5805
  const record = this.requireRecord(false);
5806
+ if (record.thread.ephemeral && command.isPinned !== undefined && command.isPinned !== null) {
5807
+ throw invalidParams("Ephemeral Claude side chats cannot be pinned.");
5808
+ }
5775
5809
  const previous = record.thread.gitInfo ?? { sha: null, branch: null, originUrl: null };
5776
5810
  const patch = command.gitInfo;
5777
5811
  const gitInfo = patch === null ? null : patch === undefined ? record.thread.gitInfo : {
@@ -5781,7 +5815,12 @@ export class ClaudeSession {
5781
5815
  };
5782
5816
  const updated = {
5783
5817
  ...record,
5784
- thread: { ...record.thread, gitInfo, updatedAt: Math.floor(Date.now() / 1_000) },
5818
+ thread: {
5819
+ ...record.thread,
5820
+ gitInfo,
5821
+ isPinned: command.isPinned ?? record.thread.isPinned,
5822
+ updatedAt: Math.floor(Date.now() / 1_000),
5823
+ },
5785
5824
  };
5786
5825
  this.repository.update(updated);
5787
5826
  this.record = updated;