@open-conduit/sdk 7.0.0 → 7.1.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/dist/actions.d.ts +145 -0
- package/dist/actions.js +281 -0
- package/dist/actiontest.d.ts +80 -0
- package/dist/actiontest.js +190 -0
- package/dist/artifactstore.d.ts +133 -0
- package/dist/artifactstore.js +364 -0
- package/dist/backup.d.ts +99 -0
- package/dist/backup.js +178 -0
- package/dist/containertest.d.ts +71 -0
- package/dist/containertest.js +294 -0
- package/dist/errors.d.ts +28 -0
- package/dist/errors.js +37 -0
- package/dist/executor.d.ts +374 -0
- package/dist/executor.js +556 -0
- package/dist/executortest.d.ts +183 -0
- package/dist/executortest.js +534 -0
- package/dist/extension.d.ts +496 -1
- package/dist/extension.js +1152 -4
- package/dist/feed.d.ts +20 -0
- package/dist/feed.js +88 -0
- package/dist/forward.d.ts +38 -0
- package/dist/forward.js +163 -0
- package/dist/forwardca.d.ts +21 -0
- package/dist/forwardca.js +144 -0
- package/dist/hooks.d.ts +108 -0
- package/dist/hooks.js +13 -0
- package/dist/host.d.ts +166 -2
- package/dist/host.js +235 -2
- package/dist/index.d.ts +27 -3
- package/dist/index.js +14 -2
- package/dist/probe.d.ts +61 -0
- package/dist/probe.js +92 -0
- package/dist/providertest.d.ts +59 -0
- package/dist/providertest.js +168 -0
- package/dist/resources.d.ts +208 -0
- package/dist/resources.js +303 -0
- package/dist/sandbox.d.ts +84 -0
- package/dist/sandbox.js +85 -0
- package/dist/setup.d.ts +145 -0
- package/dist/setup.js +179 -0
- package/dist/setuptest.d.ts +90 -0
- package/dist/setuptest.js +319 -0
- package/dist/storetest.d.ts +64 -0
- package/dist/storetest.js +740 -0
- package/dist/telemetry.d.ts +86 -0
- package/dist/telemetry.js +46 -0
- package/dist/testing.d.ts +591 -2
- package/dist/testing.js +1460 -6
- package/dist/toolbelt.d.ts +91 -0
- package/dist/toolbelt.js +216 -0
- package/dist/tunnel.d.ts +62 -0
- package/dist/tunnel.js +93 -0
- package/dist/wire.d.ts +4060 -348
- package/dist/wire.js +1583 -0
- package/package.json +1 -1
package/dist/extension.d.ts
CHANGED
|
@@ -1,7 +1,30 @@
|
|
|
1
|
+
import { type ActionsHandler, type ActionsSpec, type AnnotateFn, type PageSpec } from "./actions.js";
|
|
2
|
+
import { type ProbeHandler, type ProbeSpec } from "./probe.js";
|
|
3
|
+
import type { DependencyFilterFn, OperationGateFn, RecurrenceFn, RenderFn, SegmentEndFn, StartGateFn, TargetFn } from "./hooks.js";
|
|
4
|
+
import { type ResourceHandler, type ResourceProviderSpec } from "./resources.js";
|
|
5
|
+
import { type SandboxHandler, type SandboxProviderSpec } from "./sandbox.js";
|
|
6
|
+
import { type ConfigCandidateFn, type SetupSpec } from "./setup.js";
|
|
7
|
+
import { type ExporterSpec, type MetricsFn, type RunEnvironmentFn, type SinkFn } from "./telemetry.js";
|
|
8
|
+
import { type TunnelHandler, type TunnelProviderSpec } from "./tunnel.js";
|
|
9
|
+
import { type BackupDestinationSpec, type BackupHandler } from "./backup.js";
|
|
1
10
|
import { type Readable, Writable } from "node:stream";
|
|
2
11
|
import { type DeliveryInput, Host, type Put } from "./host.js";
|
|
12
|
+
import { type ExecutorHandler, type ExecutorSpec } from "./executor.js";
|
|
3
13
|
import { type Infer, type Type } from "./schema.js";
|
|
4
|
-
import { type AcceptedEvent, type Authority, type CertificationFile, type ConfigEntry, type ConnectionEntry, type Dependency, type Emitted, type Event, type Family, type Manifest, type PushResult, type Route, type RouteDecision, type RouteInput, type RouteSample, RouteSamplesParams, type Scan, type Scope, type Snapshot, type TaskRunResult, type WaitRequest } from "./wire.js";
|
|
14
|
+
import { type AcceptedEvent, type Authority, type CertificationFile, type ConfigEntry, type ConnectionEntry, type ContainerCreated, type ContainerPin, type ContainerPlan, type ContainerRef, type ContainerState, type ContainerUse, CredentialVerifyParams, type CredentialVerifyResult, type Dependency, type Emitted, type Event, type Family, type FieldDecl, type Manifest, type Placement, type PushResult, type ResourceOwner, type Route, type RouteDecision, type RouteInput, type RouteSample, RouteSamplesParams, type SandboxLaunch, type SandboxNeeds, type SandboxPaths, type Scan, type Scope, type Snapshot, type TaskRunResult, type WaitRequest } from "./wire.js";
|
|
15
|
+
/**
|
|
16
|
+
* The labels the host gives a container it asks a provider to create
|
|
17
|
+
* (extension.ContainerLabel*): list a container by them, and never act on
|
|
18
|
+
* one that doesn't carry the host's.
|
|
19
|
+
*/
|
|
20
|
+
export declare const ContainerLabel: {
|
|
21
|
+
/** The host's container label (ContainerContext.hostLabel). */
|
|
22
|
+
readonly Host: "dev.open-conduit.host";
|
|
23
|
+
readonly Execution: "dev.open-conduit.execution";
|
|
24
|
+
readonly Work: "dev.open-conduit.work";
|
|
25
|
+
readonly Segment: "dev.open-conduit.segment";
|
|
26
|
+
readonly Digest: "dev.open-conduit.digest";
|
|
27
|
+
};
|
|
5
28
|
/** The protocol versions this SDK speaks. */
|
|
6
29
|
export declare const ProtocolVersions: number[];
|
|
7
30
|
/** What a handler can reach besides its input. */
|
|
@@ -226,6 +249,257 @@ export type CheckFn = (ctx: CheckContext) => string | Promise<string>;
|
|
|
226
249
|
* sooner (at most an hour off); returning nothing keeps its interval.
|
|
227
250
|
*/
|
|
228
251
|
export type TaskFn = (ctx: Context) => void | TaskRunResult | Promise<void | TaskRunResult>;
|
|
252
|
+
/** One reference the host asks a secret scheme to resolve (extension.SecretRequest). */
|
|
253
|
+
export interface SecretRequest {
|
|
254
|
+
scheme: string;
|
|
255
|
+
/** The reference text after "<scheme>:", as the operator wrote it (a vault path and field). */
|
|
256
|
+
reference: string;
|
|
257
|
+
}
|
|
258
|
+
/** One value the host asks a writable secret scheme to store (extension.SecretWrite). */
|
|
259
|
+
export interface SecretWrite {
|
|
260
|
+
scheme: string;
|
|
261
|
+
/** The operator's name for the value in the daemon's secret store ([a-z][a-z0-9_-]*). */
|
|
262
|
+
name: string;
|
|
263
|
+
value: string;
|
|
264
|
+
/** The operator's opaque config for the scheme's store (settings.secret_store.config), or undefined. */
|
|
265
|
+
config: unknown;
|
|
266
|
+
/** The secret store's stable identity: every host sharing one installation's state has the same. */
|
|
267
|
+
owner: string;
|
|
268
|
+
}
|
|
269
|
+
/** What the host asks a writable secret scheme to remove (extension.SecretDelete). */
|
|
270
|
+
export interface SecretDeleteRequest {
|
|
271
|
+
scheme: string;
|
|
272
|
+
/** Reference text the scheme's store returned. */
|
|
273
|
+
reference: string;
|
|
274
|
+
owner: string;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* A secret reference scheme the package resolves (extension.SecretProvider),
|
|
278
|
+
* and, with store and delete, stores values of (extension.SecretWriter).
|
|
279
|
+
*
|
|
280
|
+
* serve returns the value, or throws SecretRefusal with a safe code when
|
|
281
|
+
* the reference names nothing it can serve. store returns the reference
|
|
282
|
+
* text that reads the value back, which must not carry the value, and
|
|
283
|
+
* refuses with SecretUnowned a name another owner stored; delete removes
|
|
284
|
+
* what a reference it stored names, succeeds when it is already gone, and
|
|
285
|
+
* refuses another owner's. Anything else thrown is reported to the
|
|
286
|
+
* operator as the provider failing, its text discarded, so an error can't
|
|
287
|
+
* carry a value out; the SDK logs nothing of a request either.
|
|
288
|
+
*/
|
|
289
|
+
export interface SecretSchemeSpec {
|
|
290
|
+
/** One line for the operator: what a reference of the scheme names ("a Vault KV path and field"). */
|
|
291
|
+
summary?: string;
|
|
292
|
+
serve: (r: SecretRequest, ctx: Context) => string | Promise<string>;
|
|
293
|
+
store?: (w: SecretWrite, ctx: Context) => string | Promise<string>;
|
|
294
|
+
delete?: (d: SecretDeleteRequest, ctx: Context) => void | Promise<void>;
|
|
295
|
+
}
|
|
296
|
+
/** One bearer credential the host asks a verifier about (extension.CredentialCheck). */
|
|
297
|
+
export interface CredentialCheck<C = unknown> {
|
|
298
|
+
/** The declared verifier type. */
|
|
299
|
+
type: string;
|
|
300
|
+
/**
|
|
301
|
+
* The host's ID for the trusted issuer. The host records the operator
|
|
302
|
+
* as operator:<issuer>:<subject>, so the verifier never names the actor.
|
|
303
|
+
*/
|
|
304
|
+
issuer: string;
|
|
305
|
+
/** The issuer's config, as the admin gave it and validate accepted it. */
|
|
306
|
+
config: C;
|
|
307
|
+
/** The bearer credential exactly as the request carried it. */
|
|
308
|
+
token: string;
|
|
309
|
+
}
|
|
310
|
+
/** Who a credential the verifier accepted names, as its issuer signed it (extension.VerifiedCredential). */
|
|
311
|
+
export interface VerifiedCredential {
|
|
312
|
+
/** The issuer's stable ID for the person: 1 to 256 printable characters, no spaces. */
|
|
313
|
+
subject: string;
|
|
314
|
+
/** The groups the issuer says the person is in; the issuer's group table, which only an admin sets, maps them to a role. */
|
|
315
|
+
groups?: string[];
|
|
316
|
+
/** When the credential stops being valid. Required: the host stops accepting it then, even if never asked again. */
|
|
317
|
+
expiresAt: Date;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* A credential verifier type (extension.CredentialVerifier), which an admin
|
|
321
|
+
* names when trusting an issuer (PUT /v1/auth/issuers/{id}).
|
|
322
|
+
*
|
|
323
|
+
* The package owns the protocol: signatures, keys and their rotation, the
|
|
324
|
+
* issuer's own claims. The host owns what follows: the actor, the role the
|
|
325
|
+
* groups map to, enforcing expiresAt and refusing the request on any
|
|
326
|
+
* error. verify returns who an accepted credential names, or throws
|
|
327
|
+
* CredentialRefusal for one its issuer didn't sign or that isn't valid
|
|
328
|
+
* now; anything else thrown crosses as internal, which the host refuses
|
|
329
|
+
* too. The host may offer one credential to several issuers in turn, so a
|
|
330
|
+
* credential that is merely not this issuer's is an ordinary refusal.
|
|
331
|
+
* verify must not call the network on every request: cache what the
|
|
332
|
+
* issuer publishes (its signing keys) and fetch again when it rotates.
|
|
333
|
+
*/
|
|
334
|
+
export interface VerifierSpec<S extends Type<unknown>> {
|
|
335
|
+
/** The issuer config's schema: validate (kind verifier) refuses a config it doesn't match, before the host stores it. */
|
|
336
|
+
config?: S;
|
|
337
|
+
/** The issuer config's fields, for adapters and the config editor (manifest verifiers[].fields). */
|
|
338
|
+
fields?: FieldDecl[];
|
|
339
|
+
/**
|
|
340
|
+
* Checks the schema can't express; throw to refuse the config. A
|
|
341
|
+
* ConfigError says which field is wrong and why; anything else thrown is
|
|
342
|
+
* reported only as invalid.
|
|
343
|
+
*/
|
|
344
|
+
validate?: (config: Infer<S>) => void | Promise<void>;
|
|
345
|
+
verify: (c: CredentialCheck<Infer<S>>, ctx: Context) => VerifiedCredential | Promise<VerifiedCredential>;
|
|
346
|
+
}
|
|
347
|
+
interface VerifierHandler {
|
|
348
|
+
validate: (config: unknown) => Promise<void>;
|
|
349
|
+
verify: (p: CredentialVerifyParams, ctx: Context) => Promise<CredentialVerifyResult>;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* A binding's whole container config (extension.ContainerConfig), as the
|
|
353
|
+
* host checked it, with the provider's own settings (its provider field)
|
|
354
|
+
* decoded by the provider's settings schema.
|
|
355
|
+
*/
|
|
356
|
+
export interface ContainerConfig<P = unknown> {
|
|
357
|
+
/** The image, pinned by digest (name@sha256:…). */
|
|
358
|
+
image: string;
|
|
359
|
+
/** The connection whose credential the provider uses, if any. */
|
|
360
|
+
connection?: string;
|
|
361
|
+
/** Host paths the run may write and read: absolute, under ~, or starting with {workspace} or {run}. */
|
|
362
|
+
write?: string[];
|
|
363
|
+
read?: string[];
|
|
364
|
+
network?: {
|
|
365
|
+
allow?: string[];
|
|
366
|
+
};
|
|
367
|
+
limits?: {
|
|
368
|
+
cpus?: number;
|
|
369
|
+
memory?: string;
|
|
370
|
+
pids?: number;
|
|
371
|
+
};
|
|
372
|
+
/** The provider's own settings. */
|
|
373
|
+
provider: P;
|
|
374
|
+
}
|
|
375
|
+
/** The context of a container provider's call: the host's container directory and label for the type, and the bindings that use it. */
|
|
376
|
+
export interface ContainerContext extends Context {
|
|
377
|
+
/** The type's state directory the host named at initialize ("" when it named none). */
|
|
378
|
+
dir: string;
|
|
379
|
+
/** The host's container label (extension.ContainerLabelHost): label what it creates with it, and list only what carries it or a former one. */
|
|
380
|
+
hostLabel: string;
|
|
381
|
+
/** Labels the host made containers under before: listed as the host's too, never put on a new container. */
|
|
382
|
+
formerHosts: string[];
|
|
383
|
+
/** The enabled bindings whose container provider is this type, from the last configure, in config order. */
|
|
384
|
+
uses: ContainerUse[];
|
|
385
|
+
}
|
|
386
|
+
/** One launch to plan (extension.ContainerProvider.Plan). */
|
|
387
|
+
export interface ContainerPlanRequest<P> {
|
|
388
|
+
type: string;
|
|
389
|
+
owner: ResourceOwner;
|
|
390
|
+
config: ContainerConfig<P>;
|
|
391
|
+
/** This attempt's host-set paths. */
|
|
392
|
+
paths: SandboxPaths;
|
|
393
|
+
/** The launch's needs, the resource's and the host's protected set already merged in. */
|
|
394
|
+
needs: SandboxNeeds;
|
|
395
|
+
launch: SandboxLaunch;
|
|
396
|
+
/** Where place put the execution ("" when the provider places nothing). */
|
|
397
|
+
placement: string;
|
|
398
|
+
}
|
|
399
|
+
/** A provider's view of one container (extension.ContainerState). */
|
|
400
|
+
export type ContainerStatus = Omit<ContainerState, "started_at"> & {
|
|
401
|
+
/** When the container started; left out until it has. */
|
|
402
|
+
started_at?: Date | string;
|
|
403
|
+
};
|
|
404
|
+
/** A command to run at a placement (extension.SiteCommand). */
|
|
405
|
+
export interface SiteRun {
|
|
406
|
+
argv: string[];
|
|
407
|
+
dir: string;
|
|
408
|
+
env: string[];
|
|
409
|
+
stdin: Uint8Array;
|
|
410
|
+
/** 0 for none. */
|
|
411
|
+
timeoutMs: number;
|
|
412
|
+
toolbelt: string;
|
|
413
|
+
tokenFile: string;
|
|
414
|
+
}
|
|
415
|
+
/** What a command run at a placement did (extension.SiteResult). A command that ran and failed is its exit code, not an error. */
|
|
416
|
+
export interface SiteOutcome {
|
|
417
|
+
exitCode: number;
|
|
418
|
+
stdout?: Uint8Array | string;
|
|
419
|
+
stderr?: Uint8Array | string;
|
|
420
|
+
truncated?: boolean;
|
|
421
|
+
}
|
|
422
|
+
/** A recovered segment the host asks a provider declared with reattach to give a new wrapper (extension.ContainerReattach). */
|
|
423
|
+
export interface ContainerReattach {
|
|
424
|
+
pin: ContainerPin;
|
|
425
|
+
/** This host's paths for the run. */
|
|
426
|
+
paths: SandboxPaths;
|
|
427
|
+
tokenFile: string;
|
|
428
|
+
/** Whether this host is the one that launched the run. */
|
|
429
|
+
sameHost: boolean;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* A container provider type (extension.ContainerProvider), which a
|
|
433
|
+
* binding's container config names. The host binds it to an attempt: it
|
|
434
|
+
* merges the protected set into the needs, pins the plan's digest and the
|
|
435
|
+
* container, and keeps stop, reconcile and removal, so the provider only
|
|
436
|
+
* plans, creates and reports containers.
|
|
437
|
+
*
|
|
438
|
+
* plan applies the binding's config and checks every need against it,
|
|
439
|
+
* never widening it; create creates the plan's container with the labels
|
|
440
|
+
* and never starts it, answering the argv and env the executor's wrapper
|
|
441
|
+
* runs to start it and wait for its exit; inspect reports one container,
|
|
442
|
+
* gone when the daemon that answered holds none; list reports every
|
|
443
|
+
* container carrying the owner's execution label, or every one of the
|
|
444
|
+
* host's for an owner without one; remove removes a container and what
|
|
445
|
+
* the provider made for it, a gone one included. A listing or inspection
|
|
446
|
+
* that fails must throw, never answer empty or gone: the host acts on
|
|
447
|
+
* both.
|
|
448
|
+
*
|
|
449
|
+
* Refuse with a ProtocolError of the confinement codes, whose message
|
|
450
|
+
* crosses to the executor: Code.SandboxDenied for a need outside the
|
|
451
|
+
* policy, Code.SandboxUnavailable when the provider can't run the launch,
|
|
452
|
+
* Code.NoCapacity (with resetAt when known) when it has no room now, and
|
|
453
|
+
* Code.SiteUnavailable from siteRun for a placement it can't name or
|
|
454
|
+
* reach. Anything else thrown crosses as internal, which the host treats
|
|
455
|
+
* as the container being unavailable, so nothing runs.
|
|
456
|
+
*
|
|
457
|
+
* The optional capabilities are declared by being given: forward names
|
|
458
|
+
* the loopback or private IP the host serves the execution's toolbelt on,
|
|
459
|
+
* over mutual TLS under its own CA (dialForward reaches it); place and
|
|
460
|
+
* siteRun (both or neither) choose the machine and run commands there;
|
|
461
|
+
* collect brings back what an exited container wrote when its wrapper
|
|
462
|
+
* didn't; reattach gives a recovered run a new wrapper.
|
|
463
|
+
*/
|
|
464
|
+
export interface ContainerSpec<S extends Type<unknown>> {
|
|
465
|
+
/** The schema of the container config's provider settings: validate (kind container) refuses settings it doesn't match, at /provider. */
|
|
466
|
+
settings?: S;
|
|
467
|
+
/**
|
|
468
|
+
* Checks the schema can't express; throw to refuse the config. A
|
|
469
|
+
* ConfigError says which field is wrong and why; anything else thrown is
|
|
470
|
+
* reported only as invalid.
|
|
471
|
+
*/
|
|
472
|
+
validate?: (config: ContainerConfig<Infer<S>>) => void | Promise<void>;
|
|
473
|
+
/** Its doctor check runs each of its bindings' version probes in the binding's container (manifest probe). */
|
|
474
|
+
probe?: boolean;
|
|
475
|
+
plan: (r: ContainerPlanRequest<Infer<S>>, ctx: ContainerContext) => ContainerPlan | Promise<ContainerPlan>;
|
|
476
|
+
create: (r: {
|
|
477
|
+
plan: ContainerPlan;
|
|
478
|
+
labels: Record<string, string>;
|
|
479
|
+
}, ctx: ContainerContext) => ContainerCreated | Promise<ContainerCreated>;
|
|
480
|
+
signal: (ref: ContainerRef, signal: string, ctx: ContainerContext) => void | Promise<void>;
|
|
481
|
+
/** Stops a container within graceMs, then kills it; an exited one is no error. */
|
|
482
|
+
stop: (ref: ContainerRef, graceMs: number, ctx: ContainerContext) => void | Promise<void>;
|
|
483
|
+
inspect: (ref: ContainerRef, ctx: ContainerContext) => ContainerStatus | Promise<ContainerStatus>;
|
|
484
|
+
list: (owner: ResourceOwner, ctx: ContainerContext) => ContainerStatus[] | Promise<ContainerStatus[]>;
|
|
485
|
+
remove: (ref: ContainerRef, ctx: ContainerContext) => void | Promise<void>;
|
|
486
|
+
/** The address the host serves the toolbelt on for a binding's config, or "" when its containers reach the socket. */
|
|
487
|
+
forward?: (config: ContainerConfig<Infer<S>>, ctx: ContainerContext) => string | Promise<string>;
|
|
488
|
+
/** Where an execution runs, before anything is acquired for it; prefer is where the Work last ran. */
|
|
489
|
+
place?: (r: {
|
|
490
|
+
owner: ResourceOwner;
|
|
491
|
+
config: ContainerConfig<Infer<S>>;
|
|
492
|
+
prefer: string;
|
|
493
|
+
}, ctx: ContainerContext) => Placement | Promise<Placement>;
|
|
494
|
+
siteRun?: (placement: string, command: SiteRun, ctx: ContainerContext) => SiteOutcome | Promise<SiteOutcome>;
|
|
495
|
+
/** Brings back what an exited container wrote; collecting again changes nothing, and one with nothing to collect is no error. */
|
|
496
|
+
collect?: (ref: ContainerRef, ctx: ContainerContext) => void | Promise<void>;
|
|
497
|
+
reattach?: (ref: ContainerRef, at: ContainerReattach, ctx: ContainerContext) => ContainerCreated | Promise<ContainerCreated>;
|
|
498
|
+
}
|
|
499
|
+
interface ContainerHandler {
|
|
500
|
+
validate: (config: unknown) => Promise<void>;
|
|
501
|
+
serve: (method: string, raw: unknown, ctx: ContainerContext) => Promise<unknown>;
|
|
502
|
+
}
|
|
229
503
|
export type MigrateFn = (from: number, to: number, ctx: Context) => void | Promise<void>;
|
|
230
504
|
export interface Options {
|
|
231
505
|
/** The extension's own version (required). */
|
|
@@ -307,6 +581,201 @@ export declare class Extension {
|
|
|
307
581
|
route<S extends Type<unknown> = Type<Record<string, unknown>>>(handler: string, spec: RouteSpec<S>): this;
|
|
308
582
|
/** Declares a kind of Work the extension's routes create, with its lifecycle. */
|
|
309
583
|
workKind(kind: string, spec?: WorkKindSpec): this;
|
|
584
|
+
/**
|
|
585
|
+
* Registers a secret reference scheme and declares it (manifest
|
|
586
|
+
* secret_schemes): config may then name a secret as
|
|
587
|
+
* "<scheme>:<reference>", and the host asks serve for its value only
|
|
588
|
+
* when the slot's authorised consumer needs it. A spec with store and
|
|
589
|
+
* delete declares the scheme writable, so the daemon's secret store can
|
|
590
|
+
* write to it (settings.secret_store).
|
|
591
|
+
*/
|
|
592
|
+
secretScheme(scheme: string, spec: SecretSchemeSpec): this;
|
|
593
|
+
/**
|
|
594
|
+
* Registers a credential verifier type and declares it (manifest
|
|
595
|
+
* verifiers): an admin may then trust an issuer of the type, whose
|
|
596
|
+
* config validate (kind verifier) checks against spec.config and
|
|
597
|
+
* spec.validate, and the host asks verify, through credential.verify,
|
|
598
|
+
* about each bearer credential it didn't issue itself.
|
|
599
|
+
*/
|
|
600
|
+
verifier<S extends Type<unknown> = Type<Record<string, unknown>>>(type: string, spec: VerifierSpec<S>): this;
|
|
601
|
+
/**
|
|
602
|
+
* Registers a container provider type and declares it (manifest
|
|
603
|
+
* containers), with forward, place, collect and reattach as the spec
|
|
604
|
+
* gives them: a binding's container config may then name the type, the
|
|
605
|
+
* host checks it through validate (kind container) against
|
|
606
|
+
* spec.settings and spec.validate, and binds it to each attempt through
|
|
607
|
+
* container_provider.*.
|
|
608
|
+
*/
|
|
609
|
+
containerProvider<S extends Type<unknown> = Type<Record<string, unknown>>>(type: string, spec: ContainerSpec<S>): this;
|
|
610
|
+
/**
|
|
611
|
+
* Registers a resource provider type and declares it (manifest
|
|
612
|
+
* resources), with mode_default, sandbox, sweep, unsaved and sites as
|
|
613
|
+
* the spec gives them: a binding's resource config may then name the
|
|
614
|
+
* type, the host checks it through validate (kind resource, and the
|
|
615
|
+
* resource_mode, resource_sandbox and resource_site checks) and binds it
|
|
616
|
+
* to each attempt through provider.*.
|
|
617
|
+
*/
|
|
618
|
+
resourceProvider<S extends Type<unknown> = Type<Record<string, unknown>>>(type: string, spec: ResourceProviderSpec<S>): this;
|
|
619
|
+
/**
|
|
620
|
+
* Registers a process sandbox provider type and declares it (manifest
|
|
621
|
+
* sandboxes): a binding's sandbox config may then name the type, the
|
|
622
|
+
* host checks it through validate (kind sandbox) against spec.config and
|
|
623
|
+
* spec.validate, and binds it to each attempt through
|
|
624
|
+
* sandbox_provider.plan and adopt.
|
|
625
|
+
*/
|
|
626
|
+
sandboxProvider<S extends Type<unknown> = Type<Record<string, unknown>>>(type: string, spec: SandboxProviderSpec<S>): this;
|
|
627
|
+
/**
|
|
628
|
+
* Registers a tunnel provider type and declares it (manifest tunnels):
|
|
629
|
+
* settings.webhooks.tunnel may then name the type, its config checked
|
|
630
|
+
* through validate (kind tunnel) against spec.config and spec.validate,
|
|
631
|
+
* and the host runs it through tunnel.run for as long as it wants the
|
|
632
|
+
* tunnel.
|
|
633
|
+
*/
|
|
634
|
+
tunnelProvider<S extends Type<unknown> = Type<Record<string, unknown>>>(type: string, spec: TunnelProviderSpec<S>): this;
|
|
635
|
+
/**
|
|
636
|
+
* Registers a backup destination type and declares it (manifest
|
|
637
|
+
* backup_destinations): settings.backup.destinations may then name the
|
|
638
|
+
* type, whose config validate (kind backup_destination) checks against
|
|
639
|
+
* spec.config and spec.validate, and the host stores bundles with it
|
|
640
|
+
* through backup_destination.*.
|
|
641
|
+
*/
|
|
642
|
+
backupDestination<S extends Type<unknown> = Type<Record<string, unknown>>>(type: string, spec: BackupDestinationSpec<S>): this;
|
|
643
|
+
/**
|
|
644
|
+
* Registers an executor and declares it (manifest executors), with the
|
|
645
|
+
* capabilities spec.capabilities names and the controls (stop, forget,
|
|
646
|
+
* sweep, live, attach, container_attach, interactive_launch) and
|
|
647
|
+
* answers (resource_mode, playbook, version_probe, folder_config) its
|
|
648
|
+
* handlers give: a binding may then name it, its config checked through
|
|
649
|
+
* validate (kind executor) against spec.config and spec.validate, and
|
|
650
|
+
* the host runs, recovers, resumes, observes and drives its attempts
|
|
651
|
+
* through executor.*. A capability whose handler is missing is refused
|
|
652
|
+
* here, as the host would refuse the binding.
|
|
653
|
+
*/
|
|
654
|
+
executor<S extends Type<unknown> = Type<Record<string, unknown>>>(name: string, spec: ExecutorSpec<S>): this;
|
|
655
|
+
/**
|
|
656
|
+
* Registers the extension's actions, requests and panels on scopes and
|
|
657
|
+
* Work and declares them (manifest actions, panels, secret_actions,
|
|
658
|
+
* entry_named): list offers actions on a target, act authorises one
|
|
659
|
+
* invocation as the Event the host accepts under core.action, requests
|
|
660
|
+
* reports what a person is asked to decide, and panels shows documents
|
|
661
|
+
* whose buttons name the listed actions. list and act come together;
|
|
662
|
+
* panels may stand alone, without buttons.
|
|
663
|
+
*/
|
|
664
|
+
actions(spec: ActionsSpec): this;
|
|
665
|
+
/** Registers the extension's Work annotations, name/value lines on each Work's view, and declares them (manifest annotate). */
|
|
666
|
+
annotate(fn: AnnotateFn): this;
|
|
667
|
+
/**
|
|
668
|
+
* Registers the extension's telemetry exporter and declares it (manifest
|
|
669
|
+
* exporters): the host sends it batches of its lifecycle records through
|
|
670
|
+
* telemetry.export, and shutdown when it shuts the extension down.
|
|
671
|
+
*/
|
|
672
|
+
exporter(spec: ExporterSpec): this;
|
|
673
|
+
/**
|
|
674
|
+
* Registers what receives each collection of the host's meter, and asks
|
|
675
|
+
* for the permission that sends it (telemetry.metrics).
|
|
676
|
+
*/
|
|
677
|
+
metrics(fn: MetricsFn): this;
|
|
678
|
+
/**
|
|
679
|
+
* Registers the extension's telemetry sink, and asks for the permission
|
|
680
|
+
* that sends it every named telemetry event the host records
|
|
681
|
+
* (telemetry.sink). Capturing one is host.capture, under the
|
|
682
|
+
* telemetry.capture permission, which Options.permissions asks for.
|
|
683
|
+
*/
|
|
684
|
+
sink(fn: SinkFn): this;
|
|
685
|
+
/**
|
|
686
|
+
* Registers the extension's run environment and declares it (manifest
|
|
687
|
+
* run_environment): the host asks it for a layer of environment
|
|
688
|
+
* variables and files for each run of a Work in a scope that uses the
|
|
689
|
+
* extension, through run.environment.
|
|
690
|
+
*/
|
|
691
|
+
runEnvironment(fn: RunEnvironmentFn): this;
|
|
692
|
+
/**
|
|
693
|
+
* Registers what the extension's Work proposes for the operator to
|
|
694
|
+
* review and apply, and declares it (manifest config_candidate): the
|
|
695
|
+
* host asks fn about a Work of a kind the extension owns through
|
|
696
|
+
* config.candidate. It asks for the config.read permission, without
|
|
697
|
+
* which the extension has no handles to propose and the host never asks,
|
|
698
|
+
* and which serves the host's config service (host.configBase,
|
|
699
|
+
* configEdit, configValidate and configTrace).
|
|
700
|
+
*/
|
|
701
|
+
configCandidate(fn: ConfigCandidateFn): this;
|
|
702
|
+
/**
|
|
703
|
+
* Registers the extension's `open-conduit init <type>` flow and declares
|
|
704
|
+
* it (manifest setup): the host runs it through setup.run, and answers
|
|
705
|
+
* the setup.* callbacks its SetupHost makes while it lasts. A package
|
|
706
|
+
* declares at most one.
|
|
707
|
+
*/
|
|
708
|
+
setup(spec: SetupSpec): this;
|
|
709
|
+
/**
|
|
710
|
+
* Registers a calendar recurrence kind and declares it (manifest
|
|
711
|
+
* recurrences): host.armTimer arms a timer of the kind, and each time it
|
|
712
|
+
* fires the host asks fn for the occurrence and the next timer
|
|
713
|
+
* (recurrence.next), inside the transaction that fires it. fn is
|
|
714
|
+
* synchronous and gets no host (see RecurrenceFn).
|
|
715
|
+
*/
|
|
716
|
+
recurrence(kind: string, fn: RecurrenceFn): this;
|
|
717
|
+
/**
|
|
718
|
+
* Registers the filter of the extension's wait operations' dependencies
|
|
719
|
+
* and declares it (manifest dependency_filter; it needs a wait
|
|
720
|
+
* operation): the host asks fn whether an Event on a dependency matches
|
|
721
|
+
* the filter the wait put on it (dependency.filter), inside its
|
|
722
|
+
* transaction. fn is synchronous and gets no host.
|
|
723
|
+
*/
|
|
724
|
+
dependencyFilter(fn: DependencyFilterFn): this;
|
|
725
|
+
/**
|
|
726
|
+
* Registers the extension's gate on other extensions' operations and
|
|
727
|
+
* declares it (manifest operation_gate), asking for the operation.gate
|
|
728
|
+
* permission, which the operator consents to at install and without
|
|
729
|
+
* which the host never asks: the host asks fn about every toolbelt call
|
|
730
|
+
* to another extension's operation in the extension's scopes
|
|
731
|
+
* (operation.gate), and it may let the call through, park the caller or
|
|
732
|
+
* refuse it.
|
|
733
|
+
*/
|
|
734
|
+
operationGate(fn: OperationGateFn): this;
|
|
735
|
+
/**
|
|
736
|
+
* Registers the extension's start gate and declares it (manifest
|
|
737
|
+
* start_gate), asking for the work.start_gate permission, which the
|
|
738
|
+
* operator consents to at install and without which the host never
|
|
739
|
+
* asks: the host asks fn before the first attempt of any Work in the
|
|
740
|
+
* extension's scopes starts (work.admit), and it may hold the Work until
|
|
741
|
+
* host.settleHold admits or cancels it.
|
|
742
|
+
*/
|
|
743
|
+
startGate(fn: StartGateFn): this;
|
|
744
|
+
/**
|
|
745
|
+
* Registers the resolver of a wait target kind ("job" for a
|
|
746
|
+
* `job:<name>` condition another extension's wait operation names) and
|
|
747
|
+
* declares it (manifest targets): the host asks fn through
|
|
748
|
+
* target.resolve. The Event types it answers must be the extension's own
|
|
749
|
+
* families.
|
|
750
|
+
*/
|
|
751
|
+
target(kind: string, fn: TargetFn): this;
|
|
752
|
+
/**
|
|
753
|
+
* Registers what the extension does when an execution's container
|
|
754
|
+
* segment ends, revoking what it issued for it, and declares it
|
|
755
|
+
* (manifest segment_end; segment.ended).
|
|
756
|
+
*/
|
|
757
|
+
onSegmentEnd(fn: SegmentEndFn): this;
|
|
758
|
+
/**
|
|
759
|
+
* Registers how the extension renders Events of its own families for an
|
|
760
|
+
* agent's prompt and declares it (manifest render; event.render). The
|
|
761
|
+
* host bounds each call and falls back to its generic rendering when fn
|
|
762
|
+
* answers undefined, throws or is slow.
|
|
763
|
+
*/
|
|
764
|
+
render(fn: RenderFn): this;
|
|
765
|
+
/**
|
|
766
|
+
* Declares a page of the extension's own in the operator's web view
|
|
767
|
+
* (manifest pages): a session of one of its Work kinds, started from a
|
|
768
|
+
* scope with one of its entries, drawn by core from the entry's actions
|
|
769
|
+
* and the session's panels. It needs actions, and the entry type, work
|
|
770
|
+
* kind and route it names declared too, which the host checks.
|
|
771
|
+
*/
|
|
772
|
+
page(id: string, spec: PageSpec): this;
|
|
773
|
+
/**
|
|
774
|
+
* Registers a read-only setup probe and declares it (manifest probes):
|
|
775
|
+
* the host lists it as "<extension>.<name>" to setup sessions and runs
|
|
776
|
+
* it through probe.serve, with its declared arguments only.
|
|
777
|
+
*/
|
|
778
|
+
probe(name: string, spec: ProbeSpec): this;
|
|
310
779
|
/** Registers a doctor check and declares it. */
|
|
311
780
|
check(name: string, fn: CheckFn, o?: {
|
|
312
781
|
deep?: boolean;
|
|
@@ -342,6 +811,30 @@ export declare class Extension {
|
|
|
342
811
|
entryTypes: Map<string, EntryType>;
|
|
343
812
|
routes: Map<string, RouteHandler>;
|
|
344
813
|
triggers: Map<string, (inputs: Event[]) => number>;
|
|
814
|
+
secrets: Map<string, SecretSchemeSpec>;
|
|
815
|
+
verifiers: Map<string, VerifierHandler>;
|
|
816
|
+
containers: Map<string, ContainerHandler>;
|
|
817
|
+
resources: Map<string, ResourceHandler>;
|
|
818
|
+
sandboxes: Map<string, SandboxHandler>;
|
|
819
|
+
tunnels: Map<string, TunnelHandler>;
|
|
820
|
+
backups: Map<string, BackupHandler>;
|
|
821
|
+
executors: Map<string, ExecutorHandler>;
|
|
822
|
+
probes: Map<string, ProbeHandler>;
|
|
823
|
+
actions: ActionsHandler | undefined;
|
|
824
|
+
annotate: AnnotateFn | undefined;
|
|
825
|
+
exporter: ExporterSpec | undefined;
|
|
826
|
+
metrics: MetricsFn | undefined;
|
|
827
|
+
sink: SinkFn | undefined;
|
|
828
|
+
runEnvironment: RunEnvironmentFn | undefined;
|
|
829
|
+
configCandidate: ConfigCandidateFn | undefined;
|
|
830
|
+
setup: SetupSpec | undefined;
|
|
831
|
+
recurrences: Map<string, RecurrenceFn>;
|
|
832
|
+
targets: Map<string, TargetFn>;
|
|
833
|
+
filter: DependencyFilterFn | undefined;
|
|
834
|
+
gate: OperationGateFn | undefined;
|
|
835
|
+
startGate: StartGateFn | undefined;
|
|
836
|
+
segmentEnd: SegmentEndFn | undefined;
|
|
837
|
+
render: RenderFn | undefined;
|
|
345
838
|
migrate: MigrateFn | undefined;
|
|
346
839
|
};
|
|
347
840
|
}
|
|
@@ -354,6 +847,8 @@ export declare class Server {
|
|
|
354
847
|
get done(): Promise<void>;
|
|
355
848
|
/** The private state directory the host gave at initialize. */
|
|
356
849
|
get stateDir(): string;
|
|
850
|
+
/** The operator's config file's directory the host named at initialize ("" for none), against which a relative path in a config resolves. */
|
|
851
|
+
get configDir(): string;
|
|
357
852
|
/** Ends the connection. */
|
|
358
853
|
close(): void;
|
|
359
854
|
}
|