agentfootprint 9.64.0 → 9.65.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.
- package/dist/adapters/hosting/foundryResponses.js +110 -0
- package/dist/adapters/hosting/foundryResponses.js.map +1 -0
- package/dist/adapters/hosting/responsesWire.js +322 -0
- package/dist/adapters/hosting/responsesWire.js.map +1 -0
- package/dist/esm/adapters/hosting/foundryResponses.d.ts +89 -0
- package/dist/esm/adapters/hosting/foundryResponses.js +106 -0
- package/dist/esm/adapters/hosting/foundryResponses.js.map +1 -0
- package/dist/esm/adapters/hosting/responsesWire.d.ts +75 -0
- package/dist/esm/adapters/hosting/responsesWire.js +316 -0
- package/dist/esm/adapters/hosting/responsesWire.js.map +1 -0
- package/dist/esm/hosting/errors.d.ts +43 -0
- package/dist/esm/hosting/errors.js +52 -0
- package/dist/esm/hosting/errors.js.map +1 -1
- package/dist/esm/hosting/httpHost.d.ts +133 -4
- package/dist/esm/hosting/httpHost.js +120 -22
- package/dist/esm/hosting/httpHost.js.map +1 -1
- package/dist/esm/hosting/index.d.ts +2 -2
- package/dist/esm/hosting/index.js +1 -1
- package/dist/esm/hosting/index.js.map +1 -1
- package/dist/esm/hosting-providers.d.ts +17 -0
- package/dist/esm/hosting-providers.js +19 -0
- package/dist/esm/hosting-providers.js.map +1 -1
- package/dist/hosting/errors.js +55 -1
- package/dist/hosting/errors.js.map +1 -1
- package/dist/hosting/httpHost.js +119 -21
- package/dist/hosting/httpHost.js.map +1 -1
- package/dist/hosting/index.js +4 -2
- package/dist/hosting/index.js.map +1 -1
- package/dist/hosting-providers.js +30 -1
- package/dist/hosting-providers.js.map +1 -1
- package/dist/types/adapters/hosting/foundryResponses.d.ts +90 -0
- package/dist/types/adapters/hosting/foundryResponses.d.ts.map +1 -0
- package/dist/types/adapters/hosting/responsesWire.d.ts +76 -0
- package/dist/types/adapters/hosting/responsesWire.d.ts.map +1 -0
- package/dist/types/hosting/errors.d.ts +43 -0
- package/dist/types/hosting/errors.d.ts.map +1 -1
- package/dist/types/hosting/httpHost.d.ts +133 -4
- package/dist/types/hosting/httpHost.d.ts.map +1 -1
- package/dist/types/hosting/index.d.ts +2 -2
- package/dist/types/hosting/index.d.ts.map +1 -1
- package/dist/types/hosting-providers.d.ts +17 -0
- package/dist/types/hosting-providers.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -26,6 +26,19 @@
|
|
|
26
26
|
* idleMs: 900000 }` declared, session affinity readable from header or
|
|
27
27
|
* query, and a `Sec-WebSocket-Protocol` bearer mapped into
|
|
28
28
|
* `headers.authorization`.
|
|
29
|
+
* • `foundryResponsesHost({ port?, hostname?, model?, maxBodyBytes? })` — an
|
|
30
|
+
* `AgentHost` for Microsoft Foundry's hosted-agent contract: `POST
|
|
31
|
+
* /responses`, a `HEAD` capability probe on the same path, `GET /readiness`
|
|
32
|
+
* answering `{"status":"healthy"}`, port 8088, and the session read from
|
|
33
|
+
* `conversation` / `agent_session_id` / `session_id` in that order. It
|
|
34
|
+
* streams when the BODY says `stream: true` — not the `Accept` header —
|
|
35
|
+
* and frames that stream as the Responses lifecycle.
|
|
36
|
+
* **Inbound only:** it is the door callers arrive at, and says nothing
|
|
37
|
+
* about which model the agent calls. It does NOT provide Workflow
|
|
38
|
+
* Visualizer topology; see the adapter's header.
|
|
39
|
+
* • `responsesWire({ defaultModel?, sessionFields?, health? })` — the
|
|
40
|
+
* Responses PROTOCOL as an `HttpWire`, with no vendor in it, for the next
|
|
41
|
+
* runtime that speaks it on paths of its own.
|
|
29
42
|
* • `agentCoreSessions({ store })` — a `SessionLifecycle` whose checkpoint
|
|
30
43
|
* home you choose at construction: a JSON file in the runtime's own session
|
|
31
44
|
* storage (survives a stop/resume, needs no SDK), or one AgentCore Memory
|
|
@@ -88,13 +101,29 @@
|
|
|
88
101
|
* symbols, one door. Import from the door.
|
|
89
102
|
*/
|
|
90
103
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
91
|
-
exports.FirestoreIndexMissingError = exports.EnvelopeTooLargeError = exports.FIRESTORE_MAX_ENVELOPE_BYTES = exports.FIRESTORE_MAX_DOCUMENT_BYTES = exports.EXPIRES_AT_FIELD = exports.DEFAULT_SESSION_COLLECTION = exports.firestoreSessions = exports.SESSION_EVENT_AUTHOR = exports.SESSION_STATE_KEY = exports.DEFAULT_USER_ID = exports.agentEngineSessions = exports.DEFAULT_SESSION_STORAGE_PATH = exports.agentCoreSessions = exports.readAgentCoreConversation = exports.agentCoreRuntimeWire = exports.agentCoreRuntimeHost = void 0;
|
|
104
|
+
exports.FirestoreIndexMissingError = exports.EnvelopeTooLargeError = exports.FIRESTORE_MAX_ENVELOPE_BYTES = exports.FIRESTORE_MAX_DOCUMENT_BYTES = exports.EXPIRES_AT_FIELD = exports.DEFAULT_SESSION_COLLECTION = exports.firestoreSessions = exports.SESSION_EVENT_AUTHOR = exports.SESSION_STATE_KEY = exports.DEFAULT_USER_ID = exports.agentEngineSessions = exports.PUBLIC_FAILURE_MESSAGE = exports.DEFAULT_SESSION_FIELDS = exports.readResponsesSession = exports.readResponsesInput = exports.responsesWire = exports.FOUNDRY_SESSION_FIELDS = exports.FOUNDRY_READINESS_PATH = exports.FOUNDRY_INVOKE_PATH = exports.DEFAULT_FOUNDRY_PORT = exports.foundryResponsesHost = exports.DEFAULT_SESSION_STORAGE_PATH = exports.agentCoreSessions = exports.readAgentCoreConversation = exports.agentCoreRuntimeWire = exports.agentCoreRuntimeHost = void 0;
|
|
92
105
|
var agentcore_js_1 = require("./adapters/hosting/agentcore.js");
|
|
93
106
|
Object.defineProperty(exports, "agentCoreRuntimeHost", { enumerable: true, get: function () { return agentcore_js_1.agentCoreRuntimeHost; } });
|
|
94
107
|
Object.defineProperty(exports, "agentCoreRuntimeWire", { enumerable: true, get: function () { return agentcore_js_1.agentCoreRuntimeWire; } });
|
|
95
108
|
Object.defineProperty(exports, "readAgentCoreConversation", { enumerable: true, get: function () { return agentcore_js_1.readAgentCoreConversation; } });
|
|
96
109
|
Object.defineProperty(exports, "agentCoreSessions", { enumerable: true, get: function () { return agentcore_js_1.agentCoreSessions; } });
|
|
97
110
|
Object.defineProperty(exports, "DEFAULT_SESSION_STORAGE_PATH", { enumerable: true, get: function () { return agentcore_js_1.DEFAULT_SESSION_STORAGE_PATH; } });
|
|
111
|
+
var foundryResponses_js_1 = require("./adapters/hosting/foundryResponses.js");
|
|
112
|
+
Object.defineProperty(exports, "foundryResponsesHost", { enumerable: true, get: function () { return foundryResponses_js_1.foundryResponsesHost; } });
|
|
113
|
+
Object.defineProperty(exports, "DEFAULT_FOUNDRY_PORT", { enumerable: true, get: function () { return foundryResponses_js_1.DEFAULT_FOUNDRY_PORT; } });
|
|
114
|
+
Object.defineProperty(exports, "FOUNDRY_INVOKE_PATH", { enumerable: true, get: function () { return foundryResponses_js_1.FOUNDRY_INVOKE_PATH; } });
|
|
115
|
+
Object.defineProperty(exports, "FOUNDRY_READINESS_PATH", { enumerable: true, get: function () { return foundryResponses_js_1.FOUNDRY_READINESS_PATH; } });
|
|
116
|
+
Object.defineProperty(exports, "FOUNDRY_SESSION_FIELDS", { enumerable: true, get: function () { return foundryResponses_js_1.FOUNDRY_SESSION_FIELDS; } });
|
|
117
|
+
// The protocol under it, on the barrel in its own right: a deployment that
|
|
118
|
+
// speaks Responses on paths of its own is a `httpHost` away, and having to
|
|
119
|
+
// import a vendor-named module to reach a vendor-neutral dialect would be the
|
|
120
|
+
// split this pair exists to make.
|
|
121
|
+
var responsesWire_js_1 = require("./adapters/hosting/responsesWire.js");
|
|
122
|
+
Object.defineProperty(exports, "responsesWire", { enumerable: true, get: function () { return responsesWire_js_1.responsesWire; } });
|
|
123
|
+
Object.defineProperty(exports, "readResponsesInput", { enumerable: true, get: function () { return responsesWire_js_1.readResponsesInput; } });
|
|
124
|
+
Object.defineProperty(exports, "readResponsesSession", { enumerable: true, get: function () { return responsesWire_js_1.readResponsesSession; } });
|
|
125
|
+
Object.defineProperty(exports, "DEFAULT_SESSION_FIELDS", { enumerable: true, get: function () { return responsesWire_js_1.DEFAULT_SESSION_FIELDS; } });
|
|
126
|
+
Object.defineProperty(exports, "PUBLIC_FAILURE_MESSAGE", { enumerable: true, get: function () { return responsesWire_js_1.PUBLIC_FAILURE_MESSAGE; } });
|
|
98
127
|
var googleAgentEngine_js_1 = require("./adapters/hosting/googleAgentEngine.js");
|
|
99
128
|
Object.defineProperty(exports, "agentEngineSessions", { enumerable: true, get: function () { return googleAgentEngine_js_1.agentEngineSessions; } });
|
|
100
129
|
Object.defineProperty(exports, "DEFAULT_USER_ID", { enumerable: true, get: function () { return googleAgentEngine_js_1.DEFAULT_USER_ID; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosting-providers.js","sourceRoot":"","sources":["../src/hosting-providers.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"hosting-providers.js","sourceRoot":"","sources":["../src/hosting-providers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoGG;;;AAEH,gEAMyC;AALvC,oHAAA,oBAAoB,OAAA;AACpB,oHAAA,oBAAoB,OAAA;AACpB,yHAAA,yBAAyB,OAAA;AACzB,iHAAA,iBAAiB,OAAA;AACjB,4HAAA,4BAA4B,OAAA;AAG9B,8EAMgD;AAL9C,2HAAA,oBAAoB,OAAA;AACpB,2HAAA,oBAAoB,OAAA;AACpB,0HAAA,mBAAmB,OAAA;AACnB,6HAAA,sBAAsB,OAAA;AACtB,6HAAA,sBAAsB,OAAA;AAKxB,2EAA2E;AAC3E,2EAA2E;AAC3E,8EAA8E;AAC9E,kCAAkC;AAClC,wEAM6C;AAL3C,iHAAA,aAAa,OAAA;AACb,sHAAA,kBAAkB,OAAA;AAClB,wHAAA,oBAAoB,OAAA;AACpB,0HAAA,sBAAsB,OAAA;AACtB,0HAAA,sBAAsB,OAAA;AAKxB,gFAKiD;AAJ/C,2HAAA,mBAAmB,OAAA;AACnB,uHAAA,eAAe,OAAA;AACf,yHAAA,iBAAiB,OAAA;AACjB,4HAAA,oBAAoB,OAAA;AAQtB,gFAAgF;AAChF,+EAA+E;AAC/E,gFAAgF;AAChF,4EAA4E;AAC5E,6EAA6E;AAC7E,mBAAmB;AACnB,gFAaiD;AAZ/C,yHAAA,iBAAiB,OAAA;AACjB,kIAAA,0BAA0B,OAAA;AAC1B,uEAAuE;AACvE,2EAA2E;AAC3E,0EAA0E;AAC1E,6EAA6E;AAC7E,yEAAyE;AACzE,wHAAA,gBAAgB,OAAA;AAChB,oIAAA,4BAA4B,OAAA;AAC5B,oIAAA,4BAA4B,OAAA;AAC5B,6HAAA,qBAAqB,OAAA;AACrB,kIAAA,0BAA0B,OAAA"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* adapters/hosting/foundryResponses — an agent behind Microsoft Foundry's
|
|
3
|
+
* hosted-agent contract.
|
|
4
|
+
*
|
|
5
|
+
* ── The split, and why it is here ────────────────────────────────────────────
|
|
6
|
+
* Two different things are needed to serve a Foundry hosted agent, and only one
|
|
7
|
+
* of them is Microsoft's:
|
|
8
|
+
*
|
|
9
|
+
* • The **Responses protocol** — `input` items, a `response` object, the
|
|
10
|
+
* named streaming lifecycle. That is a protocol several runtimes speak, so
|
|
11
|
+
* it lives in `responsesWire.ts` with no vendor in it.
|
|
12
|
+
* • The **hosting contract** — port 8088, `POST /responses`, a `HEAD` probe
|
|
13
|
+
* on the same path, `GET /readiness` answering `{"status":"healthy"}`, and
|
|
14
|
+
* `agent_session_id` as a session alias. That IS this runtime's contract,
|
|
15
|
+
* the same way `/invocations` and `X-Amzn-…` are another's, and it is what
|
|
16
|
+
* this file supplies.
|
|
17
|
+
*
|
|
18
|
+
* So this file is a configuration, not an implementation. Everything hard —
|
|
19
|
+
* draining on close, aborting when the caller hangs up, failing a handler that
|
|
20
|
+
* throws or answers nothing — is `httpHost`'s, shared with every other adapter
|
|
21
|
+
* rather than reimplemented here where the two would drift.
|
|
22
|
+
*
|
|
23
|
+
* ── What it does NOT do ──────────────────────────────────────────────────────
|
|
24
|
+
* **Workflow Visualizer topology is not provided.** The Inspector can invoke
|
|
25
|
+
* this host and render its answer; it does not learn that the answer came from
|
|
26
|
+
* four composed agents, because nothing in the Responses protocol carries that
|
|
27
|
+
* and inventing a channel for it would be claiming a compatibility this has
|
|
28
|
+
* never demonstrated. An agent's internal structure is readable from
|
|
29
|
+
* agentfootprint's own recorders.
|
|
30
|
+
*
|
|
31
|
+
* Everything the protocol does not carry — tool calls, image and file input,
|
|
32
|
+
* function-call output, structured output — is refused by name. See
|
|
33
|
+
* `responsesWire.ts`.
|
|
34
|
+
*
|
|
35
|
+
* This is an **inbound hosting adapter**: it is the door callers arrive at. It
|
|
36
|
+
* is not a model provider, and it has nothing to do with which model the agent
|
|
37
|
+
* calls — for Foundry models, that is `openai()` with the endpoint's base URL.
|
|
38
|
+
*
|
|
39
|
+
* @example An agent behind the Inspector
|
|
40
|
+
* import { foundryResponsesHost, memorySessions, standingAgent } from 'agentfootprint/hosting';
|
|
41
|
+
*
|
|
42
|
+
* const handle = await standingAgent({
|
|
43
|
+
* agent,
|
|
44
|
+
* sessions: memorySessions(),
|
|
45
|
+
* host: foundryResponsesHost(),
|
|
46
|
+
* });
|
|
47
|
+
* process.on('SIGTERM', () => void handle.close());
|
|
48
|
+
*/
|
|
49
|
+
/// <reference types="node" />
|
|
50
|
+
import type { IncomingMessage, Server, ServerResponse } from 'node:http';
|
|
51
|
+
import { type HttpHost } from '../../hosting/httpHost.js';
|
|
52
|
+
/** The port a Foundry hosted agent is expected on. */
|
|
53
|
+
export declare const DEFAULT_FOUNDRY_PORT = 8088;
|
|
54
|
+
/** The path that takes a turn. */
|
|
55
|
+
export declare const FOUNDRY_INVOKE_PATH = "/responses";
|
|
56
|
+
/** The path a Foundry hosted agent answers a readiness probe on. */
|
|
57
|
+
export declare const FOUNDRY_READINESS_PATH = "/readiness";
|
|
58
|
+
/**
|
|
59
|
+
* Session aliases this contract accepts, in precedence order.
|
|
60
|
+
*
|
|
61
|
+
* `conversation` is the protocol's own; `agent_session_id` is this runtime's;
|
|
62
|
+
* `session_id` is the spelling several clients send anyway. First one present
|
|
63
|
+
* wins, so a caller using any of the three reaches the same session.
|
|
64
|
+
*/
|
|
65
|
+
export declare const FOUNDRY_SESSION_FIELDS: readonly string[];
|
|
66
|
+
export interface FoundryResponsesHostOptions {
|
|
67
|
+
/** Port to bind. Default {@link DEFAULT_FOUNDRY_PORT}. Pass `0` for an ephemeral test port. */
|
|
68
|
+
readonly port?: number;
|
|
69
|
+
/** Interface to bind. Default `'0.0.0.0'` — a container's door has to be reachable from outside it. */
|
|
70
|
+
readonly hostname?: string;
|
|
71
|
+
/** Model label echoed in `response` objects when the request names none. */
|
|
72
|
+
readonly model?: string;
|
|
73
|
+
/** Ceiling on a request body. Default one mebibyte. */
|
|
74
|
+
readonly maxBodyBytes?: number;
|
|
75
|
+
/**
|
|
76
|
+
* A `node:http` server you own, to ATTACH these routes to rather than binding
|
|
77
|
+
* one. Refused together with `port`/`hostname`, which would name a socket
|
|
78
|
+
* this host does not bind.
|
|
79
|
+
*/
|
|
80
|
+
readonly server?: Server;
|
|
81
|
+
/** Answer a path this host does not own. Private-server mode only. */
|
|
82
|
+
readonly onUnhandled?: (req: IncomingMessage, res: ServerResponse) => void;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* An {@link HttpHost} speaking Foundry's hosted-agent contract.
|
|
86
|
+
*
|
|
87
|
+
* @param options - Port, interface, model label and body ceiling.
|
|
88
|
+
*/
|
|
89
|
+
export declare function foundryResponsesHost(options?: FoundryResponsesHostOptions): HttpHost;
|
|
90
|
+
//# sourceMappingURL=foundryResponses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"foundryResponses.d.ts","sourceRoot":"","sources":["../../../../src/adapters/hosting/foundryResponses.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEzE,OAAO,EAAY,KAAK,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAGpE,sDAAsD;AACtD,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAEzC,kCAAkC;AAClC,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAEhD,oEAAoE;AACpE,eAAO,MAAM,sBAAsB,eAAe,CAAC;AAEnD;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAInD,CAAC;AAQF,MAAM,WAAW,2BAA2B;IAC1C,+FAA+F;IAC/F,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,uGAAuG;IACvG,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,4EAA4E;IAC5E,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,uDAAuD;IACvD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,sEAAsE;IACtE,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,KAAK,IAAI,CAAC;CAC5E;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,2BAAgC,GAAG,QAAQ,CA2BxF"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* adapters/hosting/responsesWire — the Responses protocol, as an `HttpWire`.
|
|
3
|
+
*
|
|
4
|
+
* ── What this is, and what it deliberately is not ────────────────────────────
|
|
5
|
+
* This file speaks the **Responses** wire protocol: a request carries `input`
|
|
6
|
+
* as text or as message items, a reply is a `response` object with an id and a
|
|
7
|
+
* status, and a stream is a LIFECYCLE of named events that open the response,
|
|
8
|
+
* announce output, carry deltas, and close each part before closing the
|
|
9
|
+
* response itself.
|
|
10
|
+
*
|
|
11
|
+
* That protocol is nobody's product. It is the shape a Responses-speaking
|
|
12
|
+
* client sends and expects, and several hosted runtimes speak it. So it lives
|
|
13
|
+
* here as a dialect on its own, and the runtimes that CONFIGURE it — their
|
|
14
|
+
* paths, their ports, their probe bodies, their session aliases — live in their
|
|
15
|
+
* own files beside this one. Keeping the split means the next runtime that
|
|
16
|
+
* speaks Responses is a configuration rather than a copy, and it means no
|
|
17
|
+
* vendor's spelling ends up in the protocol.
|
|
18
|
+
*
|
|
19
|
+
* ── The subset ───────────────────────────────────────────────────────────────
|
|
20
|
+
* A text turn, streamed or not, with a session. Deliberately not the whole
|
|
21
|
+
* Responses API: tool calls, reasoning items, image/file input, structured
|
|
22
|
+
* output and function-call output are NOT carried, and each is REFUSED by name
|
|
23
|
+
* rather than dropped — a request whose content this dialect cannot represent
|
|
24
|
+
* is answered 400 before a turn is paid for, never answered 200 with the parts
|
|
25
|
+
* it happened to understand.
|
|
26
|
+
*
|
|
27
|
+
* @example A host that speaks Responses on paths of its own choosing
|
|
28
|
+
* httpHost({
|
|
29
|
+
* name: 'myResponsesHost',
|
|
30
|
+
* wire: responsesWire({ defaultModel: 'my-agent' }),
|
|
31
|
+
* invokePath: '/responses',
|
|
32
|
+
* healthPath: '/health',
|
|
33
|
+
* });
|
|
34
|
+
*/
|
|
35
|
+
import type { HttpWire } from '../../hosting/httpHost.js';
|
|
36
|
+
/** Body fields that may carry a session id, in the order they are consulted. */
|
|
37
|
+
export declare const DEFAULT_SESSION_FIELDS: readonly string[];
|
|
38
|
+
/**
|
|
39
|
+
* What a caller is told when a handler THREW.
|
|
40
|
+
*
|
|
41
|
+
* A thrown error's message is the author's note to their own logs — a query, a
|
|
42
|
+
* path, a token in a connection string — and none of it is the caller's. A
|
|
43
|
+
* handler that CHOSE to fail chose its words for the caller, so those travel
|
|
44
|
+
* unchanged. The host tells this dialect which happened; it never guesses from
|
|
45
|
+
* the message.
|
|
46
|
+
*/
|
|
47
|
+
export declare const PUBLIC_FAILURE_MESSAGE = "The agent could not complete this request.";
|
|
48
|
+
export interface ResponsesWireOptions {
|
|
49
|
+
/** Model label echoed in `response` objects when the request names none. */
|
|
50
|
+
readonly defaultModel?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Body fields that carry a session id, in precedence order. The first one
|
|
53
|
+
* present and non-empty wins. Default `['conversation', 'session_id']`.
|
|
54
|
+
*
|
|
55
|
+
* A runtime with its own spelling passes its own list — that is the seam a
|
|
56
|
+
* hosting contract configures rather than forks this file for.
|
|
57
|
+
*/
|
|
58
|
+
readonly sessionFields?: readonly string[];
|
|
59
|
+
/** Body for the health probe. Default `{ status: 'ok' }`. */
|
|
60
|
+
readonly health?: unknown;
|
|
61
|
+
}
|
|
62
|
+
type JsonObject = Readonly<Record<string, unknown>>;
|
|
63
|
+
/** The turn's text: a bare string, or the user message items that carry it. */
|
|
64
|
+
export declare function readResponsesInput(input: unknown): string;
|
|
65
|
+
/** The session this request claims, by whichever of its aliases it used. */
|
|
66
|
+
export declare function readResponsesSession(body: JsonObject, fields: readonly string[]): string | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* An `HttpWire` speaking the Responses protocol.
|
|
69
|
+
*
|
|
70
|
+
* Pair it with `httpHost` and the paths your deployment contract names. The
|
|
71
|
+
* host keeps its own promises — draining, aborting on disconnect, failing a
|
|
72
|
+
* handler that throws or answers nothing — and this supplies only the dialect.
|
|
73
|
+
*/
|
|
74
|
+
export declare function responsesWire(options?: ResponsesWireOptions): HttpWire;
|
|
75
|
+
export {};
|
|
76
|
+
//# sourceMappingURL=responsesWire.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responsesWire.d.ts","sourceRoot":"","sources":["../../../../src/adapters/hosting/responsesWire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAKH,OAAO,KAAK,EAGV,QAAQ,EAGT,MAAM,2BAA2B,CAAC;AAEnC,gFAAgF;AAChF,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAAmC,CAAC;AAExF;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,+CAA+C,CAAC;AAInF,MAAM,WAAW,oBAAoB;IACnC,4EAA4E;IAC5E,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;;OAMG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,6DAA6D;IAC7D,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,KAAK,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAuCpD,+EAA+E;AAC/E,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAgCzD;AAED,4EAA4E;AAC5E,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,SAAS,MAAM,EAAE,GACxB,MAAM,GAAG,SAAS,CAUpB;AAqMD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,oBAAyB,GAAG,QAAQ,CAuC1E"}
|
|
@@ -480,5 +480,48 @@ export declare class SessionsNotCarriedError extends Error {
|
|
|
480
480
|
* // or branch instead of insisting:
|
|
481
481
|
* if (host.capabilities.includes('streaming')) { ... }
|
|
482
482
|
*/
|
|
483
|
+
/**
|
|
484
|
+
* Thrown when a request body exceeds the ceiling the host was given.
|
|
485
|
+
*
|
|
486
|
+
* A body is memory this process pays for while somebody else fills it, so a
|
|
487
|
+
* host with a ceiling stops reading at it rather than discovering the limit as
|
|
488
|
+
* an out-of-memory kill. The read is abandoned at the byte that crossed the
|
|
489
|
+
* line — nothing further is buffered, and the bytes already read are dropped.
|
|
490
|
+
*
|
|
491
|
+
* There is no default ceiling: see `HttpHostOptions.maxBodyBytes` for why the
|
|
492
|
+
* absence is deliberate and what it costs.
|
|
493
|
+
*/
|
|
494
|
+
export declare class RequestTooLargeError extends Error {
|
|
495
|
+
readonly limitBytes: number;
|
|
496
|
+
readonly code: "ERR_REQUEST_TOO_LARGE";
|
|
497
|
+
constructor(limitBytes: number, hostName: string);
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* A dialect's refusal of THIS request — its own status, its own code.
|
|
501
|
+
*
|
|
502
|
+
* `readRequest` is a wire's one chance to look at a body before a turn is paid
|
|
503
|
+
* for, and some dialects can tell from the shape alone that they cannot serve
|
|
504
|
+
* it: an input item kind this dialect does not carry, a field whose type is
|
|
505
|
+
* wrong. Throwing this says so with a status the caller can act on, instead of
|
|
506
|
+
* a 500 that reads as "the server broke" for a request the caller could fix.
|
|
507
|
+
*
|
|
508
|
+
* The distinction it keeps: this is the REQUEST being wrong. A dialect that
|
|
509
|
+
* throws anything else from `readRequest` still gets that request's 500, which
|
|
510
|
+
* is the honest answer when the dialect itself is what failed.
|
|
511
|
+
*
|
|
512
|
+
* @example A dialect refusing an input kind it does not carry
|
|
513
|
+
* throw new WireRequestRefusal(
|
|
514
|
+
* 'unsupported_input',
|
|
515
|
+
* 'image input is not carried by this dialect',
|
|
516
|
+
* );
|
|
517
|
+
*/
|
|
518
|
+
export declare class WireRequestRefusal extends Error {
|
|
519
|
+
readonly code: string;
|
|
520
|
+
/** HTTP status for this refusal. Default 400 — the request is what is wrong. */
|
|
521
|
+
readonly status: number;
|
|
522
|
+
constructor(code: string, detail: string,
|
|
523
|
+
/** HTTP status for this refusal. Default 400 — the request is what is wrong. */
|
|
524
|
+
status?: number);
|
|
525
|
+
}
|
|
483
526
|
export declare function requireCapability(host: AgentHost | ConversationHost, capability: HostCapability): void;
|
|
484
527
|
//# sourceMappingURL=errors.d.ts.map
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,GAAE,MAAY;CAKhC;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,SAAS,GAAG,gBAAgB,EAClC,UAAU,EAAE,cAAc,GACzB,IAAI,CASN"}
|
|
@@ -90,6 +90,72 @@ export interface HttpRequestFacts {
|
|
|
90
90
|
* going out as one body or as a stream of frames — those are {@link httpHost}'s
|
|
91
91
|
* job, identical for every wire, which is the entire point of separating them.
|
|
92
92
|
*/
|
|
93
|
+
/**
|
|
94
|
+
* One Server-Sent Event: the name it is announced under, and the body that
|
|
95
|
+
* rides with it.
|
|
96
|
+
*/
|
|
97
|
+
/**
|
|
98
|
+
* Where a failure came from.
|
|
99
|
+
*
|
|
100
|
+
* `'refused'` is the handler CHOOSING to fail with words it picked for the
|
|
101
|
+
* caller. `'threw'` is an exception this host caught — the message is the
|
|
102
|
+
* author's note to their own logs, and may name a query, a path or a token.
|
|
103
|
+
*
|
|
104
|
+
* The distinction exists because a dialect that sanitises has to sanitise the
|
|
105
|
+
* right one: replacing both silences deliberate refusals, and replacing
|
|
106
|
+
* neither publishes stack-trace prose to whoever is on the other end.
|
|
107
|
+
*/
|
|
108
|
+
export type FailureOrigin = 'refused' | 'threw';
|
|
109
|
+
export interface StreamFrame {
|
|
110
|
+
readonly event: string;
|
|
111
|
+
readonly data: unknown;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* The frames ONE streaming response is made of.
|
|
115
|
+
*
|
|
116
|
+
* ── Why this exists ──────────────────────────────────────────────────────────
|
|
117
|
+
* A wire's body methods answer "what do the fields say". This answers a
|
|
118
|
+
* different question: "what SHAPE is a stream". This host's own dialect frames
|
|
119
|
+
* one homogeneous `chunk` per piece and one terminal frame, and that is a real
|
|
120
|
+
* shape — but it is not the only one. Several protocols in wide use frame a
|
|
121
|
+
* stream as a LIFECYCLE instead: named events that open a response, announce
|
|
122
|
+
* that output is beginning, carry deltas, close each part, and close the
|
|
123
|
+
* response — every event referring to one response object by id, often
|
|
124
|
+
* numbered.
|
|
125
|
+
*
|
|
126
|
+
* Those cannot be expressed as "a body shape per chunk", because one host
|
|
127
|
+
* lifecycle point becomes SEVERAL frames, and because the frames share state
|
|
128
|
+
* (an id minted once, a counter that only goes up). So a dialect that frames
|
|
129
|
+
* this way supplies one of these PER RESPONSE and keeps that state in it.
|
|
130
|
+
*
|
|
131
|
+
* ── The default is one of these ──────────────────────────────────────────────
|
|
132
|
+
* A wire that supplies none gets framing built from its own body methods —
|
|
133
|
+
* `chunk`/`complete`/`error`, exactly as before. The incumbent shape is an
|
|
134
|
+
* INSTANCE of this seam rather than a special case beside it, which is the
|
|
135
|
+
* reason to believe the seam is in the right place.
|
|
136
|
+
*/
|
|
137
|
+
export interface StreamFraming {
|
|
138
|
+
/**
|
|
139
|
+
* Frames to write the moment the stream opens, before the handler runs.
|
|
140
|
+
* Absent or empty means the stream announces itself with nothing, which is
|
|
141
|
+
* this host's own behaviour.
|
|
142
|
+
*/
|
|
143
|
+
open?(): readonly StreamFrame[];
|
|
144
|
+
/** Frames for one piece of streamed output. */
|
|
145
|
+
chunk(text: string): readonly StreamFrame[];
|
|
146
|
+
/** Frames that close a response that completed. */
|
|
147
|
+
complete(output: string): readonly StreamFrame[];
|
|
148
|
+
/** Frames that close a response that failed. */
|
|
149
|
+
failure(message: string, code?: string, origin?: FailureOrigin): readonly StreamFrame[];
|
|
150
|
+
/**
|
|
151
|
+
* Frames that close a response ending in one of the other terminals. Absent
|
|
152
|
+
* means the single-frame default, so a framing written for text alone keeps
|
|
153
|
+
* working when an artifact or a paused run comes back through it.
|
|
154
|
+
*/
|
|
155
|
+
awaiting?(pending: PendingAsk): readonly StreamFrame[];
|
|
156
|
+
artifact?(result: ArtifactWireResult): readonly StreamFrame[];
|
|
157
|
+
sessions?(result: SessionWireResult): readonly StreamFrame[];
|
|
158
|
+
}
|
|
93
159
|
export interface HttpWire {
|
|
94
160
|
/**
|
|
95
161
|
* Pull the port's vocabulary out of one request. Anything the wire cannot
|
|
@@ -151,12 +217,47 @@ export interface HttpWire {
|
|
|
151
217
|
*/
|
|
152
218
|
readonly responseHeaders?: Readonly<Record<string, string>>;
|
|
153
219
|
};
|
|
220
|
+
/**
|
|
221
|
+
* Did THIS caller ask for a stream?
|
|
222
|
+
*
|
|
223
|
+
* Absent, the answer is the HTTP one: an `Accept` of `text/event-stream`.
|
|
224
|
+
* That is the right default and the wrong rule for dialects that carry the
|
|
225
|
+
* choice in the body instead — where a client sets a field and never touches
|
|
226
|
+
* `Accept`, and a host reading only the header answers one JSON body to a
|
|
227
|
+
* caller waiting for events.
|
|
228
|
+
*
|
|
229
|
+
* Present, this is the whole answer: a dialect that says how its callers ask
|
|
230
|
+
* is not second-guessed by the header. Read before any reply is framed, so it
|
|
231
|
+
* decides `content-type` for the request.
|
|
232
|
+
*/
|
|
233
|
+
wantsStream?(facts: HttpRequestFacts): boolean;
|
|
234
|
+
/**
|
|
235
|
+
* Framing for ONE streaming response — see {@link StreamFraming}.
|
|
236
|
+
*
|
|
237
|
+
* Called once per streaming request, so whatever the framing has to remember
|
|
238
|
+
* across its frames (an id minted for this response, a sequence counter) is
|
|
239
|
+
* per-response state and never shared between callers. Absent, this host
|
|
240
|
+
* frames the stream with the wire's own body shapes.
|
|
241
|
+
*/
|
|
242
|
+
stream?(facts: HttpRequestFacts): StreamFraming;
|
|
154
243
|
/** Body for a health probe. `uptimeMs` is how long this host has been serving. */
|
|
155
244
|
health(uptimeMs: number): unknown;
|
|
156
|
-
/**
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
245
|
+
/**
|
|
246
|
+
* Body for a reply that completed.
|
|
247
|
+
*
|
|
248
|
+
* `facts` is the request that produced it, for dialects whose reply repeats
|
|
249
|
+
* something the request said — a model name, a conversation id. Absent only
|
|
250
|
+
* where there is no request to show: this host has none to give when a body
|
|
251
|
+
* is built outside a request's own lifecycle.
|
|
252
|
+
*/
|
|
253
|
+
output(output: string, facts?: HttpRequestFacts): unknown;
|
|
254
|
+
/**
|
|
255
|
+
* Body for a reply that failed. `code` is the refusal's stable code, when it
|
|
256
|
+
* has one — and its PRESENCE is the signal that the message was authored by
|
|
257
|
+
* this library rather than thrown by somebody's handler, which is what lets a
|
|
258
|
+
* dialect decide what is safe to repeat to a caller.
|
|
259
|
+
*/
|
|
260
|
+
failure(message: string, code?: string, facts?: HttpRequestFacts, origin?: FailureOrigin): unknown;
|
|
160
261
|
/** Body for one streamed piece, when the caller asked for Server-Sent Events. */
|
|
161
262
|
chunk(text: string): unknown;
|
|
162
263
|
/**
|
|
@@ -355,6 +456,34 @@ export interface HttpHostOptions {
|
|
|
355
456
|
* });
|
|
356
457
|
*/
|
|
357
458
|
readonly onUnhandled?: (req: IncomingMessage, res: ServerResponse) => void;
|
|
459
|
+
/**
|
|
460
|
+
* Ceiling on a request body, in bytes. Default: **none**.
|
|
461
|
+
*
|
|
462
|
+
* ── Why the default is no ceiling ────────────────────────────────────────
|
|
463
|
+
* Not because unbounded is right — it is not. A body is memory this process
|
|
464
|
+
* pays for while somebody else fills it, and a host without a ceiling can be
|
|
465
|
+
* stopped by one caller with a large POST. The default is absent because
|
|
466
|
+
* every adapter built on this file inherited unbounded reads before this
|
|
467
|
+
* option existed, and a number chosen here would silently start refusing
|
|
468
|
+
* requests that deployments are serving today.
|
|
469
|
+
*
|
|
470
|
+
* **Set it.** A deployment that knows the largest body it legitimately
|
|
471
|
+
* carries should say so; a request over the line is refused with
|
|
472
|
+
* `ERR_REQUEST_TOO_LARGE` (413) and the read is abandoned at the byte that
|
|
473
|
+
* crossed it, rather than buffered to the end and then judged.
|
|
474
|
+
*/
|
|
475
|
+
readonly maxBodyBytes?: number;
|
|
476
|
+
/**
|
|
477
|
+
* Answer `HEAD` on the invoke path with 204, instead of the 404 an unowned
|
|
478
|
+
* method gets. Default `false`.
|
|
479
|
+
*
|
|
480
|
+
* Some deployment contracts probe a door before using it — "is the agent
|
|
481
|
+
* here?" — and a probe is not a turn: nothing is read, nothing is run, and
|
|
482
|
+
* the body is empty by definition. Opt-in, because a host that answered it
|
|
483
|
+
* unasked would change what every existing adapter says to a method it has
|
|
484
|
+
* always declined.
|
|
485
|
+
*/
|
|
486
|
+
readonly invokeHeadProbe?: boolean;
|
|
358
487
|
}
|
|
359
488
|
/** A {@link HostHandle} that also says where it landed. */
|
|
360
489
|
export interface HttpHostHandle extends HostHandle {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpHost.d.ts","sourceRoot":"","sources":["../../../src/hosting/httpHost.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAIzE,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"httpHost.d.ts","sourceRoot":"","sources":["../../../src/hosting/httpHost.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAIzE,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AASjF,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAG9E,OAAO,KAAK,EACV,SAAS,EACT,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,WAAW,EAEX,UAAU,EACX,MAAM,YAAY,CAAC;AACpB,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACpB,MAAM,4BAA4B,CAAC;AAEpC,YAAY,EAAE,qBAAqB,EAAE,cAAc,EAAE,CAA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C,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;;;;;OASG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,2DAA2D;AAC3D,MAAM,WAAW,cAAe,SAAQ,UAAU;IAChD;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,yEAAyE;IACzE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,QAAS,SAAQ,SAAS,EAAE,gBAAgB;IAC3D,KAAK,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACrD,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAC3E;AAsFD;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,QAAQ,CAiW3D;AAibD;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CAAE,EAC7D,IAAI,EAAE,MAAM,EACZ,GAAG,SAAS,EAAE,MAAM,EAAE,GACrB,MAAM,GAAG,SAAS,CAMpB"}
|
|
@@ -95,14 +95,14 @@
|
|
|
95
95
|
export { nodeHost, jsonWire, jsonWireWith, DEFAULT_SESSION_HEADER } from './nodeHost.js';
|
|
96
96
|
export type { NodeHost, NodeHostHandle, NodeHostOptions, JsonWireOptions } from './nodeHost.js';
|
|
97
97
|
export { httpHost, headerValue } from './httpHost.js';
|
|
98
|
-
export type { ConversationHandshake, HandshakeFacts, HttpHost, HttpHostHandle, HttpHostOptions, HttpRequestFacts, HttpWire, } from './httpHost.js';
|
|
98
|
+
export type { ConversationHandshake, HandshakeFacts, HttpHost, HttpHostHandle, HttpHostOptions, FailureOrigin, HttpRequestFacts, HttpWire, StreamFrame, StreamFraming, } from './httpHost.js';
|
|
99
99
|
export { memorySessions } from './memorySessions.js';
|
|
100
100
|
export { sqliteSessions, SqliteUnavailableError, UnreadableSessionFileError, } from './sqliteSessions.js';
|
|
101
101
|
export type { SqliteSessions, SqliteSessionsOptions } from './sqliteSessions.js';
|
|
102
102
|
export { toEnvelope, envelopeOwner, envelopeTranscript, toPausedEnvelope, readEnvelope, readPausedRun, checkEnvelope, } from './envelope.js';
|
|
103
103
|
export { standingAgent } from './standingAgent.js';
|
|
104
104
|
export { DEFAULT_MAX_ACTIVE_SESSIONS, DEFAULT_SWEEP_LIMIT } from './types.js';
|
|
105
|
-
export { requireCapability, HostClosedError, ConcurrentRunError, PauseNotCarriedError, AwaitingDecisionError, NoPendingAskError, UnreadableEnvelopeError, ConversationClosedError, FrameTooLargeError, InvalidWireOpError, ArtifactSessionRequiredError, NoArtifactStoreError, ArtifactNotFoundError, ArtifactNotCarriedError, IdentityNotVerifiedError, VerifierUnavailableError, AdmissionRefusedError, SessionOpNeedsIdentityError, SessionIndexUnavailableError, SessionRetentionUnavailableError, SessionNotFoundError, SessionOwnershipConflictError, SessionsNotCarriedError, } from './errors.js';
|
|
105
|
+
export { requireCapability, HostClosedError, ConcurrentRunError, PauseNotCarriedError, AwaitingDecisionError, NoPendingAskError, UnreadableEnvelopeError, ConversationClosedError, FrameTooLargeError, InvalidWireOpError, ArtifactSessionRequiredError, NoArtifactStoreError, ArtifactNotFoundError, ArtifactNotCarriedError, IdentityNotVerifiedError, VerifierUnavailableError, AdmissionRefusedError, SessionOpNeedsIdentityError, SessionIndexUnavailableError, SessionRetentionUnavailableError, SessionNotFoundError, SessionOwnershipConflictError, SessionsNotCarriedError, RequestTooLargeError, WireRequestRefusal, } from './errors.js';
|
|
106
106
|
export type { IdentityFailureClass } from './errors.js';
|
|
107
107
|
export { sessionRetention } from './sessionRetention.js';
|
|
108
108
|
export { resolveSessionOwner } from './sessionOwnership.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hosting/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6FG;AAEH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACzF,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAQhG,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACtD,YAAY,EACV,qBAAqB,EACrB,cAAc,EACd,QAAQ,EACR,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hosting/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6FG;AAEH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACzF,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAQhG,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACtD,YAAY,EACV,qBAAqB,EACrB,cAAc,EACd,QAAQ,EACR,cAAc,EACd,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,WAAW,EACX,aAAa,GACd,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,cAAc,EACd,sBAAsB,EAC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0BAA0B,EAC1B,WAAW,EACX,UAAU,GACX,MAAM,YAAY,CAAC"}
|
|
@@ -25,6 +25,19 @@
|
|
|
25
25
|
* idleMs: 900000 }` declared, session affinity readable from header or
|
|
26
26
|
* query, and a `Sec-WebSocket-Protocol` bearer mapped into
|
|
27
27
|
* `headers.authorization`.
|
|
28
|
+
* • `foundryResponsesHost({ port?, hostname?, model?, maxBodyBytes? })` — an
|
|
29
|
+
* `AgentHost` for Microsoft Foundry's hosted-agent contract: `POST
|
|
30
|
+
* /responses`, a `HEAD` capability probe on the same path, `GET /readiness`
|
|
31
|
+
* answering `{"status":"healthy"}`, port 8088, and the session read from
|
|
32
|
+
* `conversation` / `agent_session_id` / `session_id` in that order. It
|
|
33
|
+
* streams when the BODY says `stream: true` — not the `Accept` header —
|
|
34
|
+
* and frames that stream as the Responses lifecycle.
|
|
35
|
+
* **Inbound only:** it is the door callers arrive at, and says nothing
|
|
36
|
+
* about which model the agent calls. It does NOT provide Workflow
|
|
37
|
+
* Visualizer topology; see the adapter's header.
|
|
38
|
+
* • `responsesWire({ defaultModel?, sessionFields?, health? })` — the
|
|
39
|
+
* Responses PROTOCOL as an `HttpWire`, with no vendor in it, for the next
|
|
40
|
+
* runtime that speaks it on paths of its own.
|
|
28
41
|
* • `agentCoreSessions({ store })` — a `SessionLifecycle` whose checkpoint
|
|
29
42
|
* home you choose at construction: a JSON file in the runtime's own session
|
|
30
43
|
* storage (survives a stop/resume, needs no SDK), or one AgentCore Memory
|
|
@@ -87,6 +100,10 @@
|
|
|
87
100
|
* symbols, one door. Import from the door.
|
|
88
101
|
*/
|
|
89
102
|
export { agentCoreRuntimeHost, agentCoreRuntimeWire, readAgentCoreConversation, agentCoreSessions, DEFAULT_SESSION_STORAGE_PATH, } from './adapters/hosting/agentcore.js';
|
|
103
|
+
export { foundryResponsesHost, DEFAULT_FOUNDRY_PORT, FOUNDRY_INVOKE_PATH, FOUNDRY_READINESS_PATH, FOUNDRY_SESSION_FIELDS, } from './adapters/hosting/foundryResponses.js';
|
|
104
|
+
export type { FoundryResponsesHostOptions } from './adapters/hosting/foundryResponses.js';
|
|
105
|
+
export { responsesWire, readResponsesInput, readResponsesSession, DEFAULT_SESSION_FIELDS, PUBLIC_FAILURE_MESSAGE, } from './adapters/hosting/responsesWire.js';
|
|
106
|
+
export type { ResponsesWireOptions } from './adapters/hosting/responsesWire.js';
|
|
90
107
|
export { agentEngineSessions, DEFAULT_USER_ID, SESSION_STATE_KEY, SESSION_EVENT_AUTHOR, } from './adapters/hosting/googleAgentEngine.js';
|
|
91
108
|
export type { AgentEngineSessions, AgentEngineSessionsOptions, } from './adapters/hosting/googleAgentEngine.js';
|
|
92
109
|
export { firestoreSessions, DEFAULT_SESSION_COLLECTION, EXPIRES_AT_FIELD, FIRESTORE_MAX_DOCUMENT_BYTES, FIRESTORE_MAX_ENVELOPE_BYTES, EnvelopeTooLargeError, FirestoreIndexMissingError, } from './adapters/hosting/firestoreSessions.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosting-providers.d.ts","sourceRoot":"","sources":["../../src/hosting-providers.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"hosting-providers.d.ts","sourceRoot":"","sources":["../../src/hosting-providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoGG;AAEH,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,EACzB,iBAAiB,EACjB,4BAA4B,GAC7B,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,wCAAwC,CAAC;AAEhD,YAAY,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AAM1F,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,qCAAqC,CAAC;AAE7C,YAAY,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAEhF,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,yCAAyC,CAAC;AAEjD,YAAY,EACV,mBAAmB,EACnB,0BAA0B,GAC3B,MAAM,yCAAyC,CAAC;AAQjD,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAM1B,gBAAgB,EAChB,4BAA4B,EAC5B,4BAA4B,EAC5B,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,yCAAyC,CAAC;AAEjD,YAAY,EACV,iBAAiB,EACjB,wBAAwB,EACxB,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,uBAAuB,EACvB,kBAAkB,EAClB,0BAA0B,EAC1B,8BAA8B,EAC9B,6BAA6B,EAC7B,wBAAwB,GACzB,MAAM,yCAAyC,CAAC;AAEjD,YAAY,EACV,2BAA2B,EAC3B,wBAAwB,EACxB,qBAAqB,EACrB,4BAA4B,EAC5B,8BAA8B,EAC9B,0BAA0B,EAC1B,qBAAqB,EACrB,gCAAgC,GACjC,MAAM,iCAAiC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentfootprint",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.65.0",
|
|
4
4
|
"description": "The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|