@skaile/workspaces 6.7.0 → 6.8.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 (175) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/app-sdk/index.js +1 -1
  3. package/dist/{asset-feeds-4A7PJ4OB.js → asset-feeds-NU5UOO5F.js} +6 -6
  4. package/dist/{asset-feeds-4A7PJ4OB.js.map → asset-feeds-NU5UOO5F.js.map} +1 -1
  5. package/dist/asset-manager/index.js +1 -1
  6. package/dist/bridge/harnesses/claude-sdk.js +18 -10
  7. package/dist/bridge/harnesses/claude-sdk.js.map +1 -1
  8. package/dist/bridge/harnesses/codex.js +3 -3
  9. package/dist/bridge/harnesses/continue.js +4 -4
  10. package/dist/bridge/harnesses/echo.js +4 -4
  11. package/dist/bridge/harnesses/gemini.js +5 -5
  12. package/dist/bridge/harnesses/goose.js +4 -4
  13. package/dist/bridge/harnesses/omp.js +6 -6
  14. package/dist/bridge/harnesses/opencode.js +4 -4
  15. package/dist/bridge/harnesses/qwen.js +5 -5
  16. package/dist/bridge/index.js +9 -9
  17. package/dist/bridge/src/harnesses/claude-sdk.d.ts.map +1 -1
  18. package/dist/bridge/src/harnesses/claude-self-turns.d.ts.map +1 -1
  19. package/dist/bridge/src/types.d.ts +11 -0
  20. package/dist/bridge/src/types.d.ts.map +1 -1
  21. package/dist/{chunk-ZM4SDVUV.js → chunk-2I5HNM7K.js} +8 -8
  22. package/dist/{chunk-ZM4SDVUV.js.map → chunk-2I5HNM7K.js.map} +1 -1
  23. package/dist/{chunk-L3JQJ6D5.js → chunk-3NJFPGEB.js} +4 -4
  24. package/dist/{chunk-L3JQJ6D5.js.map → chunk-3NJFPGEB.js.map} +1 -1
  25. package/dist/{chunk-3W6XZQ2Y.js → chunk-3QX2X77G.js} +3 -3
  26. package/dist/{chunk-3W6XZQ2Y.js.map → chunk-3QX2X77G.js.map} +1 -1
  27. package/dist/{chunk-L7QOZG5V.js → chunk-5TLMHB2U.js} +3 -3
  28. package/dist/{chunk-L7QOZG5V.js.map → chunk-5TLMHB2U.js.map} +1 -1
  29. package/dist/{chunk-KORDNXKA.js → chunk-6PVRP3LW.js} +36 -5
  30. package/dist/chunk-6PVRP3LW.js.map +1 -0
  31. package/dist/{chunk-HPXONAI2.js → chunk-6ZM5X2XW.js} +3 -3
  32. package/dist/{chunk-HPXONAI2.js.map → chunk-6ZM5X2XW.js.map} +1 -1
  33. package/dist/{chunk-ZDTDS62B.js → chunk-757G6TTZ.js} +2 -2
  34. package/dist/{chunk-ZDTDS62B.js.map → chunk-757G6TTZ.js.map} +1 -1
  35. package/dist/{chunk-ASBZOTEO.js → chunk-7NN3P6VF.js} +22 -5
  36. package/dist/chunk-7NN3P6VF.js.map +1 -0
  37. package/dist/{chunk-OGTQUEAO.js → chunk-7YOHUX2M.js} +5 -5
  38. package/dist/{chunk-OGTQUEAO.js.map → chunk-7YOHUX2M.js.map} +1 -1
  39. package/dist/{chunk-NURTGAWM.js → chunk-BRPEW3UL.js} +3 -3
  40. package/dist/{chunk-NURTGAWM.js.map → chunk-BRPEW3UL.js.map} +1 -1
  41. package/dist/{chunk-WKENHNDM.js → chunk-DRHJRTAS.js} +3 -3
  42. package/dist/{chunk-WKENHNDM.js.map → chunk-DRHJRTAS.js.map} +1 -1
  43. package/dist/{chunk-72TLO2AG.js → chunk-E3KABQS3.js} +3 -3
  44. package/dist/{chunk-72TLO2AG.js.map → chunk-E3KABQS3.js.map} +1 -1
  45. package/dist/{chunk-WIYVR24B.js → chunk-HKRME377.js} +3 -3
  46. package/dist/{chunk-WIYVR24B.js.map → chunk-HKRME377.js.map} +1 -1
  47. package/dist/{chunk-4C2E5QUP.js → chunk-I6XH46Q6.js} +3 -3
  48. package/dist/{chunk-4C2E5QUP.js.map → chunk-I6XH46Q6.js.map} +1 -1
  49. package/dist/{chunk-Q2NYTMT6.js → chunk-K6HCOTOZ.js} +5 -5
  50. package/dist/{chunk-Q2NYTMT6.js.map → chunk-K6HCOTOZ.js.map} +1 -1
  51. package/dist/{chunk-6RPS7JEH.js → chunk-K7ZGY2BY.js} +273 -26
  52. package/dist/chunk-K7ZGY2BY.js.map +1 -0
  53. package/dist/{chunk-37X4A6VZ.js → chunk-KHWGUXSF.js} +4 -4
  54. package/dist/{chunk-37X4A6VZ.js.map → chunk-KHWGUXSF.js.map} +1 -1
  55. package/dist/{chunk-LX4TTTRR.js → chunk-LJ6PLEDU.js} +6 -6
  56. package/dist/{chunk-LX4TTTRR.js.map → chunk-LJ6PLEDU.js.map} +1 -1
  57. package/dist/{chunk-GAIMSCZ7.js → chunk-LL5GMUQG.js} +6 -6
  58. package/dist/{chunk-GAIMSCZ7.js.map → chunk-LL5GMUQG.js.map} +1 -1
  59. package/dist/{chunk-UCB7FK25.js → chunk-NW7Y5SNK.js} +4 -4
  60. package/dist/{chunk-UCB7FK25.js.map → chunk-NW7Y5SNK.js.map} +1 -1
  61. package/dist/{chunk-PLLZSKOO.js → chunk-ORXV3UB6.js} +3 -3
  62. package/dist/{chunk-PLLZSKOO.js.map → chunk-ORXV3UB6.js.map} +1 -1
  63. package/dist/{chunk-CTRTFMCX.js → chunk-PMZMG3HC.js} +3 -3
  64. package/dist/{chunk-CTRTFMCX.js.map → chunk-PMZMG3HC.js.map} +1 -1
  65. package/dist/{chunk-J7VEQORJ.js → chunk-Q6FKWPRO.js} +5 -5
  66. package/dist/{chunk-J7VEQORJ.js.map → chunk-Q6FKWPRO.js.map} +1 -1
  67. package/dist/{chunk-AO57IFME.js → chunk-QGA2OBUJ.js} +3 -3
  68. package/dist/{chunk-AO57IFME.js.map → chunk-QGA2OBUJ.js.map} +1 -1
  69. package/dist/{chunk-RAHAZ7LP.js → chunk-RDIGVPXX.js} +2 -2
  70. package/dist/{chunk-RAHAZ7LP.js.map → chunk-RDIGVPXX.js.map} +1 -1
  71. package/dist/{chunk-U52FYGK5.js → chunk-REAF7ZFA.js} +4 -4
  72. package/dist/{chunk-U52FYGK5.js.map → chunk-REAF7ZFA.js.map} +1 -1
  73. package/dist/{chunk-XON6ODIC.js → chunk-SILFO5RY.js} +2 -2
  74. package/dist/{chunk-XON6ODIC.js.map → chunk-SILFO5RY.js.map} +1 -1
  75. package/dist/{chunk-BKLDBUQA.js → chunk-XCGDRLMH.js} +3 -3
  76. package/dist/{chunk-BKLDBUQA.js.map → chunk-XCGDRLMH.js.map} +1 -1
  77. package/dist/{chunk-HMVAGPYR.js → chunk-XIIIGLSL.js} +9 -9
  78. package/dist/{chunk-HMVAGPYR.js.map → chunk-XIIIGLSL.js.map} +1 -1
  79. package/dist/{chunk-N6ZGB5ES.js → chunk-Y6LC5PEZ.js} +3 -3
  80. package/dist/{chunk-N6ZGB5ES.js.map → chunk-Y6LC5PEZ.js.map} +1 -1
  81. package/dist/{chunk-LZPJOF7Y.js → chunk-YEOG7CWQ.js} +3 -3
  82. package/dist/{chunk-LZPJOF7Y.js.map → chunk-YEOG7CWQ.js.map} +1 -1
  83. package/dist/{chunk-IRK3LNG3.js → chunk-YGP6XEPA.js} +3 -3
  84. package/dist/{chunk-IRK3LNG3.js.map → chunk-YGP6XEPA.js.map} +1 -1
  85. package/dist/{chunk-37AYPPOO.js → chunk-YHNPWSSH.js} +8 -8
  86. package/dist/{chunk-37AYPPOO.js.map → chunk-YHNPWSSH.js.map} +1 -1
  87. package/dist/{chunk-TXX3OUYI.js → chunk-YZD7DUEF.js} +3 -3
  88. package/dist/{chunk-TXX3OUYI.js.map → chunk-YZD7DUEF.js.map} +1 -1
  89. package/dist/{claude-code-BLFRZU2X.js → claude-code-AESK7XO4.js} +4 -4
  90. package/dist/{claude-code-BLFRZU2X.js.map → claude-code-AESK7XO4.js.map} +1 -1
  91. package/dist/cli/index.js +55 -55
  92. package/dist/connectors/index.js +11 -11
  93. package/dist/{connectors-OJJU4LSN.js → connectors-5ZZRVAPD.js} +14 -14
  94. package/dist/{connectors-OJJU4LSN.js.map → connectors-5ZZRVAPD.js.map} +1 -1
  95. package/dist/connectors-shared/index.js +2 -2
  96. package/dist/{ensure-sources-F6VQDCWY.js → ensure-sources-VLJ7AUUK.js} +13 -13
  97. package/dist/{ensure-sources-F6VQDCWY.js.map → ensure-sources-VLJ7AUUK.js.map} +1 -1
  98. package/dist/factory-assets/connectors/box.js +11 -11
  99. package/dist/factory-assets/connectors/deploy.js +11 -11
  100. package/dist/factory-assets/connectors/devserver.js +11 -11
  101. package/dist/factory-assets/connectors/flow/adapter.js +11 -11
  102. package/dist/factory-assets/connectors/flow/contract/schema.d.ts +3 -3
  103. package/dist/factory-assets/connectors/flow/run-flow.js +12 -12
  104. package/dist/factory-assets/connectors/flow.js +11 -11
  105. package/dist/factory-assets/connectors/git.js +11 -11
  106. package/dist/factory-assets/connectors/gmail.js +11 -11
  107. package/dist/factory-assets/connectors/googledrive.js +11 -11
  108. package/dist/factory-assets/connectors/local.js +11 -11
  109. package/dist/factory-assets/connectors/mattermost.js +11 -11
  110. package/dist/factory-assets/connectors/memory.js +11 -11
  111. package/dist/factory-assets/connectors/minio.js +11 -11
  112. package/dist/factory-assets/connectors/postgres.js +11 -11
  113. package/dist/factory-assets/connectors/s3.js +11 -11
  114. package/dist/factory-assets/connectors/sharepoint.js +11 -11
  115. package/dist/factory-assets/connectors/sqlite.js +11 -11
  116. package/dist/factory-assets/connectors/static-server.js +11 -11
  117. package/dist/factory-assets/connectors/tunnel.js +11 -11
  118. package/dist/factory-assets/connectors/webdav.js +11 -11
  119. package/dist/factory-assets/connectors/xstate-store.js +11 -11
  120. package/dist/factory-assets/connectors/xstate.js +11 -11
  121. package/dist/{helpers-PJNUTZXZ.js → helpers-APXGTZ5A.js} +13 -13
  122. package/dist/{helpers-PJNUTZXZ.js.map → helpers-APXGTZ5A.js.map} +1 -1
  123. package/dist/{library-publish-FNNDWVBO.js → library-publish-B5HL4OBE.js} +27 -27
  124. package/dist/{library-publish-FNNDWVBO.js.map → library-publish-B5HL4OBE.js.map} +1 -1
  125. package/dist/model-endpoint/index.js +3 -3
  126. package/dist/{open-library-R5EZROFN.js → open-library-F56D46K7.js} +14 -14
  127. package/dist/{open-library-R5EZROFN.js.map → open-library-F56D46K7.js.map} +1 -1
  128. package/dist/{project-S2FT3LLR.js → project-GLTP6VFV.js} +23 -23
  129. package/dist/{project-S2FT3LLR.js.map → project-GLTP6VFV.js.map} +1 -1
  130. package/dist/runner/index.js +17 -17
  131. package/dist/runner/src/capability-roundtrip.d.ts +2 -1
  132. package/dist/runner/src/capability-roundtrip.d.ts.map +1 -1
  133. package/dist/runner/src/serve.d.ts.map +1 -1
  134. package/dist/runner/src/turn-scheduler.d.ts +8 -0
  135. package/dist/runner/src/turn-scheduler.d.ts.map +1 -1
  136. package/dist/runner/src/turn-visibility.d.ts +97 -0
  137. package/dist/runner/src/turn-visibility.d.ts.map +1 -0
  138. package/dist/sdk/asset-manager.js +1 -1
  139. package/dist/sdk/bridge.js +9 -9
  140. package/dist/sdk/index.js +17 -17
  141. package/dist/sdk/runner.js +17 -17
  142. package/dist/sdk/session.js +2 -2
  143. package/dist/sdk/types.js +1 -1
  144. package/dist/{serve-preflight-AADSOUO2.js → serve-preflight-EHLBSNUE.js} +15 -15
  145. package/dist/{serve-preflight-AADSOUO2.js.map → serve-preflight-EHLBSNUE.js.map} +1 -1
  146. package/dist/session/index.js +2 -2
  147. package/dist/session/src/dispatcher.d.ts.map +1 -1
  148. package/dist/{setup-HOAJHUFQ.js → setup-PMZLMFCD.js} +14 -14
  149. package/dist/{setup-HOAJHUFQ.js.map → setup-PMZLMFCD.js.map} +1 -1
  150. package/dist/{source-FOELFCY6.js → source-QNSGAM3S.js} +24 -24
  151. package/dist/{source-FOELFCY6.js.map → source-QNSGAM3S.js.map} +1 -1
  152. package/dist/{source-manifest-publish-Q7P5AEVU.js → source-manifest-publish-AI725AVE.js} +26 -26
  153. package/dist/{source-manifest-publish-Q7P5AEVU.js.map → source-manifest-publish-AI725AVE.js.map} +1 -1
  154. package/dist/tui/index.js +17 -17
  155. package/dist/types/index.js +1 -1
  156. package/dist/types/src/capabilities.d.ts +3 -2
  157. package/dist/types/src/capabilities.d.ts.map +1 -1
  158. package/dist/types/src/events.d.ts +11 -10
  159. package/dist/types/src/events.d.ts.map +1 -1
  160. package/dist/types/src/index.d.ts +2 -0
  161. package/dist/types/src/index.d.ts.map +1 -1
  162. package/dist/types/src/manifests/preset.d.ts +5 -5
  163. package/dist/types/src/protocol.d.ts +3 -0
  164. package/dist/types/src/protocol.d.ts.map +1 -1
  165. package/dist/types/src/turn-visibility.d.ts +50 -0
  166. package/dist/types/src/turn-visibility.d.ts.map +1 -0
  167. package/dist/types/src/version.d.ts +14 -1
  168. package/dist/types/src/version.d.ts.map +1 -1
  169. package/dist/workspace-plugin/adapters/mcp.js +13 -13
  170. package/dist/workspace-plugin/adapters/omp.js +7 -7
  171. package/dist/workspace-plugin/index.js +1 -1
  172. package/package.json +1 -1
  173. package/dist/chunk-6RPS7JEH.js.map +0 -1
  174. package/dist/chunk-ASBZOTEO.js.map +0 -1
  175. package/dist/chunk-KORDNXKA.js.map +0 -1
@@ -1,27 +1,27 @@
1
- import { WorkspacePlugin } from './chunk-RAHAZ7LP.js';
2
- import { buildWorkspaceToolDefs } from './chunk-37X4A6VZ.js';
1
+ import { WorkspacePlugin } from './chunk-RDIGVPXX.js';
2
+ import { buildWorkspaceToolDefs } from './chunk-KHWGUXSF.js';
3
3
  import { findAiAssetsRoot } from './chunk-HQAPUPBE.js';
4
- import { startModelEndpoint } from './chunk-U52FYGK5.js';
4
+ import { startModelEndpoint } from './chunk-REAF7ZFA.js';
5
5
  import { WebSocketServerTransport } from './chunk-HLAEYFUN.js';
6
6
  import { assembleSystemPrompt, buildCapabilitiesPromptSection } from './chunk-W3UDISS2.js';
7
7
  import { prepareNativePolicy, codexInstanceEnvironment, parseCodexCredential, parseCodexRefreshInput, parseCodexRefreshResult } from './chunk-CMXDFTA2.js';
8
- import { resolveFlowPath } from './chunk-IRK3LNG3.js';
8
+ import { resolveFlowPath } from './chunk-YGP6XEPA.js';
9
9
  import { findAiAssetsRoot as findAiAssetsRoot$1, deployCatalogEntry, undeployCatalogEntry } from './chunk-USSP43U3.js';
10
- import { ConnectFailureCarryOver, registerBuiltinConnectors, listConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, buildSdkConnectorTools, buildLazySdkFlowTools, describeFlowOperations, buildConnectorToolDefs, writeUserGitconfigInclude, buildFlowToolDefs, SessionNodeExecutor, SessionSubpromptRunner, ClassifierSubpromptRunner, SessionInlineSubFlowRunner, driveOrchestratorTurn, buildSdkFlowTools } from './chunk-LX4TTTRR.js';
10
+ import { ConnectFailureCarryOver, registerBuiltinConnectors, listConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, buildSdkConnectorTools, buildLazySdkFlowTools, describeFlowOperations, buildConnectorToolDefs, writeUserGitconfigInclude, buildFlowToolDefs, SessionNodeExecutor, SessionSubpromptRunner, ClassifierSubpromptRunner, SessionInlineSubFlowRunner, driveOrchestratorTurn, buildSdkFlowTools } from './chunk-LJ6PLEDU.js';
11
11
  import { loadYamlConnectorDeclarations, withMaterializedConnectorDeclarations, SecretProviderChain, ConnectorStartupError, isKnownSecretRef, EnvSecretProvider, PreMintedSecretProvider, InMemorySecretProvider, resolvedConfigToDeclarations, deriveSingleMaterializedConnectorDeclaration } from './chunk-ZBA4P5TD.js';
12
- import { EventNormalizer } from './chunk-HMVAGPYR.js';
13
- import { sessionSurfaceNotice, approvalCardOf, APPROVE_ONCE, DENY, probeResumeTranscript, transcriptStoreForRuntime } from './chunk-HPXONAI2.js';
14
- import { codexLoginFallbackNotice } from './chunk-N6ZGB5ES.js';
12
+ import { EventNormalizer } from './chunk-XIIIGLSL.js';
13
+ import { sessionSurfaceNotice, approvalCardOf, APPROVE_ONCE, DENY, probeResumeTranscript, transcriptStoreForRuntime } from './chunk-6ZM5X2XW.js';
14
+ import { codexLoginFallbackNotice } from './chunk-Y6LC5PEZ.js';
15
15
  import { CodexNativeStateUnavailable } from './chunk-LOO5CB5M.js';
16
- import { dispatchCapability } from './chunk-LZPJOF7Y.js';
16
+ import { dispatchCapability } from './chunk-YEOG7CWQ.js';
17
17
  import { classifyClaudeSdkError } from './chunk-5DE3DGVR.js';
18
18
  import { agentExecRequested } from './chunk-7DN6JKP2.js';
19
- import { toAgentEffort, toMergedRegistry } from './chunk-PLLZSKOO.js';
20
- import { unresolvedProviderCredentials, harnessCapabilities, createHarness, providerCredentialEnvName, registryCredentialEnv, supportsLiveToolUpdates } from './chunk-XON6ODIC.js';
19
+ import { toAgentEffort, toMergedRegistry } from './chunk-ORXV3UB6.js';
20
+ import { unresolvedProviderCredentials, harnessCapabilities, createHarness, providerCredentialEnvName, registryCredentialEnv, supportsLiveToolUpdates } from './chunk-SILFO5RY.js';
21
21
  import { catalogLayer, AI_PROVIDER_PRESETS } from './chunk-6UP2EDFN.js';
22
22
  import { loadFlow } from './chunk-WFK4MUBL.js';
23
23
  import { renderStimulusPrompt } from './chunk-WD3L5QSU.js';
24
- import { TERMINAL_AGENT_RUN_STATUSES, withActivityLabelJsonSchema, TOOL_ACTIVITY_PROMPT_SECTION, SESSION_ROOT_CONNECTOR_ID, PLATFORM_BLOCKS_RUNTIME_FEATURE, PROTOCOL_VERSION, deliveryClassOf } from './chunk-ASBZOTEO.js';
24
+ import { TURN_VISIBILITY_EVENT_TYPES, TERMINAL_AGENT_RUN_STATUSES, withActivityLabelJsonSchema, TOOL_ACTIVITY_PROMPT_SECTION, SESSION_ROOT_CONNECTOR_ID, PLATFORM_BLOCKS_RUNTIME_FEATURE, TURN_VISIBILITY_RUNTIME_FEATURE, PROTOCOL_VERSION, deliveryClassOf } from './chunk-7NN3P6VF.js';
25
25
  import { knowledgeKindProvider, scanLibraryRoot, LocalIndex } from './chunk-G44FFUMA.js';
26
26
  import { createDefaultKindRegistry } from './chunk-O5Y7VMVQ.js';
27
27
  import { parseFlowDefinition } from './chunk-JRN5QF4C.js';
@@ -7145,14 +7145,16 @@ function buildClientCapabilityHandler(args) {
7145
7145
  const gen = args.generateCallId ?? (() => `cap-${Date.now()}-${Math.floor(Math.random() * 1e9)}`);
7146
7146
  return async (input, ctx) => {
7147
7147
  const callId = ctx?.callId ?? gen();
7148
+ const refused2 = () => new Error(`Capability ${args.wire.name} refused: its readers are unknown`);
7148
7149
  if (args.wire.fireAndForget) {
7149
- args.emit({
7150
+ const sent = args.emit({
7150
7151
  type: "capability_invoked",
7151
7152
  callId,
7152
7153
  name: args.wire.name,
7153
7154
  input,
7154
7155
  invokedBy: "agent"
7155
7156
  });
7157
+ if (sent === false) throw refused2();
7156
7158
  return {};
7157
7159
  }
7158
7160
  if (args.pending.has(callId)) {
@@ -7170,13 +7172,18 @@ function buildClientCapabilityHandler(args) {
7170
7172
  );
7171
7173
  }, timeoutMs);
7172
7174
  args.pending.set(callId, { resolve: resolve5, reject, timer });
7173
- args.emit({
7175
+ const sent = args.emit({
7174
7176
  type: "capability_invoked",
7175
7177
  callId,
7176
7178
  name: args.wire.name,
7177
7179
  input,
7178
7180
  invokedBy: "agent"
7179
7181
  });
7182
+ if (sent === false) {
7183
+ clearTimeout(timer);
7184
+ args.pending.delete(callId);
7185
+ reject(refused2());
7186
+ }
7180
7187
  });
7181
7188
  };
7182
7189
  }
@@ -9721,6 +9728,7 @@ var TurnScheduler = class {
9721
9728
  this.deps.logPhase("harness_start", startedAt, { ok, attempts });
9722
9729
  }
9723
9730
  if (!endTurn) return;
9731
+ this.deps.turnVisibility?.enter(turn.visibility ?? null);
9724
9732
  this.deps.turnEnd?.begin();
9725
9733
  const endsBefore = this.turnEndReports;
9726
9734
  try {
@@ -9734,6 +9742,7 @@ var TurnScheduler = class {
9734
9742
  } finally {
9735
9743
  this.deps.turnEnd?.end();
9736
9744
  this.deps.turnEnd?.settle();
9745
+ this.deps.turnVisibility?.exit();
9737
9746
  endTurn();
9738
9747
  }
9739
9748
  }
@@ -9814,6 +9823,211 @@ function awaitAgentEnd(harness, prompt, timeoutMs) {
9814
9823
  });
9815
9824
  }
9816
9825
 
9826
+ // runner/src/turn-visibility.ts
9827
+ var AGENT_RECIPIENT = "__agent__";
9828
+ var STAMPED_TYPES = new Set(TURN_VISIBILITY_EVENT_TYPES);
9829
+ function turnVisibilityOf(cmd) {
9830
+ if (cmd.visibilityMode !== "Private") return null;
9831
+ const ids = Array.isArray(cmd.privateRecipientIds) ? cmd.privateRecipientIds : [];
9832
+ const readers = [
9833
+ ...new Set(
9834
+ ids.filter(
9835
+ (id) => typeof id === "string" && id.length > 0 && id !== AGENT_RECIPIENT
9836
+ )
9837
+ )
9838
+ ];
9839
+ if (readers.length === 0) return "no-readers";
9840
+ return { visibilityMode: "Private", privateRecipientIds: readers };
9841
+ }
9842
+ var UNKNOWN = /* @__PURE__ */ Symbol("unknown-owner");
9843
+ var MAX_TRACKED = 4096;
9844
+ var MAX_OUTSTANDING = 256;
9845
+ var PARENTLESS_CHILD_TYPES = /* @__PURE__ */ new Set([
9846
+ "capability_invoked",
9847
+ "render_invoked",
9848
+ "custom_message"
9849
+ ]);
9850
+ var QUESTION_TOOL = "AskUserQuestion";
9851
+ function intersect(a, b) {
9852
+ if (a === UNKNOWN || b === UNKNOWN) return UNKNOWN;
9853
+ if (a === null) return b;
9854
+ if (b === null) return a;
9855
+ const readers = a.privateRecipientIds.filter((id) => b.privateRecipientIds.includes(id));
9856
+ return readers.length > 0 ? { visibilityMode: "Private", privateRecipientIds: readers } : UNKNOWN;
9857
+ }
9858
+ var BoundedMap = class {
9859
+ entries = /* @__PURE__ */ new Map();
9860
+ set(key, value) {
9861
+ this.entries.delete(key);
9862
+ this.entries.set(key, value);
9863
+ if (this.entries.size > MAX_TRACKED) {
9864
+ const oldest = this.entries.keys().next().value;
9865
+ if (oldest !== void 0) this.entries.delete(oldest);
9866
+ }
9867
+ }
9868
+ resolve(key) {
9869
+ return this.entries.has(key) ? this.entries.get(key) : UNKNOWN;
9870
+ }
9871
+ };
9872
+ var WITHHELD_KEPT_FIELDS = [
9873
+ "selfStarted",
9874
+ "cancelled",
9875
+ "retrying",
9876
+ "retryReason",
9877
+ "category",
9878
+ "costUsd",
9879
+ "tokens",
9880
+ "modelUsage",
9881
+ "contextTokens",
9882
+ "contextWindow"
9883
+ ];
9884
+ var WITHHELD_ERROR_MESSAGE = "Output withheld: the people allowed to read it could not be established.";
9885
+ var TurnVisibilityStamp = class {
9886
+ current = null;
9887
+ /** The self-started turn running now, if any, and whose work it reads. */
9888
+ selfTurn = void 0;
9889
+ toolUses = new BoundedMap();
9890
+ tasks = new BoundedMap();
9891
+ /** Background tasks started and not yet settled, with their launching turn's readers. */
9892
+ running = /* @__PURE__ */ new Map();
9893
+ /** More tasks ran than {@link MAX_OUTSTANDING}: which are still running is no longer known. */
9894
+ runningOverflow = false;
9895
+ /**
9896
+ * Owner of the `AskUserQuestion` block in the raw event observed last. serve
9897
+ * normalizes and sends that event's `question` synchronously, before it
9898
+ * observes the next one.
9899
+ */
9900
+ questionOwner = void 0;
9901
+ privateSeen = false;
9902
+ /** Content events withheld so far, for the log. */
9903
+ withheldCount = 0;
9904
+ /** Stamp the prompt turn's own events until {@link exit}; `null` stamps nothing. */
9905
+ enter(visibility) {
9906
+ this.current = visibility;
9907
+ if (visibility) this.privateSeen = true;
9908
+ }
9909
+ exit() {
9910
+ this.current = null;
9911
+ }
9912
+ /**
9913
+ * Feed every raw harness event before it is normalized: it carries the ids of
9914
+ * the tool uses a turn starts and of the background tasks it launches, which
9915
+ * normalized events no longer have.
9916
+ */
9917
+ observeHarnessEvent(raw) {
9918
+ this.questionOwner = void 0;
9919
+ if (typeof raw !== "object" || raw === null) return;
9920
+ const event = raw;
9921
+ switch (event.type) {
9922
+ case "self_turn_started": {
9923
+ const ids = Array.isArray(event.taskIds) ? event.taskIds : [];
9924
+ let owner = ids.length === 0 ? UNKNOWN : null;
9925
+ for (const id of ids)
9926
+ owner = intersect(owner, typeof id === "string" ? this.tasks.resolve(id) : UNKNOWN);
9927
+ this.selfTurn = owner;
9928
+ return;
9929
+ }
9930
+ case "background_task_started":
9931
+ if (typeof event.taskId === "string") {
9932
+ const owner = this.mainOwner();
9933
+ this.remember(this.tasks, event.taskId, owner);
9934
+ if (this.running.size >= MAX_OUTSTANDING && !this.running.has(event.taskId))
9935
+ this.runningOverflow = true;
9936
+ else this.running.set(event.taskId, owner);
9937
+ }
9938
+ return;
9939
+ case "background_task_settled":
9940
+ if (typeof event.taskId === "string") this.running.delete(event.taskId);
9941
+ return;
9942
+ case "background_tasks_reset":
9943
+ this.running.clear();
9944
+ this.runningOverflow = false;
9945
+ return;
9946
+ case "tool_call":
9947
+ if (typeof event.toolCallId === "string")
9948
+ this.remember(this.toolUses, event.toolCallId, this.ownerUnder(event.parentToolUseId));
9949
+ return;
9950
+ case "message_start":
9951
+ case "message_end": {
9952
+ const message = event.message;
9953
+ if (!message) return;
9954
+ const owner = this.ownerUnder(message.parentToolUseId);
9955
+ if (Array.isArray(message.content)) {
9956
+ for (const block of message.content) {
9957
+ if (block?.type !== "tool_use") continue;
9958
+ if (typeof block.id === "string") this.remember(this.toolUses, block.id, owner);
9959
+ if (block.name === QUESTION_TOOL) this.questionOwner = owner;
9960
+ }
9961
+ }
9962
+ if (Array.isArray(message.toolCalls)) {
9963
+ for (const call of message.toolCalls) {
9964
+ if (typeof call?.id === "string") this.remember(this.toolUses, call.id, owner);
9965
+ }
9966
+ }
9967
+ return;
9968
+ }
9969
+ }
9970
+ }
9971
+ /**
9972
+ * The event as it goes on the wire: stamped with its owner's readers, or
9973
+ * `null` when it is withheld (see the class doc). `fromCapability` marks an
9974
+ * event a capability emitted whose type does not say so (a render's fallback text).
9975
+ */
9976
+ stamp(event, opts = {}) {
9977
+ const parent = event.parentToolUseId;
9978
+ const selfStarted = event.selfStarted === true;
9979
+ let owner = event.type === "question" && this.questionOwner !== void 0 ? this.questionOwner : selfStarted && typeof parent !== "string" && this.selfTurn === void 0 ? UNKNOWN : this.ownerUnder(parent);
9980
+ if (typeof parent !== "string" && (opts.fromCapability === true || PARENTLESS_CHILD_TYPES.has(event.type)))
9981
+ owner = intersect(owner, this.runningOwner());
9982
+ const terminal = event.type === "finished" || event.type === "error" && event.fatal === true && event.retrying !== true;
9983
+ if (terminal && typeof parent !== "string") this.selfTurn = void 0;
9984
+ if (!STAMPED_TYPES.has(event.type)) return event;
9985
+ if (owner === UNKNOWN) return this.privateSeen ? this.withhold(event) : event;
9986
+ if (owner === null) return event;
9987
+ const stamped = {
9988
+ visibilityMode: owner.visibilityMode,
9989
+ privateRecipientIds: [...owner.privateRecipientIds]
9990
+ };
9991
+ return { ...event, ...stamped };
9992
+ }
9993
+ /** Readers of the main thread: the prompt turn, narrowed by a self-started turn running too. */
9994
+ mainOwner() {
9995
+ return this.selfTurn === void 0 ? this.current : intersect(this.current, this.selfTurn);
9996
+ }
9997
+ /** Readers every running background task's launching turn shares; `null` when none runs. */
9998
+ runningOwner() {
9999
+ if (this.runningOverflow) return UNKNOWN;
10000
+ let owner = null;
10001
+ for (const taskOwner of this.running.values()) owner = intersect(owner, taskOwner);
10002
+ return owner;
10003
+ }
10004
+ /** Readers of work started under `parent` (a tool use id), or of the main thread without one. */
10005
+ ownerUnder(parent) {
10006
+ return typeof parent === "string" ? this.toolUses.resolve(parent) : this.mainOwner();
10007
+ }
10008
+ /** An owner that is unknown is not remembered, so the id stays unknown. */
10009
+ remember(map, id, owner) {
10010
+ if (owner !== UNKNOWN) map.set(id, owner);
10011
+ }
10012
+ withhold(event) {
10013
+ this.withheldCount += 1;
10014
+ if (event.type !== "finished" && event.type !== "error") return null;
10015
+ const kept = {};
10016
+ for (const key of WITHHELD_KEPT_FIELDS) {
10017
+ const value = event[key];
10018
+ if (value !== void 0) kept[key] = value;
10019
+ }
10020
+ if (event.type === "finished")
10021
+ return { costUsd: 0, ...kept, type: "finished", summary: "" };
10022
+ return {
10023
+ ...kept,
10024
+ type: "error",
10025
+ message: WITHHELD_ERROR_MESSAGE,
10026
+ fatal: event.fatal
10027
+ };
10028
+ }
10029
+ };
10030
+
9817
10031
  // runner/src/event-gap-buffer.ts
9818
10032
  var EVENT_GAP_BUFFER_MAX_EVENTS = 1e4;
9819
10033
  var EVENT_GAP_BUFFER_MAX_BYTES = 16 * 1024 * 1024;
@@ -13466,7 +13680,8 @@ async function startAgentServer(opts) {
13466
13680
  throw new Error("CODEX_MANAGED_BOOTSTRAP_INVALID");
13467
13681
  const supportedRuntimeFeatures = [
13468
13682
  ...managedHost ? ["codex-app-server-v1"] : [],
13469
- PLATFORM_BLOCKS_RUNTIME_FEATURE
13683
+ PLATFORM_BLOCKS_RUNTIME_FEATURE,
13684
+ TURN_VISIBILITY_RUNTIME_FEATURE
13470
13685
  ];
13471
13686
  let managedBootstrapClosed = false;
13472
13687
  const port = opts.port ?? 8080;
@@ -13562,12 +13777,19 @@ async function startAgentServer(opts) {
13562
13777
  );
13563
13778
  const turnStatus = new TurnStatusTracker();
13564
13779
  const eventGapBuffer = new EventGapBuffer();
13780
+ const turnVisibility = new TurnVisibilityStamp();
13565
13781
  const initLessRunner = !managedHost && (wsConfig.secrets?.provider ?? "env") === "env";
13566
13782
  let clientEverConnected = false;
13567
13783
  transport.onConnect(() => {
13568
13784
  clientEverConnected = true;
13569
13785
  });
13570
- function sendEvent(event) {
13786
+ function sendEvent(event, opts2) {
13787
+ const stamped = turnVisibility.stamp(event, opts2);
13788
+ if (stamped) deliverEvent(stamped);
13789
+ else log(`[serve] withheld a ${event.type} event: its readers are unknown`);
13790
+ return stamped !== null;
13791
+ }
13792
+ function deliverEvent(event) {
13571
13793
  turnStatus.observe(event);
13572
13794
  if (transport.connected) {
13573
13795
  transport.send(event);
@@ -13644,7 +13866,15 @@ async function startAgentServer(opts) {
13644
13866
  });
13645
13867
  signal?.addEventListener("abort", abort, { once: true });
13646
13868
  try {
13647
- transport.send({ type: "capability_invoked", callId, name, input, invokedBy: "agent" });
13869
+ const invoked = turnVisibility.stamp({
13870
+ type: "capability_invoked",
13871
+ callId,
13872
+ name,
13873
+ input,
13874
+ invokedBy: "agent"
13875
+ });
13876
+ if (invoked) transport.send(invoked);
13877
+ else finish(new Error(`Capability ${name} refused: its readers are unknown`));
13648
13878
  } catch (error) {
13649
13879
  finish(error);
13650
13880
  }
@@ -13831,10 +14061,9 @@ async function startAgentServer(opts) {
13831
14061
  invoke: (name, input, signal, callId) => capabilityRegistry.invoke(name, input, { sessionId, signal, callId }),
13832
14062
  onToolsChanged: (listener) => capabilityRegistry.onToolsChanged(listener),
13833
14063
  emitRender: (event) => sendEvent(event),
13834
- emitText: (text2) => sendEvent({
13835
- type: "text",
13836
- content: text2
13837
- })
14064
+ emitText: (text2) => {
14065
+ sendEvent({ type: "text", content: text2 }, { fromCapability: true });
14066
+ }
13838
14067
  };
13839
14068
  }
13840
14069
  const sessionInstanceId = opts.instanceId ?? DEFAULT_AGENT_INSTANCE_ID;
@@ -14325,7 +14554,8 @@ async function startAgentServer(opts) {
14325
14554
  },
14326
14555
  log,
14327
14556
  logPhase,
14328
- turnEnd: turnEndContract
14557
+ turnEnd: turnEndContract,
14558
+ turnVisibility
14329
14559
  });
14330
14560
  let harnessRestartChain = Promise.resolve();
14331
14561
  let toolRestartScheduler;
@@ -14340,6 +14570,7 @@ async function startAgentServer(opts) {
14340
14570
  harness.removeAllListeners("error");
14341
14571
  harness.removeAllListeners("reconfigure-rollback");
14342
14572
  harness.kill();
14573
+ turnVisibility.observeHarnessEvent({ type: "background_tasks_reset" });
14343
14574
  } catch (err) {
14344
14575
  log(
14345
14576
  `[serve] failed to retire previous harness: ${err instanceof Error ? err.message : String(err)}`
@@ -14467,6 +14698,7 @@ async function startAgentServer(opts) {
14467
14698
  liveHarnessActiveAfterTurn,
14468
14699
  event
14469
14700
  );
14701
+ turnVisibility.observeHarnessEvent(event);
14470
14702
  const normalized = normalizer.normalize(event);
14471
14703
  const turnEnded = event.type === "agent_end";
14472
14704
  for (const e of normalized) {
@@ -15672,8 +15904,17 @@ async function startAgentServer(opts) {
15672
15904
  }
15673
15905
  async function handlePrompt(cmd) {
15674
15906
  if (cmd.messageId) sendEvent({ type: "prompt_ack", messageId: cmd.messageId });
15907
+ const visibility = turnVisibilityOf(cmd);
15908
+ if (visibility === "no-readers") {
15909
+ refusePrompt(
15910
+ "Prompt refused: a private prompt must name at least one person who may read the answer.",
15911
+ { onReceipt: true }
15912
+ );
15913
+ return;
15914
+ }
15675
15915
  await turnScheduler.prompt({
15676
15916
  owner: { senderId: cmd.senderId, messageId: cmd.messageId },
15917
+ visibility,
15677
15918
  // The turn ahead may be paused on a question it can only leave through
15678
15919
  // this harness's rule for a new prompt; apply it now, not after that turn.
15679
15920
  onQueued: () => harness?.supersedePendingQuestion?.(),
@@ -15718,6 +15959,10 @@ async function startAgentServer(opts) {
15718
15959
  refusePrompt("Prompt refused: a tool allowlist cannot apply while a flow runs.");
15719
15960
  return false;
15720
15961
  }
15962
+ if (visibility) {
15963
+ refusePrompt("Prompt refused: a private message cannot stay private while a flow runs.");
15964
+ return false;
15965
+ }
15721
15966
  if (Array.isArray(cmd.platformBlocks))
15722
15967
  pendingFlowPlatformBlocks.push(...cmd.platformBlocks);
15723
15968
  return async () => {
@@ -15778,9 +16023,11 @@ async function startAgentServer(opts) {
15778
16023
  }
15779
16024
  });
15780
16025
  }
15781
- function refusePrompt(message) {
16026
+ function refusePrompt(message, opts2 = {}) {
15782
16027
  log(`[serve] ${message}`);
15783
- sendEvent({ type: "error", message, fatal: false, category: "validation" });
16028
+ const event = { type: "error", message, fatal: false, category: "validation" };
16029
+ if (opts2.onReceipt) deliverEvent(event);
16030
+ else sendEvent(event);
15784
16031
  }
15785
16032
  async function handleReply(cmd) {
15786
16033
  await turnScheduler.reply({
@@ -16470,5 +16717,5 @@ function touchSession(state) {
16470
16717
  }
16471
16718
 
16472
16719
  export { AgentRunError, CLAUDE_CODE_CREDENTIALS_KEY, COMPILE_MANIFEST_FILENAME, CONNECTOR_MUTATE_NOT_READY, CapabilityRegistry, CompileManifestEntrySchema, CompositionError, DEFAULT_CAPABILITY_CALL_TIMEOUT_MS, DEFAULT_COALESCE_MS, DEFAULT_FLOW_MUTATE_CONNECTOR_WAIT_MS, DEFAULT_MAX_FINISHED_TREES, DEFAULT_RUN_LIMITS, MOUNT_LIST_MAX_DEPTH, MOUNT_LIST_MAX_ENTRIES, MOUNT_READ_DEADLINE_FACTOR, MOUNT_READ_MAX_CHUNK_BYTES, MOUNT_STAT_BUDGET_MS, MOUNT_STAT_MAX_ENTRIES, MOUNT_TREE_OP_DEADLINE_FACTOR, MOUNT_WRITE_MAX_CHUNK_BYTES, MarkdownStreamer, PreInitRingSink, ResourceOperationError, SESSION_ROOT_WRITABLE_DIRS, SESSION_ROOT_WRITABLE_FILES, UnknownCompositionKindError, WRITE_RANGE_PARTIAL_TTL_MS, WS_AUTH_TOKEN_ENV, WS_AUTH_TOKEN_FILE_ENV, agentDefinitionExists, bootstrapCapabilityRegistry, bootstrapRunnerLogStore, buildAgentResources, buildClientCapabilityHandler, buildCompositionRunSnapshot, buildConnectorTokenMediator, buildContextSection, buildEnvironmentSection, buildResourcesAvailablePayload, buildRunnerAgentSections, buildStoreSnapshotReplay, builtinCapabilities, canonicalJson, capabilityLogInstance, capabilitySignatureInputs, clearPreInitRingSink, clearSession, compileComposition, compositionRunSnapshotPath, computeCapabilitySignature, computeDirectoryTotals, computeRevisionHash, connectorRefreshKind, createAgentSession, createCompositionContentSource, createFinalTextFallback, createFlowConnectorReadiness, createInMemoryRunStore, createManagedCodexSubpromptHarness, createRunController, createSessionStimulusBus, defineCapability, deleteSession, describeComposition, dispatchResourceRequest, dispatchRunnerCapabilityInvocation, emitSystemPromptComposed, ensureClaudeSettingsDisablesConnectors, ensureGitConfigInclude, executeConnectorMutate, extractClaudeAiOauthExpiresAt, flowStartNeedsHarnessRestart, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, handleSessionRootResourceRequest, harnessActiveAfterTurnEnd, hasNonTerminalFlow, hashAgentFiles, hashContent, hostOpResumeStimulus, installPreInitRingSink, instanceForSession, instanceSessionOverrides, isCompilePinCurrent, isCompositionError, isEmptyKnowledgeIndex, isSessionRootPathAllowed, listSessions, loadAgentManifest, loadCompileManifest, loadCompileManifestFromDir, loadCompositionRunSnapshot, loadKnowledgeDir, loadManagedCodexHostConfig, loadSession, loadSessionById, logConnectorReport, manifestModelForHarness, mcpAuthSecretKey, newSession, nulTailPaddingLength, pickChatFlowTarget, pickFlowToolTarget, pickRepointedManager, planFlowMutate, prepareCodexTools, reconcilePendingDecisions, reconnectedRunNeedsAgentTurn, recreateKeepingLiveFlows, registerActiveFlow, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, rejectPendingCapabilityCallsOnDisconnect, resetRunnerLogStore, resolveAgentInstance, resolveBinding, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveFlowMutateConnectorWaitMs, resolveInstanceAgentDir, resolveMixin, resolveSessionId, restoredRunHasWorkToResume, runAgentChat, saveCompositionRunSnapshot, saveSession, setCurrentSession, setUpFlowConnector, startAgentServer, stimulusFromMetas, stripFrontmatter, takeRunnerWsAuthToken, toActiveFlowTarget, touchSession, unresolvedCredentialNotices, validateInputResponse, verifyConventionItems, writeClaudeCodeCredentialsFile, writeRangeChunk, writeRangePartialPath };
16473
- //# sourceMappingURL=chunk-6RPS7JEH.js.map
16474
- //# sourceMappingURL=chunk-6RPS7JEH.js.map
16720
+ //# sourceMappingURL=chunk-K7ZGY2BY.js.map
16721
+ //# sourceMappingURL=chunk-K7ZGY2BY.js.map