@asterism-app/sdk 1.13.2 → 2.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/README.md +8 -0
- package/docs/getting-started.md +13 -3
- package/docs/minimal-plugin.md +6 -0
- package/docs/project-structure.md +8 -0
- package/examples/counter/README.md +29 -0
- package/examples/counter/package.json +26 -7
- package/package.json +4 -2
- package/src/error-details.ts +12 -0
- package/src/models.ts +2 -0
- package/src/reference-urls.ts +3 -2
- package/src/renderer-references.ts +32 -0
- package/src/renderer.ts +3 -0
- package/src/resource-activity.ts +6 -3
- package/src/runtime-execution.ts +2 -0
- package/src/runtime-terminal.ts +6 -1
package/README.md
CHANGED
|
@@ -14,6 +14,14 @@ Use a compatible SDK version for development and treat the running application a
|
|
|
14
14
|
|
|
15
15
|
Validate both contract agreement and actual integration. Type checking cannot establish that a distributed plugin includes all required assets, works in the intended application, or releases the work it owns.
|
|
16
16
|
|
|
17
|
+
## Deliver an explicit build
|
|
18
|
+
|
|
19
|
+
Use `@asterism-app/plugin-build` as an authoring dependency and run its `asterism-plugin-build` CLI explicitly. Source entries belong under `asterism.build`; the build writes the loaded artifact into `dist`. Build, add the package directory, and restart. Later source changes require another build and restart, not a different plugin mode.
|
|
20
|
+
|
|
21
|
+
Declare host packages and other plugins' public packages as peer dependencies; the artifact keeps those imports external so they bind to the running instances. Ordinary dependencies stay private, and the backend loads them from the installed package.
|
|
22
|
+
|
|
23
|
+
Build before packing and inspect the tarball. Typechecking and a successful build do not establish installed-application or platform compatibility.
|
|
24
|
+
|
|
17
25
|
## Keep authoring material purposeful
|
|
18
26
|
|
|
19
27
|
The package includes prose guides and maintained source examples. Guides explain mental models, ownership, integration choices, and working principles; public declarations and examples carry concrete interfaces and assembly. The complete counter package provides a small design to adapt, not a required architecture for every plugin.
|
package/docs/getting-started.md
CHANGED
|
@@ -4,9 +4,11 @@ Plugin development starts with a capability users need, not a complete framework
|
|
|
4
4
|
|
|
5
5
|
## Target a real application
|
|
6
6
|
|
|
7
|
-
Choose the application release your plugin supports and develop against compatible public packages. Development declarations help the editor and type checker; they do not upgrade the APIs supplied by a running application.
|
|
7
|
+
Choose the application release your plugin supports and develop against compatible public packages. Development declarations help the editor and type checker; they do not upgrade the APIs supplied by a running application. Use the exact development-dependency pins in the complete examples supplied by that target application, or its release's listed public-package versions. Release preparation pairs those examples with their target build. Registry tags such as `latest` and `next` identify channel heads, not the appropriate declarations for every installed or development application.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Validate a copied project outside the application checkout. Workspace dependencies can hide missing authoring dependencies; an independent install and typecheck reveal what an external author actually receives.
|
|
10
|
+
|
|
11
|
+
Host-provided public packages are shared boundaries, not private libraries to bundle into a plugin. Declare them, and other plugins' public packages you import, as peer dependencies; add development dependencies for the declarations the editor reads. The build keeps peer imports external so they bind to the running application's instances or the enabled provider. Ordinary private libraries remain the plugin's dependencies.
|
|
10
12
|
|
|
11
13
|
Preserve imports of original shared contracts. A copied declaration can look identical in TypeScript while no longer identifying the same operation at runtime.
|
|
12
14
|
|
|
@@ -18,6 +20,14 @@ Choose a stable plugin identity before sharing the package. Treat its display na
|
|
|
18
20
|
|
|
19
21
|
Avoid scaffolding unused services, views, and persistence. A small working capability makes ownership and cleanup easier to verify; an empty abstraction says little about whether the plugin works.
|
|
20
22
|
|
|
23
|
+
## Build before loading
|
|
24
|
+
|
|
25
|
+
A plugin directory contains package metadata and a completed artifact in `dist`. Source entries are authoring inputs under `asterism.build`. The official `@asterism-app/plugin-build` package supplies the `asterism-plugin-build` command. Keep it as a development dependency and expose an explicit package build script.
|
|
26
|
+
|
|
27
|
+
Install authoring dependencies, typecheck, and build before adding the package directory to Asterism. Then restart to activate the selection. Repeat the build and restart after source changes. A checkout is a user-owned package directory, not a separate plugin mode: the application neither compiles changed source at startup nor silently substitutes source when output is missing.
|
|
28
|
+
|
|
29
|
+
A successful build replaces `dist` as a whole; a failed build leaves the previous output. Restart a running application after building, because it may still load parts of the replaced output lazily.
|
|
30
|
+
|
|
21
31
|
## Validate distinct boundaries
|
|
22
32
|
|
|
23
33
|
Type checking establishes agreement with the declarations. Loading and exercising the plugin in the target application establishes whether its contributions and dependencies work together. Neither replaces the other.
|
|
@@ -26,6 +36,6 @@ Check the normal path, meaningful invalid input, visible failures, and cleanup w
|
|
|
26
36
|
|
|
27
37
|
## Verify what users receive
|
|
28
38
|
|
|
29
|
-
Test the distributed package in an installed application, not only the source checkout. Include the
|
|
39
|
+
Test the distributed package in an installed application, not only the source checkout. Build before packing, and inspect the actual tarball. Use a clean release checkout. Include the completed output, root metadata, documentation, and translation catalogs, and declare every package the plugin imports at runtime in `dependencies` or `peerDependencies`. Installation must not need to compile plugin source. Files available only on the author's machine should not be necessary.
|
|
30
40
|
|
|
31
41
|
Update public package versions intentionally and repeat the relevant integration checks. A compatible editor view is useful evidence, but the application remains the provider of runtime capabilities.
|
package/docs/minimal-plugin.md
CHANGED
|
@@ -20,6 +20,12 @@ Decide whether each new piece of state is a current value, a historical fact, a
|
|
|
20
20
|
|
|
21
21
|
A Home entry can start a session around the counter without introducing an Agent or a first message. Keep that independence when adapting the example unless conversation is part of the new plugin's domain.
|
|
22
22
|
|
|
23
|
+
## Build the package you will load
|
|
24
|
+
|
|
25
|
+
The counter's package manifest keeps source entries under `asterism.build`; the build writes the loaded artifact into `dist`. Its build script invokes `asterism-plugin-build`. Install dependencies, typecheck, and build explicitly; add the package directory to Asterism and restart. Rebuild and restart after source changes rather than expecting the application to compile them.
|
|
26
|
+
|
|
27
|
+
The counter intentionally exposes its contracts as `asterism-example-counter/contracts` in both realms. Its internal relative imports and public entry share one build graph per realm. Consumers need the provider enabled and declare that package as a peer dependency; installing a declaration package alone is not enough.
|
|
28
|
+
|
|
23
29
|
## Check the adapted design
|
|
24
30
|
|
|
25
31
|
Use a compatible application and public SDK for development. Type checking checks contract agreement; loading the package and exercising it checks the integration.
|
|
@@ -22,6 +22,14 @@ For a small extension, public exports from the implementation package may be suf
|
|
|
22
22
|
|
|
23
23
|
Import original public values. Shared contracts carry runtime identity as well as types, so a local copy is not a substitute for the provider's declaration. Development package versions support authoring; the enabled provider supplies the running implementation.
|
|
24
24
|
|
|
25
|
+
## Separate source inputs from delivered code
|
|
26
|
+
|
|
27
|
+
The package root owns identity, release metadata, translations, and manual declarations. `asterism.build` holds source inputs, and the build writes loading metadata into `dist`. Keeping those roles separate lets a source checkout and a published package use the same loader without requiring the application to transform TypeScript.
|
|
28
|
+
|
|
29
|
+
Owned public entries are listed as exact import specifiers per realm and resolve through the package's own `exports`. Compile each realm's implementation and owned public entries together so the provider uses the same declarations as its consumers. A separate authoring API package can supply types without becoming a separately activated plugin.
|
|
30
|
+
|
|
31
|
+
Package dependency declarations carry the boundary. Peer dependencies name what the application or other plugins supply; imports of them stay external and resolve to the running instances. Ordinary dependencies are private: the backend loads them from the installed package with their own files and native binaries, and the browser build bundles them. Backend and renderer graphs are separate: identity is shared within a realm, not memory shared between processes or with the browser. Root documentation and translation metadata remain with the package rather than moving into executable loading metadata.
|
|
32
|
+
|
|
25
33
|
## Keep service ownership with the provider
|
|
26
34
|
|
|
27
35
|
A provider owns shared initialization and cleanup. Consumers depend on the capability they use and release their own subscriptions or requests without ending services shared by others.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Build the counter plugin
|
|
2
|
+
|
|
3
|
+
This package is a complete SDK-only plugin with a backend, storage declarations, a renderer, and a small public contract boundary. It does not require the builtin Agent paradigm.
|
|
4
|
+
|
|
5
|
+
## Prepare and register
|
|
6
|
+
|
|
7
|
+
The manifest pins the public packages for the target application. Run from this directory:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install
|
|
11
|
+
npm run typecheck
|
|
12
|
+
npm run build
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Add this package directory to Asterism, then restart the application. Register the directory containing `package.json`, not `src` or `dist`. After changing source, build explicitly and restart again. Source edits alone do not change the running plugin.
|
|
16
|
+
|
|
17
|
+
The builder replaces `dist` only after a completed build. Asterism loads that JavaScript artifact, not the TypeScript entries in `asterism.build`.
|
|
18
|
+
|
|
19
|
+
## Preserve the public boundary
|
|
20
|
+
|
|
21
|
+
The exact `asterism-example-counter/contracts` specifier is provided in both runtime and renderer realms. Each realm builds its own graph; the backend's runtime, storage, and public entry share that graph rather than independent copies of the contracts. `asterism.build.public` lists the specifier, and the builder resolves it through the package's `exports` entry for `./contracts`. Keep `src/contracts.ts` in the distributed package for consumers' type declarations.
|
|
22
|
+
|
|
23
|
+
A consumer declares `asterism-example-counter` as a peer dependency, which keeps imports of `asterism-example-counter/contracts` external. Installing declarations alone does not enable this provider. SDK, React, React Intl, and Zod imports also remain external to use the host instances.
|
|
24
|
+
|
|
25
|
+
The manual stays in the root-level `asterism.manual` declaration. Executable output does not replace documentation or translation metadata.
|
|
26
|
+
|
|
27
|
+
## Distribute the built package
|
|
28
|
+
|
|
29
|
+
Build before packing. Include `package.json`, `dist`, documentation, and any declarations needed by consumers. Check the actual tarball with `npm pack --dry-run`; copying source without output is not a loadable distribution. Private dependencies, if added later, install through `dependencies`; platform-dependent dependencies need validation in the target runtime.
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
"version": "0.0.1",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
|
-
"scripts": {
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "asterism-plugin-build",
|
|
8
|
+
"typecheck": "tsc --noEmit"
|
|
9
|
+
},
|
|
7
10
|
"peerDependencies": {
|
|
8
11
|
"@asterism-app/sdk": "*",
|
|
9
12
|
"react": "^19.3.0",
|
|
@@ -11,17 +14,33 @@
|
|
|
11
14
|
"zod": "^4.6.5"
|
|
12
15
|
},
|
|
13
16
|
"devDependencies": {
|
|
14
|
-
"@asterism-app/sdk": "
|
|
17
|
+
"@asterism-app/sdk": "2.1.0",
|
|
15
18
|
"typescript": "^7.0.2",
|
|
16
19
|
"@types/node": "^26.6.1",
|
|
17
|
-
"@types/react": "^19.3.0"
|
|
20
|
+
"@types/react": "^19.3.0",
|
|
21
|
+
"@asterism-app/plugin-build": "1.0.0"
|
|
18
22
|
},
|
|
19
23
|
"asterism": {
|
|
20
24
|
"id": "example.counter",
|
|
21
25
|
"displayName": "Example counter",
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
+
"manual": [
|
|
27
|
+
"docs"
|
|
28
|
+
],
|
|
29
|
+
"build": {
|
|
30
|
+
"runtime": "src/runtime.ts",
|
|
31
|
+
"storage": "src/storage.ts",
|
|
32
|
+
"renderer": "src/renderer.tsx",
|
|
33
|
+
"public": {
|
|
34
|
+
"runtime": [
|
|
35
|
+
"asterism-example-counter/contracts"
|
|
36
|
+
],
|
|
37
|
+
"renderer": [
|
|
38
|
+
"asterism-example-counter/contracts"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"exports": {
|
|
44
|
+
"./contracts": "./src/contracts.ts"
|
|
26
45
|
}
|
|
27
46
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asterism-app/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Public contracts and host capabilities for Asterism plugins",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Chien Zhang",
|
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
"!**/*.test.*",
|
|
37
37
|
"docs",
|
|
38
38
|
"examples",
|
|
39
|
-
"README.md"
|
|
39
|
+
"README.md",
|
|
40
|
+
"!examples/**/dist/**",
|
|
41
|
+
"!examples/dist/**"
|
|
40
42
|
]
|
|
41
43
|
}
|
package/src/error-details.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { z } from "zod";
|
|
|
3
3
|
/** Transferable raw error data; response bodies and additional data remain text to avoid being scanned as business references. */
|
|
4
4
|
export type ErrorDetails = {
|
|
5
5
|
name?: string;
|
|
6
|
+
/** Original diagnostic text, which may include serialized values and validation issues; not a failure summary. */
|
|
6
7
|
message: string;
|
|
7
8
|
code?: string | number;
|
|
8
9
|
statusCode?: number;
|
|
@@ -25,6 +26,17 @@ export const errorDetailsSchema: z.ZodType<ErrorDetails> = z.strictObject({
|
|
|
25
26
|
stack: z.string().optional(), causes: z.lazy(() => errorDetailsSchema.array()).optional(),
|
|
26
27
|
});
|
|
27
28
|
|
|
29
|
+
/** Select an English failure summary, using the caller's error-type fallback when no message exists.
|
|
30
|
+
* Zod messages serialize validation issues; their original text belongs in describeError(), not the summary.
|
|
31
|
+
* Other integration-specific diagnostic messages are summarized by their owning adapter before propagation.
|
|
32
|
+
*/
|
|
33
|
+
export function errorMessage(error: unknown, fallback: string): string {
|
|
34
|
+
if (error instanceof z.ZodError) return "Validation failed.";
|
|
35
|
+
const message = typeof error === "string" ? error
|
|
36
|
+
: error && typeof error === "object" && "message" in error ? error.message : undefined;
|
|
37
|
+
return typeof message === "string" && message.trim() ? message : fallback;
|
|
38
|
+
}
|
|
39
|
+
|
|
28
40
|
/** Extract the error itself and response data; request bodies, request headers, and credentials are not error details. */
|
|
29
41
|
export function describeError(error: unknown): ErrorDetails {
|
|
30
42
|
const seen = new Set<object>();
|
package/src/models.ts
CHANGED
|
@@ -40,6 +40,7 @@ export type ModelEvent =
|
|
|
40
40
|
| { type: "part.end"; partId: string; arguments?: Json; continuation?: Json }
|
|
41
41
|
| { type: "finish"; reason: string; usage: Usage | null; responseId?: string; rawFinishReason?: string; source?: ModelSource; timing?: RequestTiming; response?: ModelResponse | null };
|
|
42
42
|
export type ModelSource = { model: string; adapter: string; scope: string };
|
|
43
|
+
/** Failure message is a standalone English summary; details preserve original diagnostic text and response data. */
|
|
43
44
|
export type ModelTermination =
|
|
44
45
|
| { reason: "completed" }
|
|
45
46
|
| { reason: "cancelled" }
|
|
@@ -77,6 +78,7 @@ export type ModelLiveBlock = { id: string; responseId: string; ordinal: number }
|
|
|
77
78
|
/** One-shot attention time, present only in live execution; history does not replay notices. */
|
|
78
79
|
noticeAt?: number }
|
|
79
80
|
);
|
|
81
|
+
/** Diagnostic message is a failure/warning summary; raw exception text and payloads belong in details. */
|
|
80
82
|
export type ModelRunEvent =
|
|
81
83
|
| { type: "block"; block: ModelBlock }
|
|
82
84
|
| { type: "tool.begin"; block: Extract<ModelBlock, { kind: "toolcall" }> }
|
package/src/reference-urls.ts
CHANGED
|
@@ -16,7 +16,8 @@ const encodePath = (path: string) => path.split("/").map(encodeURIComponent).joi
|
|
|
16
16
|
const decodePath = (path: string) => path.split("/").map(decodeURIComponent).join("/");
|
|
17
17
|
|
|
18
18
|
export function resourceUrl(resourceId: string, location: string): string {
|
|
19
|
-
|
|
19
|
+
// Parentheses are URI-safe but delimit the Markdown destination used by references.
|
|
20
|
+
return `resource:${encodeURIComponent(resourceId)}/${encodePath(location)}`.replaceAll("(", "%28").replaceAll(")", "%29");
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
export function parseResourceUrl(value: string): ResourceUrl | null {
|
|
@@ -55,5 +56,5 @@ export function parseModelUrl(value: string): ModelExpression | null {
|
|
|
55
56
|
|
|
56
57
|
/** The text form of a reference: a Markdown link whose label is display text and whose destination is the URL. */
|
|
57
58
|
export function referenceMarkdown(label: string, url: string): string {
|
|
58
|
-
return `[${label}](${url})`;
|
|
59
|
+
return `[${label.replace(/[\r\n]+/gu, " ").replace(/[\\[\]]/gu, "\\$&")}](${url})`;
|
|
59
60
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import type { UiText } from "./i18n.ts";
|
|
2
|
+
import type { RendererCalls } from "./renderer-calls.ts";
|
|
3
|
+
import type { ResourceRef } from "./workspace.ts";
|
|
4
|
+
|
|
1
5
|
/**
|
|
2
6
|
* Drag transfer of references. The payload is reference text: Markdown links whose destinations are reference URLs,
|
|
3
7
|
* such as `[guide.md](resource:Dir-A/docs/guide.md)`. Any plugin view can be a source and any input can be a target;
|
|
@@ -20,3 +24,31 @@ export function hasReferenceDrag(transfer: DataTransfer): boolean {
|
|
|
20
24
|
export function readReferenceDrag(transfer: DataTransfer): string | null {
|
|
21
25
|
return hasReferenceDrag(transfer) ? transfer.getData(referenceDragType) : null;
|
|
22
26
|
}
|
|
27
|
+
|
|
28
|
+
/** A selectable resource location. Its owner interprets the location; the picker only encodes it. */
|
|
29
|
+
export interface ReferenceTarget {
|
|
30
|
+
readonly label: string;
|
|
31
|
+
readonly detail?: UiText;
|
|
32
|
+
/** Resource-owned location; the empty location is reserved for the resource itself. */
|
|
33
|
+
readonly location: string;
|
|
34
|
+
}
|
|
35
|
+
export interface ListedReferenceTarget extends ReferenceTarget {
|
|
36
|
+
/** Additional local filtering keys. Presentation detail is not searched. */
|
|
37
|
+
readonly keywords?: readonly string[];
|
|
38
|
+
}
|
|
39
|
+
export interface ReferenceTargetContext {
|
|
40
|
+
readonly resource: ResourceRef;
|
|
41
|
+
readonly calls: RendererCalls;
|
|
42
|
+
readonly signal: AbortSignal;
|
|
43
|
+
}
|
|
44
|
+
export type ReferenceTargetProvider =
|
|
45
|
+
| { readonly kind: "list"; list(context: ReferenceTargetContext): Promise<readonly ListedReferenceTarget[]> }
|
|
46
|
+
| {
|
|
47
|
+
readonly kind: "search";
|
|
48
|
+
readonly prompt?: UiText;
|
|
49
|
+
readonly refineHint?: UiText;
|
|
50
|
+
search(query: string, context: ReferenceTargetContext): Promise<{
|
|
51
|
+
readonly items: readonly ReferenceTarget[];
|
|
52
|
+
/** Results stopped at a provider limit. Refine the query instead of paging. */
|
|
53
|
+
readonly limited: boolean;
|
|
54
|
+
}> };
|
package/src/renderer.ts
CHANGED
|
@@ -35,6 +35,7 @@ import type { EventSubscriber } from "./events.ts";
|
|
|
35
35
|
import type { PluginCalls } from "./calls.ts";
|
|
36
36
|
import type { RendererCalls } from "./renderer-calls.ts";
|
|
37
37
|
import type { ChannelContract, ChannelEnd, ChannelValue } from "./channels.ts";
|
|
38
|
+
import type { ReferenceTargetProvider } from "./renderer-references.ts";
|
|
38
39
|
import type { RendererResourceOpener, RendererResourceLocationActions } from "./renderer-resource-open.ts";
|
|
39
40
|
|
|
40
41
|
/** The frontend end of a channel: messages are delivered in order and buffered until a listener registers; closed resolves when either end terminates. */
|
|
@@ -95,6 +96,8 @@ export interface ResourceDescription {
|
|
|
95
96
|
card?: CardAppearance;
|
|
96
97
|
/** Open an opaque location using this resource's own operation or content surface. */
|
|
97
98
|
open?: RendererResourceOpener;
|
|
99
|
+
/** Selectable internal reference targets. A resource root needs no provider. */
|
|
100
|
+
referenceTargets?: ReferenceTargetProvider;
|
|
98
101
|
/** Additional user actions for a location, independent of its in-app preview format. The ID "open" is reserved for the host. */
|
|
99
102
|
actions?: RendererResourceLocationActions;
|
|
100
103
|
}
|
package/src/resource-activity.ts
CHANGED
|
@@ -3,13 +3,16 @@ import { defineCall } from "./calls.ts";
|
|
|
3
3
|
import { defineEvent } from "./events.ts";
|
|
4
4
|
import { uiTextSchema } from "./i18n.ts";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
export const resourceActivitySchema = z.strictObject({
|
|
6
|
+
const activityBase = z.strictObject({
|
|
8
7
|
id: z.string(),
|
|
9
8
|
resource: z.strictObject({ sessionId: z.string(), id: z.string(), kind: z.string() }),
|
|
10
9
|
title: uiTextSchema,
|
|
11
|
-
progress: z.strictObject({ value: z.number().min(0).max(1) }).optional(),
|
|
12
10
|
});
|
|
11
|
+
/** Live work or an open instance, independent of timeline occupancy and notification consumption. */
|
|
12
|
+
export const resourceActivitySchema = z.discriminatedUnion("kind", [
|
|
13
|
+
activityBase.extend({ kind: z.literal("work"), progress: z.strictObject({ value: z.number().min(0).max(1) }).optional() }),
|
|
14
|
+
activityBase.extend({ kind: z.literal("instance") }),
|
|
15
|
+
]);
|
|
13
16
|
export type ResourceActivity = z.infer<typeof resourceActivitySchema>;
|
|
14
17
|
|
|
15
18
|
/** Read live scopes without loading session bodies. Subscribe to changes before reading, including after reconnection. */
|
package/src/runtime-execution.ts
CHANGED
|
@@ -29,6 +29,8 @@ export interface ExecutionServices {
|
|
|
29
29
|
*/
|
|
30
30
|
withActivity<T>(resource: ResourceRef, work: (context: { signal: AbortSignal; progress(value: number | null): void }) => Promise<T>,
|
|
31
31
|
options?: { signal?: AbortSignal }): Promise<T>;
|
|
32
|
+
/** Publish an open instance of an owned resource. Release the returned marker when the instance ends or is disposed. */
|
|
33
|
+
openInstanceActivity(resource: ResourceRef): () => void;
|
|
32
34
|
/** Capture the owner's environment and hold resources through one request and tool batch. Callers own any timeline busy scope. */
|
|
33
35
|
run(request: ResourceModelRequest, options?: ExecutionContentOptions): Promise<ModelRunResult>;
|
|
34
36
|
/** Optional workbench output sink; the caller decides which execution events to send to it. */
|
package/src/runtime-terminal.ts
CHANGED
|
@@ -20,5 +20,10 @@ export interface InteractiveTerminal {
|
|
|
20
20
|
waitIdle(timeout: number | undefined, signal: AbortSignal): Promise<TerminalStatus & { reason: string; elapsedMs: number }>;
|
|
21
21
|
}
|
|
22
22
|
export interface TerminalSessions {
|
|
23
|
-
create(config: TerminalConfig, events: {
|
|
23
|
+
create(config: TerminalConfig, events: {
|
|
24
|
+
/** Whether this terminal owns a live shell process, independent of viewers or foreground command state. */
|
|
25
|
+
aliveChanged?(alive: boolean): void;
|
|
26
|
+
failed(error: unknown): void;
|
|
27
|
+
log(message: string, error: unknown): void;
|
|
28
|
+
}): InteractiveTerminal;
|
|
24
29
|
}
|