@rivet-dev/pi 0.1.0 → 0.5.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.
Files changed (66) hide show
  1. package/LICENSE +190 -0
  2. package/dist/actions.d.ts +188 -77
  3. package/dist/actions.d.ts.map +1 -1
  4. package/dist/actions.js +276 -103
  5. package/dist/actions.js.map +1 -1
  6. package/dist/actor-config.d.ts +32 -0
  7. package/dist/actor-config.d.ts.map +1 -0
  8. package/dist/actor-config.js +86 -0
  9. package/dist/actor-config.js.map +1 -0
  10. package/dist/actor-sqlite.d.ts +10 -0
  11. package/dist/actor-sqlite.d.ts.map +1 -0
  12. package/dist/actor-sqlite.js +32 -0
  13. package/dist/actor-sqlite.js.map +1 -0
  14. package/dist/actor-types.d.ts +34 -0
  15. package/dist/actor-types.d.ts.map +1 -0
  16. package/dist/actor-types.js +2 -0
  17. package/dist/actor-types.js.map +1 -0
  18. package/dist/actor.d.ts +27 -15
  19. package/dist/actor.d.ts.map +1 -1
  20. package/dist/actor.js +71 -78
  21. package/dist/actor.js.map +1 -1
  22. package/dist/credentials.d.ts +3 -4
  23. package/dist/credentials.d.ts.map +1 -1
  24. package/dist/credentials.js +11 -38
  25. package/dist/credentials.js.map +1 -1
  26. package/dist/drain.d.ts +12 -0
  27. package/dist/drain.d.ts.map +1 -0
  28. package/dist/drain.js +20 -0
  29. package/dist/drain.js.map +1 -0
  30. package/dist/durable.d.ts +24 -0
  31. package/dist/durable.d.ts.map +1 -0
  32. package/dist/durable.js +5 -0
  33. package/dist/durable.js.map +1 -0
  34. package/dist/errors.d.ts +8 -0
  35. package/dist/errors.d.ts.map +1 -0
  36. package/dist/errors.js +19 -0
  37. package/dist/errors.js.map +1 -0
  38. package/dist/index.d.ts +5 -4
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +1 -1
  41. package/dist/index.js.map +1 -1
  42. package/dist/models.d.ts +7 -33
  43. package/dist/models.d.ts.map +1 -1
  44. package/dist/models.js +4 -67
  45. package/dist/models.js.map +1 -1
  46. package/dist/runtime.d.ts +111 -43
  47. package/dist/runtime.d.ts.map +1 -1
  48. package/dist/runtime.js +444 -225
  49. package/dist/runtime.js.map +1 -1
  50. package/dist/storage.d.ts +27 -28
  51. package/dist/storage.d.ts.map +1 -1
  52. package/dist/storage.js +33 -55
  53. package/dist/storage.js.map +1 -1
  54. package/dist/tracing.d.ts +7 -4
  55. package/dist/tracing.d.ts.map +1 -1
  56. package/dist/tracing.js +11 -12
  57. package/dist/tracing.js.map +1 -1
  58. package/dist/watches.d.ts +77 -0
  59. package/dist/watches.d.ts.map +1 -0
  60. package/dist/watches.js +245 -0
  61. package/dist/watches.js.map +1 -0
  62. package/package.json +38 -15
  63. package/dist/sandbox.d.ts +0 -21
  64. package/dist/sandbox.d.ts.map +0 -1
  65. package/dist/sandbox.js +0 -185
  66. package/dist/sandbox.js.map +0 -1
package/dist/models.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type AgentSession, type CreateModelRuntimeOptions, ModelRuntime } from "@earendil-works/pi-coding-agent";
1
+ import { type CreateModelRuntimeOptions, ModelRuntime } from "@earendil-works/pi-coding-agent";
2
2
  import type { PiCredentialSource } from "./credentials.js";
3
3
  import type { PiContext } from "./runtime.js";
4
4
  /** Pi's credential store interface. `read`, `list`, `modify`, and `delete`, keyed by provider id. */
@@ -7,16 +7,13 @@ export type PiCredentialStore = NonNullable<CreateModelRuntimeOptions["credentia
7
7
  export type PiCredential = NonNullable<Awaited<ReturnType<PiCredentialStore["read"]>>>;
8
8
  /** A custom provider, the same shape as one entry of Pi's `models.json` `providers`. */
9
9
  export type PiProviderConfig = Parameters<ModelRuntime["registerProvider"]>[1];
10
- /** A model from Pi's catalog. */
11
- export type PiModel = NonNullable<ReturnType<ModelRuntime["getModel"]>>;
12
10
  /** Model and credential options accepted by `pi()`. */
13
11
  export interface PiModelOptions {
14
- /** The model for a new session, as `provider/modelId`, such as `anthropic/claude-opus-5-5`. */
12
+ /** The model of every new conversation, as `provider/modelId`, such as `anthropic/claude-opus-5-5`. */
15
13
  model?: string;
16
14
  /**
17
- * Models a client may switch to with `setModel`, as `provider/modelId`.
18
- * Without it, only `model`. Unlike Pi's scoped models, which only limit
19
- * cycling, this is a hard limit.
15
+ * Models a client may choose with `conversation.configure`, as `provider/modelId`.
16
+ * Without it, only `model`.
20
17
  */
21
18
  scopedModels?: string[];
22
19
  /** Custom providers registered on the actor's model runtime. */
@@ -32,16 +29,6 @@ export interface PiModelOptions {
32
29
  */
33
30
  credentials?: (c: PiContext) => PiCredentialSource;
34
31
  }
35
- /** A model a client may switch to. */
36
- export interface PiModelInfo {
37
- provider: string;
38
- id: string;
39
- name: string;
40
- reasoning: boolean;
41
- input: PiModel["input"];
42
- contextWindow: number;
43
- maxTokens: number;
44
- }
45
32
  /** The model options that decide which models a client may use. */
46
33
  type AllowlistOptions = Pick<PiModelOptions, "model" | "scopedModels">;
47
34
  /**
@@ -53,22 +40,9 @@ export declare function createActorModelRuntime(options: Omit<PiModelOptions, "c
53
40
  /** A credential store that holds nothing and refuses writes. */
54
41
  export declare const emptyCredentialStore: PiCredentialStore;
55
42
  /**
56
- * The model a session opens with: the model saved in the session when it is
57
- * still allowed, otherwise the configured default. Undefined lets Pi choose,
58
- * which only happens when no model is configured.
59
- */
60
- export declare function openingModel(options: AllowlistOptions, runtime: ModelRuntime, saved: {
61
- provider: string;
62
- modelId: string;
63
- } | null): PiModel | undefined;
64
- /** Allowed models that have a credential, for a client's model picker. */
65
- export declare function availableModels(options: AllowlistOptions, session: AgentSession): PiModelInfo[];
66
- /** Throws `model_unavailable` when the session's model has no credential, for example after a logout. */
67
- export declare function requireCredential(session: AgentSession): void;
68
- /**
69
- * Switches the session to an allowed model. The model object comes from the
70
- * runtime's catalog, so a client can never choose the URL a key is sent to.
43
+ * Throws unless a client may switch to `provider/modelId`. With neither
44
+ * `model` nor `scopedModels` set, a client may not choose any model.
71
45
  */
72
- export declare function switchModel(options: AllowlistOptions, session: AgentSession, provider: string, modelId: string): Promise<void>;
46
+ export declare function assertModelAllowed(options: AllowlistOptions, provider: string, modelId: string): void;
73
47
  export {};
74
48
  //# sourceMappingURL=models.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,yBAAyB,EAC9B,YAAY,EACZ,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,qGAAqG;AACrG,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAC,yBAAyB,CAAC,aAAa,CAAC,CAAC,CAAC;AAEtF,0EAA0E;AAC1E,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAEvF,wFAAwF;AACxF,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/E,iCAAiC;AACjC,MAAM,MAAM,OAAO,GAAG,WAAW,CAAC,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;AAExE,uDAAuD;AACvD,MAAM,WAAW,cAAc;IAC9B,+FAA+F;IAC/F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC7C;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,CAAC,EAA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,eAAO,MAAM,oBAAoB,EAAE,iBAalC,CAAC;AAeF;;;GAGG;AACH,wBAAgB,kBAAkB,CACjC,OAAO,EAAE,gBAAgB,EACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACb,IAAI,CAON"}
package/dist/models.js CHANGED
@@ -36,76 +36,13 @@ function allowedModels(options) {
36
36
  function isAllowed(options, provider, modelId) {
37
37
  return allowedModels(options).includes(`${provider}/${modelId}`);
38
38
  }
39
- /** Looks up a `provider/modelId` in the actor's catalog. */
40
- function catalogModel(runtime, name) {
41
- const slash = name.indexOf("/");
42
- const model = slash > 0 ? runtime.getModel(name.slice(0, slash), name.slice(slash + 1)) : undefined;
43
- if (!model) {
44
- throw new Error(`pi() model ${name} is not in Pi's model catalog; add it with providers`);
45
- }
46
- return model;
47
- }
48
- /**
49
- * The model a session opens with: the model saved in the session when it is
50
- * still allowed, otherwise the configured default. Undefined lets Pi choose,
51
- * which only happens when no model is configured.
52
- */
53
- export function openingModel(options, runtime, saved) {
54
- if (saved && isAllowed(options, saved.provider, saved.modelId)) {
55
- const model = runtime.getModel(saved.provider, saved.modelId);
56
- if (model)
57
- return model;
58
- }
59
- const fallback = options.model ?? allowedModels(options)[0];
60
- return fallback ? catalogModel(runtime, fallback) : undefined;
61
- }
62
- /** Allowed models that have a credential, for a client's model picker. */
63
- export function availableModels(options, session) {
64
- return session.modelRuntime
65
- .getAvailableSnapshot()
66
- .filter((model) => isAllowed(options, model.provider, model.id))
67
- .map((model) => ({
68
- provider: model.provider,
69
- id: model.id,
70
- name: model.name,
71
- reasoning: model.reasoning,
72
- input: model.input,
73
- contextWindow: model.contextWindow,
74
- maxTokens: model.maxTokens,
75
- }));
76
- }
77
- /** Throws `model_unavailable` when the session's model has no credential, for example after a logout. */
78
- export function requireCredential(session) {
79
- const model = session.model;
80
- if (!model)
81
- return;
82
- const available = session.modelRuntime
83
- .getAvailableSnapshot()
84
- .some((candidate) => candidate.provider === model.provider && candidate.id === model.id);
85
- if (!available) {
86
- throw new UserError(`No credential is configured for ${model.provider}/${model.id}.`, {
87
- code: "model_unavailable",
88
- });
89
- }
90
- }
91
39
  /**
92
- * Switches the session to an allowed model. The model object comes from the
93
- * runtime's catalog, so a client can never choose the URL a key is sent to.
40
+ * Throws unless a client may switch to `provider/modelId`. With neither
41
+ * `model` nor `scopedModels` set, a client may not choose any model.
94
42
  */
95
- export async function switchModel(options, session, provider, modelId) {
43
+ export function assertModelAllowed(options, provider, modelId) {
96
44
  if (!isAllowed(options, provider, modelId)) {
97
- throw new UserError(`Model ${provider}/${modelId} is not allowed for this agent.`, {
98
- code: "model_not_allowed",
99
- });
100
- }
101
- const model = session.modelRuntime
102
- .getAvailableSnapshot()
103
- .find((candidate) => candidate.provider === provider && candidate.id === modelId);
104
- if (!model) {
105
- throw new UserError(`No credential is configured for ${provider}/${modelId}.`, {
106
- code: "model_unavailable",
107
- });
45
+ throw new UserError(`Model ${provider}/${modelId} is not allowed for this agent.`, { code: "model_not_allowed" });
108
46
  }
109
- await session.setModel(model);
110
47
  }
111
48
  //# sourceMappingURL=models.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,YAAY,GACZ,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAsDrC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC5C,OAA4C,EAC5C,WAA8B;IAE9B,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7E,KAAK,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,EAAE,CAAC;QAC5E,OAAO,CAAC,gBAAgB,CAAC,UAAU,EAAE,MAAM,CAAC,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/runtime.d.ts CHANGED
@@ -1,64 +1,132 @@
1
- import { type AgentSession, type BashOperations, type CreateAgentSessionOptions, SettingsManager } from "@earendil-works/pi-coding-agent";
1
+ import type { Context } from "@earendil-works/chord";
2
+ import type { Models, ModelThinkingLevel } from "@earendil-works/pi-ai";
3
+ import { type ConversationDocToken, Harness, type HarnessOptions, type HarnessSettings, type ModelRef } from "@earendil-works/pi-durable";
2
4
  import type { Sandbox, SandboxProvider } from "@rivet-dev/sandbox-adapter";
3
- import type { ActorContext } from "rivetkit";
5
+ import { type ActorContext } from "rivetkit";
4
6
  import type { DatabaseProvider, RawAccess } from "rivetkit/db";
5
- import { SourceCredentialStore } from "./credentials.js";
6
7
  import { type PiModelOptions } from "./models.js";
7
- import { type PiSettings } from "./storage.js";
8
+ import { type ConnectionWatches } from "./watches.js";
8
9
  export type PiDatabaseProvider = DatabaseProvider<RawAccess>;
9
10
  /** The actor context shape every Pi helper works against. */
10
11
  export type PiContext = ActorContext<any, any, any, any, any, PiDatabaseProvider, any, any>;
11
- /** Pi options accepted by `pi()` on top of ordinary actor config. */
12
- export interface PiSessionOptions extends Omit<CreateAgentSessionOptions, "sessionManager" | "settingsManager" | "modelRuntime" | "model" | "scopedModels">, PiModelOptions {
13
- /** Initial Pi settings for a brand-new session. Later changes persist per actor. */
14
- settings?: Partial<PiSettings>;
15
- /**
16
- * Runs Pi's built-in file and shell tools in a sandbox. Without one, Pi has
17
- * no file or shell tools and only the `customTools` passed in.
18
- */
19
- sandbox?: SandboxProvider;
20
- }
21
- /** One open Pi session for a live actor generation. */
22
- export interface PiSession {
23
- session: AgentSession;
24
- settingsManager: SettingsManager;
25
- cwd: string;
26
- sandbox: ConnectedSandbox | undefined;
27
- /** Command execution for `executeBash`. Undefined when there is no sandbox. */
28
- bashOperations: BashOperations | undefined;
29
- /** JSON of the settings last written to SQLite, to skip no-op writes. */
30
- persistedSettings: string;
31
- /** Entries (header excluded) already written to SQLite, in Pi's append order. */
32
- persistedEntryCount: number;
33
- /** The application's credentials, when `pi({ credentials })` is set. */
34
- credentials: SourceCredentialStore | undefined;
35
- }
36
- /** The sandbox a session's tools run in for this actor generation. */
12
+ /** How an actor generation stops. A sleep drains until `drainUntil`; a destroy stops at once. */
13
+ export type PiStop = {
14
+ reason: "sleep";
15
+ drainUntil: number;
16
+ } | {
17
+ reason: "destroy";
18
+ };
19
+ /** The sandbox Pi's tools run in for this actor generation. */
37
20
  export interface ConnectedSandbox {
38
21
  provider: SandboxProvider;
39
22
  id: string;
40
23
  sandbox: Sandbox;
41
24
  }
42
- /** Per-actor-generation runtime state, stored on `c.vars` under `PI_RUNTIME`. */
25
+ /**
26
+ * Options accepted by `pi()` on top of ordinary actor config. The Pi
27
+ * Durable options keep the names and types of `HarnessOptions`.
28
+ */
29
+ export interface PiOptions extends PiModelOptions {
30
+ /** Pi Durable's extension registry: tools, hooks, sections, tasks, and documents. */
31
+ registry: HarnessOptions["registry"];
32
+ /** pi-ai model access. Without it, the actor builds it from `model`, `providers`, `apiKeys`, and `credentials`. */
33
+ models?: Models;
34
+ settings?: HarnessSettings;
35
+ /**
36
+ * Builds a conversation's environment. Without it, the actor builds one from
37
+ * `sandbox`, or stores files in its own database when there is no sandbox.
38
+ */
39
+ env?: HarnessOptions["env"];
40
+ conversationCreated?: HarnessOptions["conversationCreated"];
41
+ now?: HarnessOptions["now"];
42
+ onReport?: HarnessOptions["onReport"];
43
+ /** The starting thinking level of every new conversation. */
44
+ thinkingLevel?: ModelThinkingLevel;
45
+ /**
46
+ * Runs the tools of Pi's `CodingTools` extension in a sandbox. Used only
47
+ * when `env` is omitted. Without a sandbox, files live in the actor's
48
+ * database and there is no shell.
49
+ */
50
+ sandbox?: SandboxProvider;
51
+ /** App documents that clients may read by `kind` with `harness.snapshot`. */
52
+ documents?: readonly ConversationDocToken<any>[];
53
+ }
54
+ interface OpenHarness {
55
+ harness: Harness;
56
+ stopBusyWatch: () => void;
57
+ isBusy: () => Promise<boolean>;
58
+ }
59
+ /** Per-actor-generation state, stored on `c.vars` under `PI_RUNTIME`. */
43
60
  export interface PiRuntime {
44
- ready?: Promise<PiSession>;
45
- /** Serializes SQLite entry writes so entries keep their append order. Never rejects. */
46
- writes: Promise<void>;
61
+ /** The open harness, or the open in progress. */
62
+ harness?: Promise<OpenHarness>;
63
+ sandbox?: Promise<ConnectedSandbox>;
64
+ /** Set when the actor starts to sleep or is destroyed. */
65
+ closing: boolean;
66
+ /**
67
+ * The `onWake` context. Background work (keep-awake, scheduled wakes, the
68
+ * sandbox, reopening) uses it, because an action's context is cancelled
69
+ * with the action.
70
+ */
71
+ actor?: PiContext;
72
+ /** Open Pi watches of connections, for this generation. */
73
+ watches: ConnectionWatches;
47
74
  }
48
75
  export declare const PI_RUNTIME: unique symbol;
49
76
  export declare function createPiRuntime(): PiRuntime;
50
77
  export declare function piRuntime(c: PiContext): PiRuntime;
51
- /** Returns the actor's Pi session, opening it from SQLite on first use. */
52
- export declare function ensurePiSession(c: PiContext, options: PiSessionOptions): Promise<PiSession>;
53
78
  /**
54
- * Queues entries appended since the last flush and writes Pi's mutable settings
55
- * when they changed. Called after every action and on shutdown.
79
+ * Opens the harness on wake without resuming interrupted work, so the app's
80
+ * `onWake` runs first. The caller calls `harness.resume()` after it. The wake
81
+ * context becomes the context of all background work.
82
+ */
83
+ export declare function openOnWake(c: PiContext, options: PiOptions): Promise<Harness>;
84
+ /**
85
+ * Runs an action against the harness. A failed call that left Pi Durable
86
+ * unusable reopens it before the error reaches the client, so the next call
87
+ * works. Calls use `BACKGROUND_CONTEXT`, so a wait such as `prompt` lasts
88
+ * until the run settles or the action times out, including while a stopping
89
+ * actor drains the run. RivetKit's action signal also fires when the actor
90
+ * starts to stop, so it cannot cancel a wait.
91
+ */
92
+ export declare function withHarness<T>(c: PiContext, options: PiOptions, run: (harness: Harness, context: Context) => Promise<T>): Promise<T>;
93
+ /**
94
+ * Runs one of the app's own actions or hooks with the harness on `c.pi`. A
95
+ * failure that left Pi Durable unusable reopens it. The error reaches the
96
+ * client as from a built-in action. Code that never reads `c.pi` runs even
97
+ * when Pi Durable is closed or cannot open; reading `c.pi` throws the cause.
98
+ * Shutdown hooks pass `opensHarness: false`, so they use a harness that is
99
+ * already open and never open and resume one only to close it.
100
+ */
101
+ export declare function withPiAccess<T>(c: PiContext, options: PiOptions, body: () => T | Promise<T>, { opensHarness }?: {
102
+ opensHarness?: boolean;
103
+ }): Promise<T>;
104
+ /** App documents by `kind`, for clients that name a document. */
105
+ export declare function documentsByKind(options: PiOptions): ReadonlyMap<string, ConversationDocToken<any>>;
106
+ /** Parses `provider/modelId`. */
107
+ export declare function parseModelRef(name: string): ModelRef;
108
+ /**
109
+ * Closes Pi Durable for this actor generation. On sleep it drains first. On
110
+ * destroy it stops running work at once. Records of interrupted work stay
111
+ * running, and the next open resumes them. Then suspends the sandbox on
112
+ * sleep, or destroys it on destroy.
113
+ */
114
+ export declare function closeHarness(c: PiContext, options: PiOptions, stop: PiStop): Promise<void>;
115
+ /** Runs `body` with a `c.pi` that throws `error` when read. */
116
+ export declare function withUnavailablePi<T>(c: PiContext, error: unknown, body: () => T | Promise<T>): T | Promise<T>;
117
+ /**
118
+ * Connects to the actor's sandbox, creating one when none is stored or the
119
+ * provider reports the stored one no longer exists. A new sandbox id is saved
120
+ * as soon as `create` returns, so a failure later in the start reuses it. Any
121
+ * other connect failure is thrown, so a temporary outage never replaces a
122
+ * sandbox.
56
123
  */
57
- export declare function persistPiState(c: PiContext, handle: PiSession): Promise<void>;
124
+ export declare function connectSandbox(c: PiContext, provider: SandboxProvider): Promise<ConnectedSandbox>;
58
125
  /**
59
- * Stops the Pi session for this actor generation: aborts any run, lets
60
- * extensions shut down, and flushes settings and entries. Then suspends the
61
- * sandbox on sleep, or destroys it on destroy.
126
+ * Suspends the sandbox this generation connected when the actor sleeps. On
127
+ * destroy it destroys the actor's sandbox, also one stored by an earlier
128
+ * generation that this one never connected.
62
129
  */
63
- export declare function closePiSession(c: PiContext, options: PiSessionOptions, reason: "sleep" | "destroy"): Promise<void>;
130
+ export declare function closeSandbox(c: PiContext, provider: SandboxProvider, connection: Promise<ConnectedSandbox> | undefined, stop: PiStop): Promise<void>;
131
+ export {};
64
132
  //# sourceMappingURL=runtime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,YAAY,EAEjB,KAAK,cAAc,EAEnB,KAAK,yBAAyB,EAI9B,eAAe,EACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAIN,KAAK,cAAc,EACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EAKN,KAAK,UAAU,EAKf,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;AAE7D,6DAA6D;AAC7D,MAAM,MAAM,SAAS,GAAG,YAAY,CACnC,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,GAAG,EACH,kBAAkB,EAClB,GAAG,EACH,GAAG,CACH,CAAC;AAEF,qEAAqE;AACrE,MAAM,WAAW,gBAChB,SAAQ,IAAI,CACV,yBAAyB,EACzB,gBAAgB,GAAG,iBAAiB,GAAG,cAAc,GAAG,OAAO,GAAG,cAAc,CAChF,EACD,cAAc;IACf,oFAAoF;IACpF,QAAQ,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/B;;;OAGG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC;CAC1B;AAED,uDAAuD;AACvD,MAAM,WAAW,SAAS;IACzB,OAA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