@fabric-harness/sdk 6.2.0 → 6.3.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/NOTICE +1 -1
- package/README.md +9 -9
- package/connector-spec/channel.md +2 -2
- package/connector-spec/sandbox.md +1 -1
- package/connector-spec/tooling.md +1 -1
- package/connector-spec/voice-telephony.md +1 -1
- package/dist/action.d.ts +2 -2
- package/dist/action.js +1 -1
- package/dist/ai-gateway.d.ts +1 -1
- package/dist/ai-gateway.js +1 -1
- package/dist/attachment-store.d.ts +3 -3
- package/dist/attachment-store.js +2 -2
- package/dist/channel.d.ts +3 -3
- package/dist/channel.js +2 -2
- package/dist/conversation-projection.d.ts +2 -2
- package/dist/conversation-projection.js +2 -2
- package/dist/conversation-stream.d.ts +5 -5
- package/dist/conversation-stream.js +1 -1
- package/dist/cost-budget.d.ts +3 -3
- package/dist/cost-budget.js +1 -1
- package/dist/delivered-message.d.ts +3 -3
- package/dist/error.js +2 -2
- package/dist/error.js.map +1 -1
- package/dist/events.d.ts +1 -1
- package/dist/events.js +1 -1
- package/dist/filesystem-source.d.ts +3 -3
- package/dist/filesystem-source.js +1 -1
- package/dist/governed-voice.d.ts +55 -0
- package/dist/governed-voice.d.ts.map +1 -0
- package/dist/governed-voice.js +357 -0
- package/dist/governed-voice.js.map +1 -0
- package/dist/history.d.ts +3 -3
- package/dist/history.js +3 -3
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/langfuse.d.ts +2 -2
- package/dist/mcp.d.ts +1 -0
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +2 -0
- package/dist/mcp.js.map +1 -1
- package/dist/model-pricing.d.ts +7 -4
- package/dist/model-pricing.d.ts.map +1 -1
- package/dist/model-pricing.js +8 -7
- package/dist/model-pricing.js.map +1 -1
- package/dist/model.d.ts +3 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +3 -1
- package/dist/model.js.map +1 -1
- package/dist/persistent-agent.d.ts +1 -1
- package/dist/policy.d.ts +1 -1
- package/dist/rate-limiter.d.ts +2 -2
- package/dist/rate-limiter.js +2 -2
- package/dist/retrieval.d.ts +1 -1
- package/dist/sandbox-ref.d.ts +2 -2
- package/dist/sandbox.js +1 -1
- package/dist/sandbox.js.map +1 -1
- package/dist/session-memory.d.ts +4 -3
- package/dist/session-memory.d.ts.map +1 -1
- package/dist/session-memory.js +4 -3
- package/dist/session-memory.js.map +1 -1
- package/dist/session.d.ts +3 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +36 -5
- package/dist/session.js.map +1 -1
- package/dist/skill-definition.d.ts +1 -1
- package/dist/skill-definition.js +1 -1
- package/dist/store.d.ts +1 -1
- package/dist/store.js +1 -1
- package/dist/strict.d.ts +3 -0
- package/dist/strict.d.ts.map +1 -1
- package/dist/strict.js +2 -0
- package/dist/strict.js.map +1 -1
- package/dist/submission-runner.d.ts +1 -1
- package/dist/submission-runner.d.ts.map +1 -1
- package/dist/submission-runner.js +15 -1
- package/dist/submission-runner.js.map +1 -1
- package/dist/submission-state.d.ts +3 -3
- package/dist/submission-state.js +3 -3
- package/dist/submission-store.d.ts +4 -4
- package/dist/submission-store.js +2 -2
- package/dist/tool-execution.d.ts +11 -0
- package/dist/tool-execution.d.ts.map +1 -0
- package/dist/tool-execution.js +36 -0
- package/dist/tool-execution.js.map +1 -0
- package/dist/tools.d.ts +6 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +5 -0
- package/dist/tools.js.map +1 -1
- package/dist/types.d.ts +3 -3
- package/dist/vercel-ai-gateway.d.ts +4 -4
- package/dist/vercel-ai-gateway.js +4 -4
- package/dist/voice-openai-realtime.d.ts +2 -2
- package/dist/voice-openai-realtime.d.ts.map +1 -1
- package/dist/voice-openai-realtime.js +48 -41
- package/dist/voice-openai-realtime.js.map +1 -1
- package/dist/voice-pipeline.d.ts +3 -0
- package/dist/voice-pipeline.d.ts.map +1 -1
- package/dist/voice-pipeline.js +71 -23
- package/dist/voice-pipeline.js.map +1 -1
- package/dist/voice-stt-cartesia.d.ts +1 -0
- package/dist/voice-stt-cartesia.d.ts.map +1 -1
- package/dist/voice-stt-cartesia.js +8 -1
- package/dist/voice-stt-cartesia.js.map +1 -1
- package/dist/voice-stt-deepgram.d.ts +1 -0
- package/dist/voice-stt-deepgram.d.ts.map +1 -1
- package/dist/voice-stt-deepgram.js +8 -1
- package/dist/voice-stt-deepgram.js.map +1 -1
- package/dist/voice-stt.d.ts +2 -0
- package/dist/voice-stt.d.ts.map +1 -1
- package/dist/voice-tts-cartesia.d.ts +1 -0
- package/dist/voice-tts-cartesia.d.ts.map +1 -1
- package/dist/voice-tts-cartesia.js +2 -1
- package/dist/voice-tts-cartesia.js.map +1 -1
- package/dist/voice-tts-elevenlabs.d.ts +1 -0
- package/dist/voice-tts-elevenlabs.d.ts.map +1 -1
- package/dist/voice-tts-elevenlabs.js +4 -1
- package/dist/voice-tts-elevenlabs.js.map +1 -1
- package/dist/voice-tts.d.ts +2 -0
- package/dist/voice-tts.d.ts.map +1 -1
- package/dist/voice-ws-client.d.ts +6 -4
- package/dist/voice-ws-client.d.ts.map +1 -1
- package/dist/voice-ws-client.js +11 -6
- package/dist/voice-ws-client.js.map +1 -1
- package/dist/voice-ws-shared.d.ts +10 -3
- package/dist/voice-ws-shared.d.ts.map +1 -1
- package/dist/voice-ws-shared.js +45 -9
- package/dist/voice-ws-shared.js.map +1 -1
- package/dist/voice.d.ts +6 -7
- package/dist/voice.d.ts.map +1 -1
- package/dist/webhook-subscription.d.ts +1 -1
- package/dist/ws-client.d.ts +1 -1
- package/package.json +16 -10
package/NOTICE
CHANGED
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @fabric-harness/sdk
|
|
2
2
|
|
|
3
|
-
> Core SDK for [
|
|
3
|
+
> Core SDK for [TechFabric Harness](https://github.com/Fabric-Pro/fabric-harness) — a headless TypeScript framework for building durable, deployable autonomous agents.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -102,15 +102,15 @@ use direct provider endpoints and never silently fall back to a gateway or mock
|
|
|
102
102
|
|
|
103
103
|
## Documentation
|
|
104
104
|
|
|
105
|
-
- [Headless agents with the minimal entrypoint](https://harness.
|
|
106
|
-
- [SDK entrypoints, runtimes, and targets](https://harness.
|
|
107
|
-
- [Runtime modes](https://harness.
|
|
108
|
-
- [Dynamic agents and hooks](https://harness.
|
|
109
|
-
- [Filesystem sources](https://harness.
|
|
110
|
-
- [Policies and approvals](https://harness.
|
|
111
|
-
- [Telemetry](https://harness.
|
|
105
|
+
- [Headless agents with the minimal entrypoint](https://harness.techfabric.com/docs/getting-started/headless-mode)
|
|
106
|
+
- [SDK entrypoints, runtimes, and targets](https://harness.techfabric.com/docs/reference/sdk-entrypoints-runtimes-targets)
|
|
107
|
+
- [Runtime modes](https://harness.techfabric.com/docs/reference/runtime-modes) — including the direct `temporalSessionRuntime` API.
|
|
108
|
+
- [Dynamic agents and hooks](https://harness.techfabric.com/docs/building/dynamic-agents)
|
|
109
|
+
- [Filesystem sources](https://harness.techfabric.com/docs/reference/filesystem-sources) — `session.mount()` and source connectors.
|
|
110
|
+
- [Policies and approvals](https://harness.techfabric.com/docs/reference/policies-approvals) — capability policy, network policy, mount permissions, custom approvals.
|
|
111
|
+
- [Telemetry](https://harness.techfabric.com/docs/reference/telemetry) — events, transports, metrics.
|
|
112
112
|
- [Roadmap](https://github.com/Fabric-Pro/fabric-harness/blob/main/docs/ROADMAP.md)
|
|
113
|
-
- [Full reference](https://harness.
|
|
113
|
+
- [Full reference](https://harness.techfabric.com/docs)
|
|
114
114
|
|
|
115
115
|
## License
|
|
116
116
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
<!-- Canonical
|
|
1
|
+
<!-- Canonical TechFabric Harness channel connector contract. Shipped with @fabric-harness/sdk. -->
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# TechFabric Harness Channel Connector Spec
|
|
4
4
|
|
|
5
5
|
A channel turns an authenticated provider event into a durable dispatch to a persistent agent. Produce a TypeScript module under `.fabricharness/channels/<provider>.ts` that exports a `Channel` created with `defineChannel()`.
|
|
6
6
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Shipped with @fabric-harness/sdk so it's available offline.
|
|
4
4
|
|
|
5
5
|
Mirrored at the docs site:
|
|
6
|
-
https://harness.
|
|
6
|
+
https://harness.techfabric.com/docs/building/sandbox-connectors
|
|
7
7
|
|
|
8
8
|
Raw GitHub URL (must remain valid):
|
|
9
9
|
https://raw.githubusercontent.com/Fabric-Pro/fabric-harness/main/packages/sdk/connector-spec/sandbox.md
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# TechFabric Harness Tooling Connector Spec
|
|
2
2
|
|
|
3
3
|
A tooling connector observes Fabric events, traces, metrics, or eval results without changing agent behavior. Produce a project-local module that uses public Fabric event, telemetry, or eval APIs.
|
|
4
4
|
|
|
@@ -124,7 +124,7 @@ The OpenAI Realtime server-side VAD detects when the caller starts speaking and
|
|
|
124
124
|
|
|
125
125
|
## Cost
|
|
126
126
|
|
|
127
|
-
Realtime audio is billed per audio token.
|
|
127
|
+
Realtime audio is billed per audio token. TechFabric Harness records `audioInputTokens` /
|
|
128
128
|
`audioOutputTokens` on `usage` and rolls them into `costUsd`. Use `gpt-realtime` as the stable
|
|
129
129
|
general-purpose model or `gpt-realtime-mini` when cost and latency matter more than maximum quality.
|
|
130
130
|
|
package/dist/action.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ declare const actionSymbol: unique symbol;
|
|
|
5
5
|
/**
|
|
6
6
|
* What an action runs against: the harness entry point (`init` can prompt
|
|
7
7
|
* models, spawn sessions, and call tools) plus the platform environment.
|
|
8
|
-
* Jobs, agents, and servers all satisfy this
|
|
8
|
+
* Jobs, agents, and servers all satisfy this. It is the harness slice of
|
|
9
9
|
* `FabricContext`.
|
|
10
10
|
*/
|
|
11
11
|
export interface ActionHost {
|
|
@@ -45,7 +45,7 @@ export declare class ActionError extends Error {
|
|
|
45
45
|
constructor(code: ActionError['code'], action: string, message: string, issues?: SchemaIssue[]);
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
|
-
* Define an action
|
|
48
|
+
* Define an action, the harness-context counterpart to `defineTool`.
|
|
49
49
|
* A tool is a leaf capability the model calls; an action holds the harness
|
|
50
50
|
* (`context.init`) and can prompt, spawn sessions, and compose other work.
|
|
51
51
|
* Input/output use the harness `schema` builders and are validated on every
|
package/dist/action.js
CHANGED
|
@@ -13,7 +13,7 @@ export class ActionError extends Error {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Define an action
|
|
16
|
+
* Define an action, the harness-context counterpart to `defineTool`.
|
|
17
17
|
* A tool is a leaf capability the model calls; an action holds the harness
|
|
18
18
|
* (`context.init`) and can prompt, spawn sessions, and compose other work.
|
|
19
19
|
* Input/output use the harness `schema` builders and are validated on every
|
package/dist/ai-gateway.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export interface AIGatewayOptions {
|
|
|
41
41
|
* });
|
|
42
42
|
* ```
|
|
43
43
|
*
|
|
44
|
-
* For Vercel AI Gateway, prefer the {@link vercelAIGateway} preset
|
|
44
|
+
* For Vercel AI Gateway, prefer the {@link vercelAIGateway} preset: same
|
|
45
45
|
* factory under the hood with the gateway URL pre-baked.
|
|
46
46
|
*/
|
|
47
47
|
export declare function aiGateway(options: AIGatewayOptions): OpenAICompatibleModelProvider;
|
package/dist/ai-gateway.js
CHANGED
|
@@ -29,7 +29,7 @@ import { OpenAICompatibleModelProvider } from './model.js';
|
|
|
29
29
|
* });
|
|
30
30
|
* ```
|
|
31
31
|
*
|
|
32
|
-
* For Vercel AI Gateway, prefer the {@link vercelAIGateway} preset
|
|
32
|
+
* For Vercel AI Gateway, prefer the {@link vercelAIGateway} preset: same
|
|
33
33
|
* factory under the hood with the gateway URL pre-baked.
|
|
34
34
|
*/
|
|
35
35
|
export function aiGateway(options) {
|
|
@@ -60,7 +60,7 @@ export interface StoredAttachment {
|
|
|
60
60
|
/**
|
|
61
61
|
* Durable content-addressed attachment storage.
|
|
62
62
|
*
|
|
63
|
-
* - `put` is idempotent by `(scope, digest)
|
|
63
|
+
* - `put` is idempotent by `(scope, digest)`. Re-putting the same content
|
|
64
64
|
* succeeds without duplicating storage (the first stored ref metadata is
|
|
65
65
|
* retained). It MUST verify the digest against the bytes and reject a
|
|
66
66
|
* mismatch with `AttachmentStoreError('DIGEST_MISMATCH')` before writing.
|
|
@@ -99,8 +99,8 @@ export declare function messageHasDataAttachments(message: DeliveredMessage): bo
|
|
|
99
99
|
* base64 data, store the bytes under `scope`, and return a NEW message whose
|
|
100
100
|
* attachments carry `{ type, mimeType, filename?, ref }` and no `data`.
|
|
101
101
|
*
|
|
102
|
-
* Deterministic by construction
|
|
103
|
-
* and digests derive from content
|
|
102
|
+
* Deterministic by construction (attachment ids are `${idPrefix}_${index}`
|
|
103
|
+
* and digests derive from content) so an exact redelivery of the same
|
|
104
104
|
* message produces an identical materialized payload (admission idempotency).
|
|
105
105
|
* Messages without inline attachments are returned unchanged (same
|
|
106
106
|
* reference).
|
package/dist/attachment-store.js
CHANGED
|
@@ -128,8 +128,8 @@ export function messageHasDataAttachments(message) {
|
|
|
128
128
|
* base64 data, store the bytes under `scope`, and return a NEW message whose
|
|
129
129
|
* attachments carry `{ type, mimeType, filename?, ref }` and no `data`.
|
|
130
130
|
*
|
|
131
|
-
* Deterministic by construction
|
|
132
|
-
* and digests derive from content
|
|
131
|
+
* Deterministic by construction (attachment ids are `${idPrefix}_${index}`
|
|
132
|
+
* and digests derive from content) so an exact redelivery of the same
|
|
133
133
|
* message produces an identical materialized payload (admission idempotency).
|
|
134
134
|
* Messages without inline attachments are returned unchanged (same
|
|
135
135
|
* reference).
|
package/dist/channel.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { FabricActor } from './types.js';
|
|
|
4
4
|
/**
|
|
5
5
|
* Channels turn platform webhooks (Slack, GitHub, …) into agent dispatches. Handlers are written
|
|
6
6
|
* against the Web `Request`/`Response` API and `crypto.subtle`, so the same channel runs on Node and
|
|
7
|
-
* Cloudflare. A channel is a stateless route container plus a conversation-id (de)serializer
|
|
7
|
+
* Cloudflare. A channel is a stateless route container plus a conversation-id (de)serializer;
|
|
8
8
|
* session continuity falls out of the key (same thread → same key → same session).
|
|
9
9
|
*/
|
|
10
10
|
export interface ChannelRoute {
|
|
@@ -63,7 +63,7 @@ export declare function parseConversationKey(key: string): ParsedConversationKey
|
|
|
63
63
|
* Reads the full request body as bytes, or returns undefined if it exceeds `limitBytes`.
|
|
64
64
|
*
|
|
65
65
|
* NOTE: this consumes the request stream (single read). Signature-verifying channels need the *exact*
|
|
66
|
-
* bytes for HMAC and the parsed JSON afterward
|
|
66
|
+
* bytes for HMAC and the parsed JSON afterward. Don't call `request.json()` as well. Use
|
|
67
67
|
* {@link readJsonBody} to get both from one read.
|
|
68
68
|
*/
|
|
69
69
|
export declare function readRequestBody(request: Request, limitBytes?: number): Promise<Uint8Array | undefined>;
|
|
@@ -76,7 +76,7 @@ export interface RequestBody {
|
|
|
76
76
|
json: unknown;
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
|
-
* Reads the body once and returns the raw bytes, the decoded text, and the parsed JSON together
|
|
79
|
+
* Reads the body once and returns the raw bytes, the decoded text, and the parsed JSON together, so a
|
|
80
80
|
* channel can HMAC-verify the exact bytes and use the JSON without re-reading the (already consumed)
|
|
81
81
|
* stream. Returns undefined only when the body exceeds `limitBytes`.
|
|
82
82
|
*/
|
package/dist/channel.js
CHANGED
|
@@ -81,7 +81,7 @@ const DEFAULT_BODY_LIMIT = 1_000_000;
|
|
|
81
81
|
* Reads the full request body as bytes, or returns undefined if it exceeds `limitBytes`.
|
|
82
82
|
*
|
|
83
83
|
* NOTE: this consumes the request stream (single read). Signature-verifying channels need the *exact*
|
|
84
|
-
* bytes for HMAC and the parsed JSON afterward
|
|
84
|
+
* bytes for HMAC and the parsed JSON afterward. Don't call `request.json()` as well. Use
|
|
85
85
|
* {@link readJsonBody} to get both from one read.
|
|
86
86
|
*/
|
|
87
87
|
export async function readRequestBody(request, limitBytes = DEFAULT_BODY_LIMIT) {
|
|
@@ -94,7 +94,7 @@ export async function readRequestBody(request, limitBytes = DEFAULT_BODY_LIMIT)
|
|
|
94
94
|
return buffer;
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
|
-
* Reads the body once and returns the raw bytes, the decoded text, and the parsed JSON together
|
|
97
|
+
* Reads the body once and returns the raw bytes, the decoded text, and the parsed JSON together, so a
|
|
98
98
|
* channel can HMAC-verify the exact bytes and use the JSON without re-reading the (already consumed)
|
|
99
99
|
* stream. Returns undefined only when the body exceeds `limitBytes`.
|
|
100
100
|
*/
|
|
@@ -7,10 +7,10 @@ import type { SessionData, SessionEntry, SessionStore } from "./types.js";
|
|
|
7
7
|
* The SessionEntry DAG stays the single source of truth; the stream gives
|
|
8
8
|
* clients offset-based catch-up + live tail. Two rules keep them coherent:
|
|
9
9
|
*
|
|
10
|
-
* 1. **Idempotent by entryId
|
|
10
|
+
* 1. **Idempotent by entryId**. A crash between the DAG write and the
|
|
11
11
|
* stream write is repaired on the next append: the projector diffs the
|
|
12
12
|
* stream tail against the active path and re-emits anything missing.
|
|
13
|
-
* 2. **Truncation is explicit
|
|
13
|
+
* 2. **Truncation is explicit**. The DAG can branch (fork/replay/
|
|
14
14
|
* checkpoint-restore rewrite `leafId`); the stream cannot. When `save()`
|
|
15
15
|
* rewinds the active path, the projector appends a `truncated` record
|
|
16
16
|
* and re-acquires the producer (epoch bump), so tailing clients see the
|
|
@@ -6,10 +6,10 @@ import { ConversationStreamStoreError, conversationStreamPath } from "./conversa
|
|
|
6
6
|
* The SessionEntry DAG stays the single source of truth; the stream gives
|
|
7
7
|
* clients offset-based catch-up + live tail. Two rules keep them coherent:
|
|
8
8
|
*
|
|
9
|
-
* 1. **Idempotent by entryId
|
|
9
|
+
* 1. **Idempotent by entryId**. A crash between the DAG write and the
|
|
10
10
|
* stream write is repaired on the next append: the projector diffs the
|
|
11
11
|
* stream tail against the active path and re-emits anything missing.
|
|
12
|
-
* 2. **Truncation is explicit
|
|
12
|
+
* 2. **Truncation is explicit**. The DAG can branch (fork/replay/
|
|
13
13
|
* checkpoint-restore rewrite `leafId`); the stream cannot. When `save()`
|
|
14
14
|
* rewinds the active path, the projector appends a `truncated` record
|
|
15
15
|
* and re-acquires the producer (epoch bump), so tailing clients see the
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { SessionEntry } from './types.js';
|
|
2
2
|
/**
|
|
3
|
-
* Append-only conversation stream
|
|
3
|
+
* Append-only conversation stream, the durable, offset-addressable
|
|
4
4
|
* projection of a session's active path (v2 migration, phase A4).
|
|
5
5
|
*
|
|
6
6
|
* The SessionEntry DAG remains the single source of truth for model context;
|
|
7
7
|
* this stream exists so clients can read a conversation with offsets
|
|
8
8
|
* (catch-up + live tail), across processes, without count-based replay. The
|
|
9
|
-
* projection appends one record per active-path entry, and
|
|
10
|
-
* can branch (fork/replay/checkpoint-restore) while a stream cannot
|
|
9
|
+
* projection appends one record per active-path entry, and (because the DAG
|
|
10
|
+
* can branch (fork/replay/checkpoint-restore) while a stream cannot) an
|
|
11
11
|
* explicit `truncated` record whenever the active path rewinds, paired with
|
|
12
12
|
* a producer-epoch bump so stale writers are fenced out.
|
|
13
13
|
*/
|
|
@@ -92,7 +92,7 @@ export interface ConversationStreamAppendInput {
|
|
|
92
92
|
*
|
|
93
93
|
* **Producer fencing**: `acquireProducer` bumps the producer epoch; appends
|
|
94
94
|
* carrying a stale epoch are rejected. The (path, producerId, epoch,
|
|
95
|
-
* sequence) uniqueness makes redelivered appends idempotent
|
|
95
|
+
* sequence) uniqueness makes redelivered appends idempotent; a retried
|
|
96
96
|
* append with the same coordinates returns the already-committed offset.
|
|
97
97
|
*/
|
|
98
98
|
export interface ConversationStreamStore {
|
|
@@ -139,7 +139,7 @@ export declare function readConversationFromFold(store: ConversationStreamStore,
|
|
|
139
139
|
/** Stream path for a session's conversation projection. */
|
|
140
140
|
export declare function conversationStreamPath(storeSessionId: string): string;
|
|
141
141
|
/**
|
|
142
|
-
* Process-local listener registry shared by store implementations
|
|
142
|
+
* Process-local listener registry shared by store implementations:
|
|
143
143
|
* registration, unsubscribe-and-prune, and error-swallowing notify.
|
|
144
144
|
*/
|
|
145
145
|
export declare class StreamListenerRegistry {
|
|
@@ -78,7 +78,7 @@ export function conversationStreamPath(storeSessionId) {
|
|
|
78
78
|
return `conversations/${storeSessionId}`;
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
81
|
-
* Process-local listener registry shared by store implementations
|
|
81
|
+
* Process-local listener registry shared by store implementations:
|
|
82
82
|
* registration, unsubscribe-and-prune, and error-swallowing notify.
|
|
83
83
|
*/
|
|
84
84
|
export class StreamListenerRegistry {
|
package/dist/cost-budget.d.ts
CHANGED
|
@@ -18,11 +18,11 @@ import { FabricError } from './error.js';
|
|
|
18
18
|
*/
|
|
19
19
|
/**
|
|
20
20
|
* Async store for cross-process spend aggregation. Pair with `CostLimit.scopeKey`
|
|
21
|
-
* + `CostLimit.perScope` to enforce a budget that survives process restarts
|
|
21
|
+
* + `CostLimit.perScope` to enforce a budget that survives process restarts:
|
|
22
22
|
* "tenant:acme spends ≤ $50 today" or "company-wide ≤ $100 this hour".
|
|
23
23
|
*
|
|
24
24
|
* Built-in implementations:
|
|
25
|
-
* - `inMemoryCostBudgetStore()
|
|
25
|
+
* - `inMemoryCostBudgetStore()`, process-local; default.
|
|
26
26
|
* - `@fabric-harness/node` exposes `postgresCostBudgetStore({ pool })`.
|
|
27
27
|
*/
|
|
28
28
|
export interface CostBudgetStore {
|
|
@@ -46,7 +46,7 @@ export interface CostBudgetStore {
|
|
|
46
46
|
*
|
|
47
47
|
* Scope key convention: `tenant:<id>:<period>` where `<period>` is
|
|
48
48
|
* `day:YYYY-MM-DD`, `hour:YYYY-MM-DDTHH:00Z`, or `month:YYYY-MM`. Reset
|
|
49
|
-
* semantics (rollover) are the host's job
|
|
49
|
+
* semantics (rollover) are the host's job. Call `store.reset(scopeKey)`
|
|
50
50
|
* from a scheduled task to clear the period total.
|
|
51
51
|
*
|
|
52
52
|
* ```ts
|
package/dist/cost-budget.js
CHANGED
|
@@ -7,7 +7,7 @@ import { FabricError } from './error.js';
|
|
|
7
7
|
*
|
|
8
8
|
* Scope key convention: `tenant:<id>:<period>` where `<period>` is
|
|
9
9
|
* `day:YYYY-MM-DD`, `hour:YYYY-MM-DDTHH:00Z`, or `month:YYYY-MM`. Reset
|
|
10
|
-
* semantics (rollover) are the host's job
|
|
10
|
+
* semantics (rollover) are the host's job. Call `store.reset(scopeKey)`
|
|
11
11
|
* from a scheduled task to clear the period total.
|
|
12
12
|
*
|
|
13
13
|
* ```ts
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { SignalEntryData } from './types.js';
|
|
2
2
|
/**
|
|
3
|
-
* DeliveredMessage
|
|
3
|
+
* DeliveredMessage, the single unified input shape for everything that
|
|
4
4
|
* enters a persistent agent's session: direct HTTP prompts, dispatch,
|
|
5
5
|
* channels/webhooks, Databricks events, SDK clients, and tests.
|
|
6
6
|
*
|
|
7
7
|
* `kind: 'user'` is a direct user talking to the assistant (1:1 chat
|
|
8
8
|
* surface), optionally carrying attachments.
|
|
9
9
|
*
|
|
10
|
-
* `kind: 'signal'` models everything beyond that direct exchange
|
|
10
|
+
* `kind: 'signal'` models everything beyond that direct exchange. A Slack
|
|
11
11
|
* thread or a Lakeflow job event is activity the agent observes, not the
|
|
12
12
|
* assistant's own user speaking. Sender identity and structured metadata go
|
|
13
13
|
* in `attributes`; the message itself in `body`. Signals render into model
|
|
@@ -32,7 +32,7 @@ export type DeliveredMessage = {
|
|
|
32
32
|
* One attachment on a `kind: 'user'` message. Today the only supported
|
|
33
33
|
* attachment is an image, carried either inline (`data`, base64) or as a
|
|
34
34
|
* durable content-addressed reference (`ref`) once an attachment store is
|
|
35
|
-
* configured
|
|
35
|
+
* configured; admission materializes inline bytes into refs. An attachment
|
|
36
36
|
* must carry `data` or `ref` (or both, transiently during materialization).
|
|
37
37
|
*/
|
|
38
38
|
export interface DeliveredAttachment {
|
package/dist/error.js
CHANGED
|
@@ -57,7 +57,7 @@ export class FabricError extends Error {
|
|
|
57
57
|
}
|
|
58
58
|
function safePublicMessage(code, message) {
|
|
59
59
|
if (code === 'UNKNOWN')
|
|
60
|
-
return 'An unexpected
|
|
60
|
+
return 'An unexpected TechFabric Harness error occurred.';
|
|
61
61
|
return sanitizePublicText(message);
|
|
62
62
|
}
|
|
63
63
|
/** Remove credentials and host filesystem locations from caller-visible text. */
|
|
@@ -91,7 +91,7 @@ export function toFabricError(error, fallback) {
|
|
|
91
91
|
/** Convert any thrown value into the stable public/developer transport shape. */
|
|
92
92
|
export function serializeFabricError(error, audience = 'public', fallback = {
|
|
93
93
|
code: 'UNKNOWN',
|
|
94
|
-
message: 'An unexpected
|
|
94
|
+
message: 'An unexpected TechFabric Harness error occurred.',
|
|
95
95
|
}) {
|
|
96
96
|
return toFabricError(error, fallback).toJSON(audience);
|
|
97
97
|
}
|
package/dist/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AA6D5C,MAAM,gBAAgB,GAAG,kCAAkC,CAAC;AAE5D,gFAAgF;AAChF,MAAM,UAAU,oBAAoB,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE;IACnD,IAAI,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QAC3C,I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,oBAAoB,CAClC,KAAc,EACd,WAAmC,QAAQ,EAC3C,WAA8C;IAC5C,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,kDAAkD;CAC5D;IAED,OAAO,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACzD,CAAC"}
|
package/dist/events.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Typed event payloads for `init({ onEvent })` and `session.stream()`.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* TechFabric Harness already emits a structured event stream via the
|
|
5
5
|
* untyped `FabricEvent` interface (see `types.ts`). This module layers
|
|
6
6
|
* a discriminated union on top so consumers can write `if (event.type
|
|
7
7
|
* === 'tool_start')` and have TypeScript narrow `event.data` for them.
|
package/dist/events.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Typed event payloads for `init({ onEvent })` and `session.stream()`.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* TechFabric Harness already emits a structured event stream via the
|
|
5
5
|
* untyped `FabricEvent` interface (see `types.ts`). This module layers
|
|
6
6
|
* a discriminated union on top so consumers can write `if (event.type
|
|
7
7
|
* === 'tool_start')` and have TypeScript narrow `event.data` for them.
|
|
@@ -3,12 +3,12 @@ import type { SandboxBackend } from './types.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* A read-only content source that can be mounted into a sandbox at
|
|
5
5
|
* sandbox-creation time. The agent then has built-in `read`, `glob`,
|
|
6
|
-
* and `grep` tools available over the mounted content
|
|
6
|
+
* and `grep` tools available over the mounted content, no retrieval
|
|
7
7
|
* pipeline, no embeddings, no vector store required.
|
|
8
8
|
*
|
|
9
9
|
* Sources are intentionally minimal: they yield (path, content) pairs.
|
|
10
10
|
* Implementations decide how to enumerate (eager vs lazy is up to the
|
|
11
|
-
* source author)
|
|
11
|
+
* source author). The mount step pulls the full set into the sandbox.
|
|
12
12
|
*/
|
|
13
13
|
export interface FilesystemSource {
|
|
14
14
|
/** Stable name for telemetry / logs. */
|
|
@@ -73,7 +73,7 @@ export declare function inMemorySource(files: Record<string, string | Uint8Array
|
|
|
73
73
|
* withFilesystemSources('virtual', [{ mountAt, source }])
|
|
74
74
|
* ```
|
|
75
75
|
*
|
|
76
|
-
*
|
|
76
|
+
* Use it for support agents, runbook lookup, and FAQ assistants: anywhere a
|
|
77
77
|
* small Markdown corpus needs to be searchable via the agent's built-in
|
|
78
78
|
* `grep`/`glob`/`read` tools.
|
|
79
79
|
*
|
|
@@ -84,7 +84,7 @@ export function inMemorySource(files, options = {}) {
|
|
|
84
84
|
* withFilesystemSources('virtual', [{ mountAt, source }])
|
|
85
85
|
* ```
|
|
86
86
|
*
|
|
87
|
-
*
|
|
87
|
+
* Use it for support agents, runbook lookup, and FAQ assistants: anywhere a
|
|
88
88
|
* small Markdown corpus needs to be searchable via the agent's built-in
|
|
89
89
|
* `grep`/`glob`/`read` tools.
|
|
90
90
|
*
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { CostLimit } from './cost-budget.js';
|
|
2
|
+
import type { ToolCall, ToolCallResult, ToolDef } from './tools.js';
|
|
3
|
+
import type { JsonObject, SessionStore } from './types.js';
|
|
4
|
+
import type { VoiceConnectOptions, VoiceProvider, VoiceSession } from './voice.js';
|
|
5
|
+
export interface GovernedVoiceOptions {
|
|
6
|
+
provider: VoiceProvider;
|
|
7
|
+
/** Trusted application binding, resolved from authenticated server state. */
|
|
8
|
+
callId: string;
|
|
9
|
+
resourceId: string;
|
|
10
|
+
instructions: string;
|
|
11
|
+
tools: ToolDef[];
|
|
12
|
+
voice?: string;
|
|
13
|
+
audioFormat?: VoiceConnectOptions['audioFormat'];
|
|
14
|
+
sampleRate?: number;
|
|
15
|
+
signal?: AbortSignal;
|
|
16
|
+
limits: {
|
|
17
|
+
durationMs: number;
|
|
18
|
+
maxTurns: number;
|
|
19
|
+
maxToolCalls: number;
|
|
20
|
+
maxAudioFrameBytes?: number;
|
|
21
|
+
};
|
|
22
|
+
/** Estimated spend, checked after each response. One in-flight response can overshoot. */
|
|
23
|
+
costLimit: Pick<CostLimit, 'perCall' | 'perScope' | 'scopeKey'> & {
|
|
24
|
+
perSession: number;
|
|
25
|
+
};
|
|
26
|
+
/** Checked on admission and immediately before every tool execution/replay. */
|
|
27
|
+
authorize: (operation: {
|
|
28
|
+
kind: 'connect' | 'input' | 'tool';
|
|
29
|
+
tool?: string;
|
|
30
|
+
}) => boolean | Promise<boolean>;
|
|
31
|
+
/** Validate and remove sensitive values before policy/history/model exposure. Throw to reject. */
|
|
32
|
+
prepareToolInput: (name: string, input: unknown) => unknown | Promise<unknown>;
|
|
33
|
+
/** Trusted logical action identity, stable across provider reconnects. Never use a provider call ID. */
|
|
34
|
+
toolOperationKey: (name: string, preparedInput: unknown) => string | Promise<string>;
|
|
35
|
+
/** Return only model-safe output; the safe value is also what the journal retains. */
|
|
36
|
+
prepareToolOutput: (name: string, output: unknown) => unknown | Promise<unknown>;
|
|
37
|
+
/** Redact before transcript/text is exposed. Raw audio is never persisted by Harness. */
|
|
38
|
+
redactTranscript: (text: string) => string | Promise<string>;
|
|
39
|
+
/** Awaited audit delivery; failures stop the session. Contains metadata, never audio/text/arguments. */
|
|
40
|
+
onAudit?: (event: JsonObject) => void | Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
/** Only sessions opened through session.voice() carry this server-route marker. */
|
|
43
|
+
export interface GovernedVoiceSession extends VoiceSession {
|
|
44
|
+
readonly governed: true;
|
|
45
|
+
}
|
|
46
|
+
export interface GovernedVoiceRuntime {
|
|
47
|
+
sessionId: string;
|
|
48
|
+
tenantId: string;
|
|
49
|
+
actorId: string;
|
|
50
|
+
store: SessionStore;
|
|
51
|
+
execute: (call: ToolCall, tools: ToolDef[], signal: AbortSignal) => Promise<ToolCallResult>;
|
|
52
|
+
}
|
|
53
|
+
/** Internal session adapter. Public callers use session.voice(). */
|
|
54
|
+
export declare function openGovernedVoice(options: GovernedVoiceOptions, runtime: GovernedVoiceRuntime): Promise<GovernedVoiceSession>;
|
|
55
|
+
//# sourceMappingURL=governed-voice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"governed-voice.d.ts","sourceRoot":"","sources":["../src/governed-voice.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAc,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/F,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,aAAa,CAAC;IACxB,6EAA6E;IAC7E,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,MAAM,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACpG,0FAA0F;IAC1F,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IACzF,+EAA+E;IAC/E,SAAS,EAAE,CAAC,SAAS,EAAE;QAAE,IAA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