agent-relay-sdk 0.2.17 → 0.2.18
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/bus-client.d.ts +5 -4
- package/dist/bus-client.d.ts.map +1 -1
- package/dist/claim-tracker.d.ts +1 -18
- package/dist/claim-tracker.d.ts.map +1 -1
- package/dist/claim-tracker.js +2 -1
- package/dist/claim-tracker.js.map +1 -1
- package/dist/context-probe.d.ts +4 -6
- package/dist/context-probe.d.ts.map +1 -1
- package/dist/context-probe.js +11 -5
- package/dist/context-probe.js.map +1 -1
- package/dist/fs-name.d.ts +2 -1
- package/dist/fs-name.d.ts.map +1 -1
- package/dist/http-client.d.ts +3 -10
- package/dist/http-client.d.ts.map +1 -1
- package/dist/http-client.js +1 -1
- package/dist/http-client.js.map +1 -1
- package/dist/process-utils.d.ts +0 -2
- package/dist/process-utils.d.ts.map +1 -1
- package/dist/process-utils.js +1 -1
- package/dist/process-utils.js.map +1 -1
- package/dist/protocol.d.ts +11 -17
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +7 -7
- package/dist/protocol.js.map +1 -1
- package/dist/provider-base.d.ts +3 -26
- package/dist/provider-base.d.ts.map +1 -1
- package/dist/provider-base.js +1 -1
- package/dist/provider-base.js.map +1 -1
- package/dist/provider-catalog.d.ts +10 -10
- package/dist/provider-catalog.d.ts.map +1 -1
- package/dist/provider-catalog.js +1 -1
- package/dist/provider-catalog.js.map +1 -1
- package/dist/reconnect.d.ts +2 -1
- package/dist/reconnect.d.ts.map +1 -1
- package/dist/speech-text.d.ts +2 -1
- package/dist/speech-text.d.ts.map +1 -1
- package/dist/sse.d.ts +2 -1
- package/dist/sse.d.ts.map +1 -1
- package/dist/types.d.ts +29 -44
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +24 -3
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/src/bus-client.ts +4 -4
- package/src/claim-tracker.ts +4 -4
- package/src/context-probe.ts +14 -8
- package/src/fs-name.ts +1 -1
- package/src/http-client.ts +3 -3
- package/src/process-utils.ts +1 -1
- package/src/protocol.ts +17 -17
- package/src/provider-base.ts +4 -4
- package/src/provider-catalog.ts +10 -10
- package/src/reconnect.ts +1 -1
- package/src/speech-text.ts +1 -1
- package/src/sse.ts +1 -1
- package/src/types.ts +43 -18
package/src/provider-catalog.ts
CHANGED
|
@@ -3,25 +3,25 @@ import type { SpawnProvider } from "./types.js";
|
|
|
3
3
|
/** Valid reasoning-effort levels — runtime tuple is the single source of truth. */
|
|
4
4
|
export const VALID_EFFORTS = ["low", "medium", "high", "xhigh", "max"] as const;
|
|
5
5
|
export type ProviderEffort = (typeof VALID_EFFORTS)[number];
|
|
6
|
-
|
|
6
|
+
function isProviderEffort(value: unknown): value is ProviderEffort {
|
|
7
7
|
return typeof value === "string" && (VALID_EFFORTS as readonly string[]).includes(value);
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
type ProviderCatalogValueSource = "catalog" | "provider" | "runtime" | "override";
|
|
10
|
+
type ProviderCatalogConfidence = "declared" | "verified" | "estimated" | "unknown";
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
interface ProviderCatalogValue<T> {
|
|
13
13
|
value: T;
|
|
14
14
|
source: ProviderCatalogValueSource;
|
|
15
15
|
confidence: ProviderCatalogConfidence;
|
|
16
16
|
lastUpdatedAt?: number;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
interface ProviderModelLimits {
|
|
20
20
|
contextWindowTokens?: ProviderCatalogValue<number>;
|
|
21
21
|
maxOutputTokens?: ProviderCatalogValue<number>;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
interface ProviderModelModalities {
|
|
25
25
|
input: {
|
|
26
26
|
text: boolean;
|
|
27
27
|
image?: boolean;
|
|
@@ -37,7 +37,7 @@ export interface ProviderModelModalities {
|
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
interface ProviderModelToolCapabilities {
|
|
41
41
|
code?: boolean;
|
|
42
42
|
review?: boolean;
|
|
43
43
|
debug?: boolean;
|
|
@@ -50,7 +50,7 @@ export interface ProviderModelToolCapabilities {
|
|
|
50
50
|
imageEditing?: boolean;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
interface ProviderModelCapabilities {
|
|
54
54
|
modalities: ProviderModelModalities;
|
|
55
55
|
tools?: ProviderModelToolCapabilities;
|
|
56
56
|
source: ProviderCatalogValueSource;
|
|
@@ -75,13 +75,13 @@ export interface ProviderCatalogEntry {
|
|
|
75
75
|
models: ProviderModelCatalogEntry[];
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
interface ProviderSelection {
|
|
79
79
|
provider: SpawnProvider;
|
|
80
80
|
model?: string;
|
|
81
81
|
effort?: ProviderEffort;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
interface ResolvedProviderSelection {
|
|
85
85
|
provider: SpawnProvider;
|
|
86
86
|
modelAlias?: string;
|
|
87
87
|
providerModel?: string;
|
package/src/reconnect.ts
CHANGED
package/src/speech-text.ts
CHANGED
|
@@ -111,7 +111,7 @@ function collapseTables(text: string): string {
|
|
|
111
111
|
* by appending an entry. Order matters: earlier rules see the raw text, later
|
|
112
112
|
* rules see the output of earlier ones (see the ordering notes in SPEECH_RULES).
|
|
113
113
|
*/
|
|
114
|
-
|
|
114
|
+
interface SpeechRule {
|
|
115
115
|
readonly name: string
|
|
116
116
|
readonly pattern: RegExp
|
|
117
117
|
readonly replace: string | ((substring: string, ...args: string[]) => string)
|
package/src/sse.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// (voice connector). One home for the `event:`/`data:`/`retry:` field parse
|
|
4
4
|
// that was hand-rolled in connectors/voice and dashboard/src/lib/api.ts.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
interface ParsedSseFrame {
|
|
7
7
|
/** Event name; defaults to "message" per the SSE spec when no `event:` field. */
|
|
8
8
|
event: string;
|
|
9
9
|
/** Each `data:` line, in order. Join with "\n" to reconstruct the payload. */
|
package/src/types.ts
CHANGED
|
@@ -26,8 +26,8 @@ export interface AgentCard {
|
|
|
26
26
|
|
|
27
27
|
export type AgentStatus = "online" | "idle" | "busy" | "stale" | "offline";
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
type CapabilitySource = "catalog" | "provider" | "runtime" | "override" | "estimate";
|
|
30
|
+
type CapabilityConfidence = "declared" | "reported" | "verified" | "estimated" | "unknown";
|
|
31
31
|
|
|
32
32
|
export interface ProviderCapabilities {
|
|
33
33
|
lifecycle: {
|
|
@@ -99,7 +99,7 @@ export interface ProviderCapabilities {
|
|
|
99
99
|
lastUpdatedAt: number;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
type ContextLifecycleState =
|
|
103
103
|
| "fresh"
|
|
104
104
|
| "primed"
|
|
105
105
|
| "working"
|
|
@@ -249,7 +249,7 @@ export interface ContextBudget {
|
|
|
249
249
|
priorityCutoff: 1 | 2 | 3;
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
|
|
252
|
+
interface TaskHistorySummary {
|
|
253
253
|
taskId: number;
|
|
254
254
|
agentId: string;
|
|
255
255
|
status: string;
|
|
@@ -303,7 +303,7 @@ export interface MemoryBrokerContext {
|
|
|
303
303
|
|
|
304
304
|
export type MemoryBrokerKind = "sqlite" | "http" | "command";
|
|
305
305
|
|
|
306
|
-
|
|
306
|
+
interface SqliteMemoryBrokerConfig {
|
|
307
307
|
type: "sqlite";
|
|
308
308
|
}
|
|
309
309
|
|
|
@@ -332,6 +332,31 @@ export type MessageKind =
|
|
|
332
332
|
| "system"
|
|
333
333
|
| "session";
|
|
334
334
|
|
|
335
|
+
/**
|
|
336
|
+
* Mechanical message kinds: the relay's own lifecycle/observability lane, not
|
|
337
|
+
* agent-directed messaging. They bypass delivery resolution (never re-delivered
|
|
338
|
+
* into a session) and — when targeting a reserved sink — the recipient-constraint
|
|
339
|
+
* auth check (a managed token's `targets`/`policies`/`agents` constraints gate which
|
|
340
|
+
* *agents* it may message, not a session-mirror capture to the reserved sink; #284).
|
|
341
|
+
* Keep in sync with the `MessageKind` union.
|
|
342
|
+
*/
|
|
343
|
+
export const MECHANICAL_MESSAGE_KINDS: readonly MessageKind[] = ["system", "control", "session"];
|
|
344
|
+
|
|
345
|
+
export function isMechanicalMessageKind(kind: string | undefined): boolean {
|
|
346
|
+
return MECHANICAL_MESSAGE_KINDS.includes((kind ?? "") as MessageKind);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Reserved built-in identities that are not real agents: the `user` chat/mirror sink
|
|
351
|
+
* and the `system` lifecycle sender. They are never registered, polled, or delivered to
|
|
352
|
+
* like agents, so recipient constraints don't apply to mechanical posts addressed to them.
|
|
353
|
+
*/
|
|
354
|
+
export const RESERVED_AGENT_IDS: readonly string[] = ["user", "system"];
|
|
355
|
+
|
|
356
|
+
export function isReservedAgentId(id: string | undefined): boolean {
|
|
357
|
+
return id === "user" || id === "system";
|
|
358
|
+
}
|
|
359
|
+
|
|
335
360
|
/**
|
|
336
361
|
* Session-mirror event taxonomy. Every `kind: "session"` message carries a
|
|
337
362
|
* `payload.session` of this shape so the dashboard can render the live provider
|
|
@@ -342,9 +367,9 @@ export type MessageKind =
|
|
|
342
367
|
* and `notice` render discreetly (collapsed/inline activity, never bubbles).
|
|
343
368
|
* A legacy session message with no `payload.session` is treated as a `response`.
|
|
344
369
|
*/
|
|
345
|
-
|
|
370
|
+
type SessionEventType = "prompt" | "response" | "narration" | "reasoning" | "tool" | "notice";
|
|
346
371
|
|
|
347
|
-
|
|
372
|
+
type SessionEventOrigin = "chat" | "terminal" | "provider";
|
|
348
373
|
|
|
349
374
|
export interface MessageSessionMeta {
|
|
350
375
|
type: SessionEventType;
|
|
@@ -1150,14 +1175,14 @@ export type OrchestratorStatus = "online" | "offline";
|
|
|
1150
1175
|
/** Spawn providers — the runtime tuple is the single source of truth; the type derives from it. */
|
|
1151
1176
|
export const SPAWN_PROVIDERS = ["claude", "codex"] as const;
|
|
1152
1177
|
export type SpawnProvider = (typeof SPAWN_PROVIDERS)[number];
|
|
1153
|
-
|
|
1178
|
+
function isSpawnProvider(value: unknown): value is SpawnProvider {
|
|
1154
1179
|
return typeof value === "string" && (SPAWN_PROVIDERS as readonly string[]).includes(value);
|
|
1155
1180
|
}
|
|
1156
1181
|
|
|
1157
1182
|
/** Approval modes — runtime tuple + derived type. */
|
|
1158
1183
|
export const APPROVAL_MODES = ["open", "guarded", "read-only"] as const;
|
|
1159
1184
|
export type SpawnApprovalMode = (typeof APPROVAL_MODES)[number];
|
|
1160
|
-
|
|
1185
|
+
function isApprovalMode(value: unknown): value is SpawnApprovalMode {
|
|
1161
1186
|
return typeof value === "string" && (APPROVAL_MODES as readonly string[]).includes(value);
|
|
1162
1187
|
}
|
|
1163
1188
|
|
|
@@ -1203,7 +1228,7 @@ export interface WorkspaceProbe {
|
|
|
1203
1228
|
error?: string;
|
|
1204
1229
|
}
|
|
1205
1230
|
|
|
1206
|
-
|
|
1231
|
+
interface WorkspaceGitCommit {
|
|
1207
1232
|
sha: string;
|
|
1208
1233
|
message: string;
|
|
1209
1234
|
at?: number;
|
|
@@ -1548,7 +1573,7 @@ export interface ManagedAgentState {
|
|
|
1548
1573
|
updatedAt: number;
|
|
1549
1574
|
}
|
|
1550
1575
|
|
|
1551
|
-
|
|
1576
|
+
type SpawnPolicyMode = "always-on" | "on-demand";
|
|
1552
1577
|
|
|
1553
1578
|
export type AgentProfileProvider = SpawnProvider | "any";
|
|
1554
1579
|
export type AgentProfileBase = "host" | "minimal" | "isolated";
|
|
@@ -1921,7 +1946,7 @@ export interface OrchestratorRuntimeInput {
|
|
|
1921
1946
|
providerCatalog?: ProviderCatalogSummary[];
|
|
1922
1947
|
}
|
|
1923
1948
|
|
|
1924
|
-
|
|
1949
|
+
interface OrchestratorSpawnInput {
|
|
1925
1950
|
provider: SpawnProvider;
|
|
1926
1951
|
model?: string;
|
|
1927
1952
|
effort?: SpawnEffort;
|
|
@@ -2016,7 +2041,7 @@ export interface ProviderCatalogSummary {
|
|
|
2016
2041
|
}>;
|
|
2017
2042
|
}
|
|
2018
2043
|
|
|
2019
|
-
|
|
2044
|
+
interface OrchestratorSpawnResult {
|
|
2020
2045
|
orchestratorId: string;
|
|
2021
2046
|
provider: SpawnProvider;
|
|
2022
2047
|
sessionName?: string;
|
|
@@ -2057,19 +2082,19 @@ export interface RecipeAgent {
|
|
|
2057
2082
|
env?: Record<string, string>;
|
|
2058
2083
|
}
|
|
2059
2084
|
|
|
2060
|
-
|
|
2085
|
+
interface RecipeWorkflow {
|
|
2061
2086
|
trigger?: string;
|
|
2062
2087
|
fanOut?: "all" | "first";
|
|
2063
2088
|
collect?: string;
|
|
2064
2089
|
routing?: RecipeRoute[];
|
|
2065
2090
|
}
|
|
2066
2091
|
|
|
2067
|
-
|
|
2092
|
+
interface RecipeRoute {
|
|
2068
2093
|
pattern: string;
|
|
2069
2094
|
pipeline: string[];
|
|
2070
2095
|
}
|
|
2071
2096
|
|
|
2072
|
-
|
|
2097
|
+
interface RecipeLifecycle {
|
|
2073
2098
|
mode?: "persistent" | "ephemeral";
|
|
2074
2099
|
idleTimeoutMs?: number;
|
|
2075
2100
|
memory?: RecipeMemoryPolicy;
|
|
@@ -2186,7 +2211,7 @@ export interface TokenConstraints {
|
|
|
2186
2211
|
canDelegate?: boolean;
|
|
2187
2212
|
}
|
|
2188
2213
|
|
|
2189
|
-
|
|
2214
|
+
type TokenScope =
|
|
2190
2215
|
| "system:admin"
|
|
2191
2216
|
| "token:read"
|
|
2192
2217
|
| "token:write"
|
|
@@ -2291,7 +2316,7 @@ export function errMessage(error: unknown): string {
|
|
|
2291
2316
|
// --- Relay connection defaults ---
|
|
2292
2317
|
|
|
2293
2318
|
/** Default port the relay server listens on. */
|
|
2294
|
-
|
|
2319
|
+
const DEFAULT_RELAY_PORT = 4850;
|
|
2295
2320
|
|
|
2296
2321
|
/** Default relay base URL. Loopback spelling settled on `127.0.0.1` (not `localhost`). */
|
|
2297
2322
|
export const DEFAULT_RELAY_URL = `http://127.0.0.1:${DEFAULT_RELAY_PORT}`;
|