@punica/editor 1.0.6 → 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 -22
- 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,273 @@
|
|
|
1
|
+
declare module 'punica' {
|
|
2
|
+
export namespace kernel {
|
|
3
|
+
export type PolicyMode = 'suggest' | 'execute';
|
|
4
|
+
export type PolicyRisk = 'low' | 'medium' | 'high' | (string & {});
|
|
5
|
+
export type PolicyApproval = 'none' | 'plan' | 'step' | (string & {});
|
|
6
|
+
export type ApprovalScope = 'once' | 'workspace' | 'always';
|
|
7
|
+
|
|
8
|
+
export type ApprovalKey = string;
|
|
9
|
+
|
|
10
|
+
export interface PolicyRequest {
|
|
11
|
+
/**
|
|
12
|
+
* Logical kind of the guarded action (e.g. "capability", "llm.remote").
|
|
13
|
+
*/
|
|
14
|
+
kind: string;
|
|
15
|
+
/**
|
|
16
|
+
* Identifier within the kind (e.g. capabilityId, providerId).
|
|
17
|
+
*/
|
|
18
|
+
id: string;
|
|
19
|
+
risk: PolicyRisk;
|
|
20
|
+
approval: PolicyApproval;
|
|
21
|
+
/**
|
|
22
|
+
* Optional human-readable reason shown in UI prompts.
|
|
23
|
+
*/
|
|
24
|
+
reason?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Multi-stage approval chain primitives — Sub-step 3.L.
|
|
29
|
+
*
|
|
30
|
+
* An approval chain replaces a single approver with a small
|
|
31
|
+
* state machine. Three shapes:
|
|
32
|
+
*
|
|
33
|
+
* - `sequential` — approvers must approve **in order**.
|
|
34
|
+
* Approver[i+1] is only asked after approver[i] approves.
|
|
35
|
+
* Any denial in the chain → full denial.
|
|
36
|
+
* - `parallel` — approvers are asked simultaneously.
|
|
37
|
+
* Chain GRANTED when `quorum` (default = all) approvals
|
|
38
|
+
* have landed; DENIED when so many denials have landed
|
|
39
|
+
* that quorum is mathematically impossible.
|
|
40
|
+
* - `single` — degenerate one-approver chain (kept
|
|
41
|
+
* in the union so callers can treat all approvals
|
|
42
|
+
* uniformly).
|
|
43
|
+
*
|
|
44
|
+
* Substrate ships the type + state machine; the orchestrator
|
|
45
|
+
* (UI / host) drives which approver gets asked next + how the
|
|
46
|
+
* UI surfaces partial state. The substrate stays headless.
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Logical approver — kept abstract so hosts can map `id` to
|
|
51
|
+
* user / role / group / OIDC subject / etc.
|
|
52
|
+
*/
|
|
53
|
+
export interface ApproverSpec {
|
|
54
|
+
/** Substrate-opaque approver identifier. */
|
|
55
|
+
id: string;
|
|
56
|
+
/** Optional display label for UIs. */
|
|
57
|
+
label?: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** A single approver's response on a chain. */
|
|
61
|
+
export interface ApproverDecision {
|
|
62
|
+
/** Approver id (must match an entry in the chain spec). */
|
|
63
|
+
approverId: string;
|
|
64
|
+
/** Approve / deny — chain consumes this on `recordChainDecision`. */
|
|
65
|
+
decision: 'approve' | 'deny';
|
|
66
|
+
/** Epoch ms when the approver decided. */
|
|
67
|
+
timestampMs: number;
|
|
68
|
+
/** Optional reason — surfaced in audit. */
|
|
69
|
+
reason?: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Chain-level outcome of `recordChainDecision`. */
|
|
73
|
+
export type ApprovalChainStatus = 'pending' | 'granted' | 'denied';
|
|
74
|
+
|
|
75
|
+
/** Discriminated union — every chain runs as one of these. */
|
|
76
|
+
export type ApprovalChainSpec =
|
|
77
|
+
| {
|
|
78
|
+
type: 'sequential';
|
|
79
|
+
approvers: readonly ApproverSpec[];
|
|
80
|
+
}
|
|
81
|
+
| {
|
|
82
|
+
type: 'parallel';
|
|
83
|
+
approvers: readonly ApproverSpec[];
|
|
84
|
+
/**
|
|
85
|
+
* Approvals required out of `approvers.length`. Default =
|
|
86
|
+
* all approvers (effectively unanimous parallel). Must be
|
|
87
|
+
* `1 <= quorum <= approvers.length`.
|
|
88
|
+
*/
|
|
89
|
+
quorum?: number;
|
|
90
|
+
}
|
|
91
|
+
| {
|
|
92
|
+
type: 'single';
|
|
93
|
+
approver: ApproverSpec;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/** Snapshot of a running chain — read-only from the caller's POV. */
|
|
97
|
+
export interface ApprovalChainState {
|
|
98
|
+
/** Caller-supplied chain id; load-bearing for store lookups. */
|
|
99
|
+
chainId: string;
|
|
100
|
+
/** The shape the chain runs under (frozen at creation). */
|
|
101
|
+
spec: ApprovalChainSpec;
|
|
102
|
+
/** Decisions landed so far, in arrival order. */
|
|
103
|
+
decisions: readonly ApproverDecision[];
|
|
104
|
+
/** Current overall status. */
|
|
105
|
+
status: ApprovalChainStatus;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface ApprovalRecord {
|
|
109
|
+
key: ApprovalKey;
|
|
110
|
+
kind: string;
|
|
111
|
+
id: string;
|
|
112
|
+
scope: ApprovalScope;
|
|
113
|
+
workspaceId?: string;
|
|
114
|
+
risk: PolicyRisk;
|
|
115
|
+
approval: PolicyApproval;
|
|
116
|
+
reason?: string;
|
|
117
|
+
decidedBy?: string;
|
|
118
|
+
timestampMs: number;
|
|
119
|
+
/**
|
|
120
|
+
* Optional chain reference — Sub-step 3.L. When present,
|
|
121
|
+
* this approval landed as part of a multi-stage chain
|
|
122
|
+
* (`ApprovalChainState.chainId`). Audit consumers join
|
|
123
|
+
* record + chain state by this id.
|
|
124
|
+
*/
|
|
125
|
+
chainRef?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Time-bounded approvals — Sub-step 3.F. Epoch ms after which
|
|
128
|
+
* the approval is considered expired. `hasApproval` returns
|
|
129
|
+
* false once `Date.now() >= expiresAt`; `listApprovals`
|
|
130
|
+
* filters expired records by default (`{ includeExpired:
|
|
131
|
+
* true }` to retain them). Undefined = permanent approval
|
|
132
|
+
* (pre-3.F semantics preserved).
|
|
133
|
+
*
|
|
134
|
+
* The substrate stores the absolute epoch — callers compute
|
|
135
|
+
* `Date.now() + durationMs` for relative durations. UI
|
|
136
|
+
* preset durations (1 saat / 1 gün / kalıcı) live in host
|
|
137
|
+
* code, not substrate.
|
|
138
|
+
*/
|
|
139
|
+
expiresAt?: number;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface PolicyDecision {
|
|
143
|
+
allowed: boolean;
|
|
144
|
+
mode: PolicyMode;
|
|
145
|
+
requiresApproval: boolean;
|
|
146
|
+
suggestedScope?: ApprovalScope;
|
|
147
|
+
reason?: string;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export interface PolicyApi {
|
|
151
|
+
setMode(mode: PolicyMode): void;
|
|
152
|
+
getMode(): PolicyMode;
|
|
153
|
+
|
|
154
|
+
evaluate(
|
|
155
|
+
req: PolicyRequest,
|
|
156
|
+
ctx?: { workspaceId?: string }
|
|
157
|
+
): PolicyDecision;
|
|
158
|
+
|
|
159
|
+
requestApproval(
|
|
160
|
+
req: PolicyRequest,
|
|
161
|
+
ctx?: {
|
|
162
|
+
workspaceId?: string;
|
|
163
|
+
correlationId?: string;
|
|
164
|
+
/**
|
|
165
|
+
* Trace id of the invocation hitting the gate (an agent run id
|
|
166
|
+
* for agent-loop calls) — carried into the pending approval so
|
|
167
|
+
* waiters/UI can match a pending to its run.
|
|
168
|
+
*/
|
|
169
|
+
traceId?: string;
|
|
170
|
+
}
|
|
171
|
+
): void;
|
|
172
|
+
|
|
173
|
+
hasApproval(
|
|
174
|
+
req: PolicyRequest,
|
|
175
|
+
scope: ApprovalScope,
|
|
176
|
+
ctx?: { workspaceId?: string }
|
|
177
|
+
): boolean;
|
|
178
|
+
|
|
179
|
+
recordApproval(
|
|
180
|
+
req: PolicyRequest,
|
|
181
|
+
scope: ApprovalScope,
|
|
182
|
+
ctx?: {
|
|
183
|
+
workspaceId?: string;
|
|
184
|
+
decidedBy?: string;
|
|
185
|
+
/**
|
|
186
|
+
* Time-bound the approval — Sub-step 3.F. Epoch ms;
|
|
187
|
+
* `hasApproval` rejects after this point. Undefined =
|
|
188
|
+
* permanent.
|
|
189
|
+
*/
|
|
190
|
+
expiresAt?: number;
|
|
191
|
+
}
|
|
192
|
+
): ApprovalRecord;
|
|
193
|
+
|
|
194
|
+
revokeApproval(
|
|
195
|
+
rec: Pick<ApprovalRecord, 'kind' | 'id' | 'scope' | 'workspaceId'>
|
|
196
|
+
): boolean;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* @param options - 3.F: `includeExpired` (default false)
|
|
200
|
+
* retains approvals whose `expiresAt <= Date.now()`. Pre-
|
|
201
|
+
* 3.F callers ignored expiry entirely; the default
|
|
202
|
+
* behavior change is intentional — expired approvals are
|
|
203
|
+
* no longer load-bearing.
|
|
204
|
+
*/
|
|
205
|
+
listApprovals(options?: { includeExpired?: boolean }): ApprovalRecord[];
|
|
206
|
+
clearApprovals(): void;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Export policy state (mode + approvals) as JSON.
|
|
210
|
+
*/
|
|
211
|
+
exportState(): PolicyExport;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Import policy state from JSON. Returns number of approvals imported.
|
|
215
|
+
*/
|
|
216
|
+
importState(data: PolicyExport, options?: { merge?: boolean }): number;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Policy templates: workspace-scoped policy templates
|
|
220
|
+
*/
|
|
221
|
+
saveTemplate(
|
|
222
|
+
name: string,
|
|
223
|
+
template: PolicyTemplate,
|
|
224
|
+
workspaceId?: string
|
|
225
|
+
): void;
|
|
226
|
+
getTemplate(name: string, workspaceId?: string): PolicyTemplate | null;
|
|
227
|
+
listTemplates(workspaceId?: string): PolicyTemplate[];
|
|
228
|
+
deleteTemplate(name: string, workspaceId?: string): boolean;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Export policy audit log (approvals, decisions) as CSV/JSON.
|
|
232
|
+
*/
|
|
233
|
+
exportAuditLog(options?: {
|
|
234
|
+
format?: 'json' | 'csv';
|
|
235
|
+
since?: number;
|
|
236
|
+
until?: number;
|
|
237
|
+
workspaceId?: string;
|
|
238
|
+
}): string;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Policy template for workspace-scoped policy rules
|
|
243
|
+
*/
|
|
244
|
+
export interface PolicyTemplate {
|
|
245
|
+
name: string;
|
|
246
|
+
description?: string;
|
|
247
|
+
workspaceId?: string;
|
|
248
|
+
rules: Array<{
|
|
249
|
+
kind: string;
|
|
250
|
+
id?: string;
|
|
251
|
+
risk?: 'low' | 'medium' | 'high';
|
|
252
|
+
approval?: 'none' | 'plan' | 'step';
|
|
253
|
+
condition?: string; // Future: expression for conditional rules
|
|
254
|
+
}>;
|
|
255
|
+
createdAtMs?: number;
|
|
256
|
+
updatedAtMs?: number;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Exported policy state format (v2).
|
|
261
|
+
*/
|
|
262
|
+
export interface PolicyExport {
|
|
263
|
+
version: 2;
|
|
264
|
+
exportedAt: number;
|
|
265
|
+
mode: PolicyMode;
|
|
266
|
+
approvals: ApprovalRecord[];
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export namespace Policy {
|
|
270
|
+
const manager: PolicyApi;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
declare module 'punica' {
|
|
2
|
+
export namespace kernel {
|
|
3
|
+
export type TaskKind = 'op' | 'code' | 'shell' | 'pipeline' | 'custom';
|
|
4
|
+
|
|
5
|
+
export type TaskStatus =
|
|
6
|
+
| 'pending'
|
|
7
|
+
| 'running'
|
|
8
|
+
| 'success'
|
|
9
|
+
| 'failed'
|
|
10
|
+
| 'cancelled';
|
|
11
|
+
|
|
12
|
+
export interface TaskDefinition {
|
|
13
|
+
/** Unique identifier for this task definition. */
|
|
14
|
+
id: string;
|
|
15
|
+
/** Human-readable label shown in UIs. */
|
|
16
|
+
label: string;
|
|
17
|
+
/** High-level category (build, test, etc.). */
|
|
18
|
+
kind: TaskKind;
|
|
19
|
+
/** Command to execute (e.g. a shell command, script, or workflow id). */
|
|
20
|
+
command: string;
|
|
21
|
+
/** Optional arguments passed to the command. */
|
|
22
|
+
args?: string[];
|
|
23
|
+
/** Working directory when executing the task. */
|
|
24
|
+
cwd?: string;
|
|
25
|
+
/** Environment variables for the task process. */
|
|
26
|
+
env?: Record<string, string>;
|
|
27
|
+
/** Logical group for UI filtering. */
|
|
28
|
+
group?: 'build' | 'test' | 'lint' | 'deploy' | 'other';
|
|
29
|
+
/**
|
|
30
|
+
* Optional flag or configuration indicating that the task should
|
|
31
|
+
* automatically be re-run when it finishes.
|
|
32
|
+
*/
|
|
33
|
+
autoRerun?: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface TaskRun {
|
|
37
|
+
/** Unique id for this concrete run. */
|
|
38
|
+
runId: string;
|
|
39
|
+
/** Id of the TaskDefinition this run belongs to. */
|
|
40
|
+
definitionId: string;
|
|
41
|
+
/** Human-readable label (usually from the definition). */
|
|
42
|
+
label: string;
|
|
43
|
+
/** Current status of the run. */
|
|
44
|
+
status: TaskStatus;
|
|
45
|
+
/** When the run started, as ISO string. */
|
|
46
|
+
startedAt: string;
|
|
47
|
+
/** When the run finished, as ISO string. */
|
|
48
|
+
finishedAt?: string;
|
|
49
|
+
/** Exit code from the underlying process, if any. */
|
|
50
|
+
exitCode?: number | null;
|
|
51
|
+
/** Optional error message for failed runs. */
|
|
52
|
+
errorMessage?: string;
|
|
53
|
+
/** Associated terminal session id, if any. */
|
|
54
|
+
terminalId?: string;
|
|
55
|
+
/** Workspace id for the run, if applicable. */
|
|
56
|
+
workspaceId?: string;
|
|
57
|
+
/** Environment id used for this run, if applicable. */
|
|
58
|
+
environmentId?: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface TasksQuery {
|
|
62
|
+
status?: TaskStatus[];
|
|
63
|
+
definitionId?: string;
|
|
64
|
+
workspaceId?: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface TasksApi {
|
|
68
|
+
/** List all registered task definitions. */
|
|
69
|
+
listDefinitions(): Promise<TaskDefinition[]>;
|
|
70
|
+
/** Register or update a task definition. */
|
|
71
|
+
registerDefinition(def: TaskDefinition): void;
|
|
72
|
+
/** Remove a task definition. */
|
|
73
|
+
unregisterDefinition(id: string): void;
|
|
74
|
+
/** Start a new task run. */
|
|
75
|
+
run(id: string, options?: { environmentId?: string }): Promise<TaskRun>;
|
|
76
|
+
/** Look up a single run by id. */
|
|
77
|
+
getRun(id: string): Promise<TaskRun | null>;
|
|
78
|
+
/** List all runs, optionally filtered by status/definition/workspace. */
|
|
79
|
+
listRuns(query?: TasksQuery): Promise<TaskRun[]>;
|
|
80
|
+
/** Request cancellation of a running task. */
|
|
81
|
+
cancel(id: string): Promise<void>;
|
|
82
|
+
/** Subscribe to task run updates. */
|
|
83
|
+
onDidChangeRun(listener: (run: TaskRun) => void): () => void;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Tasks module façade surfaced under `punica.kernel.Tasks`.
|
|
88
|
+
*
|
|
89
|
+
* Hosts/extensions can use this to access the global tasks API.
|
|
90
|
+
*/
|
|
91
|
+
export namespace Tasks {
|
|
92
|
+
/**
|
|
93
|
+
* Default tasks manager instance used across the workbench.
|
|
94
|
+
* Runtime dependencies (terminals, workspace) are resolved lazily from punica.runtime.
|
|
95
|
+
*/
|
|
96
|
+
const manager: TasksApi;
|
|
97
|
+
/**
|
|
98
|
+
* Factory function to create a new TasksApi instance bound to specific runtime dependencies.
|
|
99
|
+
* Use `manager` for the global singleton instance.
|
|
100
|
+
*/
|
|
101
|
+
function createTasksApi(
|
|
102
|
+
terminals: runtime.TerminalApi,
|
|
103
|
+
workspace?: runtime.WorkspaceApi
|
|
104
|
+
): TasksApi;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare module 'punica' {
|
|
2
|
+
export namespace kernel {
|
|
3
|
+
export namespace TimeServer {
|
|
4
|
+
interface ISubscriber {
|
|
5
|
+
update(time: Date): void;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface ITimeServerManager {
|
|
9
|
+
subscribe(subscriber: ISubscriber): void;
|
|
10
|
+
unsubscribe(subscriber: ISubscriber): void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const manager: ITimeServerManager;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/// <reference path="punica.module.runtime.capabilities.d.ts" />
|
|
2
|
+
/// <reference path="punica.module.runtime.compute.d.ts" />
|
|
3
|
+
/// <reference path="punica.module.runtime.datasets.d.ts" />
|
|
4
|
+
/// <reference path="punica.module.runtime.models.d.ts" />
|
|
5
|
+
/// <reference path="punica.module.runtime.modelRuntimes.d.ts" />
|
|
6
|
+
/// <reference path="punica.module.runtime.inference.d.ts" />
|
|
7
|
+
/// <reference path="punica.module.runtime.vectors.d.ts" />
|
|
8
|
+
|
|
9
|
+
declare module 'punica' {
|
|
10
|
+
export namespace runtime {
|
|
11
|
+
/**
|
|
12
|
+
* Terminal session metadata shared between host and extensions.
|
|
13
|
+
* This describes a single logical terminal session owned by the host.
|
|
14
|
+
*/
|
|
15
|
+
export type TerminalBackendKind = 'local' | 'remote' | 'custom';
|
|
16
|
+
|
|
17
|
+
export interface TerminalSessionInfo {
|
|
18
|
+
id: string;
|
|
19
|
+
backend: TerminalBackendKind;
|
|
20
|
+
cwd: string;
|
|
21
|
+
shell: string;
|
|
22
|
+
title?: string;
|
|
23
|
+
createdAt: number;
|
|
24
|
+
pty?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface TerminalCreateOptions {
|
|
28
|
+
cwd?: string;
|
|
29
|
+
shell?: string;
|
|
30
|
+
title?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Optional environment overrides for the spawned shell.
|
|
33
|
+
*/
|
|
34
|
+
env?: Record<string, string>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Stream-oriented terminal API. Hosts provide a concrete implementation
|
|
39
|
+
* (Electron: local node-pty, browser: WebSocket to remote shell, etc.)
|
|
40
|
+
* and extensions only depend on this abstraction.
|
|
41
|
+
*/
|
|
42
|
+
export interface TerminalApi {
|
|
43
|
+
create(opts?: TerminalCreateOptions): Promise<TerminalSessionInfo>;
|
|
44
|
+
write(id: string, data: string): void;
|
|
45
|
+
resize(id: string, cols: number, rows: number): void;
|
|
46
|
+
close(id: string): void;
|
|
47
|
+
onData(id: string, listener: (data: string) => void): () => void;
|
|
48
|
+
onExit(
|
|
49
|
+
id: string,
|
|
50
|
+
listener: (code: number | null, signal?: string) => void
|
|
51
|
+
): () => void;
|
|
52
|
+
list(): Promise<TerminalSessionInfo[]>;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Aggregate host/runtime capabilities exposed to extensions.
|
|
57
|
+
*
|
|
58
|
+
* This surface is intentionally limited to integration concerns
|
|
59
|
+
* (filesystem, search, vcs, workspace, resources, terminals). Core
|
|
60
|
+
* domain models live under the `kernel` namespace and UI/shell
|
|
61
|
+
* surfaces live under the `shell` namespace.
|
|
62
|
+
*/
|
|
63
|
+
interface RuntimeApi {
|
|
64
|
+
/**
|
|
65
|
+
* Current high-level lifecycle phase for the workbench/host. Hosts are
|
|
66
|
+
* responsible for updating this field as the system progresses through
|
|
67
|
+
* startup, workspace loading, background work and shutdown.
|
|
68
|
+
*/
|
|
69
|
+
lifecyclePhase?: LifecyclePhase;
|
|
70
|
+
fs: FileSystemProvider;
|
|
71
|
+
fileOpeners: FileOpenersApi;
|
|
72
|
+
search: SearchApi;
|
|
73
|
+
vcs: VcsApi;
|
|
74
|
+
terminals: TerminalApi;
|
|
75
|
+
/**
|
|
76
|
+
* Host-backed task runner primitive (exec/spawn via host, e.g. Electron).
|
|
77
|
+
*/
|
|
78
|
+
tasks: TaskRunnerApi;
|
|
79
|
+
/**
|
|
80
|
+
* Workspace-level context and operations for the current host.
|
|
81
|
+
*/
|
|
82
|
+
workspace: WorkspaceApi;
|
|
83
|
+
/**
|
|
84
|
+
* Shared catalog of logical resources (datasets, services, secrets, agents, etc.).
|
|
85
|
+
*/
|
|
86
|
+
resources: ResourcesApi;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Minimal in-memory secrets API.
|
|
90
|
+
*/
|
|
91
|
+
secrets: SecretsApi;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* LLM provider interface. Hosts decide whether this is backed by local
|
|
95
|
+
* models, remote APIs, or a hybrid routing layer.
|
|
96
|
+
*/
|
|
97
|
+
llm: LlmApi;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Compute execution interface for code execution (Python, Node, etc.).
|
|
101
|
+
* Supports both ephemeral and stateful session-based execution.
|
|
102
|
+
*/
|
|
103
|
+
compute: compute.ComputeApi;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Datasets interface for dataset discovery, mounting, and access.
|
|
107
|
+
* Vendor-free contract for dataset providers (Kaggle, HuggingFace, S3, local, etc.).
|
|
108
|
+
*/
|
|
109
|
+
datasets: datasets.DatasetsApi;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Models interface for model discovery, mounting, and access.
|
|
113
|
+
* Vendor-free contract for model providers (HuggingFace, Bedrock, local, etc.).
|
|
114
|
+
*/
|
|
115
|
+
models: models.ModelsApi;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Local model execution seam: dispatch a model record to a pluggable
|
|
119
|
+
* runtime (GGUF/Transformers/ONNX/custom) and obtain a live endpoint.
|
|
120
|
+
* See docs/model-runtimes.md.
|
|
121
|
+
*/
|
|
122
|
+
modelRuntimes: modelRuntimes.ModelRuntimesApi;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Task-general inference surface for non-chat tasks (embeddings / vision /
|
|
126
|
+
* ASR / rerank) on started local runtimes. Chat stays on `llm.chat`. See
|
|
127
|
+
* docs/model-runtimes.md §9.2.
|
|
128
|
+
*/
|
|
129
|
+
inference: inference.InferenceApi;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Local vector index (similarity store) — pairs with `inference`
|
|
133
|
+
* embeddings for RAG. Pure vector store; never computes embeddings. See
|
|
134
|
+
* docs/model-runtimes.md §9.8.
|
|
135
|
+
*/
|
|
136
|
+
vectors: vectors.VectorsApi;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Host data-directory surface: an absolute, out-of-workspace location for
|
|
140
|
+
* heavy artifacts (model weights, dataset files) plus a fs surface scoped
|
|
141
|
+
* to it. Injected by hosts with a real filesystem (Electron); may be
|
|
142
|
+
* absent on a browser host. See docs/model-runtimes.md.
|
|
143
|
+
*/
|
|
144
|
+
host: host.HostApi;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Capability gateway for centralized capability invocation.
|
|
148
|
+
*/
|
|
149
|
+
capabilities: CapabilitiesApi;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Host wiring helpers for registering providers.
|
|
153
|
+
* These methods are always available at runtime for extension convenience.
|
|
154
|
+
*/
|
|
155
|
+
setFsProvider: (provider: FileSystemProvider) => void;
|
|
156
|
+
setLlmProvider: (provider: LlmApi) => void;
|
|
157
|
+
setComputeProvider: (provider: compute.ComputeProvider) => void;
|
|
158
|
+
setComputeRuntime: (runtime: compute.LanguageRuntime) => void;
|
|
159
|
+
setDatasetProvider: (provider: datasets.DatasetProvider) => void;
|
|
160
|
+
setModelProvider: (provider: models.ModelProvider) => void;
|
|
161
|
+
setModelRuntime: (runtime: modelRuntimes.ModelRuntime) => void;
|
|
162
|
+
setHostProvider: (provider: host.HostApi) => void;
|
|
163
|
+
setVectorsProvider: (provider: vectors.VectorsApi) => void;
|
|
164
|
+
setSearchProvider: (provider: SearchApi) => void;
|
|
165
|
+
setWorkspaceProvider: (provider: WorkspaceApi) => void;
|
|
166
|
+
setTerminalProvider: (provider: TerminalApi) => void;
|
|
167
|
+
setVcsProvider: (provider: VcsApi) => void;
|
|
168
|
+
setResourcesProvider: (provider: ResourcesApi) => void;
|
|
169
|
+
setTasksProvider: (provider: TaskRunnerApi) => void;
|
|
170
|
+
setSecretsProvider: (provider: SecretsApi) => void;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export const runtime: runtime.RuntimeApi;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Shared diagnostics model for Problems/Errors panels.
|
|
178
|
+
*/
|
|
179
|
+
export type ProblemSeverity = 'error' | 'warning' | 'info';
|
|
180
|
+
|
|
181
|
+
export interface ProblemItem {
|
|
182
|
+
id: string;
|
|
183
|
+
file: string;
|
|
184
|
+
line: number;
|
|
185
|
+
column: number;
|
|
186
|
+
message: string;
|
|
187
|
+
source?: string;
|
|
188
|
+
code?: string | number;
|
|
189
|
+
severity: ProblemSeverity;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Shared output/log entry model for Output panels and log viewers.
|
|
194
|
+
*/
|
|
195
|
+
export type OutputLevel = 'info' | 'warning' | 'error';
|
|
196
|
+
|
|
197
|
+
export interface OutputEntry {
|
|
198
|
+
id: string;
|
|
199
|
+
channel: string;
|
|
200
|
+
text: string;
|
|
201
|
+
timestamp: string;
|
|
202
|
+
level: OutputLevel;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// NOTE: Hosts should attach concrete implementations directly via
|
|
206
|
+
// window.punica.runtime.search = <runtime.SearchApi>
|
|
207
|
+
// window.punica.runtime.vcs = <runtime.VcsApi>
|
|
208
|
+
// window.punica.runtime.terminals = <runtime.TerminalApi>
|
|
209
|
+
// window.punica.runtime.workspace = <runtime.WorkspaceApi>
|
|
210
|
+
// window.punica.runtime.resources = <runtime.ResourcesApi>
|
|
211
|
+
// window.punica.runtime.llm = <runtime.LlmApi>
|
|
212
|
+
// window.punica.runtime.setFsProvider(<runtime.FileSystemProvider>)
|
|
213
|
+
// window.punica.runtime.fileOpeners = <runtime.FileOpenersApi>
|
|
214
|
+
}
|