@synadia-ai/agent-fabric 0.1.0 → 0.2.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/CHANGELOG.md +14 -1
- package/README.md +104 -0
- package/dist/cli.cjs +681 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.js +679 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +973 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +258 -9
- package/dist/index.d.ts +258 -9
- package/dist/index.js +962 -67
- package/dist/index.js.map +1 -1
- package/examples/answer-questions.mjs +33 -0
- package/examples/ask.mjs +22 -0
- package/examples/every.mjs +28 -0
- package/examples/list-agents.mjs +21 -0
- package/examples/prompt.mjs +25 -0
- package/package.json +6 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequestInterceptor, AgentServiceExtraEndpoint, AgentService } from '@synadia-ai/agent-service';
|
|
2
|
-
import { AgentId, PromptInterceptor, Agents, Logger, AgentToolsExtension, SenderInfo,
|
|
2
|
+
import { AgentId, PromptInterceptor, PromptOptions, QueryEvent, StreamMessage, PromptStream, Agents, Agent, Logger, AgentToolsExtension, SenderInfo, AgentToolsPromptContext, AgentToolsPromptRewrite, AgentToolsReplyContext, NatsConnectionSource } from '@synadia-ai/agents';
|
|
3
3
|
import { NatsConnection } from '@nats-io/nats-core';
|
|
4
4
|
|
|
5
5
|
declare const EDGE_RECORD_VERSION = 1;
|
|
@@ -165,6 +165,123 @@ interface FabricTracing {
|
|
|
165
165
|
*/
|
|
166
166
|
declare function fabricTracing(options?: TraceOptions): FabricTracing;
|
|
167
167
|
|
|
168
|
+
/** The inbox prefix a caller's permissions allow it to receive on. */
|
|
169
|
+
declare const CALLER_INBOX_PREFIX = "_INBOX.agents";
|
|
170
|
+
/** What `ask()` replies to a question from the agent when no `onQuery` is given. */
|
|
171
|
+
declare const CANNOT_ANSWER = "The caller is a command line and cannot answer; continue with your best judgement.";
|
|
172
|
+
/** How long `list()` and `find()` listen for agents, by default. */
|
|
173
|
+
declare const DEFAULT_DISCOVER_TIMEOUT_MS = 1000;
|
|
174
|
+
/** The variables {@link fabricCallerFromEnv} reads. */
|
|
175
|
+
declare const NATS_URL_VAR = "NATS_URL";
|
|
176
|
+
declare const NATS_CREDS_VAR = "NATS_CREDS";
|
|
177
|
+
/**
|
|
178
|
+
* Why a caller could not be set up, could not find its agent, or has no
|
|
179
|
+
* root for a prompt: `config` (a missing or invalid setting), `connect`
|
|
180
|
+
* (no connection), `identity` (the server would not say who the creds
|
|
181
|
+
* file is), `not-found`, `ambiguous`, `not-sent` (the prompt ended before
|
|
182
|
+
* it went out, so it has no root).
|
|
183
|
+
*/
|
|
184
|
+
type FabricCallerErrorReason = "config" | "connect" | "identity" | "not-found" | "ambiguous" | "not-sent";
|
|
185
|
+
/** A caller's own error: a missing setting, no connection, no identity, or no such agent. */
|
|
186
|
+
declare class FabricCallerError extends Error {
|
|
187
|
+
readonly reason: FabricCallerErrorReason;
|
|
188
|
+
constructor(reason: FabricCallerErrorReason, message: string);
|
|
189
|
+
}
|
|
190
|
+
interface FabricCallerOptions {
|
|
191
|
+
/** The path to the creds file. */
|
|
192
|
+
readonly creds: string;
|
|
193
|
+
/**
|
|
194
|
+
* The server's URL, as the console showed it next to the creds file.
|
|
195
|
+
* Default: `NATS_URL`. There is no built-in default.
|
|
196
|
+
*/
|
|
197
|
+
readonly url?: string;
|
|
198
|
+
/** The client's name, on the connection and in its identity. */
|
|
199
|
+
readonly name?: string;
|
|
200
|
+
/** Where the edge records go; `null` publishes none. Default: tracing's. */
|
|
201
|
+
readonly edgeSubject?: TraceOptions["edgeSubject"];
|
|
202
|
+
}
|
|
203
|
+
/** A prompt on its way: its stream, and the root of the task it starts. */
|
|
204
|
+
interface CallerPrompt {
|
|
205
|
+
/** The SDK's `PromptStream`, passed through: iterate it for the reply. */
|
|
206
|
+
readonly stream: CallerStream;
|
|
207
|
+
/**
|
|
208
|
+
* The root id of the task the prompt starts. Resolves at the stream's
|
|
209
|
+
* first iteration, before any chunk arrives; await it after iteration
|
|
210
|
+
* has begun, never before. Rejects with a {@link FabricCallerError}
|
|
211
|
+
* (`not-sent`), or the stream's own error, when the prompt ends before
|
|
212
|
+
* it goes out: cancelled, refused before it was sent, or failed.
|
|
213
|
+
*/
|
|
214
|
+
readonly rootId: Promise<string>;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* The SDK's `PromptStream`, with the prompt's root settled when iteration
|
|
218
|
+
* ends or fails before the prompt went out. The messages are the SDK's,
|
|
219
|
+
* unchanged.
|
|
220
|
+
*/
|
|
221
|
+
declare class CallerStream implements AsyncIterable<StreamMessage> {
|
|
222
|
+
#private;
|
|
223
|
+
constructor(inner: PromptStream, sink: RootSink);
|
|
224
|
+
/** The subject the prompt is published to. */
|
|
225
|
+
get subject(): string;
|
|
226
|
+
/** Stop the stream, as `PromptStream.cancel()`. */
|
|
227
|
+
cancel(): void;
|
|
228
|
+
[Symbol.asyncIterator](): AsyncIterator<StreamMessage>;
|
|
229
|
+
}
|
|
230
|
+
interface AskOptions extends PromptOptions {
|
|
231
|
+
/**
|
|
232
|
+
* Answers a question the agent asks mid-reply. Without it, or when it
|
|
233
|
+
* answers with nothing but whitespace, the agent is told the caller
|
|
234
|
+
* cannot answer and goes on.
|
|
235
|
+
*/
|
|
236
|
+
readonly onQuery?: (query: QueryEvent) => string | Promise<string>;
|
|
237
|
+
}
|
|
238
|
+
/** The whole reply to a prompt, and the root of the task it started. */
|
|
239
|
+
interface CallerReply {
|
|
240
|
+
readonly text: string;
|
|
241
|
+
readonly rootId: string;
|
|
242
|
+
}
|
|
243
|
+
interface FabricCaller {
|
|
244
|
+
/** The SDK's client, for anything beyond. */
|
|
245
|
+
readonly agents: Agents;
|
|
246
|
+
/** The URL the caller connected to. */
|
|
247
|
+
readonly url: string;
|
|
248
|
+
/** The agents on the fabric. */
|
|
249
|
+
list(opts?: {
|
|
250
|
+
readonly timeoutMs?: number;
|
|
251
|
+
}): Promise<Agent[]>;
|
|
252
|
+
/**
|
|
253
|
+
* One agent: by its prompt address, else by its kind when exactly one
|
|
254
|
+
* agent has it. Throws {@link FabricCallerError} naming what is there.
|
|
255
|
+
*/
|
|
256
|
+
find(who: string, opts?: {
|
|
257
|
+
readonly timeoutMs?: number;
|
|
258
|
+
}): Promise<Agent>;
|
|
259
|
+
/**
|
|
260
|
+
* Prompt an agent: an address, a kind, or an `Agent` this caller's
|
|
261
|
+
* `list()` or `find()` returned.
|
|
262
|
+
*/
|
|
263
|
+
prompt(who: string | Agent, text: string, options?: PromptOptions): Promise<CallerPrompt>;
|
|
264
|
+
/** Prompt an agent and wait for the whole reply. */
|
|
265
|
+
ask(who: string | Agent, text: string, options?: AskOptions): Promise<CallerReply>;
|
|
266
|
+
/** Close the client and the connection, then wipe the credentials. */
|
|
267
|
+
close(): Promise<void>;
|
|
268
|
+
}
|
|
269
|
+
/** Settles a prompt's root once: the first call wins. Internal. */
|
|
270
|
+
interface RootSink {
|
|
271
|
+
resolve(rootId: string): void;
|
|
272
|
+
reject(err: unknown): void;
|
|
273
|
+
}
|
|
274
|
+
/** Connect a caller with a creds file. */
|
|
275
|
+
declare function fabricCaller(options: FabricCallerOptions): Promise<FabricCaller>;
|
|
276
|
+
/** {@link fabricCaller} from `NATS_URL` and `NATS_CREDS`. */
|
|
277
|
+
declare function fabricCallerFromEnv(options?: Omit<FabricCallerOptions, "creds" | "url">): Promise<FabricCaller>;
|
|
278
|
+
/**
|
|
279
|
+
* The rule {@link FabricCaller.find} applies: the agent whose prompt address
|
|
280
|
+
* is `who`, else the one agent of kind `who`; otherwise an error that names
|
|
281
|
+
* what is there.
|
|
282
|
+
*/
|
|
283
|
+
declare function pickAgent(found: ReadonlyArray<Agent>, who: string): Agent;
|
|
284
|
+
|
|
168
285
|
/**
|
|
169
286
|
* The served prompt's trace as a run's input carries it, in this key
|
|
170
287
|
* order. Wire form: the same keys and order in both packages.
|
|
@@ -610,7 +727,9 @@ interface SpCliScratchPadOptions {
|
|
|
610
727
|
* deployment provisions it for the agent's account and user; the first
|
|
611
728
|
* commit creates it.
|
|
612
729
|
*/
|
|
613
|
-
readonly volume
|
|
730
|
+
readonly volume?: string;
|
|
731
|
+
/** Exact public creation descriptor, imported by sp init. Requires a persistent dir. */
|
|
732
|
+
readonly bootstrapFile?: string;
|
|
614
733
|
/**
|
|
615
734
|
* The agent's own connection source: `sp` authenticates the same way. It
|
|
616
735
|
* takes a URL with a credentials file; it reads no NATS context, and an
|
|
@@ -662,6 +781,7 @@ declare class ScratchPadError extends Error {
|
|
|
662
781
|
declare function spCliScratchPad(options: SpCliScratchPadOptions): ScratchPadClient;
|
|
663
782
|
/** The variables {@link scratchPadFromEnv} reads. */
|
|
664
783
|
declare const SCRATCHPAD_VOLUME_VAR = "SCRATCHPAD_VOLUME";
|
|
784
|
+
declare const SCRATCHPAD_BOOTSTRAP_FILE_VAR = "SCRATCHPAD_BOOTSTRAP_FILE";
|
|
665
785
|
declare const SCRATCHPAD_BIN_VAR = "SCRATCHPAD_BIN";
|
|
666
786
|
declare const SCRATCHPAD_DIR_VAR = "SCRATCHPAD_DIR";
|
|
667
787
|
declare const SCRATCHPAD_GRANT_TTL_S_VAR = "SCRATCHPAD_GRANT_TTL_S";
|
|
@@ -677,7 +797,7 @@ interface ScratchPadFromEnvOptions {
|
|
|
677
797
|
}
|
|
678
798
|
/**
|
|
679
799
|
* The agent's ScratchPad as the environment configures it, or `undefined`
|
|
680
|
-
* when `SCRATCHPAD_VOLUME`
|
|
800
|
+
* when both `SCRATCHPAD_VOLUME` and `SCRATCHPAD_BOOTSTRAP_FILE` are unset. Reads
|
|
681
801
|
* `SCRATCHPAD_VOLUME`, `SCRATCHPAD_BIN`, `SCRATCHPAD_DIR` and
|
|
682
802
|
* `SCRATCHPAD_GRANT_TTL_S`, and, unless `options.nats` is given, the
|
|
683
803
|
* connection the agent's own configuration reads: `NATS_CREDS` with
|
|
@@ -712,7 +832,7 @@ interface LoopGuard {
|
|
|
712
832
|
}
|
|
713
833
|
declare function loopGuard(): LoopGuard;
|
|
714
834
|
|
|
715
|
-
declare const CODES: readonly ["ok", "invalid", "unauthenticated", "denied", "not_found", "exists", "conflict", "fenced", "intent_changed", "capacity", "summary_limit", "closed", "epoch_changed", "expired", "corrupt", "incomplete", "busy", "unknown", "unavailable", "internal"];
|
|
835
|
+
declare const CODES: readonly ["ok", "invalid", "unauthenticated", "denied", "not_found", "exists", "conflict", "fenced", "generation_retired", "intent_changed", "capacity", "summary_limit", "closed", "epoch_changed", "expired", "corrupt", "incomplete", "busy", "unknown", "unavailable", "internal"];
|
|
716
836
|
type Code = (typeof CODES)[number];
|
|
717
837
|
type ContentID = string;
|
|
718
838
|
interface Principal {
|
|
@@ -766,6 +886,7 @@ interface Command {
|
|
|
766
886
|
base: Head;
|
|
767
887
|
root: ContentID;
|
|
768
888
|
trace: Trace;
|
|
889
|
+
remove_path?: string;
|
|
769
890
|
retention: RetentionIntent;
|
|
770
891
|
}
|
|
771
892
|
interface Receipt {
|
|
@@ -815,6 +936,68 @@ interface VolumeView {
|
|
|
815
936
|
writers: WriterSlot[];
|
|
816
937
|
retentions: RetentionSlot[];
|
|
817
938
|
grants: GrantSlot[];
|
|
939
|
+
lifetime?: LifetimeView;
|
|
940
|
+
}
|
|
941
|
+
interface AdmissionBinding {
|
|
942
|
+
slot: number;
|
|
943
|
+
generation: number;
|
|
944
|
+
operation_id: string;
|
|
945
|
+
}
|
|
946
|
+
interface LifetimeView {
|
|
947
|
+
admission: AdmissionBinding;
|
|
948
|
+
phase: "active" | "shrinking" | "expiring";
|
|
949
|
+
expires_at: number;
|
|
950
|
+
grace_until: number;
|
|
951
|
+
max_lease_seconds: number;
|
|
952
|
+
grace_seconds: number;
|
|
953
|
+
recovery_reads: boolean;
|
|
954
|
+
reserve_objects: number;
|
|
955
|
+
reserve_bytes: number;
|
|
956
|
+
}
|
|
957
|
+
interface RenewRequest {
|
|
958
|
+
target: Target;
|
|
959
|
+
until: number;
|
|
960
|
+
}
|
|
961
|
+
interface RemovalRequest {
|
|
962
|
+
target: Target;
|
|
963
|
+
command: Command;
|
|
964
|
+
}
|
|
965
|
+
interface RemovalPlan extends RemovalRequest {
|
|
966
|
+
slot: number;
|
|
967
|
+
generation: number;
|
|
968
|
+
sequence: number;
|
|
969
|
+
added_objects: number;
|
|
970
|
+
added_bytes: number;
|
|
971
|
+
}
|
|
972
|
+
interface VolumeReleaseRequest {
|
|
973
|
+
target: Target;
|
|
974
|
+
operation_id: string;
|
|
975
|
+
end_promises: boolean;
|
|
976
|
+
}
|
|
977
|
+
interface ReleaseEffects {
|
|
978
|
+
objects: number;
|
|
979
|
+
bytes: number;
|
|
980
|
+
retentions: number;
|
|
981
|
+
read_grants: number;
|
|
982
|
+
access_slots: number;
|
|
983
|
+
references: number;
|
|
984
|
+
}
|
|
985
|
+
interface VolumeReleasePlan {
|
|
986
|
+
request: VolumeReleaseRequest;
|
|
987
|
+
incarnation: string;
|
|
988
|
+
slot: number;
|
|
989
|
+
generation: number;
|
|
990
|
+
sequence: number;
|
|
991
|
+
head: Head;
|
|
992
|
+
effects: ReleaseEffects;
|
|
993
|
+
}
|
|
994
|
+
interface VolumeReleaseResult {
|
|
995
|
+
target: Target;
|
|
996
|
+
slot: number;
|
|
997
|
+
generation: number;
|
|
998
|
+
operation_id: string;
|
|
999
|
+
disposed: boolean;
|
|
1000
|
+
capacity_returned: boolean;
|
|
818
1001
|
}
|
|
819
1002
|
interface Limits {
|
|
820
1003
|
object_bytes: number;
|
|
@@ -830,6 +1013,7 @@ interface ReservedScope {
|
|
|
830
1013
|
volume: string;
|
|
831
1014
|
objects: number;
|
|
832
1015
|
bytes: number;
|
|
1016
|
+
admission?: AdmissionBinding;
|
|
833
1017
|
}
|
|
834
1018
|
interface Info {
|
|
835
1019
|
principal: Principal;
|
|
@@ -875,6 +1059,7 @@ interface PutRequest {
|
|
|
875
1059
|
interface CreateRequest {
|
|
876
1060
|
volume: string;
|
|
877
1061
|
action: Action;
|
|
1062
|
+
admission?: AdmissionBinding;
|
|
878
1063
|
}
|
|
879
1064
|
interface PublishRequest {
|
|
880
1065
|
target: Target;
|
|
@@ -1046,6 +1231,11 @@ declare class ScratchPadTransport {
|
|
|
1046
1231
|
private view;
|
|
1047
1232
|
info(options?: RequestOptions): Promise<Info>;
|
|
1048
1233
|
createVolume(request: CreateRequest, options?: RequestOptions): Promise<VolumeView>;
|
|
1234
|
+
renewLease(request: RenewRequest, options?: RequestOptions): Promise<VolumeView>;
|
|
1235
|
+
planRemoval(request: RemovalRequest, options?: RequestOptions): Promise<RemovalPlan>;
|
|
1236
|
+
applyRemoval(plan: RemovalPlan, options?: RequestOptions): Promise<Receipt>;
|
|
1237
|
+
planVolumeRelease(request: VolumeReleaseRequest, options?: RequestOptions): Promise<VolumeReleasePlan>;
|
|
1238
|
+
applyVolumeRelease(plan: VolumeReleasePlan, options?: RequestOptions): Promise<VolumeReleaseResult>;
|
|
1049
1239
|
getVolume(target: Target, options?: RequestOptions): Promise<VolumeView>;
|
|
1050
1240
|
prepare(request: PrepareRequest, options?: RequestOptions): Promise<PrepareResult>;
|
|
1051
1241
|
putPrepared(request: PutRequest, data: Uint8Array, options?: RequestOptions): Promise<void>;
|
|
@@ -1129,7 +1319,10 @@ declare class WorkspaceStore {
|
|
|
1129
1319
|
interface NativeScratchPadOptions extends ScratchPadReaderOptions {
|
|
1130
1320
|
/** Private directory on a persistent local filesystem. One client owns it at a time. */
|
|
1131
1321
|
dir: string;
|
|
1132
|
-
volume
|
|
1322
|
+
/** Required unless bootstrapFile supplies the exact volume. */
|
|
1323
|
+
volume?: string;
|
|
1324
|
+
/** Public descriptor file. Never a credentials file or an adoption target. */
|
|
1325
|
+
bootstrapFile?: string;
|
|
1133
1326
|
/** Prompt address used only to route Fabric grant requests. It is not authentication. */
|
|
1134
1327
|
creator: string;
|
|
1135
1328
|
ttlSeconds?: number;
|
|
@@ -1143,10 +1336,16 @@ interface PublishResult {
|
|
|
1143
1336
|
reference: string;
|
|
1144
1337
|
receipt: Receipt;
|
|
1145
1338
|
}
|
|
1339
|
+
/** Capacity returned can be known even when this release request's acceptance is unknown. */
|
|
1340
|
+
type VolumeReleaseOutcome = VolumeReleaseResult & {
|
|
1341
|
+
acceptance_unknown?: true;
|
|
1342
|
+
};
|
|
1146
1343
|
interface RecoveryResult {
|
|
1147
1344
|
kind: string;
|
|
1148
1345
|
reference?: string;
|
|
1149
1346
|
receipt?: Receipt;
|
|
1347
|
+
volume?: VolumeView;
|
|
1348
|
+
release?: VolumeReleaseOutcome;
|
|
1150
1349
|
}
|
|
1151
1350
|
interface Publication {
|
|
1152
1351
|
kind: "publish";
|
|
@@ -1172,7 +1371,18 @@ type Control = {
|
|
|
1172
1371
|
kind: "close" | "apply";
|
|
1173
1372
|
request: MaintenanceRequest;
|
|
1174
1373
|
};
|
|
1175
|
-
type
|
|
1374
|
+
type Lifecycle = {
|
|
1375
|
+
kind: "renew";
|
|
1376
|
+
request: RenewRequest;
|
|
1377
|
+
} | {
|
|
1378
|
+
kind: "remove";
|
|
1379
|
+
plan: RemovalPlan;
|
|
1380
|
+
} | {
|
|
1381
|
+
kind: "volume_release";
|
|
1382
|
+
plan: VolumeReleasePlan;
|
|
1383
|
+
fence_accepted?: true;
|
|
1384
|
+
};
|
|
1385
|
+
type Pending = Publication | Control | Lifecycle | {
|
|
1176
1386
|
kind: "reset";
|
|
1177
1387
|
writer: Writer;
|
|
1178
1388
|
};
|
|
@@ -1182,16 +1392,22 @@ interface State {
|
|
|
1182
1392
|
volume: string;
|
|
1183
1393
|
creator: string;
|
|
1184
1394
|
creation: Action;
|
|
1395
|
+
admission?: AdmissionBinding;
|
|
1185
1396
|
target?: Target;
|
|
1186
1397
|
writer?: Writer;
|
|
1187
1398
|
next: number;
|
|
1188
1399
|
pending?: Pending;
|
|
1400
|
+
renewal?: RenewRequest;
|
|
1189
1401
|
last?: PublishResult & {
|
|
1190
1402
|
path: string;
|
|
1191
1403
|
ttl: number;
|
|
1192
1404
|
resolved?: ResolvedReference;
|
|
1193
1405
|
};
|
|
1194
1406
|
grants: Granted[];
|
|
1407
|
+
removal?: Receipt;
|
|
1408
|
+
disposal?: VolumeReleaseResult;
|
|
1409
|
+
disposal_plan?: VolumeReleasePlan;
|
|
1410
|
+
release_acceptance_unknown?: true;
|
|
1195
1411
|
}
|
|
1196
1412
|
/** A native writer and Fabric adapter. It borrows the caller's authenticated connection. */
|
|
1197
1413
|
declare class NativeScratchPad extends ScratchPadReader implements ScratchPadClient {
|
|
@@ -1202,7 +1418,7 @@ declare class NativeScratchPad extends ScratchPadReader implements ScratchPadCli
|
|
|
1202
1418
|
private tail;
|
|
1203
1419
|
private closing;
|
|
1204
1420
|
private closePromise?;
|
|
1205
|
-
constructor(transport: ScratchPadTransport, store: WorkspaceStore, state: State, scope: ReservedScope, ttl: number);
|
|
1421
|
+
constructor(transport: ScratchPadTransport, store: WorkspaceStore, state: State, scope: ReservedScope | undefined, ttl: number);
|
|
1206
1422
|
private run;
|
|
1207
1423
|
private save;
|
|
1208
1424
|
private change;
|
|
@@ -1219,6 +1435,26 @@ declare class NativeScratchPad extends ScratchPadReader implements ScratchPadCli
|
|
|
1219
1435
|
volume: VolumeView;
|
|
1220
1436
|
pending?: string;
|
|
1221
1437
|
}>;
|
|
1438
|
+
/** Save an absolute deadline before sending it. Retries never extend it implicitly. */
|
|
1439
|
+
renewLease(until: number): Promise<VolumeView>;
|
|
1440
|
+
private resumeRenewal;
|
|
1441
|
+
/** Read-only plan for an initialized writer. The caller chooses the path to remove. */
|
|
1442
|
+
planRemoval(path: string, options: {
|
|
1443
|
+
operationId: string;
|
|
1444
|
+
trace?: TraceIds;
|
|
1445
|
+
}): Promise<RemovalPlan>;
|
|
1446
|
+
applyRemoval(plan: RemovalPlan): Promise<Receipt>;
|
|
1447
|
+
/** Lists every promise affected. EndPromises must be explicitly true to authorize release. */
|
|
1448
|
+
planVolumeRelease(options: {
|
|
1449
|
+
operationId: string;
|
|
1450
|
+
endPromises?: boolean;
|
|
1451
|
+
}): Promise<VolumeReleasePlan>;
|
|
1452
|
+
applyVolumeRelease(plan: VolumeReleasePlan): Promise<VolumeReleaseOutcome>;
|
|
1453
|
+
private beginLifecycle;
|
|
1454
|
+
private lifecycle;
|
|
1455
|
+
private releaseFenced;
|
|
1456
|
+
private releaseOutcome;
|
|
1457
|
+
private finishRelease;
|
|
1222
1458
|
recover(): Promise<RecoveryResult>;
|
|
1223
1459
|
private recoverPending;
|
|
1224
1460
|
publishBytes(bytes: Uint8Array, path: string, options: PublishOptions): Promise<PublishResult>;
|
|
@@ -1244,7 +1480,7 @@ declare class NativeScratchPad extends ScratchPadReader implements ScratchPadCli
|
|
|
1244
1480
|
}
|
|
1245
1481
|
/** Construct a native client without creating a remote volume until first use. */
|
|
1246
1482
|
declare function nativeScratchPad(options: NativeScratchPadOptions): Promise<NativeScratchPad>;
|
|
1247
|
-
/**
|
|
1483
|
+
/** A volume or bootstrap file enables the native client on its existing connection. */
|
|
1248
1484
|
declare function nativeScratchPadFromEnv(env: Readonly<Record<string, string | undefined>>, options: ScratchPadReaderOptions & {
|
|
1249
1485
|
creator: string;
|
|
1250
1486
|
}): Promise<NativeScratchPad | undefined>;
|
|
@@ -1261,6 +1497,17 @@ declare class NativeScratchPadError extends Error {
|
|
|
1261
1497
|
});
|
|
1262
1498
|
}
|
|
1263
1499
|
|
|
1500
|
+
/** The descriptor selects an exact creation request; it supplies no authority. */
|
|
1501
|
+
interface ScratchPadBootstrap {
|
|
1502
|
+
version: 1;
|
|
1503
|
+
principal: Principal;
|
|
1504
|
+
volume: string;
|
|
1505
|
+
admission: AdmissionBinding;
|
|
1506
|
+
creation: Action;
|
|
1507
|
+
}
|
|
1508
|
+
declare const MAX_BOOTSTRAP_BYTES = 4096;
|
|
1509
|
+
declare function decodeScratchPadBootstrap(data: Uint8Array | string): ScratchPadBootstrap;
|
|
1510
|
+
|
|
1264
1511
|
/** The one setting: the edge subject, in the config entry's `options`. */
|
|
1265
1512
|
declare const EDGE_SUBJECT_OPTION = "edgeSubject";
|
|
1266
1513
|
/** The same setting as a variable, read when the option is not given. */
|
|
@@ -1417,6 +1664,7 @@ declare const SP_VARS: {
|
|
|
1417
1664
|
readonly creds: "SP_NATS_CREDS";
|
|
1418
1665
|
readonly dir: "SCRATCHPAD_DIR";
|
|
1419
1666
|
readonly volume: "SCRATCHPAD_VOLUME";
|
|
1667
|
+
readonly bootstrapFile: "SCRATCHPAD_BOOTSTRAP_FILE";
|
|
1420
1668
|
readonly creator: "SP_CREATOR";
|
|
1421
1669
|
readonly threadId: "SP_THREAD_ID";
|
|
1422
1670
|
readonly rootId: "SP_ROOT_ID";
|
|
@@ -1429,6 +1677,7 @@ interface ScratchPadSettings {
|
|
|
1429
1677
|
readonly url: string;
|
|
1430
1678
|
readonly creds: string;
|
|
1431
1679
|
readonly volume: string;
|
|
1680
|
+
readonly bootstrapFile?: string;
|
|
1432
1681
|
/** Unset when neither a setting nor the plugin's state directory gives one. */
|
|
1433
1682
|
readonly dir?: string;
|
|
1434
1683
|
/**
|
|
@@ -1526,4 +1775,4 @@ declare function readRecordedGrants(file: string): RecordedGrant[];
|
|
|
1526
1775
|
*/
|
|
1527
1776
|
declare function withRecordedGrants(port: ScratchPad, file: string, now?: () => number): ScratchPad;
|
|
1528
1777
|
|
|
1529
|
-
export { type AgentExtension, type AgentExtensionContext, type AgentExtensionFactory, type AgentExtensionHandles, type AgentExtensionSettings, type BuiltEdgeRecord, type BuiltServedRecord, DEFAULT_EDGE_SUBJECT, DEFAULT_GRANT_REQUEST_TIMEOUT_MS, DEFAULT_GRANT_TTL_S, DEFAULT_READ_LIMIT_BYTES, DEFAULT_SP_BIN, type DurableTrace, EDGE_RECORD_VERSION, EDGE_SUBJECT_OPTION, EDGE_SUBJECT_VAR, type EndReason, type FabricTracing, GRANT_REQUEST_ENDPOINT, type GrantKind, type GrantReply, type GrantRequest, type GrantRequestEndpointOptions, type Grantee, HARNESS_THREAD_ID_MAX, type Harness, type HarnessEvents, LOOP_GUARD_CODE, type LoopGuard, NativeScratchPad, NativeScratchPadError, type NativeScratchPadOptions, type Outcome, type PluginHarness, type PublishOptions, type PublishResult, READS_REFERENCES_KEY, READS_SCRATCHPAD_REFERENCES_FIELD, REFERENCE_PREFIX, ROOT_ID_FIELD, ROOT_ID_HEADER, type ReadBytesOptions, type RecordedGrant, type RecoveryResult, type Reference, type RequestGrantOptions, SCRATCHPAD_BIN_VAR, SCRATCHPAD_DIR_VAR, SCRATCHPAD_GRANT_TTL_S_VAR, SCRATCHPAD_OPTION, SCRATCHPAD_VOLUME_VAR, SERVED_RECORD_REASON_VERSION, SERVED_RECORD_VERSION, SHORT_REFERENCE_PREFIX, SP_VARS, type ScratchPad, type ScratchPadClient, ScratchPadError, ScratchPadExtension, type ScratchPadExtensionOptions, type ScratchPadFromEnvOptions, ScratchPadHandOn, ScratchPadReader, type ScratchPadReaderOptions, type ScratchPadSettings, type ServedPhase, ServedPromptEnv, ServedPublisher, type ServedPublisherOptions, type ServedReason, type ServedRequest, type ServedStatus, type ServedTurn, type ShortReference, type SpCliScratchPadOptions, THREAD_ID_FIELD, THREAD_ID_HEADER, THREAD_ID_HEX_LEN, TOOL_CALL_ID_CONTEXT_KEY, TOOL_CALL_ID_MAX, type TraceIds, type TraceOptions, type TraceRecordCounts, type TraceScope, activeTrace, answerGrantRequest, assertValidTraceOptions, bindActiveTrace, buildEdgeRecord, buildServedRecord, countTraceRecordDropped, countTraceRecordPublished, decodeReference, decodeShortReference, durableHeaders, durableRunId, durableTrace, encodeGrantReply, encodeGrantRequest, encodeReference, exportScratchPad, fabricTracing, findReferences, grantRequestEndpoint, grantSubject, granteeFromIdentity, isThreadId, loopGuard, loopGuardDescription, nativeScratchPad, nativeScratchPadFromEnv, randomThreadId, readRecordedGrants, readsReferences, referenceCreator, removeReferences, requestGrant, resolveEdgeSubject, resolveScratchPad, scratchPadExtension, scratchPadFromEnv, scratchPadReader, servedPublisher, spBinary, spCliScratchPad, spPort, traceHeaders, traceRecordCounts, unixSeconds, validHarnessThreadId, validToolCallId, withDurableTrace, withRecordedGrants };
|
|
1778
|
+
export { type AdmissionBinding, type AgentExtension, type AgentExtensionContext, type AgentExtensionFactory, type AgentExtensionHandles, type AgentExtensionSettings, type AskOptions, type BuiltEdgeRecord, type BuiltServedRecord, CALLER_INBOX_PREFIX, CANNOT_ANSWER, type CallerPrompt, type CallerReply, CallerStream, DEFAULT_DISCOVER_TIMEOUT_MS, DEFAULT_EDGE_SUBJECT, DEFAULT_GRANT_REQUEST_TIMEOUT_MS, DEFAULT_GRANT_TTL_S, DEFAULT_READ_LIMIT_BYTES, DEFAULT_SP_BIN, type DurableTrace, EDGE_RECORD_VERSION, EDGE_SUBJECT_OPTION, EDGE_SUBJECT_VAR, type EndReason, type FabricCaller, FabricCallerError, type FabricCallerErrorReason, type FabricCallerOptions, type FabricTracing, GRANT_REQUEST_ENDPOINT, type GrantKind, type GrantReply, type GrantRequest, type GrantRequestEndpointOptions, type Grantee, HARNESS_THREAD_ID_MAX, type Harness, type HarnessEvents, LOOP_GUARD_CODE, type LifetimeView, type LoopGuard, MAX_BOOTSTRAP_BYTES, NATS_CREDS_VAR, NATS_URL_VAR, NativeScratchPad, NativeScratchPadError, type NativeScratchPadOptions, type Outcome, type PluginHarness, type PublishOptions, type PublishResult, READS_REFERENCES_KEY, READS_SCRATCHPAD_REFERENCES_FIELD, REFERENCE_PREFIX, ROOT_ID_FIELD, ROOT_ID_HEADER, type ReadBytesOptions, type RecordedGrant, type RecoveryResult, type Reference, type ReleaseEffects, type RemovalPlan, type RemovalRequest, type RenewRequest, type RequestGrantOptions, SCRATCHPAD_BIN_VAR, SCRATCHPAD_BOOTSTRAP_FILE_VAR, SCRATCHPAD_DIR_VAR, SCRATCHPAD_GRANT_TTL_S_VAR, SCRATCHPAD_OPTION, SCRATCHPAD_VOLUME_VAR, SERVED_RECORD_REASON_VERSION, SERVED_RECORD_VERSION, SHORT_REFERENCE_PREFIX, SP_VARS, type ScratchPad, type ScratchPadBootstrap, type ScratchPadClient, ScratchPadError, ScratchPadExtension, type ScratchPadExtensionOptions, type ScratchPadFromEnvOptions, ScratchPadHandOn, ScratchPadReader, type ScratchPadReaderOptions, type ScratchPadSettings, type ServedPhase, ServedPromptEnv, ServedPublisher, type ServedPublisherOptions, type ServedReason, type ServedRequest, type ServedStatus, type ServedTurn, type ShortReference, type SpCliScratchPadOptions, THREAD_ID_FIELD, THREAD_ID_HEADER, THREAD_ID_HEX_LEN, TOOL_CALL_ID_CONTEXT_KEY, TOOL_CALL_ID_MAX, type TraceIds, type TraceOptions, type TraceRecordCounts, type TraceScope, type VolumeReleaseOutcome, type VolumeReleasePlan, type VolumeReleaseRequest, type VolumeReleaseResult, activeTrace, answerGrantRequest, assertValidTraceOptions, bindActiveTrace, buildEdgeRecord, buildServedRecord, countTraceRecordDropped, countTraceRecordPublished, decodeReference, decodeScratchPadBootstrap, decodeShortReference, durableHeaders, durableRunId, durableTrace, encodeGrantReply, encodeGrantRequest, encodeReference, exportScratchPad, fabricCaller, fabricCallerFromEnv, fabricTracing, findReferences, grantRequestEndpoint, grantSubject, granteeFromIdentity, isThreadId, loopGuard, loopGuardDescription, nativeScratchPad, nativeScratchPadFromEnv, pickAgent, randomThreadId, readRecordedGrants, readsReferences, referenceCreator, removeReferences, requestGrant, resolveEdgeSubject, resolveScratchPad, scratchPadExtension, scratchPadFromEnv, scratchPadReader, servedPublisher, spBinary, spCliScratchPad, spPort, traceHeaders, traceRecordCounts, unixSeconds, validHarnessThreadId, validToolCallId, withDurableTrace, withRecordedGrants };
|