@punica/editor 1.4.1 → 1.4.2
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 +2 -2
- package/dist/index.bundle.esm.js.map +1 -1
- package/dist/index.bundle.umd.js +2 -2
- package/dist/index.bundle.umd.js.map +1 -1
- package/package.json +1 -1
- package/types/punica.module.flow.agent.d.ts +1 -1
- package/types/punica.module.flow.d.ts +20 -20
- package/types/punica.module.flow.engine.d.ts +2 -2
- package/types/punica.module.flow.primitives.d.ts +15 -15
- package/types/punica.module.kernel.llm.d.ts +4 -4
package/package.json
CHANGED
|
@@ -66,7 +66,7 @@ declare module 'punica' {
|
|
|
66
66
|
workspaceId?: string;
|
|
67
67
|
}
|
|
68
68
|
): Promise<{ output?: JSONValue; runId: string; durationMs: number }>;
|
|
69
|
-
/** Wrap an agent document in a transient
|
|
69
|
+
/** Wrap an agent document in a transient Workflow envelope. */
|
|
70
70
|
envelope(manifest: unknown): unknown;
|
|
71
71
|
/** True when the value looks like a runnable IvyAgent manifest. */
|
|
72
72
|
isAgentManifest(manifest: unknown): boolean;
|
|
@@ -170,16 +170,16 @@ declare module 'punica' {
|
|
|
170
170
|
|
|
171
171
|
/**
|
|
172
172
|
* Validator API surface (host/extension implementation).
|
|
173
|
-
* Validates
|
|
173
|
+
* Validates WorkflowDocument.
|
|
174
174
|
*
|
|
175
175
|
* `options.hasCapability` mirrors the top-level
|
|
176
|
-
* `
|
|
177
|
-
* into `
|
|
176
|
+
* `validateWorkflowDocument` Trinity seam — implementers thread it
|
|
177
|
+
* into `workflowValidator` so registry lookups stay pure and
|
|
178
178
|
* substitutable (capability registry + CONSTITUTION § 0.1).
|
|
179
179
|
*/
|
|
180
180
|
export interface Validator {
|
|
181
181
|
validate(
|
|
182
|
-
spec:
|
|
182
|
+
spec: WorkflowDocument,
|
|
183
183
|
options?: {
|
|
184
184
|
mode?: 'strict' | 'best-effort';
|
|
185
185
|
hasCapability?: CapabilityLookup;
|
|
@@ -192,10 +192,10 @@ declare module 'punica' {
|
|
|
192
192
|
};
|
|
193
193
|
|
|
194
194
|
/**
|
|
195
|
-
* Validates a
|
|
195
|
+
* Validates a WorkflowDocument. Top-level helper exposed on `punica.flow`.
|
|
196
196
|
*
|
|
197
197
|
* Pass `options.hasCapability` to enable Trinity verification — the
|
|
198
|
-
* validator checks every `ivyNode` / `
|
|
198
|
+
* validator checks every `ivyNode` / `workflow` `ref.id` against
|
|
199
199
|
* that predicate and emits `WF_UNKNOWN_CAPABILITY` errors (strict)
|
|
200
200
|
* or warnings (best-effort) for any miss. Substrate's
|
|
201
201
|
* `validator.module.ts` wires this to
|
|
@@ -203,8 +203,8 @@ declare module 'punica' {
|
|
|
203
203
|
* Trinity check is skipped (keeps the validator usable in
|
|
204
204
|
* registry-less unit tests).
|
|
205
205
|
*/
|
|
206
|
-
export function
|
|
207
|
-
spec:
|
|
206
|
+
export function validateWorkflowDocument(
|
|
207
|
+
spec: WorkflowDocument,
|
|
208
208
|
options?: {
|
|
209
209
|
mode?: 'strict' | 'best-effort';
|
|
210
210
|
hasCapability?: CapabilityLookup;
|
|
@@ -221,7 +221,7 @@ declare module 'punica' {
|
|
|
221
221
|
ivy?: {
|
|
222
222
|
/**
|
|
223
223
|
* Optional annotation: which capability this cell belongs to (not required).
|
|
224
|
-
* Source-of-truth contract is CapabilityDefinition on IvyNode/
|
|
224
|
+
* Source-of-truth contract is CapabilityDefinition on IvyNode/Workflow.
|
|
225
225
|
*/
|
|
226
226
|
capability?: {
|
|
227
227
|
id?: CapabilityId;
|
|
@@ -310,7 +310,7 @@ declare module 'punica' {
|
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
/**
|
|
313
|
-
* Capability ID (IvyNode and
|
|
313
|
+
* Capability ID (IvyNode and Workflow are both CapabilityDefinition-based).
|
|
314
314
|
*/
|
|
315
315
|
export type CapabilityId = string;
|
|
316
316
|
|
|
@@ -348,7 +348,7 @@ declare module 'punica' {
|
|
|
348
348
|
* -------------------------
|
|
349
349
|
* Generic graph IR (the core)
|
|
350
350
|
* -------------------------
|
|
351
|
-
* Used by
|
|
351
|
+
* Used by Workflow now; intended to be reused by agent/mcp/rest later.
|
|
352
352
|
*/
|
|
353
353
|
export type GraphId = string;
|
|
354
354
|
export type NodeId = string;
|
|
@@ -403,7 +403,7 @@ declare module 'punica' {
|
|
|
403
403
|
}
|
|
404
404
|
|
|
405
405
|
/**
|
|
406
|
-
* Reserved pseudo IO node ids (for
|
|
406
|
+
* Reserved pseudo IO node ids (for Workflow wiring).
|
|
407
407
|
* If edges use these ids, they must exist as nodes in Graph.nodes.
|
|
408
408
|
*/
|
|
409
409
|
export type FlowIoNodeId = 'flow-input' | 'flow-output';
|
|
@@ -422,14 +422,14 @@ declare module 'punica' {
|
|
|
422
422
|
version?: string;
|
|
423
423
|
}
|
|
424
424
|
|
|
425
|
-
export interface
|
|
426
|
-
kind: '
|
|
425
|
+
export interface WorkflowRef {
|
|
426
|
+
kind: 'workflow';
|
|
427
427
|
id: CapabilityId;
|
|
428
428
|
version?: string;
|
|
429
429
|
/**
|
|
430
430
|
* Optional inline definition for local experiments (no registry publishing).
|
|
431
431
|
*/
|
|
432
|
-
inline?:
|
|
432
|
+
inline?: WorkflowDocument;
|
|
433
433
|
}
|
|
434
434
|
|
|
435
435
|
/**
|
|
@@ -452,7 +452,7 @@ declare module 'punica' {
|
|
|
452
452
|
| FlowInputRef
|
|
453
453
|
| FlowOutputRef
|
|
454
454
|
| NodeCapabilityRef
|
|
455
|
-
|
|
|
455
|
+
| WorkflowRef
|
|
456
456
|
| PrimitiveRef;
|
|
457
457
|
|
|
458
458
|
/**
|
|
@@ -465,11 +465,11 @@ declare module 'punica' {
|
|
|
465
465
|
}
|
|
466
466
|
|
|
467
467
|
/**
|
|
468
|
-
*
|
|
468
|
+
* Workflow = GraphDocumentBase with Workflow discriminators.
|
|
469
469
|
*/
|
|
470
|
-
export interface
|
|
471
|
-
apiVersion: 'ivy.
|
|
472
|
-
kind: '
|
|
470
|
+
export interface WorkflowDocument extends GraphDocumentBase {
|
|
471
|
+
apiVersion: 'ivy.workflow/v0.1';
|
|
472
|
+
kind: 'Workflow';
|
|
473
473
|
}
|
|
474
474
|
|
|
475
475
|
/**
|
|
@@ -170,7 +170,7 @@ declare module 'punica' {
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
export interface StartRunInput {
|
|
173
|
-
spec: flow.
|
|
173
|
+
spec: flow.WorkflowDocument;
|
|
174
174
|
workspaceId?: string;
|
|
175
175
|
filePathOrUri?: string;
|
|
176
176
|
/**
|
|
@@ -211,7 +211,7 @@ declare module 'punica' {
|
|
|
211
211
|
}): boolean;
|
|
212
212
|
rejectPending(input: { pendingId: string }): boolean;
|
|
213
213
|
/**
|
|
214
|
-
* Spawn a child run for a `
|
|
214
|
+
* Spawn a child run for a `WorkflowDocument` and await its
|
|
215
215
|
* terminal state (subflow spawning). Substrate enforces
|
|
216
216
|
* `MAX_SUBFLOW_DEPTH` and rejects synchronously when
|
|
217
217
|
* `(parentDepth ?? 0) + 1` exceeds the cap. The child run
|
|
@@ -5,8 +5,8 @@ declare module 'punica' {
|
|
|
5
5
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
6
6
|
export namespace flow {
|
|
7
7
|
/**
|
|
8
|
-
* Trinity verification seam — every `ivyNode` / `
|
|
9
|
-
* `
|
|
8
|
+
* Trinity verification seam — every `ivyNode` / `workflow` ref in a
|
|
9
|
+
* `WorkflowDocument` is checked against this predicate at validation
|
|
10
10
|
* time. Substrate's `validator.module.ts` plumbs it through
|
|
11
11
|
* `unifiedCapabilityRegistry.getCapability(...)`; unit tests inject
|
|
12
12
|
* a deterministic set without touching the registry.
|
|
@@ -21,7 +21,7 @@ declare module 'punica' {
|
|
|
21
21
|
export type CapabilityLookup = (capabilityId: string) => boolean;
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* Built-in primitive node kinds carried by `
|
|
24
|
+
* Built-in primitive node kinds carried by `WorkflowDocument` graphs.
|
|
25
25
|
* Substrate ships the executor surface (4.C); host extensions can
|
|
26
26
|
* register additional kinds via the node registry. Primitives are
|
|
27
27
|
* deliberately small — they exist so a domain author can compose
|
|
@@ -69,7 +69,7 @@ declare module 'punica' {
|
|
|
69
69
|
export interface FlowMigrationTransformer {
|
|
70
70
|
from: string;
|
|
71
71
|
to: string;
|
|
72
|
-
transform(doc:
|
|
72
|
+
transform(doc: WorkflowDocument): WorkflowDocument;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
/**
|
|
@@ -81,7 +81,7 @@ declare module 'punica' {
|
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
83
|
* One finding produced by a lint rule. `path` is a dot-path into
|
|
84
|
-
* `
|
|
84
|
+
* `WorkflowDocument` (e.g. `graph.nodes[2].ref.id`); `nodeId` is the
|
|
85
85
|
* resolved node id when applicable. `code` is the rule's stable
|
|
86
86
|
* machine identifier (e.g. `WF_UNKNOWN_CAPABILITY`).
|
|
87
87
|
*/
|
|
@@ -129,7 +129,7 @@ declare module 'punica' {
|
|
|
129
129
|
/**
|
|
130
130
|
* Substrate-shipped lint aggregator (flow linter). Pure analyzer:
|
|
131
131
|
* `lint(spec, ctx?)` runs every registered rule against the
|
|
132
|
-
* `
|
|
132
|
+
* `WorkflowDocument` and returns a single aggregated
|
|
133
133
|
* `FlowLintResult`. `register` / `unregister` let extensions
|
|
134
134
|
* add custom rules without forking the substrate. The default
|
|
135
135
|
* rule set (7 rules — `capability-not-declared`,
|
|
@@ -139,7 +139,7 @@ declare module 'punica' {
|
|
|
139
139
|
* substrate; `reset()` restores it.
|
|
140
140
|
*/
|
|
141
141
|
export interface FlowLinter {
|
|
142
|
-
lint(spec:
|
|
142
|
+
lint(spec: WorkflowDocument, ctx?: FlowLintContext): FlowLintResult;
|
|
143
143
|
register(rule: FlowLintRule): void;
|
|
144
144
|
unregister(ruleId: string): boolean;
|
|
145
145
|
list(): readonly string[];
|
|
@@ -155,7 +155,7 @@ declare module 'punica' {
|
|
|
155
155
|
export interface FlowLintRule {
|
|
156
156
|
id: string;
|
|
157
157
|
severity: FlowLintSeverity;
|
|
158
|
-
check(spec:
|
|
158
|
+
check(spec: WorkflowDocument, ctx: FlowLintContext): FlowLintIssue[];
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
/**
|
|
@@ -455,7 +455,7 @@ declare module 'punica' {
|
|
|
455
455
|
/**
|
|
456
456
|
* Substrate-shipped registry for `CheckpointMigrator` entries.
|
|
457
457
|
* Same shape as `MigrationRegistry` (4.F) but operates on
|
|
458
|
-
* checkpoint payloads rather than
|
|
458
|
+
* checkpoint payloads rather than WorkflowDocuments. Substrate
|
|
459
459
|
* ships an EMPTY registry — hosts inject migrators when the
|
|
460
460
|
* checkpoint version moves forward.
|
|
461
461
|
*/
|
|
@@ -524,7 +524,7 @@ declare module 'punica' {
|
|
|
524
524
|
export const primitives: PrimitivesApi;
|
|
525
525
|
|
|
526
526
|
/**
|
|
527
|
-
* Policy for handling a `
|
|
527
|
+
* Policy for handling a `WorkflowDocument` whose `version` differs
|
|
528
528
|
* from the runtime's expected version (flow migration).
|
|
529
529
|
*
|
|
530
530
|
* - `'auto-migrate'` — attempt to apply registered transformers
|
|
@@ -563,7 +563,7 @@ declare module 'punica' {
|
|
|
563
563
|
export type MigrationResult =
|
|
564
564
|
| {
|
|
565
565
|
ok: true;
|
|
566
|
-
document:
|
|
566
|
+
document: WorkflowDocument;
|
|
567
567
|
appliedTransformers: readonly string[];
|
|
568
568
|
fromVersion: string;
|
|
569
569
|
toVersion: string;
|
|
@@ -572,7 +572,7 @@ declare module 'punica' {
|
|
|
572
572
|
ok: false;
|
|
573
573
|
reason: MigrationFailureReason;
|
|
574
574
|
message: string;
|
|
575
|
-
partialDocument?:
|
|
575
|
+
partialDocument?: WorkflowDocument;
|
|
576
576
|
appliedTransformers: readonly string[];
|
|
577
577
|
};
|
|
578
578
|
|
|
@@ -586,7 +586,7 @@ declare module 'punica' {
|
|
|
586
586
|
* target), substrate returns `{ ok: true, appliedTransformers: [] }`.
|
|
587
587
|
*/
|
|
588
588
|
export interface MigrationInvocation {
|
|
589
|
-
document:
|
|
589
|
+
document: WorkflowDocument;
|
|
590
590
|
targetVersion: string;
|
|
591
591
|
policy?: VersionMismatchPolicy;
|
|
592
592
|
}
|
|
@@ -649,7 +649,7 @@ declare module 'punica' {
|
|
|
649
649
|
* session, so a parent's `'once'` approval is naturally honored
|
|
650
650
|
* by the child as long as `workspaceId` matches — F33 dedup).
|
|
651
651
|
*
|
|
652
|
-
* - `spec` — required `
|
|
652
|
+
* - `spec` — required `WorkflowDocument` to run.
|
|
653
653
|
* - `workspaceId` — inherited from the parent run; the
|
|
654
654
|
* substrate refuses to spawn a subflow into
|
|
655
655
|
* a different workspace by default.
|
|
@@ -669,7 +669,7 @@ declare module 'punica' {
|
|
|
669
669
|
* notebookCell-backed flows.
|
|
670
670
|
*/
|
|
671
671
|
export interface SubflowInvocation {
|
|
672
|
-
spec:
|
|
672
|
+
spec: WorkflowDocument;
|
|
673
673
|
workspaceId?: string;
|
|
674
674
|
input?: JSONValue;
|
|
675
675
|
parentRunId?: string;
|
|
@@ -54,7 +54,7 @@ declare module 'punica' {
|
|
|
54
54
|
/**
|
|
55
55
|
* Product ID that this instruction class belongs to.
|
|
56
56
|
* Used for product-scoped routing.
|
|
57
|
-
* Example: 'ivy-node', 'ivy-agent', 'ivy-mcp', 'ivy-
|
|
57
|
+
* Example: 'ivy-node', 'ivy-agent', 'ivy-mcp', 'ivy-workflow'
|
|
58
58
|
*/
|
|
59
59
|
productId?: string;
|
|
60
60
|
}
|
|
@@ -255,7 +255,7 @@ declare module 'punica' {
|
|
|
255
255
|
): Promise<CapabilityResult>;
|
|
256
256
|
|
|
257
257
|
/**
|
|
258
|
-
* Generate
|
|
258
|
+
* Generate Workflow IR from natural language query.
|
|
259
259
|
*/
|
|
260
260
|
plan(input: {
|
|
261
261
|
query: string;
|
|
@@ -300,10 +300,10 @@ declare module 'punica' {
|
|
|
300
300
|
}): Promise<CapabilityResult>;
|
|
301
301
|
|
|
302
302
|
/**
|
|
303
|
-
* Edit and optimize
|
|
303
|
+
* Edit and optimize Workflow IR structures.
|
|
304
304
|
*/
|
|
305
305
|
editWorkflow(input: {
|
|
306
|
-
|
|
306
|
+
workflow: ivy.WorkflowDocument;
|
|
307
307
|
requirements?: string;
|
|
308
308
|
context?: {
|
|
309
309
|
workspaceId?: string;
|