@stigmer/runner 3.6.0 → 3.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 (100) hide show
  1. package/dist/.build-fingerprint +1 -1
  2. package/dist/activities/call-agent.js +85 -10
  3. package/dist/activities/call-agent.js.map +1 -1
  4. package/dist/activities/execute-cursor/index.d.ts +12 -0
  5. package/dist/activities/execute-cursor/index.js +80 -10
  6. package/dist/activities/execute-cursor/index.js.map +1 -1
  7. package/dist/activities/execute-cursor/model-pricing.d.ts +9 -0
  8. package/dist/activities/execute-cursor/model-pricing.js +19 -0
  9. package/dist/activities/execute-cursor/model-pricing.js.map +1 -1
  10. package/dist/activities/execute-cursor/prompt-builder.d.ts +11 -0
  11. package/dist/activities/execute-cursor/prompt-builder.js +11 -0
  12. package/dist/activities/execute-cursor/prompt-builder.js.map +1 -1
  13. package/dist/activities/execute-cursor/service-tier.d.ts +68 -0
  14. package/dist/activities/execute-cursor/service-tier.js +187 -0
  15. package/dist/activities/execute-cursor/service-tier.js.map +1 -0
  16. package/dist/activities/execute-cursor/session-lifecycle.d.ts +16 -1
  17. package/dist/activities/execute-cursor/session-lifecycle.js +12 -4
  18. package/dist/activities/execute-cursor/session-lifecycle.js.map +1 -1
  19. package/dist/activities/execute-cursor/usage-accumulator.d.ts +21 -1
  20. package/dist/activities/execute-cursor/usage-accumulator.js +23 -3
  21. package/dist/activities/execute-cursor/usage-accumulator.js.map +1 -1
  22. package/dist/activities/execute-deep-agent/mcp-gate.d.ts +28 -0
  23. package/dist/activities/execute-deep-agent/mcp-gate.js +22 -0
  24. package/dist/activities/execute-deep-agent/mcp-gate.js.map +1 -0
  25. package/dist/activities/execute-deep-agent/prompt-builder.d.ts +11 -0
  26. package/dist/activities/execute-deep-agent/prompt-builder.js +16 -0
  27. package/dist/activities/execute-deep-agent/prompt-builder.js.map +1 -1
  28. package/dist/activities/execute-deep-agent/setup.js +30 -4
  29. package/dist/activities/execute-deep-agent/setup.js.map +1 -1
  30. package/dist/client/stigmer-client.d.ts +6 -1
  31. package/dist/client/stigmer-client.js +5 -2
  32. package/dist/client/stigmer-client.js.map +1 -1
  33. package/dist/main.js +18 -0
  34. package/dist/main.js.map +1 -1
  35. package/dist/runner.js +48 -0
  36. package/dist/runner.js.map +1 -1
  37. package/dist/sandbox-token-renewal.d.ts +65 -0
  38. package/dist/sandbox-token-renewal.js +169 -0
  39. package/dist/sandbox-token-renewal.js.map +1 -0
  40. package/dist/shared/artifact-storage.d.ts +17 -3
  41. package/dist/shared/artifact-storage.js +22 -4
  42. package/dist/shared/artifact-storage.js.map +1 -1
  43. package/dist/shared/channel-attachment.d.ts +3 -1
  44. package/dist/shared/channel-attachment.js +3 -1
  45. package/dist/shared/channel-attachment.js.map +1 -1
  46. package/dist/shared/conversation-attachment.d.ts +81 -0
  47. package/dist/shared/conversation-attachment.js +102 -0
  48. package/dist/shared/conversation-attachment.js.map +1 -0
  49. package/dist/shared/conversation-catchup.d.ts +33 -0
  50. package/dist/shared/conversation-catchup.js +53 -0
  51. package/dist/shared/conversation-catchup.js.map +1 -0
  52. package/dist/workflow-engine/loader.js +99 -2
  53. package/dist/workflow-engine/loader.js.map +1 -1
  54. package/dist/workflow-engine/tasks/call-agent.d.ts +0 -2
  55. package/dist/workflow-engine/tasks/call-agent.js +0 -2
  56. package/dist/workflow-engine/tasks/call-agent.js.map +1 -1
  57. package/dist/workflow-engine/types.d.ts +39 -7
  58. package/dist/workflow-engine/types.js.map +1 -1
  59. package/dist/workflows/call-agent-orchestrator.d.ts +3 -2
  60. package/dist/workflows/call-agent-orchestrator.js +8 -2
  61. package/dist/workflows/call-agent-orchestrator.js.map +1 -1
  62. package/package.json +2 -2
  63. package/src/__tests__/sandbox-token-renewal.test.ts +174 -0
  64. package/src/activities/__tests__/call-agent-contracts.test.ts +4 -4
  65. package/src/activities/__tests__/call-agent.test.ts +219 -4
  66. package/src/activities/call-agent.ts +94 -10
  67. package/src/activities/execute-cursor/__tests__/build-prompt.test.ts +79 -0
  68. package/src/activities/execute-cursor/__tests__/model-pricing.test.ts +20 -0
  69. package/src/activities/execute-cursor/__tests__/service-tier.test.ts +170 -0
  70. package/src/activities/execute-cursor/__tests__/usage-accumulator.test.ts +87 -1
  71. package/src/activities/execute-cursor/index.ts +111 -11
  72. package/src/activities/execute-cursor/model-pricing.ts +23 -0
  73. package/src/activities/execute-cursor/prompt-builder.ts +23 -0
  74. package/src/activities/execute-cursor/service-tier.ts +244 -0
  75. package/src/activities/execute-cursor/session-lifecycle.ts +33 -5
  76. package/src/activities/execute-cursor/usage-accumulator.ts +35 -3
  77. package/src/activities/execute-deep-agent/__tests__/mcp-gate.test.ts +42 -0
  78. package/src/activities/execute-deep-agent/__tests__/prompt-builder.test.ts +39 -1
  79. package/src/activities/execute-deep-agent/mcp-gate.ts +37 -0
  80. package/src/activities/execute-deep-agent/prompt-builder.ts +22 -2
  81. package/src/activities/execute-deep-agent/setup.ts +40 -4
  82. package/src/client/stigmer-client.ts +11 -4
  83. package/src/main.ts +20 -0
  84. package/src/runner.ts +62 -0
  85. package/src/sandbox-token-renewal.ts +212 -0
  86. package/src/shared/__tests__/channel-attachment.test.ts +3 -3
  87. package/src/shared/__tests__/conversation-attachment.test.ts +138 -0
  88. package/src/shared/__tests__/conversation-catchup.test.ts +70 -0
  89. package/src/shared/__tests__/synthesized-attachment.test.ts +120 -0
  90. package/src/shared/artifact-storage.ts +32 -7
  91. package/src/shared/channel-attachment.ts +3 -1
  92. package/src/shared/conversation-attachment.ts +115 -0
  93. package/src/shared/conversation-catchup.ts +60 -0
  94. package/src/workflow-engine/__tests__/golden-execution.test.ts +8 -8
  95. package/src/workflow-engine/__tests__/loader.test.ts +192 -7
  96. package/src/workflow-engine/__tests__/tasks/call-agent.test.ts +9 -9
  97. package/src/workflow-engine/loader.ts +113 -2
  98. package/src/workflow-engine/tasks/call-agent.ts +0 -2
  99. package/src/workflow-engine/types.ts +40 -7
  100. package/src/workflows/call-agent-orchestrator.ts +8 -2
@@ -0,0 +1,169 @@
1
+ /**
2
+ * Self-renewal of a cloud sandbox's control-plane credential (STIGMER_TOKEN).
3
+ *
4
+ * A sandbox token is minted with a fixed TTL, but the sandbox it serves has
5
+ * no fixed lifetime: an active conversation extends a session sandbox
6
+ * indefinitely, and a long workflow run can outlast any TTL chosen at
7
+ * provisioning. Before this module, the only refresh path was the control
8
+ * plane's Secret-rewrite + pod restart — which the 2026-08-05 incident
9
+ * showed both sacrifices the turn that trips it (the old pod picks up the
10
+ * work holding the dead env token) and wipes an ephemeral sandbox's
11
+ * workspace. Renewal decouples credential lifetime from sandbox lifetime:
12
+ * the runner re-mints in-process before expiry via the getRunnerScopedToken
13
+ * `renewal` arm, and the server bounds renewability by the live sandbox
14
+ * record (a reaped sandbox's credential dies with it).
15
+ *
16
+ * Relationship to {@link createRunnerTokenCoordinator}
17
+ * (runner-token-coordinator.ts): the coordinator owns the PROXY credential
18
+ * (x-stigmer-auth) and re-mints it using the control-plane token; this
19
+ * module keeps that control-plane token itself fresh, so the two form one
20
+ * chain with no expiring root. They stay separate modules because their
21
+ * hosts differ — every proxy-mode runner has a coordinator, but only
22
+ * in-cluster sandbox runners (static cloud sandboxes and pool members) hold
23
+ * a renewable credential; the desktop's control-plane token is the user's
24
+ * own Auth0 token, refreshed by the host app.
25
+ *
26
+ * The loop re-reads the CURRENT token every cycle rather than binding to
27
+ * the boot credential, because the credential's class can change under it:
28
+ * a pool member boots with a non-renewable pool_sandbox token and swaps to
29
+ * a renewable session token at claim time (attach-session.ts). A
30
+ * non-renewable token parks the loop on a slow recheck instead of stopping
31
+ * it, so the swap is picked up without any coupling to the claim path.
32
+ */
33
+ /**
34
+ * Renew once the token has lived this fraction of its issued lifetime
35
+ * (anchored on iat/exp, the coordinator's 0.8 convention). Anchoring on the
36
+ * ISSUED lifetime matters: a fraction of the *remaining* lifetime re-arms at
37
+ * 80% of an ever-shrinking remainder and never reaches the renewal point.
38
+ */
39
+ const RENEW_AT_LIFETIME_FRACTION = 0.8;
40
+ /**
41
+ * Fallback safety margin before expiry for a token without an iat claim:
42
+ * renew this early, leaving room for two retry cycles.
43
+ */
44
+ const FALLBACK_RENEW_MARGIN_MS = 10 * 60_000;
45
+ /** Retry delay after a failed renewal — short enough to recover well before expiry. */
46
+ const RETRY_DELAY_MS = 60_000;
47
+ /** Recheck cadence while the current token is not a renewable class (pre-claim pool member). */
48
+ const RECHECK_DELAY_MS = 60_000;
49
+ /** Floor for any scheduled delay so a malformed expiry cannot spin a hot loop. */
50
+ const MIN_DELAY_MS = 5_000;
51
+ /** The token_type claims the renewal arm accepts (mirrors the server's gate). */
52
+ const RENEWABLE_TOKEN_TYPES = new Set(["sandbox", "workflow_sandbox"]);
53
+ /**
54
+ * Whether a token's decoded claims mark it as renewable through the
55
+ * `renewal` arm. Exported so a static-mode host can decide not to start
56
+ * the loop at all for a credential whose class can never change.
57
+ */
58
+ export function isRenewableSandboxToken(token) {
59
+ const claims = decodeClaims(token);
60
+ return claims !== null
61
+ && RENEWABLE_TOKEN_TYPES.has(claims.tokenType ?? "")
62
+ && claims.expMs !== null;
63
+ }
64
+ /**
65
+ * Start the renewal loop. The first cycle runs immediately (it only reads
66
+ * the token and schedules; no network call unless the credential is already
67
+ * past its renewal point).
68
+ */
69
+ export function startSandboxTokenRenewal(options) {
70
+ const log = options.log ?? console;
71
+ let stopped = false;
72
+ let timer = null;
73
+ const schedule = (delayMs) => {
74
+ if (stopped) {
75
+ return;
76
+ }
77
+ timer = setTimeout(() => {
78
+ void cycle();
79
+ }, Math.max(MIN_DELAY_MS, delayMs));
80
+ // Never keep the process alive solely for a token renewal.
81
+ timer.unref?.();
82
+ };
83
+ const cycle = async () => {
84
+ if (stopped) {
85
+ return;
86
+ }
87
+ const token = options.getToken() ?? null;
88
+ const claims = decodeClaims(token);
89
+ if (token === null || claims === null
90
+ || !RENEWABLE_TOKEN_TYPES.has(claims.tokenType ?? "")) {
91
+ // Not (yet) a renewable credential — a pre-claim pool member, or a
92
+ // credential class this loop does not own. Park and look again.
93
+ schedule(RECHECK_DELAY_MS);
94
+ return;
95
+ }
96
+ if (claims.expMs === null) {
97
+ // A renewable-class token without an expiry is a mint-side anomaly;
98
+ // renewing "before expiry" is undefined, so park rather than spin.
99
+ log.warn("[sandbox-token-renewal] Credential carries no exp claim; parking");
100
+ schedule(RECHECK_DELAY_MS);
101
+ return;
102
+ }
103
+ const renewAtMs = claims.iatMs !== null
104
+ ? claims.iatMs + (claims.expMs - claims.iatMs) * RENEW_AT_LIFETIME_FRACTION
105
+ : claims.expMs - FALLBACK_RENEW_MARGIN_MS;
106
+ const delayMs = renewAtMs - Date.now();
107
+ if (delayMs > MIN_DELAY_MS) {
108
+ schedule(delayMs);
109
+ return;
110
+ }
111
+ // At or past the renewal point (possibly past expiry after a long pod
112
+ // pause — the attempt is still correct: the server decides).
113
+ try {
114
+ const renewed = await options.renew(token);
115
+ if (renewed) {
116
+ options.applyToken(renewed.token);
117
+ log.log("[sandbox-token-renewal] Sandbox credential renewed");
118
+ // Recompute from the fresh token (its own exp is authoritative).
119
+ schedule(MIN_DELAY_MS);
120
+ }
121
+ else {
122
+ log.warn("[sandbox-token-renewal] Server minted no renewal; will retry");
123
+ schedule(RETRY_DELAY_MS);
124
+ }
125
+ }
126
+ catch (err) {
127
+ log.warn("[sandbox-token-renewal] Renewal failed; will retry: " +
128
+ `${err instanceof Error ? err.message : err}`);
129
+ schedule(RETRY_DELAY_MS);
130
+ }
131
+ };
132
+ void cycle();
133
+ return {
134
+ stop() {
135
+ stopped = true;
136
+ if (timer) {
137
+ clearTimeout(timer);
138
+ timer = null;
139
+ }
140
+ },
141
+ };
142
+ }
143
+ /**
144
+ * Decode the claims this module reads (token_type, iat, exp) from an
145
+ * unverified JWT. Decode-only on purpose: this is the runner's OWN
146
+ * credential, minted by the server it will present it back to —
147
+ * verification happens there.
148
+ */
149
+ function decodeClaims(token) {
150
+ if (!token) {
151
+ return null;
152
+ }
153
+ const parts = token.split(".");
154
+ if (parts.length !== 3) {
155
+ return null;
156
+ }
157
+ try {
158
+ const payload = JSON.parse(Buffer.from(parts[1], "base64url").toString("utf-8"));
159
+ return {
160
+ tokenType: payload.token_type,
161
+ iatMs: typeof payload.iat === "number" ? payload.iat * 1000 : null,
162
+ expMs: typeof payload.exp === "number" ? payload.exp * 1000 : null,
163
+ };
164
+ }
165
+ catch {
166
+ return null;
167
+ }
168
+ }
169
+ //# sourceMappingURL=sandbox-token-renewal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox-token-renewal.js","sourceRoot":"","sources":["../src/sandbox-token-renewal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH;;;;;GAKG;AACH,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAEvC;;;GAGG;AACH,MAAM,wBAAwB,GAAG,EAAE,GAAG,MAAM,CAAC;AAE7C,uFAAuF;AACvF,MAAM,cAAc,GAAG,MAAM,CAAC;AAE9B,gGAAgG;AAChG,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEhC,kFAAkF;AAClF,MAAM,YAAY,GAAG,KAAK,CAAC;AAE3B,iFAAiF;AACjF,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAwBvE;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAgC;IACtE,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACnC,OAAO,MAAM,KAAK,IAAI;WACjB,qBAAqB,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC;WACjD,MAAM,CAAC,KAAK,KAAK,IAAI,CAAC;AAC7B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CACtC,OAAmC;IAEnC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC;IACnC,IAAI,OAAO,GAAG,KAAK,CAA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AK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CACxB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CACE,CAAC;QACzD,OAAO;YACL,SAAS,EAAE,OAAO,CAAC,UAAU;YAC7B,KAAK,EAAE,OAAO,OAAO,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI;YAClE,KAAK,EAAE,OAAO,OAAO,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI;SACnE,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -44,19 +44,33 @@ export declare class LocalArtifactStorage implements ArtifactStorage {
44
44
  }
45
45
  export declare class ProxyArtifactStorage implements ArtifactStorage {
46
46
  private readonly baseUrl;
47
- private readonly authToken;
48
- constructor(proxyEndpoint: string, authToken: string);
47
+ private readonly authTokenSource;
48
+ constructor(proxyEndpoint: string, authToken: ProxyAuthTokenSource);
49
+ /**
50
+ * Resolve the credential per call rather than pinning the boot token: a
51
+ * cloud sandbox's control-plane token rotates in place (see
52
+ * sandbox-token-renewal.ts), and this storage lives for the pod's whole
53
+ * life — a captured string would silently 401 after the first rotation.
54
+ */
55
+ private get authToken();
49
56
  upload(key: string, content: Buffer, contentType?: string): Promise<string>;
50
57
  getDownloadUrl(key: string): Promise<string>;
51
58
  download(key: string): Promise<Buffer>;
52
59
  exists(key: string): Promise<boolean>;
53
60
  }
61
+ /**
62
+ * The proxy credential, either fixed (a caller-supplied string) or live (a
63
+ * shared mutable ref, read per call — the sandbox token-renewal posture).
64
+ */
65
+ export type ProxyAuthTokenSource = string | {
66
+ readonly current: string | null;
67
+ };
54
68
  export interface ArtifactStorageConfig {
55
69
  readonly type: ArtifactStorageType;
56
70
  readonly localPath: string;
57
71
  readonly localServeUrl: string;
58
72
  readonly proxyEndpoint: string | null;
59
- readonly proxyAuthToken: string | null;
73
+ readonly proxyAuthToken: ProxyAuthTokenSource | null;
60
74
  }
61
75
  export declare function loadArtifactStorageConfig(config: Config): ArtifactStorageConfig;
62
76
  export declare function createArtifactStorage(cfg: ArtifactStorageConfig): ArtifactStorage;
@@ -59,10 +59,21 @@ export class LocalArtifactStorage {
59
59
  // ── Proxy Backend ────────────────────────────────────────────────────
60
60
  export class ProxyArtifactStorage {
61
61
  baseUrl;
62
- authToken;
62
+ authTokenSource;
63
63
  constructor(proxyEndpoint, authToken) {
64
64
  this.baseUrl = `${proxyEndpoint.replace(/\/+$/, "")}/v1/proxy/artifacts`;
65
- this.authToken = authToken;
65
+ this.authTokenSource = authToken;
66
+ }
67
+ /**
68
+ * Resolve the credential per call rather than pinning the boot token: a
69
+ * cloud sandbox's control-plane token rotates in place (see
70
+ * sandbox-token-renewal.ts), and this storage lives for the pod's whole
71
+ * life — a captured string would silently 401 after the first rotation.
72
+ */
73
+ get authToken() {
74
+ return typeof this.authTokenSource === "string"
75
+ ? this.authTokenSource
76
+ : (this.authTokenSource.current ?? "");
66
77
  }
67
78
  async upload(key, content, contentType) {
68
79
  const ct = contentType ?? "application/octet-stream";
@@ -181,7 +192,11 @@ export function loadArtifactStorageConfig(config) {
181
192
  localPath: process.env.LOCAL_ARTIFACT_PATH ?? "/var/stigmer/artifacts",
182
193
  localServeUrl: process.env.LOCAL_ARTIFACT_SERVE_URL ?? "http://localhost:7235",
183
194
  proxyEndpoint: type === "proxy" ? (config.proxyEndpoint ?? null) : null,
184
- proxyAuthToken: type === "proxy" ? (config.stigmerToken ?? null) : null,
195
+ // Prefer the live ref: renewal rotates the token in place and uploads
196
+ // must present the current credential, not the boot one.
197
+ proxyAuthToken: type === "proxy"
198
+ ? (config.stigmerTokenRef ?? config.stigmerToken ?? null)
199
+ : null,
185
200
  };
186
201
  }
187
202
  export function createArtifactStorage(cfg) {
@@ -189,7 +204,10 @@ export function createArtifactStorage(cfg) {
189
204
  if (!cfg.proxyEndpoint) {
190
205
  throw new Error("Proxy artifact storage requires STIGMER_PROXY_ENDPOINT");
191
206
  }
192
- if (!cfg.proxyAuthToken) {
207
+ const tokenAtBoot = typeof cfg.proxyAuthToken === "string"
208
+ ? cfg.proxyAuthToken
209
+ : cfg.proxyAuthToken?.current;
210
+ if (!tokenAtBoot) {
193
211
  throw new Error("Proxy artifact storage requires STIGMER_TOKEN");
194
212
  }
195
213
  return new ProxyArtifactStorage(cfg.proxyEndpoint, cfg.proxyAuthToken);
@@ -1 +1 @@
1
- {"version":3,"file":"artifact-storage.js","sourceRoot":"","sources":["../../src/shared/artifact-storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAwB1C,wEAAwE;AAExE,MAAM,OAAO,oBAAoB;IACd,QAAQ,CAAS;IACjB,YAAY,CAAS;IAEtC,YAAY,QAAgB,EAAE,YAAoB;QAChD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAW,EAAE,OAAe,EAAE,YAAqB;QAC9D,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAA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AAC;IACnB,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -41,7 +41,9 @@ import { type SynthesizedAttachmentOptions } from "./synthesized-attachment.js";
41
41
  /**
42
42
  * The synthesized attachment's slug. Reserved: a user McpServer with
43
43
  * this slug is shadowed by the synthesized attachment, with a warning.
44
- * Pinned cross-repo by the mcp-server integration test (the
44
+ * Runner-internal (the resolved-server name and shadow key — the
45
+ * mcp-server never sees it); pinned by this module's test. The ROUTE
46
+ * below is the cross-repo string, pinned on both sides (the
45
47
  * TOOL_CALL_LIMIT precedent).
46
48
  */
47
49
  export declare const CHANNEL_ATTACHMENT_SLUG = "stigmer-channels";
@@ -39,7 +39,9 @@ import { grpcTarget } from "./synthesized-attachment.js";
39
39
  /**
40
40
  * The synthesized attachment's slug. Reserved: a user McpServer with
41
41
  * this slug is shadowed by the synthesized attachment, with a warning.
42
- * Pinned cross-repo by the mcp-server integration test (the
42
+ * Runner-internal (the resolved-server name and shadow key — the
43
+ * mcp-server never sees it); pinned by this module's test. The ROUTE
44
+ * below is the cross-repo string, pinned on both sides (the
43
45
  * TOOL_CALL_LIMIT precedent).
44
46
  */
45
47
  export const CHANNEL_ATTACHMENT_SLUG = "stigmer-channels";
@@ -1 +1 @@
1
- {"version":3,"file":"channel-attachment.js","sourceRoot":"","sources":["../../src/shared/channel-attachment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAOzD,OAAO,EAAE,UAAU,EAAqC,MAAM,6BAA6B,CAAC;AAE5F;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,kBAAkB,CAAC;AAE1D,gFAAgF;AAChF,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAQvC;;;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,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACjG,CAAC;IAED,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,MAAM,GAAG,QAAQ,GAAG,CAAC;QACzB,CAAC,CAAC,CAAC,IAAI,QAAQ,0BAA0B,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC;QAChF,CAAC,CAAC,EAAE,CAAC;IACP,OAAO;QACL,+BAA+B;QAC/B,yEAAyE;QACzE,0EAA0E;QAC1E,2EAA2E;QAC3E,gEAAgE;QAChE,EAAE;QACF,GAAG,aAAa;QAChB,GAAG,MAAM;QACT,gCAAgC;KACjC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,SAAS,mBAAmB,CAAC,IAAY,EAAE,GAAY;IACrD,MAAM,EAAE,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,QAAQ,GACZ,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,aAAa;QAC9B,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,kBAAkB;QACnC,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,WAAW,CAAC;IAC/B,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,wBAAwB,IAAI,gCAAgC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;IAC1F,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,IAAI,CACV,wBAAwB,IAAI,+CAA+C,EAAE,CAAC,OAAO,EAAE,CACxF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * The runner-synthesized conversation participation attachment
3
+ * (channel-conversations DD-008 D-c, A14) — the third synthesized
4
+ * attachment, on the datastore module's shape (a cheap local predicate,
5
+ * not the channel module's discovery machinery).
6
+ *
7
+ * When the session IS a live channel conversation, the runner
8
+ * synthesizes ONE MCP attachment serving `escalate_to_human`, so the
9
+ * agent can flag its own conversation for human attention
10
+ * (escalate-and-continue: the agent keeps serving; nothing is paged).
11
+ *
12
+ * The conditioning signal is the session resource label
13
+ * `stigmer.ai/channel-id`, stamped server-side from the JWT on every
14
+ * channel-created Session (ChannelSessionCreateScopeStep) — the same
15
+ * field the cloud's own ChannelMessagingReach.deriveOrigin reads to
16
+ * answer exactly this question. It is deliberately NOT a
17
+ * SessionSpec.metadata key: none of those asserts "this is a channel
18
+ * conversation" (sender identity is who wrote, the bridge is rollover
19
+ * provenance), and a new key would reach existing live conversations
20
+ * only at rollover. The label is not authorization — a spoofed label
21
+ * buys a tool the server refuses (the reach derives identity from the
22
+ * session token, never from labels the runner read).
23
+ *
24
+ * ONE connection shape — HTTP against the bridge's /conversation route
25
+ * with the execution's session-scoped credential as the Bearer token —
26
+ * and deliberately NO stdio fallback, diverging from both siblings:
27
+ * escalate is cloud-only (OSS refuses FAILED_PRECONDITION) AND
28
+ * session-token-only (a stdio child's startup API key carries no
29
+ * session_id claim, so even cloud would refuse PERMISSION_DENIED). A
30
+ * stdio shape would be a tool that can only fail; no bridge endpoint
31
+ * means honest absence instead.
32
+ *
33
+ * Also deliberately NO prompt section (the siblings' <available_*>
34
+ * pattern): the tool description carries the full when-to-use contract,
35
+ * and a standing section would spend every channel turn's context to
36
+ * restate what the tool listing already shows.
37
+ *
38
+ * Approval-free by construction, and FORCED, not convenient: channel
39
+ * surfaces run APPROVAL_MODE_UNATTENDED, where a gated tool resolves as
40
+ * skip-and-adapt — a gated escalation would never fire (DD-008's
41
+ * approval-free ruling). Empty approval maps + no McpServerUsage keep
42
+ * the connect backfill structurally unable to gate it (see
43
+ * synthesized-attachment.ts). Callers inject AFTER resolve + backfill.
44
+ */
45
+ import type { ResolvedMcpServer } from "./mcp-resolver.js";
46
+ import type { SynthesizedAttachmentOptions } from "./synthesized-attachment.js";
47
+ /**
48
+ * The synthesized attachment's slug. Reserved: a user McpServer with
49
+ * this slug is shadowed by the synthesized attachment, with a warning.
50
+ * Runner-internal (the resolved-server name and shadow key — the
51
+ * mcp-server never sees it); pinned by this module's test.
52
+ */
53
+ export declare const CONVERSATION_ATTACHMENT_SLUG = "stigmer-conversation";
54
+ /**
55
+ * The bridge route serving the conversation-only roster. The cross-repo
56
+ * string: pinned here and in the mcp-server's conversation integration
57
+ * test — a drift strands every synthesized attachment on a 404.
58
+ */
59
+ export declare const CONVERSATION_ROUTE = "/conversation";
60
+ /**
61
+ * The session label naming the serving channel. Pinned verbatim to
62
+ * ChannelRuntimeConstants.CHANNEL_ID_METADATA_KEY in stigmer-cloud
63
+ * (mirror guard in this module's test and in ChannelSessionBrokerTest).
64
+ * Drift degrades to honest absence — the tool silently stops attaching,
65
+ * escalation never fires from a tool that was never offered — never
66
+ * worse.
67
+ */
68
+ export declare const CHANNEL_ID_LABEL = "stigmer.ai/channel-id";
69
+ /**
70
+ * Read the serving channel id from a session's resource labels. Blank
71
+ * and whitespace-only values are absent: the label is stamped complete
72
+ * or not at all, and a blank channel id must not synthesize a tool.
73
+ */
74
+ export declare function readChannelConversationId(labels: Record<string, string> | undefined): string | undefined;
75
+ /**
76
+ * Synthesize the conversation attachment for a channel-conversation
77
+ * session. Returns undefined when the session serves no channel
78
+ * conversation OR no bridge endpoint is configured (the deliberate
79
+ * no-stdio divergence — see the file header).
80
+ */
81
+ export declare function synthesizeConversationAttachment(channelId: string | undefined, options: SynthesizedAttachmentOptions): ResolvedMcpServer | undefined;
@@ -0,0 +1,102 @@
1
+ /**
2
+ * The runner-synthesized conversation participation attachment
3
+ * (channel-conversations DD-008 D-c, A14) — the third synthesized
4
+ * attachment, on the datastore module's shape (a cheap local predicate,
5
+ * not the channel module's discovery machinery).
6
+ *
7
+ * When the session IS a live channel conversation, the runner
8
+ * synthesizes ONE MCP attachment serving `escalate_to_human`, so the
9
+ * agent can flag its own conversation for human attention
10
+ * (escalate-and-continue: the agent keeps serving; nothing is paged).
11
+ *
12
+ * The conditioning signal is the session resource label
13
+ * `stigmer.ai/channel-id`, stamped server-side from the JWT on every
14
+ * channel-created Session (ChannelSessionCreateScopeStep) — the same
15
+ * field the cloud's own ChannelMessagingReach.deriveOrigin reads to
16
+ * answer exactly this question. It is deliberately NOT a
17
+ * SessionSpec.metadata key: none of those asserts "this is a channel
18
+ * conversation" (sender identity is who wrote, the bridge is rollover
19
+ * provenance), and a new key would reach existing live conversations
20
+ * only at rollover. The label is not authorization — a spoofed label
21
+ * buys a tool the server refuses (the reach derives identity from the
22
+ * session token, never from labels the runner read).
23
+ *
24
+ * ONE connection shape — HTTP against the bridge's /conversation route
25
+ * with the execution's session-scoped credential as the Bearer token —
26
+ * and deliberately NO stdio fallback, diverging from both siblings:
27
+ * escalate is cloud-only (OSS refuses FAILED_PRECONDITION) AND
28
+ * session-token-only (a stdio child's startup API key carries no
29
+ * session_id claim, so even cloud would refuse PERMISSION_DENIED). A
30
+ * stdio shape would be a tool that can only fail; no bridge endpoint
31
+ * means honest absence instead.
32
+ *
33
+ * Also deliberately NO prompt section (the siblings' <available_*>
34
+ * pattern): the tool description carries the full when-to-use contract,
35
+ * and a standing section would spend every channel turn's context to
36
+ * restate what the tool listing already shows.
37
+ *
38
+ * Approval-free by construction, and FORCED, not convenient: channel
39
+ * surfaces run APPROVAL_MODE_UNATTENDED, where a gated tool resolves as
40
+ * skip-and-adapt — a gated escalation would never fire (DD-008's
41
+ * approval-free ruling). Empty approval maps + no McpServerUsage keep
42
+ * the connect backfill structurally unable to gate it (see
43
+ * synthesized-attachment.ts). Callers inject AFTER resolve + backfill.
44
+ */
45
+ /**
46
+ * The synthesized attachment's slug. Reserved: a user McpServer with
47
+ * this slug is shadowed by the synthesized attachment, with a warning.
48
+ * Runner-internal (the resolved-server name and shadow key — the
49
+ * mcp-server never sees it); pinned by this module's test.
50
+ */
51
+ export const CONVERSATION_ATTACHMENT_SLUG = "stigmer-conversation";
52
+ /**
53
+ * The bridge route serving the conversation-only roster. The cross-repo
54
+ * string: pinned here and in the mcp-server's conversation integration
55
+ * test — a drift strands every synthesized attachment on a 404.
56
+ */
57
+ export const CONVERSATION_ROUTE = "/conversation";
58
+ /**
59
+ * The session label naming the serving channel. Pinned verbatim to
60
+ * ChannelRuntimeConstants.CHANNEL_ID_METADATA_KEY in stigmer-cloud
61
+ * (mirror guard in this module's test and in ChannelSessionBrokerTest).
62
+ * Drift degrades to honest absence — the tool silently stops attaching,
63
+ * escalation never fires from a tool that was never offered — never
64
+ * worse.
65
+ */
66
+ export const CHANNEL_ID_LABEL = "stigmer.ai/channel-id";
67
+ /**
68
+ * Read the serving channel id from a session's resource labels. Blank
69
+ * and whitespace-only values are absent: the label is stamped complete
70
+ * or not at all, and a blank channel id must not synthesize a tool.
71
+ */
72
+ export function readChannelConversationId(labels) {
73
+ const channelId = labels?.[CHANNEL_ID_LABEL]?.trim();
74
+ return channelId !== undefined && channelId !== "" ? channelId : undefined;
75
+ }
76
+ /**
77
+ * Synthesize the conversation attachment for a channel-conversation
78
+ * session. Returns undefined when the session serves no channel
79
+ * conversation OR no bridge endpoint is configured (the deliberate
80
+ * no-stdio divergence — see the file header).
81
+ */
82
+ export function synthesizeConversationAttachment(channelId, options) {
83
+ if (channelId === undefined) {
84
+ return undefined;
85
+ }
86
+ if (options.bridgeEndpoint === null || options.bridgeEndpoint === "") {
87
+ return undefined;
88
+ }
89
+ // Approval-free by construction + backfill-proof: see file header.
90
+ return {
91
+ slug: CONVERSATION_ATTACHMENT_SLUG,
92
+ toolApprovals: [],
93
+ pinnedToolApprovals: [],
94
+ discoveredCapabilitiesEmpty: false,
95
+ connectionType: "http",
96
+ url: options.bridgeEndpoint.replace(/\/+$/, "") + CONVERSATION_ROUTE,
97
+ headers: options.credential !== null && options.credential !== ""
98
+ ? { Authorization: `Bearer ${options.credential}` }
99
+ : undefined,
100
+ };
101
+ }
102
+ //# sourceMappingURL=conversation-attachment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-attachment.js","sourceRoot":"","sources":["../../src/shared/conversation-attachment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAKH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,sBAAsB,CAAC;AAEnE;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAElD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AAExD;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CACvC,MAA0C;IAE1C,MAAM,SAAS,GAAG,MAAM,EAAE,CAAC,gBAAgB,CAAC,EAAE,IAAI,EAAE,CAAC;IACrD,OAAO,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gCAAgC,CAC9C,SAA6B,EAC7B,OAAqC;IAErC,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,OAAO,CAAC,cAAc,KAAK,IAAI,IAAI,OAAO,CAAC,cAAc,KAAK,EAAE,EAAE,CAAC;QACrE,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,mEAAmE;IACnE,OAAO;QACL,IAAI,EAAE,4BAA4B;QAClC,aAAa,EAAE,EAAE;QACjB,mBAAmB,EAAE,EAAE;QACvB,2BAA2B,EAAE,KAAK;QAClC,cAAc,EAAE,MAAM;QACtB,GAAG,EAAE,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,kBAAkB;QACpE,OAAO,EAAE,OAAO,CAAC,UAAU,KAAK,IAAI,IAAI,OAAO,CAAC,UAAU,KAAK,EAAE;YAC/D,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,OAAO,CAAC,UAAU,EAAE,EAAE;YACnD,CAAC,CAAC,SAAS;KACd,CAAC;AACJ,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Conversation catchup (cloud channel-conversations DD-006): what happened on
3
+ * a live channel conversation that the agent has not seen — customer messages
4
+ * handled by a human teammate, the teammate's replies, platform notices the
5
+ * customer received, notes, and the agent's own earlier escalations.
6
+ *
7
+ * The cloud composes the CONTENT (bare `Customer:` / `Teammate:` / `System:` /
8
+ * `You escalated:` / `Note:` lines, oldest first) on the execution spec's
9
+ * `conversation_catchup` field, fresh per turn. This module owns the
10
+ * PRESENTATION framing; the digest is prepended to the TURN'S USER MESSAGE on
11
+ * both harnesses (A27) — never the system prompt — because it is per-turn
12
+ * conversation content that must persist in the conversation history: the
13
+ * native system prompt is rebuilt per invocation and would forget the digest
14
+ * one turn later, while a message rides the checkpointer/agent store forever.
15
+ *
16
+ * Unlike its metadata-keyed siblings (context-bridge, sender-identity,
17
+ * session-context) there is no string key to mirror-guard: the value rides a
18
+ * TYPED proto field, so codegen enforces the cross-repo contract. The
19
+ * degradation posture still holds — an absent or blank digest renders
20
+ * nothing, and a runner predating this module simply ignores the field: the
21
+ * agent re-enters blind, exactly the pre-DD-006 behavior, never worse.
22
+ */
23
+ import type { ConversationCatchup } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/spec_pb";
24
+ /**
25
+ * Read the catchup digest from an execution spec's `conversation_catchup`.
26
+ * Returns undefined when the field is absent or the digest is blank — the
27
+ * caller renders no section. The field itself is present on EVERY channel
28
+ * turn (its `window_end` is cloud watermark bookkeeping this module must
29
+ * never read); only a non-empty digest means there is something to say.
30
+ */
31
+ export declare function readConversationCatchup(catchup: ConversationCatchup | undefined): string | undefined;
32
+ /** The framed catchup body (preamble + digest), ready for section wrapping. */
33
+ export declare function formatConversationCatchupText(digest: string): string;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Conversation catchup (cloud channel-conversations DD-006): what happened on
3
+ * a live channel conversation that the agent has not seen — customer messages
4
+ * handled by a human teammate, the teammate's replies, platform notices the
5
+ * customer received, notes, and the agent's own earlier escalations.
6
+ *
7
+ * The cloud composes the CONTENT (bare `Customer:` / `Teammate:` / `System:` /
8
+ * `You escalated:` / `Note:` lines, oldest first) on the execution spec's
9
+ * `conversation_catchup` field, fresh per turn. This module owns the
10
+ * PRESENTATION framing; the digest is prepended to the TURN'S USER MESSAGE on
11
+ * both harnesses (A27) — never the system prompt — because it is per-turn
12
+ * conversation content that must persist in the conversation history: the
13
+ * native system prompt is rebuilt per invocation and would forget the digest
14
+ * one turn later, while a message rides the checkpointer/agent store forever.
15
+ *
16
+ * Unlike its metadata-keyed siblings (context-bridge, sender-identity,
17
+ * session-context) there is no string key to mirror-guard: the value rides a
18
+ * TYPED proto field, so codegen enforces the cross-repo contract. The
19
+ * degradation posture still holds — an absent or blank digest renders
20
+ * nothing, and a runner predating this module simply ignores the field: the
21
+ * agent re-enters blind, exactly the pre-DD-006 behavior, never worse.
22
+ */
23
+ /**
24
+ * How the digest is introduced to the model, shared by both harnesses so the
25
+ * behavioral contract ("known history, don't answer or announce it") cannot
26
+ * drift between them. Deliberately takeover-neutral: a digest can exist with
27
+ * no human handoff at all (a failed turn's re-composed window), so the
28
+ * preamble asserts only what is always true (the A15/A20 honesty bar).
29
+ */
30
+ const CONVERSATION_CATCHUP_PREAMBLE = "Below is activity from this conversation that you have not seen — " +
31
+ "oldest first. It may include customer messages that were handled by a " +
32
+ "human teammate, the teammate's own replies, notices the customer " +
33
+ "received, internal notes, and escalations you raised earlier. Treat it " +
34
+ "as conversation history you already know: do not answer or re-answer " +
35
+ "these messages, do not repeat or summarize them back, and do not " +
36
+ "mention any handoff unless asked. Continue from the customer's newest " +
37
+ "message.";
38
+ /**
39
+ * Read the catchup digest from an execution spec's `conversation_catchup`.
40
+ * Returns undefined when the field is absent or the digest is blank — the
41
+ * caller renders no section. The field itself is present on EVERY channel
42
+ * turn (its `window_end` is cloud watermark bookkeeping this module must
43
+ * never read); only a non-empty digest means there is something to say.
44
+ */
45
+ export function readConversationCatchup(catchup) {
46
+ const digest = catchup?.digest?.trim();
47
+ return digest ? digest : undefined;
48
+ }
49
+ /** The framed catchup body (preamble + digest), ready for section wrapping. */
50
+ export function formatConversationCatchupText(digest) {
51
+ return `${CONVERSATION_CATCHUP_PREAMBLE}\n\n${digest.trim()}`;
52
+ }
53
+ //# sourceMappingURL=conversation-catchup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-catchup.js","sourceRoot":"","sources":["../../src/shared/conversation-catchup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH;;;;;;GAMG;AACH,MAAM,6BAA6B,GACjC,oEAAoE;IACpE,wEAAwE;IACxE,mEAAmE;IACnE,yEAAyE;IACzE,uEAAuE;IACvE,mEAAmE;IACnE,wEAAwE;IACxE,UAAU,CAAC;AAEb;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAwC;IAExC,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACvC,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACrC,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,6BAA6B,CAAC,MAAc;IAC1D,OAAO,GAAG,6BAA6B,OAAO,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;AAChE,CAAC"}