agentfootprint 9.30.0 → 9.32.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/AGENTS.md +1 -1
- package/CLAUDE.md +6 -2
- package/ai-instructions/claude-code/SKILL.md +1 -1
- package/dist/adapters/identity/jwks.js +18 -0
- package/dist/adapters/identity/jwks.js.map +1 -1
- package/dist/adapters/llm/BrowserOpenAIProvider.js +5 -3
- package/dist/adapters/llm/BrowserOpenAIProvider.js.map +1 -1
- package/dist/adapters/llm/OpenAIProvider.js +74 -2
- package/dist/adapters/llm/OpenAIProvider.js.map +1 -1
- package/dist/adapters/llm/azureUrl.js +48 -0
- package/dist/adapters/llm/azureUrl.js.map +1 -0
- package/dist/adapters/llm/createProvider.js +25 -6
- package/dist/adapters/llm/createProvider.js.map +1 -1
- package/dist/adapters/types.js.map +1 -1
- package/dist/artifacts/gcsArtifacts.js +20 -0
- package/dist/artifacts/gcsArtifacts.js.map +1 -1
- package/dist/esm/adapters/identity/jwks.d.ts +18 -0
- package/dist/esm/adapters/identity/jwks.js +18 -0
- package/dist/esm/adapters/identity/jwks.js.map +1 -1
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.js +5 -3
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.js.map +1 -1
- package/dist/esm/adapters/llm/OpenAIProvider.d.ts +15 -2
- package/dist/esm/adapters/llm/OpenAIProvider.js +74 -2
- package/dist/esm/adapters/llm/OpenAIProvider.js.map +1 -1
- package/dist/esm/adapters/llm/azureUrl.d.ts +36 -0
- package/dist/esm/adapters/llm/azureUrl.js +43 -0
- package/dist/esm/adapters/llm/azureUrl.js.map +1 -0
- package/dist/esm/adapters/llm/createProvider.d.ts +5 -1
- package/dist/esm/adapters/llm/createProvider.js +25 -6
- package/dist/esm/adapters/llm/createProvider.js.map +1 -1
- package/dist/esm/adapters/types.d.ts +30 -2
- package/dist/esm/adapters/types.js.map +1 -1
- package/dist/esm/artifacts/gcsArtifacts.d.ts +20 -0
- package/dist/esm/artifacts/gcsArtifacts.js +20 -0
- package/dist/esm/artifacts/gcsArtifacts.js.map +1 -1
- package/dist/esm/events/payloads.d.ts +36 -0
- package/dist/esm/events/registry.d.ts +3 -1
- package/dist/esm/events/registry.js +2 -0
- package/dist/esm/events/registry.js.map +1 -1
- package/dist/esm/hosting/admission.d.ts +25 -0
- package/dist/esm/hosting/admission.js +25 -0
- package/dist/esm/hosting/admission.js.map +1 -1
- package/dist/esm/hosting/envelope.d.ts +10 -0
- package/dist/esm/hosting/envelope.js +10 -0
- package/dist/esm/hosting/envelope.js.map +1 -1
- package/dist/esm/hosting/index.d.ts +1 -0
- package/dist/esm/hosting/index.js.map +1 -1
- package/dist/esm/hosting/ingressRecord.d.ts +177 -0
- package/dist/esm/hosting/ingressRecord.js +246 -0
- package/dist/esm/hosting/ingressRecord.js.map +1 -0
- package/dist/esm/hosting/standingAgent.js +50 -1
- package/dist/esm/hosting/standingAgent.js.map +1 -1
- package/dist/esm/hosting/types.d.ts +31 -0
- package/dist/esm/hosting/types.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillExamples.d.ts +168 -0
- package/dist/esm/lib/injection-engine/skillExamples.js +435 -0
- package/dist/esm/lib/injection-engine/skillExamples.js.map +1 -0
- package/dist/esm/lib/injection-engine/skillGraph.d.ts +63 -0
- package/dist/esm/lib/injection-engine/skillGraph.js +40 -2
- package/dist/esm/lib/injection-engine/skillGraph.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillGraphCheckup.d.ts +25 -2
- package/dist/esm/lib/injection-engine/skillGraphCheckup.js +11 -2
- package/dist/esm/lib/injection-engine/skillGraphCheckup.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillMatch.d.ts +7 -0
- package/dist/esm/lib/injection-engine/skillMatch.js +9 -4
- package/dist/esm/lib/injection-engine/skillMatch.js.map +1 -1
- package/dist/esm/lib/mcp/gatewayTransport.d.ts +52 -0
- package/dist/esm/lib/mcp/gatewayTransport.js +1 -0
- package/dist/esm/lib/mcp/gatewayTransport.js.map +1 -1
- package/dist/esm/lib/mcp/mcpClient.js +8 -1
- package/dist/esm/lib/mcp/mcpClient.js.map +1 -1
- package/dist/esm/lib/mcp/types.d.ts +10 -0
- package/dist/esm/observe.js +2 -1
- package/dist/esm/observe.js.map +1 -1
- package/dist/esm/recorders/core/ResilienceRecorder.d.ts +8 -7
- package/dist/esm/recorders/core/ResilienceRecorder.js +9 -7
- package/dist/esm/recorders/core/ResilienceRecorder.js.map +1 -1
- package/dist/esm/recorders/core/resilienceHooks.d.ts +1 -0
- package/dist/esm/recorders/core/resilienceHooks.js +13 -0
- package/dist/esm/recorders/core/resilienceHooks.js.map +1 -1
- package/dist/esm/resilience/withCircuitBreaker.d.ts +27 -7
- package/dist/esm/resilience/withCircuitBreaker.js +53 -19
- package/dist/esm/resilience/withCircuitBreaker.js.map +1 -1
- package/dist/esm/resilience/withFallback.d.ts +11 -0
- package/dist/esm/resilience/withFallback.js +11 -0
- package/dist/esm/resilience/withFallback.js.map +1 -1
- package/dist/esm/resilience/withRetry.d.ts +12 -0
- package/dist/esm/resilience/withRetry.js +12 -0
- package/dist/esm/resilience/withRetry.js.map +1 -1
- package/dist/esm/security/PermissionPolicy.d.ts +22 -0
- package/dist/esm/security/PermissionPolicy.js +22 -0
- package/dist/esm/security/PermissionPolicy.js.map +1 -1
- package/dist/events/registry.js +2 -0
- package/dist/events/registry.js.map +1 -1
- package/dist/hosting/admission.js +25 -0
- package/dist/hosting/admission.js.map +1 -1
- package/dist/hosting/envelope.js +10 -0
- package/dist/hosting/envelope.js.map +1 -1
- package/dist/hosting/index.js.map +1 -1
- package/dist/hosting/ingressRecord.js +250 -0
- package/dist/hosting/ingressRecord.js.map +1 -0
- package/dist/hosting/standingAgent.js +50 -1
- package/dist/hosting/standingAgent.js.map +1 -1
- package/dist/hosting/types.js.map +1 -1
- package/dist/lib/injection-engine/skillExamples.js +440 -0
- package/dist/lib/injection-engine/skillExamples.js.map +1 -0
- package/dist/lib/injection-engine/skillGraph.js +40 -2
- package/dist/lib/injection-engine/skillGraph.js.map +1 -1
- package/dist/lib/injection-engine/skillGraphCheckup.js +11 -2
- package/dist/lib/injection-engine/skillGraphCheckup.js.map +1 -1
- package/dist/lib/injection-engine/skillMatch.js +11 -5
- package/dist/lib/injection-engine/skillMatch.js.map +1 -1
- package/dist/lib/mcp/gatewayTransport.js +1 -0
- package/dist/lib/mcp/gatewayTransport.js.map +1 -1
- package/dist/lib/mcp/mcpClient.js +8 -1
- package/dist/lib/mcp/mcpClient.js.map +1 -1
- package/dist/observe.js +2 -1
- package/dist/observe.js.map +1 -1
- package/dist/recorders/core/ResilienceRecorder.js +9 -7
- package/dist/recorders/core/ResilienceRecorder.js.map +1 -1
- package/dist/recorders/core/resilienceHooks.js +13 -0
- package/dist/recorders/core/resilienceHooks.js.map +1 -1
- package/dist/resilience/withCircuitBreaker.js +53 -19
- package/dist/resilience/withCircuitBreaker.js.map +1 -1
- package/dist/resilience/withFallback.js +11 -0
- package/dist/resilience/withFallback.js.map +1 -1
- package/dist/resilience/withRetry.js +12 -0
- package/dist/resilience/withRetry.js.map +1 -1
- package/dist/security/PermissionPolicy.js +22 -0
- package/dist/security/PermissionPolicy.js.map +1 -1
- package/dist/types/adapters/identity/jwks.d.ts +18 -0
- package/dist/types/adapters/identity/jwks.d.ts.map +1 -1
- package/dist/types/adapters/llm/BrowserOpenAIProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/OpenAIProvider.d.ts +15 -2
- package/dist/types/adapters/llm/OpenAIProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/azureUrl.d.ts +37 -0
- package/dist/types/adapters/llm/azureUrl.d.ts.map +1 -0
- package/dist/types/adapters/llm/createProvider.d.ts +5 -1
- package/dist/types/adapters/llm/createProvider.d.ts.map +1 -1
- package/dist/types/adapters/types.d.ts +30 -2
- package/dist/types/adapters/types.d.ts.map +1 -1
- package/dist/types/artifacts/gcsArtifacts.d.ts +20 -0
- package/dist/types/artifacts/gcsArtifacts.d.ts.map +1 -1
- package/dist/types/events/payloads.d.ts +36 -0
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/events/registry.d.ts +3 -1
- package/dist/types/events/registry.d.ts.map +1 -1
- package/dist/types/hosting/admission.d.ts +25 -0
- package/dist/types/hosting/admission.d.ts.map +1 -1
- package/dist/types/hosting/envelope.d.ts +10 -0
- package/dist/types/hosting/envelope.d.ts.map +1 -1
- package/dist/types/hosting/index.d.ts +1 -0
- package/dist/types/hosting/index.d.ts.map +1 -1
- package/dist/types/hosting/ingressRecord.d.ts +178 -0
- package/dist/types/hosting/ingressRecord.d.ts.map +1 -0
- package/dist/types/hosting/standingAgent.d.ts.map +1 -1
- package/dist/types/hosting/types.d.ts +31 -0
- package/dist/types/hosting/types.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillExamples.d.ts +169 -0
- package/dist/types/lib/injection-engine/skillExamples.d.ts.map +1 -0
- package/dist/types/lib/injection-engine/skillGraph.d.ts +63 -0
- package/dist/types/lib/injection-engine/skillGraph.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillGraphCheckup.d.ts +25 -2
- package/dist/types/lib/injection-engine/skillGraphCheckup.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillMatch.d.ts +7 -0
- package/dist/types/lib/injection-engine/skillMatch.d.ts.map +1 -1
- package/dist/types/lib/mcp/gatewayTransport.d.ts +52 -0
- package/dist/types/lib/mcp/gatewayTransport.d.ts.map +1 -1
- package/dist/types/lib/mcp/types.d.ts +10 -0
- package/dist/types/lib/mcp/types.d.ts.map +1 -1
- package/dist/types/observe.d.ts.map +1 -1
- package/dist/types/recorders/core/ResilienceRecorder.d.ts +8 -7
- package/dist/types/recorders/core/ResilienceRecorder.d.ts.map +1 -1
- package/dist/types/recorders/core/resilienceHooks.d.ts +1 -0
- package/dist/types/recorders/core/resilienceHooks.d.ts.map +1 -1
- package/dist/types/resilience/withCircuitBreaker.d.ts +27 -7
- package/dist/types/resilience/withCircuitBreaker.d.ts.map +1 -1
- package/dist/types/resilience/withFallback.d.ts +11 -0
- package/dist/types/resilience/withFallback.d.ts.map +1 -1
- package/dist/types/resilience/withRetry.d.ts +12 -0
- package/dist/types/resilience/withRetry.d.ts.map +1 -1
- package/dist/types/security/PermissionPolicy.d.ts +22 -0
- package/dist/types/security/PermissionPolicy.d.ts.map +1 -1
- package/package.json +2 -1
|
@@ -17,6 +17,18 @@
|
|
|
17
17
|
* • shouldRetry: rejects 4xx-class errors (client mistakes don't
|
|
18
18
|
* benefit from retry) and AbortError; retries 5xx,
|
|
19
19
|
* network errors, and unknown shapes.
|
|
20
|
+
*
|
|
21
|
+
* **Status: contract-shaped and tested — independently reproduced against a
|
|
22
|
+
* local harness, 2026-08-13.** Somebody who is not this library's author ran
|
|
23
|
+
* the behaviour end to end and it held: this decorator absorbed two HTTP
|
|
24
|
+
* 503-shaped failures and recovered on call three, with both
|
|
25
|
+
* `agentfootprint.error.retried` and `agentfootprint.error.recovered` on the
|
|
26
|
+
* typed stream, and it made exactly ONE streaming attempt, the limit as
|
|
27
|
+
* designed. What was exercised was a SCRIPTED failing provider — the trial's
|
|
28
|
+
* own note is that those tests *"were local and deterministic, so they consumed
|
|
29
|
+
* no GCP credit"*. **No live provider outage has been retried from this
|
|
30
|
+
* repository**, so this is not the field-validated rung: a real 503 from a real
|
|
31
|
+
* vendor, with a real Retry-After and real latency, remains unexercised.
|
|
20
32
|
*/
|
|
21
33
|
/**
|
|
22
34
|
* Wrap a provider so its `complete()` retries transient failures.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withRetry.js","sourceRoot":"","sources":["../../../src/resilience/withRetry.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"withRetry.js","sourceRoot":"","sources":["../../../src/resilience/withRetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAwCH;;;;;;;;;;;GAWG;AACH,MAAM,U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ClD,OAAO,CAAC,CAAC,IAAI,KAAK,YAAY,IAAI,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC;AAC3D,CAAC;AAED,SAAS,KAAK,CAAC,EAAU,EAAE,MAAoB;IAC7C,IAAI,EAAE,IAAI,CAAC;QAAE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IACtC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;YACpB,MAAM,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;YAC9C,OAAO;QACT,CAAC;QACD,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE;YACzB,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC9C,OAAO,EAAE,CAAC;QACZ,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,MAAM,OAAO,GAAG,GAAS,EAAE;YACzB,YAAY,CAAC,EAAE,CAAC,CAAC;YACjB,MAAM,CAAC,MAAM,EAAE,MAAM,IAAI,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QACjD,CAAC,CAAC;QACF,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -16,6 +16,28 @@
|
|
|
16
16
|
* - sync `isAllowed(toolId)` method (consumed by `gatedTools(...)`
|
|
17
17
|
* from `agentfootprint/providers`)
|
|
18
18
|
*
|
|
19
|
+
* **Status: contract-shaped and tested — independently reproduced against a
|
|
20
|
+
* local harness, 2026-08-13.** A tool declaring `memory_write` and `user_data`
|
|
21
|
+
* was put in front of two roles: the read-only role passed the tool-NAME
|
|
22
|
+
* allowlist, failed the `memory_write` capability check, and the tool executed
|
|
23
|
+
* ZERO times; the admin role cleared `tool_call`, `memory_write` and
|
|
24
|
+
* `user_data` and executed once. A separate checker that threw `simulated
|
|
25
|
+
* authorizer outage` failed CLOSED — a denial carrying the operator's error in
|
|
26
|
+
* its rationale, the model free to continue without the tool, zero executions
|
|
27
|
+
* again. The reviewer's own wording: *"the permission checker is a real
|
|
28
|
+
* execution guard, not merely tool hiding"*, which holds exactly as far as the
|
|
29
|
+
* policy inputs and the role binding are trustworthy — a fact about a
|
|
30
|
+
* deployment, not about this class.
|
|
31
|
+
*
|
|
32
|
+
* What was exercised: the guard, end to end, by somebody who is not this
|
|
33
|
+
* library's author — on a DETERMINISTIC LOCAL run whose model was a mock and
|
|
34
|
+
* whose "authorizer outage" was a thrown `Error` (those tests *"were local and
|
|
35
|
+
* deterministic, so they consumed no GCP credit"*). What was NOT: **no external
|
|
36
|
+
* authorization service has answered a `check()` from this repository**, so
|
|
37
|
+
* this is not the field-validated rung — a real IAM/OPA/entitlements backend,
|
|
38
|
+
* with its own latency, partial outages and stale caches, remains unexercised.
|
|
39
|
+
* Runnable: `examples/features/03-permissions.ts` (all four shapes).
|
|
40
|
+
*
|
|
19
41
|
* Pattern: Strategy (GoF) for the role-allowlist policy + Adapter
|
|
20
42
|
* (matches `PermissionChecker` interface so it composes with
|
|
21
43
|
* existing v2.4 Agent constructor).
|
|
@@ -16,6 +16,28 @@
|
|
|
16
16
|
* - sync `isAllowed(toolId)` method (consumed by `gatedTools(...)`
|
|
17
17
|
* from `agentfootprint/providers`)
|
|
18
18
|
*
|
|
19
|
+
* **Status: contract-shaped and tested — independently reproduced against a
|
|
20
|
+
* local harness, 2026-08-13.** A tool declaring `memory_write` and `user_data`
|
|
21
|
+
* was put in front of two roles: the read-only role passed the tool-NAME
|
|
22
|
+
* allowlist, failed the `memory_write` capability check, and the tool executed
|
|
23
|
+
* ZERO times; the admin role cleared `tool_call`, `memory_write` and
|
|
24
|
+
* `user_data` and executed once. A separate checker that threw `simulated
|
|
25
|
+
* authorizer outage` failed CLOSED — a denial carrying the operator's error in
|
|
26
|
+
* its rationale, the model free to continue without the tool, zero executions
|
|
27
|
+
* again. The reviewer's own wording: *"the permission checker is a real
|
|
28
|
+
* execution guard, not merely tool hiding"*, which holds exactly as far as the
|
|
29
|
+
* policy inputs and the role binding are trustworthy — a fact about a
|
|
30
|
+
* deployment, not about this class.
|
|
31
|
+
*
|
|
32
|
+
* What was exercised: the guard, end to end, by somebody who is not this
|
|
33
|
+
* library's author — on a DETERMINISTIC LOCAL run whose model was a mock and
|
|
34
|
+
* whose "authorizer outage" was a thrown `Error` (those tests *"were local and
|
|
35
|
+
* deterministic, so they consumed no GCP credit"*). What was NOT: **no external
|
|
36
|
+
* authorization service has answered a `check()` from this repository**, so
|
|
37
|
+
* this is not the field-validated rung — a real IAM/OPA/entitlements backend,
|
|
38
|
+
* with its own latency, partial outages and stale caches, remains unexercised.
|
|
39
|
+
* Runnable: `examples/features/03-permissions.ts` (all four shapes).
|
|
40
|
+
*
|
|
19
41
|
* Pattern: Strategy (GoF) for the role-allowlist policy + Adapter
|
|
20
42
|
* (matches `PermissionChecker` interface so it composes with
|
|
21
43
|
* existing v2.4 Agent constructor).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PermissionPolicy.js","sourceRoot":"","sources":["../../../src/security/PermissionPolicy.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"PermissionPolicy.js","sourceRoot":"","sources":["../../../src/security/PermissionPolicy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AASH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD;;6CAE6C;AAC7C,MAAM,iBAAiB,GAA8B;IACnD,aAAa;IACb,cAAc;IACd,cAAc;IACd,WAAW;CACZ,CAAC;AAyEF;;;;GAIG;AACH,MAAM,OAAO,gBAAgB;IAaU;IAZ5B,IA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AI,KAAK;QACP,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IAED,0DAA0D;IAC1D,cAAc;QACZ,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC5D,CAAC;CACF"}
|
package/dist/events/registry.js
CHANGED
|
@@ -128,6 +128,7 @@ exports.EVENT_NAMES = {
|
|
|
128
128
|
retried: 'agentfootprint.error.retried',
|
|
129
129
|
recovered: 'agentfootprint.error.recovered',
|
|
130
130
|
fatal: 'agentfootprint.error.fatal',
|
|
131
|
+
circuitChanged: 'agentfootprint.error.circuit_changed',
|
|
131
132
|
},
|
|
132
133
|
reliability: {
|
|
133
134
|
failFast: 'agentfootprint.reliability.fail_fast',
|
|
@@ -238,6 +239,7 @@ exports.ALL_EVENT_TYPES = [
|
|
|
238
239
|
'agentfootprint.error.retried',
|
|
239
240
|
'agentfootprint.error.recovered',
|
|
240
241
|
'agentfootprint.error.fatal',
|
|
242
|
+
'agentfootprint.error.circuit_changed',
|
|
241
243
|
'agentfootprint.reliability.fail_fast',
|
|
242
244
|
'agentfootprint.reliability.retried',
|
|
243
245
|
'agentfootprint.reliability.recovered',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/events/registry.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/events/registry.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAkGH,yEAAyE;AACzE,gEAAgE;AAChE,wEAAwE;AAC3D,QAAA,WAAW,GAAG;IACzB,WAAW,EAAE;QACX,KAAK,EAAE,kCAAkC;QACzC,IAAI,EAAE,iCAAiC;QACvC,SAAS,EA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gC;IAChC,kCAAkC;IAClC,+BAA+B;IAC/B,yCAAyC;IACzC,qCAAqC;IACrC,kCAAkC;IAClC,oCAAoC;IACpC,mCAAmC;IACnC,uCAAuC;IACvC,gCAAgC;IAChC,iCAAiC;IACjC,uCAAuC;IACvC,uCAAuC;IACvC,gCAAgC;IAChC,qCAAqC;IACrC,oCAAoC;IACpC,kDAAkD;IAClD,kCAAkC;IAClC,6BAA6B;IAC7B,mCAAmC;IACnC,0BAA0B;IAC1B,+BAA+B;IAC/B,2BAA2B;IAC3B,uCAAuC;IACvC,8BAA8B;IAC9B,gCAAgC;IAChC,4BAA4B;IAC5B,sCAAsC;IACtC,sCAAsC;IACtC,oCAAoC;IACpC,sCAAsC;IACtC,8BAA8B;IAC9B,6BAA6B;IAC7B,gCAAgC;IAChC,iCAAiC;IACjC,oCAAoC;IACpC,oCAAoC;IACpC,iCAAiC;IACjC,mCAAmC;IACnC,kCAAkC;IAClC,kCAAkC;IAClC,oCAAoC;CAC5B,CAAC"}
|
|
@@ -13,6 +13,31 @@
|
|
|
13
13
|
* and cost events every run already emits). This module is the join, plus the
|
|
14
14
|
* seam where an operator's own rule goes.
|
|
15
15
|
*
|
|
16
|
+
* **Status, split rather than averaged, because the two halves were not earned
|
|
17
|
+
* equally:**
|
|
18
|
+
*
|
|
19
|
+
* • **The `admission: { decide }` seam is field-validated — an independent
|
|
20
|
+
* field trial, 2026-08-13.** Running against a real hosted door (a live
|
|
21
|
+
* `nodeHost` in a live Google Cloud project, sessions in a real Firestore),
|
|
22
|
+
* the trial had one caller's first two turns run and the third answer **429
|
|
23
|
+
* before the provider or the session store was invoked** — the
|
|
24
|
+
* cheapest-refusal claim, measured rather than asserted.
|
|
25
|
+
*
|
|
26
|
+
* • **`turnsPerHour` itself is contract-shaped and tested.** The finding
|
|
27
|
+
* records the refusal and restates this helper's per-process bound; it does
|
|
28
|
+
* not record the shipped helper as the policy under test, and a run of a few
|
|
29
|
+
* minutes cannot have crossed an HOUR boundary in any case. So the window's
|
|
30
|
+
* own arithmetic — the roll-off, the reset a caller is told about — is
|
|
31
|
+
* proven here by tests and not by a field run.
|
|
32
|
+
*
|
|
33
|
+
* The honest bound the trial restated is the one already on {@link RecentSpend}:
|
|
34
|
+
* `turnsPerHour` is an in-process reference policy, its counters are not shared
|
|
35
|
+
* across instances and do not survive a restart, so a fleet-wide or billing
|
|
36
|
+
* control needs a `decide` that reads a transactional store of your own.
|
|
37
|
+
*
|
|
38
|
+
* The refusal itself is invisible to `auditExport()` — it happens before a run
|
|
39
|
+
* exists. `standingAgent({ onIngressDecision })` is where it lands instead.
|
|
40
|
+
*
|
|
16
41
|
* ── One decision, three answers, no fourth ───────────────────────────────────
|
|
17
42
|
* `'allow'` · `{ queue: true }` · `{ refuse: '<sentence>' }`. Deliberately not
|
|
18
43
|
* "delay by N ms" (a sleep is a thread the caller is paying for), not "degrade
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admission.js","sourceRoot":"","sources":["../../src/hosting/admission.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"admission.js","sourceRoot":"","sources":["../../src/hosting/admission.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;;;AA0FH,gEAAgE;AAChE,MAAM,OAAO,GAAG,SAAS,CAAC;AAE1B;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,YAAY,CAAC,OAA4B;IACvD,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAC1B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,SAAS,CACjB,mCAAmC,MAAM,CAAC,KAAK,CAAC,uCAAuC;YACrF,uFAAuF;YACvF,gFAAgF,CACnF,CAAC;IACJ,CAAC;IACD,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IA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GAAG,KAAK,CAAC;YACnB,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;gBAC5B,WAAW,IAAI,KAAK,CAAC,WAAW,CAAC;gBACjC,YAAY,IAAI,KAAK,CAAC,YAAY,CAAC;gBACnC,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC;gBACjB,MAAM,KAAK,KAAK,CAAC,MAAM,CAAC;YAC1B,CAAC;YACD,OAAO;gBACL,KAAK,EAAE,OAAO,CAAC,MAAM;gBACrB,WAAW;gBACX,YAAY;gBACZ,uEAAuE;gBACvE,GAAG,CAAC,MAAM,IAAI,EAAE,GAAG,EAAE,CAAC;gBACtB,QAAQ;gBACR,QAAQ,EAAE,EAAE,GAAG,SAAS,IAAI,QAAQ;aACrC,CAAC;QACJ,CAAC;QACD,IAAI,IAAI;YACN,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC;AAvFD,kCAuFC;AAED;;;;;;;;GAQG;AACH,SAAgB,WAAW,CAAC,QAAsC;IAChE,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,QAAQ,CAAC,MAAM,EAAE,CAAC;AAC3E,CAAC;AAFD,kCAEC"}
|
package/dist/hosting/envelope.js
CHANGED
|
@@ -173,6 +173,16 @@ exports.checkEnvelope = checkEnvelope;
|
|
|
173
173
|
* session nobody signed for is a session nobody can list, and inventing an
|
|
174
174
|
* owner would be inventing an entitlement.
|
|
175
175
|
*
|
|
176
|
+
* **Status: the CONTRACT is field-validated — an independent field trial,
|
|
177
|
+
* 2026-08-13.** A live multi-user run against a real Firestore: an owner
|
|
178
|
+
* written once and never moved, a cross-user transcript answering the same
|
|
179
|
+
* not-found a missing session gets, one caller's own two sessions listed over
|
|
180
|
+
* two pages, `listByUser` / `ownerOf` feature detection, and `mayOpenSession`
|
|
181
|
+
* refusing an ordinary turn on somebody else's conversation. The store
|
|
182
|
+
* underneath was **the trial's own Firestore `SessionLifecycle`**, not one this
|
|
183
|
+
* package ships — so the rung belongs to this derivation and the rules above
|
|
184
|
+
* it, and no shipped Google adapter may borrow the credit.
|
|
185
|
+
*
|
|
176
186
|
* Reads both formats, so a session that is mid-question is owned exactly as
|
|
177
187
|
* firmly as one that is finished. Returns `undefined` rather than throwing on
|
|
178
188
|
* a shape it cannot read — an index is a convenience, and refusing to WRITE a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envelope.js","sourceRoot":"","sources":["../../src/hosting/envelope.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;;;AAEH,2CAAsD;AACtD,+DAAuF;AASvF,+DAA+D;AAC/D,MAAM,aAAa,GAAsB,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAC;AAE7E;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,UAA8B;IACvD,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;AAC9E,CAAC;AAFD,gCAEC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,gBAAgB,CAAC,MAAiB;IAChD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;AACvE,CAAC;AAFD,4CAEC;AAED;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,YAAY,CAAC,QAAiB;IAC5C,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,cAAc,EAAE,CAAC;QAC5C,MAAM,IAAI,SAAS,CACjB,mFAAmF;YACjF,mFAAmF;YACnF,kFAAkF;YAClF,uDAAuD,CAC1D,CAAC;IACJ,CAAC;IACD,OAAO,IAAA,qCAAkB,EAAE,QAAiC,CAAC,IAAI,CAAC,CAAC;AACrE,CAAC;AAVD,oC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,uBAAuB,OAAA;AACvB,qHAAA,wBAAwB,OAAA;AACxB,qHAAA,wBAAwB,OAAA;AACxB,kHAAA,qBAAqB,OAAA;AACrB,wHAAA,2BAA2B,OAAA;AAC3B,yHAAA,4BAA4B,OAAA;AAC5B,iHAAA,oBAAoB,OAAA;AACpB,oHAAA,uBAAuB,OAAA;AAIzB,2EAA2E;AAC3E,iEAAiE;AACjE,8EAA8E;AAC9E,yDAAyD;AACzD,qEAA+E;AAAtE,sHAAA,WAAW,OAAA;AAAE,gIAAA,qBAAqB,OAAA;AAO3C,+EAA+E;AAC/E,uEAAuE;AACvE,2DAA2D;AAC3D,+CAAwE;AAA/D,2GAAA,WAAW,OAAA;AAAE,2GAAA,WAAW,OAAA;AAAE,4GAAA,YAAY,OAAA;AAuB/C,+EAA+E;AAC/E,yEAAyE;AACzE,qBAAqB;AACrB,mDAK0B;AAJxB,mHAAA,iBAAiB,OAAA;AACjB,iHAAA,eAAe,OAAA;AACf,iHAAA,eAAe,OAAA;AACf,uHAAA,qBAAqB,OAAA;AAQvB,2CAAqF;AAA5E,0GAAA,YAAY,OAAA;AAAE,sGAAA,QAAQ,OAAA;AAAE,iHAAA,mBAAmB,OAAA;AAAE,sGAAA,QAAQ,OAAA;AAG9D,8EAA8E;AAC9E,6EAA6E;AAC7E,yEAAyE;AACzE,0EAA0E;AAC1E,2EAA2E;AAC3E,2BAA2B;AAC3B,qDAK2B;AAJzB,qHAAA,kBAAkB,OAAA;AAClB,mHAAA,gBAAgB,OAAA;AAChB,mHAAA,gBAAgB,OAAA;AAChB,kHAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* hosting/ingressRecord — what the door decided, for the requests that never
|
|
4
|
+
* became a run.
|
|
5
|
+
*
|
|
6
|
+
* await standingAgent({
|
|
7
|
+
* agent, sessions, host,
|
|
8
|
+
* identity: { verify },
|
|
9
|
+
* admission: turnsPerHour({ limit: 60 }),
|
|
10
|
+
* onIngressDecision: (record) => myAuditSink.write(record),
|
|
11
|
+
* });
|
|
12
|
+
*
|
|
13
|
+
* ── The gap this closes, named exactly ───────────────────────────────────────
|
|
14
|
+
* `auditExport()` is a record of RUNS. A 401 out of `identity.verify` and a 429
|
|
15
|
+
* out of `admission.decide` both happen before a run exists — no agent has been
|
|
16
|
+
* built, no observer is attached, no typed event is emitted — so neither is in
|
|
17
|
+
* the bundle. Two independent review rounds wrote that down as the same finding,
|
|
18
|
+
* and the honest consequence is the sharp one: **an empty bundle is not evidence
|
|
19
|
+
* that nobody was turned away.** It is evidence that nobody ran.
|
|
20
|
+
*
|
|
21
|
+
* This is the seam where the turned-away go. One record per request the composer
|
|
22
|
+
* decided, handed to a sink you own, at the moment the reply reaches its
|
|
23
|
+
* terminal.
|
|
24
|
+
*
|
|
25
|
+
* ── What it is NOT, said before anything else ────────────────────────────────
|
|
26
|
+
* **It does not join the audit hash chain.** Nothing here is hashed, chained,
|
|
27
|
+
* sequenced against `auditExport()`'s records, or verifiable by
|
|
28
|
+
* `verifyAuditBundle`. It is a STREAM you chain into your own sink. Saying
|
|
29
|
+
* otherwise would make this fix the exact failure it exists to close — a
|
|
30
|
+
* mechanism that looks like evidence and is not. If you need ingress decisions
|
|
31
|
+
* inside a tamper-evident chain, write them into the same store your audit
|
|
32
|
+
* bundle lands in and chain them there, where the sequence is yours to define.
|
|
33
|
+
*
|
|
34
|
+
* ── Secrets never travel ─────────────────────────────────────────────────────
|
|
35
|
+
* A record carries the CLASS of what happened and the identifiers the caller
|
|
36
|
+
* already knew. Never the bearer token, never a header, never a claim set,
|
|
37
|
+
* never an error's message — the `sdkFailure` law, applied to the front door.
|
|
38
|
+
* `errorName` and `errorCode` are this package's own vocabulary; a message may
|
|
39
|
+
* carry an SDK's text, an operator's sentence or a store's detail, so no message
|
|
40
|
+
* is copied. The one identity field is `userId`, and it is the id the token
|
|
41
|
+
* PROVED — never one a request merely claimed.
|
|
42
|
+
*
|
|
43
|
+
* ── What the composer can decide, and what it never sees ─────────────────────
|
|
44
|
+
* Every ingress exit of `standingAgent` funnels through one reply terminal, so
|
|
45
|
+
* all of these land here — including the ones a consumer's own `verify` and
|
|
46
|
+
* `decide` never observe:
|
|
47
|
+
*
|
|
48
|
+
* - a request with no `Authorization: Bearer …` at all (`verify` is never
|
|
49
|
+
* called, so nothing you wrote could have logged it);
|
|
50
|
+
* - a verifier that could not answer (503) as distinct from a bad credential;
|
|
51
|
+
* - an admission refusal, and also an admission ALLOW — the census is what
|
|
52
|
+
* makes an absence readable;
|
|
53
|
+
* - a turn or a transcript naming somebody else's session (the 404 that is
|
|
54
|
+
* deliberately indistinguishable from "no such session");
|
|
55
|
+
* - a session op at a door with no verifier, a store with no owner index, a
|
|
56
|
+
* concurrent-run refusal, an artifact ref that did not resolve;
|
|
57
|
+
* - and a request that was SERVED.
|
|
58
|
+
*
|
|
59
|
+
* What it does not carry, stated rather than implied: a body the TRANSPORT
|
|
60
|
+
* refused before the composer ever saw it — unparseable JSON, or an `op` this
|
|
61
|
+
* host's wire grammar does not speak (`InvalidWireOpError`, answered 400 by
|
|
62
|
+
* `httpHost` inside its own request reader). That is a malformed request rather
|
|
63
|
+
* than a decision about a caller, and the composer does not claim it. Your HTTP
|
|
64
|
+
* access log has it.
|
|
65
|
+
*
|
|
66
|
+
* Pattern: Observer at a composition boundary. Zero-cost when unset — with no
|
|
67
|
+
* sink configured nothing is built, nothing is wrapped, and the reply object the
|
|
68
|
+
* handler uses is the host's own, to the byte.
|
|
69
|
+
*/
|
|
70
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
71
|
+
exports.beginIngress = void 0;
|
|
72
|
+
const identityVerification_js_1 = require("./identityVerification.js");
|
|
73
|
+
const errors_js_1 = require("./errors.js");
|
|
74
|
+
const artifactWire_js_1 = require("./artifactWire.js");
|
|
75
|
+
const sessionWire_js_1 = require("./sessionWire.js");
|
|
76
|
+
/**
|
|
77
|
+
* Classify one refusal into the record's vocabulary.
|
|
78
|
+
*
|
|
79
|
+
* The order is deliberate: the classes this package authored are matched by
|
|
80
|
+
* `instanceof` first, so a door refusal never reads as a generic failure, and
|
|
81
|
+
* anything else keeps only its class NAME. No message is read, from any error,
|
|
82
|
+
* ever.
|
|
83
|
+
*/
|
|
84
|
+
function classify(err) {
|
|
85
|
+
if (err instanceof errors_js_1.IdentityNotVerifiedError) {
|
|
86
|
+
return {
|
|
87
|
+
outcome: 'identity-refused',
|
|
88
|
+
errorCode: err.code,
|
|
89
|
+
errorName: err.name,
|
|
90
|
+
identityFailure: err.failure,
|
|
91
|
+
claimedUser: err.claimedUser,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
if (err instanceof errors_js_1.VerifierUnavailableError) {
|
|
95
|
+
return { outcome: 'verifier-unavailable', errorCode: err.code, errorName: err.name };
|
|
96
|
+
}
|
|
97
|
+
if (err instanceof errors_js_1.AdmissionRefusedError) {
|
|
98
|
+
return { outcome: 'admission-refused', errorCode: err.code, errorName: err.name };
|
|
99
|
+
}
|
|
100
|
+
if (err instanceof errors_js_1.SessionNotFoundError) {
|
|
101
|
+
return { outcome: 'session-refused', errorCode: err.code, errorName: err.name };
|
|
102
|
+
}
|
|
103
|
+
const code = err?.code;
|
|
104
|
+
const name = err?.name;
|
|
105
|
+
// A hosting refusal names itself with an `ERR_…` code. Anything else is a
|
|
106
|
+
// failure rather than a decision — and either way only the class travels.
|
|
107
|
+
const hasHostingCode = typeof code === 'string' && code.startsWith('ERR_');
|
|
108
|
+
return {
|
|
109
|
+
outcome: hasHostingCode ? 'refused' : 'failed',
|
|
110
|
+
...(typeof code === 'string' && { errorCode: code }),
|
|
111
|
+
...(typeof name === 'string' && { errorName: name }),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/** Which op name a request named, in the spelling a body uses. */
|
|
115
|
+
function opOf(request) {
|
|
116
|
+
if (request.session !== undefined) {
|
|
117
|
+
return request.session.op === 'list' ? sessionWire_js_1.SESSION_LIST_OP : sessionWire_js_1.SESSION_TRANSCRIPT_OP;
|
|
118
|
+
}
|
|
119
|
+
if (request.artifact !== undefined) {
|
|
120
|
+
return request.artifact.op === 'head' ? artifactWire_js_1.ARTIFACT_HEAD_OP : artifactWire_js_1.ARTIFACT_GET_OP;
|
|
121
|
+
}
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
/** Which door a request knocked at — the same discriminants the handler uses. */
|
|
125
|
+
function doorOf(request) {
|
|
126
|
+
if (request.session !== undefined)
|
|
127
|
+
return 'session-op';
|
|
128
|
+
if (request.artifact !== undefined)
|
|
129
|
+
return 'artifact';
|
|
130
|
+
return 'turn';
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Which conversation this request named. A `session-transcript` names it inside
|
|
134
|
+
* the op rather than beside it, and a record that missed that would be blind to
|
|
135
|
+
* exactly the refusal the ownership rule produces.
|
|
136
|
+
*/
|
|
137
|
+
function sessionOf(request) {
|
|
138
|
+
if (request.session !== undefined && request.session.op === 'transcript') {
|
|
139
|
+
return request.session.sessionId;
|
|
140
|
+
}
|
|
141
|
+
return request.sessionId;
|
|
142
|
+
}
|
|
143
|
+
let warnedOnce = false;
|
|
144
|
+
/** Report a throwing sink once. A broken record is a fault worth naming; a
|
|
145
|
+
* fault reported on every request is a second outage. */
|
|
146
|
+
function warnSink(err) {
|
|
147
|
+
if (warnedOnce)
|
|
148
|
+
return;
|
|
149
|
+
warnedOnce = true;
|
|
150
|
+
// eslint-disable-next-line no-console
|
|
151
|
+
console.warn(`[hosting] the onIngressDecision sink threw and the record was dropped. The request was ` +
|
|
152
|
+
`unaffected — a broken log must not turn a served request into a failed one — but this ` +
|
|
153
|
+
`door's ingress decisions are not being recorded. Reported once per process. Cause: ` +
|
|
154
|
+
`${err?.name ?? 'unknown'}`);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Begin one request's ingress record.
|
|
158
|
+
*
|
|
159
|
+
* @internal — the option is public, this bookkeeping is not.
|
|
160
|
+
*/
|
|
161
|
+
function beginIngress(request, sink) {
|
|
162
|
+
const door = doorOf(request);
|
|
163
|
+
const op = opOf(request);
|
|
164
|
+
const sessionId = sessionOf(request);
|
|
165
|
+
// Presence, never the value: the whole point of the class vocabulary above is
|
|
166
|
+
// that an operator can act without a single character of the credential.
|
|
167
|
+
const bearerPresent = (0, identityVerification_js_1.bearerToken)(request.headers) !== undefined;
|
|
168
|
+
let userId;
|
|
169
|
+
let admission;
|
|
170
|
+
let filed = false;
|
|
171
|
+
function file(outcome, err) {
|
|
172
|
+
if (filed)
|
|
173
|
+
return;
|
|
174
|
+
filed = true;
|
|
175
|
+
const detail = err === undefined ? undefined : classify(err);
|
|
176
|
+
const record = {
|
|
177
|
+
at: Date.now(),
|
|
178
|
+
door,
|
|
179
|
+
...(op !== undefined && { op }),
|
|
180
|
+
outcome: detail?.outcome ?? outcome,
|
|
181
|
+
...(detail?.errorCode !== undefined && { errorCode: detail.errorCode }),
|
|
182
|
+
...(detail?.errorName !== undefined && { errorName: detail.errorName }),
|
|
183
|
+
...(detail?.identityFailure !== undefined && { identityFailure: detail.identityFailure }),
|
|
184
|
+
...(detail?.claimedUser !== undefined && { claimedUser: detail.claimedUser }),
|
|
185
|
+
...(userId !== undefined && { userId }),
|
|
186
|
+
...(sessionId !== undefined && { sessionId }),
|
|
187
|
+
bearerPresent,
|
|
188
|
+
...(admission !== undefined && { admission }),
|
|
189
|
+
};
|
|
190
|
+
try {
|
|
191
|
+
sink(record);
|
|
192
|
+
}
|
|
193
|
+
catch (sinkErr) {
|
|
194
|
+
warnSink(sinkErr);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
watch(reply) {
|
|
199
|
+
// Every optional terminal is forwarded ONLY when the host has it: the
|
|
200
|
+
// composer feature-detects `awaiting`/`artifact`/`sessions`, so a wrapper
|
|
201
|
+
// that defined them unconditionally would tell it the host can describe a
|
|
202
|
+
// pause it cannot, and the named refusal for that case would never fire.
|
|
203
|
+
return {
|
|
204
|
+
complete(output) {
|
|
205
|
+
file('served');
|
|
206
|
+
reply.complete(output);
|
|
207
|
+
},
|
|
208
|
+
fail(error) {
|
|
209
|
+
file('failed', error);
|
|
210
|
+
reply.fail(error);
|
|
211
|
+
},
|
|
212
|
+
...(reply.awaiting && {
|
|
213
|
+
awaiting: (pending) => {
|
|
214
|
+
file('served');
|
|
215
|
+
reply.awaiting?.(pending);
|
|
216
|
+
},
|
|
217
|
+
}),
|
|
218
|
+
...(reply.artifact && {
|
|
219
|
+
artifact: (result) => {
|
|
220
|
+
file('served');
|
|
221
|
+
reply.artifact?.(result);
|
|
222
|
+
},
|
|
223
|
+
}),
|
|
224
|
+
...(reply.sessions && {
|
|
225
|
+
sessions: (result) => {
|
|
226
|
+
file('served');
|
|
227
|
+
reply.sessions?.(result);
|
|
228
|
+
},
|
|
229
|
+
}),
|
|
230
|
+
// Not a terminal: a chunk is part of an answer still being written.
|
|
231
|
+
...(reply.emit && { emit: (chunk) => reply.emit?.(chunk) }),
|
|
232
|
+
};
|
|
233
|
+
},
|
|
234
|
+
identified(verified) {
|
|
235
|
+
if (verified !== undefined)
|
|
236
|
+
userId = verified.userId;
|
|
237
|
+
},
|
|
238
|
+
admitted(verdict) {
|
|
239
|
+
admission = verdict;
|
|
240
|
+
},
|
|
241
|
+
settle() {
|
|
242
|
+
// Only reachable if a request left the door without ending its reply,
|
|
243
|
+
// which the composer never does. Recorded as a failure rather than
|
|
244
|
+
// silently dropped: a census with holes is the thing this replaces.
|
|
245
|
+
file('failed');
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
exports.beginIngress = beginIngress;
|
|
250
|
+
//# sourceMappingURL=ingressRecord.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ingressRecord.js","sourceRoot":"","sources":["../../src/hosting/ingressRecord.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAC,MAAM,EAAE,EAAE;wBACnB,IAAI,CAAC,QAAQ,CAAC,CAAC;wBACf,KAAK,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAC;oBAC3B,CAAC;iBACF,CAAC;gBACF,GAAG,CAAC,KAAK,CAAC,QAAQ,IAAI;oBACpB,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE;wBACnB,IAAI,CAAC,QAAQ,CAAC,CAAC;wBACf,KAAK,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAC;oBAC3B,CAAC;iBACF,CAAC;gBACF,oEAAoE;gBACpE,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;aACpE,CAAC;QACJ,CAAC;QACD,UAAU,CAAC,QAAsC;YAC/C,IAAI,QAAQ,KAAK,SAAS;gBAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;QACvD,CAAC;QACD,QAAQ,CAAC,OAAgC;YACvC,SAAS,GAAG,OAAO,CAAC;QACtB,CAAC;QACD,MAAM;YACJ,sEAAsE;YACtE,mEAAmE;YACnE,oEAAoE;YACpE,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC;AAtFD,oCAsFC"}
|
|
@@ -108,6 +108,7 @@ const envelope_js_1 = require("./envelope.js");
|
|
|
108
108
|
const errors_js_1 = require("./errors.js");
|
|
109
109
|
const identityVerification_js_1 = require("./identityVerification.js");
|
|
110
110
|
const admission_js_1 = require("./admission.js");
|
|
111
|
+
const ingressRecord_js_1 = require("./ingressRecord.js");
|
|
111
112
|
const sessionWire_js_1 = require("./sessionWire.js");
|
|
112
113
|
const types_js_1 = require("./types.js");
|
|
113
114
|
/**
|
|
@@ -167,6 +168,13 @@ async function standingAgent(options) {
|
|
|
167
168
|
* server's whole traffic would be a cost nobody asked for.
|
|
168
169
|
*/
|
|
169
170
|
const ledger = admission !== undefined ? (0, admission_js_1.spendLedger)() : undefined;
|
|
171
|
+
/**
|
|
172
|
+
* Where ingress decisions go (9.32.0), or `undefined` — the zero-delta path.
|
|
173
|
+
* With no sink nothing is wrapped and the handler uses the host's own reply
|
|
174
|
+
* object, which is what makes this option free for everyone who never asks
|
|
175
|
+
* for it.
|
|
176
|
+
*/
|
|
177
|
+
const ingressSink = options.onIngressDecision;
|
|
170
178
|
// ── Refused at construction, before a socket exists ──────────────────
|
|
171
179
|
//
|
|
172
180
|
// Two spellings of one decision, and nothing could make the winner visible
|
|
@@ -464,7 +472,17 @@ async function standingAgent(options) {
|
|
|
464
472
|
lane.chain = mine.then(() => undefined, () => undefined);
|
|
465
473
|
return mine;
|
|
466
474
|
}
|
|
467
|
-
|
|
475
|
+
/**
|
|
476
|
+
* The composer's whole request path — with the reply it is handed already
|
|
477
|
+
* wrapped, when an ingress record is being kept.
|
|
478
|
+
*
|
|
479
|
+
* Split out from {@link handler} for exactly one reason: the record's funnel
|
|
480
|
+
* has to be ONE place. Every exit below ends at a reply terminal, so wrapping
|
|
481
|
+
* the reply once above this function covers all of them — a refusal added
|
|
482
|
+
* later cannot forget to report, because reporting is not something any exit
|
|
483
|
+
* does.
|
|
484
|
+
*/
|
|
485
|
+
const answerRequest = async (request, reply, note) => {
|
|
468
486
|
// ── The badge, before anything else ───────────────────────────────
|
|
469
487
|
// FIRST, and once — so a turn, a claim-ticket redemption and a session
|
|
470
488
|
// read all inherit one answer to "who is this", and a door added later
|
|
@@ -479,6 +497,10 @@ async function standingAgent(options) {
|
|
|
479
497
|
reply.fail(err instanceof Error ? err : new Error(String(err)));
|
|
480
498
|
return;
|
|
481
499
|
}
|
|
500
|
+
// The PROVEN id, on the record — never the claimed one, which is the whole
|
|
501
|
+
// distinction the verifier exists to draw. Nothing is recorded when nobody
|
|
502
|
+
// was proven; absent and "anonymous" are the same fact here.
|
|
503
|
+
note?.identified(verified);
|
|
482
504
|
// The user id that reaches every downstream composition. With a verifier
|
|
483
505
|
// it is the one the TOKEN proved (the request's own claim was already
|
|
484
506
|
// reconciled or refused); without one it is exactly what the transport
|
|
@@ -533,10 +555,15 @@ async function standingAgent(options) {
|
|
|
533
555
|
recentSpend: ledger.read(spendKey),
|
|
534
556
|
});
|
|
535
557
|
if (typeof verdict === 'object' && verdict !== null && 'refuse' in verdict) {
|
|
558
|
+
note?.admitted('refuse');
|
|
536
559
|
reply.fail(new errors_js_1.AdmissionRefusedError(verdict.refuse, userId));
|
|
537
560
|
return;
|
|
538
561
|
}
|
|
539
562
|
queueAnyway = typeof verdict === 'object' && verdict !== null && 'queue' in verdict;
|
|
563
|
+
// An ALLOW is recorded too. A stream of refusals alone cannot answer
|
|
564
|
+
// "was anybody turned away?" — only a census can, which is the same
|
|
565
|
+
// reason an empty audit bundle is not evidence of an empty door.
|
|
566
|
+
note?.admitted(queueAnyway ? 'queue' : 'allow');
|
|
540
567
|
// Counted at ADMISSION, not at completion: a turn that is running has
|
|
541
568
|
// been spent whether or not it ever answers, and counting on the way
|
|
542
569
|
// out would let a caller hold N runs open under a limit of one.
|
|
@@ -556,6 +583,28 @@ async function standingAgent(options) {
|
|
|
556
583
|
reply.fail(err instanceof Error ? err : new Error(String(err)));
|
|
557
584
|
}
|
|
558
585
|
};
|
|
586
|
+
/**
|
|
587
|
+
* What the host calls — {@link answerRequest} with the ingress record's one
|
|
588
|
+
* funnel around it (9.32.0).
|
|
589
|
+
*
|
|
590
|
+
* With no sink configured this is the identity function over the host's own
|
|
591
|
+
* reply: no wrapper object, no bookkeeping, no branch inside any exit path.
|
|
592
|
+
*
|
|
593
|
+
* `settle()` covers the one case a terminal cannot: a request that leaves
|
|
594
|
+
* without ending its reply at all. The composer never does that, and the
|
|
595
|
+
* `finally` is there because "never" is a claim about today's code rather
|
|
596
|
+
* than a guarantee — a census with a hole in it is what this replaces.
|
|
597
|
+
*/
|
|
598
|
+
const handler = async (request, hostReply) => {
|
|
599
|
+
const note = ingressSink === undefined ? undefined : (0, ingressRecord_js_1.beginIngress)(request, ingressSink);
|
|
600
|
+
const reply = note === undefined ? hostReply : note.watch(hostReply);
|
|
601
|
+
try {
|
|
602
|
+
await answerRequest(request, reply, note);
|
|
603
|
+
}
|
|
604
|
+
finally {
|
|
605
|
+
note?.settle();
|
|
606
|
+
}
|
|
607
|
+
};
|
|
559
608
|
/**
|
|
560
609
|
* Answer "which conversations are mine?" and "what did we say?" — the two
|
|
561
610
|
* session-history ops (9.26.0).
|