@punica/editor 1.0.5 → 1.0.7
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/index.bundle.esm.js +1 -1
- package/dist/index.bundle.esm.js.map +1 -1
- package/dist/index.bundle.umd.js +1 -1
- package/dist/index.bundle.umd.js.map +1 -1
- package/package.json +28 -3
- package/types/index.d.ts +120 -11
- package/types/punica.module.bootstrap.d.ts +45 -0
- package/types/punica.module.capability.d.ts +359 -0
- package/types/punica.module.extensions.api.d.ts +740 -0
- package/types/punica.module.extensions.settings.d.ts +106 -0
- package/types/punica.module.flow.agent.d.ts +75 -0
- package/types/punica.module.flow.api.d.ts +128 -0
- package/types/punica.module.flow.d.ts +490 -0
- package/types/punica.module.flow.engine.d.ts +228 -0
- package/types/punica.module.flow.mcp.d.ts +26 -0
- package/types/punica.module.flow.notebook.d.ts +210 -0
- package/types/punica.module.flow.primitives.d.ts +700 -0
- package/types/punica.module.flow.shell.d.ts +374 -0
- package/types/punica.module.kernel.ai.d.ts +462 -0
- package/types/punica.module.kernel.commands.d.ts +49 -0
- package/types/punica.module.kernel.events.d.ts +274 -0
- package/types/punica.module.kernel.history.d.ts +20 -0
- package/types/punica.module.kernel.llm.d.ts +343 -0
- package/types/punica.module.kernel.notifications.d.ts +64 -0
- package/types/punica.module.kernel.policy.d.ts +273 -0
- package/types/punica.module.kernel.tasks.d.ts +107 -0
- package/types/punica.module.kernel.timeServer.d.ts +16 -0
- package/types/punica.module.runtime.api.d.ts +214 -0
- package/types/punica.module.runtime.capabilities.d.ts +175 -0
- package/types/punica.module.runtime.compute.d.ts +339 -0
- package/types/punica.module.runtime.datasets.d.ts +234 -0
- package/types/punica.module.runtime.fs.d.ts +385 -0
- package/types/punica.module.runtime.harness.d.ts +246 -0
- package/types/punica.module.runtime.host.d.ts +272 -0
- package/types/punica.module.runtime.inference.d.ts +164 -0
- package/types/punica.module.runtime.lifecycle.d.ts +15 -0
- package/types/punica.module.runtime.llm.d.ts +470 -0
- package/types/punica.module.runtime.mcp.d.ts +139 -0
- package/types/punica.module.runtime.modelRuntimes.d.ts +90 -0
- package/types/punica.module.runtime.models.d.ts +254 -0
- package/types/punica.module.runtime.search.d.ts +59 -0
- package/types/punica.module.runtime.secrets.d.ts +26 -0
- package/types/punica.module.runtime.tasks.d.ts +27 -0
- package/types/punica.module.runtime.vcs.d.ts +67 -0
- package/types/punica.module.runtime.vectors.d.ts +74 -0
- package/types/punica.module.runtime.workspace.d.ts +134 -0
- package/types/punica.module.shell.activityBar.d.ts +42 -0
- package/types/punica.module.shell.components.d.ts +87 -0
- package/types/punica.module.shell.contentTabs.d.ts +33 -0
- package/types/punica.module.shell.dragDrop.d.ts +25 -0
- package/types/punica.module.shell.keyboardShortcuts.d.ts +38 -0
- package/types/punica.module.shell.layout.d.ts +106 -0
- package/types/punica.module.shell.markdown.d.ts +36 -0
- package/types/punica.module.shell.panelTabs.d.ts +48 -0
- package/types/punica.module.shell.profile.d.ts +278 -0
- package/types/punica.module.shell.statusbar.d.ts +26 -0
- package/types/punica.module.shell.view.d.ts +455 -0
- package/types/punica.module.shell.views.d.ts +150 -0
- package/types/punica.module.test.d.ts +562 -0
- package/types/punica.module.activityBar.d.ts +0 -21
- package/types/punica.module.commands.d.ts +0 -21
- package/types/punica.module.dragDrop.d.ts +0 -23
- package/types/punica.module.extensions.d.ts +0 -157
- package/types/punica.module.history.d.ts +0 -18
- package/types/punica.module.keyboardShortcuts.d.ts +0 -29
- package/types/punica.module.layout.d.ts +0 -23
- package/types/punica.module.statusbar.d.ts +0 -21
- package/types/punica.module.timeServer.d.ts +0 -14
- package/types/punica.module.view.d.ts +0 -8
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/// <reference path="./punica.module.ivy.d.ts" />
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Runtime Capabilities API Type Definitions
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
declare module 'punica' {
|
|
8
|
+
export namespace runtime {
|
|
9
|
+
/**
|
|
10
|
+
* Capability name identifier.
|
|
11
|
+
*/
|
|
12
|
+
export type CapabilityName = string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Actor that invokes a capability.
|
|
16
|
+
*/
|
|
17
|
+
export interface InvocationActor {
|
|
18
|
+
/** Type of actor */
|
|
19
|
+
type: 'user' | 'extension' | 'ai';
|
|
20
|
+
/** Optional actor identifier */
|
|
21
|
+
id?: string;
|
|
22
|
+
/** Extension name (if type is 'extension') */
|
|
23
|
+
extensionName?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Origin of the capability invocation.
|
|
28
|
+
*/
|
|
29
|
+
export interface InvocationOrigin {
|
|
30
|
+
/** Kind of origin */
|
|
31
|
+
kind: 'command' | 'workflow' | 'ai';
|
|
32
|
+
/** Unique identifier for the origin */
|
|
33
|
+
id: string;
|
|
34
|
+
/** Extension name (if applicable) */
|
|
35
|
+
extension?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Distributed tracing context.
|
|
40
|
+
*/
|
|
41
|
+
export interface TraceContext {
|
|
42
|
+
/** Trace ID (correlates all spans in a request) */
|
|
43
|
+
traceId: string;
|
|
44
|
+
/** Parent span ID (for nested spans) */
|
|
45
|
+
parentSpanId?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Policy evaluation context.
|
|
50
|
+
*/
|
|
51
|
+
export interface PolicyContext {
|
|
52
|
+
/** Policy mode: 'suggest' (dry-run) or 'execute' */
|
|
53
|
+
mode: 'suggest' | 'execute';
|
|
54
|
+
/** Approval token (if approval was granted) */
|
|
55
|
+
approvalToken?: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Complete invocation context for a capability call.
|
|
60
|
+
*/
|
|
61
|
+
export interface InvocationContext {
|
|
62
|
+
/** Session identifier */
|
|
63
|
+
sessionId: string;
|
|
64
|
+
/**
|
|
65
|
+
* Persistent AI conversation this call belongs to
|
|
66
|
+
* (`kernel.AI.sessions` id). Distinct from `sessionId`, which is
|
|
67
|
+
* the per-run/streaming correlation id (`llm.chunk` matching);
|
|
68
|
+
* one conversation spans many runs.
|
|
69
|
+
*/
|
|
70
|
+
conversationId?: string;
|
|
71
|
+
/** Workspace identifier (optional) */
|
|
72
|
+
workspaceId?: string;
|
|
73
|
+
/** Actor information */
|
|
74
|
+
actor: InvocationActor;
|
|
75
|
+
/** Origin information */
|
|
76
|
+
origin: InvocationOrigin;
|
|
77
|
+
/** Tracing context */
|
|
78
|
+
trace: TraceContext;
|
|
79
|
+
/** Policy context */
|
|
80
|
+
policy: PolicyContext;
|
|
81
|
+
/**
|
|
82
|
+
* Optional cancellation signal (Faz 0b Stop/iptal). Threaded by the caller
|
|
83
|
+
* through `gateway.call(name, input, context)`; the pipeline forwards it to
|
|
84
|
+
* `provider.execute(input, ctx)`. Long-running providers (e.g.
|
|
85
|
+
* `llm.chatStream`) honor it to stop in-flight work. Travels out-of-band
|
|
86
|
+
* here rather than in `input`, so the data payload stays serializable and
|
|
87
|
+
* schema-clean.
|
|
88
|
+
*/
|
|
89
|
+
signal?: AbortSignal;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Capability Gateway API
|
|
94
|
+
*/
|
|
95
|
+
export interface CapabilityGatewayApi {
|
|
96
|
+
/**
|
|
97
|
+
* Call a capability through the gateway.
|
|
98
|
+
*
|
|
99
|
+
* @param name - Capability name
|
|
100
|
+
* @param input - Input payload
|
|
101
|
+
* @param context - Invocation context
|
|
102
|
+
* @param idempotencyKey - Optional idempotency key for safe retries
|
|
103
|
+
* @returns Promise resolving to output
|
|
104
|
+
*/
|
|
105
|
+
call(
|
|
106
|
+
name: CapabilityName,
|
|
107
|
+
input: unknown,
|
|
108
|
+
context: InvocationContext,
|
|
109
|
+
idempotencyKey?: string
|
|
110
|
+
): Promise<unknown>;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Capabilities API
|
|
115
|
+
*/
|
|
116
|
+
export interface CapabilitiesApi {
|
|
117
|
+
/** Capability gateway */
|
|
118
|
+
gateway: CapabilityGatewayApi;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Python runtime gateway adapter interface.
|
|
123
|
+
*
|
|
124
|
+
* This interface defines the contract that a separate Python runtime project
|
|
125
|
+
* must implement to provide safety guarantees (rate limits, concurrency budgets,
|
|
126
|
+
* backpressure, timeouts, retry+jitter, cancellation mapping) above JEG.
|
|
127
|
+
*
|
|
128
|
+
* The Python runtime gateway:
|
|
129
|
+
* 1. Receives capability execution requests with execution defaults/overrides
|
|
130
|
+
* 2. Applies safety guarantees (rate limit, concurrency semaphore, timeout, retry+jitter)
|
|
131
|
+
* 3. Maps cancellation requests to JEG primitives (interrupt/restart/kill)
|
|
132
|
+
* 4. Emits standardized execution events for observability
|
|
133
|
+
* 5. Manages backpressure via bounded queues
|
|
134
|
+
*/
|
|
135
|
+
export interface PythonRuntimeGatewayAdapter {
|
|
136
|
+
/**
|
|
137
|
+
* Execute a capability through the Python runtime gateway.
|
|
138
|
+
*
|
|
139
|
+
* @param capabilityId - Capability identifier
|
|
140
|
+
* @param input - Input payload
|
|
141
|
+
* @param context - Invocation context
|
|
142
|
+
* @param executionDefaults - Capability execution defaults (from CapabilityDefinition.execution)
|
|
143
|
+
* @param executionOverride - Optional workflow node override
|
|
144
|
+
* @param runBudget - Optional run-level budget constraints
|
|
145
|
+
* @param idempotencyKey - Optional idempotency key for safe retries
|
|
146
|
+
* @returns Promise resolving to output
|
|
147
|
+
*/
|
|
148
|
+
execute(
|
|
149
|
+
capabilityId: string,
|
|
150
|
+
input: unknown,
|
|
151
|
+
context: InvocationContext,
|
|
152
|
+
executionDefaults?: CapabilityExecutionDefaults,
|
|
153
|
+
executionOverride?: ivy.ExecutionOverride,
|
|
154
|
+
runBudget?: ivy.RunBudget,
|
|
155
|
+
idempotencyKey?: string
|
|
156
|
+
): Promise<unknown>;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Cancel a running capability execution.
|
|
160
|
+
*
|
|
161
|
+
* @param runId - Run identifier
|
|
162
|
+
* @param mode - Cancellation mode ('best-effort' or 'hard')
|
|
163
|
+
*/
|
|
164
|
+
cancel(runId: string, mode: ivy.CancellationMode): Promise<void>;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Get execution event stream for a run.
|
|
168
|
+
*
|
|
169
|
+
* @param runId - Run identifier
|
|
170
|
+
* @returns Async iterable of execution events
|
|
171
|
+
*/
|
|
172
|
+
getExecutionEvents(runId: string): AsyncIterable<ivy.ExecutionEvent>;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
declare module 'punica' {
|
|
2
|
+
export namespace runtime {
|
|
3
|
+
export namespace compute {
|
|
4
|
+
/**
|
|
5
|
+
* Supported programming languages for code execution.
|
|
6
|
+
*/
|
|
7
|
+
export type LanguageId =
|
|
8
|
+
| 'python'
|
|
9
|
+
| 'node'
|
|
10
|
+
| 'java'
|
|
11
|
+
| 'dotnet'
|
|
12
|
+
| 'bash'
|
|
13
|
+
| 'scala'
|
|
14
|
+
| 'r';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Resource limits for execution.
|
|
18
|
+
*/
|
|
19
|
+
export interface ResourceLimits {
|
|
20
|
+
timeoutMs?: number;
|
|
21
|
+
cpu?: number;
|
|
22
|
+
memoryMb?: number;
|
|
23
|
+
gpu?: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Execution step definition.
|
|
28
|
+
*/
|
|
29
|
+
export interface ExecutionStep {
|
|
30
|
+
id: string;
|
|
31
|
+
language: LanguageId;
|
|
32
|
+
code?: string;
|
|
33
|
+
entrypoint?: string;
|
|
34
|
+
files?: Array<{ path: string; content: string }>;
|
|
35
|
+
deps?: {
|
|
36
|
+
pip?: string[];
|
|
37
|
+
npm?: string[];
|
|
38
|
+
maven?: string[];
|
|
39
|
+
nuget?: string[];
|
|
40
|
+
};
|
|
41
|
+
env?: Record<string, string>;
|
|
42
|
+
cwd?: string;
|
|
43
|
+
resources?: ResourceLimits;
|
|
44
|
+
inputs?: Record<string, unknown>;
|
|
45
|
+
metadata?: Record<string, unknown>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* MIME bundle for display data (Jupyter-compatible).
|
|
50
|
+
* Matches ivy.MimeBundle type (Record<string, JSONValue>).
|
|
51
|
+
*/
|
|
52
|
+
export type MimeBundle = Record<string, unknown>;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Cancellation reason for compute execution.
|
|
56
|
+
*/
|
|
57
|
+
export type CancellationReason =
|
|
58
|
+
| 'user_requested'
|
|
59
|
+
| 'timeout'
|
|
60
|
+
| 'run_budget_exceeded'
|
|
61
|
+
| 'provider_error';
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Execution event types emitted during code execution.
|
|
65
|
+
*/
|
|
66
|
+
export type ExecutionEvent =
|
|
67
|
+
| {
|
|
68
|
+
type: 'started';
|
|
69
|
+
runId: string;
|
|
70
|
+
sessionId: string;
|
|
71
|
+
providerId: string;
|
|
72
|
+
}
|
|
73
|
+
| {
|
|
74
|
+
type: 'status';
|
|
75
|
+
runId: string;
|
|
76
|
+
state: 'busy' | 'idle';
|
|
77
|
+
}
|
|
78
|
+
| {
|
|
79
|
+
type: 'stdout';
|
|
80
|
+
runId: string;
|
|
81
|
+
text: string;
|
|
82
|
+
}
|
|
83
|
+
| {
|
|
84
|
+
type: 'stderr';
|
|
85
|
+
runId: string;
|
|
86
|
+
text: string;
|
|
87
|
+
}
|
|
88
|
+
| {
|
|
89
|
+
type: 'display';
|
|
90
|
+
runId: string;
|
|
91
|
+
displayId?: string;
|
|
92
|
+
mime: MimeBundle;
|
|
93
|
+
metadata?: Record<string, unknown>;
|
|
94
|
+
}
|
|
95
|
+
| {
|
|
96
|
+
type: 'result';
|
|
97
|
+
runId: string;
|
|
98
|
+
value?: unknown;
|
|
99
|
+
mime?: MimeBundle;
|
|
100
|
+
}
|
|
101
|
+
| {
|
|
102
|
+
type: 'error';
|
|
103
|
+
runId: string;
|
|
104
|
+
name?: string;
|
|
105
|
+
message: string;
|
|
106
|
+
stack?: string;
|
|
107
|
+
traceback?: string[];
|
|
108
|
+
}
|
|
109
|
+
| {
|
|
110
|
+
type: 'log';
|
|
111
|
+
runId: string;
|
|
112
|
+
level: 'debug' | 'info' | 'warn' | 'error';
|
|
113
|
+
message: string;
|
|
114
|
+
}
|
|
115
|
+
| {
|
|
116
|
+
type: 'cancelled';
|
|
117
|
+
runId: string;
|
|
118
|
+
reason: CancellationReason;
|
|
119
|
+
mode: 'best-effort' | 'hard';
|
|
120
|
+
}
|
|
121
|
+
| {
|
|
122
|
+
type: 'finished';
|
|
123
|
+
runId: string;
|
|
124
|
+
ok: boolean;
|
|
125
|
+
exitCode?: number;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* JEG (Jupyter Enterprise Gateway) provider parameters.
|
|
130
|
+
*/
|
|
131
|
+
export interface JegProviderParams {
|
|
132
|
+
/**
|
|
133
|
+
* JEG gateway URL (e.g., "http://jeg-gateway:8888").
|
|
134
|
+
*/
|
|
135
|
+
gatewayUrl: string;
|
|
136
|
+
/**
|
|
137
|
+
* Optional authentication token or credentials.
|
|
138
|
+
*/
|
|
139
|
+
authToken?: string;
|
|
140
|
+
/**
|
|
141
|
+
* Optional kernel spec mapping (kernel name -> JEG kernel spec identifier).
|
|
142
|
+
*/
|
|
143
|
+
kernelSpecMapping?: Record<string, string>;
|
|
144
|
+
/**
|
|
145
|
+
* Optional HTTP headers to include in requests.
|
|
146
|
+
*/
|
|
147
|
+
headers?: Record<string, string>;
|
|
148
|
+
/**
|
|
149
|
+
* Optional namespace/tenant identifier for multi-tenant JEG deployments.
|
|
150
|
+
*/
|
|
151
|
+
namespace?: string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Local process provider parameters.
|
|
156
|
+
*/
|
|
157
|
+
export interface LocalProviderParams {
|
|
158
|
+
/**
|
|
159
|
+
* Optional working directory for process execution.
|
|
160
|
+
*/
|
|
161
|
+
cwd?: string;
|
|
162
|
+
/**
|
|
163
|
+
* Optional environment variables.
|
|
164
|
+
*/
|
|
165
|
+
env?: Record<string, string>;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Provider selector for session creation.
|
|
170
|
+
* Discriminated union for type-safe provider configuration.
|
|
171
|
+
*/
|
|
172
|
+
export type ProviderSelector =
|
|
173
|
+
| {
|
|
174
|
+
id: 'jeg';
|
|
175
|
+
params: JegProviderParams;
|
|
176
|
+
}
|
|
177
|
+
| {
|
|
178
|
+
id: 'local';
|
|
179
|
+
params: LocalProviderParams;
|
|
180
|
+
}
|
|
181
|
+
| {
|
|
182
|
+
id: string;
|
|
183
|
+
params?: Record<string, unknown>;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Request to open a compute session.
|
|
188
|
+
*/
|
|
189
|
+
export interface SessionOpenRequest {
|
|
190
|
+
provider?: ProviderSelector;
|
|
191
|
+
language: LanguageId;
|
|
192
|
+
kernelspec?: string;
|
|
193
|
+
env?: Record<string, string>;
|
|
194
|
+
cwd?: string;
|
|
195
|
+
resources?: ResourceLimits;
|
|
196
|
+
metadata?: Record<string, unknown>;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Options for running code.
|
|
201
|
+
*/
|
|
202
|
+
export interface RunOptions {
|
|
203
|
+
runId?: string;
|
|
204
|
+
exclusive?: boolean;
|
|
205
|
+
silent?: boolean;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Compute session interface for stateful execution.
|
|
210
|
+
*/
|
|
211
|
+
export interface ComputeSession {
|
|
212
|
+
id: string;
|
|
213
|
+
providerId: string;
|
|
214
|
+
language: LanguageId;
|
|
215
|
+
kernelspec?: string;
|
|
216
|
+
run(
|
|
217
|
+
step: ExecutionStep,
|
|
218
|
+
opts?: RunOptions
|
|
219
|
+
): AsyncIterable<ExecutionEvent>;
|
|
220
|
+
interrupt(): Promise<void>;
|
|
221
|
+
restart(): Promise<void>;
|
|
222
|
+
close(): Promise<void>;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Session manager for opening and managing compute sessions.
|
|
227
|
+
*/
|
|
228
|
+
export interface ComputeSessionManager {
|
|
229
|
+
open(request: SessionOpenRequest): Promise<ComputeSession>;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Registry for providers and language runtimes.
|
|
234
|
+
*/
|
|
235
|
+
export interface ComputeRegistry {
|
|
236
|
+
registerProvider(provider: ComputeProvider): void;
|
|
237
|
+
registerLanguageRuntime(runtime: LanguageRuntime): void;
|
|
238
|
+
getProvider(id: string): ComputeProvider | undefined;
|
|
239
|
+
getLanguageRuntime(language: LanguageId): LanguageRuntime | undefined;
|
|
240
|
+
listProviders(): ComputeProvider[];
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Main compute API surface.
|
|
245
|
+
*/
|
|
246
|
+
export interface ComputeApi {
|
|
247
|
+
/**
|
|
248
|
+
* Run code in an ephemeral session (session is created and closed automatically).
|
|
249
|
+
*/
|
|
250
|
+
run(
|
|
251
|
+
step: ExecutionStep,
|
|
252
|
+
opts?: RunOptions
|
|
253
|
+
): AsyncIterable<ExecutionEvent>;
|
|
254
|
+
/**
|
|
255
|
+
* Cancel a running execution.
|
|
256
|
+
*
|
|
257
|
+
* Semantics:
|
|
258
|
+
* - For JEG provider: maps to kernel interrupt (best-effort) or kernel restart/kill (hard).
|
|
259
|
+
* - For local provider: maps to process signal (SIGTERM for best-effort, SIGKILL for hard).
|
|
260
|
+
* - Returns when cancellation is initiated; actual cancellation may be asynchronous.
|
|
261
|
+
*
|
|
262
|
+
* @param runId - Run identifier to cancel
|
|
263
|
+
* @param mode - Cancellation mode: 'best-effort' (graceful) or 'hard' (force)
|
|
264
|
+
*/
|
|
265
|
+
cancel(runId: string, mode?: 'best-effort' | 'hard'): Promise<void>;
|
|
266
|
+
/**
|
|
267
|
+
* Session manager for stateful execution.
|
|
268
|
+
*/
|
|
269
|
+
session: ComputeSessionManager;
|
|
270
|
+
/**
|
|
271
|
+
* Registry for providers and language runtimes.
|
|
272
|
+
*/
|
|
273
|
+
registry: ComputeRegistry;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Session information passed to language runtimes.
|
|
278
|
+
*/
|
|
279
|
+
export interface SessionInfo {
|
|
280
|
+
id: string;
|
|
281
|
+
providerId: string;
|
|
282
|
+
language: LanguageId;
|
|
283
|
+
kernelspec?: string;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Prepared run configuration (provider-specific).
|
|
288
|
+
*/
|
|
289
|
+
export interface PreparedRun {
|
|
290
|
+
kind: 'jupyter' | 'process';
|
|
291
|
+
code?: string;
|
|
292
|
+
kernelspec?: string;
|
|
293
|
+
command?: string[];
|
|
294
|
+
files?: Array<{ path: string; content: string }>;
|
|
295
|
+
env?: Record<string, string>;
|
|
296
|
+
cwd?: string;
|
|
297
|
+
timeoutMs?: number;
|
|
298
|
+
meta?: Record<string, unknown>;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Language runtime adapter for preparing execution steps.
|
|
303
|
+
*/
|
|
304
|
+
export interface LanguageRuntime {
|
|
305
|
+
language: LanguageId;
|
|
306
|
+
resolveKernelSpec?(req: SessionOpenRequest): string | undefined;
|
|
307
|
+
prepare(step: ExecutionStep, session: SessionInfo): PreparedRun;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Provider session interface (internal to providers).
|
|
312
|
+
*/
|
|
313
|
+
export interface ProviderSession {
|
|
314
|
+
id: string;
|
|
315
|
+
run(
|
|
316
|
+
run: PreparedRun,
|
|
317
|
+
runId: string,
|
|
318
|
+
opts?: RunOptions
|
|
319
|
+
): AsyncIterable<ExecutionEvent>;
|
|
320
|
+
interrupt(): Promise<void>;
|
|
321
|
+
restart(): Promise<void>;
|
|
322
|
+
close(): Promise<void>;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Compute provider interface (implemented by providers like local, jeg, etc.).
|
|
327
|
+
*/
|
|
328
|
+
export interface ComputeProvider {
|
|
329
|
+
id: string;
|
|
330
|
+
label?: string; // Human-readable name (e.g., "Jupyter Enterprise Gateway")
|
|
331
|
+
kind?: string; // Provider type (e.g., "jeg", "local")
|
|
332
|
+
description?: string; // Optional description
|
|
333
|
+
openSession(
|
|
334
|
+
request: SessionOpenRequest & { kernelspec?: string }
|
|
335
|
+
): Promise<ProviderSession>;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|