agentfootprint 9.8.0 → 9.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 (159) hide show
  1. package/dist/adapters/observability/audit.js +2 -28
  2. package/dist/adapters/observability/audit.js.map +1 -1
  3. package/dist/adapters/observability/githubBugReporter.js +461 -0
  4. package/dist/adapters/observability/githubBugReporter.js.map +1 -0
  5. package/dist/adapters/observability/githubDeviceSignIn.js +263 -0
  6. package/dist/adapters/observability/githubDeviceSignIn.js.map +1 -0
  7. package/dist/core/Agent.js +13 -4
  8. package/dist/core/Agent.js.map +1 -1
  9. package/dist/core/agent/stages/seed.js +38 -6
  10. package/dist/core/agent/stages/seed.js.map +1 -1
  11. package/dist/core/agent/stages/toolCalls.js.map +1 -1
  12. package/dist/core/tools.js.map +1 -1
  13. package/dist/esm/adapters/observability/audit.js +1 -27
  14. package/dist/esm/adapters/observability/audit.js.map +1 -1
  15. package/dist/esm/adapters/observability/githubBugReporter.d.ts +154 -0
  16. package/dist/esm/adapters/observability/githubBugReporter.js +457 -0
  17. package/dist/esm/adapters/observability/githubBugReporter.js.map +1 -0
  18. package/dist/esm/adapters/observability/githubDeviceSignIn.d.ts +131 -0
  19. package/dist/esm/adapters/observability/githubDeviceSignIn.js +259 -0
  20. package/dist/esm/adapters/observability/githubDeviceSignIn.js.map +1 -0
  21. package/dist/esm/core/Agent.d.ts +13 -4
  22. package/dist/esm/core/Agent.js +13 -4
  23. package/dist/esm/core/Agent.js.map +1 -1
  24. package/dist/esm/core/agent/stages/seed.d.ts +11 -0
  25. package/dist/esm/core/agent/stages/seed.js +38 -6
  26. package/dist/esm/core/agent/stages/seed.js.map +1 -1
  27. package/dist/esm/core/agent/stages/toolCalls.d.ts +3 -2
  28. package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
  29. package/dist/esm/core/agent/types.d.ts +35 -4
  30. package/dist/esm/core/tools.d.ts +5 -2
  31. package/dist/esm/core/tools.js.map +1 -1
  32. package/dist/esm/hosting/browserSession.d.ts +97 -0
  33. package/dist/esm/hosting/browserSession.js +171 -0
  34. package/dist/esm/hosting/browserSession.js.map +1 -0
  35. package/dist/esm/hosting/httpHost.d.ts +14 -0
  36. package/dist/esm/hosting/httpHost.js +34 -6
  37. package/dist/esm/hosting/httpHost.js.map +1 -1
  38. package/dist/esm/hosting/index.d.ts +9 -3
  39. package/dist/esm/hosting/index.js +13 -1
  40. package/dist/esm/hosting/index.js.map +1 -1
  41. package/dist/esm/hosting/nodeHost.d.ts +73 -2
  42. package/dist/esm/hosting/nodeHost.js +110 -35
  43. package/dist/esm/hosting/nodeHost.js.map +1 -1
  44. package/dist/esm/hosting/standingAgent.d.ts +58 -14
  45. package/dist/esm/hosting/standingAgent.js +361 -88
  46. package/dist/esm/hosting/standingAgent.js.map +1 -1
  47. package/dist/esm/hosting/types.d.ts +112 -9
  48. package/dist/esm/hosting/types.js +3 -1
  49. package/dist/esm/hosting/types.js.map +1 -1
  50. package/dist/esm/index.d.ts +1 -0
  51. package/dist/esm/index.js +6 -0
  52. package/dist/esm/index.js.map +1 -1
  53. package/dist/esm/lib/bug-report/build.d.ts +103 -0
  54. package/dist/esm/lib/bug-report/build.js +648 -0
  55. package/dist/esm/lib/bug-report/build.js.map +1 -0
  56. package/dist/esm/lib/bug-report/index.d.ts +14 -0
  57. package/dist/esm/lib/bug-report/index.js +13 -0
  58. package/dist/esm/lib/bug-report/index.js.map +1 -0
  59. package/dist/esm/lib/bug-report/transcript.d.ts +61 -0
  60. package/dist/esm/lib/bug-report/transcript.js +124 -0
  61. package/dist/esm/lib/bug-report/transcript.js.map +1 -0
  62. package/dist/esm/lib/bug-report/types.d.ts +206 -0
  63. package/dist/esm/lib/bug-report/types.js +12 -0
  64. package/dist/esm/lib/bug-report/types.js.map +1 -0
  65. package/dist/esm/lib/bug-report/zip.d.ts +71 -0
  66. package/dist/esm/lib/bug-report/zip.js +202 -0
  67. package/dist/esm/lib/bug-report/zip.js.map +1 -0
  68. package/dist/esm/lib/libraryVersion.d.ts +23 -0
  69. package/dist/esm/lib/libraryVersion.js +46 -0
  70. package/dist/esm/lib/libraryVersion.js.map +1 -0
  71. package/dist/esm/lib/trace-toolpack/openRecording.d.ts +17 -0
  72. package/dist/esm/lib/trace-toolpack/openRecording.js +8 -2
  73. package/dist/esm/lib/trace-toolpack/openRecording.js.map +1 -1
  74. package/dist/esm/observability-providers.d.ts +2 -0
  75. package/dist/esm/observability-providers.js +9 -0
  76. package/dist/esm/observability-providers.js.map +1 -1
  77. package/dist/esm/observe.d.ts +1 -0
  78. package/dist/esm/observe.js +6 -0
  79. package/dist/esm/observe.js.map +1 -1
  80. package/dist/hosting/browserSession.js +175 -0
  81. package/dist/hosting/browserSession.js.map +1 -0
  82. package/dist/hosting/httpHost.js +34 -6
  83. package/dist/hosting/httpHost.js.map +1 -1
  84. package/dist/hosting/index.js +16 -1
  85. package/dist/hosting/index.js.map +1 -1
  86. package/dist/hosting/nodeHost.js +112 -36
  87. package/dist/hosting/nodeHost.js.map +1 -1
  88. package/dist/hosting/standingAgent.js +361 -88
  89. package/dist/hosting/standingAgent.js.map +1 -1
  90. package/dist/hosting/types.js +4 -0
  91. package/dist/hosting/types.js.map +1 -1
  92. package/dist/index.js +10 -2
  93. package/dist/index.js.map +1 -1
  94. package/dist/lib/bug-report/build.js +656 -0
  95. package/dist/lib/bug-report/build.js.map +1 -0
  96. package/dist/lib/bug-report/index.js +18 -0
  97. package/dist/lib/bug-report/index.js.map +1 -0
  98. package/dist/lib/bug-report/transcript.js +128 -0
  99. package/dist/lib/bug-report/transcript.js.map +1 -0
  100. package/dist/lib/bug-report/types.js +13 -0
  101. package/dist/lib/bug-report/types.js.map +1 -0
  102. package/dist/lib/bug-report/zip.js +207 -0
  103. package/dist/lib/bug-report/zip.js.map +1 -0
  104. package/dist/lib/libraryVersion.js +51 -0
  105. package/dist/lib/libraryVersion.js.map +1 -0
  106. package/dist/lib/trace-toolpack/openRecording.js +9 -2
  107. package/dist/lib/trace-toolpack/openRecording.js.map +1 -1
  108. package/dist/observability-providers.js +12 -1
  109. package/dist/observability-providers.js.map +1 -1
  110. package/dist/observe.js +14 -6
  111. package/dist/observe.js.map +1 -1
  112. package/dist/types/adapters/observability/audit.d.ts.map +1 -1
  113. package/dist/types/adapters/observability/githubBugReporter.d.ts +155 -0
  114. package/dist/types/adapters/observability/githubBugReporter.d.ts.map +1 -0
  115. package/dist/types/adapters/observability/githubDeviceSignIn.d.ts +132 -0
  116. package/dist/types/adapters/observability/githubDeviceSignIn.d.ts.map +1 -0
  117. package/dist/types/core/Agent.d.ts +13 -4
  118. package/dist/types/core/Agent.d.ts.map +1 -1
  119. package/dist/types/core/agent/stages/seed.d.ts +11 -0
  120. package/dist/types/core/agent/stages/seed.d.ts.map +1 -1
  121. package/dist/types/core/agent/stages/toolCalls.d.ts +3 -2
  122. package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
  123. package/dist/types/core/agent/types.d.ts +35 -4
  124. package/dist/types/core/agent/types.d.ts.map +1 -1
  125. package/dist/types/core/tools.d.ts +5 -2
  126. package/dist/types/core/tools.d.ts.map +1 -1
  127. package/dist/types/hosting/browserSession.d.ts +98 -0
  128. package/dist/types/hosting/browserSession.d.ts.map +1 -0
  129. package/dist/types/hosting/httpHost.d.ts +14 -0
  130. package/dist/types/hosting/httpHost.d.ts.map +1 -1
  131. package/dist/types/hosting/index.d.ts +9 -3
  132. package/dist/types/hosting/index.d.ts.map +1 -1
  133. package/dist/types/hosting/nodeHost.d.ts +73 -2
  134. package/dist/types/hosting/nodeHost.d.ts.map +1 -1
  135. package/dist/types/hosting/standingAgent.d.ts +58 -14
  136. package/dist/types/hosting/standingAgent.d.ts.map +1 -1
  137. package/dist/types/hosting/types.d.ts +112 -9
  138. package/dist/types/hosting/types.d.ts.map +1 -1
  139. package/dist/types/index.d.ts +1 -0
  140. package/dist/types/index.d.ts.map +1 -1
  141. package/dist/types/lib/bug-report/build.d.ts +104 -0
  142. package/dist/types/lib/bug-report/build.d.ts.map +1 -0
  143. package/dist/types/lib/bug-report/index.d.ts +15 -0
  144. package/dist/types/lib/bug-report/index.d.ts.map +1 -0
  145. package/dist/types/lib/bug-report/transcript.d.ts +62 -0
  146. package/dist/types/lib/bug-report/transcript.d.ts.map +1 -0
  147. package/dist/types/lib/bug-report/types.d.ts +207 -0
  148. package/dist/types/lib/bug-report/types.d.ts.map +1 -0
  149. package/dist/types/lib/bug-report/zip.d.ts +72 -0
  150. package/dist/types/lib/bug-report/zip.d.ts.map +1 -0
  151. package/dist/types/lib/libraryVersion.d.ts +24 -0
  152. package/dist/types/lib/libraryVersion.d.ts.map +1 -0
  153. package/dist/types/lib/trace-toolpack/openRecording.d.ts +17 -0
  154. package/dist/types/lib/trace-toolpack/openRecording.d.ts.map +1 -1
  155. package/dist/types/observability-providers.d.ts +2 -0
  156. package/dist/types/observability-providers.d.ts.map +1 -1
  157. package/dist/types/observe.d.ts +1 -0
  158. package/dist/types/observe.d.ts.map +1 -1
  159. package/package.json +1 -1
@@ -471,9 +471,19 @@ async function dispatchOne(req, res, handler, wire) {
471
471
  }
472
472
  const headers = lowerCasedHeaders(req.headers);
473
473
  const query = new URLSearchParams((req.url ?? '').split('?')[1] ?? '');
474
- const { input, sessionId, decision } = wire.readRequest({ body, headers, query });
474
+ const { input, sessionId, decision, responseHeaders } = wire.readRequest({
475
+ body,
476
+ headers,
477
+ query,
478
+ });
479
+ // The dialect's own reply headers — a `Set-Cookie` that issues a session, and
480
+ // nothing else so far. Stripped of `content-type` because the framing below
481
+ // is this host's to decide: a dialect that set it would be choosing between
482
+ // one JSON body and Server-Sent Events on the caller's behalf.
483
+ const extraHeaders = withoutContentType(responseHeaders);
475
484
  if (wantsStream) {
476
485
  res.writeHead(200, {
486
+ ...extraHeaders,
477
487
  'content-type': 'text/event-stream',
478
488
  'cache-control': 'no-cache',
479
489
  connection: 'keep-alive',
@@ -510,7 +520,7 @@ async function dispatchOne(req, res, handler, wire) {
510
520
  res.end();
511
521
  }
512
522
  else {
513
- sendJson(res, 200, wire.output(output));
523
+ sendJson(res, 200, wire.output(output), extraHeaders);
514
524
  }
515
525
  },
516
526
  awaiting(pending) {
@@ -535,7 +545,7 @@ async function dispatchOne(req, res, handler, wire) {
535
545
  res.end();
536
546
  }
537
547
  else {
538
- sendJson(res, AWAITING_STATUS, payload);
548
+ sendJson(res, AWAITING_STATUS, payload, extraHeaders);
539
549
  }
540
550
  },
541
551
  fail(error) {
@@ -549,7 +559,7 @@ async function dispatchOne(req, res, handler, wire) {
549
559
  res.end();
550
560
  }
551
561
  else {
552
- sendJson(res, code !== undefined ? STATUS_BY_CODE[code] ?? 500 : 500, payload);
562
+ sendJson(res, code !== undefined ? STATUS_BY_CODE[code] ?? 500 : 500, payload, extraHeaders);
553
563
  }
554
564
  },
555
565
  };
@@ -629,10 +639,28 @@ function readJson(req) {
629
639
  });
630
640
  });
631
641
  }
632
- function sendJson(res, status, body) {
633
- res.writeHead(status, { 'content-type': 'application/json' });
642
+ function sendJson(res, status, body, extraHeaders) {
643
+ res.writeHead(status, { ...extraHeaders, 'content-type': 'application/json' });
634
644
  res.end(JSON.stringify(body));
635
645
  }
646
+ /**
647
+ * A dialect's reply headers, minus the one it does not get to choose.
648
+ *
649
+ * `content-type` is the framing, and the framing is this host's decision — one
650
+ * JSON body or a stream of SSE frames, picked from what the CALLER asked for. A
651
+ * wire that set it would be answering that question for every caller at once.
652
+ */
653
+ function withoutContentType(headers) {
654
+ if (headers === undefined)
655
+ return undefined;
656
+ const kept = {};
657
+ for (const [name, value] of Object.entries(headers)) {
658
+ if (name.toLowerCase() === 'content-type')
659
+ continue;
660
+ kept[name] = value;
661
+ }
662
+ return Object.keys(kept).length > 0 ? kept : undefined;
663
+ }
636
664
  /**
637
665
  * The last answer a request can be given: its own 500.
638
666
  *
@@ -1 +1 @@
1
- {"version":3,"file":"httpHost.js","sourceRoot":"","sources":["../../../src/hosting/httpHost.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;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AAC;QAAC,MAAM,CAAC;YACP,yEAAyE;YACzE,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;QAC5C,CAAC;QACD,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC,CAAC;QAC3D,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,yEAAyE;QACzE,kEAAkE;IACpE,CAAC;AACH,CAAC;AAED,SAAS,OAAO,CAAC,GAAY;IAC3B,OAAO,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7D,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CACzB,KAA6D,EAC7D,IAAY,EACZ,GAAG,SAAmB;IAEtB,KAAK,MAAM,SAAS,IAAI,CAAC,IAAI,EAAE,GAAG,SAAS,CAAC,EAAE,CAAC;QAC7C,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;QACrD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC;IAClE,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -58,6 +58,11 @@
58
58
  * without `node:sqlite` rather than falling back to memory, because a store
59
59
  * that silently forgot everything looks exactly like a new user.
60
60
  * • `standingAgent({ agent, sessions, host, durability? })` — the composer.
61
+ * `{ agentFactory }` instead of `{ agent }` gives every ACTIVE SESSION its
62
+ * own agent, so sessions run in parallel while each session's turns still
63
+ * serialize on its own instance — bounded by `maxActiveSessions`, evicted
64
+ * least-recently-used, and invisible when it evicts because the
65
+ * conversation lives in the store rather than in the instance.
61
66
  * • `toEnvelope` / `readEnvelope` — pack a conversation, and refuse by name to
62
67
  * unpack a format this runtime does not know.
63
68
  * • `toPausedEnvelope` / `readPausedRun` — the same for a run that stopped to
@@ -80,8 +85,8 @@
80
85
  * });
81
86
  * process.on('SIGTERM', () => void handle.close());
82
87
  */
83
- export { nodeHost, jsonWire } from './nodeHost.js';
84
- export type { NodeHost, NodeHostHandle, NodeHostOptions } from './nodeHost.js';
88
+ export { nodeHost, jsonWire, jsonWireWith, DEFAULT_SESSION_HEADER } from './nodeHost.js';
89
+ export type { NodeHost, NodeHostHandle, NodeHostOptions, JsonWireOptions } from './nodeHost.js';
85
90
  export { httpHost, headerValue } from './httpHost.js';
86
91
  export type { ConversationHandshake, HandshakeFacts, HttpHost, HttpHostHandle, HttpHostOptions, HttpRequestFacts, HttpWire, } from './httpHost.js';
87
92
  export { memorySessions } from './memorySessions.js';
@@ -89,5 +94,6 @@ export { sqliteSessions, SqliteUnavailableError, UnreadableSessionFileError, } f
89
94
  export type { SqliteSessions, SqliteSessionsOptions } from './sqliteSessions.js';
90
95
  export { toEnvelope, toPausedEnvelope, readEnvelope, readPausedRun, checkEnvelope, } from './envelope.js';
91
96
  export { standingAgent } from './standingAgent.js';
97
+ export { DEFAULT_MAX_ACTIVE_SESSIONS } from './types.js';
92
98
  export { requireCapability, HostClosedError, ConcurrentRunError, PauseNotCarriedError, AwaitingDecisionError, NoPendingAskError, UnreadableEnvelopeError, ConversationClosedError, FrameTooLargeError, } from './errors.js';
93
- export type { AgentHost, CheckpointEnvelope, ConcurrentInvokePolicy, ConversationClose, ConversationEnvelope, ConversationHandler, ConversationHost, ConversationLimits, DurabilityMode, HostCapability, HostConversation, HostHandle, HostHandler, HostReply, HostRequest, PausedRun, PausedRunEnvelope, PendingAsk, SessionLifecycle, StandingAgentOptions, Unsubscribe, WakeReason, } from './types.js';
99
+ export type { AgentHost, CheckpointEnvelope, ConcurrentInvokePolicy, ConversationClose, ConversationEnvelope, ConversationHandler, ConversationHost, ConversationLimits, DurabilityMode, HostCapability, HostConversation, HostHandle, HostHandler, HostReply, HostRequest, PausedRun, PausedRunEnvelope, PendingAsk, SessionLifecycle, StandingAgentBaseOptions, StandingAgentOptions, StandingAgentPoolOptions, StandingAgentSharedOptions, Unsubscribe, WakeReason, } from './types.js';
@@ -58,6 +58,11 @@
58
58
  * without `node:sqlite` rather than falling back to memory, because a store
59
59
  * that silently forgot everything looks exactly like a new user.
60
60
  * • `standingAgent({ agent, sessions, host, durability? })` — the composer.
61
+ * `{ agentFactory }` instead of `{ agent }` gives every ACTIVE SESSION its
62
+ * own agent, so sessions run in parallel while each session's turns still
63
+ * serialize on its own instance — bounded by `maxActiveSessions`, evicted
64
+ * least-recently-used, and invisible when it evicts because the
65
+ * conversation lives in the store rather than in the instance.
61
66
  * • `toEnvelope` / `readEnvelope` — pack a conversation, and refuse by name to
62
67
  * unpack a format this runtime does not know.
63
68
  * • `toPausedEnvelope` / `readPausedRun` — the same for a run that stopped to
@@ -80,11 +85,18 @@
80
85
  * });
81
86
  * process.on('SIGTERM', () => void handle.close());
82
87
  */
83
- export { nodeHost, jsonWire } from './nodeHost.js';
88
+ export { nodeHost, jsonWire, jsonWireWith, DEFAULT_SESSION_HEADER } from './nodeHost.js';
89
+ // `browserSessionId` — the CLIENT half of a session — is deliberately NOT on
90
+ // this barrel. It lives in `./browserSession.ts` beside the server half it
91
+ // pairs with, and is exported from the MAIN barrel instead: everything else in
92
+ // this folder is Node (`node:http` behind a dynamic import, `node:sqlite`
93
+ // behind `createRequire`), and a browser bundle must not have to reach through
94
+ // a Node door to mint a session id.
84
95
  export { httpHost, headerValue } from './httpHost.js';
85
96
  export { memorySessions } from './memorySessions.js';
86
97
  export { sqliteSessions, SqliteUnavailableError, UnreadableSessionFileError, } from './sqliteSessions.js';
87
98
  export { toEnvelope, toPausedEnvelope, readEnvelope, readPausedRun, checkEnvelope, } from './envelope.js';
88
99
  export { standingAgent } from './standingAgent.js';
100
+ export { DEFAULT_MAX_ACTIVE_SESSIONS } from './types.js';
89
101
  export { requireCapability, HostClosedError, ConcurrentRunError, PauseNotCarriedError, AwaitingDecisionError, NoPendingAskError, UnreadableEnvelopeError, ConversationClosedError, FrameTooLargeError, } from './errors.js';
90
102
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hosting/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;AAEH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAWtD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hosting/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AAEH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEzF,6EAA6E;AAC7E,2EAA2E;AAC3E,+EAA+E;AAC/E,0EAA0E;AAC1E,+EAA+E;AAC/E,oCAAoC;AAEpC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAWtD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAEzD,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,aAAa,CAAC"}
@@ -113,6 +113,27 @@ export interface NodeHostOptions {
113
113
  * });
114
114
  */
115
115
  readonly onUnhandled?: (req: import('node:http').IncomingMessage, res: import('node:http').ServerResponse) => void;
116
+ /**
117
+ * Which header carries the session id. Default `'x-session-id'` — the header
118
+ * this adapter has always read, now named so a deployment can change it.
119
+ *
120
+ * The pairing on the client side is one line:
121
+ * `browserSessionId()` from the main barrel mints the id, keeps it, and hands
122
+ * it back on every call.
123
+ */
124
+ readonly sessionHeader?: string;
125
+ /**
126
+ * Read the session from a cookie of this name, and ISSUE one (HttpOnly,
127
+ * SameSite=Lax) when the request carried none — a durable per-browser
128
+ * conversation with no client code at all.
129
+ *
130
+ * Off by default. The trade-offs are real and are stated in full on
131
+ * {@link JsonWireOptions.sessionCookie} — read them before turning it on;
132
+ * the short version is that a cookie is browser affinity and never identity,
133
+ * and that no `Secure` flag is set because this host cannot know whether it
134
+ * is behind TLS.
135
+ */
136
+ readonly sessionCookie?: string;
116
137
  }
117
138
  /**
118
139
  * What {@link nodeHost}'s `serve()` resolves to — a `HostHandle` that also
@@ -122,14 +143,64 @@ export interface NodeHostOptions {
122
143
  export type NodeHostHandle = HttpHostHandle;
123
144
  /** `AgentHost` narrowed to this adapter's handle. */
124
145
  export type NodeHost = HttpHost;
146
+ /** The header this dialect reads a session id from when nobody says otherwise. */
147
+ export declare const DEFAULT_SESSION_HEADER = "x-session-id";
148
+ /** What {@link jsonWireWith} lets a deployment re-decide about sessions. */
149
+ export interface JsonWireOptions {
150
+ /**
151
+ * Which header carries the session id. Default `'x-session-id'`, matched
152
+ * case-insensitively (headers reach a wire already lower-cased).
153
+ *
154
+ * Change it when something in front of the process already stamps a
155
+ * conversation id under its own name — a gateway, a CDN, a corporate proxy.
156
+ * The JSON body's `sessionId` still wins over it, unchanged.
157
+ */
158
+ readonly sessionHeader?: string;
159
+ /**
160
+ * Read the session from a COOKIE of this name, and issue one when the request
161
+ * did not carry it. Off by default.
162
+ *
163
+ * ── What it buys ─────────────────────────────────────────────────────────
164
+ * A browser gets a durable conversation with **no client code at all**: the
165
+ * first request comes back with `Set-Cookie`, and every later request carries
166
+ * it automatically. Nothing to mint, nothing to store, nothing to remember to
167
+ * send.
168
+ *
169
+ * ── What it costs, stated rather than discovered ─────────────────────────
170
+ * - **It is browser affinity, not identity.** The same laws as
171
+ * {@link HostRequest.sessionId}: a cookie is client data, anyone can send
172
+ * any value, and nothing here signs or verifies it. Authenticate the
173
+ * caller by your own means before serving the session they claimed.
174
+ * - **No `Secure` flag is set**, because this host cannot know whether it is
175
+ * behind TLS — it is routinely terminated at a proxy and answers plain
176
+ * HTTP itself. On the public internet, add `Secure` at your proxy or
177
+ * terminate TLS here; a session cookie on plain HTTP travels in the clear.
178
+ * - `HttpOnly` and `SameSite=Lax` ARE set: script on the page cannot read
179
+ * the id, and a cross-site POST does not carry it. `HttpOnly` also means
180
+ * your own front-end code cannot read it — if the page needs the id in
181
+ * hand, use `browserSessionId()` and the header instead.
182
+ * - **It follows the browser, not the person.** One profile is one
183
+ * conversation; two devices are two, and a shared machine is one.
184
+ * - A caller that already sent a session (body, header, or an existing
185
+ * cookie) is never issued a second one — two competing handles for one
186
+ * conversation is worse than none.
187
+ */
188
+ readonly sessionCookie?: string;
189
+ }
125
190
  /**
126
- * This adapter's own JSON dialect: `{ input, sessionId? }` in, `{ output }`
127
- * out, `{ status: 'ok', uptimeMs }` on the health path.
191
+ * Build this adapter's JSON dialect: `{ input, sessionId? }` in, `{ output }`
192
+ * out, `{ status: 'ok', uptimeMs }` on the health path — with the session
193
+ * plumbing a deployment gets to re-decide.
128
194
  *
129
195
  * Exported by name so a deployment that has to keep these exact bodies while
130
196
  * changing something else about the host reuses them rather than retyping them
131
197
  * and getting one field subtly wrong.
132
198
  */
199
+ export declare function jsonWireWith(options?: JsonWireOptions): HttpWire;
200
+ /**
201
+ * This adapter's own JSON dialect with its defaults: the session on
202
+ * `x-session-id`, no cookie.
203
+ */
133
204
  export declare const jsonWire: HttpWire;
134
205
  /**
135
206
  * An HTTP host for one handler.
@@ -48,46 +48,113 @@
48
48
  */
49
49
  import { headerValue, httpHost, } from './httpHost.js';
50
50
  const HOST_NAME = 'nodeHost';
51
+ /** The header this dialect reads a session id from when nobody says otherwise. */
52
+ export const DEFAULT_SESSION_HEADER = 'x-session-id';
51
53
  /**
52
- * This adapter's own JSON dialect: `{ input, sessionId? }` in, `{ output }`
53
- * out, `{ status: 'ok', uptimeMs }` on the health path.
54
+ * Build this adapter's JSON dialect: `{ input, sessionId? }` in, `{ output }`
55
+ * out, `{ status: 'ok', uptimeMs }` on the health path — with the session
56
+ * plumbing a deployment gets to re-decide.
54
57
  *
55
58
  * Exported by name so a deployment that has to keep these exact bodies while
56
59
  * changing something else about the host reuses them rather than retyping them
57
60
  * and getting one field subtly wrong.
58
61
  */
59
- export const jsonWire = {
60
- readRequest(facts) {
61
- const input = typeof facts.body.input === 'string' ? facts.body.input : '';
62
- // sessionId is caller data whichever way it arrives; the body wins so a
63
- // caller that sets both is not surprised by which one the server preferred.
64
- const fromBody = typeof facts.body.sessionId === 'string' ? facts.body.sessionId : undefined;
65
- const sessionId = fromBody ?? facts.headers['x-session-id'];
66
- // Read as-is and never coerced: `decision` is a person's answer to whatever
67
- // a tool asked, and this dialect does not get to decide what that looks
68
- // like. Its PRESENCE is the whole signal.
69
- const decision = facts.body.decision;
70
- return {
71
- input,
72
- ...(sessionId !== undefined && { sessionId }),
73
- ...(decision !== undefined && { decision }),
74
- };
75
- },
76
- health: (uptimeMs) => ({ status: 'ok', uptimeMs }),
77
- output: (output) => ({ output }),
78
- failure: (error, code) => ({ error, ...(code !== undefined && { code }) }),
79
- chunk: (text) => ({ text }),
80
- awaiting: (pending) => ({ awaiting: pending }),
81
- readConversation(facts) {
82
- // A handshake has no body, so this dialect names the two places a session
83
- // id can be: the header a server-side caller sets, and the query a BROWSER
84
- // has to use because the WebSocket API gives it no way to set a header.
85
- // Header wins, so a caller that sets both is not surprised by which one the
86
- // server preferred — the same rule the request dialect uses for body-vs-header.
87
- const sessionId = headerValue(facts, 'x-session-id') ?? facts.query.get('sessionId') ?? undefined;
88
- return { ...(sessionId !== undefined && sessionId.length > 0 && { sessionId }) };
89
- },
90
- };
62
+ export function jsonWireWith(options = {}) {
63
+ const sessionHeader = options.sessionHeader ?? DEFAULT_SESSION_HEADER;
64
+ const sessionCookie = options.sessionCookie;
65
+ return {
66
+ readRequest(facts) {
67
+ const input = typeof facts.body.input === 'string' ? facts.body.input : '';
68
+ // sessionId is caller data whichever way it arrives; the body wins so a
69
+ // caller that sets both is not surprised by which one the server preferred.
70
+ // The cookie is last, because a caller that named a session explicitly
71
+ // meant that one — the cookie is what the BROWSER remembered, and the
72
+ // explicit value is what this request said.
73
+ const fromBody = typeof facts.body.sessionId === 'string' ? facts.body.sessionId : undefined;
74
+ const fromHeader = headerValue(facts, sessionHeader);
75
+ const fromCookie = sessionCookie !== undefined ? cookieValue(facts.headers.cookie, sessionCookie) : undefined;
76
+ const carried = fromBody ?? fromHeader ?? fromCookie;
77
+ // Issued ONLY in cookie mode, and only when this request carried no
78
+ // session at all. A caller holding a session already has a conversation;
79
+ // handing it a second handle would split it in two.
80
+ const minted = sessionCookie !== undefined && carried === undefined ? mintSessionId() : undefined;
81
+ const sessionId = carried ?? minted;
82
+ // Read as-is and never coerced: `decision` is a person's answer to whatever
83
+ // a tool asked, and this dialect does not get to decide what that looks
84
+ // like. Its PRESENCE is the whole signal.
85
+ const decision = facts.body.decision;
86
+ return {
87
+ input,
88
+ ...(sessionId !== undefined && { sessionId }),
89
+ ...(decision !== undefined && { decision }),
90
+ ...(minted !== undefined &&
91
+ sessionCookie !== undefined && {
92
+ responseHeaders: { 'set-cookie': sessionCookieHeader(sessionCookie, minted) },
93
+ }),
94
+ };
95
+ },
96
+ health: (uptimeMs) => ({ status: 'ok', uptimeMs }),
97
+ output: (output) => ({ output }),
98
+ failure: (error, code) => ({ error, ...(code !== undefined && { code }) }),
99
+ chunk: (text) => ({ text }),
100
+ awaiting: (pending) => ({ awaiting: pending }),
101
+ readConversation(facts) {
102
+ // A handshake has no body, so this dialect names the three places a
103
+ // session id can be: the header a server-side caller sets, the cookie the
104
+ // browser sends on its own (when cookie mode is on), and the query a
105
+ // BROWSER has to use because the WebSocket API gives it no way to set a
106
+ // header. Header wins, so a caller that sets both is not surprised by
107
+ // which one the server preferred — the same rule the request dialect uses
108
+ // for body-vs-header.
109
+ //
110
+ // Nothing is MINTED here, in either mode: the 101 this door writes is not
111
+ // a reply a wire composes, so a session issued on a handshake could never
112
+ // reach the client and would be a conversation nobody could resume.
113
+ const sessionId = headerValue(facts, sessionHeader) ??
114
+ (sessionCookie !== undefined
115
+ ? cookieValue(facts.headers.cookie, sessionCookie)
116
+ : undefined) ??
117
+ facts.query.get('sessionId') ??
118
+ undefined;
119
+ return { ...(sessionId !== undefined && sessionId.length > 0 && { sessionId }) };
120
+ },
121
+ };
122
+ }
123
+ /**
124
+ * This adapter's own JSON dialect with its defaults: the session on
125
+ * `x-session-id`, no cookie.
126
+ */
127
+ export const jsonWire = jsonWireWith();
128
+ /**
129
+ * One cookie's value out of a `Cookie` header, or `undefined`.
130
+ *
131
+ * Deliberately small: it splits on `;`, takes the first `=`, and trims. It does
132
+ * not decode, because a session id this library minted is URL-safe and a value
133
+ * somebody else's system minted is theirs to interpret — guessing at an
134
+ * encoding is how a session id silently becomes a different string.
135
+ */
136
+ function cookieValue(header, name) {
137
+ if (header === undefined || header.length === 0)
138
+ return undefined;
139
+ for (const pair of header.split(';')) {
140
+ const at = pair.indexOf('=');
141
+ if (at < 0)
142
+ continue;
143
+ if (pair.slice(0, at).trim() !== name)
144
+ continue;
145
+ const value = pair.slice(at + 1).trim();
146
+ return value.length > 0 ? value : undefined;
147
+ }
148
+ return undefined;
149
+ }
150
+ /** The `Set-Cookie` this dialect issues. See {@link JsonWireOptions.sessionCookie}. */
151
+ function sessionCookieHeader(name, value) {
152
+ return `${name}=${value}; Path=/; HttpOnly; SameSite=Lax`;
153
+ }
154
+ /** A session id for a caller that carried none. Node 20+ has global `crypto`. */
155
+ function mintSessionId() {
156
+ return globalThis.crypto.randomUUID();
157
+ }
91
158
  /**
92
159
  * An HTTP host for one handler.
93
160
  *
@@ -101,9 +168,17 @@ export const jsonWire = {
101
168
  * await handle.close();
102
169
  */
103
170
  export function nodeHost(options = {}) {
171
+ // The shared default instance when nothing about sessions was re-decided, so
172
+ // a host built with no options is the same object graph it always was.
173
+ const wire = options.sessionHeader === undefined && options.sessionCookie === undefined
174
+ ? jsonWire
175
+ : jsonWireWith({
176
+ ...(options.sessionHeader !== undefined && { sessionHeader: options.sessionHeader }),
177
+ ...(options.sessionCookie !== undefined && { sessionCookie: options.sessionCookie }),
178
+ });
104
179
  return httpHost({
105
180
  name: HOST_NAME,
106
- wire: jsonWire,
181
+ wire,
107
182
  // Chosen, not inherited — see the test in this folder that greps for one
108
183
  // particular runtime's container-contract path literal.
109
184
  invokePath: options.invokePath ?? '/invoke',
@@ -1 +1 @@
1
- {"version":3,"file":"nodeHost.js","sourceR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ACxD,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,SAAS;QAC3C,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,SAAS;QAC3C,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,IAAI,eAAe;QAC7D,GAAG,CAAC,OAAO,CAAC,kBAAkB,KAAK,SAAS,IAAI;YAC9C,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;SAC/C,CAAC;QACF,uEAAuE;QACvE,0EAA0E;QAC1E,yEAAyE;QACzE,0DAA0D;QAC1D,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;QACzD,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC;QACrE,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;QAC/D,0EAA0E;QAC1E,0EAA0E;QAC1E,qDAAqD;QACrD,GAAG,CAAC,OAAO,CAAC,WAAW,KAAK,SAAS,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC;KAC/E,CAAC,CAAC;AACL,CAAC"}
@@ -51,33 +51,69 @@
51
51
  * Resuming a PAUSED run is different in kind: it is not a replay at all — the
52
52
  * engine continues from its own checkpoint, and no earlier tool call re-runs.
53
53
  *
54
- * ── Why one run at a time ───────────────────────────────────────────────────
55
- * An Agent instance holds per-run state on itself, and this composer shares ONE
56
- * instance across every session. Two runs overlapping on it do not crash —
57
- * which is precisely the danger. They both finish, and the state the composer
58
- * reads afterwards belongs to whichever started last, so one session's envelope
59
- * can end up holding another session's conversation. Nothing in the recording
60
- * would say so. Runs are therefore serialized, globally, and that is a
61
- * correctness requirement rather than a tuning choice.
54
+ * ── Why one run at a time, and where that bound actually is ─────────────────
55
+ * An Agent instance holds per-run state on itself. Two runs overlapping on ONE
56
+ * instance do not crash — which is precisely the danger. They both finish, and
57
+ * the state the composer reads afterwards belongs to whichever started last, so
58
+ * one session's envelope can end up holding another session's conversation.
59
+ * Nothing in the recording would say so. **Runs on one instance are therefore
60
+ * serialized, and that is a correctness requirement rather than a tuning
61
+ * choice.**
62
+ *
63
+ * What CHANGED in 9.10.0 is not that rule but its scope. `{ agent }` hands this
64
+ * composer one instance to share, so the serialization is global — the shape
65
+ * every earlier release had, unchanged to the byte. `{ agentFactory }` hands it
66
+ * a way to MAKE instances, so each session gets its own and the same rule binds
67
+ * per session: sessions run in parallel, each session's turns queue behind that
68
+ * session's own instance.
69
+ *
70
+ * standingAgent({ agent }) → one instance, global queue
71
+ * standingAgent({ agentFactory }) → one per session, a queue each
72
+ *
73
+ * Everything else is identical between the two: the same stores, the same
74
+ * durability modes, the same pause/resume contract, the same refusals. The
75
+ * session store is keyed per session already, which is why the pool can evict a
76
+ * session's instance without the person on the other end noticing — the
77
+ * CONVERSATION was never in the instance.
62
78
  *
63
79
  * `onConcurrentInvoke` is the separate question of what to do when a second
64
80
  * turn of the SAME conversation arrives while the first is running: refuse it
65
- * (default) or queue it. A request for a DIFFERENT session is never refused —
66
- * there is nothing wrong with it; it simply waits its turn.
81
+ * (default) or queue it. It means the same thing in both shapes. A request for
82
+ * a DIFFERENT session is never refused — there is nothing wrong with it; in the
83
+ * shared shape it waits its turn, and in the pooled shape it does not have to.
84
+ *
85
+ * ── The pool, in one paragraph ──────────────────────────────────────────────
86
+ * One instance per ACTIVE session, built on first sight by the factory, bounded
87
+ * by `maxActiveSessions` (default 100) and evicted least-recently-used. An
88
+ * evicted session's agent has its tool sessions closed with reason `'evicted'`
89
+ * — the 9.7.0 vocabulary, not a new one — and is then shut down; its
90
+ * conversation stays in the store, so its next request re-hydrates onto a fresh
91
+ * instance and nothing was lost. A session that is RUNNING is never evicted:
92
+ * the bound is on retained idle instances, and a cache policy does not get to
93
+ * end somebody's turn. Requests with NO session share one fallback instance,
94
+ * because there is no conversation to isolate and an instance per anonymous
95
+ * request would be an instance per request.
67
96
  *
68
97
  * Pattern: Composition root. It owns wiring and ordering; it invents no
69
98
  * mechanism of its own.
70
99
  */
71
100
  import type { HostHandle, StandingAgentOptions } from './types.js';
72
101
  /**
73
- * Serve one agent, with per-session conversation memory, on any
102
+ * Serve an agent, with per-session conversation memory, on any
74
103
  * {@link AgentHost}.
75
104
  *
76
105
  * Resolves once the host is live. Closing the returned handle closes the host,
77
- * detaches the listeners this composer added to the agent, and removes its
78
- * durability wiring.
106
+ * detaches the listeners this composer added, and removes its durability
107
+ * wiring.
108
+ *
109
+ * Two shapes, one composer — see the file header for the full comparison:
79
110
  *
80
- * @example
111
+ * - `{ agent }` — one instance for every session, runs serialized globally.
112
+ * Correct, and unchanged from every earlier release.
113
+ * - `{ agentFactory }` — one instance per active session, sessions in
114
+ * PARALLEL, each session's turns serialized on its own instance.
115
+ *
116
+ * @example One agent, every session
81
117
  * const handle = await standingAgent({
82
118
  * agent,
83
119
  * sessions: memorySessions(),
@@ -86,5 +122,13 @@ import type { HostHandle, StandingAgentOptions } from './types.js';
86
122
  * durability: 'sync',
87
123
  * });
88
124
  * process.on('SIGTERM', () => void handle.close());
125
+ *
126
+ * @example One agent per session — they answer at the same time
127
+ * const handle = await standingAgent({
128
+ * agentFactory: () => Agent.create({ provider, model }).system('…').build(),
129
+ * sessions: sqliteSessions({ file: './sessions.db' }),
130
+ * host: nodeHost({ port: 8080 }),
131
+ * maxActiveSessions: 200,
132
+ * });
89
133
  */
90
134
  export declare function standingAgent<TH extends HostHandle>(options: StandingAgentOptions<TH>): Promise<TH>;