pmx-canvas 0.1.35 → 0.2.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/CHANGELOG.md +461 -0
- package/Readme.md +14 -2
- package/dist/canvas/index.js +82 -41
- package/dist/json-render/index.js +89 -334
- package/dist/types/client/nodes/ExtAppFrame.d.ts +2 -0
- package/dist/types/mcp/canvas-access.d.ts +12 -159
- package/dist/types/server/ax-context.d.ts +1 -1
- package/dist/types/server/ax-state-manager.d.ts +256 -0
- package/dist/types/server/ax-state.d.ts +29 -1
- package/dist/types/server/ax-wait.d.ts +23 -0
- package/dist/types/server/canvas-operations.d.ts +1 -12
- package/dist/types/server/canvas-state.d.ts +46 -14
- package/dist/types/server/html-surface.d.ts +7 -0
- package/dist/types/server/index.d.ts +66 -26
- package/dist/types/server/operations/composites.d.ts +121 -0
- package/dist/types/server/operations/http.d.ts +7 -0
- package/dist/types/server/operations/index.d.ts +8 -0
- package/dist/types/server/operations/invoker.d.ts +13 -0
- package/dist/types/server/operations/mcp.d.ts +15 -0
- package/dist/types/server/operations/ops/annotation.d.ts +2 -0
- package/dist/types/server/operations/ops/app.d.ts +33 -0
- package/dist/types/server/operations/ops/ax-await.d.ts +2 -0
- package/dist/types/server/operations/ops/ax-shared.d.ts +31 -0
- package/dist/types/server/operations/ops/ax-state.d.ts +2 -0
- package/dist/types/server/operations/ops/ax-timeline.d.ts +2 -0
- package/dist/types/server/operations/ops/ax-work.d.ts +2 -0
- package/dist/types/server/operations/ops/batch.d.ts +19 -0
- package/dist/types/server/operations/ops/edges.d.ts +2 -0
- package/dist/types/server/operations/ops/groups.d.ts +2 -0
- package/dist/types/server/operations/ops/json-render.d.ts +31 -0
- package/dist/types/server/operations/ops/nodes.d.ts +62 -0
- package/dist/types/server/operations/ops/query.d.ts +2 -0
- package/dist/types/server/operations/ops/snapshots.d.ts +2 -0
- package/dist/types/server/operations/ops/validate.d.ts +2 -0
- package/dist/types/server/operations/ops/viewport.d.ts +2 -0
- package/dist/types/server/operations/ops/webview.d.ts +2 -0
- package/dist/types/server/operations/registry.d.ts +15 -0
- package/dist/types/server/operations/types.d.ts +116 -0
- package/dist/types/server/operations/webview-runner.d.ts +69 -0
- package/docs/RELEASE.md +5 -0
- package/docs/adr-001-bun-only-runtime.md +46 -0
- package/docs/api-stability.md +57 -0
- package/docs/ax-host-adapter-contract.md +65 -0
- package/docs/ax-state-contract.md +72 -0
- package/docs/http-api.md +34 -2
- package/docs/mcp.md +64 -11
- package/docs/plans/plan-005-operation-registry.md +84 -0
- package/docs/plans/plan-006-mcp-tool-consolidation.md +109 -0
- package/docs/plans/plan-007-ax-domain.md +99 -0
- package/docs/plans/plan-008-registry-finish.md +91 -0
- package/docs/screenshot.png +0 -0
- package/docs/tech-debt-assessment-2026-06.md +90 -0
- package/package.json +3 -3
- package/skills/pmx-canvas/SKILL.md +233 -185
- package/skills/pmx-canvas/evals/evals.json +3 -3
- package/skills/pmx-canvas/references/codex-app-adapter.md +24 -11
- package/skills/pmx-canvas/references/github-copilot-app-adapter.md +31 -1
- package/src/cli/agent.ts +52 -31
- package/src/client/nodes/ExtAppFrame.tsx +73 -5
- package/src/client/nodes/HtmlNode.tsx +12 -3
- package/src/client/nodes/McpAppNode.tsx +12 -3
- package/src/json-render/renderer/index.tsx +3 -0
- package/src/mcp/canvas-access.ts +43 -774
- package/src/mcp/server.ts +190 -2001
- package/src/server/ax-context.ts +7 -1
- package/src/server/ax-state-manager.ts +808 -0
- package/src/server/ax-state.ts +89 -2
- package/src/server/ax-wait.ts +56 -0
- package/src/server/canvas-operations.ts +2 -328
- package/src/server/canvas-schema.ts +2 -2
- package/src/server/canvas-state.ts +140 -382
- package/src/server/html-surface.ts +49 -11
- package/src/server/index.ts +136 -192
- package/src/server/operations/composites.ts +355 -0
- package/src/server/operations/http.ts +103 -0
- package/src/server/operations/index.ts +65 -0
- package/src/server/operations/invoker.ts +87 -0
- package/src/server/operations/mcp.ts +221 -0
- package/src/server/operations/ops/annotation.ts +60 -0
- package/src/server/operations/ops/app.ts +447 -0
- package/src/server/operations/ops/ax-await.ts +216 -0
- package/src/server/operations/ops/ax-shared.ts +38 -0
- package/src/server/operations/ops/ax-state.ts +249 -0
- package/src/server/operations/ops/ax-timeline.ts +381 -0
- package/src/server/operations/ops/ax-work.ts +635 -0
- package/src/server/operations/ops/batch.ts +365 -0
- package/src/server/operations/ops/edges.ts +166 -0
- package/src/server/operations/ops/groups.ts +176 -0
- package/src/server/operations/ops/json-render.ts +691 -0
- package/src/server/operations/ops/nodes.ts +1047 -0
- package/src/server/operations/ops/query.ts +281 -0
- package/src/server/operations/ops/snapshots.ts +366 -0
- package/src/server/operations/ops/validate.ts +37 -0
- package/src/server/operations/ops/viewport.ts +219 -0
- package/src/server/operations/ops/webview.ts +339 -0
- package/src/server/operations/registry.ts +79 -0
- package/src/server/operations/types.ts +150 -0
- package/src/server/operations/webview-runner.ts +77 -0
- package/src/server/server.ts +253 -2170
- package/src/server/web-artifacts.ts +6 -2
|
@@ -16,6 +16,8 @@ export declare function resolveExtAppDisplayModeRequest(requestedMode: DisplayMo
|
|
|
16
16
|
};
|
|
17
17
|
export declare function sendExtAppBootstrapState(bridge: ExtAppBridgeNotifications, toolInput: Record<string, unknown>, toolResult: CallToolResult | undefined): Promise<void>;
|
|
18
18
|
export declare function resolveExtAppSandbox(value: unknown): string;
|
|
19
|
+
export declare function buildExtAppAxBridgeScript(axToken: string, nodeId: string): string;
|
|
20
|
+
export declare function injectExtAppAxBridgeScript(html: string, axBridgeScript: string): string;
|
|
19
21
|
export declare function resolveExtAppContainerDimensions(target: ExtAppHostDimensionsTarget | null | undefined, fallback: {
|
|
20
22
|
width: number;
|
|
21
23
|
height: number;
|
|
@@ -1,160 +1,49 @@
|
|
|
1
|
-
import { type CanvasLayout, type CanvasNodeState, type
|
|
1
|
+
import { type CanvasLayout, type CanvasNodeState, type PmxCanvas } from '../server/index.js';
|
|
2
2
|
import type { PmxAxSource } from '../server/ax-state.js';
|
|
3
|
-
type
|
|
4
|
-
type AddWebpageNodeInput = Parameters<PmxCanvas['addWebpageNode']>[0];
|
|
3
|
+
import { type OperationInvoker } from '../server/operations/index.js';
|
|
5
4
|
type RefreshWebpageNodeResult = Awaited<ReturnType<PmxCanvas['refreshWebpageNode']>>;
|
|
6
|
-
type OpenMcpAppInput = Parameters<PmxCanvas['openMcpApp']>[0];
|
|
7
|
-
type OpenMcpAppResult = Awaited<ReturnType<PmxCanvas['openMcpApp']>>;
|
|
8
|
-
type AddDiagramInput = Parameters<PmxCanvas['addDiagram']>[0];
|
|
9
|
-
type AddJsonRenderNodeInput = Parameters<PmxCanvas['addJsonRenderNode']>[0];
|
|
10
|
-
type AddJsonRenderNodeResult = ReturnType<PmxCanvas['addJsonRenderNode']>;
|
|
11
|
-
type StreamJsonRenderNodeInput = Parameters<PmxCanvas['streamJsonRenderNode']>[0];
|
|
12
|
-
type StreamJsonRenderNodeResult = ReturnType<PmxCanvas['streamJsonRenderNode']>;
|
|
13
5
|
type AddHtmlNodeInput = Parameters<PmxCanvas['addHtmlNode']>[0];
|
|
14
6
|
type AddHtmlPrimitiveInput = Parameters<PmxCanvas['addHtmlPrimitive']>[0];
|
|
15
7
|
type AddHtmlPrimitiveResult = ReturnType<PmxCanvas['addHtmlPrimitive']>;
|
|
16
|
-
type AddGraphNodeInput = Parameters<PmxCanvas['addGraphNode']>[0];
|
|
17
|
-
type AddGraphNodeResult = ReturnType<PmxCanvas['addGraphNode']>;
|
|
18
|
-
type UpdateNodePatch = Parameters<PmxCanvas['updateNode']>[1];
|
|
19
|
-
type AddEdgeInput = Parameters<PmxCanvas['addEdge']>[0];
|
|
20
|
-
type CreateGroupInput = Parameters<PmxCanvas['createGroup']>[0];
|
|
21
|
-
type GroupNodesOptions = Parameters<PmxCanvas['groupNodes']>[2];
|
|
22
|
-
type ArrangeLayout = Parameters<PmxCanvas['arrange']>[0];
|
|
23
|
-
type FocusNodeResult = ReturnType<PmxCanvas['focusNode']>;
|
|
24
|
-
type FitViewOptions = Parameters<PmxCanvas['fitView']>[0];
|
|
25
|
-
type FitViewResult = ReturnType<PmxCanvas['fitView']>;
|
|
26
8
|
type AxStateResult = ReturnType<PmxCanvas['getAxState']>;
|
|
27
9
|
type AxContextResult = ReturnType<PmxCanvas['getAxContext']>;
|
|
28
|
-
type SetAxFocusResult = ReturnType<PmxCanvas['setAxFocus']>;
|
|
29
|
-
type RecordAxEventInput = Parameters<PmxCanvas['recordAxEvent']>[0];
|
|
30
|
-
type RecordAxEventResult = ReturnType<PmxCanvas['recordAxEvent']>;
|
|
31
|
-
type SendSteeringResult = ReturnType<PmxCanvas['sendSteering']>;
|
|
32
10
|
type SubmitAxInteractionInput = Parameters<PmxCanvas['submitAxInteraction']>[0];
|
|
33
11
|
type SubmitAxInteractionResult = ReturnType<PmxCanvas['submitAxInteraction']>;
|
|
34
12
|
type GetPendingSteeringResult = ReturnType<PmxCanvas['getPendingSteering']>;
|
|
35
13
|
type ListElicitationsResult = ReturnType<PmxCanvas['listElicitations']>;
|
|
36
|
-
type RequestElicitationInput = Parameters<PmxCanvas['requestElicitation']>[0];
|
|
37
|
-
type RequestElicitationResult = ReturnType<PmxCanvas['requestElicitation']>;
|
|
38
|
-
type RespondElicitationResult = ReturnType<PmxCanvas['respondElicitation']>;
|
|
39
14
|
type ListModeRequestsResult = ReturnType<PmxCanvas['listModeRequests']>;
|
|
40
|
-
type
|
|
41
|
-
type
|
|
42
|
-
type ResolveModeRequestResult = ReturnType<PmxCanvas['resolveModeRequest']>;
|
|
43
|
-
type GetCommandRegistryResult = ReturnType<PmxCanvas['getCommandRegistry']>;
|
|
44
|
-
type InvokeCommandResult = ReturnType<PmxCanvas['invokeCommand']>;
|
|
15
|
+
type IngestActivityInput = Parameters<PmxCanvas['ingestActivity']>[0];
|
|
16
|
+
type IngestActivityResult = ReturnType<PmxCanvas['ingestActivity']>;
|
|
45
17
|
type GetPolicyResult = ReturnType<PmxCanvas['getPolicy']>;
|
|
46
|
-
type SetPolicyInput = Parameters<PmxCanvas['setPolicy']>[0];
|
|
47
|
-
type SetPolicyResult = ReturnType<PmxCanvas['setPolicy']>;
|
|
48
18
|
type GetAxTimelineQuery = Parameters<PmxCanvas['getAxTimeline']>[0];
|
|
49
19
|
type GetAxTimelineResult = ReturnType<PmxCanvas['getAxTimeline']>;
|
|
50
|
-
type AddWorkItemInput = Parameters<PmxCanvas['addWorkItem']>[0];
|
|
51
|
-
type AddWorkItemResult = ReturnType<PmxCanvas['addWorkItem']>;
|
|
52
|
-
type UpdateWorkItemPatch = Parameters<PmxCanvas['updateWorkItem']>[1];
|
|
53
|
-
type UpdateWorkItemResult = ReturnType<PmxCanvas['updateWorkItem']>;
|
|
54
20
|
type ListWorkItemsResult = ReturnType<PmxCanvas['listWorkItems']>;
|
|
55
|
-
type RequestApprovalInput = Parameters<PmxCanvas['requestApproval']>[0];
|
|
56
|
-
type RequestApprovalResult = ReturnType<PmxCanvas['requestApproval']>;
|
|
57
|
-
type ResolveApprovalResult = ReturnType<PmxCanvas['resolveApproval']>;
|
|
58
21
|
type ListApprovalGatesResult = ReturnType<PmxCanvas['listApprovalGates']>;
|
|
59
|
-
type AddEvidenceInput = Parameters<PmxCanvas['addEvidence']>[0];
|
|
60
|
-
type AddEvidenceResult = ReturnType<PmxCanvas['addEvidence']>;
|
|
61
|
-
type AddReviewAnnotationInput = Parameters<PmxCanvas['addReviewAnnotation']>[0];
|
|
62
|
-
type AddReviewAnnotationResult = ReturnType<PmxCanvas['addReviewAnnotation']>;
|
|
63
|
-
type UpdateReviewAnnotationPatch = Parameters<PmxCanvas['updateReviewAnnotation']>[1];
|
|
64
|
-
type UpdateReviewAnnotationResult = ReturnType<PmxCanvas['updateReviewAnnotation']>;
|
|
65
22
|
type ListReviewAnnotationsResult = ReturnType<PmxCanvas['listReviewAnnotations']>;
|
|
66
|
-
type GetHostCapabilityResult = ReturnType<PmxCanvas['getHostCapability']>;
|
|
67
|
-
type ReportHostCapabilityResult = ReturnType<PmxCanvas['reportHostCapability']>;
|
|
68
|
-
type SearchResult = ReturnType<PmxCanvas['search']>;
|
|
69
|
-
type UndoRedoResult = Awaited<ReturnType<PmxCanvas['undo']>>;
|
|
70
23
|
type HistoryResult = ReturnType<PmxCanvas['getHistory']>;
|
|
71
|
-
type SetContextPinsResult = ReturnType<PmxCanvas['setContextPins']>;
|
|
72
24
|
type RunBatchInput = Parameters<PmxCanvas['runBatch']>[0];
|
|
73
25
|
type RunBatchResult = Awaited<ReturnType<PmxCanvas['runBatch']>>;
|
|
74
|
-
type SnapshotListOptions = Parameters<PmxCanvas['listSnapshots']>[0];
|
|
75
|
-
type SnapshotList = ReturnType<PmxCanvas['listSnapshots']>;
|
|
76
|
-
type DeleteSnapshotResult = ReturnType<PmxCanvas['deleteSnapshot']>;
|
|
77
|
-
type GcSnapshotsOptions = Parameters<PmxCanvas['gcSnapshots']>[0];
|
|
78
|
-
type GcSnapshotsResult = ReturnType<PmxCanvas['gcSnapshots']>;
|
|
79
|
-
type DiffSnapshotResult = ReturnType<PmxCanvas['diffSnapshot']>;
|
|
80
26
|
type CodeGraphResult = ReturnType<PmxCanvas['getCodeGraph']>;
|
|
81
|
-
type
|
|
82
|
-
type WebArtifactInput = Parameters<PmxCanvas['buildWebArtifact']>[0];
|
|
83
|
-
type WebArtifactResult = Awaited<ReturnType<PmxCanvas['buildWebArtifact']>>;
|
|
84
|
-
type AutomationWebViewOptions = Parameters<PmxCanvas['startAutomationWebView']>[0];
|
|
85
|
-
type AutomationWebViewStatus = Awaited<ReturnType<PmxCanvas['startAutomationWebView']>>;
|
|
86
|
-
type AutomationEvaluateResult = Awaited<ReturnType<PmxCanvas['evaluateAutomationWebView']>>;
|
|
27
|
+
type AutomationWebViewStatus = Awaited<ReturnType<PmxCanvas['getAutomationWebViewStatus']>>;
|
|
87
28
|
type AutomationScreenshotOptions = Parameters<PmxCanvas['screenshotAutomationWebView']>[0];
|
|
88
29
|
export interface CanvasAccess {
|
|
89
30
|
readonly port: number;
|
|
90
31
|
readonly remoteBaseUrl: string | null;
|
|
32
|
+
/** Operation-registry invoker (plan-005): local in-process or HTTP, matching the access mode. */
|
|
33
|
+
invoker(): OperationInvoker;
|
|
91
34
|
getLayout(): Promise<CanvasLayout>;
|
|
92
35
|
getNode(id: string): Promise<CanvasNodeState | undefined>;
|
|
93
|
-
addNode(input: AddNodeInput): Promise<string>;
|
|
94
|
-
addWebpageNode(input: AddWebpageNodeInput): Promise<Awaited<ReturnType<PmxCanvas['addWebpageNode']>>>;
|
|
95
36
|
refreshWebpageNode(id: string, url?: string): Promise<RefreshWebpageNodeResult>;
|
|
96
|
-
openMcpApp(input: OpenMcpAppInput): Promise<OpenMcpAppResult>;
|
|
97
|
-
addDiagram(input: AddDiagramInput): Promise<OpenMcpAppResult>;
|
|
98
|
-
addJsonRenderNode(input: AddJsonRenderNodeInput): Promise<AddJsonRenderNodeResult>;
|
|
99
|
-
streamJsonRenderNode(input: StreamJsonRenderNodeInput): Promise<StreamJsonRenderNodeResult>;
|
|
100
37
|
addHtmlNode(input: AddHtmlNodeInput): Promise<string>;
|
|
101
38
|
addHtmlPrimitive(input: AddHtmlPrimitiveInput): Promise<AddHtmlPrimitiveResult>;
|
|
102
|
-
addGraphNode(input: AddGraphNodeInput): Promise<AddGraphNodeResult>;
|
|
103
|
-
buildWebArtifact(input: WebArtifactInput): Promise<WebArtifactResult>;
|
|
104
|
-
updateNode(id: string, patch: UpdateNodePatch): Promise<void>;
|
|
105
|
-
removeNode(id: string): Promise<void>;
|
|
106
|
-
removeAnnotation(id: string): Promise<boolean>;
|
|
107
|
-
addEdge(input: AddEdgeInput): Promise<string>;
|
|
108
|
-
removeEdge(id: string): Promise<void>;
|
|
109
|
-
createGroup(input: CreateGroupInput): Promise<string>;
|
|
110
|
-
groupNodes(groupId: string, childIds: string[], options?: GroupNodesOptions): Promise<boolean>;
|
|
111
|
-
ungroupNodes(groupId: string): Promise<boolean>;
|
|
112
|
-
arrange(layout?: ArrangeLayout): Promise<void>;
|
|
113
|
-
focusNode(id: string, options?: {
|
|
114
|
-
noPan?: boolean;
|
|
115
|
-
}): Promise<FocusNodeResult>;
|
|
116
|
-
fitView(options?: FitViewOptions): Promise<FitViewResult>;
|
|
117
39
|
getAxState(): Promise<AxStateResult>;
|
|
118
|
-
getAxContext(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}): Promise<SetAxFocusResult>;
|
|
122
|
-
recordAxEvent(input: RecordAxEventInput, options?: {
|
|
123
|
-
source?: PmxAxSource;
|
|
124
|
-
}): Promise<RecordAxEventResult>;
|
|
125
|
-
sendSteering(message: string, options?: {
|
|
126
|
-
source?: PmxAxSource;
|
|
127
|
-
}): Promise<SendSteeringResult>;
|
|
40
|
+
getAxContext(options?: {
|
|
41
|
+
consumer?: string;
|
|
42
|
+
}): Promise<AxContextResult>;
|
|
128
43
|
getAxTimeline(query?: GetAxTimelineQuery): Promise<GetAxTimelineResult>;
|
|
129
|
-
addWorkItem(input: AddWorkItemInput, options?: {
|
|
130
|
-
source?: PmxAxSource;
|
|
131
|
-
}): Promise<AddWorkItemResult>;
|
|
132
|
-
updateWorkItem(id: string, patch: UpdateWorkItemPatch, options?: {
|
|
133
|
-
source?: PmxAxSource;
|
|
134
|
-
}): Promise<UpdateWorkItemResult>;
|
|
135
44
|
listWorkItems(): Promise<ListWorkItemsResult>;
|
|
136
|
-
requestApproval(input: RequestApprovalInput, options?: {
|
|
137
|
-
source?: PmxAxSource;
|
|
138
|
-
}): Promise<RequestApprovalResult>;
|
|
139
|
-
resolveApproval(id: string, decision: 'approved' | 'rejected', options?: {
|
|
140
|
-
resolution?: string;
|
|
141
|
-
source?: PmxAxSource;
|
|
142
|
-
}): Promise<ResolveApprovalResult>;
|
|
143
45
|
listApprovalGates(): Promise<ListApprovalGatesResult>;
|
|
144
|
-
addEvidence(input: AddEvidenceInput, options?: {
|
|
145
|
-
source?: PmxAxSource;
|
|
146
|
-
}): Promise<AddEvidenceResult>;
|
|
147
|
-
addReviewAnnotation(input: AddReviewAnnotationInput, options?: {
|
|
148
|
-
source?: PmxAxSource;
|
|
149
|
-
}): Promise<AddReviewAnnotationResult>;
|
|
150
|
-
updateReviewAnnotation(id: string, patch: UpdateReviewAnnotationPatch, options?: {
|
|
151
|
-
source?: PmxAxSource;
|
|
152
|
-
}): Promise<UpdateReviewAnnotationResult>;
|
|
153
46
|
listReviewAnnotations(): Promise<ListReviewAnnotationsResult>;
|
|
154
|
-
getHostCapability(): Promise<GetHostCapabilityResult>;
|
|
155
|
-
reportHostCapability(input: unknown, options?: {
|
|
156
|
-
source?: PmxAxSource;
|
|
157
|
-
}): Promise<ReportHostCapabilityResult>;
|
|
158
47
|
submitAxInteraction(input: SubmitAxInteractionInput, options?: {
|
|
159
48
|
source?: PmxAxSource;
|
|
160
49
|
}): Promise<SubmitAxInteractionResult>;
|
|
@@ -162,53 +51,17 @@ export interface CanvasAccess {
|
|
|
162
51
|
consumer?: string;
|
|
163
52
|
limit?: number;
|
|
164
53
|
}): Promise<GetPendingSteeringResult>;
|
|
165
|
-
markSteeringDelivered(id: string): Promise<boolean>;
|
|
166
54
|
listElicitations(): Promise<ListElicitationsResult>;
|
|
167
|
-
requestElicitation(input: RequestElicitationInput, options?: {
|
|
168
|
-
source?: PmxAxSource;
|
|
169
|
-
}): Promise<RequestElicitationResult>;
|
|
170
|
-
respondElicitation(id: string, response: Record<string, unknown>, options?: {
|
|
171
|
-
source?: PmxAxSource;
|
|
172
|
-
}): Promise<RespondElicitationResult>;
|
|
173
55
|
listModeRequests(): Promise<ListModeRequestsResult>;
|
|
174
|
-
|
|
175
|
-
source?: PmxAxSource;
|
|
176
|
-
}): Promise<RequestModeResult>;
|
|
177
|
-
resolveModeRequest(id: string, decision: 'approved' | 'rejected', options?: {
|
|
178
|
-
resolution?: string;
|
|
56
|
+
ingestActivity(input: IngestActivityInput, options?: {
|
|
179
57
|
source?: PmxAxSource;
|
|
180
|
-
}): Promise<
|
|
181
|
-
getCommandRegistry(): Promise<GetCommandRegistryResult>;
|
|
182
|
-
invokeCommand(name: string, args?: Record<string, unknown> | null, options?: {
|
|
183
|
-
source?: PmxAxSource;
|
|
184
|
-
}): Promise<InvokeCommandResult>;
|
|
58
|
+
}): Promise<IngestActivityResult>;
|
|
185
59
|
getPolicy(): Promise<GetPolicyResult>;
|
|
186
|
-
setPolicy(patch: SetPolicyInput, options?: {
|
|
187
|
-
source?: PmxAxSource;
|
|
188
|
-
}): Promise<SetPolicyResult>;
|
|
189
|
-
clear(): Promise<void>;
|
|
190
|
-
search(query: string): Promise<SearchResult>;
|
|
191
|
-
undo(): Promise<UndoRedoResult>;
|
|
192
|
-
redo(): Promise<UndoRedoResult>;
|
|
193
60
|
getHistory(): Promise<HistoryResult>;
|
|
194
|
-
setContextPins(nodeIds: string[], mode?: 'set' | 'add' | 'remove'): Promise<SetContextPinsResult>;
|
|
195
61
|
getPinnedNodeIds(): Promise<string[]>;
|
|
196
62
|
runBatch(operations: RunBatchInput): Promise<RunBatchResult>;
|
|
197
|
-
listSnapshots(options?: SnapshotListOptions): Promise<SnapshotList>;
|
|
198
|
-
saveSnapshot(name: string): Promise<CanvasSnapshot | null>;
|
|
199
|
-
restoreSnapshot(id: string): Promise<{
|
|
200
|
-
ok: boolean;
|
|
201
|
-
}>;
|
|
202
|
-
deleteSnapshot(id: string): Promise<DeleteSnapshotResult>;
|
|
203
|
-
gcSnapshots(options?: GcSnapshotsOptions): Promise<GcSnapshotsResult>;
|
|
204
|
-
diffSnapshot(idOrName: string): Promise<DiffSnapshotResult>;
|
|
205
63
|
getCodeGraph(): Promise<CodeGraphResult>;
|
|
206
|
-
validate(): Promise<ValidationResult>;
|
|
207
64
|
getAutomationWebViewStatus(): Promise<AutomationWebViewStatus>;
|
|
208
|
-
startAutomationWebView(options?: AutomationWebViewOptions): Promise<AutomationWebViewStatus>;
|
|
209
|
-
stopAutomationWebView(): Promise<boolean>;
|
|
210
|
-
evaluateAutomationWebView(expression: string): Promise<AutomationEvaluateResult>;
|
|
211
|
-
resizeAutomationWebView(width: number, height: number): Promise<AutomationWebViewStatus>;
|
|
212
65
|
screenshotAutomationWebView(options?: AutomationScreenshotOptions): Promise<Uint8Array>;
|
|
213
66
|
}
|
|
214
67
|
export declare function refreshCanvasAccess(access: CanvasAccess): Promise<CanvasAccess>;
|
|
@@ -23,4 +23,4 @@ export interface PmxAxSurfaceSnapshot {
|
|
|
23
23
|
*/
|
|
24
24
|
export declare function buildCanvasAxSurfaceSnapshot(): PmxAxSurfaceSnapshot;
|
|
25
25
|
export declare function buildCanvasAxPinnedContext(): PmxAxPinnedContext;
|
|
26
|
-
export declare function buildCanvasAxContext(): PmxAxContext;
|
|
26
|
+
export declare function buildCanvasAxContext(consumer?: string): PmxAxContext;
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AX state manager.
|
|
3
|
+
*
|
|
4
|
+
* Owns the agent-experience (AX) state that previously lived inline in
|
|
5
|
+
* `CanvasStateManager`. Splits cleanly into the three documented partitions
|
|
6
|
+
* (see `docs/ax-state-contract.md`):
|
|
7
|
+
*
|
|
8
|
+
* • Canvas-bound (`_axState`): focus, work items, approval gates, review
|
|
9
|
+
* annotations, elicitations, mode requests, policy. Snapshotted, cleared by
|
|
10
|
+
* `canvas_clear`, replaced by `restore`. Mutators record undo/redo history
|
|
11
|
+
* (via the injected `recordMutation` / `suppressed` callbacks).
|
|
12
|
+
* • Timeline (audit-only): agent events, evidence, steering. DB-direct, NOT in
|
|
13
|
+
* `_axState`, NOT history-recorded, NOT snapshotted, retention-bounded.
|
|
14
|
+
* • Host/session: a single host-capability row in its own table.
|
|
15
|
+
*
|
|
16
|
+
* `CanvasStateManager` holds one of these and DELEGATES its public AX methods to
|
|
17
|
+
* it, so the SDK/HTTP/MCP surface is byte-stable. The manager takes injected
|
|
18
|
+
* callbacks for everything it does not own: a node-id-validity provider (used by
|
|
19
|
+
* normalization on write), the live DB handle, `scheduleSave`, `notifyChange`,
|
|
20
|
+
* `recordMutation`, and a `suppressed` wrapper for history closures.
|
|
21
|
+
*/
|
|
22
|
+
import { type AxTimelineQuery } from './canvas-db.js';
|
|
23
|
+
import { type PmxAxActivityKind, type PmxAxElicitation, type PmxAxModeRequest, type PmxAxMode, type PmxAxCommandDescriptor, type PmxAxPolicy, type PmxAxFocusState, type PmxAxSource, type PmxAxState, type PmxAxWorkItem, type PmxAxWorkItemStatus, type PmxAxApprovalGate, type PmxAxReviewAnnotation, type PmxAxReviewKind, type PmxAxReviewSeverity, type PmxAxReviewStatus, type PmxAxReviewAnchorType, type PmxAxReviewRegion, type PmxAxEvent, type PmxAxEventKind, type PmxAxEvidence, type PmxAxEvidenceKind, type PmxAxSteeringMessage, type PmxAxHostCapability, type PmxAxTimelineSummary } from './ax-state.js';
|
|
24
|
+
import type { CanvasChangeType, MutationRecordInfo } from './canvas-state.js';
|
|
25
|
+
type Database = import('bun:sqlite').Database;
|
|
26
|
+
/** Host-environment hooks the AX manager needs from its owner (CanvasStateManager). */
|
|
27
|
+
export interface AxStateManagerDeps {
|
|
28
|
+
/** Current valid node-id set — used by normalization on write to prune dangling refs. */
|
|
29
|
+
getNodeIds(): Set<string>;
|
|
30
|
+
/** Live DB handle for the timeline tables / host-capability table (null when no workspace). */
|
|
31
|
+
getDb(): Database | null;
|
|
32
|
+
/** Debounced save of the canvas-bound blob (timeline ops do NOT trigger this — they are DB-direct). */
|
|
33
|
+
scheduleSave(): void;
|
|
34
|
+
/** Emit a change notification (drives MCP resource notifications + blocking-wait endpoints). */
|
|
35
|
+
notifyChange(type: CanvasChangeType): void;
|
|
36
|
+
/** Record an undo/redo history entry. */
|
|
37
|
+
recordMutation(info: MutationRecordInfo): void;
|
|
38
|
+
/** Wrap a closure so it runs with mutation recording suppressed (for undo/redo replay). */
|
|
39
|
+
suppressed(fn: () => void): () => void;
|
|
40
|
+
}
|
|
41
|
+
export declare class AxStateManager {
|
|
42
|
+
private readonly deps;
|
|
43
|
+
private _axState;
|
|
44
|
+
private _axHostCapability;
|
|
45
|
+
constructor(deps: AxStateManagerDeps);
|
|
46
|
+
private normalizeForCurrentNodes;
|
|
47
|
+
private applyAxState;
|
|
48
|
+
/** Reset the canvas-bound partition to empty (used by clear() and applyPersistedState()). */
|
|
49
|
+
resetCanvasBound(): void;
|
|
50
|
+
/** Replace the canvas-bound partition from a persisted/restored blob, normalized against current nodes. */
|
|
51
|
+
applyPersistedAx(ax: unknown): void;
|
|
52
|
+
/** Load the host-capability row from its own table (own partition; not snapshotted). */
|
|
53
|
+
loadHostCapabilityFromDb(): void;
|
|
54
|
+
/**
|
|
55
|
+
* Re-normalize the canvas-bound partition against the current node set after a
|
|
56
|
+
* node was removed, and report what the removal orphaned. Work items / approval
|
|
57
|
+
* gates / elicitations / mode requests keep the item but strip the dangling node
|
|
58
|
+
* id ("re-anchored"); node-anchored review annotations are dropped ("removed").
|
|
59
|
+
* Returns the affected ids so the owner can record one audit timeline event.
|
|
60
|
+
*/
|
|
61
|
+
revalidateAfterNodeRemoval(removedNodeId: string): {
|
|
62
|
+
reanchoredIds: string[];
|
|
63
|
+
removedReviewIds: string[];
|
|
64
|
+
reanchoredFocus: boolean;
|
|
65
|
+
};
|
|
66
|
+
getAxState(): PmxAxState;
|
|
67
|
+
getAxFocus(): PmxAxFocusState;
|
|
68
|
+
setAxFocus(nodeIds: string[], options?: {
|
|
69
|
+
source?: PmxAxSource;
|
|
70
|
+
recordHistory?: boolean;
|
|
71
|
+
}): PmxAxFocusState;
|
|
72
|
+
clearAxFocus(): PmxAxFocusState;
|
|
73
|
+
getWorkItems(): PmxAxWorkItem[];
|
|
74
|
+
addWorkItem(input: {
|
|
75
|
+
title: string;
|
|
76
|
+
status?: PmxAxWorkItemStatus;
|
|
77
|
+
detail?: string | null;
|
|
78
|
+
nodeIds?: string[];
|
|
79
|
+
}, options?: {
|
|
80
|
+
source?: PmxAxSource;
|
|
81
|
+
}): PmxAxWorkItem;
|
|
82
|
+
updateWorkItem(id: string, patch: {
|
|
83
|
+
title?: string;
|
|
84
|
+
status?: PmxAxWorkItemStatus;
|
|
85
|
+
detail?: string | null;
|
|
86
|
+
nodeIds?: string[];
|
|
87
|
+
}, options?: {
|
|
88
|
+
source?: PmxAxSource;
|
|
89
|
+
}): PmxAxWorkItem | null;
|
|
90
|
+
getApprovalGates(): PmxAxApprovalGate[];
|
|
91
|
+
requestApproval(input: {
|
|
92
|
+
title: string;
|
|
93
|
+
detail?: string | null;
|
|
94
|
+
action?: string | null;
|
|
95
|
+
nodeIds?: string[];
|
|
96
|
+
}, options?: {
|
|
97
|
+
source?: PmxAxSource;
|
|
98
|
+
}): PmxAxApprovalGate;
|
|
99
|
+
resolveApproval(id: string, decision: 'approved' | 'rejected', options?: {
|
|
100
|
+
resolution?: string;
|
|
101
|
+
source?: PmxAxSource;
|
|
102
|
+
}): PmxAxApprovalGate | null;
|
|
103
|
+
getReviewAnnotations(): PmxAxReviewAnnotation[];
|
|
104
|
+
addReviewAnnotation(input: {
|
|
105
|
+
body: string;
|
|
106
|
+
kind?: PmxAxReviewKind;
|
|
107
|
+
severity?: PmxAxReviewSeverity;
|
|
108
|
+
anchorType?: PmxAxReviewAnchorType;
|
|
109
|
+
nodeId?: string | null;
|
|
110
|
+
file?: string | null;
|
|
111
|
+
region?: PmxAxReviewRegion | null;
|
|
112
|
+
author?: string | null;
|
|
113
|
+
}, options?: {
|
|
114
|
+
source?: PmxAxSource;
|
|
115
|
+
}): PmxAxReviewAnnotation | null;
|
|
116
|
+
updateReviewAnnotation(id: string, patch: {
|
|
117
|
+
body?: string;
|
|
118
|
+
status?: PmxAxReviewStatus;
|
|
119
|
+
severity?: PmxAxReviewSeverity;
|
|
120
|
+
kind?: PmxAxReviewKind;
|
|
121
|
+
}, options?: {
|
|
122
|
+
source?: PmxAxSource;
|
|
123
|
+
}): PmxAxReviewAnnotation | null;
|
|
124
|
+
getHostCapability(): PmxAxHostCapability | null;
|
|
125
|
+
getElicitations(): PmxAxElicitation[];
|
|
126
|
+
requestElicitation(input: {
|
|
127
|
+
prompt: string;
|
|
128
|
+
fields?: string[];
|
|
129
|
+
nodeIds?: string[];
|
|
130
|
+
}, options?: {
|
|
131
|
+
source?: PmxAxSource;
|
|
132
|
+
}): PmxAxElicitation;
|
|
133
|
+
respondElicitation(id: string, response: Record<string, unknown>, options?: {
|
|
134
|
+
source?: PmxAxSource;
|
|
135
|
+
}): PmxAxElicitation | null;
|
|
136
|
+
getModeRequests(): PmxAxModeRequest[];
|
|
137
|
+
requestMode(input: {
|
|
138
|
+
mode: PmxAxMode;
|
|
139
|
+
reason?: string | null;
|
|
140
|
+
nodeIds?: string[];
|
|
141
|
+
}, options?: {
|
|
142
|
+
source?: PmxAxSource;
|
|
143
|
+
}): PmxAxModeRequest;
|
|
144
|
+
resolveModeRequest(id: string, decision: 'approved' | 'rejected', options?: {
|
|
145
|
+
resolution?: string;
|
|
146
|
+
source?: PmxAxSource;
|
|
147
|
+
}): PmxAxModeRequest | null;
|
|
148
|
+
getApproval(id: string): PmxAxApprovalGate | null;
|
|
149
|
+
getElicitation(id: string): PmxAxElicitation | null;
|
|
150
|
+
getModeRequest(id: string): PmxAxModeRequest | null;
|
|
151
|
+
getCommandRegistry(): PmxAxCommandDescriptor[];
|
|
152
|
+
/** Invoke a registry-gated PMX command intent — records a timeline event (no execution). */
|
|
153
|
+
invokeCommand(name: string, args?: Record<string, unknown> | null, options?: {
|
|
154
|
+
source?: PmxAxSource;
|
|
155
|
+
}): PmxAxEvent | null;
|
|
156
|
+
getPolicy(): PmxAxPolicy;
|
|
157
|
+
/** Merge a declarative tool/prompt policy patch (canvas-bound, snapshotted). */
|
|
158
|
+
setPolicy(patch: {
|
|
159
|
+
tools?: Partial<PmxAxPolicy['tools']>;
|
|
160
|
+
prompt?: Partial<PmxAxPolicy['prompt']>;
|
|
161
|
+
}, _options?: {
|
|
162
|
+
source?: PmxAxSource;
|
|
163
|
+
}): PmxAxPolicy;
|
|
164
|
+
setHostCapability(input: unknown, _options?: {
|
|
165
|
+
source?: PmxAxSource;
|
|
166
|
+
}): PmxAxHostCapability;
|
|
167
|
+
recordAxEvent(input: {
|
|
168
|
+
kind: PmxAxEventKind;
|
|
169
|
+
summary: string;
|
|
170
|
+
detail?: string | null;
|
|
171
|
+
nodeIds?: string[];
|
|
172
|
+
data?: Record<string, unknown> | null;
|
|
173
|
+
}, options?: {
|
|
174
|
+
source?: PmxAxSource;
|
|
175
|
+
}): PmxAxEvent;
|
|
176
|
+
addEvidence(input: {
|
|
177
|
+
kind: PmxAxEvidenceKind;
|
|
178
|
+
title: string;
|
|
179
|
+
body?: string | null;
|
|
180
|
+
ref?: string | null;
|
|
181
|
+
nodeIds?: string[];
|
|
182
|
+
data?: Record<string, unknown> | null;
|
|
183
|
+
}, options?: {
|
|
184
|
+
source?: PmxAxSource;
|
|
185
|
+
}): PmxAxEvidence;
|
|
186
|
+
recordSteeringMessage(message: string, options?: {
|
|
187
|
+
source?: PmxAxSource;
|
|
188
|
+
}): PmxAxSteeringMessage;
|
|
189
|
+
markSteeringDelivered(id: string): boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Ingest a normalized agent activity (a tool/session event a harness forwards)
|
|
192
|
+
* and apply kind-driven board reactions, so the agent's real work flows back into
|
|
193
|
+
* the board without it remembering to push each item (report primitive A — makes
|
|
194
|
+
* AX bidirectional). Always records a timeline event; then, unless the caller
|
|
195
|
+
* overrides/suppresses via `reactions`, applies defaults by kind/outcome:
|
|
196
|
+
* • failure | error | outcome==='failure' → work item (blocked) + review
|
|
197
|
+
* (finding/error, anchored to a valid nodeId else the `ref` file) + evidence (logs)
|
|
198
|
+
* • tool-result + outcome==='success' → evidence (tool-result)
|
|
199
|
+
* • everything else (tool-start, session-*, command, note) → event only
|
|
200
|
+
* A reaction value of `false` suppresses it; an object overrides its fields/forces it on.
|
|
201
|
+
*/
|
|
202
|
+
ingestActivity(input: {
|
|
203
|
+
kind: PmxAxActivityKind;
|
|
204
|
+
title: string;
|
|
205
|
+
summary?: string | null;
|
|
206
|
+
outcome?: 'success' | 'failure';
|
|
207
|
+
ref?: string | null;
|
|
208
|
+
nodeIds?: string[];
|
|
209
|
+
data?: Record<string, unknown> | null;
|
|
210
|
+
reactions?: {
|
|
211
|
+
workItem?: false | {
|
|
212
|
+
status?: PmxAxWorkItemStatus;
|
|
213
|
+
detail?: string | null;
|
|
214
|
+
};
|
|
215
|
+
evidence?: false | {
|
|
216
|
+
kind?: PmxAxEvidenceKind;
|
|
217
|
+
body?: string | null;
|
|
218
|
+
};
|
|
219
|
+
review?: false | {
|
|
220
|
+
severity?: PmxAxReviewSeverity;
|
|
221
|
+
kind?: PmxAxReviewKind;
|
|
222
|
+
anchorType?: PmxAxReviewAnchorType;
|
|
223
|
+
nodeId?: string | null;
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
}, options?: {
|
|
227
|
+
source?: PmxAxSource;
|
|
228
|
+
}): {
|
|
229
|
+
event: PmxAxEvent;
|
|
230
|
+
workItem: PmxAxWorkItem | null;
|
|
231
|
+
evidence: PmxAxEvidence | null;
|
|
232
|
+
review: PmxAxReviewAnnotation | null;
|
|
233
|
+
};
|
|
234
|
+
getAxEvents(q?: AxTimelineQuery): PmxAxEvent[];
|
|
235
|
+
getAxEvidence(q?: AxTimelineQuery): PmxAxEvidence[];
|
|
236
|
+
getAxSteering(q?: AxTimelineQuery & {
|
|
237
|
+
onlyPending?: boolean;
|
|
238
|
+
}): PmxAxSteeringMessage[];
|
|
239
|
+
/**
|
|
240
|
+
* Undelivered steering for a consumer (Phase 4 delivery). Excludes messages
|
|
241
|
+
* whose source equals the consumer to prevent delivery loops (e.g. Copilot
|
|
242
|
+
* should not be handed back steering it originated).
|
|
243
|
+
*/
|
|
244
|
+
getPendingSteering(options?: {
|
|
245
|
+
consumer?: string;
|
|
246
|
+
limit?: number;
|
|
247
|
+
}): PmxAxSteeringMessage[];
|
|
248
|
+
getAxTimelineSummary(): PmxAxTimelineSummary;
|
|
249
|
+
getAxTimeline(q?: AxTimelineQuery): {
|
|
250
|
+
events: PmxAxEvent[];
|
|
251
|
+
evidence: PmxAxEvidence[];
|
|
252
|
+
steering: PmxAxSteeringMessage[];
|
|
253
|
+
summary: PmxAxTimelineSummary;
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
export {};
|
|
@@ -7,7 +7,7 @@ export interface PmxAxFocusState {
|
|
|
7
7
|
updatedAt: string | null;
|
|
8
8
|
source: PmxAxSource | null;
|
|
9
9
|
}
|
|
10
|
-
export type PmxAxEventKind = 'prompt' | 'assistant-message' | 'tool-start' | 'tool-result' | 'failure' | 'approval' | 'steering' | 'command';
|
|
10
|
+
export type PmxAxEventKind = 'prompt' | 'assistant-message' | 'tool-start' | 'tool-result' | 'failure' | 'approval' | 'steering' | 'command' | 'note';
|
|
11
11
|
export type PmxAxEvidenceKind = 'logs' | 'tool-result' | 'screenshot' | 'file' | 'diff' | 'test-output';
|
|
12
12
|
export type PmxAxWorkItemStatus = 'todo' | 'in-progress' | 'blocked' | 'done' | 'cancelled';
|
|
13
13
|
export type PmxAxApprovalStatus = 'pending' | 'approved' | 'rejected';
|
|
@@ -135,6 +135,18 @@ export interface PmxAxPinnedContext {
|
|
|
135
135
|
export interface PmxAxFocusContext extends PmxAxFocusState {
|
|
136
136
|
nodes: AgentContextNode[];
|
|
137
137
|
}
|
|
138
|
+
export interface PendingAxActivityItem {
|
|
139
|
+
kind: 'work-item' | 'approval-gate' | 'elicitation' | 'mode-request';
|
|
140
|
+
id: string;
|
|
141
|
+
title: string;
|
|
142
|
+
status: string;
|
|
143
|
+
nodeIds: string[];
|
|
144
|
+
source: PmxAxSource | null;
|
|
145
|
+
}
|
|
146
|
+
export interface PmxAxDeliveryContext {
|
|
147
|
+
pendingSteering: PmxAxSteeringMessage[];
|
|
148
|
+
pendingActivity: PendingAxActivityItem[];
|
|
149
|
+
}
|
|
138
150
|
export interface PmxAxContext {
|
|
139
151
|
version: 1;
|
|
140
152
|
generatedAt: string;
|
|
@@ -142,6 +154,7 @@ export interface PmxAxContext {
|
|
|
142
154
|
nodeCount: number;
|
|
143
155
|
edgeCount: number;
|
|
144
156
|
};
|
|
157
|
+
delivery: PmxAxDeliveryContext;
|
|
145
158
|
pinned: PmxAxPinnedContext;
|
|
146
159
|
focus: PmxAxFocusContext;
|
|
147
160
|
workItems: PmxAxWorkItem[];
|
|
@@ -153,6 +166,20 @@ export interface PmxAxContext {
|
|
|
153
166
|
timeline: PmxAxTimelineSummary;
|
|
154
167
|
host: PmxAxHostCapability | null;
|
|
155
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Open, agent-actionable canvas-bound AX items (open work items + pending approval
|
|
171
|
+
* gates / elicitations / mode requests). Unlike steering (a directive routed through
|
|
172
|
+
* the claim/ack delivery queue), these are STATE the human curates in the browser —
|
|
173
|
+
* they fire `ax-state-changed` (so resource-subscribers are pushed canvas://ax-work),
|
|
174
|
+
* but an adapterless client that only POLLS the delivery surface never saw them.
|
|
175
|
+
* Optionally excludes items the consumer itself originated (loop prevention),
|
|
176
|
+
* mirroring getPendingSteering. Shared by the MCP delivery surface and the HTTP
|
|
177
|
+
* context lead block so the digest never drifts between the two.
|
|
178
|
+
*/
|
|
179
|
+
export declare function buildPendingAxActivity(state: PmxAxState, consumer?: string): PendingAxActivityItem[];
|
|
180
|
+
export type PmxAxActivityKind = 'tool-start' | 'tool-result' | 'failure' | 'error' | 'session-start' | 'session-end' | 'command' | 'note';
|
|
181
|
+
export declare function isAxActivityKind(value: unknown): value is PmxAxActivityKind;
|
|
182
|
+
export declare function mapAxActivityKindToEventKind(kind: PmxAxActivityKind): PmxAxEventKind;
|
|
156
183
|
export interface PmxAxCommandDescriptor {
|
|
157
184
|
name: string;
|
|
158
185
|
description: string;
|
|
@@ -264,6 +291,7 @@ export declare function createAxSteeringMessage(message: string, source: PmxAxSo
|
|
|
264
291
|
export declare function normalizeAxState(input: unknown, validNodeIds?: Set<string>): PmxAxState;
|
|
265
292
|
export declare function buildAxContext(input: {
|
|
266
293
|
layout: CanvasLayout;
|
|
294
|
+
delivery: PmxAxDeliveryContext;
|
|
267
295
|
pinned: PmxAxPinnedContext;
|
|
268
296
|
focus: PmxAxFocusState;
|
|
269
297
|
focusNodes: AgentContextNode[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Hard ceiling on a single blocking wait, regardless of the requested timeout. */
|
|
2
|
+
export declare const AX_WAIT_MAX_MS = 120000;
|
|
3
|
+
export interface AxWaitResult<T> {
|
|
4
|
+
/** Latest value, or null if the item does not exist / vanished mid-wait. */
|
|
5
|
+
value: T | null;
|
|
6
|
+
/** True only when the item still exists and is still pending after the wait. */
|
|
7
|
+
pending: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Block until a canvas-bound AX item resolves (its status leaves `pending`), the
|
|
11
|
+
* timeout elapses, or the request aborts — the server side of report primitive D
|
|
12
|
+
* ("gates that actually gate"). Resolves immediately when the item is already
|
|
13
|
+
* resolved, missing, or `timeoutMs <= 0` (a plain single read). Subscribes to the
|
|
14
|
+
* `ax` change channel and always disposes the listener + timer.
|
|
15
|
+
*/
|
|
16
|
+
export declare function waitForAxResolution<T extends {
|
|
17
|
+
status: string;
|
|
18
|
+
}>(opts: {
|
|
19
|
+
read: () => T | null;
|
|
20
|
+
isResolved: (value: T) => boolean;
|
|
21
|
+
timeoutMs: number;
|
|
22
|
+
signal?: AbortSignal;
|
|
23
|
+
}): Promise<AxWaitResult<T>>;
|
|
@@ -3,6 +3,7 @@ import { type GraphNodeInput, type JsonRenderNodeInput, type JsonRenderSpec } fr
|
|
|
3
3
|
export type CanvasArrangeMode = 'grid' | 'column' | 'flow';
|
|
4
4
|
export type CanvasPinMode = 'set' | 'add' | 'remove';
|
|
5
5
|
export declare function setCanvasLayoutUpdateEmitter(emitter: (() => void) | null): void;
|
|
6
|
+
export declare function emitCanvasLayoutUpdate(): void;
|
|
6
7
|
export interface CanvasFitViewOptions {
|
|
7
8
|
width?: number;
|
|
8
9
|
height?: number;
|
|
@@ -82,11 +83,6 @@ interface CanvasCreateGroupInput {
|
|
|
82
83
|
color?: string;
|
|
83
84
|
childLayout?: CanvasArrangeMode;
|
|
84
85
|
}
|
|
85
|
-
export interface CanvasBatchOperation {
|
|
86
|
-
op: string;
|
|
87
|
-
assign?: string;
|
|
88
|
-
args?: Record<string, unknown>;
|
|
89
|
-
}
|
|
90
86
|
interface CanvasNodeLookupInput {
|
|
91
87
|
id?: string;
|
|
92
88
|
search?: string;
|
|
@@ -262,11 +258,4 @@ export declare function createCanvasGraphNode(input: GraphNodeInput): {
|
|
|
262
258
|
node: CanvasNodeState;
|
|
263
259
|
};
|
|
264
260
|
export declare function fitCanvasView(options?: CanvasFitViewOptions): CanvasFitViewResult;
|
|
265
|
-
export declare function executeCanvasBatch(operations: CanvasBatchOperation[]): Promise<{
|
|
266
|
-
ok: boolean;
|
|
267
|
-
results: Array<Record<string, unknown>>;
|
|
268
|
-
refs: Record<string, unknown>;
|
|
269
|
-
failedIndex?: number;
|
|
270
|
-
error?: string;
|
|
271
|
-
}>;
|
|
272
261
|
export {};
|