@skaile/workspaces 0.9.1 → 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 (67) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/base-assets/connectors/flow/run-flow.js +1 -1
  3. package/dist/bridge/drivers/claude-sdk.js +53 -3
  4. package/dist/bridge/drivers/claude-sdk.js.map +1 -1
  5. package/dist/bridge/drivers/codex.js +1 -1
  6. package/dist/bridge/drivers/echo.js +1 -1
  7. package/dist/bridge/drivers/omp.js +1 -1
  8. package/dist/bridge/index.js +2 -2
  9. package/dist/bridge/src/drivers/claude-sdk.d.ts +23 -0
  10. package/dist/bridge/src/drivers/claude-sdk.d.ts.map +1 -1
  11. package/dist/{chunk-QZ6PY73K.js → chunk-BYZI6FMB.js} +17 -22
  12. package/dist/chunk-BYZI6FMB.js.map +1 -0
  13. package/dist/{chunk-TODD4VNR.js → chunk-D3VO6WNC.js} +85 -3
  14. package/dist/chunk-D3VO6WNC.js.map +1 -0
  15. package/dist/{chunk-DTL7S57T.js → chunk-NPNRWHCU.js} +2 -2
  16. package/dist/{chunk-DTL7S57T.js.map → chunk-NPNRWHCU.js.map} +1 -1
  17. package/dist/{chunk-K3TMZI6D.js → chunk-OSJH4SPO.js} +3 -3
  18. package/dist/{chunk-K3TMZI6D.js.map → chunk-OSJH4SPO.js.map} +1 -1
  19. package/dist/{chunk-AE6GCXGL.js → chunk-S7RACIZI.js} +2 -2
  20. package/dist/{chunk-AE6GCXGL.js.map → chunk-S7RACIZI.js.map} +1 -1
  21. package/dist/{chunk-O5AE4QDX.js → chunk-TDSRLMDB.js} +4 -4
  22. package/dist/chunk-TDSRLMDB.js.map +1 -0
  23. package/dist/chunk-W3UDISS2.js +31 -0
  24. package/dist/chunk-W3UDISS2.js.map +1 -0
  25. package/dist/{chunk-5IC6CJL4.js → chunk-YWQ3NGCS.js} +2 -2
  26. package/dist/{chunk-5IC6CJL4.js.map → chunk-YWQ3NGCS.js.map} +1 -1
  27. package/dist/cli/index.js +8 -7
  28. package/dist/cli/index.js.map +1 -1
  29. package/dist/runner/index.js +6 -5
  30. package/dist/runner/prompt-assembly.js +4 -0
  31. package/dist/runner/prompt-assembly.js.map +1 -0
  32. package/dist/runner/src/capability-registry.d.ts.map +1 -1
  33. package/dist/runner/src/capability-roundtrip.d.ts +18 -0
  34. package/dist/runner/src/capability-roundtrip.d.ts.map +1 -1
  35. package/dist/runner/src/define-capability.d.ts +7 -0
  36. package/dist/runner/src/define-capability.d.ts.map +1 -1
  37. package/dist/runner/src/prompt-assembly.d.ts +39 -0
  38. package/dist/runner/src/prompt-assembly.d.ts.map +1 -1
  39. package/dist/runner/src/serve.d.ts.map +1 -1
  40. package/dist/sdk/bridge.js +2 -2
  41. package/dist/sdk/index.js +6 -5
  42. package/dist/sdk/index.js.map +1 -1
  43. package/dist/sdk/runner.js +6 -5
  44. package/dist/sdk/session.js +2 -2
  45. package/dist/sdk/types.js +1 -1
  46. package/dist/session/index.js +2 -2
  47. package/dist/session/src/dispatcher.d.ts +57 -0
  48. package/dist/session/src/dispatcher.d.ts.map +1 -1
  49. package/dist/{setup-PHFPBDBI.js → setup-QIEPIYH2.js} +4 -4
  50. package/dist/{setup-PHFPBDBI.js.map → setup-QIEPIYH2.js.map} +1 -1
  51. package/dist/tui/index.js +6 -5
  52. package/dist/tui/index.js.map +1 -1
  53. package/dist/types/index.js +1 -1
  54. package/dist/types/src/capabilities.d.ts +13 -0
  55. package/dist/types/src/capabilities.d.ts.map +1 -1
  56. package/dist/types/src/events.d.ts +29 -1
  57. package/dist/types/src/events.d.ts.map +1 -1
  58. package/dist/types/src/index.d.ts +1 -1
  59. package/dist/types/src/index.d.ts.map +1 -1
  60. package/dist/types/src/version.d.ts +19 -1
  61. package/dist/types/src/version.d.ts.map +1 -1
  62. package/dist/workspace-plugin/adapters/mcp.js +2 -2
  63. package/dist/workspace-plugin/index.js +1 -1
  64. package/package.json +7 -1
  65. package/dist/chunk-O5AE4QDX.js.map +0 -1
  66. package/dist/chunk-QZ6PY73K.js.map +0 -1
  67. package/dist/chunk-TODD4VNR.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - eb14ab2: Add runtime support for agent-to-agent (session-to-session) communication:
8
+ - New `a2a_message` event kind in the agent event union.
9
+ - `SessionDispatcher.onceNextFinished` — a one-shot hook that resolves on the
10
+ session's next finished assistant turn, used to capture a peer's answer to a
11
+ synchronous `ask`.
12
+ - `SessionDispatcher.deliverPrompt` — delivers a turn-triggering prompt without
13
+ persisting it to the message store (A2A message persistence is owned by the
14
+ caller).
15
+ - Per-capability `callTimeoutMs` on the capability definition + wire format, so
16
+ a long-running capability call (e.g. a 5-minute `ask_session`) can exceed the
17
+ default capability-call timeout.
18
+ - `buildLinkedPeersPromptSection` — renders a `<LINKED_PEERS>` system-prompt
19
+ block from a session's linked peers, exported via the new
20
+ `@skaile/workspaces/runner/prompt-assembly` subpath.
21
+ - `PROTOCOL_VERSION` bumped to `3.3.0` for the additive A2A wire surface
22
+ (`a2a_message` event + capability `callTimeoutMs`); also backfills the
23
+ `3.2.0` changelog entry for the previously-undocumented resume cascade.
24
+
3
25
  ## 0.9.1
4
26
 
5
27
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- export { resumeFlow, runFlow } from '../../../chunk-DTL7S57T.js';
1
+ export { resumeFlow, runFlow } from '../../../chunk-NPNRWHCU.js';
2
2
  import '../../../chunk-GCJXPUHG.js';
3
3
  import '../../../chunk-IPUYL6TD.js';
4
4
  import '../../../chunk-EPGHAOEU.js';
@@ -1,7 +1,7 @@
1
1
  import { classifyClaudeSdkError, AuthError } from '../../chunk-EWP5HZBV.js';
2
2
  import { fetchProviderModels } from '../../chunk-KOVLSBXK.js';
3
3
  import { dispatchCapability } from '../../chunk-RRVQAE5D.js';
4
- import { registerDriver, DRIVER_CATALOG, AgentDriver, getBridgeLogger } from '../../chunk-AE6GCXGL.js';
4
+ import { registerDriver, DRIVER_CATALOG, AgentDriver, getBridgeLogger } from '../../chunk-S7RACIZI.js';
5
5
  import '../../chunk-24UIWON4.js';
6
6
  import '../../chunk-NSBPE2FW.js';
7
7
  import { spawnSync } from 'child_process';
@@ -367,9 +367,8 @@ var ClaudeSdkDriver = class extends AgentDriver {
367
367
  const isPoisonedHistory = _retryCount === 0 && /invalid_request_error/i.test(errMsg) && /media[_ ]?type|could not process image|image exceeds|cache_control/i.test(errMsg);
368
368
  const poisonSessionId = this.config.resumeSessionId || this.sessionId;
369
369
  if (isPoisonedHistory && poisonSessionId) {
370
- const configDir = this.config.env?.CLAUDE_CONFIG_DIR || process.env.CLAUDE_CONFIG_DIR || join(homedir(), ".claude");
371
370
  const scrub = scrubPoisonedTranscript({
372
- configDir,
371
+ configDir: this.resolveClaudeConfigDir(),
373
372
  sessionId: poisonSessionId,
374
373
  log: this.log
375
374
  });
@@ -450,8 +449,59 @@ var ClaudeSdkDriver = class extends AgentDriver {
450
449
  }
451
450
  }
452
451
  }
452
+ /**
453
+ * Resolve the Claude Code config directory — the parent of `projects/` — from
454
+ * the driver config, the process environment, or the `~/.claude` default.
455
+ */
456
+ resolveClaudeConfigDir() {
457
+ return this.config.env?.CLAUDE_CONFIG_DIR || process.env.CLAUDE_CONFIG_DIR || join(homedir(), ".claude");
458
+ }
459
+ /**
460
+ * Preventively repair the on-disk SDK transcript before a resume.
461
+ *
462
+ * The reactive {@link scrubPoisonedTranscript} pass in `prompt()` only fires
463
+ * *after* a turn has already failed with a `400 invalid_request_error`,
464
+ * costing a wasted round-trip and surfacing a scary (if non-fatal) error to
465
+ * the user. A transcript poisoned in a prior driver lifetime — most commonly
466
+ * an image block whose `media_type` does not match its bytes, produced by the
467
+ * Claude Code `Read` tool on a PDF with embedded JPEGs (anthropics/claude-code
468
+ * #55338) — would otherwise 400 on the very first resumed turn.
469
+ *
470
+ * Running the same magic-byte scrub *before* handing the transcript to the
471
+ * SDK means a known poison class never reaches the API, so recovery is
472
+ * invisible. This is regex-free (unlike the reactive gate) and idempotent: a
473
+ * clean transcript is left byte-for-byte untouched. The reactive path remains
474
+ * the safety net for poison introduced mid-turn within the current lifetime.
475
+ */
476
+ preventivelyScrubTranscript() {
477
+ const sessionId = this.config.resumeSessionId || this.sessionId;
478
+ if (!sessionId) {
479
+ return;
480
+ }
481
+ try {
482
+ const scrub = scrubPoisonedTranscript({
483
+ configDir: this.resolveClaudeConfigDir(),
484
+ sessionId,
485
+ log: this.log
486
+ });
487
+ if (scrub.changed) {
488
+ this.log.warn("preventively scrubbed poisoned Claude Code transcript before resume", {
489
+ sessionId,
490
+ corrected: scrub.corrected,
491
+ stubbed: scrub.stubbed,
492
+ cacheStripped: scrub.cacheStripped
493
+ });
494
+ }
495
+ } catch (err) {
496
+ this.log.warn("preventive transcript scrub failed; continuing", {
497
+ sessionId,
498
+ error: err instanceof Error ? err.message : String(err)
499
+ });
500
+ }
501
+ }
453
502
  async startQuery(message) {
454
503
  this.abortController = new AbortController();
504
+ this.preventivelyScrubTranscript();
455
505
  const apiKey = this.config.apiKeys?.anthropic || this.config.env?.ANTHROPIC_API_KEY || process.env.ANTHROPIC_API_KEY;
456
506
  this.usingOauthCredential = !apiKey;
457
507
  const claudePath = this.findClaudeBinary();