hiveagents-runtime 0.0.0-stage → 0.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +85 -2
- package/dist/adapter-kit.d.ts +37 -0
- package/dist/adapter-kit.js +33 -0
- package/dist/adapter-kit.js.map +1 -0
- package/dist/agent-D0HS38G3.d.ts +169 -0
- package/dist/agent-OLSXNGNN.js +23 -0
- package/dist/agent-OLSXNGNN.js.map +1 -0
- package/dist/agent-readiness-V36OJME4.js +19 -0
- package/dist/agent-readiness-V36OJME4.js.map +1 -0
- package/dist/capture-runtime-GP6NZ2ee.d.ts +54 -0
- package/dist/chunk-2RUEC63U.js +1217 -0
- package/dist/chunk-2RUEC63U.js.map +1 -0
- package/dist/chunk-3B3JW4U3.js +291 -0
- package/dist/chunk-3B3JW4U3.js.map +1 -0
- package/dist/chunk-3TIYA3K5.js +55 -0
- package/dist/chunk-3TIYA3K5.js.map +1 -0
- package/dist/chunk-6XIJW65Q.js +52 -0
- package/dist/chunk-6XIJW65Q.js.map +1 -0
- package/dist/chunk-7LDQKJKI.js +248 -0
- package/dist/chunk-7LDQKJKI.js.map +1 -0
- package/dist/chunk-ALLOMOUN.js +810 -0
- package/dist/chunk-ALLOMOUN.js.map +1 -0
- package/dist/chunk-C2DN6KL4.js +853 -0
- package/dist/chunk-C2DN6KL4.js.map +1 -0
- package/dist/chunk-COKYQUTK.js +581 -0
- package/dist/chunk-COKYQUTK.js.map +1 -0
- package/dist/chunk-CPN4DOXH.js +115 -0
- package/dist/chunk-CPN4DOXH.js.map +1 -0
- package/dist/chunk-DBFXFWQZ.js +385 -0
- package/dist/chunk-DBFXFWQZ.js.map +1 -0
- package/dist/chunk-DZFFGUIA.js +81 -0
- package/dist/chunk-DZFFGUIA.js.map +1 -0
- package/dist/chunk-EEUYQFCP.js +106 -0
- package/dist/chunk-EEUYQFCP.js.map +1 -0
- package/dist/chunk-GFVYNPLS.js +118 -0
- package/dist/chunk-GFVYNPLS.js.map +1 -0
- package/dist/chunk-GJ4FTDBJ.js +2910 -0
- package/dist/chunk-GJ4FTDBJ.js.map +1 -0
- package/dist/chunk-GS5U3KUN.js +201 -0
- package/dist/chunk-GS5U3KUN.js.map +1 -0
- package/dist/chunk-HB7FBSH2.js +960 -0
- package/dist/chunk-HB7FBSH2.js.map +1 -0
- package/dist/chunk-HZFZX5A3.js +21 -0
- package/dist/chunk-HZFZX5A3.js.map +1 -0
- package/dist/chunk-J7VAYJKM.js +595 -0
- package/dist/chunk-J7VAYJKM.js.map +1 -0
- package/dist/chunk-NCNSHOF7.js +52 -0
- package/dist/chunk-NCNSHOF7.js.map +1 -0
- package/dist/chunk-RXU2Q2HF.js +49 -0
- package/dist/chunk-RXU2Q2HF.js.map +1 -0
- package/dist/chunk-SRJUZJKV.js +521 -0
- package/dist/chunk-SRJUZJKV.js.map +1 -0
- package/dist/chunk-TG7NTMTR.js +208 -0
- package/dist/chunk-TG7NTMTR.js.map +1 -0
- package/dist/chunk-TIZKGD4R.js +202 -0
- package/dist/chunk-TIZKGD4R.js.map +1 -0
- package/dist/chunk-WMKO5XOE.js +601 -0
- package/dist/chunk-WMKO5XOE.js.map +1 -0
- package/dist/chunk-WOQBVJH5.js +175 -0
- package/dist/chunk-WOQBVJH5.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +25 -0
- package/dist/cli.js.map +1 -0
- package/dist/errors-DgehLwqI.d.ts +98 -0
- package/dist/execution-halt-CW0Oi9s9.d.ts +12 -0
- package/dist/execution-types-UJ6gAF48.d.ts +239 -0
- package/dist/host-ledger-VPRWVVOS.js +25 -0
- package/dist/host-ledger-VPRWVVOS.js.map +1 -0
- package/dist/hosted-runtime.d.ts +168 -0
- package/dist/hosted-runtime.js +857 -0
- package/dist/hosted-runtime.js.map +1 -0
- package/dist/index-B86C6VAD.d.ts +41 -0
- package/dist/index.d.ts +327 -0
- package/dist/index.js +8818 -0
- package/dist/index.js.map +1 -0
- package/dist/memory-items-BSTC0_R0.d.ts +28 -0
- package/dist/memory-tools.d.ts +222 -0
- package/dist/memory-tools.js +923 -0
- package/dist/memory-tools.js.map +1 -0
- package/dist/orchestration/dynamic.d.ts +854 -0
- package/dist/orchestration/dynamic.js +3150 -0
- package/dist/orchestration/dynamic.js.map +1 -0
- package/dist/orchestration/graph.d.ts +11 -0
- package/dist/orchestration/graph.js +9 -0
- package/dist/orchestration/graph.js.map +1 -0
- package/dist/orchestration/index.d.ts +2385 -0
- package/dist/orchestration/index.js +6403 -0
- package/dist/orchestration/index.js.map +1 -0
- package/dist/orchestration/log.d.ts +301 -0
- package/dist/orchestration/log.js +3058 -0
- package/dist/orchestration/log.js.map +1 -0
- package/dist/orchestration/memory.d.ts +711 -0
- package/dist/orchestration/memory.js +27 -0
- package/dist/orchestration/memory.js.map +1 -0
- package/dist/provider-XCpWjJ6a.d.ts +151 -0
- package/dist/routing/index.d.ts +29 -0
- package/dist/routing/index.js +385 -0
- package/dist/routing/index.js.map +1 -0
- package/dist/routing/learning/index.d.ts +433 -0
- package/dist/routing/learning/index.js +2501 -0
- package/dist/routing/learning/index.js.map +1 -0
- package/dist/runtime-C6Cu2fvw.d.ts +283 -0
- package/dist/runtime-Y72XJFFO.js +18 -0
- package/dist/runtime-Y72XJFFO.js.map +1 -0
- package/dist/store-types-2YdceOMy.d.ts +78 -0
- package/dist/types-BB7KqceP.d.ts +52 -0
- package/dist/types-BBRKjIc7.d.ts +86 -0
- package/dist/types-DTFc1qO6.d.ts +1065 -0
- package/dist/types-DYex3p7_.d.ts +88 -0
- package/docs/licenses/ruflo-memory-MIT.txt +21 -0
- package/docs/releases/0.1.0-beta.1.md +13 -0
- package/package.json +114 -4
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { J as JsonValue } from './types-DYex3p7_.js';
|
|
2
|
+
import { U as Usage, A as AgentEvent } from './types-DTFc1qO6.js';
|
|
3
|
+
import { E as ExecutionHaltedError } from './execution-halt-CW0Oi9s9.js';
|
|
4
|
+
import { P as PayloadReference, R as RunIdentity } from './types-BB7KqceP.js';
|
|
5
|
+
|
|
6
|
+
interface DecisionBinding {
|
|
7
|
+
readonly input: JsonValue;
|
|
8
|
+
readonly inputHash: string;
|
|
9
|
+
readonly authorityHash: string;
|
|
10
|
+
readonly inputVersion: string;
|
|
11
|
+
readonly authorityVersion: string;
|
|
12
|
+
}
|
|
13
|
+
interface DecisionAuthorization {
|
|
14
|
+
decision: 'allow' | 'wait' | 'deny';
|
|
15
|
+
reason: string;
|
|
16
|
+
/** Epoch milliseconds; checked again after async authorization and durable intent persistence. */
|
|
17
|
+
expiresAt: number;
|
|
18
|
+
nextAt?: number;
|
|
19
|
+
}
|
|
20
|
+
interface DecisionReceipt {
|
|
21
|
+
intentId: string;
|
|
22
|
+
inputHash: string;
|
|
23
|
+
authorityHash: string;
|
|
24
|
+
inputVersion: string;
|
|
25
|
+
authorityVersion: string;
|
|
26
|
+
approval: DecisionAuthorization;
|
|
27
|
+
resultHash: string;
|
|
28
|
+
evidence: string[];
|
|
29
|
+
verifiedAt: number;
|
|
30
|
+
}
|
|
31
|
+
interface DecisionRecord {
|
|
32
|
+
format: 1;
|
|
33
|
+
id: string;
|
|
34
|
+
binding: DecisionBinding;
|
|
35
|
+
status: 'waiting' | 'denied' | 'intent' | 'dispatched' | 'verified' | 'needs-owner';
|
|
36
|
+
attempts: number;
|
|
37
|
+
reason: string;
|
|
38
|
+
authorization?: DecisionAuthorization;
|
|
39
|
+
intentId?: string;
|
|
40
|
+
result?: JsonValue;
|
|
41
|
+
receipt?: DecisionReceipt;
|
|
42
|
+
}
|
|
43
|
+
/** App-owned, exclusive for the entire run including callback drainage. No expiry-based takeover. */
|
|
44
|
+
interface DecisionLease {
|
|
45
|
+
load(): Promise<unknown | undefined>;
|
|
46
|
+
/** Atomic durable replacement; rejection must never be reported as a completed effect. */
|
|
47
|
+
save(record: DecisionRecord): Promise<void>;
|
|
48
|
+
release(): Promise<void>;
|
|
49
|
+
}
|
|
50
|
+
interface DecisionStore {
|
|
51
|
+
acquire(id: string): Promise<DecisionLease>;
|
|
52
|
+
}
|
|
53
|
+
interface DecisionContext {
|
|
54
|
+
readonly id: string;
|
|
55
|
+
readonly binding: DecisionBinding;
|
|
56
|
+
readonly signal: AbortSignal;
|
|
57
|
+
}
|
|
58
|
+
interface DecisionEffectContext extends DecisionContext {
|
|
59
|
+
readonly intentId: string;
|
|
60
|
+
readonly attempt: number;
|
|
61
|
+
}
|
|
62
|
+
interface DecisionRunOptions {
|
|
63
|
+
id: string;
|
|
64
|
+
binding: DecisionBinding;
|
|
65
|
+
signal?: AbortSignal;
|
|
66
|
+
now?: () => number;
|
|
67
|
+
/** App condition only; a true condition never grants authority. */
|
|
68
|
+
condition?: (context: DecisionContext) => boolean | Promise<boolean>;
|
|
69
|
+
/** Trusted application port; called afresh immediately before every new dispatch. */
|
|
70
|
+
authorize(context: DecisionContext): DecisionAuthorization | Promise<DecisionAuthorization>;
|
|
71
|
+
/** Synchronous trusted check of live input/authority identity after persistence, immediately before dispatch.
|
|
72
|
+
* execute must check again at its own effect boundary if it awaits other work first. */
|
|
73
|
+
isCurrent(context: DecisionContext): boolean;
|
|
74
|
+
execute(context: DecisionEffectContext): JsonValue | Promise<JsonValue>;
|
|
75
|
+
verify(result: JsonValue, context: DecisionEffectContext): {
|
|
76
|
+
verified: boolean;
|
|
77
|
+
evidence: readonly string[];
|
|
78
|
+
} | Promise<{
|
|
79
|
+
verified: boolean;
|
|
80
|
+
evidence: readonly string[];
|
|
81
|
+
}>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface TraceIdentity {
|
|
85
|
+
episodeId: string;
|
|
86
|
+
task: {
|
|
87
|
+
id: string;
|
|
88
|
+
version: string;
|
|
89
|
+
inputDigest: string;
|
|
90
|
+
};
|
|
91
|
+
source: {
|
|
92
|
+
id: string;
|
|
93
|
+
version: string;
|
|
94
|
+
digest: string;
|
|
95
|
+
};
|
|
96
|
+
profile: {
|
|
97
|
+
id: string;
|
|
98
|
+
version: string;
|
|
99
|
+
digest: string;
|
|
100
|
+
};
|
|
101
|
+
provider?: string;
|
|
102
|
+
model?: string;
|
|
103
|
+
transport?: string;
|
|
104
|
+
cliVersion?: string;
|
|
105
|
+
}
|
|
106
|
+
/** Metadata only. Arbitrary fields, free text, raw provider events and tool payloads are rejected. */
|
|
107
|
+
interface TraceEventInput {
|
|
108
|
+
type: string;
|
|
109
|
+
phaseId?: string;
|
|
110
|
+
parentId?: string;
|
|
111
|
+
sessionId?: string;
|
|
112
|
+
turnId?: string;
|
|
113
|
+
status?: string;
|
|
114
|
+
code?: string;
|
|
115
|
+
count?: number;
|
|
116
|
+
toolId?: string;
|
|
117
|
+
subagentId?: string;
|
|
118
|
+
interactionId?: string;
|
|
119
|
+
usage?: Usage;
|
|
120
|
+
}
|
|
121
|
+
interface TraceEntry extends TraceEventInput {
|
|
122
|
+
sequence: number;
|
|
123
|
+
timestamp: number;
|
|
124
|
+
}
|
|
125
|
+
type TraceTerminalStatus = 'completed' | 'failed' | 'cancelled';
|
|
126
|
+
interface TraceEpisode {
|
|
127
|
+
format: 1;
|
|
128
|
+
identity: TraceIdentity;
|
|
129
|
+
status: 'running' | TraceTerminalStatus;
|
|
130
|
+
startedAt: number;
|
|
131
|
+
updatedAt: number;
|
|
132
|
+
finishedAt?: number;
|
|
133
|
+
entries: readonly TraceEntry[];
|
|
134
|
+
/** Corruption checksum, not an authentication signature against store writers. */
|
|
135
|
+
digest: string;
|
|
136
|
+
}
|
|
137
|
+
/** Trusted app port: exclusive across all clients for this episode; never expires active ownership. */
|
|
138
|
+
interface TraceLease {
|
|
139
|
+
load(): Promise<unknown | undefined>;
|
|
140
|
+
/** Atomic durable save. Reject failures rather than reporting undurable progress. */
|
|
141
|
+
save(episode: TraceEpisode): Promise<void>;
|
|
142
|
+
release(): Promise<void>;
|
|
143
|
+
}
|
|
144
|
+
interface TraceStore {
|
|
145
|
+
acquire(episodeId: string): Promise<TraceLease>;
|
|
146
|
+
}
|
|
147
|
+
interface TraceWriter {
|
|
148
|
+
append(event: TraceEventInput): Promise<void>;
|
|
149
|
+
observe?(event: AgentEvent): Promise<void>;
|
|
150
|
+
}
|
|
151
|
+
interface TraceRecorder extends TraceWriter {
|
|
152
|
+
observe(event: AgentEvent): Promise<void>;
|
|
153
|
+
snapshot(): TraceEpisode;
|
|
154
|
+
finish(status: TraceTerminalStatus): Promise<TraceEpisode>;
|
|
155
|
+
/** Waits for already submitted writes, then releases. Safe to call more than once. */
|
|
156
|
+
close(): Promise<void>;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
interface LogArtifactBinding {
|
|
160
|
+
readonly sourceId: string;
|
|
161
|
+
readonly systemId: string;
|
|
162
|
+
readonly generation: number;
|
|
163
|
+
}
|
|
164
|
+
interface LogArtifactOptions {
|
|
165
|
+
readonly directory: string;
|
|
166
|
+
readonly binding: LogArtifactBinding;
|
|
167
|
+
readonly maxBytes?: number;
|
|
168
|
+
readonly maxPending?: number;
|
|
169
|
+
}
|
|
170
|
+
interface LogArtifactReadOptions {
|
|
171
|
+
readonly signal?: AbortSignal;
|
|
172
|
+
}
|
|
173
|
+
interface LogArtifactWriteOptions extends LogArtifactReadOptions {
|
|
174
|
+
readonly mediaType: PayloadReference['mediaType'];
|
|
175
|
+
}
|
|
176
|
+
/** Byte integrity/durability data only, never execution, recovery or release permission. */
|
|
177
|
+
interface LogArtifactVerification {
|
|
178
|
+
readonly kind: 'verified' | 'missing' | 'corrupt';
|
|
179
|
+
readonly reference: PayloadReference;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** Optional private artifact storage. Refs/pins are DATA; the execution log owns its transactional reference records. No GC or permission API. */
|
|
183
|
+
declare function createLogArtifactStore(input: LogArtifactOptions): Promise<Readonly<{
|
|
184
|
+
write(input: string | Uint8Array, operation: LogArtifactWriteOptions): Promise<PayloadReference>;
|
|
185
|
+
verify(input: PayloadReference, operation?: LogArtifactReadOptions): Promise<LogArtifactVerification>;
|
|
186
|
+
read(input: PayloadReference, operation?: LogArtifactReadOptions): Promise<Uint8Array>;
|
|
187
|
+
snapshot: () => Readonly<{
|
|
188
|
+
faulted: boolean;
|
|
189
|
+
quarantined: number;
|
|
190
|
+
pending: number;
|
|
191
|
+
maxPending: number;
|
|
192
|
+
maxBytes: number;
|
|
193
|
+
}>;
|
|
194
|
+
}>>;
|
|
195
|
+
|
|
196
|
+
type ExecutionArtifactStore = Pick<Awaited<ReturnType<typeof createLogArtifactStore>>, 'write' | 'read' | 'verify'>;
|
|
197
|
+
interface LogExecutionDatabaseOptions {
|
|
198
|
+
readonly databasePath: string;
|
|
199
|
+
readonly systemId: string;
|
|
200
|
+
readonly busyTimeoutMs?: number;
|
|
201
|
+
readonly artifactStore?: ExecutionArtifactStore;
|
|
202
|
+
readonly maxRecordBytes?: number;
|
|
203
|
+
}
|
|
204
|
+
interface ManagedEffectAssociation {
|
|
205
|
+
readonly identity: RunIdentity;
|
|
206
|
+
readonly stepId: string;
|
|
207
|
+
readonly effectKey: string;
|
|
208
|
+
readonly operation: Readonly<{
|
|
209
|
+
id: string;
|
|
210
|
+
version: string;
|
|
211
|
+
targetDigest: string;
|
|
212
|
+
contentDigest: string;
|
|
213
|
+
provider?: string;
|
|
214
|
+
model?: string;
|
|
215
|
+
}>;
|
|
216
|
+
readonly parentEffectKey?: string;
|
|
217
|
+
}
|
|
218
|
+
interface CapturedEffectAssociation extends ManagedEffectAssociation {
|
|
219
|
+
readonly sourceId: string;
|
|
220
|
+
}
|
|
221
|
+
interface ExecutionOwnership {
|
|
222
|
+
readonly format: 1;
|
|
223
|
+
readonly sourceId: string;
|
|
224
|
+
readonly kind: 'decision' | 'workflow';
|
|
225
|
+
readonly runKey: string;
|
|
226
|
+
readonly identity: RunIdentity;
|
|
227
|
+
readonly ownerId: string;
|
|
228
|
+
}
|
|
229
|
+
interface StandaloneStoppedAcknowledgement {
|
|
230
|
+
readonly ownerStopped: true;
|
|
231
|
+
}
|
|
232
|
+
type LogExecutionFailure = 'INVALID_STATE' | 'STORAGE_UNCERTAIN' | 'INTEGRITY' | 'RUN_OWNED' | 'EFFECT_BINDING_CONFLICT' | 'OUTCOME_UNKNOWN' | 'CLOSED' | 'PAYLOAD_CODEC_REQUIRED' | 'PAYLOAD_UNAVAILABLE' | 'CODEC_LIMIT' | 'CODEC_BUSY';
|
|
233
|
+
/** Nominal SDK halt: infrastructure/effect uncertainty is not negative model-quality evidence. */
|
|
234
|
+
declare class LogExecutionError extends ExecutionHaltedError {
|
|
235
|
+
readonly reason: LogExecutionFailure;
|
|
236
|
+
constructor(reason: LogExecutionFailure);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export { type CapturedEffectAssociation as C, type DecisionBinding as D, type ExecutionOwnership as E, type LogExecutionDatabaseOptions as L, type ManagedEffectAssociation as M, type StandaloneStoppedAcknowledgement as S, type TraceEventInput as T, type DecisionRecord as a, type DecisionStore as b, type DecisionLease as c, type ExecutionArtifactStore as d, type LogArtifactBinding as e, type LogArtifactOptions as f, type LogArtifactReadOptions as g, type LogArtifactVerification as h, type LogArtifactWriteOptions as i, LogExecutionError as j, type LogExecutionFailure as k, createLogArtifactStore as l, type DecisionRunOptions as m, type TraceStore as n, type TraceIdentity as o, type TraceRecorder as p, type TraceEpisode as q, type TraceLease as r, type DecisionContext as s, type DecisionEffectContext as t, type DecisionAuthorization as u, type DecisionReceipt as v, type TraceEntry as w, type TraceTerminalStatus as x, type TraceWriter as y };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HOST_LAUNCH_LIMITS,
|
|
3
|
+
HostLedger,
|
|
4
|
+
LaunchQuotaRecordError,
|
|
5
|
+
LaunchRefusedError,
|
|
6
|
+
LaunchReleaseError,
|
|
7
|
+
WAITER_LEASE_MS,
|
|
8
|
+
hostLaunchLimits,
|
|
9
|
+
hostLedgerPath,
|
|
10
|
+
inspectLegacyLaunchBudget
|
|
11
|
+
} from "./chunk-HB7FBSH2.js";
|
|
12
|
+
import "./chunk-RXU2Q2HF.js";
|
|
13
|
+
import "./chunk-TG7NTMTR.js";
|
|
14
|
+
export {
|
|
15
|
+
HOST_LAUNCH_LIMITS,
|
|
16
|
+
HostLedger,
|
|
17
|
+
LaunchQuotaRecordError,
|
|
18
|
+
LaunchRefusedError,
|
|
19
|
+
LaunchReleaseError,
|
|
20
|
+
WAITER_LEASE_MS,
|
|
21
|
+
hostLaunchLimits,
|
|
22
|
+
hostLedgerPath,
|
|
23
|
+
inspectLegacyLaunchBudget
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=host-ledger-VPRWVVOS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { b as AdmissionRefusalReason } from './errors-DgehLwqI.js';
|
|
2
|
+
import { P as ProviderRegistration, R as Runtime } from './runtime-C6Cu2fvw.js';
|
|
3
|
+
import { M as ModelInfo, C as CapabilitySupport, d as AgentOptions } from './types-DTFc1qO6.js';
|
|
4
|
+
import { P as ProcessRunner, a as ExecProbeTurn, f as ExecTurnRequest } from './provider-XCpWjJ6a.js';
|
|
5
|
+
import { R as RuntimeCaptureOptions } from './capture-runtime-GP6NZ2ee.js';
|
|
6
|
+
import './types-BB7KqceP.js';
|
|
7
|
+
|
|
8
|
+
type HostedJson = null | boolean | number | string | HostedJson[] | {
|
|
9
|
+
[key: string]: HostedJson;
|
|
10
|
+
};
|
|
11
|
+
interface HostedRecipeDescriptor {
|
|
12
|
+
readonly recipeId: string;
|
|
13
|
+
readonly recipeDigest: string;
|
|
14
|
+
readonly contextArgs: readonly string[];
|
|
15
|
+
readonly permissionArgs: readonly string[];
|
|
16
|
+
readonly providerOptionsDigest: string;
|
|
17
|
+
readonly clientEnvironmentPolicyDigest: string;
|
|
18
|
+
readonly environmentPolicyId: string;
|
|
19
|
+
readonly modelIds: readonly string[];
|
|
20
|
+
readonly efforts: readonly string[];
|
|
21
|
+
readonly allowInstructions: boolean;
|
|
22
|
+
readonly cwdRoots: readonly string[];
|
|
23
|
+
}
|
|
24
|
+
interface HostedProviderDescriptor {
|
|
25
|
+
readonly schemaVersion: 1;
|
|
26
|
+
readonly provider: string;
|
|
27
|
+
readonly bindingId: string;
|
|
28
|
+
readonly bindingDigest: string;
|
|
29
|
+
readonly token: string;
|
|
30
|
+
readonly adapterVersion: string;
|
|
31
|
+
readonly modelCatalog: readonly ModelInfo[];
|
|
32
|
+
readonly execCapabilities: Readonly<Record<string, CapabilitySupport>>;
|
|
33
|
+
readonly target: Readonly<{
|
|
34
|
+
command: string;
|
|
35
|
+
argsPrefix: readonly string[];
|
|
36
|
+
executableDigest: string;
|
|
37
|
+
identityFiles: readonly string[];
|
|
38
|
+
}>;
|
|
39
|
+
readonly probeRecipeId: string;
|
|
40
|
+
readonly limits: Readonly<{
|
|
41
|
+
maxTurnMs: number;
|
|
42
|
+
maxProbeMs: number;
|
|
43
|
+
maxOutputBytes: number;
|
|
44
|
+
}>;
|
|
45
|
+
readonly recipes: readonly HostedRecipeDescriptor[];
|
|
46
|
+
}
|
|
47
|
+
interface HostedTurnPayload {
|
|
48
|
+
readonly mode: 'open' | 'resume' | 'fork' | 'one-shot';
|
|
49
|
+
readonly modelId: string;
|
|
50
|
+
readonly cwd: string;
|
|
51
|
+
readonly prompt: string;
|
|
52
|
+
readonly timeoutMs: number;
|
|
53
|
+
readonly maxOutputBytes: number;
|
|
54
|
+
readonly sessionId?: string;
|
|
55
|
+
readonly instructions?: string;
|
|
56
|
+
readonly effort?: string;
|
|
57
|
+
readonly outputSchema?: {
|
|
58
|
+
[key: string]: HostedJson;
|
|
59
|
+
};
|
|
60
|
+
readonly intentId?: string;
|
|
61
|
+
/**
|
|
62
|
+
* A request to wait behind every default turn for the host's admission. The only value is `low`:
|
|
63
|
+
* a worker may lower a turn (a rehearsal), never raise one. Absent means the default priority.
|
|
64
|
+
*/
|
|
65
|
+
readonly priority?: 'low';
|
|
66
|
+
}
|
|
67
|
+
interface RequestBase {
|
|
68
|
+
readonly schemaVersion: 1;
|
|
69
|
+
readonly channelId: string;
|
|
70
|
+
readonly systemId: string;
|
|
71
|
+
readonly generation: number;
|
|
72
|
+
readonly bindingId: string;
|
|
73
|
+
readonly requestId: string;
|
|
74
|
+
readonly remainingMs: number;
|
|
75
|
+
}
|
|
76
|
+
type HostedRequest = RequestBase & ({
|
|
77
|
+
readonly method: 'detect' | 'auth' | 'models' | 'compatibility';
|
|
78
|
+
readonly recipeId: string;
|
|
79
|
+
readonly cwd: string;
|
|
80
|
+
} | {
|
|
81
|
+
readonly method: 'execute' | 'stream-open';
|
|
82
|
+
readonly recipeId: string;
|
|
83
|
+
readonly turn: HostedTurnPayload;
|
|
84
|
+
} | {
|
|
85
|
+
readonly method: 'stream-next' | 'stream-return' | 'stream-throw' | 'status';
|
|
86
|
+
readonly operationId: string;
|
|
87
|
+
} | {
|
|
88
|
+
readonly method: 'cancel';
|
|
89
|
+
readonly targetRequestId: string;
|
|
90
|
+
} | {
|
|
91
|
+
readonly method: 'intent-begin';
|
|
92
|
+
readonly turnId: string;
|
|
93
|
+
readonly semanticDigest: string;
|
|
94
|
+
} | {
|
|
95
|
+
readonly method: 'intent-finish';
|
|
96
|
+
readonly intentId: string;
|
|
97
|
+
});
|
|
98
|
+
type HostedErrorCode = 'ADMISSION_REFUSED' | 'EXECUTION_HALTED' | 'USAGE_LIMIT' | 'UNSUPPORTED_CAPABILITY' | 'INVALID_RUNTIME_PROTOCOL' | 'ABORTED' | 'TIMEOUT' | 'OUTPUT_LIMIT' | 'PROVIDER_UNAVAILABLE' | 'NOT_AUTHENTICATED';
|
|
99
|
+
type HostedErrorWire = Readonly<{
|
|
100
|
+
code: 'ADMISSION_REFUSED';
|
|
101
|
+
reason: AdmissionRefusalReason;
|
|
102
|
+
receiptDigest: string;
|
|
103
|
+
}> | Readonly<{
|
|
104
|
+
code: Exclude<HostedErrorCode, 'ADMISSION_REFUSED'>;
|
|
105
|
+
receiptDigest?: string;
|
|
106
|
+
}>;
|
|
107
|
+
type HostedReply = Omit<RequestBase, 'remainingMs'> & ({
|
|
108
|
+
readonly ok: true;
|
|
109
|
+
readonly data: HostedJson;
|
|
110
|
+
} | {
|
|
111
|
+
readonly ok: false;
|
|
112
|
+
readonly error: HostedErrorWire;
|
|
113
|
+
});
|
|
114
|
+
/** Trusted local transport facade built by Root bootstrap. It is never serialized or host authority. */
|
|
115
|
+
interface HostedRuntimeClient {
|
|
116
|
+
call(request: HostedRequest, options?: {
|
|
117
|
+
readonly signal?: AbortSignal;
|
|
118
|
+
readonly remainingMs?: number;
|
|
119
|
+
}): Promise<HostedReply>;
|
|
120
|
+
close(): void;
|
|
121
|
+
}
|
|
122
|
+
interface HostedWorkerContext {
|
|
123
|
+
readonly schemaVersion: 1;
|
|
124
|
+
readonly channelId: string;
|
|
125
|
+
readonly systemId: string;
|
|
126
|
+
readonly generation: number;
|
|
127
|
+
readonly dataDirectory: string;
|
|
128
|
+
readonly descriptors: readonly HostedProviderDescriptor[];
|
|
129
|
+
readonly client: HostedRuntimeClient;
|
|
130
|
+
}
|
|
131
|
+
/** Trusted fingerprinted worker code only, never a factory/module name supplied over RPC. */
|
|
132
|
+
interface HostedProxyFactory {
|
|
133
|
+
readonly id: string;
|
|
134
|
+
create(options: {
|
|
135
|
+
runner: ProcessRunner;
|
|
136
|
+
probeRunner: ProcessRunner;
|
|
137
|
+
}): ProviderRegistration;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
declare function hostedDigest(value: unknown): string;
|
|
141
|
+
|
|
142
|
+
declare function captureHostedDescriptor(input: unknown): HostedProviderDescriptor;
|
|
143
|
+
declare function captureHostedRequest(input: unknown): HostedRequest;
|
|
144
|
+
declare function captureHostedReply(input: unknown): HostedReply;
|
|
145
|
+
|
|
146
|
+
/** A per-run capture scope reuses this worker's negotiated providers, transport and admission port. */
|
|
147
|
+
declare function createHostedRunRuntime(parent: Runtime, capture: RuntimeCaptureOptions): Runtime;
|
|
148
|
+
declare function createHostedRuntime(input: HostedWorkerContext, options?: {
|
|
149
|
+
providers?: readonly HostedProxyFactory[];
|
|
150
|
+
}): Runtime;
|
|
151
|
+
|
|
152
|
+
declare function createRecipeMatcher(d: HostedProviderDescriptor): {
|
|
153
|
+
validate(options: Readonly<AgentOptions>): void;
|
|
154
|
+
probe: (env: NodeJS.ProcessEnv, turn?: ExecProbeTurn) => HostedRecipeDescriptor;
|
|
155
|
+
turn: (turn: ExecTurnRequest) => HostedRecipeDescriptor;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* `priority: 'low'` makes every turn of this intent wait behind default turns for the host's admission
|
|
160
|
+
* (a rehearsal). It is the only accepted value: a caller can lower its own turns, never raise them.
|
|
161
|
+
*/
|
|
162
|
+
declare function withHostedTurnIntent<T>(runtime: Runtime, options: {
|
|
163
|
+
turnId?: string;
|
|
164
|
+
signal?: AbortSignal;
|
|
165
|
+
priority?: 'low';
|
|
166
|
+
}, work: () => T | Promise<T>): Promise<T>;
|
|
167
|
+
|
|
168
|
+
export { type HostedErrorCode, type HostedErrorWire, type HostedJson, type HostedProviderDescriptor, type HostedProxyFactory, type HostedRecipeDescriptor, type HostedReply, type HostedRequest, type HostedRuntimeClient, type HostedTurnPayload, type HostedWorkerContext, captureHostedDescriptor, captureHostedReply, captureHostedRequest, createHostedRunRuntime, createHostedRuntime, createRecipeMatcher, hostedDigest, withHostedTurnIntent };
|