agentfootprint 7.22.0 → 7.22.1
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.
- package/dist/adapters/hosting/agentcore.js +68 -8
- package/dist/adapters/hosting/agentcore.js.map +1 -1
- package/dist/adapters/memory/agentcore.js +116 -11
- package/dist/adapters/memory/agentcore.js.map +1 -1
- package/dist/esm/adapters/hosting/agentcore.d.ts +34 -4
- package/dist/esm/adapters/hosting/agentcore.js +68 -8
- package/dist/esm/adapters/hosting/agentcore.js.map +1 -1
- package/dist/esm/adapters/memory/agentcore.d.ts +59 -1
- package/dist/esm/adapters/memory/agentcore.js +114 -10
- package/dist/esm/adapters/memory/agentcore.js.map +1 -1
- package/dist/esm/hosting/envelope.d.ts +31 -2
- package/dist/esm/hosting/envelope.js +42 -7
- package/dist/esm/hosting/envelope.js.map +1 -1
- package/dist/esm/hosting/errors.d.ts +44 -1
- package/dist/esm/hosting/errors.js +81 -1
- package/dist/esm/hosting/errors.js.map +1 -1
- package/dist/esm/hosting/index.d.ts +5 -1
- package/dist/esm/hosting/index.js +5 -1
- package/dist/esm/hosting/index.js.map +1 -1
- package/dist/esm/hosting/standingAgent.d.ts +9 -0
- package/dist/esm/hosting/standingAgent.js +30 -9
- package/dist/esm/hosting/standingAgent.js.map +1 -1
- package/dist/esm/lib/storedPreview.d.ts +58 -0
- package/dist/esm/lib/storedPreview.js +97 -0
- package/dist/esm/lib/storedPreview.js.map +1 -0
- package/dist/esm/memory-providers.d.ts +1 -1
- package/dist/esm/memory-providers.js +1 -1
- package/dist/esm/memory-providers.js.map +1 -1
- package/dist/hosting/envelope.js +42 -7
- package/dist/hosting/envelope.js.map +1 -1
- package/dist/hosting/errors.js +83 -2
- package/dist/hosting/errors.js.map +1 -1
- package/dist/hosting/index.js +6 -1
- package/dist/hosting/index.js.map +1 -1
- package/dist/hosting/standingAgent.js +29 -8
- package/dist/hosting/standingAgent.js.map +1 -1
- package/dist/lib/storedPreview.js +102 -0
- package/dist/lib/storedPreview.js.map +1 -0
- package/dist/memory-providers.js +2 -1
- package/dist/memory-providers.js.map +1 -1
- package/dist/types/adapters/hosting/agentcore.d.ts +34 -4
- package/dist/types/adapters/hosting/agentcore.d.ts.map +1 -1
- package/dist/types/adapters/memory/agentcore.d.ts +59 -1
- package/dist/types/adapters/memory/agentcore.d.ts.map +1 -1
- package/dist/types/hosting/envelope.d.ts +31 -2
- package/dist/types/hosting/envelope.d.ts.map +1 -1
- package/dist/types/hosting/errors.d.ts +44 -1
- package/dist/types/hosting/errors.d.ts.map +1 -1
- package/dist/types/hosting/index.d.ts +5 -1
- package/dist/types/hosting/index.d.ts.map +1 -1
- package/dist/types/hosting/standingAgent.d.ts +9 -0
- package/dist/types/hosting/standingAgent.d.ts.map +1 -1
- package/dist/types/lib/storedPreview.d.ts +59 -0
- package/dist/types/lib/storedPreview.d.ts.map +1 -0
- package/dist/types/memory-providers.d.ts +1 -1
- package/dist/types/memory-providers.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -41,6 +41,10 @@
|
|
|
41
41
|
* • `toPausedEnvelope` / `readPausedRun` — the same for a run that stopped to
|
|
42
42
|
* ask a person something (`'flowchart-v1'`). `checkEnvelope` validates
|
|
43
43
|
* either without committing to which half you wanted — what a STORE wants.
|
|
44
|
+
* • `UnreadableEnvelopeError` — the refusal every reader and every store
|
|
45
|
+
* adapter inherits when a stored session is PRESENT but cannot be read. An
|
|
46
|
+
* unreadable stored conversation and an absent one are different facts, and
|
|
47
|
+
* only one of them is safe to answer with a fresh start.
|
|
44
48
|
* • `requireCapability` — feature-detection with teeth.
|
|
45
49
|
*
|
|
46
50
|
* @example An agent that stays up and remembers
|
|
@@ -61,5 +65,5 @@ export type { HttpHost, HttpHostHandle, HttpHostOptions, HttpRequestFacts, HttpW
|
|
|
61
65
|
export { memorySessions } from './memorySessions.js';
|
|
62
66
|
export { toEnvelope, toPausedEnvelope, readEnvelope, readPausedRun, checkEnvelope, } from './envelope.js';
|
|
63
67
|
export { standingAgent } from './standingAgent.js';
|
|
64
|
-
export { requireCapability, HostClosedError, ConcurrentRunError, PauseNotCarriedError, AwaitingDecisionError, NoPendingAskError, } from './errors.js';
|
|
68
|
+
export { requireCapability, HostClosedError, ConcurrentRunError, PauseNotCarriedError, AwaitingDecisionError, NoPendingAskError, UnreadableEnvelopeError, } from './errors.js';
|
|
65
69
|
export type { AgentHost, CheckpointEnvelope, ConcurrentInvokePolicy, ConversationEnvelope, DurabilityMode, HostCapability, HostHandle, HostHandler, HostReply, HostRequest, PausedRun, PausedRunEnvelope, PendingAsk, SessionLifecycle, StandingAgentOptions, WakeReason, } from './types.js';
|
|
@@ -41,6 +41,10 @@
|
|
|
41
41
|
* • `toPausedEnvelope` / `readPausedRun` — the same for a run that stopped to
|
|
42
42
|
* ask a person something (`'flowchart-v1'`). `checkEnvelope` validates
|
|
43
43
|
* either without committing to which half you wanted — what a STORE wants.
|
|
44
|
+
* • `UnreadableEnvelopeError` — the refusal every reader and every store
|
|
45
|
+
* adapter inherits when a stored session is PRESENT but cannot be read. An
|
|
46
|
+
* unreadable stored conversation and an absent one are different facts, and
|
|
47
|
+
* only one of them is safe to answer with a fresh start.
|
|
44
48
|
* • `requireCapability` — feature-detection with teeth.
|
|
45
49
|
*
|
|
46
50
|
* @example An agent that stays up and remembers
|
|
@@ -59,5 +63,5 @@ export { httpHost, headerValue } from './httpHost.js';
|
|
|
59
63
|
export { memorySessions } from './memorySessions.js';
|
|
60
64
|
export { toEnvelope, toPausedEnvelope, readEnvelope, readPausedRun, checkEnvelope, } from './envelope.js';
|
|
61
65
|
export { standingAgent } from './standingAgent.js';
|
|
62
|
-
export { requireCapability, HostClosedError, ConcurrentRunError, PauseNotCarriedError, AwaitingDecisionError, NoPendingAskError, } from './errors.js';
|
|
66
|
+
export { requireCapability, HostClosedError, ConcurrentRunError, PauseNotCarriedError, AwaitingDecisionError, NoPendingAskError, UnreadableEnvelopeError, } from './errors.js';
|
|
63
67
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hosting/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hosting/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AAEH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAStD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,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,GACxB,MAAM,aAAa,CAAC"}
|
|
@@ -21,6 +21,15 @@
|
|
|
21
21
|
* tells every dashboard downstream something untrue. A later request for that
|
|
22
22
|
* session carrying `decision` continues the run from exactly where it stopped.
|
|
23
23
|
*
|
|
24
|
+
* ── "Start a fresh one" is an answer it must EARN ───────────────────────────
|
|
25
|
+
* A session with nothing stored is answered fresh, and that is right. A session
|
|
26
|
+
* whose stored conversation cannot be READ is not: an unreadable stored
|
|
27
|
+
* conversation and an absent one are different facts, and only one of them is
|
|
28
|
+
* safe to answer with a fresh start. So an `UnreadableEnvelopeError` out of the
|
|
29
|
+
* store fails THIS REQUEST, naming the session, and the fresh-start path is
|
|
30
|
+
* never reached. The alternative is a reply that looks perfect to everyone
|
|
31
|
+
* involved while a user's conversation quietly stops existing.
|
|
32
|
+
*
|
|
24
33
|
* ── Resuming a CONVERSATION is a REPLAY, and that has a cost ─────────────────
|
|
25
34
|
* A stored conversation is restored through `agent.resumeOnError(...)`, and this
|
|
26
35
|
* is its caveat, stated here in the words the Agent states it in, because a
|
|
@@ -21,6 +21,15 @@
|
|
|
21
21
|
* tells every dashboard downstream something untrue. A later request for that
|
|
22
22
|
* session carrying `decision` continues the run from exactly where it stopped.
|
|
23
23
|
*
|
|
24
|
+
* ── "Start a fresh one" is an answer it must EARN ───────────────────────────
|
|
25
|
+
* A session with nothing stored is answered fresh, and that is right. A session
|
|
26
|
+
* whose stored conversation cannot be READ is not: an unreadable stored
|
|
27
|
+
* conversation and an absent one are different facts, and only one of them is
|
|
28
|
+
* safe to answer with a fresh start. So an `UnreadableEnvelopeError` out of the
|
|
29
|
+
* store fails THIS REQUEST, naming the session, and the fresh-start path is
|
|
30
|
+
* never reached. The alternative is a reply that looks perfect to everyone
|
|
31
|
+
* involved while a user's conversation quietly stops existing.
|
|
32
|
+
*
|
|
24
33
|
* ── Resuming a CONVERSATION is a REPLAY, and that has a cost ─────────────────
|
|
25
34
|
* A stored conversation is restored through `agent.resumeOnError(...)`, and this
|
|
26
35
|
* is its caveat, stated here in the words the Agent states it in, because a
|
|
@@ -58,7 +67,7 @@
|
|
|
58
67
|
import { isPaused } from '../core/pause.js';
|
|
59
68
|
import { durableWriter } from './durability.js';
|
|
60
69
|
import { readEnvelope, readPausedRun, toEnvelope, toPausedEnvelope } from './envelope.js';
|
|
61
|
-
import { AwaitingDecisionError, ConcurrentRunError, NoPendingAskError, PauseNotCarriedError, } from './errors.js';
|
|
70
|
+
import { AwaitingDecisionError, ConcurrentRunError, NoPendingAskError, PauseNotCarriedError, UnreadableEnvelopeError, } from './errors.js';
|
|
62
71
|
/**
|
|
63
72
|
* Serve one agent, with per-session conversation memory, on any
|
|
64
73
|
* {@link AgentHost}.
|
|
@@ -161,14 +170,26 @@ export async function standingAgent(options) {
|
|
|
161
170
|
// A request carrying a decision is waking this session to CONTINUE a
|
|
162
171
|
// run, which is a different thing to ask a store to be ready for.
|
|
163
172
|
await store.onWake?.(sessionId, request.decision !== undefined ? 'resume' : 'invoke');
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
173
|
+
try {
|
|
174
|
+
const stored = await store.hydrate(sessionId);
|
|
175
|
+
if (stored !== undefined) {
|
|
176
|
+
// Both readers throw by name on a format this runtime cannot read —
|
|
177
|
+
// better a loud refusal than an agent answering from half a session.
|
|
178
|
+
if (stored.format === 'flowchart-v1')
|
|
179
|
+
paused = readPausedRun(stored);
|
|
180
|
+
else
|
|
181
|
+
prior = readEnvelope(stored);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
catch (err) {
|
|
185
|
+
// A stored conversation this runtime cannot read fails THIS REQUEST,
|
|
186
|
+
// naming the session. It must never fall through to the fresh-start
|
|
187
|
+
// path below: the conversation exists, and answering it as if the
|
|
188
|
+
// caller were new is the one failure nobody can see from the outside.
|
|
189
|
+
// A store that knows the session already named it; one that does not
|
|
190
|
+
// gets the name added here, so the guarantee does not depend on which
|
|
191
|
+
// store you chose.
|
|
192
|
+
throw err instanceof UnreadableEnvelopeError ? err.withSession(sessionId) : err;
|
|
172
193
|
}
|
|
173
194
|
}
|
|
174
195
|
// The signal reaches tool execution, tool discovery and skill-entry
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standingAgent.js","sourceRoot":"","sources":["../../../src/hosting/standingAgent.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"standingAgent.js","sourceRoot":"","sources":["../../../src/hosting/standingAgent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AAEH,OAAO,EAAE,QAAQ,EAA2B,MAAM,kBAAkB,CAAC;AAErE,OAAO,EAAE,aAAa,EAAsB,MAAM,iB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AE,CAAC;QAC3C,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;QAClE,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,SAAS,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;QACtD,SAAS,EAAE,OAAO,CAAC,SAAS;KAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lib/storedPreview — how much of somebody's stored data an error may quote.
|
|
3
|
+
*
|
|
4
|
+
* A refusal about unreadable bytes has to show enough of them to be diagnosable
|
|
5
|
+
* ("ah, that is our envelope stringified by something that was not JSON") and no
|
|
6
|
+
* more, because the rest of those bytes are a conversation, a memory, or
|
|
7
|
+
* whatever else a user said. Error messages travel: they land in logs, in
|
|
8
|
+
* dashboards, in bug reports pasted into chat windows. So the quote is capped,
|
|
9
|
+
* and the cap lives HERE rather than being re-decided by each adapter that needs
|
|
10
|
+
* one — two copies of a redaction rule is one copy that will drift.
|
|
11
|
+
*
|
|
12
|
+
* Structured values are SUMMARISED rather than serialized: an array reports its
|
|
13
|
+
* length and an object its keys, because `String(anObject)` and
|
|
14
|
+
* `JSON.stringify(anArray)` are both ways of accidentally printing the payload
|
|
15
|
+
* this file exists to keep out of the message.
|
|
16
|
+
*
|
|
17
|
+
* Two functions, because a cap is only safe when the first bytes are structure.
|
|
18
|
+
* {@link previewStored} quotes a capped prefix — right for a value whose opening
|
|
19
|
+
* fields are metadata. {@link describeStoredShape} quotes nothing at all — right
|
|
20
|
+
* for a value whose content starts immediately. Choosing between them is the
|
|
21
|
+
* caller's job because only the caller knows what its bytes begin with.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* How much of a stored value a refusal may quote. Enough to recognise a mangled
|
|
25
|
+
* encoding at a glance; not enough to leak what was being said.
|
|
26
|
+
*/
|
|
27
|
+
export declare const STORED_PREVIEW_LIMIT = 64;
|
|
28
|
+
/**
|
|
29
|
+
* Describe what a store handed back WITHOUT quoting the whole thing.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* previewStored('{format=conversation-v1, data={version=1, …}}')
|
|
33
|
+
* // → '"{format=conversation-v1, data={version=1, …" (96 chars)'
|
|
34
|
+
* previewStored({ id: 'm-1', value: 'her address is …' })
|
|
35
|
+
* // → 'an object with keys: id, value'
|
|
36
|
+
*/
|
|
37
|
+
export declare function previewStored(value: unknown): string;
|
|
38
|
+
/**
|
|
39
|
+
* Describe a stored value **without quoting any of it** — its type, its size and
|
|
40
|
+
* its shape, and nothing that came from a person.
|
|
41
|
+
*
|
|
42
|
+
* Use this instead of {@link previewStored} wherever the stored bytes carry
|
|
43
|
+
* user content from their first characters, so that even a capped prefix would
|
|
44
|
+
* leak. A `CheckpointEnvelope` opens with `format`, `data`, `savedAt` and can
|
|
45
|
+
* afford to be quoted; a `MemoryEntry` opens with `id` and then `value`, so its
|
|
46
|
+
* second field IS the thing somebody asked an agent to remember. The cap is a
|
|
47
|
+
* policy about how MUCH may be shown; this is the answer when the honest amount
|
|
48
|
+
* is none.
|
|
49
|
+
*
|
|
50
|
+
* It stays diagnosable, which is the whole job of the quote it replaces: a
|
|
51
|
+
* length, whether it is JSON at all, and its opening character are enough to
|
|
52
|
+
* recognise "an object stringified by something that was not JSON".
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* describeStoredShape('{id=a, value={text=her address is …}}')
|
|
56
|
+
* // → "a 37-character string that is not JSON, starting '{'"
|
|
57
|
+
*/
|
|
58
|
+
export declare function describeStoredShape(value: unknown): string;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lib/storedPreview — how much of somebody's stored data an error may quote.
|
|
3
|
+
*
|
|
4
|
+
* A refusal about unreadable bytes has to show enough of them to be diagnosable
|
|
5
|
+
* ("ah, that is our envelope stringified by something that was not JSON") and no
|
|
6
|
+
* more, because the rest of those bytes are a conversation, a memory, or
|
|
7
|
+
* whatever else a user said. Error messages travel: they land in logs, in
|
|
8
|
+
* dashboards, in bug reports pasted into chat windows. So the quote is capped,
|
|
9
|
+
* and the cap lives HERE rather than being re-decided by each adapter that needs
|
|
10
|
+
* one — two copies of a redaction rule is one copy that will drift.
|
|
11
|
+
*
|
|
12
|
+
* Structured values are SUMMARISED rather than serialized: an array reports its
|
|
13
|
+
* length and an object its keys, because `String(anObject)` and
|
|
14
|
+
* `JSON.stringify(anArray)` are both ways of accidentally printing the payload
|
|
15
|
+
* this file exists to keep out of the message.
|
|
16
|
+
*
|
|
17
|
+
* Two functions, because a cap is only safe when the first bytes are structure.
|
|
18
|
+
* {@link previewStored} quotes a capped prefix — right for a value whose opening
|
|
19
|
+
* fields are metadata. {@link describeStoredShape} quotes nothing at all — right
|
|
20
|
+
* for a value whose content starts immediately. Choosing between them is the
|
|
21
|
+
* caller's job because only the caller knows what its bytes begin with.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* How much of a stored value a refusal may quote. Enough to recognise a mangled
|
|
25
|
+
* encoding at a glance; not enough to leak what was being said.
|
|
26
|
+
*/
|
|
27
|
+
export const STORED_PREVIEW_LIMIT = 64;
|
|
28
|
+
/**
|
|
29
|
+
* Describe what a store handed back WITHOUT quoting the whole thing.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* previewStored('{format=conversation-v1, data={version=1, …}}')
|
|
33
|
+
* // → '"{format=conversation-v1, data={version=1, …" (96 chars)'
|
|
34
|
+
* previewStored({ id: 'm-1', value: 'her address is …' })
|
|
35
|
+
* // → 'an object with keys: id, value'
|
|
36
|
+
*/
|
|
37
|
+
export function previewStored(value) {
|
|
38
|
+
if (typeof value === 'string') {
|
|
39
|
+
return value.length <= STORED_PREVIEW_LIMIT
|
|
40
|
+
? `"${value}"`
|
|
41
|
+
: `"${value.slice(0, STORED_PREVIEW_LIMIT)}…" (${value.length} chars)`;
|
|
42
|
+
}
|
|
43
|
+
return describeStoredShape(value);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Describe a stored value **without quoting any of it** — its type, its size and
|
|
47
|
+
* its shape, and nothing that came from a person.
|
|
48
|
+
*
|
|
49
|
+
* Use this instead of {@link previewStored} wherever the stored bytes carry
|
|
50
|
+
* user content from their first characters, so that even a capped prefix would
|
|
51
|
+
* leak. A `CheckpointEnvelope` opens with `format`, `data`, `savedAt` and can
|
|
52
|
+
* afford to be quoted; a `MemoryEntry` opens with `id` and then `value`, so its
|
|
53
|
+
* second field IS the thing somebody asked an agent to remember. The cap is a
|
|
54
|
+
* policy about how MUCH may be shown; this is the answer when the honest amount
|
|
55
|
+
* is none.
|
|
56
|
+
*
|
|
57
|
+
* It stays diagnosable, which is the whole job of the quote it replaces: a
|
|
58
|
+
* length, whether it is JSON at all, and its opening character are enough to
|
|
59
|
+
* recognise "an object stringified by something that was not JSON".
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* describeStoredShape('{id=a, value={text=her address is …}}')
|
|
63
|
+
* // → "a 37-character string that is not JSON, starting '{'"
|
|
64
|
+
*/
|
|
65
|
+
export function describeStoredShape(value) {
|
|
66
|
+
if (typeof value === 'string') {
|
|
67
|
+
let parsedShape = 'is not JSON';
|
|
68
|
+
try {
|
|
69
|
+
const parsed = JSON.parse(value);
|
|
70
|
+
parsedShape =
|
|
71
|
+
parsed !== null && typeof parsed === 'object'
|
|
72
|
+
? 'parses as JSON'
|
|
73
|
+
: `parses as JSON but is a bare ${parsed === null ? 'null' : typeof parsed}`;
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
/* not JSON — the interesting case, and already the default */
|
|
77
|
+
}
|
|
78
|
+
// The opening character only: '{' or '[' is what says "something
|
|
79
|
+
// stringified an object", and one structural character is not content.
|
|
80
|
+
const opener = value.length > 0 ? `, starting ${JSON.stringify(value[0])}` : '';
|
|
81
|
+
return `a ${value.length}-character string that ${parsedShape}${opener}`;
|
|
82
|
+
}
|
|
83
|
+
if (Array.isArray(value))
|
|
84
|
+
return `an array of ${value.length} item(s)`;
|
|
85
|
+
if (value === null)
|
|
86
|
+
return 'null';
|
|
87
|
+
if (value === undefined)
|
|
88
|
+
return 'undefined';
|
|
89
|
+
if (typeof value === 'object') {
|
|
90
|
+
const keys = Object.keys(value);
|
|
91
|
+
return keys.length > 0
|
|
92
|
+
? `an object with keys: ${keys.slice(0, 8).join(', ')}`
|
|
93
|
+
: 'an object with no keys';
|
|
94
|
+
}
|
|
95
|
+
return `${typeof value} ${String(value)}`;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=storedPreview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storedPreview.js","sourceRoot":"","sources":["../../../src/lib/storedPreview.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEvC;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC,MAAM,IAAI,oBAAoB;YACzC,CAAC,CAAC,IAAI,KAAK,GAAG;YACd,CAAC,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,oBAAoB,CAAC,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;IAC3E,CAAC;IACD,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,IAAI,WAAW,GAAG,aAAa,CAAC;QAChC,IAAI,CAAC;YACH,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC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
|
|
34
34
|
*/
|
|
35
35
|
export { RedisStore, type RedisStoreOptions, type RedisLikeClient, type RedisLikePipeline, } from './adapters/memory/redis.js';
|
|
36
|
-
export { AgentCoreStore, type AgentCoreStoreOptions, type AgentCoreLikeClient, type AgentCoreEvent, type AgentCoreMemoryRecord, } from './adapters/memory/agentcore.js';
|
|
36
|
+
export { AgentCoreStore, UnreadableMemoryEntryError, type AgentCoreStoreOptions, type AgentCoreLikeClient, type AgentCoreEvent, type AgentCoreMemoryRecord, } from './adapters/memory/agentcore.js';
|
|
37
37
|
export { BedrockAgentMemory, type BedrockAgentMemoryOptions, type BedrockAgentMemoryLikeClient, type BedrockAgentSummary, } from './adapters/memory/bedrockAgentMemory.js';
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
// `require()` to constructor time; importing this barrel doesn't load
|
|
37
37
|
// `ioredis` or `@aws-sdk/client-bedrock-agent-runtime`.
|
|
38
38
|
export { RedisStore, } from './adapters/memory/redis.js';
|
|
39
|
-
export { AgentCoreStore, } from './adapters/memory/agentcore.js';
|
|
39
|
+
export { AgentCoreStore, UnreadableMemoryEntryError, } from './adapters/memory/agentcore.js';
|
|
40
40
|
// Read-only reader for the legacy Bedrock Agents auto session-summary memory.
|
|
41
41
|
// NOT a MemoryStore (Bedrock owns the writes) — see the class docstring.
|
|
42
42
|
export { BedrockAgentMemory, } from './adapters/memory/bedrockAgentMemory.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-providers.js","sourceRoot":"","sources":["../../src/memory-providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,sEAAsE;AACtE,sEAAsE;AACtE,wDAAwD;AACxD,OAAO,EACL,UAAU,GAIX,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,cAAc,
|
|
1
|
+
{"version":3,"file":"memory-providers.js","sourceRoot":"","sources":["../../src/memory-providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,sEAAsE;AACtE,sEAAsE;AACtE,wDAAwD;AACxD,OAAO,EACL,UAAU,GAIX,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,cAAc,EACd,0BAA0B,GAK3B,MAAM,gCAAgC,CAAC;AAExC,8EAA8E;AAC9E,yEAAyE;AACzE,OAAO,EACL,kBAAkB,GAInB,MAAM,yCAAyC,CAAC"}
|
package/dist/hosting/envelope.js
CHANGED
|
@@ -20,9 +20,28 @@
|
|
|
20
20
|
* while a person is still waiting on a question nobody mentioned. That is a
|
|
21
21
|
* half-restore wearing a happy path, which is the exact failure the format field
|
|
22
22
|
* exists to prevent.
|
|
23
|
+
*
|
|
24
|
+
* ── The same rule one step earlier: unreadable ≠ absent ──────────────────────
|
|
25
|
+
* A format nobody knows is one way a store can hand back something unusable.
|
|
26
|
+
* The other is bytes that are not an envelope at all — a store that kept its own
|
|
27
|
+
* encoding and gave back its host language's `toString()` of the object rather
|
|
28
|
+
* than the object, say. **An unreadable stored conversation and an absent one
|
|
29
|
+
* are different facts, and only one of them is safe to answer with a fresh
|
|
30
|
+
* start.** Absent is ordinary. Unreadable means a conversation EXISTS and this
|
|
31
|
+
* runtime cannot see it, and answering that with a fresh start is invisible from
|
|
32
|
+
* the outside — it looks exactly like a new user — until a deployment boundary
|
|
33
|
+
* hands somebody a blank slate where their conversation was.
|
|
34
|
+
*
|
|
35
|
+
* So {@link readFormat} — the ONE place a stored value is inspected, and
|
|
36
|
+
* therefore the place every reader and every store adapter inherits from —
|
|
37
|
+
* raises {@link UnreadableEnvelopeError} by name, with the session and a short
|
|
38
|
+
* prefix of what it found. Decoding is an adapter's business (only the adapter
|
|
39
|
+
* knows its transport's encoding); "these bytes are nobody's readable session"
|
|
40
|
+
* is everybody's, so it is refused here, once.
|
|
23
41
|
*/
|
|
24
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
43
|
exports.checkEnvelope = exports.readPausedRun = exports.readEnvelope = exports.toPausedEnvelope = exports.toEnvelope = void 0;
|
|
44
|
+
const errors_js_1 = require("./errors.js");
|
|
26
45
|
const runCheckpoint_js_1 = require("../core/runCheckpoint.js");
|
|
27
46
|
/** Every format this runtime can read. Add, never redefine. */
|
|
28
47
|
const KNOWN_FORMATS = ['conversation-v1', 'flowchart-v1'];
|
|
@@ -68,6 +87,10 @@ exports.toPausedEnvelope = toPausedEnvelope;
|
|
|
68
87
|
* else wrote, in a format this runtime may not know, and typing the parameter
|
|
69
88
|
* as the happy shape would be assuming the very thing that needs checking.
|
|
70
89
|
*
|
|
90
|
+
* @throws UnreadableEnvelopeError when what came back is present but is not an
|
|
91
|
+
* envelope at all — bytes a store kept in its own encoding, say. Never
|
|
92
|
+
* `undefined`: a conversation that exists and cannot be read is not the same
|
|
93
|
+
* fact as one that was never there.
|
|
71
94
|
* @throws TypeError naming the format when it is one this runtime cannot read;
|
|
72
95
|
* naming the missing field when the conversation inside is malformed; and
|
|
73
96
|
* pointing at {@link readPausedRun} when the envelope holds a paused run,
|
|
@@ -108,17 +131,24 @@ exports.readPausedRun = readPausedRun;
|
|
|
108
131
|
* produced them rather than whoever read them next; it has no business caring
|
|
109
132
|
* whether the session inside is mid-conversation or mid-question.
|
|
110
133
|
*
|
|
134
|
+
* Pass `sessionId` and the refusal names the conversation, which is what turns
|
|
135
|
+
* a log line into an incident somebody can act on. Pass it whenever you have it
|
|
136
|
+
* — a store always does.
|
|
137
|
+
*
|
|
138
|
+
* @throws UnreadableEnvelopeError when the stored value is present but is not an
|
|
139
|
+
* envelope at all. That is the case a store must NOT answer with `undefined`:
|
|
140
|
+
* see the module header.
|
|
111
141
|
* @throws TypeError naming the format when this runtime cannot read it, or the
|
|
112
142
|
* missing field when the payload is malformed.
|
|
113
143
|
*
|
|
114
144
|
* @example
|
|
115
145
|
* async hydrate(sessionId) {
|
|
116
146
|
* const stored = await myStore.get(sessionId);
|
|
117
|
-
* return stored === undefined ? undefined : checkEnvelope(stored);
|
|
147
|
+
* return stored === undefined ? undefined : checkEnvelope(stored, sessionId);
|
|
118
148
|
* }
|
|
119
149
|
*/
|
|
120
|
-
function checkEnvelope(envelope) {
|
|
121
|
-
if (readFormat(envelope) === 'flowchart-v1') {
|
|
150
|
+
function checkEnvelope(envelope, sessionId) {
|
|
151
|
+
if (readFormat(envelope, sessionId) === 'flowchart-v1') {
|
|
122
152
|
validatePausedRun(envelope.data);
|
|
123
153
|
}
|
|
124
154
|
else {
|
|
@@ -128,12 +158,17 @@ function checkEnvelope(envelope) {
|
|
|
128
158
|
}
|
|
129
159
|
exports.checkEnvelope = checkEnvelope;
|
|
130
160
|
/**
|
|
131
|
-
* The one place a
|
|
132
|
-
* same thing in the same words
|
|
161
|
+
* The one place a stored value is inspected, so every refusal in this file says
|
|
162
|
+
* the same thing in the same words — and so the "unreadable is not absent" law
|
|
163
|
+
* holds for every reader here and every store adapter that calls one, including
|
|
164
|
+
* ones nobody has written yet.
|
|
133
165
|
*/
|
|
134
|
-
function readFormat(envelope) {
|
|
166
|
+
function readFormat(envelope, sessionId) {
|
|
135
167
|
if (!envelope || typeof envelope !== 'object' || Array.isArray(envelope)) {
|
|
136
|
-
|
|
168
|
+
// Present but not an envelope. NOT `undefined`, NOT a fresh start: see the
|
|
169
|
+
// module header. Still a `TypeError` by ancestry, so an existing catch is
|
|
170
|
+
// unaffected — it just has a name and a session now.
|
|
171
|
+
throw new errors_js_1.UnreadableEnvelopeError(envelope, sessionId);
|
|
137
172
|
}
|
|
138
173
|
const found = envelope.format;
|
|
139
174
|
if (typeof found !== 'string' || !KNOWN_FORMATS.includes(found)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envelope.js","sourceRoot":"","sources":["../../src/hosting/envelope.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"envelope.js","sourceRoot":"","sources":["../../src/hosting/envelope.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AClC,MAAM,IAAI,SAAS,CACjB,8DAA8D;YAC5D,gFAAgF;YAChF,6BAA6B,CAChC,CAAC;IACJ,CAAC;IACD,IACE,OAAO,EAAE,CAAC,aAAa,KAAK,QAAQ;QACpC,CAAC,EAAE,CAAC,WAAW;QACf,OAAO,EAAE,CAAC,WAAW,KAAK,QAAQ,EAClC,CAAC;QACD,MAAM,IAAI,SAAS,CACjB,+EAA+E;YAC7E,qFAAqF,CACxF,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,SAAS,CACjB,2EAA2E,CAC5E,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QACpD,MAAM,IAAI,SAAS,CACjB,+EAA+E;YAC7E,yEAAyE,CAC5E,CAAC;IACJ,CAAC;IACD,IAAA,qCAAkB,EAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACrC,OAAO,GAAgB,CAAC;AAC1B,CAAC"}
|
package/dist/hosting/errors.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* same words.
|
|
5
5
|
*
|
|
6
6
|
* A refusal that varies by adapter is a refusal nobody can write a test or a
|
|
7
|
-
* runbook against. These
|
|
7
|
+
* runbook against. These six carry a stable `code`, name WHO refused, and say
|
|
8
8
|
* what the caller should do instead. Adapters map the codes onto whatever their
|
|
9
9
|
* transport uses to say "no" — that mapping is the adapter's business and lives
|
|
10
10
|
* in the adapter, never here.
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
* say so loudly and name the adapter it is talking about.
|
|
20
20
|
*/
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.requireCapability = exports.NoPendingAskError = exports.AwaitingDecisionError = exports.PauseNotCarriedError = exports.ConcurrentRunError = exports.HostClosedError = void 0;
|
|
22
|
+
exports.requireCapability = exports.UnreadableEnvelopeError = exports.NoPendingAskError = exports.AwaitingDecisionError = exports.PauseNotCarriedError = exports.ConcurrentRunError = exports.HostClosedError = void 0;
|
|
23
|
+
const storedPreview_js_1 = require("../lib/storedPreview.js");
|
|
23
24
|
/**
|
|
24
25
|
* Thrown when a request arrives at a host that is shutting down or shut down.
|
|
25
26
|
*
|
|
@@ -175,6 +176,86 @@ class NoPendingAskError extends Error {
|
|
|
175
176
|
}
|
|
176
177
|
}
|
|
177
178
|
exports.NoPendingAskError = NoPendingAskError;
|
|
179
|
+
/**
|
|
180
|
+
* An already-computed preview, so {@link UnreadableEnvelopeError.withSession}
|
|
181
|
+
* can copy a refusal without being handed the stored bytes a second time. Not
|
|
182
|
+
* exported: nothing outside this file should be able to hand-write a preview.
|
|
183
|
+
*/
|
|
184
|
+
class StoredPreview {
|
|
185
|
+
text;
|
|
186
|
+
constructor(text) {
|
|
187
|
+
this.text = text;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Thrown when a store hands back something that is **present but unreadable**
|
|
192
|
+
* where a `CheckpointEnvelope` should be.
|
|
193
|
+
*
|
|
194
|
+
* The law, in the words of the field report that bought it:
|
|
195
|
+
*
|
|
196
|
+
* > *An unreadable stored conversation and an absent one are different facts,
|
|
197
|
+
* > and only one of them is safe to answer with a fresh start.*
|
|
198
|
+
*
|
|
199
|
+
* Absent is ordinary — a new session has no conversation, and answering it
|
|
200
|
+
* fresh is exactly right. Unreadable is not ordinary: a conversation EXISTS,
|
|
201
|
+
* somebody is in the middle of it, and starting fresh over the top of it looks
|
|
202
|
+
* identical to the happy path from the outside. Nobody finds that until a
|
|
203
|
+
* deployment boundary hands a user a stranger's blank slate. So this refuses,
|
|
204
|
+
* loudly, naming the session — the one thing a silent `undefined` could never
|
|
205
|
+
* do.
|
|
206
|
+
*
|
|
207
|
+
* It extends `TypeError` because that is what it always was: the refusal gained
|
|
208
|
+
* a name, a `code` and the session it is about, but a caller who was already
|
|
209
|
+
* catching a `TypeError` from a reader keeps working.
|
|
210
|
+
*
|
|
211
|
+
* `storedPreview` quotes at most 64 characters (`STORED_PREVIEW_LIMIT`, in
|
|
212
|
+
* `lib/storedPreview` — one cap, shared by every adapter that has to describe
|
|
213
|
+
* bytes it could not read) — enough to recognise a mangled encoding at a
|
|
214
|
+
* glance, never the conversation itself.
|
|
215
|
+
*/
|
|
216
|
+
class UnreadableEnvelopeError extends TypeError {
|
|
217
|
+
code = 'ERR_UNREADABLE_ENVELOPE';
|
|
218
|
+
/** The session those bytes were stored under, when the refuser knows it. */
|
|
219
|
+
sessionId;
|
|
220
|
+
/** A short, deliberately truncated rendering of what the store handed back. */
|
|
221
|
+
storedPreview;
|
|
222
|
+
constructor(stored, sessionId) {
|
|
223
|
+
const preview = stored instanceof StoredPreview ? stored.text : (0, storedPreview_js_1.previewStored)(stored);
|
|
224
|
+
super(`[hosting] ` +
|
|
225
|
+
(sessionId === undefined
|
|
226
|
+
? `a stored session is present but unreadable`
|
|
227
|
+
: `session '${sessionId}' has a STORED conversation this runtime cannot read`) +
|
|
228
|
+
`. An unreadable stored conversation and an absent one are different facts, and ` +
|
|
229
|
+
`only one of them is safe to answer with a fresh start — so this refuses instead ` +
|
|
230
|
+
`of starting over on top of a conversation that exists. ` +
|
|
231
|
+
`What the store handed back looks like: ${preview}. ` +
|
|
232
|
+
`Only a short prefix is ever quoted here — the rest of those bytes is the ` +
|
|
233
|
+
`conversation. ` +
|
|
234
|
+
`Expected { format, data, savedAt } as written by toEnvelope() / toPausedEnvelope(). ` +
|
|
235
|
+
`A store that keeps its own encoding must decode back to that object before ` +
|
|
236
|
+
`handing it over.`);
|
|
237
|
+
this.name = 'UnreadableEnvelopeError';
|
|
238
|
+
if (sessionId !== undefined)
|
|
239
|
+
this.sessionId = sessionId;
|
|
240
|
+
this.storedPreview = preview;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* The same refusal, naming the session — for a reader that knew the bytes
|
|
244
|
+
* were unreadable but not whose conversation they were.
|
|
245
|
+
*
|
|
246
|
+
* Returns a copy rather than mutating: an error already thrown past somebody
|
|
247
|
+
* is a fact about a moment, and editing it under them is how two stack traces
|
|
248
|
+
* end up disagreeing about what happened.
|
|
249
|
+
*/
|
|
250
|
+
withSession(sessionId) {
|
|
251
|
+
if (this.sessionId !== undefined)
|
|
252
|
+
return this;
|
|
253
|
+
const named = new UnreadableEnvelopeError(new StoredPreview(this.storedPreview), sessionId);
|
|
254
|
+
named.cause = this;
|
|
255
|
+
return named;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
exports.UnreadableEnvelopeError = UnreadableEnvelopeError;
|
|
178
259
|
/**
|
|
179
260
|
* Assert that a host can do something, and throw a corrective error naming the
|
|
180
261
|
* adapter when it cannot.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/hosting/errors.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/hosting/errors.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;AAEH,8DAAwD;AAGxD;;;;;GAKG;AACH,MAAa,eAAgB,SAAQ,KAAK;IAC/B,IAAI,GAAG,iBAA0B,CAAC;IAC3C,6BAA6B;IACpB,QAAQ,CAAS;IAE1B,YAAY,QAAgB;QAC1B,KAAK,CACH,kBAAkB,QAAQ,sDAAsD;YAC9E,wFAAwF;YACxF,iDAAiD,CACpD,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF;AAdD,0CAcC;AAED;;;;;;;;GAQG;AACH,MAAa,kBAAmB,SAAQ,KAAK;IAClC,IAAI,GAAG,oBAA6B,CAAC;IAC9C,gDAAgD;IACvC,SAAS,CAAS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,IAAI,CAAC;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AA3CD,0DA2CC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAgB,iBAAiB,CAAC,IAAe,EAAE,UAA0B;IAC3E,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC;QAAE,OAAO;IACnD,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IACjF,MAAM,IAAI,KAAK,CACb,kBAAkB,IAAI,CAAC,IAAI,4BAA4B,UAAU,KAAK;QACpE,eAAe,GAAG,wBAAwB;QAC1C,+BAA+B,UAAU,uCAAuC;QAChF,oFAAoF,CACvF,CAAC;AACJ,CAAC;AATD,8CASC"}
|
package/dist/hosting/index.js
CHANGED
|
@@ -42,6 +42,10 @@
|
|
|
42
42
|
* • `toPausedEnvelope` / `readPausedRun` — the same for a run that stopped to
|
|
43
43
|
* ask a person something (`'flowchart-v1'`). `checkEnvelope` validates
|
|
44
44
|
* either without committing to which half you wanted — what a STORE wants.
|
|
45
|
+
* • `UnreadableEnvelopeError` — the refusal every reader and every store
|
|
46
|
+
* adapter inherits when a stored session is PRESENT but cannot be read. An
|
|
47
|
+
* unreadable stored conversation and an absent one are different facts, and
|
|
48
|
+
* only one of them is safe to answer with a fresh start.
|
|
45
49
|
* • `requireCapability` — feature-detection with teeth.
|
|
46
50
|
*
|
|
47
51
|
* @example An agent that stays up and remembers
|
|
@@ -56,7 +60,7 @@
|
|
|
56
60
|
* process.on('SIGTERM', () => void handle.close());
|
|
57
61
|
*/
|
|
58
62
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
-
exports.NoPendingAskError = exports.AwaitingDecisionError = exports.PauseNotCarriedError = exports.ConcurrentRunError = exports.HostClosedError = exports.requireCapability = exports.standingAgent = exports.checkEnvelope = exports.readPausedRun = exports.readEnvelope = exports.toPausedEnvelope = exports.toEnvelope = exports.memorySessions = exports.headerValue = exports.httpHost = exports.jsonWire = exports.nodeHost = void 0;
|
|
63
|
+
exports.UnreadableEnvelopeError = exports.NoPendingAskError = exports.AwaitingDecisionError = exports.PauseNotCarriedError = exports.ConcurrentRunError = exports.HostClosedError = exports.requireCapability = exports.standingAgent = exports.checkEnvelope = exports.readPausedRun = exports.readEnvelope = exports.toPausedEnvelope = exports.toEnvelope = exports.memorySessions = exports.headerValue = exports.httpHost = exports.jsonWire = exports.nodeHost = void 0;
|
|
60
64
|
var nodeHost_js_1 = require("./nodeHost.js");
|
|
61
65
|
Object.defineProperty(exports, "nodeHost", { enumerable: true, get: function () { return nodeHost_js_1.nodeHost; } });
|
|
62
66
|
Object.defineProperty(exports, "jsonWire", { enumerable: true, get: function () { return nodeHost_js_1.jsonWire; } });
|
|
@@ -80,4 +84,5 @@ Object.defineProperty(exports, "ConcurrentRunError", { enumerable: true, get: fu
|
|
|
80
84
|
Object.defineProperty(exports, "PauseNotCarriedError", { enumerable: true, get: function () { return errors_js_1.PauseNotCarriedError; } });
|
|
81
85
|
Object.defineProperty(exports, "AwaitingDecisionError", { enumerable: true, get: function () { return errors_js_1.AwaitingDecisionError; } });
|
|
82
86
|
Object.defineProperty(exports, "NoPendingAskError", { enumerable: true, get: function () { return errors_js_1.NoPendingAskError; } });
|
|
87
|
+
Object.defineProperty(exports, "UnreadableEnvelopeError", { enumerable: true, get: function () { return errors_js_1.UnreadableEnvelopeError; } });
|
|
83
88
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hosting/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hosting/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;;;AAEH,6CAAmD;AAA1C,uGAAA,QAAQ,OAAA;AAAE,uGAAA,QAAQ,OAAA;AAG3B,6CAAsD;AAA7C,uGAAA,QAAQ,OAAA;AAAE,0GAAA,WAAW,OAAA;AAS9B,yDAAqD;AAA5C,mHAAA,cAAc,OAAA;AACvB,6CAMuB;AALrB,yGAAA,UAAU,OAAA;AACV,+GAAA,gBAAgB,OAAA;AAChB,2GAAA,YAAY,OAAA;AACZ,4GAAA,aAAa,OAAA;AACb,4GAAA,aAAa,OAAA;AAEf,uDAAmD;AAA1C,iHAAA,aAAa,OAAA;AAEtB,yCAQqB;AAPnB,8GAAA,iBAAiB,OAAA;AACjB,4GAAA,eAAe,OAAA;AACf,+GAAA,kBAAkB,OAAA;AAClB,iHAAA,oBAAoB,OAAA;AACpB,kHAAA,qBAAqB,OAAA;AACrB,8GAAA,iBAAiB,OAAA;AACjB,oHAAA,uBAAuB,OAAA"}
|