agentfootprint 9.9.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 (77) hide show
  1. package/dist/core/Agent.js +13 -4
  2. package/dist/core/Agent.js.map +1 -1
  3. package/dist/core/agent/stages/seed.js +38 -6
  4. package/dist/core/agent/stages/seed.js.map +1 -1
  5. package/dist/core/agent/stages/toolCalls.js.map +1 -1
  6. package/dist/core/tools.js.map +1 -1
  7. package/dist/esm/core/Agent.d.ts +13 -4
  8. package/dist/esm/core/Agent.js +13 -4
  9. package/dist/esm/core/Agent.js.map +1 -1
  10. package/dist/esm/core/agent/stages/seed.d.ts +11 -0
  11. package/dist/esm/core/agent/stages/seed.js +38 -6
  12. package/dist/esm/core/agent/stages/seed.js.map +1 -1
  13. package/dist/esm/core/agent/stages/toolCalls.d.ts +3 -2
  14. package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
  15. package/dist/esm/core/agent/types.d.ts +35 -4
  16. package/dist/esm/core/tools.d.ts +5 -2
  17. package/dist/esm/core/tools.js.map +1 -1
  18. package/dist/esm/hosting/browserSession.d.ts +97 -0
  19. package/dist/esm/hosting/browserSession.js +171 -0
  20. package/dist/esm/hosting/browserSession.js.map +1 -0
  21. package/dist/esm/hosting/httpHost.d.ts +14 -0
  22. package/dist/esm/hosting/httpHost.js +34 -6
  23. package/dist/esm/hosting/httpHost.js.map +1 -1
  24. package/dist/esm/hosting/index.d.ts +9 -3
  25. package/dist/esm/hosting/index.js +13 -1
  26. package/dist/esm/hosting/index.js.map +1 -1
  27. package/dist/esm/hosting/nodeHost.d.ts +73 -2
  28. package/dist/esm/hosting/nodeHost.js +110 -35
  29. package/dist/esm/hosting/nodeHost.js.map +1 -1
  30. package/dist/esm/hosting/standingAgent.d.ts +58 -14
  31. package/dist/esm/hosting/standingAgent.js +361 -88
  32. package/dist/esm/hosting/standingAgent.js.map +1 -1
  33. package/dist/esm/hosting/types.d.ts +112 -9
  34. package/dist/esm/hosting/types.js +3 -1
  35. package/dist/esm/hosting/types.js.map +1 -1
  36. package/dist/esm/index.d.ts +1 -0
  37. package/dist/esm/index.js +6 -0
  38. package/dist/esm/index.js.map +1 -1
  39. package/dist/hosting/browserSession.js +175 -0
  40. package/dist/hosting/browserSession.js.map +1 -0
  41. package/dist/hosting/httpHost.js +34 -6
  42. package/dist/hosting/httpHost.js.map +1 -1
  43. package/dist/hosting/index.js +16 -1
  44. package/dist/hosting/index.js.map +1 -1
  45. package/dist/hosting/nodeHost.js +112 -36
  46. package/dist/hosting/nodeHost.js.map +1 -1
  47. package/dist/hosting/standingAgent.js +361 -88
  48. package/dist/hosting/standingAgent.js.map +1 -1
  49. package/dist/hosting/types.js +4 -0
  50. package/dist/hosting/types.js.map +1 -1
  51. package/dist/index.js +10 -2
  52. package/dist/index.js.map +1 -1
  53. package/dist/types/core/Agent.d.ts +13 -4
  54. package/dist/types/core/Agent.d.ts.map +1 -1
  55. package/dist/types/core/agent/stages/seed.d.ts +11 -0
  56. package/dist/types/core/agent/stages/seed.d.ts.map +1 -1
  57. package/dist/types/core/agent/stages/toolCalls.d.ts +3 -2
  58. package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
  59. package/dist/types/core/agent/types.d.ts +35 -4
  60. package/dist/types/core/agent/types.d.ts.map +1 -1
  61. package/dist/types/core/tools.d.ts +5 -2
  62. package/dist/types/core/tools.d.ts.map +1 -1
  63. package/dist/types/hosting/browserSession.d.ts +98 -0
  64. package/dist/types/hosting/browserSession.d.ts.map +1 -0
  65. package/dist/types/hosting/httpHost.d.ts +14 -0
  66. package/dist/types/hosting/httpHost.d.ts.map +1 -1
  67. package/dist/types/hosting/index.d.ts +9 -3
  68. package/dist/types/hosting/index.d.ts.map +1 -1
  69. package/dist/types/hosting/nodeHost.d.ts +73 -2
  70. package/dist/types/hosting/nodeHost.d.ts.map +1 -1
  71. package/dist/types/hosting/standingAgent.d.ts +58 -14
  72. package/dist/types/hosting/standingAgent.d.ts.map +1 -1
  73. package/dist/types/hosting/types.d.ts +112 -9
  74. package/dist/types/hosting/types.d.ts.map +1 -1
  75. package/dist/types/index.d.ts +1 -0
  76. package/dist/types/index.d.ts.map +1 -1
  77. package/package.json +1 -1
@@ -0,0 +1,97 @@
1
+ /**
2
+ * hosting/browserSession — the client half of a session, for a page.
3
+ *
4
+ * A standing agent remembers a conversation per `sessionId`. Something has to
5
+ * decide what that id IS, and in a browser that is one line:
6
+ *
7
+ * const sessionId = browserSessionId();
8
+ * await fetch('/invoke', {
9
+ * method: 'POST',
10
+ * headers: { 'content-type': 'application/json', 'x-session-id': sessionId },
11
+ * body: JSON.stringify({ input: 'hello' }),
12
+ * });
13
+ *
14
+ * The server half is `nodeHost({ sessionHeader })` (default `'x-session-id'`,
15
+ * so the line above needs no server option at all) or
16
+ * `nodeHost({ sessionCookie })`, which does the same job without any client
17
+ * code — see those options for the trade.
18
+ *
19
+ * ── Why this file imports NOTHING ────────────────────────────────────────────
20
+ * It is the one piece of `hosting/` a browser bundle is meant to contain, and
21
+ * the rest of that folder is Node: `httpHost` dynamically imports `node:http`,
22
+ * `sqliteSessions` reaches `node:sqlite` through `createRequire`. So this file
23
+ * has no imports at all and is exported from the MAIN barrel
24
+ * (`import { browserSessionId } from 'agentfootprint'`) rather than from
25
+ * `agentfootprint/hosting`, which no browser bundle should have to pull in. It
26
+ * lives here, beside the server half it pairs with, so the two cannot drift
27
+ * about which header carries what.
28
+ *
29
+ * Pattern: a plain function. There is no state to own beyond the storage key.
30
+ */
31
+ /** Options for {@link browserSessionId}. */
32
+ export interface BrowserSessionIdOptions {
33
+ /**
34
+ * Where the id is kept. Default `'agentfootprint.sessionId'`.
35
+ *
36
+ * Change it when one origin serves two different agents that must not share a
37
+ * conversation — two keys, two sessions, one browser.
38
+ */
39
+ readonly storageKey?: string;
40
+ }
41
+ /** The default `localStorage` key. Named, so a page can clear it deliberately. */
42
+ export declare const DEFAULT_SESSION_STORAGE_KEY = "agentfootprint.sessionId";
43
+ /**
44
+ * The conversation this browser is having with your agent: minted once, kept,
45
+ * and handed back on every later call.
46
+ *
47
+ * Pass it as `x-session-id` (or in the JSON body as `sessionId`) and a
48
+ * `standingAgent` will hydrate the same conversation on every turn — and, since
49
+ * 9.10.0, scope the agent's memory to it too, with no configuration.
50
+ *
51
+ * ── What it is, and the thing it is NOT ──────────────────────────────────────
52
+ * **A session id is not authentication.** It is a handle the browser carries,
53
+ * and anyone who can reach your host can send any string in its place. Nothing
54
+ * here signs it, and nothing on the server side checks it: authenticate the
55
+ * caller by your own means, then check that the authenticated principal is
56
+ * allowed the session they claimed. Storing anything sensitive under a session
57
+ * id alone is storing it under a value the client controls.
58
+ *
59
+ * ── Where it is kept, and what that costs ────────────────────────────────────
60
+ * `localStorage`, under {@link BrowserSessionIdOptions.storageKey}. That means
61
+ * it survives a reload and a closed tab, is scoped to the ORIGIN, and is
62
+ * readable by any script running on that origin — including one you did not
63
+ * write. It is per browser profile, so the same person on a phone and a laptop
64
+ * is two conversations, and a shared machine is one.
65
+ *
66
+ * When `localStorage` cannot be reached — private mode in some browsers throws
67
+ * on access, and there is no `window` at all during SSR — the id is kept in a
68
+ * module-level `Map` instead. Same id for the life of the page, gone on reload.
69
+ * This is a fallback and it is stated rather than hidden: a page that must
70
+ * survive a reload in private mode needs its own storage.
71
+ *
72
+ * ── How it is minted ─────────────────────────────────────────────────────────
73
+ * `crypto.randomUUID()` where it exists (every current browser, in a secure
74
+ * context), then `crypto.getRandomValues`. Both are unguessable. On a runtime
75
+ * that has NEITHER — an insecure-context page in an older browser — it falls
76
+ * back to `Math.random`, which is **not** unguessable, and that is survivable
77
+ * only because of the paragraph above: this id is a handle, never a credential.
78
+ *
79
+ * @example A chat page that remembers across reloads
80
+ * ```ts
81
+ * import { browserSessionId } from 'agentfootprint';
82
+ *
83
+ * const sessionId = browserSessionId();
84
+ * const reply = await fetch('/invoke', {
85
+ * method: 'POST',
86
+ * headers: { 'content-type': 'application/json', 'x-session-id': sessionId },
87
+ * body: JSON.stringify({ input: message }),
88
+ * }).then((r) => r.json());
89
+ * ```
90
+ *
91
+ * @example Two agents on one origin, two conversations
92
+ * ```ts
93
+ * const support = browserSessionId({ storageKey: 'support.sessionId' });
94
+ * const billing = browserSessionId({ storageKey: 'billing.sessionId' });
95
+ * ```
96
+ */
97
+ export declare function browserSessionId(options?: BrowserSessionIdOptions): string;
@@ -0,0 +1,171 @@
1
+ /**
2
+ * hosting/browserSession — the client half of a session, for a page.
3
+ *
4
+ * A standing agent remembers a conversation per `sessionId`. Something has to
5
+ * decide what that id IS, and in a browser that is one line:
6
+ *
7
+ * const sessionId = browserSessionId();
8
+ * await fetch('/invoke', {
9
+ * method: 'POST',
10
+ * headers: { 'content-type': 'application/json', 'x-session-id': sessionId },
11
+ * body: JSON.stringify({ input: 'hello' }),
12
+ * });
13
+ *
14
+ * The server half is `nodeHost({ sessionHeader })` (default `'x-session-id'`,
15
+ * so the line above needs no server option at all) or
16
+ * `nodeHost({ sessionCookie })`, which does the same job without any client
17
+ * code — see those options for the trade.
18
+ *
19
+ * ── Why this file imports NOTHING ────────────────────────────────────────────
20
+ * It is the one piece of `hosting/` a browser bundle is meant to contain, and
21
+ * the rest of that folder is Node: `httpHost` dynamically imports `node:http`,
22
+ * `sqliteSessions` reaches `node:sqlite` through `createRequire`. So this file
23
+ * has no imports at all and is exported from the MAIN barrel
24
+ * (`import { browserSessionId } from 'agentfootprint'`) rather than from
25
+ * `agentfootprint/hosting`, which no browser bundle should have to pull in. It
26
+ * lives here, beside the server half it pairs with, so the two cannot drift
27
+ * about which header carries what.
28
+ *
29
+ * Pattern: a plain function. There is no state to own beyond the storage key.
30
+ */
31
+ /** The default `localStorage` key. Named, so a page can clear it deliberately. */
32
+ export const DEFAULT_SESSION_STORAGE_KEY = 'agentfootprint.sessionId';
33
+ /**
34
+ * Storage for the runs where `localStorage` is not there — a private-mode
35
+ * browser that throws on access, an SSR pass, a test. One `Map` for the module,
36
+ * so a second call in the same page still gets the same id back.
37
+ */
38
+ const fallbackStore = new Map();
39
+ /**
40
+ * The conversation this browser is having with your agent: minted once, kept,
41
+ * and handed back on every later call.
42
+ *
43
+ * Pass it as `x-session-id` (or in the JSON body as `sessionId`) and a
44
+ * `standingAgent` will hydrate the same conversation on every turn — and, since
45
+ * 9.10.0, scope the agent's memory to it too, with no configuration.
46
+ *
47
+ * ── What it is, and the thing it is NOT ──────────────────────────────────────
48
+ * **A session id is not authentication.** It is a handle the browser carries,
49
+ * and anyone who can reach your host can send any string in its place. Nothing
50
+ * here signs it, and nothing on the server side checks it: authenticate the
51
+ * caller by your own means, then check that the authenticated principal is
52
+ * allowed the session they claimed. Storing anything sensitive under a session
53
+ * id alone is storing it under a value the client controls.
54
+ *
55
+ * ── Where it is kept, and what that costs ────────────────────────────────────
56
+ * `localStorage`, under {@link BrowserSessionIdOptions.storageKey}. That means
57
+ * it survives a reload and a closed tab, is scoped to the ORIGIN, and is
58
+ * readable by any script running on that origin — including one you did not
59
+ * write. It is per browser profile, so the same person on a phone and a laptop
60
+ * is two conversations, and a shared machine is one.
61
+ *
62
+ * When `localStorage` cannot be reached — private mode in some browsers throws
63
+ * on access, and there is no `window` at all during SSR — the id is kept in a
64
+ * module-level `Map` instead. Same id for the life of the page, gone on reload.
65
+ * This is a fallback and it is stated rather than hidden: a page that must
66
+ * survive a reload in private mode needs its own storage.
67
+ *
68
+ * ── How it is minted ─────────────────────────────────────────────────────────
69
+ * `crypto.randomUUID()` where it exists (every current browser, in a secure
70
+ * context), then `crypto.getRandomValues`. Both are unguessable. On a runtime
71
+ * that has NEITHER — an insecure-context page in an older browser — it falls
72
+ * back to `Math.random`, which is **not** unguessable, and that is survivable
73
+ * only because of the paragraph above: this id is a handle, never a credential.
74
+ *
75
+ * @example A chat page that remembers across reloads
76
+ * ```ts
77
+ * import { browserSessionId } from 'agentfootprint';
78
+ *
79
+ * const sessionId = browserSessionId();
80
+ * const reply = await fetch('/invoke', {
81
+ * method: 'POST',
82
+ * headers: { 'content-type': 'application/json', 'x-session-id': sessionId },
83
+ * body: JSON.stringify({ input: message }),
84
+ * }).then((r) => r.json());
85
+ * ```
86
+ *
87
+ * @example Two agents on one origin, two conversations
88
+ * ```ts
89
+ * const support = browserSessionId({ storageKey: 'support.sessionId' });
90
+ * const billing = browserSessionId({ storageKey: 'billing.sessionId' });
91
+ * ```
92
+ */
93
+ export function browserSessionId(options = {}) {
94
+ const key = options.storageKey ?? DEFAULT_SESSION_STORAGE_KEY;
95
+ const existing = readStored(key);
96
+ if (existing !== undefined && existing.length > 0)
97
+ return existing;
98
+ const minted = mintId();
99
+ writeStored(key, minted);
100
+ return minted;
101
+ }
102
+ /**
103
+ * `localStorage` if it is both present and usable, otherwise `undefined`.
104
+ *
105
+ * Presence is not usability: Safari's private mode has historically THROWN on
106
+ * `localStorage` access rather than being absent, so the only honest test is to
107
+ * touch it inside a try.
108
+ */
109
+ function storage() {
110
+ try {
111
+ const candidate = globalThis.localStorage;
112
+ if (candidate === undefined || candidate === null)
113
+ return undefined;
114
+ // A round trip, because a quota-exhausted or disabled store can be present
115
+ // and still refuse every write.
116
+ const probe = '__agentfootprint_probe__';
117
+ candidate.setItem(probe, '1');
118
+ candidate.removeItem(probe);
119
+ return candidate;
120
+ }
121
+ catch {
122
+ return undefined;
123
+ }
124
+ }
125
+ function readStored(key) {
126
+ const store = storage();
127
+ if (store === undefined)
128
+ return fallbackStore.get(key);
129
+ try {
130
+ return store.getItem(key) ?? undefined;
131
+ }
132
+ catch {
133
+ return fallbackStore.get(key);
134
+ }
135
+ }
136
+ function writeStored(key, value) {
137
+ // The in-memory copy is kept EITHER WAY. A `localStorage` that accepted the
138
+ // probe and then refused this write (quota, a policy change mid-page) would
139
+ // otherwise mint a new id on every call, and a conversation that starts over
140
+ // on every message is worse than one that ends at the reload.
141
+ fallbackStore.set(key, value);
142
+ const store = storage();
143
+ if (store === undefined)
144
+ return;
145
+ try {
146
+ store.setItem(key, value);
147
+ }
148
+ catch {
149
+ // Already kept above. Nothing here is worth failing a page over.
150
+ }
151
+ }
152
+ /** An unguessable id where the platform offers one; see the caveat on the door. */
153
+ function mintId() {
154
+ const webcrypto = globalThis.crypto;
155
+ if (typeof webcrypto?.randomUUID === 'function')
156
+ return webcrypto.randomUUID();
157
+ if (typeof webcrypto?.getRandomValues === 'function') {
158
+ const bytes = webcrypto.getRandomValues(new Uint8Array(16));
159
+ // RFC 4122 version 4, laid out by hand because `randomUUID` is what is
160
+ // missing here, not the randomness.
161
+ bytes[6] = ((bytes[6] ?? 0) & 0x0f) | 0x40;
162
+ bytes[8] = ((bytes[8] ?? 0) & 0x3f) | 0x80;
163
+ const hex = [...bytes].map((b) => b.toString(16).padStart(2, '0')).join('');
164
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
165
+ }
166
+ // No crypto at all. Not unguessable, and labelled so in the returned value
167
+ // itself rather than only in a doc nobody reads at three in the morning.
168
+ const random = () => Math.random().toString(36).slice(2, 10);
169
+ return `weak-${Date.now().toString(36)}-${random()}${random()}`;
170
+ }
171
+ //# sourceMappingURL=browserSession.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browserSession.js","sourceRoot":"","sources":["../../../src/hosting/browserSession.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAaH,kFAAkF;AAClF,MAAM,CAAC,MAAM,2BAA2B,GAAG,0BAA0B,CAAC;AAEtE;;;;GAIG;AACH,MAAM,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAAmC,EAAE;IACpE,MAAM,GAAG,GAAG,OAAO,CAAC,UAAU,IAAI,2BAA2B,CAAC;IAC9D,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IACjC,I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,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;IACvB,CAAC;IACD,2EAA2E;IAC3E,yEAAyE;IACzE,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC7D,OAAO,QAAQ,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC;AAClE,CAAC"}
@@ -105,6 +105,20 @@ export interface HttpWire {
105
105
  * message, so a wire that never returns it can only ever start new turns.
106
106
  */
107
107
  readonly decision?: unknown;
108
+ /**
109
+ * Headers to put on THIS request's reply, whatever terminal it ends with
110
+ * (9.10.0).
111
+ *
112
+ * It exists for one shape: a dialect that ISSUES the session it just read —
113
+ * a `Set-Cookie` for a session the caller did not carry. The wire stays
114
+ * pure either way; it returns a value and this file writes it, the same as
115
+ * the body shapes beside it.
116
+ *
117
+ * They are merged over the reply's own `content-type` (or the SSE headers),
118
+ * so a dialect cannot accidentally break the framing this host chose:
119
+ * `content-type` set here is ignored.
120
+ */
121
+ readonly responseHeaders?: Readonly<Record<string, string>>;
108
122
  };
109
123
  /** Body for a health probe. `uptimeMs` is how long this host has been serving. */
110
124
  health(uptimeMs: number): unknown;
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AAKH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAYjD,OAAO,EACL,gBAAgB,GAGjB,MAAM,4BAA4B,CAAC;AA2PpC;;;;;;;;;;;;;GAaG;AACH,MAAM,cAAc,GAAqC;IACvD,eAAe,EAAE,GAAG;IACpB,kBAAkB,EAAE,GAAG;IACvB,qBAAqB,EAAE,GAAG;IAC1B,qBAAqB,EAAE,GAAG;IAC1B,kBAAkB,EAAE,GAAG;IACvB,qBAAqB,EAAE,GAAG;CAC3B,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,MAAM,oBAAoB,GAA8B,CAAC,WAAW,CAAC,CAAC;AAEtE;;;;;;;;;GASG;AACH,MAAM,2BAA2B,GAAG;IAClC,aAAa,EAAE,SAAS;IACxB,eAAe,EAAE,SAAS;CAClB,CAAC;AAEX;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAwB;IAC/C,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC;IACzE,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;IACjC,yEAAyE;IACzE,2EAA2E;IAC3E,4EAA4E;IAC5E,qBAAqB;IACrB,IAA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AO;QAC9B,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC;YACpB,GAAG,CAAC,GAAG,EAAE,CAAC;YACV,OAAO;QACT,CAAC;QACD,IAAI,IAAY,CAAC;QACjB,IAAI,CAAC;YACH,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/C,CAAC;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.