@lace-cloud/canvas 0.24.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -7
- package/dist/{chunk-HZWABSPP.mjs → chunk-ID563WHD.mjs} +795 -583
- package/dist/chunk-ID563WHD.mjs.map +1 -0
- package/dist/engine/index.cjs +784 -580
- package/dist/engine/index.cjs.map +1 -1
- package/dist/engine/index.d.mts +2 -2
- package/dist/engine/index.d.ts +2 -2
- package/dist/engine/index.mjs +5 -1
- package/dist/index.cjs +1261 -962
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +3 -9
- package/dist/index.d.ts +3 -9
- package/dist/index.mjs +333 -242
- package/dist/index.mjs.map +1 -1
- package/dist/{mapping-Z-STJQRP.d.mts → registry-BhFAgvlq.d.mts} +96 -16
- package/dist/{mapping-Z-STJQRP.d.ts → registry-BhFAgvlq.d.ts} +96 -16
- package/package.json +3 -3
- package/dist/chunk-HZWABSPP.mjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -66,6 +66,7 @@ __export(index_exports, {
|
|
|
66
66
|
UngeneratedMarker: () => UngeneratedMarker,
|
|
67
67
|
UnifiedSettingsPanel: () => UnifiedSettingsPanel,
|
|
68
68
|
UnsavedMarker: () => UnsavedMarker,
|
|
69
|
+
answering: () => answering,
|
|
69
70
|
bridgeCaller: () => bridgeCaller,
|
|
70
71
|
carriesFailure: () => carriesFailure,
|
|
71
72
|
conflictPanel: () => conflictPanel,
|
|
@@ -86,7 +87,7 @@ __export(index_exports, {
|
|
|
86
87
|
openEngineSession: () => openEngineSession,
|
|
87
88
|
parseBound: () => parseBound,
|
|
88
89
|
parseCommandFailure: () => parseCommandFailure,
|
|
89
|
-
projectCanvasView: () =>
|
|
90
|
+
projectCanvasView: () => import_proto16.projectCanvasView,
|
|
90
91
|
reportDiagnostics: () => reportDiagnostics,
|
|
91
92
|
resolveContributions: () => resolveContributions,
|
|
92
93
|
rowActions: () => rowActions,
|
|
@@ -102,20 +103,20 @@ __export(index_exports, {
|
|
|
102
103
|
usePanelScope: () => usePanelScope
|
|
103
104
|
});
|
|
104
105
|
module.exports = __toCommonJS(index_exports);
|
|
105
|
-
var
|
|
106
|
+
var import_proto16 = require("@lace-cloud/proto");
|
|
106
107
|
var import_feedback = require("@lace-cloud/ui/feedback");
|
|
107
108
|
|
|
108
109
|
// src/App.tsx
|
|
109
|
-
var
|
|
110
|
-
var
|
|
110
|
+
var import_react40 = require("@xyflow/react");
|
|
111
|
+
var import_react41 = require("react");
|
|
111
112
|
var import_App = require("./App-IFIOMNV7.css");
|
|
112
113
|
|
|
113
114
|
// src/Canvas.tsx
|
|
114
115
|
var import_style = require("@xyflow/react/dist/style.css");
|
|
115
116
|
var import_Canvas = require("./Canvas-JRY2HAY6.css");
|
|
116
|
-
var
|
|
117
|
-
var
|
|
118
|
-
var
|
|
117
|
+
var import_proto9 = require("@lace-cloud/proto");
|
|
118
|
+
var import_react18 = require("@xyflow/react");
|
|
119
|
+
var import_react19 = require("react");
|
|
119
120
|
|
|
120
121
|
// src/components/CanvasControls.tsx
|
|
121
122
|
var import_ui = require("@lace-cloud/ui");
|
|
@@ -332,7 +333,16 @@ var TARGET_NEEDS = {
|
|
|
332
333
|
runId: "a run",
|
|
333
334
|
failure: "a failed command"
|
|
334
335
|
};
|
|
335
|
-
|
|
336
|
+
function busyReason(busy) {
|
|
337
|
+
return busy.kind === "run" ? "A run is in progress" : `${busy.running.label} is running`;
|
|
338
|
+
}
|
|
339
|
+
function runsOn(action, ctx, target) {
|
|
340
|
+
if (action.requiredTarget?.includes("runId")) return `run:${target.runId}`;
|
|
341
|
+
const required = action.requiredContext ?? [];
|
|
342
|
+
if (required.includes("stack")) return `stack:${ctx.stack?.id}`;
|
|
343
|
+
if (required.includes("root")) return `root:${ctx.root}`;
|
|
344
|
+
return "";
|
|
345
|
+
}
|
|
336
346
|
function keySatisfied(ctx, key) {
|
|
337
347
|
if (key === "editable") return ctx.editable === true;
|
|
338
348
|
if (key === "saved") return ctx.view?.unsaved === false;
|
|
@@ -357,13 +367,24 @@ function keySatisfied(ctx, key) {
|
|
|
357
367
|
function contextSatisfied(ctx, required) {
|
|
358
368
|
return required.every((key) => keySatisfied(ctx, key));
|
|
359
369
|
}
|
|
360
|
-
function disabledReason(action, ctx,
|
|
361
|
-
if (
|
|
370
|
+
function disabledReason(action, ctx, busy) {
|
|
371
|
+
if (busy) return busyReason(busy);
|
|
362
372
|
for (const { key, reason } of action.enabledWhen ?? []) {
|
|
363
373
|
if (!keySatisfied(ctx, key)) return reason;
|
|
364
374
|
}
|
|
365
375
|
return void 0;
|
|
366
376
|
}
|
|
377
|
+
function busyLabelOf(action, ctx, busy) {
|
|
378
|
+
if (action.busy && keySatisfied(ctx, action.busy.when)) return action.busy.label;
|
|
379
|
+
if (busy === void 0 || action.binding.kind !== "command") return void 0;
|
|
380
|
+
return busy.kind === "run" || busy.running.path === action.binding.path ? action.label : void 0;
|
|
381
|
+
}
|
|
382
|
+
function actionState(action, ctx, busy) {
|
|
383
|
+
return {
|
|
384
|
+
disabledReason: disabledReason(action, ctx, busy),
|
|
385
|
+
busyLabel: busyLabelOf(action, ctx, busy)
|
|
386
|
+
};
|
|
387
|
+
}
|
|
367
388
|
function missingPort(ports, required) {
|
|
368
389
|
return required.find((name) => ports[name] === void 0);
|
|
369
390
|
}
|
|
@@ -394,6 +415,16 @@ function asksConfirm(binding) {
|
|
|
394
415
|
return binding.confirm !== void 0;
|
|
395
416
|
}
|
|
396
417
|
}
|
|
418
|
+
var FAILURE_ROW = "failure";
|
|
419
|
+
function placedOn(action, row) {
|
|
420
|
+
return typeof action.placement === "object" && action.placement.row === row;
|
|
421
|
+
}
|
|
422
|
+
function answersFailure(action, failure) {
|
|
423
|
+
return action.answers?.includes(failure.reason) === true;
|
|
424
|
+
}
|
|
425
|
+
function answering(actions, failure) {
|
|
426
|
+
return actions.filter((a) => placedOn(a, FAILURE_ROW) && answersFailure(a, failure));
|
|
427
|
+
}
|
|
397
428
|
function unmetRequirement(action, ports, ctx, target) {
|
|
398
429
|
const { label, binding } = action;
|
|
399
430
|
const port = missingPort(ports, action.requiredPorts);
|
|
@@ -405,11 +436,9 @@ function unmetRequirement(action, ports, ctx, target) {
|
|
|
405
436
|
if (key !== void 0) return `${label} needs ${CONTEXT_NEEDS[key]}`;
|
|
406
437
|
const targetKey = (action.requiredTarget ?? []).find((k) => target[k] === void 0);
|
|
407
438
|
if (targetKey !== void 0) return `${label} needs ${TARGET_NEEDS[targetKey]}`;
|
|
408
|
-
if (action.answers !== void 0) {
|
|
439
|
+
if (placedOn(action, FAILURE_ROW) || action.answers !== void 0) {
|
|
409
440
|
if (target.failure === void 0) return `${label} needs ${TARGET_NEEDS.failure}`;
|
|
410
|
-
if (!action
|
|
411
|
-
return `${label} does not answer this failure`;
|
|
412
|
-
}
|
|
441
|
+
if (!answersFailure(action, target.failure)) return `${label} does not answer this failure`;
|
|
413
442
|
}
|
|
414
443
|
if (binding.kind === "command" && !availableCommands(ports).has(binding.path)) {
|
|
415
444
|
return `${label} runs lace ${binding.path}, which this host does not route`;
|
|
@@ -428,9 +457,7 @@ function resolveContributions(all, ports, ctx, target = NO_TARGET) {
|
|
|
428
457
|
};
|
|
429
458
|
}
|
|
430
459
|
function rowActions(resolved, panelId) {
|
|
431
|
-
return resolved.actions.filter(
|
|
432
|
-
(a) => typeof a.placement === "object" && a.placement.row === panelId
|
|
433
|
-
);
|
|
460
|
+
return resolved.actions.filter((a) => placedOn(a, panelId));
|
|
434
461
|
}
|
|
435
462
|
|
|
436
463
|
// src/core/sections.ts
|
|
@@ -466,10 +493,6 @@ function isEmphasized(action, ctx) {
|
|
|
466
493
|
if (!action.primary) return false;
|
|
467
494
|
return action.primary.when === void 0 || keySatisfied(ctx, action.primary.when);
|
|
468
495
|
}
|
|
469
|
-
function busyLabelOf(action, ctx, commandBusy) {
|
|
470
|
-
if (action.busy && keySatisfied(ctx, action.busy.when)) return action.busy.label;
|
|
471
|
-
return commandBusy ? action.label : void 0;
|
|
472
|
-
}
|
|
473
496
|
|
|
474
497
|
// src/utils/key-chord.ts
|
|
475
498
|
function parseChord(spec) {
|
|
@@ -802,9 +825,9 @@ function DependencyEdge({
|
|
|
802
825
|
var edgeTypes = { [DEPENDENCY_EDGE_TYPE]: DependencyEdge };
|
|
803
826
|
|
|
804
827
|
// src/components/nodes/GroupNode.tsx
|
|
805
|
-
var
|
|
806
|
-
var
|
|
807
|
-
var
|
|
828
|
+
var import_proto6 = require("@lace-cloud/proto");
|
|
829
|
+
var import_react9 = require("@xyflow/react");
|
|
830
|
+
var import_react10 = require("react");
|
|
808
831
|
|
|
809
832
|
// src/core/editor-actions.ts
|
|
810
833
|
var import_proto3 = require("@lace-cloud/proto");
|
|
@@ -4344,7 +4367,7 @@ function conflictChoiceToJSON(object) {
|
|
|
4344
4367
|
}
|
|
4345
4368
|
}
|
|
4346
4369
|
function createBaseReasonDetail() {
|
|
4347
|
-
return { reason: 0, api_code: "" };
|
|
4370
|
+
return { reason: 0, api_code: "", request_id: "" };
|
|
4348
4371
|
}
|
|
4349
4372
|
var ReasonDetail = {
|
|
4350
4373
|
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
@@ -4354,6 +4377,9 @@ var ReasonDetail = {
|
|
|
4354
4377
|
if (message.api_code !== "") {
|
|
4355
4378
|
writer.uint32(18).string(message.api_code);
|
|
4356
4379
|
}
|
|
4380
|
+
if (message.request_id !== "") {
|
|
4381
|
+
writer.uint32(26).string(message.request_id);
|
|
4382
|
+
}
|
|
4357
4383
|
return writer;
|
|
4358
4384
|
},
|
|
4359
4385
|
decode(input, length) {
|
|
@@ -4377,6 +4403,13 @@ var ReasonDetail = {
|
|
|
4377
4403
|
message.api_code = reader.string();
|
|
4378
4404
|
continue;
|
|
4379
4405
|
}
|
|
4406
|
+
case 3: {
|
|
4407
|
+
if (tag !== 26) {
|
|
4408
|
+
break;
|
|
4409
|
+
}
|
|
4410
|
+
message.request_id = reader.string();
|
|
4411
|
+
continue;
|
|
4412
|
+
}
|
|
4380
4413
|
}
|
|
4381
4414
|
if ((tag & 7) === 4 || tag === 0) {
|
|
4382
4415
|
break;
|
|
@@ -4388,7 +4421,8 @@ var ReasonDetail = {
|
|
|
4388
4421
|
fromJSON(object) {
|
|
4389
4422
|
return {
|
|
4390
4423
|
reason: isSet3(object.reason) ? reasonFromJSON(object.reason) : 0,
|
|
4391
|
-
api_code: isSet3(object.apiCode) ? globalThis.String(object.apiCode) : isSet3(object.api_code) ? globalThis.String(object.api_code) : ""
|
|
4424
|
+
api_code: isSet3(object.apiCode) ? globalThis.String(object.apiCode) : isSet3(object.api_code) ? globalThis.String(object.api_code) : "",
|
|
4425
|
+
request_id: isSet3(object.requestId) ? globalThis.String(object.requestId) : isSet3(object.request_id) ? globalThis.String(object.request_id) : ""
|
|
4392
4426
|
};
|
|
4393
4427
|
},
|
|
4394
4428
|
toJSON(message) {
|
|
@@ -4399,6 +4433,9 @@ var ReasonDetail = {
|
|
|
4399
4433
|
if (message.api_code !== "") {
|
|
4400
4434
|
obj.apiCode = message.api_code;
|
|
4401
4435
|
}
|
|
4436
|
+
if (message.request_id !== "") {
|
|
4437
|
+
obj.requestId = message.request_id;
|
|
4438
|
+
}
|
|
4402
4439
|
return obj;
|
|
4403
4440
|
},
|
|
4404
4441
|
create(base) {
|
|
@@ -4408,6 +4445,7 @@ var ReasonDetail = {
|
|
|
4408
4445
|
const message = createBaseReasonDetail();
|
|
4409
4446
|
message.reason = object.reason ?? 0;
|
|
4410
4447
|
message.api_code = object.api_code ?? "";
|
|
4448
|
+
message.request_id = object.request_id ?? "";
|
|
4411
4449
|
return message;
|
|
4412
4450
|
}
|
|
4413
4451
|
};
|
|
@@ -8766,7 +8804,7 @@ var InvokeRequest = {
|
|
|
8766
8804
|
}
|
|
8767
8805
|
};
|
|
8768
8806
|
function createBaseInvokeEvent() {
|
|
8769
|
-
return { json: void 0, exit: void 0 };
|
|
8807
|
+
return { json: void 0, exit: void 0, started: void 0 };
|
|
8770
8808
|
}
|
|
8771
8809
|
var InvokeEvent = {
|
|
8772
8810
|
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
@@ -8776,6 +8814,9 @@ var InvokeEvent = {
|
|
|
8776
8814
|
if (message.exit !== void 0) {
|
|
8777
8815
|
InvokeExit.encode(message.exit, writer.uint32(18).fork()).join();
|
|
8778
8816
|
}
|
|
8817
|
+
if (message.started !== void 0) {
|
|
8818
|
+
InvokeStarted.encode(message.started, writer.uint32(26).fork()).join();
|
|
8819
|
+
}
|
|
8779
8820
|
return writer;
|
|
8780
8821
|
},
|
|
8781
8822
|
decode(input, length) {
|
|
@@ -8799,6 +8840,13 @@ var InvokeEvent = {
|
|
|
8799
8840
|
message.exit = InvokeExit.decode(reader, reader.uint32());
|
|
8800
8841
|
continue;
|
|
8801
8842
|
}
|
|
8843
|
+
case 3: {
|
|
8844
|
+
if (tag !== 26) {
|
|
8845
|
+
break;
|
|
8846
|
+
}
|
|
8847
|
+
message.started = InvokeStarted.decode(reader, reader.uint32());
|
|
8848
|
+
continue;
|
|
8849
|
+
}
|
|
8802
8850
|
}
|
|
8803
8851
|
if ((tag & 7) === 4 || tag === 0) {
|
|
8804
8852
|
break;
|
|
@@ -8810,7 +8858,8 @@ var InvokeEvent = {
|
|
|
8810
8858
|
fromJSON(object) {
|
|
8811
8859
|
return {
|
|
8812
8860
|
json: isSet3(object.json) ? globalThis.String(object.json) : void 0,
|
|
8813
|
-
exit: isSet3(object.exit) ? InvokeExit.fromJSON(object.exit) : void 0
|
|
8861
|
+
exit: isSet3(object.exit) ? InvokeExit.fromJSON(object.exit) : void 0,
|
|
8862
|
+
started: isSet3(object.started) ? InvokeStarted.fromJSON(object.started) : void 0
|
|
8814
8863
|
};
|
|
8815
8864
|
},
|
|
8816
8865
|
toJSON(message) {
|
|
@@ -8821,6 +8870,9 @@ var InvokeEvent = {
|
|
|
8821
8870
|
if (message.exit !== void 0) {
|
|
8822
8871
|
obj.exit = InvokeExit.toJSON(message.exit);
|
|
8823
8872
|
}
|
|
8873
|
+
if (message.started !== void 0) {
|
|
8874
|
+
obj.started = InvokeStarted.toJSON(message.started);
|
|
8875
|
+
}
|
|
8824
8876
|
return obj;
|
|
8825
8877
|
},
|
|
8826
8878
|
create(base) {
|
|
@@ -8830,6 +8882,44 @@ var InvokeEvent = {
|
|
|
8830
8882
|
const message = createBaseInvokeEvent();
|
|
8831
8883
|
message.json = object.json ?? void 0;
|
|
8832
8884
|
message.exit = object.exit !== void 0 && object.exit !== null ? InvokeExit.fromPartial(object.exit) : void 0;
|
|
8885
|
+
message.started = object.started !== void 0 && object.started !== null ? InvokeStarted.fromPartial(object.started) : void 0;
|
|
8886
|
+
return message;
|
|
8887
|
+
}
|
|
8888
|
+
};
|
|
8889
|
+
function createBaseInvokeStarted() {
|
|
8890
|
+
return {};
|
|
8891
|
+
}
|
|
8892
|
+
var InvokeStarted = {
|
|
8893
|
+
encode(_, writer = new import_wire4.BinaryWriter()) {
|
|
8894
|
+
return writer;
|
|
8895
|
+
},
|
|
8896
|
+
decode(input, length) {
|
|
8897
|
+
const reader = input instanceof import_wire4.BinaryReader ? input : new import_wire4.BinaryReader(input);
|
|
8898
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
8899
|
+
const message = createBaseInvokeStarted();
|
|
8900
|
+
while (reader.pos < end) {
|
|
8901
|
+
const tag = reader.uint32();
|
|
8902
|
+
switch (tag >>> 3) {
|
|
8903
|
+
}
|
|
8904
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
8905
|
+
break;
|
|
8906
|
+
}
|
|
8907
|
+
reader.skip(tag & 7);
|
|
8908
|
+
}
|
|
8909
|
+
return message;
|
|
8910
|
+
},
|
|
8911
|
+
fromJSON(_) {
|
|
8912
|
+
return {};
|
|
8913
|
+
},
|
|
8914
|
+
toJSON(_) {
|
|
8915
|
+
const obj = {};
|
|
8916
|
+
return obj;
|
|
8917
|
+
},
|
|
8918
|
+
create(base) {
|
|
8919
|
+
return InvokeStarted.fromPartial(base ?? {});
|
|
8920
|
+
},
|
|
8921
|
+
fromPartial(_) {
|
|
8922
|
+
const message = createBaseInvokeStarted();
|
|
8833
8923
|
return message;
|
|
8834
8924
|
}
|
|
8835
8925
|
};
|
|
@@ -11108,8 +11198,9 @@ var LaceEngineDefinition = {
|
|
|
11108
11198
|
options: {}
|
|
11109
11199
|
},
|
|
11110
11200
|
/**
|
|
11111
|
-
* Runs one CLI command in-process against a fresh command tree.
|
|
11112
|
-
*
|
|
11201
|
+
* Runs one CLI command in-process against a fresh command tree. `started` is first, once the engine has accepted
|
|
11202
|
+
* the request and before the command runs; the command's `-o json` output follows: each top-level JSON value on
|
|
11203
|
+
* stdout is one `json` event; `exit` is always last.
|
|
11113
11204
|
*/
|
|
11114
11205
|
invoke: {
|
|
11115
11206
|
name: "Invoke",
|
|
@@ -11184,6 +11275,7 @@ function isSet3(value) {
|
|
|
11184
11275
|
}
|
|
11185
11276
|
|
|
11186
11277
|
// src/ports.ts
|
|
11278
|
+
var import_proto = require("@lace-cloud/proto");
|
|
11187
11279
|
function currentFrame(source) {
|
|
11188
11280
|
return new Promise((resolve) => {
|
|
11189
11281
|
let settled = false;
|
|
@@ -11217,7 +11309,9 @@ var ConnectError = class extends Error {
|
|
|
11217
11309
|
super(`[${code}] ${message}`);
|
|
11218
11310
|
this.code = code;
|
|
11219
11311
|
this.reason = detail.reason;
|
|
11220
|
-
|
|
11312
|
+
const { apiCode, requestId } = (0, import_proto.apiFields)(detail);
|
|
11313
|
+
this.apiCode = apiCode;
|
|
11314
|
+
this.requestId = requestId;
|
|
11221
11315
|
this.name = "ConnectError";
|
|
11222
11316
|
}
|
|
11223
11317
|
};
|
|
@@ -11238,9 +11332,9 @@ var CommandUnobservedError = class extends Error {
|
|
|
11238
11332
|
};
|
|
11239
11333
|
|
|
11240
11334
|
// src/utils/arrangement.ts
|
|
11241
|
-
var
|
|
11335
|
+
var import_proto2 = require("@lace-cloud/proto");
|
|
11242
11336
|
function scopeKeyForCanvasPath(bundle, canvasPath) {
|
|
11243
|
-
return (0,
|
|
11337
|
+
return (0, import_proto2.resolveInstance)(bundle, canvasPath)?.scopeKey ?? null;
|
|
11244
11338
|
}
|
|
11245
11339
|
function cloneArrangement(arrangement) {
|
|
11246
11340
|
const next = {};
|
|
@@ -11255,7 +11349,7 @@ function cloneArrangement(arrangement) {
|
|
|
11255
11349
|
function withNodePosition(bundle, arrangement, canvasPath, position) {
|
|
11256
11350
|
const scopeKey = scopeKeyForCanvasPath(bundle, canvasPath);
|
|
11257
11351
|
if (!scopeKey) return arrangement;
|
|
11258
|
-
const { localId } = (0,
|
|
11352
|
+
const { localId } = (0, import_proto2.splitPath)(canvasPath);
|
|
11259
11353
|
const next = cloneArrangement(arrangement);
|
|
11260
11354
|
const scopeEntry = next[scopeKey] ?? {};
|
|
11261
11355
|
next[scopeKey] = { ...scopeEntry, nodes: { ...scopeEntry.nodes, [localId]: position } };
|
|
@@ -11270,25 +11364,25 @@ function withNodePositions(bundle, arrangement, positions) {
|
|
|
11270
11364
|
}
|
|
11271
11365
|
function withScopesPinned(bundle, view, arrangement, canvasPath) {
|
|
11272
11366
|
const scopes = /* @__PURE__ */ new Set();
|
|
11273
|
-
for (let scope = (0,
|
|
11367
|
+
for (let scope = (0, import_proto2.splitPath)(canvasPath).parentPath; ; scope = (0, import_proto2.splitPath)(scope).parentPath) {
|
|
11274
11368
|
scopes.add(scope);
|
|
11275
11369
|
if (scope === "") break;
|
|
11276
11370
|
}
|
|
11277
11371
|
let next = arrangement;
|
|
11278
11372
|
for (const id of [...view.groups.map((g) => g.id), ...view.nodes.map((n) => n.id)]) {
|
|
11279
|
-
const { parentPath } = (0,
|
|
11373
|
+
const { parentPath } = (0, import_proto2.splitPath)(id);
|
|
11280
11374
|
if (!scopes.has(parentPath)) continue;
|
|
11281
11375
|
const scopeKey = scopeKeyForCanvasPath(bundle, id);
|
|
11282
|
-
const at = (0,
|
|
11376
|
+
const at = (0, import_proto2.drawnAt)(view, id);
|
|
11283
11377
|
if (!scopeKey || !at) continue;
|
|
11284
|
-
next = withNodePosition(bundle, next, id, (0,
|
|
11378
|
+
next = withNodePosition(bundle, next, id, (0, import_proto2.localIn)(view, id, at));
|
|
11285
11379
|
}
|
|
11286
11380
|
return next;
|
|
11287
11381
|
}
|
|
11288
11382
|
function withGroupCollapsed(bundle, arrangement, canvasPath, collapsed) {
|
|
11289
11383
|
const scopeKey = scopeKeyForCanvasPath(bundle, canvasPath);
|
|
11290
11384
|
if (!scopeKey) return arrangement;
|
|
11291
|
-
const { localId } = (0,
|
|
11385
|
+
const { localId } = (0, import_proto2.splitPath)(canvasPath);
|
|
11292
11386
|
const next = cloneArrangement(arrangement);
|
|
11293
11387
|
const scopeEntry = next[scopeKey] ?? {};
|
|
11294
11388
|
next[scopeKey] = {
|
|
@@ -11297,8 +11391,7 @@ function withGroupCollapsed(bundle, arrangement, canvasPath, collapsed) {
|
|
|
11297
11391
|
};
|
|
11298
11392
|
return next;
|
|
11299
11393
|
}
|
|
11300
|
-
function withRenameCarried(
|
|
11301
|
-
if (bundle.modules[scopeKey]?.modules?.some((u) => u.id === newId)) return arrangement;
|
|
11394
|
+
function withRenameCarried(arrangement, scopeKey, oldId, newId) {
|
|
11302
11395
|
const scopeEntry = arrangement[scopeKey];
|
|
11303
11396
|
const position = scopeEntry?.nodes?.[oldId];
|
|
11304
11397
|
const group2 = scopeEntry?.groups?.[oldId];
|
|
@@ -11319,7 +11412,7 @@ function migrateUngroup(bundle, view, arrangement, groupCanvasPath, groupModuleK
|
|
|
11319
11412
|
const parentScopeKey = scopeKeyForCanvasPath(bundle, groupCanvasPath);
|
|
11320
11413
|
const group2 = view.groups.find((g) => g.id === groupCanvasPath);
|
|
11321
11414
|
if (!parentScopeKey || !group2) return arrangement;
|
|
11322
|
-
const { localId } = (0,
|
|
11415
|
+
const { localId } = (0, import_proto2.splitPath)(groupCanvasPath);
|
|
11323
11416
|
const pinned = withScopesPinned(bundle, view, arrangement, groupCanvasPath);
|
|
11324
11417
|
const parentEntry = pinned[parentScopeKey] ?? {};
|
|
11325
11418
|
const groupEntry = pinned[groupModuleKey] ?? {};
|
|
@@ -11327,12 +11420,12 @@ function migrateUngroup(bundle, view, arrangement, groupCanvasPath, groupModuleK
|
|
|
11327
11420
|
promoted.filter((ref) => ref.scope === parentScopeKey && ref.sourceId).map((ref) => [ref.sourceId, ref.id])
|
|
11328
11421
|
);
|
|
11329
11422
|
const rename = (id) => renameMap.get(id) ?? id;
|
|
11330
|
-
const frame = (0,
|
|
11423
|
+
const frame = (0, import_proto2.frameOf)(view, groupCanvasPath);
|
|
11331
11424
|
const nodes = { ...parentEntry.nodes };
|
|
11332
11425
|
delete nodes[localId];
|
|
11333
11426
|
for (const member of group2.node_ids) {
|
|
11334
|
-
const at = (0,
|
|
11335
|
-
if (at) nodes[rename((0,
|
|
11427
|
+
const at = (0, import_proto2.drawnAt)(view, member);
|
|
11428
|
+
if (at) nodes[rename((0, import_proto2.splitPath)(member).localId)] = (0, import_proto2.localIn)(view, member, at, frame);
|
|
11336
11429
|
}
|
|
11337
11430
|
const remainingGroups = parentEntry.groups ? { ...parentEntry.groups } : void 0;
|
|
11338
11431
|
if (remainingGroups) delete remainingGroups[localId];
|
|
@@ -11376,36 +11469,6 @@ function inEntryScope(view, ids) {
|
|
|
11376
11469
|
return ids.filter((id) => entry.has(id));
|
|
11377
11470
|
}
|
|
11378
11471
|
|
|
11379
|
-
// src/core/pipeline.ts
|
|
11380
|
-
var import_proto2 = require("@lace-cloud/proto");
|
|
11381
|
-
var import_react6 = require("react");
|
|
11382
|
-
function projectFrame(frame, arrangement) {
|
|
11383
|
-
return (0, import_proto2.projectCanvasView)(frame.bundle, arrangement, {
|
|
11384
|
-
canUndo: frame.canUndo,
|
|
11385
|
-
canRedo: frame.canRedo,
|
|
11386
|
-
unsaved: frame.unsaved,
|
|
11387
|
-
conflict: frame.conflict ? { base_tree_hash: frame.conflict.baseTreeHash, tree_hash: frame.conflict.treeHash } : void 0,
|
|
11388
|
-
ungenerated: frame.ungenerated
|
|
11389
|
-
});
|
|
11390
|
-
}
|
|
11391
|
-
function useCanvasSource(source, onCommandResult, onSessionEnd) {
|
|
11392
|
-
const [state, setState] = (0, import_react6.useState)({ source: null, end: null, session: null });
|
|
11393
|
-
(0, import_react6.useEffect)(() => {
|
|
11394
|
-
const session = {};
|
|
11395
|
-
setState({ source: null, end: null, session });
|
|
11396
|
-
const unsubscribe = source.subscribe(
|
|
11397
|
-
(next) => setState({ source: next, end: null, session }),
|
|
11398
|
-
(end) => setState((prev) => ({ source: prev.source, end, session })),
|
|
11399
|
-
(result) => onCommandResult(result, session)
|
|
11400
|
-
);
|
|
11401
|
-
return () => {
|
|
11402
|
-
unsubscribe();
|
|
11403
|
-
onSessionEnd(session);
|
|
11404
|
-
};
|
|
11405
|
-
}, [source, onCommandResult, onSessionEnd]);
|
|
11406
|
-
return state;
|
|
11407
|
-
}
|
|
11408
|
-
|
|
11409
11472
|
// src/core/editor-actions.ts
|
|
11410
11473
|
function emptyApplyResult(message) {
|
|
11411
11474
|
if (!message) return { success: true, errors: [], created: [], ties: [] };
|
|
@@ -11586,8 +11649,6 @@ async function groupRun(env) {
|
|
|
11586
11649
|
groups: { ...parentEntry.groups, [created.id]: { collapsed: true } }
|
|
11587
11650
|
});
|
|
11588
11651
|
env.arrangement.update(written);
|
|
11589
|
-
const card = (0, import_proto3.drawnRect)(projectFrame(frame, written), groupPath);
|
|
11590
|
-
if (card) env.layout.panIntoView(card);
|
|
11591
11652
|
return result;
|
|
11592
11653
|
}
|
|
11593
11654
|
function groupTarget(id) {
|
|
@@ -11809,10 +11870,10 @@ var CORE_EDITOR_ACTIONS = [
|
|
|
11809
11870
|
];
|
|
11810
11871
|
|
|
11811
11872
|
// src/state/canvas-context.ts
|
|
11812
|
-
var
|
|
11813
|
-
var CanvasContext = (0,
|
|
11873
|
+
var import_react6 = require("react");
|
|
11874
|
+
var CanvasContext = (0, import_react6.createContext)(null);
|
|
11814
11875
|
function useCanvas() {
|
|
11815
|
-
const value = (0,
|
|
11876
|
+
const value = (0, import_react6.useContext)(CanvasContext);
|
|
11816
11877
|
if (!value) throw new Error("CanvasContext not available: mount inside <App>");
|
|
11817
11878
|
return value;
|
|
11818
11879
|
}
|
|
@@ -11833,6 +11894,84 @@ function useEditorEnvExtras() {
|
|
|
11833
11894
|
|
|
11834
11895
|
// src/components/nodes/GroupNode.tsx
|
|
11835
11896
|
var import_GroupNode = require("./GroupNode-QWSLBFCH.css");
|
|
11897
|
+
|
|
11898
|
+
// src/components/nodes/use-rename-instance.ts
|
|
11899
|
+
var import_proto5 = require("@lace-cloud/proto");
|
|
11900
|
+
var import_react8 = require("react");
|
|
11901
|
+
|
|
11902
|
+
// src/core/pipeline.ts
|
|
11903
|
+
var import_proto4 = require("@lace-cloud/proto");
|
|
11904
|
+
var import_react7 = require("react");
|
|
11905
|
+
function projectFrame(frame, arrangement) {
|
|
11906
|
+
return (0, import_proto4.projectCanvasView)(frame.bundle, arrangement, {
|
|
11907
|
+
canUndo: frame.canUndo,
|
|
11908
|
+
canRedo: frame.canRedo,
|
|
11909
|
+
unsaved: frame.unsaved,
|
|
11910
|
+
conflict: frame.conflict ? { base_tree_hash: frame.conflict.baseTreeHash, tree_hash: frame.conflict.treeHash } : void 0,
|
|
11911
|
+
ungenerated: frame.ungenerated
|
|
11912
|
+
});
|
|
11913
|
+
}
|
|
11914
|
+
function reconcileSelection(view, selection) {
|
|
11915
|
+
const held = new Set([...view.nodes, ...view.groups].map((n) => n.id));
|
|
11916
|
+
const nodes = selection.nodes.filter((id) => held.has(id));
|
|
11917
|
+
const { edge } = selection;
|
|
11918
|
+
const keptEdge = edge && view.edges.some((e) => e.id === edge.id) ? edge : null;
|
|
11919
|
+
if (nodes.length === selection.nodes.length && keptEdge === edge) return selection;
|
|
11920
|
+
return { nodes, edge: keptEdge };
|
|
11921
|
+
}
|
|
11922
|
+
function carrySelection(selection, oldPath, newPath) {
|
|
11923
|
+
const copies = selection.nodes.flatMap(
|
|
11924
|
+
(id) => id === oldPath || id.startsWith(`${oldPath}.`) ? [newPath + id.slice(oldPath.length)] : []
|
|
11925
|
+
);
|
|
11926
|
+
if (copies.length === 0) return selection;
|
|
11927
|
+
return { ...selection, nodes: [...selection.nodes, ...copies] };
|
|
11928
|
+
}
|
|
11929
|
+
function useCanvasSource(source, onCommandResult, onSessionEnd) {
|
|
11930
|
+
const [state, setState] = (0, import_react7.useState)({ source: null, end: null, session: null });
|
|
11931
|
+
(0, import_react7.useEffect)(() => {
|
|
11932
|
+
const session = {};
|
|
11933
|
+
setState({ source: null, end: null, session });
|
|
11934
|
+
const unsubscribe = source.subscribe(
|
|
11935
|
+
(next) => setState({ source: next, end: null, session }),
|
|
11936
|
+
(end) => setState((prev) => ({ source: prev.source, end, session })),
|
|
11937
|
+
(result) => onCommandResult(result, session)
|
|
11938
|
+
);
|
|
11939
|
+
return () => {
|
|
11940
|
+
unsubscribe();
|
|
11941
|
+
onSessionEnd(session);
|
|
11942
|
+
};
|
|
11943
|
+
}, [source, onCommandResult, onSessionEnd]);
|
|
11944
|
+
return state;
|
|
11945
|
+
}
|
|
11946
|
+
|
|
11947
|
+
// src/components/nodes/use-rename-instance.ts
|
|
11948
|
+
function useRenameInstance() {
|
|
11949
|
+
const { bundle, view, arrangement, updateArrangement, selection, setSelection, runner } = useCanvas();
|
|
11950
|
+
const latest = (0, import_react8.useRef)({ view, selection });
|
|
11951
|
+
latest.current = { view, selection };
|
|
11952
|
+
return (0, import_react8.useCallback)(
|
|
11953
|
+
async (canvasPath, newId) => {
|
|
11954
|
+
const { scope, id: oldId } = (0, import_proto5.instanceAddress)(bundle, canvasPath);
|
|
11955
|
+
if (!newId || newId === oldId) return;
|
|
11956
|
+
const taken = bundle.modules[scope]?.modules?.some((u) => u.id === newId) ?? false;
|
|
11957
|
+
const newPath = canvasPath.slice(0, canvasPath.length - oldId.length) + newId;
|
|
11958
|
+
const carriedArrangement = taken ? arrangement : withRenameCarried(arrangement, scope, oldId, newId);
|
|
11959
|
+
const carriedSelection = taken ? selection : carrySelection(selection, canvasPath, newPath);
|
|
11960
|
+
if (carriedArrangement !== arrangement) updateArrangement(carriedArrangement);
|
|
11961
|
+
if (carriedSelection !== selection) setSelection(carriedSelection);
|
|
11962
|
+
const result = await runner.apply([
|
|
11963
|
+
{ rename_instance: { scope, old_id: oldId, new_id: newId } }
|
|
11964
|
+
]);
|
|
11965
|
+
if (result?.success || carriedSelection === selection) return;
|
|
11966
|
+
const now = latest.current;
|
|
11967
|
+
const held = reconcileSelection(now.view, now.selection);
|
|
11968
|
+
if (held !== now.selection) setSelection(held);
|
|
11969
|
+
},
|
|
11970
|
+
[bundle, arrangement, updateArrangement, selection, setSelection, runner]
|
|
11971
|
+
);
|
|
11972
|
+
}
|
|
11973
|
+
|
|
11974
|
+
// src/components/nodes/GroupNode.tsx
|
|
11836
11975
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
11837
11976
|
var GroupHeader = ({
|
|
11838
11977
|
label,
|
|
@@ -11852,7 +11991,7 @@ var GroupHeader = ({
|
|
|
11852
11991
|
"div",
|
|
11853
11992
|
{
|
|
11854
11993
|
className: `lace-group-node__header lace-group-node__header--${collapsed ? "collapsed" : "expanded"}`,
|
|
11855
|
-
style: collapsed ? { height:
|
|
11994
|
+
style: collapsed ? { height: import_proto6.GROUP_HEADER_HEIGHT } : void 0,
|
|
11856
11995
|
children: [
|
|
11857
11996
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
11858
11997
|
"button",
|
|
@@ -11915,10 +12054,10 @@ var InterfacePinRow = ({ pin, y }) => {
|
|
|
11915
12054
|
{
|
|
11916
12055
|
style: {
|
|
11917
12056
|
position: "absolute",
|
|
11918
|
-
top: y -
|
|
12057
|
+
top: y - import_proto6.NODE_ROW_HEIGHT / 2,
|
|
11919
12058
|
left: 0,
|
|
11920
12059
|
right: 0,
|
|
11921
|
-
height:
|
|
12060
|
+
height: import_proto6.NODE_ROW_HEIGHT,
|
|
11922
12061
|
paddingLeft: isInput ? 12 : 8,
|
|
11923
12062
|
paddingRight: isInput ? 8 : 12,
|
|
11924
12063
|
display: "flex",
|
|
@@ -11928,11 +12067,11 @@ var InterfacePinRow = ({ pin, y }) => {
|
|
|
11928
12067
|
title: pin.name,
|
|
11929
12068
|
children: [
|
|
11930
12069
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
11931
|
-
|
|
12070
|
+
import_react9.Handle,
|
|
11932
12071
|
{
|
|
11933
12072
|
id: pin.handleId,
|
|
11934
12073
|
type: isInput ? "target" : "source",
|
|
11935
|
-
position: isInput ?
|
|
12074
|
+
position: isInput ? import_react9.Position.Left : import_react9.Position.Right,
|
|
11936
12075
|
isConnectable: false,
|
|
11937
12076
|
className: "lace-pin-handle",
|
|
11938
12077
|
style: {
|
|
@@ -11943,30 +12082,31 @@ var InterfacePinRow = ({ pin, y }) => {
|
|
|
11943
12082
|
width: 10,
|
|
11944
12083
|
height: 10,
|
|
11945
12084
|
[isInput ? "left" : "right"]: -5,
|
|
11946
|
-
top:
|
|
12085
|
+
top: import_proto6.NODE_ROW_HEIGHT / 2
|
|
11947
12086
|
}
|
|
11948
12087
|
}
|
|
11949
12088
|
),
|
|
11950
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "lace-group-node__pin-label", style: { maxWidth:
|
|
12089
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "lace-group-node__pin-label", style: { maxWidth: import_proto6.COLLAPSED_GROUP_WIDTH - 28 }, children: pin.name })
|
|
11951
12090
|
]
|
|
11952
12091
|
}
|
|
11953
12092
|
);
|
|
11954
12093
|
};
|
|
11955
12094
|
var GroupNode = ({ data }) => {
|
|
11956
12095
|
const { editable, ctx, runner, bundle, arrangement, updateArrangement } = useCanvas();
|
|
12096
|
+
const rename = useRenameInstance();
|
|
11957
12097
|
const envExtras = useEditorEnvExtras();
|
|
11958
|
-
const [editing, setEditing] = (0,
|
|
11959
|
-
const [editValue, setEditValue] = (0,
|
|
11960
|
-
const [hovered, setHovered] = (0,
|
|
11961
|
-
const inputRef = (0,
|
|
12098
|
+
const [editing, setEditing] = (0, import_react10.useState)(false);
|
|
12099
|
+
const [editValue, setEditValue] = (0, import_react10.useState)(data.label);
|
|
12100
|
+
const [hovered, setHovered] = (0, import_react10.useState)(false);
|
|
12101
|
+
const inputRef = (0, import_react10.useRef)(null);
|
|
11962
12102
|
const collapsed = data.collapsed;
|
|
11963
|
-
(0,
|
|
12103
|
+
(0, import_react10.useEffect)(() => {
|
|
11964
12104
|
if (editing && inputRef.current) {
|
|
11965
12105
|
inputRef.current.focus();
|
|
11966
12106
|
inputRef.current.select();
|
|
11967
12107
|
}
|
|
11968
12108
|
}, [editing]);
|
|
11969
|
-
const onDoubleClick = (0,
|
|
12109
|
+
const onDoubleClick = (0, import_react10.useCallback)(
|
|
11970
12110
|
(e) => {
|
|
11971
12111
|
if (!editable) return;
|
|
11972
12112
|
e.stopPropagation();
|
|
@@ -11975,22 +12115,15 @@ var GroupNode = ({ data }) => {
|
|
|
11975
12115
|
},
|
|
11976
12116
|
[data.label, editable]
|
|
11977
12117
|
);
|
|
11978
|
-
const renamingRef = (0,
|
|
11979
|
-
const commitRename = (0,
|
|
12118
|
+
const renamingRef = (0, import_react10.useRef)(false);
|
|
12119
|
+
const commitRename = (0, import_react10.useCallback)(async () => {
|
|
11980
12120
|
if (renamingRef.current) return;
|
|
11981
12121
|
renamingRef.current = true;
|
|
11982
12122
|
setEditing(false);
|
|
11983
|
-
|
|
11984
|
-
const address = (0, import_proto4.instanceAddress)(bundle, data.groupId);
|
|
11985
|
-
if (trimmed && trimmed !== address.id) {
|
|
11986
|
-
updateArrangement(withRenameCarried(bundle, arrangement, address.scope, address.id, trimmed));
|
|
11987
|
-
await runner.apply([
|
|
11988
|
-
{ rename_instance: { scope: address.scope, old_id: address.id, new_id: trimmed } }
|
|
11989
|
-
]);
|
|
11990
|
-
}
|
|
12123
|
+
await rename(data.groupId, editValue.trim());
|
|
11991
12124
|
renamingRef.current = false;
|
|
11992
|
-
}, [editValue, data.groupId,
|
|
11993
|
-
const onKeyDown = (0,
|
|
12125
|
+
}, [editValue, data.groupId, rename]);
|
|
12126
|
+
const onKeyDown = (0, import_react10.useCallback)(
|
|
11994
12127
|
(e) => {
|
|
11995
12128
|
e.stopPropagation();
|
|
11996
12129
|
if (e.key === "Enter") commitRename();
|
|
@@ -11998,14 +12131,14 @@ var GroupNode = ({ data }) => {
|
|
|
11998
12131
|
},
|
|
11999
12132
|
[commitRename]
|
|
12000
12133
|
);
|
|
12001
|
-
const toggleCollapsed = (0,
|
|
12134
|
+
const toggleCollapsed = (0, import_react10.useCallback)(
|
|
12002
12135
|
(e) => {
|
|
12003
12136
|
e.stopPropagation();
|
|
12004
12137
|
updateArrangement(withGroupCollapsed(bundle, arrangement, data.groupId, !data.collapsed));
|
|
12005
12138
|
},
|
|
12006
12139
|
[bundle, data.groupId, data.collapsed, arrangement, updateArrangement]
|
|
12007
12140
|
);
|
|
12008
|
-
const onUngroup = (0,
|
|
12141
|
+
const onUngroup = (0, import_react10.useCallback)(
|
|
12009
12142
|
async (e) => {
|
|
12010
12143
|
e.stopPropagation();
|
|
12011
12144
|
const action = ctx.contributions.actions.find((a) => a.id === "ungroup");
|
|
@@ -12039,14 +12172,14 @@ var GroupNode = ({ data }) => {
|
|
|
12039
12172
|
"data-group": data.groupId,
|
|
12040
12173
|
"data-collapsed": "true",
|
|
12041
12174
|
className: `lace-group-node lace-group-node--collapsed${bare ? " lace-group-node--bare" : ""}${data.hasErrors ? " lace-group-node--error" : ""}`,
|
|
12042
|
-
style: (0,
|
|
12175
|
+
style: (0, import_proto6.collapsedGroupSize)({ inputs, outputs }),
|
|
12043
12176
|
onMouseEnter: () => setHovered(true),
|
|
12044
12177
|
onMouseLeave: () => setHovered(false),
|
|
12045
12178
|
children: [
|
|
12046
12179
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(GroupHeader, { ...headerProps }),
|
|
12047
12180
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(GroupBadges, { badges: data.badges }),
|
|
12048
|
-
inputs.map((pin, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(InterfacePinRow, { pin, y: (0,
|
|
12049
|
-
outputs.map((pin, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(InterfacePinRow, { pin, y: (0,
|
|
12181
|
+
inputs.map((pin, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(InterfacePinRow, { pin, y: (0, import_proto6.groupPinY)(i) }, pin.handleId)),
|
|
12182
|
+
outputs.map((pin, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(InterfacePinRow, { pin, y: (0, import_proto6.groupPinY)(i) }, pin.handleId))
|
|
12050
12183
|
]
|
|
12051
12184
|
}
|
|
12052
12185
|
);
|
|
@@ -12070,12 +12203,12 @@ var GroupNode = ({ data }) => {
|
|
|
12070
12203
|
var GroupNode_default = GroupNode;
|
|
12071
12204
|
|
|
12072
12205
|
// src/components/nodes/ModuleNode.tsx
|
|
12073
|
-
var
|
|
12074
|
-
var
|
|
12075
|
-
var
|
|
12206
|
+
var import_proto8 = require("@lace-cloud/proto");
|
|
12207
|
+
var import_react12 = require("@xyflow/react");
|
|
12208
|
+
var import_react13 = require("react");
|
|
12076
12209
|
|
|
12077
12210
|
// src/core/decorate.ts
|
|
12078
|
-
var
|
|
12211
|
+
var import_proto7 = require("@lace-cloud/proto");
|
|
12079
12212
|
var EMPTY_DECORATIONS = { nodes: {} };
|
|
12080
12213
|
function hasErrorBadge(badges) {
|
|
12081
12214
|
return (badges ?? []).some((b) => b.tone === "error");
|
|
@@ -12094,7 +12227,7 @@ function decorate(view, overlayDecorations, diagnostics) {
|
|
|
12094
12227
|
}
|
|
12095
12228
|
const byNode = /* @__PURE__ */ new Map();
|
|
12096
12229
|
for (const diagnostic of diagnostics) {
|
|
12097
|
-
const nodeId = (0,
|
|
12230
|
+
const nodeId = (0, import_proto7.nodeIdForDiagnostic)(view, diagnostic);
|
|
12098
12231
|
if (nodeId === null) continue;
|
|
12099
12232
|
byNode.set(nodeId, [...byNode.get(nodeId) ?? [], diagnostic]);
|
|
12100
12233
|
}
|
|
@@ -12153,20 +12286,20 @@ function typedName(name, type) {
|
|
|
12153
12286
|
var import_ModuleNode = require("./ModuleNode-RRZ37SFM.css");
|
|
12154
12287
|
|
|
12155
12288
|
// src/components/nodes/node-config-bus.tsx
|
|
12156
|
-
var
|
|
12289
|
+
var import_react11 = require("react");
|
|
12157
12290
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
12158
|
-
var NodeConfigBusContext = (0,
|
|
12291
|
+
var NodeConfigBusContext = (0, import_react11.createContext)(null);
|
|
12159
12292
|
function NodeConfigBusProvider({
|
|
12160
12293
|
onOpen,
|
|
12161
12294
|
children
|
|
12162
12295
|
}) {
|
|
12163
|
-
const onOpenRef = (0,
|
|
12296
|
+
const onOpenRef = (0, import_react11.useRef)(onOpen);
|
|
12164
12297
|
onOpenRef.current = onOpen;
|
|
12165
|
-
const stableRef = (0,
|
|
12298
|
+
const stableRef = (0, import_react11.useRef)((instanceId) => onOpenRef.current(instanceId));
|
|
12166
12299
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(NodeConfigBusContext.Provider, { value: stableRef.current, children });
|
|
12167
12300
|
}
|
|
12168
12301
|
function useOpenNodeConfig() {
|
|
12169
|
-
const fn = (0,
|
|
12302
|
+
const fn = (0, import_react11.useContext)(NodeConfigBusContext);
|
|
12170
12303
|
if (!fn) throw new Error("useOpenNodeConfig: mount inside <NodeConfigBusProvider>");
|
|
12171
12304
|
return fn;
|
|
12172
12305
|
}
|
|
@@ -12249,7 +12382,7 @@ var PinRow = ({ pin, side, top, shared, problem, isConnectable }) => {
|
|
|
12249
12382
|
width: 10,
|
|
12250
12383
|
height: 10,
|
|
12251
12384
|
[isInput ? "left" : "right"]: -5,
|
|
12252
|
-
top:
|
|
12385
|
+
top: import_proto8.NODE_ROW_HEIGHT / 2
|
|
12253
12386
|
};
|
|
12254
12387
|
const about = `${typedName(pin.name, pin.type)}${pin.description ? ` \u2014 ${pin.description}` : ""}`;
|
|
12255
12388
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
@@ -12261,7 +12394,7 @@ var PinRow = ({ pin, side, top, shared, problem, isConnectable }) => {
|
|
|
12261
12394
|
top,
|
|
12262
12395
|
left: 0,
|
|
12263
12396
|
right: 0,
|
|
12264
|
-
height:
|
|
12397
|
+
height: import_proto8.NODE_ROW_HEIGHT,
|
|
12265
12398
|
paddingLeft: isInput ? 12 : 8,
|
|
12266
12399
|
paddingRight: isInput ? 8 : 12,
|
|
12267
12400
|
display: "flex",
|
|
@@ -12272,11 +12405,11 @@ var PinRow = ({ pin, side, top, shared, problem, isConnectable }) => {
|
|
|
12272
12405
|
${about}` : about,
|
|
12273
12406
|
children: [
|
|
12274
12407
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
12275
|
-
|
|
12408
|
+
import_react12.Handle,
|
|
12276
12409
|
{
|
|
12277
12410
|
id: `${isInput ? "in" : "out"}:${pin.name}`,
|
|
12278
12411
|
type: isInput ? "target" : "source",
|
|
12279
|
-
position: isInput ?
|
|
12412
|
+
position: isInput ? import_react12.Position.Left : import_react12.Position.Right,
|
|
12280
12413
|
isConnectable,
|
|
12281
12414
|
className: "lace-pin-handle",
|
|
12282
12415
|
style: handleStyle
|
|
@@ -12286,7 +12419,7 @@ ${about}` : about,
|
|
|
12286
12419
|
"span",
|
|
12287
12420
|
{
|
|
12288
12421
|
className: `lace-module-node__pin-row-label lace-module-node__pin-row-label--${isError ? "error" : filled ? "wired" : "default"}`,
|
|
12289
|
-
style: { maxWidth: shared ? (
|
|
12422
|
+
style: { maxWidth: shared ? (import_proto8.NODE_WIDTH - 28) / 2 - 4 : import_proto8.NODE_WIDTH - 28 },
|
|
12290
12423
|
children: pin.name
|
|
12291
12424
|
}
|
|
12292
12425
|
)
|
|
@@ -12295,19 +12428,20 @@ ${about}` : about,
|
|
|
12295
12428
|
);
|
|
12296
12429
|
};
|
|
12297
12430
|
var ModuleNode = ({ id, data }) => {
|
|
12298
|
-
const { editable, ctx, runner, bundle
|
|
12299
|
-
const
|
|
12431
|
+
const { editable, ctx, runner, bundle } = useCanvas();
|
|
12432
|
+
const rename = useRenameInstance();
|
|
12433
|
+
const connecting = (0, import_react12.useStore)(nodeDragging);
|
|
12300
12434
|
const openNodeConfig = useOpenNodeConfig();
|
|
12301
12435
|
const envExtras = useEditorEnvExtras();
|
|
12302
|
-
const [editing, setEditing] = (0,
|
|
12303
|
-
const [editValue, setEditValue] = (0,
|
|
12304
|
-
const [hovered, setHovered] = (0,
|
|
12305
|
-
const [imgFailed, setImgFailed] = (0,
|
|
12306
|
-
const [collapsed, setCollapsed] = (0,
|
|
12307
|
-
const [showAllInputs, setShowAllInputs] = (0,
|
|
12308
|
-
const inputRef = (0,
|
|
12309
|
-
const renamingRef = (0,
|
|
12310
|
-
(0,
|
|
12436
|
+
const [editing, setEditing] = (0, import_react13.useState)(false);
|
|
12437
|
+
const [editValue, setEditValue] = (0, import_react13.useState)(id);
|
|
12438
|
+
const [hovered, setHovered] = (0, import_react13.useState)(false);
|
|
12439
|
+
const [imgFailed, setImgFailed] = (0, import_react13.useState)(false);
|
|
12440
|
+
const [collapsed, setCollapsed] = (0, import_react13.useState)(false);
|
|
12441
|
+
const [showAllInputs, setShowAllInputs] = (0, import_react13.useState)(false);
|
|
12442
|
+
const inputRef = (0, import_react13.useRef)(null);
|
|
12443
|
+
const renamingRef = (0, import_react13.useRef)(false);
|
|
12444
|
+
(0, import_react13.useEffect)(() => {
|
|
12311
12445
|
if (editing && inputRef.current) {
|
|
12312
12446
|
inputRef.current.focus();
|
|
12313
12447
|
inputRef.current.select();
|
|
@@ -12315,48 +12449,41 @@ var ModuleNode = ({ id, data }) => {
|
|
|
12315
12449
|
}, [editing]);
|
|
12316
12450
|
const inputs = data.inputs ?? [];
|
|
12317
12451
|
const outputs = data.outputs ?? [];
|
|
12318
|
-
const { shownInputs, hiddenInputCount } = (0,
|
|
12452
|
+
const { shownInputs, hiddenInputCount } = (0, import_react13.useMemo)(() => {
|
|
12319
12453
|
if (showAllInputs) {
|
|
12320
12454
|
return { shownInputs: inputs, hiddenInputCount: 0 };
|
|
12321
12455
|
}
|
|
12322
|
-
const visible = (0,
|
|
12456
|
+
const visible = (0, import_proto8.visibleInputs)(inputs);
|
|
12323
12457
|
return {
|
|
12324
12458
|
shownInputs: visible,
|
|
12325
12459
|
hiddenInputCount: inputs.length - visible.length
|
|
12326
12460
|
};
|
|
12327
12461
|
}, [inputs, showAllInputs]);
|
|
12328
|
-
const updateNodeInternals = (0,
|
|
12462
|
+
const updateNodeInternals = (0, import_react12.useUpdateNodeInternals)();
|
|
12329
12463
|
const drawnHandles = [
|
|
12330
12464
|
...shownInputs.map((pin) => `in:${pin.name}`),
|
|
12331
12465
|
...outputs.map((pin) => sourceHandleId(pin.name))
|
|
12332
12466
|
].join("|");
|
|
12333
|
-
(0,
|
|
12467
|
+
(0, import_react13.useEffect)(() => {
|
|
12334
12468
|
updateNodeInternals(id);
|
|
12335
12469
|
}, [id, drawnHandles, updateNodeInternals]);
|
|
12336
|
-
const onDoubleClick = (0,
|
|
12470
|
+
const onDoubleClick = (0, import_react13.useCallback)(
|
|
12337
12471
|
(e) => {
|
|
12338
12472
|
if (!editable) return;
|
|
12339
12473
|
e.stopPropagation();
|
|
12340
|
-
setEditValue((0,
|
|
12474
|
+
setEditValue((0, import_proto8.instanceAddress)(bundle, id).id);
|
|
12341
12475
|
setEditing(true);
|
|
12342
12476
|
},
|
|
12343
12477
|
[id, editable, bundle]
|
|
12344
12478
|
);
|
|
12345
|
-
const commitRename = (0,
|
|
12479
|
+
const commitRename = (0, import_react13.useCallback)(async () => {
|
|
12346
12480
|
if (renamingRef.current) return;
|
|
12347
12481
|
renamingRef.current = true;
|
|
12348
12482
|
setEditing(false);
|
|
12349
|
-
|
|
12350
|
-
const address = (0, import_proto6.instanceAddress)(bundle, id);
|
|
12351
|
-
if (trimmed && trimmed !== address.id) {
|
|
12352
|
-
updateArrangement(withRenameCarried(bundle, arrangement, address.scope, address.id, trimmed));
|
|
12353
|
-
await runner.apply([
|
|
12354
|
-
{ rename_instance: { scope: address.scope, old_id: address.id, new_id: trimmed } }
|
|
12355
|
-
]);
|
|
12356
|
-
}
|
|
12483
|
+
await rename(id, editValue.trim());
|
|
12357
12484
|
renamingRef.current = false;
|
|
12358
|
-
}, [editValue, id,
|
|
12359
|
-
const onKeyDown = (0,
|
|
12485
|
+
}, [editValue, id, rename]);
|
|
12486
|
+
const onKeyDown = (0, import_react13.useCallback)(
|
|
12360
12487
|
(e) => {
|
|
12361
12488
|
e.stopPropagation();
|
|
12362
12489
|
if (e.key === "Enter") commitRename();
|
|
@@ -12364,7 +12491,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
12364
12491
|
},
|
|
12365
12492
|
[commitRename]
|
|
12366
12493
|
);
|
|
12367
|
-
const onHeaderClick = (0,
|
|
12494
|
+
const onHeaderClick = (0, import_react13.useCallback)(
|
|
12368
12495
|
(e) => {
|
|
12369
12496
|
if (!e.shiftKey && !e.metaKey && !e.ctrlKey) {
|
|
12370
12497
|
openNodeConfig(data.id);
|
|
@@ -12372,7 +12499,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
12372
12499
|
},
|
|
12373
12500
|
[data.id, openNodeConfig]
|
|
12374
12501
|
);
|
|
12375
|
-
const onDeleteInstance = (0,
|
|
12502
|
+
const onDeleteInstance = (0, import_react13.useCallback)(
|
|
12376
12503
|
async (e) => {
|
|
12377
12504
|
e.stopPropagation();
|
|
12378
12505
|
const action = ctx.contributions.actions.find((a) => a.id === "delete-node");
|
|
@@ -12381,11 +12508,11 @@ var ModuleNode = ({ id, data }) => {
|
|
|
12381
12508
|
},
|
|
12382
12509
|
[ctx, runner, envExtras, data.id]
|
|
12383
12510
|
);
|
|
12384
|
-
const toggleCollapsed = (0,
|
|
12511
|
+
const toggleCollapsed = (0, import_react13.useCallback)((e) => {
|
|
12385
12512
|
e.stopPropagation();
|
|
12386
12513
|
setCollapsed((v) => !v);
|
|
12387
12514
|
}, []);
|
|
12388
|
-
const toggleShowAllInputs = (0,
|
|
12515
|
+
const toggleShowAllInputs = (0, import_react13.useCallback)((e) => {
|
|
12389
12516
|
e.stopPropagation();
|
|
12390
12517
|
setShowAllInputs((v) => !v);
|
|
12391
12518
|
}, []);
|
|
@@ -12393,15 +12520,15 @@ var ModuleNode = ({ id, data }) => {
|
|
|
12393
12520
|
const badges = data.badges ?? [];
|
|
12394
12521
|
const hasAnyError = hasErrorBadge(badges) || !!data.hasValidationError;
|
|
12395
12522
|
const isNew = !!data.isNew && !hasAnyError;
|
|
12396
|
-
const rowCount = collapsed ? 0 : showAllInputs ? Math.max(inputs.length, outputs.length) : (0,
|
|
12397
|
-
const bodyHeight = rowCount *
|
|
12398
|
-
const nodeHeight =
|
|
12523
|
+
const rowCount = collapsed ? 0 : showAllInputs ? Math.max(inputs.length, outputs.length) : (0, import_proto8.nodeRows)({ inputs, outputs });
|
|
12524
|
+
const bodyHeight = rowCount * import_proto8.NODE_ROW_HEIGHT;
|
|
12525
|
+
const nodeHeight = import_proto8.NODE_HEADER_HEIGHT + bodyHeight;
|
|
12399
12526
|
const stateClass = hasAnyError ? "lace-module-node--error" : isNew ? "lace-module-node--new" : "";
|
|
12400
12527
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
12401
12528
|
"div",
|
|
12402
12529
|
{
|
|
12403
12530
|
className: `lace-module-node${collapsed ? " lace-module-node--collapsed" : ""}${stateClass ? ` ${stateClass}` : ""}`,
|
|
12404
|
-
style: { width:
|
|
12531
|
+
style: { width: import_proto8.NODE_WIDTH, height: nodeHeight },
|
|
12405
12532
|
onMouseEnter: () => setHovered(true),
|
|
12406
12533
|
onMouseLeave: () => setHovered(false),
|
|
12407
12534
|
children: [
|
|
@@ -12409,7 +12536,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
12409
12536
|
"div",
|
|
12410
12537
|
{
|
|
12411
12538
|
className: "lace-module-node__header",
|
|
12412
|
-
style: { height:
|
|
12539
|
+
style: { height: import_proto8.NODE_HEADER_HEIGHT },
|
|
12413
12540
|
onClick: onHeaderClick,
|
|
12414
12541
|
title: badges.length > 0 ? badges.map((b) => b.title ?? b.label).join("\n") : data.label,
|
|
12415
12542
|
children: [
|
|
@@ -12480,11 +12607,11 @@ var ModuleNode = ({ id, data }) => {
|
|
|
12480
12607
|
b.id
|
|
12481
12608
|
)) }),
|
|
12482
12609
|
data.call_wired && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
12483
|
-
|
|
12610
|
+
import_react12.Handle,
|
|
12484
12611
|
{
|
|
12485
12612
|
id: sourceHandleId(""),
|
|
12486
12613
|
type: "source",
|
|
12487
|
-
position:
|
|
12614
|
+
position: import_react12.Position.Right,
|
|
12488
12615
|
isConnectable: false,
|
|
12489
12616
|
className: "lace-pin-handle",
|
|
12490
12617
|
style: {
|
|
@@ -12494,7 +12621,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
12494
12621
|
borderStyle: "solid",
|
|
12495
12622
|
width: 8,
|
|
12496
12623
|
height: 8,
|
|
12497
|
-
top:
|
|
12624
|
+
top: import_proto8.NODE_HEADER_HEIGHT / 2,
|
|
12498
12625
|
right: -4
|
|
12499
12626
|
}
|
|
12500
12627
|
}
|
|
@@ -12505,7 +12632,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
12505
12632
|
{
|
|
12506
12633
|
pin,
|
|
12507
12634
|
side: "input",
|
|
12508
|
-
top: i *
|
|
12635
|
+
top: i * import_proto8.NODE_ROW_HEIGHT,
|
|
12509
12636
|
shared: i < outputs.length,
|
|
12510
12637
|
problem: data.pins?.[pin.name],
|
|
12511
12638
|
isConnectable: editable
|
|
@@ -12517,7 +12644,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
12517
12644
|
{
|
|
12518
12645
|
pin,
|
|
12519
12646
|
side: "output",
|
|
12520
|
-
top: i *
|
|
12647
|
+
top: i * import_proto8.NODE_ROW_HEIGHT,
|
|
12521
12648
|
shared: i < shownInputs.length,
|
|
12522
12649
|
isConnectable: editable
|
|
12523
12650
|
},
|
|
@@ -12534,10 +12661,10 @@ var ModuleNode = ({ id, data }) => {
|
|
|
12534
12661
|
role: "button",
|
|
12535
12662
|
tabIndex: 0,
|
|
12536
12663
|
style: {
|
|
12537
|
-
top: shownInputs.length *
|
|
12664
|
+
top: shownInputs.length * import_proto8.NODE_ROW_HEIGHT,
|
|
12538
12665
|
left: 12,
|
|
12539
12666
|
right: 12,
|
|
12540
|
-
height:
|
|
12667
|
+
height: import_proto8.NODE_ROW_HEIGHT
|
|
12541
12668
|
},
|
|
12542
12669
|
title: "Show all inputs",
|
|
12543
12670
|
children: [
|
|
@@ -12552,11 +12679,11 @@ var ModuleNode = ({ id, data }) => {
|
|
|
12552
12679
|
inputs.map((pin, i) => {
|
|
12553
12680
|
const color = pinColor(pin);
|
|
12554
12681
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
12555
|
-
|
|
12682
|
+
import_react12.Handle,
|
|
12556
12683
|
{
|
|
12557
12684
|
id: `in:${pin.name}`,
|
|
12558
12685
|
type: "target",
|
|
12559
|
-
position:
|
|
12686
|
+
position: import_react12.Position.Left,
|
|
12560
12687
|
isConnectable: editable,
|
|
12561
12688
|
className: "lace-pin-handle",
|
|
12562
12689
|
style: {
|
|
@@ -12566,7 +12693,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
12566
12693
|
borderStyle: "solid",
|
|
12567
12694
|
width: 8,
|
|
12568
12695
|
height: 8,
|
|
12569
|
-
top:
|
|
12696
|
+
top: import_proto8.NODE_HEADER_HEIGHT / 2 - 4 + (i - (inputs.length - 1) / 2) * 3,
|
|
12570
12697
|
left: -4
|
|
12571
12698
|
}
|
|
12572
12699
|
},
|
|
@@ -12576,11 +12703,11 @@ var ModuleNode = ({ id, data }) => {
|
|
|
12576
12703
|
outputs.map((pin, i) => {
|
|
12577
12704
|
const color = pinColor(pin);
|
|
12578
12705
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
12579
|
-
|
|
12706
|
+
import_react12.Handle,
|
|
12580
12707
|
{
|
|
12581
12708
|
id: `out:${pin.name}`,
|
|
12582
12709
|
type: "source",
|
|
12583
|
-
position:
|
|
12710
|
+
position: import_react12.Position.Right,
|
|
12584
12711
|
isConnectable: editable,
|
|
12585
12712
|
className: "lace-pin-handle",
|
|
12586
12713
|
style: {
|
|
@@ -12590,7 +12717,7 @@ var ModuleNode = ({ id, data }) => {
|
|
|
12590
12717
|
borderStyle: "solid",
|
|
12591
12718
|
width: 8,
|
|
12592
12719
|
height: 8,
|
|
12593
|
-
top:
|
|
12720
|
+
top: import_proto8.NODE_HEADER_HEIGHT / 2 - 4 + (i - (outputs.length - 1) / 2) * 3,
|
|
12594
12721
|
right: -4
|
|
12595
12722
|
}
|
|
12596
12723
|
},
|
|
@@ -12600,21 +12727,21 @@ var ModuleNode = ({ id, data }) => {
|
|
|
12600
12727
|
] }),
|
|
12601
12728
|
editable && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
12602
12729
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
12603
|
-
|
|
12730
|
+
import_react12.Handle,
|
|
12604
12731
|
{
|
|
12605
12732
|
id: NODE_HANDLE,
|
|
12606
12733
|
type: "source",
|
|
12607
|
-
position:
|
|
12734
|
+
position: import_react12.Position.Bottom,
|
|
12608
12735
|
onClick: void 0,
|
|
12609
12736
|
className: "lace-module-node__grip"
|
|
12610
12737
|
}
|
|
12611
12738
|
),
|
|
12612
12739
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
12613
|
-
|
|
12740
|
+
import_react12.Handle,
|
|
12614
12741
|
{
|
|
12615
12742
|
id: NODE_HANDLE,
|
|
12616
12743
|
type: "target",
|
|
12617
|
-
position:
|
|
12744
|
+
position: import_react12.Position.Top,
|
|
12618
12745
|
isConnectableStart: false,
|
|
12619
12746
|
isConnectableEnd: connecting,
|
|
12620
12747
|
className: "lace-module-node__drop"
|
|
@@ -12635,7 +12762,7 @@ function PaperGrid() {
|
|
|
12635
12762
|
}
|
|
12636
12763
|
|
|
12637
12764
|
// src/core/use-action-keys.ts
|
|
12638
|
-
var
|
|
12765
|
+
var import_react14 = require("react");
|
|
12639
12766
|
|
|
12640
12767
|
// src/contribution-types.ts
|
|
12641
12768
|
var KEY_SCOPES = ["surface", "app"];
|
|
@@ -12658,7 +12785,7 @@ function isFormTarget(target) {
|
|
|
12658
12785
|
return tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || target.isContentEditable;
|
|
12659
12786
|
}
|
|
12660
12787
|
function useFocusWhenNoneHeld(root, mounted) {
|
|
12661
|
-
(0,
|
|
12788
|
+
(0, import_react14.useEffect)(() => {
|
|
12662
12789
|
const element = root.current;
|
|
12663
12790
|
if (!mounted || !element) return;
|
|
12664
12791
|
const doc = element.ownerDocument;
|
|
@@ -12683,7 +12810,7 @@ function matchesKey(e, spec) {
|
|
|
12683
12810
|
return e.key.toLowerCase() === chord.key.toLowerCase();
|
|
12684
12811
|
}
|
|
12685
12812
|
function useActionKeys(actions, ctx, runner, envExtras) {
|
|
12686
|
-
(0,
|
|
12813
|
+
(0, import_react14.useEffect)(() => {
|
|
12687
12814
|
if (!ctx || !envExtras) return;
|
|
12688
12815
|
const activeCtx = ctx;
|
|
12689
12816
|
const activeEnvExtras = envExtras;
|
|
@@ -12720,10 +12847,10 @@ function useActionKeys(actions, ctx, runner, envExtras) {
|
|
|
12720
12847
|
}
|
|
12721
12848
|
|
|
12722
12849
|
// src/hooks/useContextMenu.ts
|
|
12723
|
-
var
|
|
12850
|
+
var import_react15 = require("react");
|
|
12724
12851
|
function useContextMenu() {
|
|
12725
|
-
const [contextMenu, setContextMenu] = (0,
|
|
12726
|
-
const showContextMenu = (0,
|
|
12852
|
+
const [contextMenu, setContextMenu] = (0, import_react15.useState)(null);
|
|
12853
|
+
const showContextMenu = (0, import_react15.useCallback)((request) => {
|
|
12727
12854
|
setContextMenu({
|
|
12728
12855
|
x: request.x,
|
|
12729
12856
|
y: request.y,
|
|
@@ -12731,21 +12858,21 @@ function useContextMenu() {
|
|
|
12731
12858
|
groupId: request.groupId
|
|
12732
12859
|
});
|
|
12733
12860
|
}, []);
|
|
12734
|
-
const dismissContextMenu = (0,
|
|
12861
|
+
const dismissContextMenu = (0, import_react15.useCallback)(() => {
|
|
12735
12862
|
setContextMenu(null);
|
|
12736
12863
|
}, []);
|
|
12737
12864
|
return { contextMenu, showContextMenu, dismissContextMenu };
|
|
12738
12865
|
}
|
|
12739
12866
|
|
|
12740
12867
|
// src/hooks/useGroupLogic.ts
|
|
12741
|
-
var
|
|
12868
|
+
var import_react16 = require("react");
|
|
12742
12869
|
function drawnPosition(groups, node) {
|
|
12743
12870
|
const parent = node.parentId ? groups.find((g) => g.id === node.parentId) : void 0;
|
|
12744
12871
|
if (!parent) return node.position;
|
|
12745
12872
|
return { x: parent.position.x + node.position.x, y: parent.position.y + node.position.y };
|
|
12746
12873
|
}
|
|
12747
12874
|
function useGroupLogic(nodes, edges, groups, newNodeIds, decorations) {
|
|
12748
|
-
return (0,
|
|
12875
|
+
return (0, import_react16.useMemo)(() => {
|
|
12749
12876
|
const parentOf = /* @__PURE__ */ new Map();
|
|
12750
12877
|
for (const g of groups) {
|
|
12751
12878
|
for (const id of g.node_ids) parentOf.set(id, g);
|
|
@@ -12853,29 +12980,34 @@ function renderEdgeToRfEdge(e) {
|
|
|
12853
12980
|
}
|
|
12854
12981
|
|
|
12855
12982
|
// src/hooks/useNewNodeTracking.ts
|
|
12856
|
-
var
|
|
12983
|
+
var import_react17 = require("react");
|
|
12857
12984
|
function useNewNodeTracking(view) {
|
|
12858
|
-
const [
|
|
12859
|
-
const
|
|
12860
|
-
const
|
|
12861
|
-
(0,
|
|
12985
|
+
const [addedIds, setAddedIds] = (0, import_react17.useState)(/* @__PURE__ */ new Set());
|
|
12986
|
+
const [newNodeIds, setNewNodeIds] = (0, import_react17.useState)(/* @__PURE__ */ new Set());
|
|
12987
|
+
const prevCardIdsRef = (0, import_react17.useRef)(/* @__PURE__ */ new Set());
|
|
12988
|
+
const sessionLoadedRef = (0, import_react17.useRef)(false);
|
|
12989
|
+
(0, import_react17.useEffect)(() => {
|
|
12862
12990
|
if (!view) return;
|
|
12863
|
-
const
|
|
12991
|
+
const nodeIds = new Set(view.nodes.map((n) => n.id));
|
|
12992
|
+
const cardIds = /* @__PURE__ */ new Set([...nodeIds, ...view.groups.map((g) => g.id)]);
|
|
12864
12993
|
if (!sessionLoadedRef.current) {
|
|
12865
12994
|
sessionLoadedRef.current = true;
|
|
12866
|
-
|
|
12995
|
+
prevCardIdsRef.current = cardIds;
|
|
12867
12996
|
return;
|
|
12868
12997
|
}
|
|
12869
|
-
const prev =
|
|
12870
|
-
const added =
|
|
12871
|
-
|
|
12872
|
-
const
|
|
12873
|
-
|
|
12874
|
-
|
|
12875
|
-
|
|
12876
|
-
|
|
12998
|
+
const prev = prevCardIdsRef.current;
|
|
12999
|
+
const added = [...cardIds].filter((id) => !prev.has(id));
|
|
13000
|
+
const track = (drawn) => (s) => {
|
|
13001
|
+
const arrived = added.filter((id) => drawn.has(id));
|
|
13002
|
+
const next = new Set([...s].filter((id) => drawn.has(id)));
|
|
13003
|
+
for (const id of arrived) next.add(id);
|
|
13004
|
+
return next.size !== s.size || arrived.length > 0 ? next : s;
|
|
13005
|
+
};
|
|
13006
|
+
setAddedIds(track(cardIds));
|
|
13007
|
+
setNewNodeIds(track(nodeIds));
|
|
13008
|
+
prevCardIdsRef.current = cardIds;
|
|
12877
13009
|
}, [view]);
|
|
12878
|
-
const clearNew = (0,
|
|
13010
|
+
const clearNew = (0, import_react17.useCallback)((...ids) => {
|
|
12879
13011
|
setNewNodeIds((s) => {
|
|
12880
13012
|
const next = new Set(s);
|
|
12881
13013
|
let changed = false;
|
|
@@ -12885,7 +13017,7 @@ function useNewNodeTracking(view) {
|
|
|
12885
13017
|
return changed ? next : s;
|
|
12886
13018
|
});
|
|
12887
13019
|
}, []);
|
|
12888
|
-
return { newNodeIds, clearNew };
|
|
13020
|
+
return { addedIds, newNodeIds, clearNew };
|
|
12889
13021
|
}
|
|
12890
13022
|
|
|
12891
13023
|
// src/utils/viewport.ts
|
|
@@ -12941,10 +13073,23 @@ var FIT_VIEW_OPTIONS = { padding: 0.2, duration: 300, maxZoom: 1 };
|
|
|
12941
13073
|
var REVEAL_MARGIN = 24;
|
|
12942
13074
|
var NO_ENV_EXTRAS_TARGET = {};
|
|
12943
13075
|
var isValidConnection = (c) => c.sourceHandle === NODE_HANDLE ? c.targetHandle === NODE_HANDLE && c.source !== c.target : c.targetHandle !== NODE_HANDLE;
|
|
13076
|
+
function edgeRefOf(edge) {
|
|
13077
|
+
const data = rfEdgeData(edge);
|
|
13078
|
+
if (!data) return null;
|
|
13079
|
+
return {
|
|
13080
|
+
id: edge.id,
|
|
13081
|
+
source: edge.source,
|
|
13082
|
+
target: edge.target,
|
|
13083
|
+
sourceOutput: data.source_output,
|
|
13084
|
+
targetInput: data.target_input
|
|
13085
|
+
};
|
|
13086
|
+
}
|
|
12944
13087
|
function CompositeEditor({
|
|
12945
13088
|
view,
|
|
12946
13089
|
editable,
|
|
13090
|
+
addedIds,
|
|
12947
13091
|
newNodeIds,
|
|
13092
|
+
editing,
|
|
12948
13093
|
onDragStop,
|
|
12949
13094
|
onConnect,
|
|
12950
13095
|
onEdgeClick,
|
|
@@ -12956,22 +13101,23 @@ function CompositeEditor({
|
|
|
12956
13101
|
registerGoToNode,
|
|
12957
13102
|
layout,
|
|
12958
13103
|
focusIds,
|
|
13104
|
+
selection,
|
|
12959
13105
|
paneRef,
|
|
12960
13106
|
decorations
|
|
12961
13107
|
}) {
|
|
12962
|
-
const { fitView, getNode, getNodes, getNodesBounds, getViewport, setViewport } = (0,
|
|
12963
|
-
const xyflowInitialized = (0,
|
|
13108
|
+
const { fitView, getNode, getNodes, getNodesBounds, getViewport, setViewport } = (0, import_react18.useReactFlow)();
|
|
13109
|
+
const xyflowInitialized = (0, import_react18.useNodesInitialized)();
|
|
12964
13110
|
const nodesInitialized = xyflowInitialized || view.nodes.length === 0;
|
|
12965
|
-
(0,
|
|
13111
|
+
(0, import_react19.useEffect)(() => {
|
|
12966
13112
|
registerGoToNode((nodeId) => {
|
|
12967
13113
|
if (!getNode(nodeId)) return;
|
|
12968
13114
|
const bounds = getNodesBounds([nodeId]);
|
|
12969
13115
|
layout.panIntoView(withMargin(bounds, REVEAL_MARGIN, getViewport().zoom));
|
|
12970
13116
|
});
|
|
12971
13117
|
}, [registerGoToNode, getNode, getNodesBounds, getViewport, layout]);
|
|
12972
|
-
const focusRef = (0,
|
|
13118
|
+
const focusRef = (0, import_react19.useRef)(focusIds);
|
|
12973
13119
|
focusRef.current = focusIds;
|
|
12974
|
-
(0,
|
|
13120
|
+
(0, import_react19.useEffect)(() => {
|
|
12975
13121
|
const pane = paneRef.current;
|
|
12976
13122
|
if (!pane || typeof ResizeObserver === "undefined") return;
|
|
12977
13123
|
let before = { width: pane.clientWidth, height: pane.clientHeight };
|
|
@@ -13004,7 +13150,7 @@ function CompositeEditor({
|
|
|
13004
13150
|
observer.disconnect();
|
|
13005
13151
|
};
|
|
13006
13152
|
}, [paneRef, getViewport, getNodes, getNode, getNodesBounds, fitView, setViewport]);
|
|
13007
|
-
(0,
|
|
13153
|
+
(0, import_react19.useEffect)(() => {
|
|
13008
13154
|
layout.panIntoView = (rect) => {
|
|
13009
13155
|
const pane = paneRef.current?.getBoundingClientRect();
|
|
13010
13156
|
if (!pane) return;
|
|
@@ -13021,47 +13167,68 @@ function CompositeEditor({
|
|
|
13021
13167
|
);
|
|
13022
13168
|
};
|
|
13023
13169
|
}, [layout, getViewport, setViewport, paneRef]);
|
|
13024
|
-
const firedRef = (0,
|
|
13025
|
-
(0,
|
|
13170
|
+
const firedRef = (0, import_react19.useRef)(false);
|
|
13171
|
+
(0, import_react19.useEffect)(() => {
|
|
13026
13172
|
if (firedRef.current || !nodesInitialized || view.nodes.length === 0) return;
|
|
13027
13173
|
firedRef.current = true;
|
|
13028
13174
|
requestAnimationFrame(() => fitView(FIT_VIEW_OPTIONS));
|
|
13029
13175
|
}, [nodesInitialized, view.nodes.length, fitView]);
|
|
13030
13176
|
const groupLogic = useGroupLogic(view.nodes, view.edges, view.groups, newNodeIds, decorations);
|
|
13177
|
+
const revealedRef = (0, import_react19.useRef)(addedIds);
|
|
13178
|
+
(0, import_react19.useEffect)(() => {
|
|
13179
|
+
if (editing) return;
|
|
13180
|
+
const arrived = [...addedIds].filter((id) => !revealedRef.current.has(id));
|
|
13181
|
+
revealedRef.current = addedIds;
|
|
13182
|
+
const shown = arrived.flatMap((id) => {
|
|
13183
|
+
const node = groupLogic.rfNodes.find((n) => n.id === id);
|
|
13184
|
+
const rect = node && !node.hidden ? (0, import_proto9.drawnRect)(view, id) : void 0;
|
|
13185
|
+
return rect ? [rect] : [];
|
|
13186
|
+
});
|
|
13187
|
+
if (shown.length === 0) return;
|
|
13188
|
+
layout.panIntoView(withMargin((0, import_proto9.extentOf)(shown), REVEAL_MARGIN, getViewport().zoom));
|
|
13189
|
+
}, [editing, addedIds, groupLogic.rfNodes, view, layout, getViewport]);
|
|
13031
13190
|
const rfEdgesFromView = groupLogic.rfEdges;
|
|
13032
|
-
const
|
|
13033
|
-
|
|
13034
|
-
|
|
13035
|
-
|
|
13036
|
-
|
|
13037
|
-
|
|
13191
|
+
const selectedNodeIds = (0, import_react19.useMemo)(() => new Set(selection.nodes), [selection.nodes]);
|
|
13192
|
+
const selectedEdgeId = selection.edge?.id;
|
|
13193
|
+
const [rfEdges, setRfEdges] = (0, import_react19.useState)(rfEdgesFromView);
|
|
13194
|
+
(0, import_react19.useEffect)(() => {
|
|
13195
|
+
setRfEdges((prev) => {
|
|
13196
|
+
const held = new Set(prev.filter((e) => e.selected).map((e) => e.id));
|
|
13197
|
+
return rfEdgesFromView.map(
|
|
13198
|
+
(e) => held.has(e.id) || e.id === selectedEdgeId ? { ...e, selected: true } : e
|
|
13199
|
+
);
|
|
13200
|
+
});
|
|
13201
|
+
}, [rfEdgesFromView, selectedEdgeId]);
|
|
13202
|
+
const onEdgesChange = (0, import_react19.useCallback)((changes) => {
|
|
13203
|
+
setRfEdges((prev) => (0, import_react18.applyEdgeChanges)(changes, prev));
|
|
13038
13204
|
}, []);
|
|
13039
13205
|
const rfNodesFromView = groupLogic.rfNodes;
|
|
13040
|
-
const [rfNodes, setRfNodes] = (0,
|
|
13041
|
-
(0,
|
|
13206
|
+
const [rfNodes, setRfNodes] = (0, import_react19.useState)(rfNodesFromView);
|
|
13207
|
+
(0, import_react19.useEffect)(() => {
|
|
13042
13208
|
setRfNodes((prev) => {
|
|
13043
13209
|
const current = new Map(prev.map((n) => [n.id, n]));
|
|
13044
13210
|
return rfNodesFromView.map((n) => {
|
|
13045
13211
|
const existing = current.get(n.id);
|
|
13046
|
-
|
|
13212
|
+
const selected = (existing?.selected === true || selectedNodeIds.has(n.id)) && !n.hidden;
|
|
13213
|
+
if (!existing) return selected ? { ...n, selected } : n;
|
|
13047
13214
|
return {
|
|
13048
13215
|
...n,
|
|
13049
13216
|
position: existing.dragging ? existing.position : n.position,
|
|
13050
13217
|
dragging: existing.dragging,
|
|
13051
|
-
selected
|
|
13218
|
+
selected,
|
|
13052
13219
|
measured: existing.measured
|
|
13053
13220
|
};
|
|
13054
13221
|
});
|
|
13055
13222
|
});
|
|
13056
|
-
}, [rfNodesFromView]);
|
|
13057
|
-
const onNodesChange = (0,
|
|
13058
|
-
setRfNodes((prev) => (0,
|
|
13223
|
+
}, [rfNodesFromView, selectedNodeIds]);
|
|
13224
|
+
const onNodesChange = (0, import_react19.useCallback)((changes) => {
|
|
13225
|
+
setRfNodes((prev) => (0, import_react18.applyNodeChanges)(changes, prev));
|
|
13059
13226
|
}, []);
|
|
13060
|
-
const onNodeDragStop = (0,
|
|
13227
|
+
const onNodeDragStop = (0, import_react19.useCallback)(
|
|
13061
13228
|
(_e, _draggedNode, draggedNodes) => {
|
|
13062
13229
|
const positions = {};
|
|
13063
13230
|
for (const n of draggedNodes) {
|
|
13064
|
-
positions[n.id] = (0,
|
|
13231
|
+
positions[n.id] = (0, import_proto9.localIn)(view, n.id, drawnPosition(view.groups, n));
|
|
13065
13232
|
}
|
|
13066
13233
|
if (draggedNodes.length > 0) onDragStop(positions);
|
|
13067
13234
|
},
|
|
@@ -13072,7 +13239,7 @@ function CompositeEditor({
|
|
|
13072
13239
|
animated: false
|
|
13073
13240
|
};
|
|
13074
13241
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
13075
|
-
|
|
13242
|
+
import_react18.ReactFlow,
|
|
13076
13243
|
{
|
|
13077
13244
|
onInit,
|
|
13078
13245
|
nodes: rfNodes,
|
|
@@ -13136,7 +13303,7 @@ function Canvas({ height }) {
|
|
|
13136
13303
|
layout
|
|
13137
13304
|
} = useCanvas();
|
|
13138
13305
|
const editor = ctx.ports.editor;
|
|
13139
|
-
const makeEnvExtras = (0,
|
|
13306
|
+
const makeEnvExtras = (0, import_react19.useCallback)(
|
|
13140
13307
|
() => ({
|
|
13141
13308
|
bundle,
|
|
13142
13309
|
arrangement: { get: () => arrangement, update: updateArrangement },
|
|
@@ -13144,34 +13311,42 @@ function Canvas({ height }) {
|
|
|
13144
13311
|
}),
|
|
13145
13312
|
[bundle, arrangement, updateArrangement, layout]
|
|
13146
13313
|
);
|
|
13147
|
-
const focusIds = (0,
|
|
13314
|
+
const focusIds = (0, import_react19.useMemo)(
|
|
13148
13315
|
() => selection.edge ? [selection.edge.source, selection.edge.target] : selection.nodes,
|
|
13149
13316
|
[selection]
|
|
13150
13317
|
);
|
|
13151
13318
|
const { contextMenu, showContextMenu, dismissContextMenu } = useContextMenu();
|
|
13152
|
-
const { newNodeIds } = useNewNodeTracking(view);
|
|
13153
|
-
|
|
13154
|
-
|
|
13155
|
-
|
|
13319
|
+
const { addedIds, newNodeIds, clearNew } = useNewNodeTracking(view);
|
|
13320
|
+
(0, import_react19.useEffect)(() => {
|
|
13321
|
+
clearNew(...selection.nodes);
|
|
13322
|
+
}, [selection.nodes, clearNew]);
|
|
13323
|
+
const [editing, setEditing] = (0, import_react19.useState)(() => runner.editing());
|
|
13324
|
+
(0, import_react19.useEffect)(() => {
|
|
13325
|
+
setEditing(runner.editing());
|
|
13326
|
+
return runner.onEditingChange(setEditing);
|
|
13327
|
+
}, [runner]);
|
|
13328
|
+
const paneRef = (0, import_react19.useRef)(null);
|
|
13329
|
+
const surfaceRef = (0, import_react19.useRef)(null);
|
|
13330
|
+
(0, import_react19.useEffect)(() => {
|
|
13156
13331
|
registerKeyTarget(ctx, "surface", surfaceRef.current);
|
|
13157
13332
|
return () => registerKeyTarget(ctx, "surface", null);
|
|
13158
13333
|
}, [ctx]);
|
|
13159
|
-
const onSurfacePointerDown = (0,
|
|
13334
|
+
const onSurfacePointerDown = (0, import_react19.useCallback)((e) => {
|
|
13160
13335
|
if (isFormTarget(e.target)) return;
|
|
13161
13336
|
surfaceRef.current?.focus();
|
|
13162
13337
|
}, []);
|
|
13163
|
-
const goToNodeRef = (0,
|
|
13164
|
-
const registerGoToNode = (0,
|
|
13338
|
+
const goToNodeRef = (0, import_react19.useRef)(null);
|
|
13339
|
+
const registerGoToNode = (0, import_react19.useCallback)((fn) => {
|
|
13165
13340
|
goToNodeRef.current = fn;
|
|
13166
13341
|
}, []);
|
|
13167
|
-
const onOpenNodeConfig = (0,
|
|
13342
|
+
const onOpenNodeConfig = (0, import_react19.useCallback)(
|
|
13168
13343
|
(instanceId) => {
|
|
13169
13344
|
setSelection({ nodes: [instanceId], edge: null });
|
|
13170
13345
|
goToNodeRef.current?.(instanceId);
|
|
13171
13346
|
},
|
|
13172
13347
|
[setSelection]
|
|
13173
13348
|
);
|
|
13174
|
-
const onDragStop = (0,
|
|
13349
|
+
const onDragStop = (0, import_react19.useCallback)(
|
|
13175
13350
|
(positions) => {
|
|
13176
13351
|
const pinned = Object.keys(positions).reduce(
|
|
13177
13352
|
(next, id) => withScopesPinned(bundle, view, next, id),
|
|
@@ -13181,11 +13356,11 @@ function Canvas({ height }) {
|
|
|
13181
13356
|
},
|
|
13182
13357
|
[bundle, view, arrangement, updateArrangement]
|
|
13183
13358
|
);
|
|
13184
|
-
const onConnect = (0,
|
|
13359
|
+
const onConnect = (0, import_react19.useCallback)(
|
|
13185
13360
|
async (conn) => {
|
|
13186
13361
|
if (!conn.source || !conn.target || !editor) return;
|
|
13187
|
-
const source = (0,
|
|
13188
|
-
const target = (0,
|
|
13362
|
+
const source = (0, import_proto9.instanceAddress)(bundle, conn.source);
|
|
13363
|
+
const target = (0, import_proto9.instanceAddress)(bundle, conn.target);
|
|
13189
13364
|
const ends = {
|
|
13190
13365
|
scope: target.scope,
|
|
13191
13366
|
source_scope: source.scope,
|
|
@@ -13203,29 +13378,19 @@ function Canvas({ height }) {
|
|
|
13203
13378
|
},
|
|
13204
13379
|
[editor, runner, bundle]
|
|
13205
13380
|
);
|
|
13206
|
-
const onEdgeClick = (0,
|
|
13381
|
+
const onEdgeClick = (0, import_react19.useCallback)(
|
|
13207
13382
|
(_e, edge) => {
|
|
13208
|
-
const
|
|
13209
|
-
if (
|
|
13210
|
-
setSelection({
|
|
13211
|
-
nodes: [],
|
|
13212
|
-
edge: {
|
|
13213
|
-
id: edge.id,
|
|
13214
|
-
source: edge.source,
|
|
13215
|
-
target: edge.target,
|
|
13216
|
-
sourceOutput: data.source_output,
|
|
13217
|
-
targetInput: data.target_input
|
|
13218
|
-
}
|
|
13219
|
-
});
|
|
13383
|
+
const ref = edgeRefOf(edge);
|
|
13384
|
+
if (ref) setSelection({ nodes: [], edge: ref });
|
|
13220
13385
|
},
|
|
13221
13386
|
[setSelection]
|
|
13222
13387
|
);
|
|
13223
|
-
const onEdgesDelete = (0,
|
|
13388
|
+
const onEdgesDelete = (0, import_react19.useCallback)(
|
|
13224
13389
|
async (edges) => {
|
|
13225
13390
|
for (const edge of edges) {
|
|
13226
13391
|
const data = rfEdgeData(edge);
|
|
13227
13392
|
if (!data) continue;
|
|
13228
|
-
const target = (0,
|
|
13393
|
+
const target = (0, import_proto9.instanceAddress)(bundle, edge.target);
|
|
13229
13394
|
await runner.apply([
|
|
13230
13395
|
{ disconnect: { scope: target.scope, target: target.id, input_name: data.target_input } }
|
|
13231
13396
|
]);
|
|
@@ -13233,7 +13398,7 @@ function Canvas({ height }) {
|
|
|
13233
13398
|
},
|
|
13234
13399
|
[runner, bundle]
|
|
13235
13400
|
);
|
|
13236
|
-
const onNodesDelete = (0,
|
|
13401
|
+
const onNodesDelete = (0, import_react19.useCallback)(
|
|
13237
13402
|
async (nodes) => {
|
|
13238
13403
|
const action = ctx.contributions.actions.find((a) => a.id === "delete-node");
|
|
13239
13404
|
if (!action) return;
|
|
@@ -13244,22 +13409,25 @@ function Canvas({ height }) {
|
|
|
13244
13409
|
},
|
|
13245
13410
|
[ctx, runner, makeEnvExtras]
|
|
13246
13411
|
);
|
|
13247
|
-
const onSelectionChange = (0,
|
|
13412
|
+
const onSelectionChange = (0, import_react19.useCallback)(
|
|
13248
13413
|
(params) => {
|
|
13249
|
-
const
|
|
13250
|
-
setSelection({
|
|
13414
|
+
const [wire, ...more] = params.edges;
|
|
13415
|
+
setSelection({
|
|
13416
|
+
nodes: params.nodes.map((n) => n.id),
|
|
13417
|
+
edge: wire && more.length === 0 && params.nodes.length === 0 ? edgeRefOf(wire) : null
|
|
13418
|
+
});
|
|
13251
13419
|
},
|
|
13252
|
-
[setSelection
|
|
13420
|
+
[setSelection]
|
|
13253
13421
|
);
|
|
13254
13422
|
const menuTarget = contextMenu ? contextMenu.groupId ? groupTarget(contextMenu.groupId) : { nodeId: contextMenu.nodeId ?? void 0 } : NO_ENV_EXTRAS_TARGET;
|
|
13255
|
-
const menuActions = (0,
|
|
13423
|
+
const menuActions = (0, import_react19.useMemo)(() => {
|
|
13256
13424
|
if (!contextMenu) return [];
|
|
13257
13425
|
const placement = menuTarget.nodeId === void 0 ? "pane-menu" : "node-menu";
|
|
13258
13426
|
return resolveContributions(ctx.contributions, ctx.ports, ctx, menuTarget).actions.filter(
|
|
13259
13427
|
(a) => a.placement === placement
|
|
13260
13428
|
);
|
|
13261
13429
|
}, [contextMenu, ctx, menuTarget]);
|
|
13262
|
-
const runMenuAction = (0,
|
|
13430
|
+
const runMenuAction = (0, import_react19.useCallback)(
|
|
13263
13431
|
(action) => {
|
|
13264
13432
|
void runner.run(action, ctx, menuTarget, makeEnvExtras());
|
|
13265
13433
|
},
|
|
@@ -13295,7 +13463,9 @@ function Canvas({ height }) {
|
|
|
13295
13463
|
{
|
|
13296
13464
|
view,
|
|
13297
13465
|
editable,
|
|
13466
|
+
addedIds,
|
|
13298
13467
|
newNodeIds,
|
|
13468
|
+
editing,
|
|
13299
13469
|
onDragStop,
|
|
13300
13470
|
onConnect,
|
|
13301
13471
|
onEdgeClick,
|
|
@@ -13308,6 +13478,7 @@ function Canvas({ height }) {
|
|
|
13308
13478
|
registerGoToNode,
|
|
13309
13479
|
layout,
|
|
13310
13480
|
focusIds,
|
|
13481
|
+
selection,
|
|
13311
13482
|
paneRef,
|
|
13312
13483
|
decorations
|
|
13313
13484
|
}
|
|
@@ -13320,7 +13491,7 @@ function Canvas({ height }) {
|
|
|
13320
13491
|
}
|
|
13321
13492
|
|
|
13322
13493
|
// src/components/Drawer.tsx
|
|
13323
|
-
var
|
|
13494
|
+
var import_react20 = require("react");
|
|
13324
13495
|
|
|
13325
13496
|
// src/utils/style-vars.ts
|
|
13326
13497
|
function readTokenPx(el, name) {
|
|
@@ -13341,30 +13512,30 @@ function clampWidth(width, bounds) {
|
|
|
13341
13512
|
return Math.min(bounds.max, Math.max(bounds.min, width));
|
|
13342
13513
|
}
|
|
13343
13514
|
function Drawer({ label, children }) {
|
|
13344
|
-
const ref = (0,
|
|
13345
|
-
const [bounds, setBounds] = (0,
|
|
13346
|
-
const [width, setWidth] = (0,
|
|
13347
|
-
const [measured, setMeasured] = (0,
|
|
13348
|
-
const drag = (0,
|
|
13349
|
-
(0,
|
|
13515
|
+
const ref = (0, import_react20.useRef)(null);
|
|
13516
|
+
const [bounds, setBounds] = (0, import_react20.useState)(null);
|
|
13517
|
+
const [width, setWidth] = (0, import_react20.useState)(null);
|
|
13518
|
+
const [measured, setMeasured] = (0, import_react20.useState)(0);
|
|
13519
|
+
const drag = (0, import_react20.useRef)(null);
|
|
13520
|
+
(0, import_react20.useLayoutEffect)(() => {
|
|
13350
13521
|
if (ref.current) setBounds(readDrawerBounds(ref.current));
|
|
13351
13522
|
}, []);
|
|
13352
|
-
(0,
|
|
13523
|
+
(0, import_react20.useLayoutEffect)(() => {
|
|
13353
13524
|
if (ref.current) setMeasured(Math.round(ref.current.getBoundingClientRect().width));
|
|
13354
13525
|
}, [width]);
|
|
13355
|
-
const onPointerDown = (0,
|
|
13526
|
+
const onPointerDown = (0, import_react20.useCallback)((e) => {
|
|
13356
13527
|
e.preventDefault();
|
|
13357
13528
|
e.currentTarget.setPointerCapture(e.pointerId);
|
|
13358
13529
|
drag.current = { x: e.clientX, width: ref.current?.getBoundingClientRect().width ?? 0 };
|
|
13359
13530
|
}, []);
|
|
13360
|
-
const onPointerMove = (0,
|
|
13531
|
+
const onPointerMove = (0, import_react20.useCallback)(
|
|
13361
13532
|
(e) => {
|
|
13362
13533
|
if (!drag.current) return;
|
|
13363
13534
|
setWidth(clampWidth(drag.current.width + drag.current.x - e.clientX, bounds));
|
|
13364
13535
|
},
|
|
13365
13536
|
[bounds]
|
|
13366
13537
|
);
|
|
13367
|
-
const onPointerUp = (0,
|
|
13538
|
+
const onPointerUp = (0, import_react20.useCallback)((e) => {
|
|
13368
13539
|
drag.current = null;
|
|
13369
13540
|
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
13370
13541
|
}, []);
|
|
@@ -13398,7 +13569,7 @@ function Drawer({ label, children }) {
|
|
|
13398
13569
|
}
|
|
13399
13570
|
|
|
13400
13571
|
// src/components/ErrorBoundary.tsx
|
|
13401
|
-
var
|
|
13572
|
+
var import_react21 = __toESM(require("react"));
|
|
13402
13573
|
var import_ErrorBoundary = require("./ErrorBoundary-IXSIVZFH.css");
|
|
13403
13574
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
13404
13575
|
function ErrorState({ message }) {
|
|
@@ -13416,7 +13587,7 @@ function ErrorState({ message }) {
|
|
|
13416
13587
|
)
|
|
13417
13588
|
] });
|
|
13418
13589
|
}
|
|
13419
|
-
var ErrorBoundary = class extends
|
|
13590
|
+
var ErrorBoundary = class extends import_react21.default.Component {
|
|
13420
13591
|
constructor() {
|
|
13421
13592
|
super(...arguments);
|
|
13422
13593
|
this.state = { error: null };
|
|
@@ -13502,7 +13673,7 @@ function ToolbarAction({ action, disabledReason: disabledReason2, emphasized, bu
|
|
|
13502
13673
|
}
|
|
13503
13674
|
|
|
13504
13675
|
// src/core/CommandArgsForm.tsx
|
|
13505
|
-
var
|
|
13676
|
+
var import_react22 = require("react");
|
|
13506
13677
|
|
|
13507
13678
|
// src/contracts/commands.gen.ts
|
|
13508
13679
|
var COMMANDS = {
|
|
@@ -14838,7 +15009,8 @@ var commandFailureSchema = import_zod.z.strictObject({
|
|
|
14838
15009
|
tool: import_zod.z.string().optional(),
|
|
14839
15010
|
importResiduals: import_zod.z.array(importResidualSchema).optional(),
|
|
14840
15011
|
addresses: import_zod.z.array(import_zod.z.string()).optional(),
|
|
14841
|
-
apiCode: import_zod.z.string().optional()
|
|
15012
|
+
apiCode: import_zod.z.string().optional(),
|
|
15013
|
+
requestId: import_zod.z.string().optional()
|
|
14842
15014
|
});
|
|
14843
15015
|
var moduleValidateDeviationSchema = import_zod.z.object({
|
|
14844
15016
|
notCompositional: import_zod.z.boolean(),
|
|
@@ -15277,18 +15449,16 @@ var stackScanSchema = import_zod.z.object({
|
|
|
15277
15449
|
driftCount: import_zod.z.number(),
|
|
15278
15450
|
scannedAt: import_zod.z.string(),
|
|
15279
15451
|
undeterminedReason: import_zod.z.string().nullable(),
|
|
15452
|
+
undeterminedMessage: import_zod.z.string().nullable(),
|
|
15280
15453
|
standingDriftFindings: import_zod.z.number(),
|
|
15281
15454
|
footprintDestroyed: import_zod.z.boolean(),
|
|
15282
15455
|
drift: driftSchema
|
|
15283
15456
|
}).nullable()
|
|
15284
15457
|
});
|
|
15285
|
-
var stackImportSchema =
|
|
15458
|
+
var stackImportSchema = moduleConvertResultSchema.extend({
|
|
15286
15459
|
stack: stackIdentSchema,
|
|
15287
|
-
written: import_zod.z.array(import_zod.z.string()),
|
|
15288
|
-
removed: import_zod.z.array(import_zod.z.string()),
|
|
15289
15460
|
importBlocks: import_zod.z.number(),
|
|
15290
|
-
importResiduals: import_zod.z.array(importResidualSchema)
|
|
15291
|
-
validate: moduleValidateResultSchema
|
|
15461
|
+
importResiduals: import_zod.z.array(importResidualSchema)
|
|
15292
15462
|
});
|
|
15293
15463
|
var artifactRefSchema = import_zod.z.object({ url: import_zod.z.string(), key: import_zod.z.string() });
|
|
15294
15464
|
var runPlanSchema = import_zod.z.object({
|
|
@@ -15422,7 +15592,7 @@ function flagsOf(path) {
|
|
|
15422
15592
|
return COMMANDS[path].flags;
|
|
15423
15593
|
}
|
|
15424
15594
|
function CommandArgsForm({ form }) {
|
|
15425
|
-
const [values, setValues] = (0,
|
|
15595
|
+
const [values, setValues] = (0, import_react22.useState)({});
|
|
15426
15596
|
if (!form) return null;
|
|
15427
15597
|
const flags = isCommandPath(form.path) ? flagsOf(form.path) : {};
|
|
15428
15598
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
@@ -15465,68 +15635,384 @@ function CommandArgsForm({ form }) {
|
|
|
15465
15635
|
);
|
|
15466
15636
|
}
|
|
15467
15637
|
|
|
15468
|
-
// src/core/
|
|
15469
|
-
|
|
15470
|
-
|
|
15471
|
-
|
|
15638
|
+
// src/core/report-fold.ts
|
|
15639
|
+
var REPORT_PATHS = ["module validate", "module convert", "module scan"];
|
|
15640
|
+
var FOLDS_AS = new Map([
|
|
15641
|
+
...REPORT_PATHS.map((path) => [path, path]),
|
|
15642
|
+
["stack import", "module convert"]
|
|
15643
|
+
]);
|
|
15644
|
+
var EMPTY_REPORT_FOLD = /* @__PURE__ */ new Map();
|
|
15645
|
+
function readEntry(path, exitCode, data) {
|
|
15646
|
+
if (carriesFailure(data)) {
|
|
15647
|
+
return { kind: "failure", path, exitCode, failure: parseCommandFailure(data) };
|
|
15648
|
+
}
|
|
15649
|
+
switch (path) {
|
|
15650
|
+
case "module validate":
|
|
15651
|
+
return { kind: "result", path, exitCode, document: parseBound(path, data) };
|
|
15652
|
+
case "module convert":
|
|
15653
|
+
return { kind: "result", path, exitCode, document: parseBound(path, data) };
|
|
15654
|
+
case "module scan":
|
|
15655
|
+
return { kind: "result", path, exitCode, document: parseBound(path, data) };
|
|
15472
15656
|
}
|
|
15473
|
-
if (err instanceof Error) return [err.message];
|
|
15474
|
-
return [String(err)];
|
|
15475
|
-
}
|
|
15476
|
-
function defineCommand(binding) {
|
|
15477
|
-
return {
|
|
15478
|
-
kind: "command",
|
|
15479
|
-
path: binding.path,
|
|
15480
|
-
confirms: binding.confirm !== void 0,
|
|
15481
|
-
resultKind: binding.result.kind,
|
|
15482
|
-
invalidates: binding.invalidates,
|
|
15483
|
-
partialArgs(ctx, target) {
|
|
15484
|
-
return binding.args(ctx, target);
|
|
15485
|
-
},
|
|
15486
|
-
confirmSpec(ctx, target, formArgs) {
|
|
15487
|
-
if (!binding.confirm) return void 0;
|
|
15488
|
-
const merged = completeArgs(binding.path, { ...binding.args(ctx, target), ...formArgs });
|
|
15489
|
-
if (!merged.ok) return void 0;
|
|
15490
|
-
return binding.confirm(ctx, merged.args, target);
|
|
15491
|
-
},
|
|
15492
|
-
async start(rt, ctx, target, formArgs, signal) {
|
|
15493
|
-
const merged = completeArgs(binding.path, { ...binding.args(ctx, target), ...formArgs });
|
|
15494
|
-
if (!merged.ok) return null;
|
|
15495
|
-
const commands = rt.ports.commands;
|
|
15496
|
-
if (!commands) return null;
|
|
15497
|
-
const invocation = commands.invoke(binding.path, merged.args, signal, rt.cwd);
|
|
15498
|
-
rt.begin();
|
|
15499
|
-
if (binding.invalidates === "start+settle") rt.tick();
|
|
15500
|
-
void (async () => {
|
|
15501
|
-
try {
|
|
15502
|
-
for await (const event of invocation.events) {
|
|
15503
|
-
binding.result.consume(rt, event);
|
|
15504
|
-
}
|
|
15505
|
-
if (binding.invalidates) rt.tick();
|
|
15506
|
-
} catch (err) {
|
|
15507
|
-
if (!rt.fail(err) && !(err instanceof CommandDetachedError)) {
|
|
15508
|
-
rt.ports.presenter.notify("error", ...errorNotice(err));
|
|
15509
|
-
}
|
|
15510
|
-
if (binding.invalidates) rt.tick();
|
|
15511
|
-
} finally {
|
|
15512
|
-
rt.settled?.();
|
|
15513
|
-
}
|
|
15514
|
-
})();
|
|
15515
|
-
return { cancel: () => invocation.cancel() };
|
|
15516
|
-
}
|
|
15517
|
-
};
|
|
15518
15657
|
}
|
|
15519
|
-
|
|
15520
|
-
|
|
15521
|
-
|
|
15522
|
-
|
|
15658
|
+
function foldReport(prev, result) {
|
|
15659
|
+
const path = FOLDS_AS.get(result.path);
|
|
15660
|
+
if (path === void 0) return prev;
|
|
15661
|
+
const next = new Map(prev);
|
|
15662
|
+
if (result.document === "") next.delete(path);
|
|
15663
|
+
else next.set(path, readEntry(path, result.exitCode, JSON.parse(result.document)));
|
|
15664
|
+
return next;
|
|
15523
15665
|
}
|
|
15524
|
-
|
|
15525
|
-
kind
|
|
15526
|
-
path
|
|
15527
|
-
|
|
15528
|
-
|
|
15529
|
-
|
|
15666
|
+
function treeHashOf(entry) {
|
|
15667
|
+
if (entry.kind === "failure") return void 0;
|
|
15668
|
+
switch (entry.path) {
|
|
15669
|
+
case "module validate":
|
|
15670
|
+
case "module scan":
|
|
15671
|
+
return entry.document.treeHash;
|
|
15672
|
+
case "module convert":
|
|
15673
|
+
return entry.document.validate.treeHash;
|
|
15674
|
+
}
|
|
15675
|
+
}
|
|
15676
|
+
function currentReport(fold, treeHash) {
|
|
15677
|
+
return new Map(
|
|
15678
|
+
[...fold].filter(([, entry]) => {
|
|
15679
|
+
const about = treeHashOf(entry);
|
|
15680
|
+
return about === void 0 || about === treeHash;
|
|
15681
|
+
})
|
|
15682
|
+
);
|
|
15683
|
+
}
|
|
15684
|
+
function diagnosticsOfDocument(document2) {
|
|
15685
|
+
return document2.diagnostics.map((d) => ({
|
|
15686
|
+
severity: d.severity,
|
|
15687
|
+
code: d.code,
|
|
15688
|
+
message: d.message,
|
|
15689
|
+
module_key: d.moduleKey,
|
|
15690
|
+
instance_id: d.instanceId,
|
|
15691
|
+
input_name: d.inputName,
|
|
15692
|
+
file: d.file,
|
|
15693
|
+
line: d.line,
|
|
15694
|
+
column: d.column
|
|
15695
|
+
}));
|
|
15696
|
+
}
|
|
15697
|
+
function diagnosticsOfEntry(entry) {
|
|
15698
|
+
return entry.kind === "failure" ? [{ severity: "error", message: entry.failure.message }] : diagnosticsOfDocument(entry.document);
|
|
15699
|
+
}
|
|
15700
|
+
function reportDiagnostics(fold) {
|
|
15701
|
+
return uniqueDiagnostics(
|
|
15702
|
+
REPORT_PATHS.flatMap((path) => {
|
|
15703
|
+
const entry = fold.get(path);
|
|
15704
|
+
return entry ? diagnosticsOfEntry(entry) : [];
|
|
15705
|
+
})
|
|
15706
|
+
);
|
|
15707
|
+
}
|
|
15708
|
+
|
|
15709
|
+
// src/core/results.ts
|
|
15710
|
+
var SLOT_REDUCERS = {
|
|
15711
|
+
run: reduceRun,
|
|
15712
|
+
preview: reducePreview,
|
|
15713
|
+
report: reduceReport,
|
|
15714
|
+
follow: reduceFollow
|
|
15715
|
+
};
|
|
15716
|
+
function stamp(slot, readOver) {
|
|
15717
|
+
return slot ? { ...slot, readOver } : null;
|
|
15718
|
+
}
|
|
15719
|
+
function applySlot(kind, prev, token, value, readOver) {
|
|
15720
|
+
return stamp(SLOT_REDUCERS[kind](prev, token, value), readOver);
|
|
15721
|
+
}
|
|
15722
|
+
function liveReport(report, current) {
|
|
15723
|
+
const fold = report?.sessions.get(current.session);
|
|
15724
|
+
if (!fold) return null;
|
|
15725
|
+
const live = currentReport(fold, current.treeHash);
|
|
15726
|
+
return live.size > 0 ? live : null;
|
|
15727
|
+
}
|
|
15728
|
+
function liveSlots(slots, current) {
|
|
15729
|
+
const { run, preview: preview2, report } = slots;
|
|
15730
|
+
return {
|
|
15731
|
+
...slots,
|
|
15732
|
+
run: run && (run.outcome.kind === "running" || run.readOver.stack === current.stack) ? run : null,
|
|
15733
|
+
preview: preview2 && preview2.readOver.stack === current.stack ? preview2 : null,
|
|
15734
|
+
report: liveReport(report, current)
|
|
15735
|
+
};
|
|
15736
|
+
}
|
|
15737
|
+
function withPhase(phases, name) {
|
|
15738
|
+
return [...phases.map((p) => ({ ...p, status: "done" })), { name, status: "current" }];
|
|
15739
|
+
}
|
|
15740
|
+
function closePhases(phases) {
|
|
15741
|
+
return phases.map((p) => p.status === "done" ? p : { ...p, status: "done" });
|
|
15742
|
+
}
|
|
15743
|
+
function reduceRun(prev, token, event) {
|
|
15744
|
+
const carried = prev && prev.token === token ? prev : null;
|
|
15745
|
+
const lastLog = event.type === "log" ? event.text : carried?.lastLog ?? null;
|
|
15746
|
+
const phases = event.type === "phase" ? withPhase(carried?.phases ?? [], event.name) : carried?.phases ?? [];
|
|
15747
|
+
const submitted = carried?.submitted || event.type === "phase" && event.name === "submit";
|
|
15748
|
+
if (event.type === "gate" && event.changeRequest !== null) {
|
|
15749
|
+
return {
|
|
15750
|
+
token,
|
|
15751
|
+
outcome: { kind: "awaiting-approval", changeRequest: event.changeRequest, runUrl: null },
|
|
15752
|
+
lastLog,
|
|
15753
|
+
submitted,
|
|
15754
|
+
phases: closePhases(phases)
|
|
15755
|
+
};
|
|
15756
|
+
}
|
|
15757
|
+
if (event.type === "result") {
|
|
15758
|
+
if (carried?.outcome.kind === "awaiting-approval") {
|
|
15759
|
+
return {
|
|
15760
|
+
token,
|
|
15761
|
+
outcome: { ...carried.outcome, runUrl: event.run.url ?? null },
|
|
15762
|
+
lastLog,
|
|
15763
|
+
submitted,
|
|
15764
|
+
phases
|
|
15765
|
+
};
|
|
15766
|
+
}
|
|
15767
|
+
if (event.error)
|
|
15768
|
+
return {
|
|
15769
|
+
token,
|
|
15770
|
+
outcome: { kind: "failed", message: event.error },
|
|
15771
|
+
lastLog,
|
|
15772
|
+
submitted,
|
|
15773
|
+
phases: closePhases(phases)
|
|
15774
|
+
};
|
|
15775
|
+
return {
|
|
15776
|
+
token,
|
|
15777
|
+
outcome: { kind: "succeeded" },
|
|
15778
|
+
lastLog,
|
|
15779
|
+
submitted,
|
|
15780
|
+
phases: closePhases(phases)
|
|
15781
|
+
};
|
|
15782
|
+
}
|
|
15783
|
+
return { token, outcome: { kind: "running" }, lastLog, submitted, phases };
|
|
15784
|
+
}
|
|
15785
|
+
function failureSays(error, command) {
|
|
15786
|
+
if (error instanceof CommandExitError) {
|
|
15787
|
+
return error.failure ? { message: error.failure.message, failure: error.failure } : { message: error.stderrTail };
|
|
15788
|
+
}
|
|
15789
|
+
if (error instanceof CommandUnobservedError && command.kind === "read") {
|
|
15790
|
+
return { message: `the stream ended before \`lace ${command.path}\` finished; run it again` };
|
|
15791
|
+
}
|
|
15792
|
+
return { message: error instanceof Error ? error.message : String(error) };
|
|
15793
|
+
}
|
|
15794
|
+
var RUN = { kind: "write" };
|
|
15795
|
+
function settleRun(prev, token, error) {
|
|
15796
|
+
const carried = prev && prev.token === token ? prev : null;
|
|
15797
|
+
const lastLog = carried?.lastLog ?? null;
|
|
15798
|
+
const submitted = carried?.submitted ?? false;
|
|
15799
|
+
const phases = closePhases(carried?.phases ?? []);
|
|
15800
|
+
if (error instanceof CommandDetachedError || error instanceof CommandUnobservedError)
|
|
15801
|
+
return { token, outcome: { kind: "detached", submitted }, lastLog, submitted, phases };
|
|
15802
|
+
if (error instanceof CommandExitError) {
|
|
15803
|
+
if (error.code === 130)
|
|
15804
|
+
return { token, outcome: { kind: "cancelled" }, lastLog, submitted, phases };
|
|
15805
|
+
if (error.code === 143)
|
|
15806
|
+
return { token, outcome: { kind: "detached", submitted }, lastLog, submitted, phases };
|
|
15807
|
+
if (error.code === 7)
|
|
15808
|
+
return {
|
|
15809
|
+
token,
|
|
15810
|
+
outcome: { kind: "blocked", ...failureSays(error, RUN) },
|
|
15811
|
+
lastLog,
|
|
15812
|
+
submitted,
|
|
15813
|
+
phases
|
|
15814
|
+
};
|
|
15815
|
+
}
|
|
15816
|
+
return {
|
|
15817
|
+
token,
|
|
15818
|
+
outcome: { kind: "failed", ...failureSays(error, RUN) },
|
|
15819
|
+
lastLog,
|
|
15820
|
+
submitted,
|
|
15821
|
+
phases
|
|
15822
|
+
};
|
|
15823
|
+
}
|
|
15824
|
+
function reducePreview(_prev, token, event) {
|
|
15825
|
+
return { token, data: event };
|
|
15826
|
+
}
|
|
15827
|
+
function reduceReport(prev, session, result) {
|
|
15828
|
+
const fold = foldReport(prev?.sessions.get(session) ?? EMPTY_REPORT_FOLD, result);
|
|
15829
|
+
return { sessions: new Map(prev?.sessions).set(session, fold) };
|
|
15830
|
+
}
|
|
15831
|
+
function reduceFollow(prev, token, event) {
|
|
15832
|
+
const carried = prev && prev.token === token ? prev : null;
|
|
15833
|
+
const runId = carried?.runId ?? "";
|
|
15834
|
+
const lines = carried?.lines ?? [];
|
|
15835
|
+
if (event.type === "log") return { token, runId, lines: [...lines, event.text], done: false };
|
|
15836
|
+
return { token, runId, lines, done: true };
|
|
15837
|
+
}
|
|
15838
|
+
function createResultStore() {
|
|
15839
|
+
let slots = {
|
|
15840
|
+
run: null,
|
|
15841
|
+
preview: null,
|
|
15842
|
+
report: null,
|
|
15843
|
+
follow: null,
|
|
15844
|
+
running: /* @__PURE__ */ new Map()
|
|
15845
|
+
};
|
|
15846
|
+
let tick = 0;
|
|
15847
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
15848
|
+
const notify = () => {
|
|
15849
|
+
for (const listener of listeners) listener();
|
|
15850
|
+
};
|
|
15851
|
+
const retiredTokens = /* @__PURE__ */ new WeakSet();
|
|
15852
|
+
return {
|
|
15853
|
+
getSnapshot() {
|
|
15854
|
+
return slots;
|
|
15855
|
+
},
|
|
15856
|
+
getTick() {
|
|
15857
|
+
return tick;
|
|
15858
|
+
},
|
|
15859
|
+
subscribe(listener) {
|
|
15860
|
+
listeners.add(listener);
|
|
15861
|
+
return () => listeners.delete(listener);
|
|
15862
|
+
},
|
|
15863
|
+
write(kind, token, value, readOver) {
|
|
15864
|
+
if (retiredTokens.has(token)) return;
|
|
15865
|
+
slots = { ...slots, [kind]: applySlot(kind, slots[kind], token, value, readOver) };
|
|
15866
|
+
notify();
|
|
15867
|
+
},
|
|
15868
|
+
fail(kind, token, error) {
|
|
15869
|
+
if (kind !== "run") return false;
|
|
15870
|
+
if (retiredTokens.has(token) || !slots.run) return true;
|
|
15871
|
+
slots = { ...slots, run: stamp(settleRun(slots.run, token, error), slots.run.readOver) };
|
|
15872
|
+
notify();
|
|
15873
|
+
return true;
|
|
15874
|
+
},
|
|
15875
|
+
begin(kind, token, readOver, started) {
|
|
15876
|
+
if (kind === "run") {
|
|
15877
|
+
slots = {
|
|
15878
|
+
...slots,
|
|
15879
|
+
run: {
|
|
15880
|
+
token,
|
|
15881
|
+
outcome: { kind: "running" },
|
|
15882
|
+
lastLog: null,
|
|
15883
|
+
submitted: false,
|
|
15884
|
+
phases: [],
|
|
15885
|
+
readOver
|
|
15886
|
+
}
|
|
15887
|
+
};
|
|
15888
|
+
} else if (kind === "follow") {
|
|
15889
|
+
slots = {
|
|
15890
|
+
...slots,
|
|
15891
|
+
follow: { token, runId: started.target.runId ?? "", lines: [], done: false, readOver }
|
|
15892
|
+
};
|
|
15893
|
+
} else if (kind === "notify") {
|
|
15894
|
+
const { on, path, label } = started;
|
|
15895
|
+
slots = { ...slots, running: new Map(slots.running).set(on, { token, path, label }) };
|
|
15896
|
+
} else {
|
|
15897
|
+
return;
|
|
15898
|
+
}
|
|
15899
|
+
notify();
|
|
15900
|
+
},
|
|
15901
|
+
detach(kind, token) {
|
|
15902
|
+
if (kind === "follow" && slots.follow?.token === token) {
|
|
15903
|
+
slots = { ...slots, follow: null };
|
|
15904
|
+
notify();
|
|
15905
|
+
} else if (kind === "report" && slots.report?.sessions.has(token)) {
|
|
15906
|
+
const sessions = new Map(slots.report.sessions);
|
|
15907
|
+
sessions.delete(token);
|
|
15908
|
+
slots = {
|
|
15909
|
+
...slots,
|
|
15910
|
+
report: sessions.size > 0 ? { sessions, readOver: slots.report.readOver } : null
|
|
15911
|
+
};
|
|
15912
|
+
notify();
|
|
15913
|
+
} else if (kind === "run" && slots.run?.token === token) {
|
|
15914
|
+
const settled = settleRun(slots.run, token, new CommandDetachedError());
|
|
15915
|
+
slots = { ...slots, run: stamp(settled, slots.run.readOver) };
|
|
15916
|
+
notify();
|
|
15917
|
+
} else if (kind === "notify") {
|
|
15918
|
+
const running = new Map([...slots.running].filter(([, mark]) => mark.token !== token));
|
|
15919
|
+
if (running.size !== slots.running.size) {
|
|
15920
|
+
slots = { ...slots, running };
|
|
15921
|
+
notify();
|
|
15922
|
+
}
|
|
15923
|
+
}
|
|
15924
|
+
retiredTokens.add(token);
|
|
15925
|
+
},
|
|
15926
|
+
busy(kind, on) {
|
|
15927
|
+
if (kind === "run") {
|
|
15928
|
+
return slots.run?.outcome.kind === "running" ? { kind: "run" } : void 0;
|
|
15929
|
+
}
|
|
15930
|
+
if (kind !== "notify") return void 0;
|
|
15931
|
+
const running = slots.running.get(on);
|
|
15932
|
+
return running ? { kind: "notify", running } : void 0;
|
|
15933
|
+
},
|
|
15934
|
+
bumpTick() {
|
|
15935
|
+
tick += 1;
|
|
15936
|
+
notify();
|
|
15937
|
+
}
|
|
15938
|
+
};
|
|
15939
|
+
}
|
|
15940
|
+
|
|
15941
|
+
// src/core/define-command.ts
|
|
15942
|
+
function defineCommand(binding) {
|
|
15943
|
+
return {
|
|
15944
|
+
kind: "command",
|
|
15945
|
+
path: binding.path,
|
|
15946
|
+
confirms: binding.confirm !== void 0,
|
|
15947
|
+
resultKind: binding.result.kind,
|
|
15948
|
+
invalidates: binding.invalidates,
|
|
15949
|
+
partialArgs(ctx, target) {
|
|
15950
|
+
return binding.args(ctx, target);
|
|
15951
|
+
},
|
|
15952
|
+
confirmSpec(ctx, target, formArgs) {
|
|
15953
|
+
if (!binding.confirm) return void 0;
|
|
15954
|
+
const merged = completeArgs(binding.path, { ...binding.args(ctx, target), ...formArgs });
|
|
15955
|
+
if (!merged.ok) return void 0;
|
|
15956
|
+
return binding.confirm(ctx, merged.args, target);
|
|
15957
|
+
},
|
|
15958
|
+
async start(rt, ctx, target, formArgs, signal) {
|
|
15959
|
+
const merged = completeArgs(binding.path, { ...binding.args(ctx, target), ...formArgs });
|
|
15960
|
+
if (!merged.ok) return null;
|
|
15961
|
+
const commands = rt.ports.commands;
|
|
15962
|
+
if (!commands) return null;
|
|
15963
|
+
const invocation = commands.invoke(binding.path, merged.args, signal, rt.cwd);
|
|
15964
|
+
rt.begin();
|
|
15965
|
+
if (binding.invalidates === "start+settle") rt.tick();
|
|
15966
|
+
void (async () => {
|
|
15967
|
+
let rendered = false;
|
|
15968
|
+
try {
|
|
15969
|
+
for await (const event of invocation.events) {
|
|
15970
|
+
rendered = true;
|
|
15971
|
+
binding.result.consume(rt, event);
|
|
15972
|
+
}
|
|
15973
|
+
if (binding.invalidates) rt.tick();
|
|
15974
|
+
} catch (err) {
|
|
15975
|
+
const settledByDocument = rendered && binding.result.kind === "notify" && (err instanceof CommandExitError || err instanceof CommandUnobservedError);
|
|
15976
|
+
if (!rt.fail(err) && !(err instanceof CommandDetachedError) && !settledByDocument) {
|
|
15977
|
+
const { message, failure } = failureSays(
|
|
15978
|
+
err,
|
|
15979
|
+
binding.result.kind === "preview" || binding.result.kind === "follow" ? { kind: "read", path: binding.path } : { kind: "write" }
|
|
15980
|
+
);
|
|
15981
|
+
rt.ports.presenter.notify("error", message, ...failure ? [failure] : []);
|
|
15982
|
+
}
|
|
15983
|
+
if (binding.invalidates) rt.tick();
|
|
15984
|
+
} finally {
|
|
15985
|
+
rt.settled?.();
|
|
15986
|
+
}
|
|
15987
|
+
})();
|
|
15988
|
+
return { cancel: () => invocation.cancel() };
|
|
15989
|
+
}
|
|
15990
|
+
};
|
|
15991
|
+
}
|
|
15992
|
+
|
|
15993
|
+
// src/core/actions.ts
|
|
15994
|
+
function whyNotValid(v) {
|
|
15995
|
+
if (v.failure) return v.failure.message;
|
|
15996
|
+
const errors = v.diagnostics.filter((d) => d.severity === "error");
|
|
15997
|
+
if (errors.length === 0) return void 0;
|
|
15998
|
+
return `${errors[0].message} (${errors.length} ${errors.length === 1 ? "error" : "errors"})`;
|
|
15999
|
+
}
|
|
16000
|
+
function didNotValidate(v) {
|
|
16001
|
+
const why = whyNotValid(v);
|
|
16002
|
+
return why === void 0 ? "The tree did not validate: fix it before you commit it." : `The tree did not validate: ${why}. Fix it before you commit it.`;
|
|
16003
|
+
}
|
|
16004
|
+
function beside(v) {
|
|
16005
|
+
return v.failure ? [v.failure] : [];
|
|
16006
|
+
}
|
|
16007
|
+
function slotSink(kind) {
|
|
16008
|
+
return { kind, consume: (rt, e) => rt.write(kind, rt.token, e) };
|
|
16009
|
+
}
|
|
16010
|
+
var apply = defineCommand({
|
|
16011
|
+
kind: "command",
|
|
16012
|
+
path: "stack apply",
|
|
16013
|
+
args: (ctx) => ({ stack: ctx.stack?.id }),
|
|
16014
|
+
// The run sink ticks at both start and settle, so a read keyed on the
|
|
16015
|
+
// tick (a host's run list, the describe overlay) sees the in-flight run
|
|
15530
16016
|
// as soon as it starts, not only once it ends.
|
|
15531
16017
|
invalidates: "start+settle",
|
|
15532
16018
|
result: slotSink("run")
|
|
@@ -15550,16 +16036,28 @@ function scanNotice(e) {
|
|
|
15550
16036
|
const { slug } = e.stack;
|
|
15551
16037
|
const settled = e.settled;
|
|
15552
16038
|
if (!settled) {
|
|
15553
|
-
return
|
|
16039
|
+
return [
|
|
16040
|
+
"info",
|
|
16041
|
+
e.triggered ? `Drift scan triggered for stack ${slug} (${e.stack.id}).` : `Drift scan already in progress for stack ${slug}.`
|
|
16042
|
+
];
|
|
15554
16043
|
}
|
|
15555
|
-
if (settled.
|
|
16044
|
+
if (settled.undeterminedMessage !== null) return ["warn", settled.undeterminedMessage];
|
|
15556
16045
|
if (settled.footprintDestroyed) {
|
|
15557
|
-
return
|
|
16046
|
+
return [
|
|
16047
|
+
"info",
|
|
16048
|
+
`Drift scan complete for stack ${slug}: IN_SYNC (0 drifted) \u2014 its resources were destroyed, so there was nothing to compare.`
|
|
16049
|
+
];
|
|
15558
16050
|
}
|
|
15559
16051
|
if (settled.standingDriftFindings > 0) {
|
|
15560
|
-
return
|
|
16052
|
+
return [
|
|
16053
|
+
"info",
|
|
16054
|
+
`Drift scan complete for stack ${slug}: the scan observed no drift, but ${settled.standingDriftFindings} drift finding(s) from earlier scans still stand \u2014 the stack remains DRIFTED.`
|
|
16055
|
+
];
|
|
15561
16056
|
}
|
|
15562
|
-
return
|
|
16057
|
+
return [
|
|
16058
|
+
"info",
|
|
16059
|
+
`Drift scan complete for stack ${slug}: ${settled.driftStatus} (${settled.driftCount} drifted).`
|
|
16060
|
+
];
|
|
15563
16061
|
}
|
|
15564
16062
|
var scan = defineCommand({
|
|
15565
16063
|
kind: "command",
|
|
@@ -15568,10 +16066,7 @@ var scan = defineCommand({
|
|
|
15568
16066
|
invalidates: true,
|
|
15569
16067
|
result: {
|
|
15570
16068
|
kind: "notify",
|
|
15571
|
-
consume: (rt, e) =>
|
|
15572
|
-
const notice = scanNotice(e);
|
|
15573
|
-
if (notice !== void 0) rt.ports.presenter.notify("info", notice);
|
|
15574
|
-
}
|
|
16069
|
+
consume: (rt, e) => rt.ports.presenter.notify(...scanNotice(e))
|
|
15575
16070
|
}
|
|
15576
16071
|
});
|
|
15577
16072
|
var create = defineCommand({
|
|
@@ -15596,13 +16091,12 @@ function treeChanges(e) {
|
|
|
15596
16091
|
function importNotice(e) {
|
|
15597
16092
|
const { slug } = e.stack;
|
|
15598
16093
|
const changes = treeChanges(e);
|
|
15599
|
-
const
|
|
15600
|
-
const files = changed ? `, ${changes.join(" and ")}` : "";
|
|
16094
|
+
const files = changes.length > 0 ? `, ${changes.join(" and ")}` : "";
|
|
15601
16095
|
const imported = `Imported ${e.importBlocks} resource(s) into ${slug}${files}.`;
|
|
15602
16096
|
if (e.validate.exitClass !== "ok") {
|
|
15603
|
-
return ["warn", `${imported}
|
|
16097
|
+
return ["warn", `${imported} ${didNotValidate(e.validate)}`, ...beside(e.validate)];
|
|
15604
16098
|
}
|
|
15605
|
-
const adopt = changed ? ` Review the change in git, commit it, then apply ${slug} to adopt them.` : "";
|
|
16099
|
+
const adopt = e.changed ? ` Review the change in git, commit it, then apply ${slug} to adopt them.` : "";
|
|
15606
16100
|
if (e.importResiduals.length === 0) return ["info", `${imported}${adopt}`];
|
|
15607
16101
|
return [
|
|
15608
16102
|
"warn",
|
|
@@ -15630,15 +16124,24 @@ var importPartial = defineCommand({
|
|
|
15630
16124
|
invalidates: true,
|
|
15631
16125
|
result: importResult
|
|
15632
16126
|
});
|
|
16127
|
+
function validateNotice(v) {
|
|
16128
|
+
if (v.exitClass === "ok") return ["info", `Valid for Lace \u2014 ${v.verdict}`];
|
|
16129
|
+
if (v.failure) return ["error", v.failure.message, v.failure];
|
|
16130
|
+
const why = whyNotValid(v);
|
|
16131
|
+
return ["warn", why === void 0 ? "Not valid for Lace" : `Not valid: ${why}`];
|
|
16132
|
+
}
|
|
16133
|
+
function convertNotice(e) {
|
|
16134
|
+
const converted = e.changed ? `Converted \u2014 ${e.written.length} file(s) written` : "Already lace-style \u2014 nothing to write";
|
|
16135
|
+
if (e.validate.exitClass === "ok") return ["info", converted];
|
|
16136
|
+
return ["warn", `${converted}. ${didNotValidate(e.validate)}`, ...beside(e.validate)];
|
|
16137
|
+
}
|
|
15633
16138
|
var validate = defineCommand({
|
|
15634
16139
|
kind: "command",
|
|
15635
16140
|
path: "module validate",
|
|
15636
16141
|
args: () => ({}),
|
|
15637
16142
|
result: {
|
|
15638
16143
|
kind: "notify",
|
|
15639
|
-
consume: (rt, e) =>
|
|
15640
|
-
if (e.exitClass === "ok") rt.ports.presenter.notify("info", `Valid for Lace \u2014 ${e.verdict}`);
|
|
15641
|
-
}
|
|
16144
|
+
consume: (rt, e) => rt.ports.presenter.notify(...validateNotice(e))
|
|
15642
16145
|
}
|
|
15643
16146
|
});
|
|
15644
16147
|
var convert = defineCommand({
|
|
@@ -15647,10 +16150,7 @@ var convert = defineCommand({
|
|
|
15647
16150
|
args: () => ({}),
|
|
15648
16151
|
result: {
|
|
15649
16152
|
kind: "notify",
|
|
15650
|
-
consume: (rt, e) => rt.ports.presenter.notify(
|
|
15651
|
-
"info",
|
|
15652
|
-
e.changed ? `Converted \u2014 ${e.written.length} file(s) written` : "Already lace-style \u2014 nothing to write"
|
|
15653
|
-
)
|
|
16153
|
+
consume: (rt, e) => rt.ports.presenter.notify(...convertNotice(e))
|
|
15654
16154
|
}
|
|
15655
16155
|
});
|
|
15656
16156
|
var preview = defineCommand({
|
|
@@ -15803,13 +16303,13 @@ var CORE_COMMAND_ACTIONS = [
|
|
|
15803
16303
|
];
|
|
15804
16304
|
|
|
15805
16305
|
// src/core/overlays/describe.ts
|
|
15806
|
-
var
|
|
16306
|
+
var import_proto10 = require("@lace-cloud/proto");
|
|
15807
16307
|
|
|
15808
16308
|
// src/core/define-overlay.ts
|
|
15809
|
-
var
|
|
16309
|
+
var import_react25 = require("react");
|
|
15810
16310
|
|
|
15811
16311
|
// src/core/use-command-read.ts
|
|
15812
|
-
var
|
|
16312
|
+
var import_react24 = require("react");
|
|
15813
16313
|
|
|
15814
16314
|
// src/utils/is-plain-object.ts
|
|
15815
16315
|
function isPlainObject(val) {
|
|
@@ -15817,11 +16317,11 @@ function isPlainObject(val) {
|
|
|
15817
16317
|
}
|
|
15818
16318
|
|
|
15819
16319
|
// src/core/panel-scope.tsx
|
|
15820
|
-
var
|
|
16320
|
+
var import_react23 = require("react");
|
|
15821
16321
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
15822
16322
|
var noopReportError = () => {
|
|
15823
16323
|
};
|
|
15824
|
-
var PanelScopeContext = (0,
|
|
16324
|
+
var PanelScopeContext = (0, import_react23.createContext)(null);
|
|
15825
16325
|
function PanelScope({
|
|
15826
16326
|
ctx,
|
|
15827
16327
|
target = {},
|
|
@@ -15831,14 +16331,14 @@ function PanelScope({
|
|
|
15831
16331
|
children
|
|
15832
16332
|
}) {
|
|
15833
16333
|
const reportError = onReadError ?? noopReportError;
|
|
15834
|
-
const value = (0,
|
|
16334
|
+
const value = (0, import_react23.useMemo)(
|
|
15835
16335
|
() => ({ ctx, target, paths: new Set(paths), tick, reportError }),
|
|
15836
16336
|
[ctx, target, paths, tick, reportError]
|
|
15837
16337
|
);
|
|
15838
16338
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PanelScopeContext.Provider, { value, children });
|
|
15839
16339
|
}
|
|
15840
16340
|
function usePanelScope() {
|
|
15841
|
-
const value = (0,
|
|
16341
|
+
const value = (0, import_react23.useContext)(PanelScopeContext);
|
|
15842
16342
|
if (!value) {
|
|
15843
16343
|
throw new Error(
|
|
15844
16344
|
"usePanelScope: not inside a <PanelScope> \u2014 mount panels/overlays through App, which wraps every declared-read contribution"
|
|
@@ -15872,20 +16372,20 @@ function useCommandRead(read, target) {
|
|
|
15872
16372
|
const effectiveTarget = target ?? scope.target;
|
|
15873
16373
|
const args = read.args(scope.ctx, effectiveTarget);
|
|
15874
16374
|
const key = args === null ? null : stableJson(args);
|
|
15875
|
-
const [state, setState] = (0,
|
|
15876
|
-
const prevKeyRef = (0,
|
|
16375
|
+
const [state, setState] = (0, import_react24.useState)(INITIAL);
|
|
16376
|
+
const prevKeyRef = (0, import_react24.useRef)(NOT_YET_READ);
|
|
15877
16377
|
const inputs = {
|
|
15878
16378
|
path: read.path,
|
|
15879
16379
|
args,
|
|
15880
16380
|
commands: scope.ctx.ports.commands,
|
|
15881
16381
|
reportError: scope.reportError
|
|
15882
16382
|
};
|
|
15883
|
-
const inputsRef = (0,
|
|
15884
|
-
(0,
|
|
16383
|
+
const inputsRef = (0, import_react24.useRef)(inputs);
|
|
16384
|
+
(0, import_react24.useEffect)(() => {
|
|
15885
16385
|
inputsRef.current = inputs;
|
|
15886
16386
|
});
|
|
15887
|
-
const request = (0,
|
|
15888
|
-
(0,
|
|
16387
|
+
const request = (0, import_react24.useMemo)(() => ({ key, tick: scope.tick }), [key, scope.tick]);
|
|
16388
|
+
(0, import_react24.useEffect)(() => {
|
|
15889
16389
|
const { path, args: args2, commands, reportError } = inputsRef.current;
|
|
15890
16390
|
const keyChanged = prevKeyRef.current !== request.key;
|
|
15891
16391
|
prevKeyRef.current = request.key;
|
|
@@ -15930,7 +16430,7 @@ function defineOverlay(o) {
|
|
|
15930
16430
|
useDecorations(ctx) {
|
|
15931
16431
|
const { data } = useCommandRead(o.read);
|
|
15932
16432
|
const view = ctx.view;
|
|
15933
|
-
return (0,
|
|
16433
|
+
return (0, import_react25.useMemo)(
|
|
15934
16434
|
() => data ? o.decorate(view, data) : EMPTY_DECORATIONS2,
|
|
15935
16435
|
[o.decorate, view, data]
|
|
15936
16436
|
);
|
|
@@ -15948,7 +16448,7 @@ function decorateDescribe(view, data) {
|
|
|
15948
16448
|
if (data.state) {
|
|
15949
16449
|
const countByNode = /* @__PURE__ */ new Map();
|
|
15950
16450
|
for (const resource of data.state.resources) {
|
|
15951
|
-
const nodeId = (0,
|
|
16451
|
+
const nodeId = (0, import_proto10.nodeIdForAddress)(view, resource.address);
|
|
15952
16452
|
if (nodeId === null) continue;
|
|
15953
16453
|
countByNode.set(nodeId, (countByNode.get(nodeId) ?? 0) + 1);
|
|
15954
16454
|
}
|
|
@@ -15963,7 +16463,7 @@ function decorateDescribe(view, data) {
|
|
|
15963
16463
|
if (data.drift) {
|
|
15964
16464
|
const driftedNodes = /* @__PURE__ */ new Set();
|
|
15965
16465
|
for (const resource of data.drift.driftedResources) {
|
|
15966
|
-
const nodeId = (0,
|
|
16466
|
+
const nodeId = (0, import_proto10.nodeIdForAddress)(view, resource.address);
|
|
15967
16467
|
if (nodeId === null) continue;
|
|
15968
16468
|
driftedNodes.add(nodeId);
|
|
15969
16469
|
}
|
|
@@ -16020,18 +16520,24 @@ function RowActionBanner({ ctx, panelId, severity, className, opening }) {
|
|
|
16020
16520
|
severity,
|
|
16021
16521
|
className,
|
|
16022
16522
|
message: bannerMessage(opening, actions),
|
|
16023
|
-
actions: actions.length === 0 ? void 0 : actions.map((action) =>
|
|
16024
|
-
|
|
16025
|
-
|
|
16026
|
-
|
|
16027
|
-
|
|
16028
|
-
|
|
16029
|
-
|
|
16030
|
-
|
|
16031
|
-
|
|
16032
|
-
|
|
16033
|
-
|
|
16034
|
-
|
|
16523
|
+
actions: actions.length === 0 ? void 0 : actions.map((action) => {
|
|
16524
|
+
const state = actionState(action, ctx, runner.busy(action, ctx, {}));
|
|
16525
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
16526
|
+
import_ui5.Button,
|
|
16527
|
+
{
|
|
16528
|
+
rung: true,
|
|
16529
|
+
size: "sm",
|
|
16530
|
+
variant: "secondary",
|
|
16531
|
+
className: `${className}__${action.id}`,
|
|
16532
|
+
disabled: state.disabledReason !== void 0,
|
|
16533
|
+
loading: state.busyLabel !== void 0,
|
|
16534
|
+
tooltip: state.disabledReason,
|
|
16535
|
+
onClick: () => void runner.run(action, ctx, {}, envExtras),
|
|
16536
|
+
children: action.label
|
|
16537
|
+
},
|
|
16538
|
+
action.id
|
|
16539
|
+
);
|
|
16540
|
+
})
|
|
16035
16541
|
}
|
|
16036
16542
|
);
|
|
16037
16543
|
}
|
|
@@ -16063,7 +16569,7 @@ var conflictPanel = {
|
|
|
16063
16569
|
var import_ui6 = require("@lace-cloud/ui");
|
|
16064
16570
|
|
|
16065
16571
|
// src/components/Identifier.tsx
|
|
16066
|
-
var
|
|
16572
|
+
var import_react26 = require("react");
|
|
16067
16573
|
var import_Identifier = require("./Identifier-V6MZ37EG.css");
|
|
16068
16574
|
var import_jsx_runtime19 = (
|
|
16069
16575
|
// biome-ignore lint/suspicious/noArrayIndexKey: a segment's place in the name is its identity.
|
|
@@ -16073,7 +16579,7 @@ function identifierSegments(text) {
|
|
|
16073
16579
|
return text.split(/(?<=[_.])/);
|
|
16074
16580
|
}
|
|
16075
16581
|
function Identifier({ text, className }) {
|
|
16076
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: className ? `lace-identifier ${className}` : "lace-identifier", children: identifierSegments(text).map((segment, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
16582
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: className ? `lace-identifier ${className}` : "lace-identifier", children: identifierSegments(text).map((segment, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react26.Fragment, { children: [
|
|
16077
16583
|
i > 0 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("wbr", {}) : null,
|
|
16078
16584
|
segment
|
|
16079
16585
|
] }, i)) });
|
|
@@ -16109,18 +16615,24 @@ function DiagnosticsPanel({ ctx }) {
|
|
|
16109
16615
|
}
|
|
16110
16616
|
),
|
|
16111
16617
|
d.code !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Identifier, { className: "lace-diagnostics-panel__code", text: d.code }),
|
|
16112
|
-
actions.map((action) =>
|
|
16113
|
-
|
|
16114
|
-
|
|
16115
|
-
|
|
16116
|
-
|
|
16117
|
-
|
|
16118
|
-
|
|
16119
|
-
|
|
16120
|
-
|
|
16121
|
-
|
|
16122
|
-
|
|
16123
|
-
|
|
16618
|
+
actions.map((action) => {
|
|
16619
|
+
const state = actionState(action, ctx, runner.busy(action, ctx, target));
|
|
16620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
16621
|
+
import_ui6.Button,
|
|
16622
|
+
{
|
|
16623
|
+
rung: true,
|
|
16624
|
+
size: "sm",
|
|
16625
|
+
variant: "ghost",
|
|
16626
|
+
className: "lace-diagnostics-panel__action",
|
|
16627
|
+
disabled: state.disabledReason !== void 0,
|
|
16628
|
+
loading: state.busyLabel !== void 0,
|
|
16629
|
+
tooltip: state.disabledReason,
|
|
16630
|
+
onClick: () => void runner.run(action, ctx, target, envExtras),
|
|
16631
|
+
children: action.label
|
|
16632
|
+
},
|
|
16633
|
+
action.id
|
|
16634
|
+
);
|
|
16635
|
+
})
|
|
16124
16636
|
] })
|
|
16125
16637
|
]
|
|
16126
16638
|
},
|
|
@@ -16141,11 +16653,11 @@ var diagnosticsPanel = {
|
|
|
16141
16653
|
};
|
|
16142
16654
|
|
|
16143
16655
|
// src/core/panels/edge-inspector.ts
|
|
16144
|
-
var
|
|
16145
|
-
var
|
|
16656
|
+
var import_proto12 = require("@lace-cloud/proto");
|
|
16657
|
+
var import_react27 = require("react");
|
|
16146
16658
|
|
|
16147
16659
|
// src/components/panels/EdgeInspectorPanel.tsx
|
|
16148
|
-
var
|
|
16660
|
+
var import_proto11 = require("@lace-cloud/proto");
|
|
16149
16661
|
var import_ui7 = require("@lace-cloud/ui");
|
|
16150
16662
|
var import_EdgeInspectorPanel = require("./EdgeInspectorPanel-JD6CVUAT.css");
|
|
16151
16663
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
@@ -16169,7 +16681,7 @@ function EdgeInspectorPanel({
|
|
|
16169
16681
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_ui7.Panel, { title, footer, onClose, children: [
|
|
16170
16682
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "lace-edge-panel__section-label", children: "Wiring" }),
|
|
16171
16683
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "lace-edge-panel__wiring", children: [
|
|
16172
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Identifier, { text: sourceOutput ? `${source}.outputs.${sourceOutput}` : (0,
|
|
16684
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Identifier, { text: sourceOutput ? `${source}.outputs.${sourceOutput}` : (0, import_proto11.callText)(source) }),
|
|
16173
16685
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "lace-edge-panel__wiring-arrow", children: "\u2193" }),
|
|
16174
16686
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Identifier, { text: `${target}.inputs.${targetInput}` })
|
|
16175
16687
|
] }),
|
|
@@ -16184,7 +16696,7 @@ var disconnectBinding = {
|
|
|
16184
16696
|
async run(env) {
|
|
16185
16697
|
const edge = env.ctx.selection.edge;
|
|
16186
16698
|
if (!edge) return { success: true, errors: [], created: [], ties: [] };
|
|
16187
|
-
const target = (0,
|
|
16699
|
+
const target = (0, import_proto12.instanceAddress)(env.bundle, edge.target);
|
|
16188
16700
|
return env.apply([
|
|
16189
16701
|
{ disconnect: { scope: target.scope, target: target.id, input_name: edge.targetInput } }
|
|
16190
16702
|
]);
|
|
@@ -16203,9 +16715,8 @@ function EdgeInspectorPanel2({ ctx }) {
|
|
|
16203
16715
|
const envExtras = useEditorEnvExtras();
|
|
16204
16716
|
const edge = ctx.selection.edge;
|
|
16205
16717
|
if (!edge) return null;
|
|
16206
|
-
const close = () => setSelection({ nodes: [], edge: null });
|
|
16207
16718
|
const disconnect = rowActionsFor(ctx, "edge-inspector").find((a) => a.id === "disconnect");
|
|
16208
|
-
return (0,
|
|
16719
|
+
return (0, import_react27.createElement)(EdgeInspectorPanel, {
|
|
16209
16720
|
source: edge.source,
|
|
16210
16721
|
target: edge.target,
|
|
16211
16722
|
sourceOutput: edge.sourceOutput,
|
|
@@ -16213,12 +16724,10 @@ function EdgeInspectorPanel2({ ctx }) {
|
|
|
16213
16724
|
// The delete button exists exactly when `disconnect` resolved.
|
|
16214
16725
|
...disconnect ? {
|
|
16215
16726
|
onDelete: () => {
|
|
16216
|
-
void runner.run(disconnect, ctx, {}, envExtras)
|
|
16217
|
-
if (result?.success) close();
|
|
16218
|
-
});
|
|
16727
|
+
void runner.run(disconnect, ctx, {}, envExtras);
|
|
16219
16728
|
}
|
|
16220
16729
|
} : {},
|
|
16221
|
-
onClose:
|
|
16730
|
+
onClose: () => setSelection({ nodes: [], edge: null })
|
|
16222
16731
|
});
|
|
16223
16732
|
}
|
|
16224
16733
|
var edgeInspectorPanel = {
|
|
@@ -16259,12 +16768,12 @@ var ungeneratedMarker = {
|
|
|
16259
16768
|
};
|
|
16260
16769
|
|
|
16261
16770
|
// src/core/panels/module-config.ts
|
|
16262
|
-
var
|
|
16771
|
+
var import_react38 = require("react");
|
|
16263
16772
|
|
|
16264
16773
|
// src/components/panels/ModuleConfigPanel.tsx
|
|
16265
|
-
var
|
|
16774
|
+
var import_proto14 = require("@lace-cloud/proto");
|
|
16266
16775
|
var import_ui17 = require("@lace-cloud/ui");
|
|
16267
|
-
var
|
|
16776
|
+
var import_react37 = require("react");
|
|
16268
16777
|
|
|
16269
16778
|
// src/exhaustive.ts
|
|
16270
16779
|
function assertNever(value) {
|
|
@@ -16272,15 +16781,15 @@ function assertNever(value) {
|
|
|
16272
16781
|
}
|
|
16273
16782
|
|
|
16274
16783
|
// src/hooks/useUpdateState.ts
|
|
16275
|
-
var
|
|
16784
|
+
var import_react28 = require("react");
|
|
16276
16785
|
function useUpdateState(updateFn) {
|
|
16277
|
-
const [status, setStatus] = (0,
|
|
16278
|
-
const mountedRef = (0,
|
|
16279
|
-
const resetTimerRef = (0,
|
|
16280
|
-
const safeSetStatus = (0,
|
|
16786
|
+
const [status, setStatus] = (0, import_react28.useState)("idle");
|
|
16787
|
+
const mountedRef = (0, import_react28.useRef)(true);
|
|
16788
|
+
const resetTimerRef = (0, import_react28.useRef)(null);
|
|
16789
|
+
const safeSetStatus = (0, import_react28.useCallback)((next) => {
|
|
16281
16790
|
if (mountedRef.current) setStatus(next);
|
|
16282
16791
|
}, []);
|
|
16283
|
-
const scheduleReset = (0,
|
|
16792
|
+
const scheduleReset = (0, import_react28.useCallback)(
|
|
16284
16793
|
(delay) => {
|
|
16285
16794
|
if (resetTimerRef.current !== null) clearTimeout(resetTimerRef.current);
|
|
16286
16795
|
resetTimerRef.current = setTimeout(() => {
|
|
@@ -16290,7 +16799,7 @@ function useUpdateState(updateFn) {
|
|
|
16290
16799
|
},
|
|
16291
16800
|
[safeSetStatus]
|
|
16292
16801
|
);
|
|
16293
|
-
const handleUpdate = (0,
|
|
16802
|
+
const handleUpdate = (0, import_react28.useCallback)(async () => {
|
|
16294
16803
|
safeSetStatus("updating");
|
|
16295
16804
|
try {
|
|
16296
16805
|
await updateFn();
|
|
@@ -16301,7 +16810,7 @@ function useUpdateState(updateFn) {
|
|
|
16301
16810
|
scheduleReset(2e3);
|
|
16302
16811
|
}
|
|
16303
16812
|
}, [updateFn, safeSetStatus, scheduleReset]);
|
|
16304
|
-
(0,
|
|
16813
|
+
(0, import_react28.useEffect)(() => {
|
|
16305
16814
|
return () => {
|
|
16306
16815
|
mountedRef.current = false;
|
|
16307
16816
|
if (resetTimerRef.current !== null) {
|
|
@@ -16314,11 +16823,11 @@ function useUpdateState(updateFn) {
|
|
|
16314
16823
|
}
|
|
16315
16824
|
|
|
16316
16825
|
// src/components/AccordionSection.tsx
|
|
16317
|
-
var
|
|
16826
|
+
var import_react29 = require("react");
|
|
16318
16827
|
var import_AccordionSection = require("./AccordionSection-J3ALHB5M.css");
|
|
16319
16828
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
16320
16829
|
function AccordionSection({ title, defaultOpen = false, badge, children }) {
|
|
16321
|
-
const [open, setOpen] = (0,
|
|
16830
|
+
const [open, setOpen] = (0, import_react29.useState)(defaultOpen);
|
|
16322
16831
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: `lace-accordion${open ? " lace-accordion--open" : ""}`, children: [
|
|
16323
16832
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
16324
16833
|
"button",
|
|
@@ -16374,13 +16883,13 @@ function UpdateButton({ status, label, onClick, disabled, disabledTitle }) {
|
|
|
16374
16883
|
}
|
|
16375
16884
|
|
|
16376
16885
|
// src/components/panels/ModuleDetails.tsx
|
|
16377
|
-
var
|
|
16886
|
+
var import_proto13 = require("@lace-cloud/proto");
|
|
16378
16887
|
var import_ui16 = require("@lace-cloud/ui");
|
|
16379
|
-
var
|
|
16888
|
+
var import_react36 = require("react");
|
|
16380
16889
|
|
|
16381
16890
|
// src/components/panels/BlockEditor.tsx
|
|
16382
16891
|
var import_ui10 = require("@lace-cloud/ui");
|
|
16383
|
-
var
|
|
16892
|
+
var import_react30 = require("react");
|
|
16384
16893
|
var import_panels_shared = require("./panels-shared-5JFNYXQ7.css");
|
|
16385
16894
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
16386
16895
|
function replaceAt(list, index, item) {
|
|
@@ -16434,8 +16943,8 @@ function BlockEditor({ blocks, onChange, editable, templates }) {
|
|
|
16434
16943
|
] });
|
|
16435
16944
|
}
|
|
16436
16945
|
function NewBlockRow({ onAdd }) {
|
|
16437
|
-
const [type, setType] = (0,
|
|
16438
|
-
const [label, setLabel] = (0,
|
|
16946
|
+
const [type, setType] = (0, import_react30.useState)("");
|
|
16947
|
+
const [label, setLabel] = (0, import_react30.useState)("");
|
|
16439
16948
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
16440
16949
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
16441
16950
|
import_ui10.Input,
|
|
@@ -16554,7 +17063,7 @@ function BlockCard({ block, editable, onChange, onRemove }) {
|
|
|
16554
17063
|
|
|
16555
17064
|
// src/components/panels/LocalsPanel.tsx
|
|
16556
17065
|
var import_ui11 = require("@lace-cloud/ui");
|
|
16557
|
-
var
|
|
17066
|
+
var import_react31 = require("react");
|
|
16558
17067
|
|
|
16559
17068
|
// src/utils/duplicates.ts
|
|
16560
17069
|
function findDuplicateIndices(items, keyFn) {
|
|
@@ -16583,20 +17092,20 @@ function fromRows(rows) {
|
|
|
16583
17092
|
}
|
|
16584
17093
|
function LocalsContent({ locals, onSave }) {
|
|
16585
17094
|
const { editable } = useCanvas();
|
|
16586
|
-
const [rows, setRows] = (0,
|
|
16587
|
-
const addLocal = (0,
|
|
17095
|
+
const [rows, setRows] = (0, import_react31.useState)(() => toRows(locals));
|
|
17096
|
+
const addLocal = (0, import_react31.useCallback)(() => {
|
|
16588
17097
|
setRows((prev) => [...prev, { id: crypto.randomUUID(), name: "", value: "" }]);
|
|
16589
17098
|
}, []);
|
|
16590
|
-
const removeLocal = (0,
|
|
17099
|
+
const removeLocal = (0, import_react31.useCallback)((index) => {
|
|
16591
17100
|
setRows((prev) => prev.filter((_, i) => i !== index));
|
|
16592
17101
|
}, []);
|
|
16593
|
-
const updateRow = (0,
|
|
17102
|
+
const updateRow = (0, import_react31.useCallback)((index, field, value) => {
|
|
16594
17103
|
setRows((prev) => prev.map((r, i) => i === index ? { ...r, [field]: value } : r));
|
|
16595
17104
|
}, []);
|
|
16596
17105
|
const nameDupes = findDuplicateIndices(rows, (r) => r.name);
|
|
16597
17106
|
const hasErrors = nameDupes.size > 0;
|
|
16598
17107
|
const { status: updateStatus, handleUpdate } = useUpdateState(
|
|
16599
|
-
(0,
|
|
17108
|
+
(0, import_react31.useCallback)(async () => {
|
|
16600
17109
|
if (hasErrors) return;
|
|
16601
17110
|
await onSave(fromRows(rows));
|
|
16602
17111
|
}, [onSave, rows, hasErrors])
|
|
@@ -16664,7 +17173,7 @@ function LocalsPanel({ locals, onSave, onClose }) {
|
|
|
16664
17173
|
|
|
16665
17174
|
// src/components/panels/ModuleInterfacePanel.tsx
|
|
16666
17175
|
var import_ui12 = require("@lace-cloud/ui");
|
|
16667
|
-
var
|
|
17176
|
+
var import_react32 = require("react");
|
|
16668
17177
|
var import_panels_shared3 = require("./panels-shared-5JFNYXQ7.css");
|
|
16669
17178
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
16670
17179
|
function variablesToRows(variables) {
|
|
@@ -16704,17 +17213,17 @@ function outputName(text) {
|
|
|
16704
17213
|
}
|
|
16705
17214
|
function ModuleInterfaceContent({ settings, onSave }) {
|
|
16706
17215
|
const { editable } = useCanvas();
|
|
16707
|
-
const [variables, setVariables2] = (0,
|
|
17216
|
+
const [variables, setVariables2] = (0, import_react32.useState)(
|
|
16708
17217
|
() => variablesToRows(settings.variables)
|
|
16709
17218
|
);
|
|
16710
|
-
const [outputs, setOutputs2] = (0,
|
|
16711
|
-
const updateVariable = (0,
|
|
17219
|
+
const [outputs, setOutputs2] = (0, import_react32.useState)(() => outputsToRows(settings.outputs));
|
|
17220
|
+
const updateVariable = (0, import_react32.useCallback)(
|
|
16712
17221
|
(index, field, value) => {
|
|
16713
17222
|
setVariables2((prev) => prev.map((v, i) => i === index ? { ...v, [field]: value } : v));
|
|
16714
17223
|
},
|
|
16715
17224
|
[]
|
|
16716
17225
|
);
|
|
16717
|
-
const addVariable = (0,
|
|
17226
|
+
const addVariable = (0, import_react32.useCallback)(() => {
|
|
16718
17227
|
setVariables2((prev) => [
|
|
16719
17228
|
...prev,
|
|
16720
17229
|
{
|
|
@@ -16732,7 +17241,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
16732
17241
|
}
|
|
16733
17242
|
]);
|
|
16734
17243
|
}, []);
|
|
16735
|
-
const addValidation = (0,
|
|
17244
|
+
const addValidation = (0, import_react32.useCallback)((index) => {
|
|
16736
17245
|
setVariables2(
|
|
16737
17246
|
(prev) => prev.map(
|
|
16738
17247
|
(v, i) => i === index ? {
|
|
@@ -16745,14 +17254,14 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
16745
17254
|
)
|
|
16746
17255
|
);
|
|
16747
17256
|
}, []);
|
|
16748
|
-
const removeValidation = (0,
|
|
17257
|
+
const removeValidation = (0, import_react32.useCallback)((index, vIndex) => {
|
|
16749
17258
|
setVariables2(
|
|
16750
17259
|
(prev) => prev.map(
|
|
16751
17260
|
(v, i) => i === index ? { ...v, validation: v.validation.filter((_, j) => j !== vIndex) } : v
|
|
16752
17261
|
)
|
|
16753
17262
|
);
|
|
16754
17263
|
}, []);
|
|
16755
|
-
const updateValidation = (0,
|
|
17264
|
+
const updateValidation = (0, import_react32.useCallback)(
|
|
16756
17265
|
(index, vIndex, field, value) => {
|
|
16757
17266
|
setVariables2(
|
|
16758
17267
|
(prev) => prev.map(
|
|
@@ -16767,19 +17276,19 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
16767
17276
|
},
|
|
16768
17277
|
[]
|
|
16769
17278
|
);
|
|
16770
|
-
const updateOutput = (0,
|
|
17279
|
+
const updateOutput = (0, import_react32.useCallback)(
|
|
16771
17280
|
(index, field, value) => {
|
|
16772
17281
|
setOutputs2((prev) => prev.map((o, i) => i === index ? { ...o, [field]: value } : o));
|
|
16773
17282
|
},
|
|
16774
17283
|
[]
|
|
16775
17284
|
);
|
|
16776
|
-
const addOutput = (0,
|
|
17285
|
+
const addOutput = (0, import_react32.useCallback)((name, value) => {
|
|
16777
17286
|
setOutputs2((prev) => [
|
|
16778
17287
|
...prev,
|
|
16779
17288
|
{ id: crypto.randomUUID(), name, value, description: "", sensitive: false, depends_on: [] }
|
|
16780
17289
|
]);
|
|
16781
17290
|
}, []);
|
|
16782
|
-
const toggleDependsOn = (0,
|
|
17291
|
+
const toggleDependsOn = (0, import_react32.useCallback)((index, dep) => {
|
|
16783
17292
|
setOutputs2(
|
|
16784
17293
|
(prev) => prev.map((o, i) => {
|
|
16785
17294
|
if (i !== index) return o;
|
|
@@ -16796,7 +17305,7 @@ function ModuleInterfaceContent({ settings, onSave }) {
|
|
|
16796
17305
|
const unnamedOutput = outputs.some((o) => !o.name.trim() || !o.value.trim());
|
|
16797
17306
|
const hasErrors = variableDupes.size > 0 || outputDupes.size > 0 || unnamedOutput;
|
|
16798
17307
|
const { status: updateStatus, handleUpdate } = useUpdateState(
|
|
16799
|
-
(0,
|
|
17308
|
+
(0, import_react32.useCallback)(async () => {
|
|
16800
17309
|
if (hasErrors) return;
|
|
16801
17310
|
const variableDefs = variables.filter((v) => v.name.trim()).map((v) => {
|
|
16802
17311
|
const validation = v.validation.map((b) => ({ condition: b.condition.trim(), error_message: b.error_message.trim() })).filter((b) => b.condition || b.error_message);
|
|
@@ -17203,7 +17712,7 @@ var import_panels_shared7 = require("./panels-shared-5JFNYXQ7.css");
|
|
|
17203
17712
|
|
|
17204
17713
|
// src/components/panels/ProvidersPanel.tsx
|
|
17205
17714
|
var import_ui13 = require("@lace-cloud/ui");
|
|
17206
|
-
var
|
|
17715
|
+
var import_react33 = require("react");
|
|
17207
17716
|
var import_panels_shared4 = require("./panels-shared-5JFNYXQ7.css");
|
|
17208
17717
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
17209
17718
|
function toRows2(providers) {
|
|
@@ -17233,8 +17742,8 @@ function fromRows2(rows) {
|
|
|
17233
17742
|
}
|
|
17234
17743
|
function ProvidersContent({ providers, onSave }) {
|
|
17235
17744
|
const { editable } = useCanvas();
|
|
17236
|
-
const [rows, setRows] = (0,
|
|
17237
|
-
const addProvider = (0,
|
|
17745
|
+
const [rows, setRows] = (0, import_react33.useState)(() => toRows2(providers));
|
|
17746
|
+
const addProvider = (0, import_react33.useCallback)(() => {
|
|
17238
17747
|
setRows((prev) => [
|
|
17239
17748
|
...prev,
|
|
17240
17749
|
{
|
|
@@ -17246,16 +17755,16 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
17246
17755
|
}
|
|
17247
17756
|
]);
|
|
17248
17757
|
}, []);
|
|
17249
|
-
const removeProvider = (0,
|
|
17758
|
+
const removeProvider = (0, import_react33.useCallback)((index) => {
|
|
17250
17759
|
setRows((prev) => prev.filter((_, i) => i !== index));
|
|
17251
17760
|
}, []);
|
|
17252
|
-
const updateField = (0,
|
|
17761
|
+
const updateField = (0, import_react33.useCallback)((index, field, value) => {
|
|
17253
17762
|
setRows((prev) => prev.map((r, i) => i === index ? { ...r, [field]: value } : r));
|
|
17254
17763
|
}, []);
|
|
17255
|
-
const updateBlocks = (0,
|
|
17764
|
+
const updateBlocks = (0, import_react33.useCallback)((index, blocks) => {
|
|
17256
17765
|
setRows((prev) => prev.map((r, i) => i === index ? { ...r, blocks } : r));
|
|
17257
17766
|
}, []);
|
|
17258
|
-
const addConfigEntry = (0,
|
|
17767
|
+
const addConfigEntry = (0, import_react33.useCallback)((providerIndex) => {
|
|
17259
17768
|
setRows(
|
|
17260
17769
|
(prev) => prev.map(
|
|
17261
17770
|
(r, i) => i === providerIndex ? {
|
|
@@ -17265,14 +17774,14 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
17265
17774
|
)
|
|
17266
17775
|
);
|
|
17267
17776
|
}, []);
|
|
17268
|
-
const removeConfigEntry = (0,
|
|
17777
|
+
const removeConfigEntry = (0, import_react33.useCallback)((providerIndex, entryIndex) => {
|
|
17269
17778
|
setRows(
|
|
17270
17779
|
(prev) => prev.map(
|
|
17271
17780
|
(r, i) => i === providerIndex ? { ...r, configEntries: r.configEntries.filter((_, ei) => ei !== entryIndex) } : r
|
|
17272
17781
|
)
|
|
17273
17782
|
);
|
|
17274
17783
|
}, []);
|
|
17275
|
-
const updateConfigEntry = (0,
|
|
17784
|
+
const updateConfigEntry = (0, import_react33.useCallback)(
|
|
17276
17785
|
(providerIndex, entryIndex, field, value) => {
|
|
17277
17786
|
setRows(
|
|
17278
17787
|
(prev) => prev.map(
|
|
@@ -17288,7 +17797,7 @@ function ProvidersContent({ providers, onSave }) {
|
|
|
17288
17797
|
[]
|
|
17289
17798
|
);
|
|
17290
17799
|
const { status: updateStatus, handleUpdate } = useUpdateState(
|
|
17291
|
-
(0,
|
|
17800
|
+
(0, import_react33.useCallback)(async () => {
|
|
17292
17801
|
await onSave(fromRows2(rows));
|
|
17293
17802
|
}, [onSave, rows])
|
|
17294
17803
|
);
|
|
@@ -17384,7 +17893,7 @@ function ProvidersPanel({ providers, onSave, onClose }) {
|
|
|
17384
17893
|
|
|
17385
17894
|
// src/components/panels/ResourcesPanel.tsx
|
|
17386
17895
|
var import_ui14 = require("@lace-cloud/ui");
|
|
17387
|
-
var
|
|
17896
|
+
var import_react34 = require("react");
|
|
17388
17897
|
var import_panels_shared5 = require("./panels-shared-5JFNYXQ7.css");
|
|
17389
17898
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
17390
17899
|
function ResourcesContent({
|
|
@@ -17421,10 +17930,10 @@ function NewResourceRow({
|
|
|
17421
17930
|
onAdd
|
|
17422
17931
|
}) {
|
|
17423
17932
|
const options = managed ? [MANAGED_OPTION, DATA_OPTION] : [DATA_OPTION];
|
|
17424
|
-
const [chosen, setChosen] = (0,
|
|
17933
|
+
const [chosen, setChosen] = (0, import_react34.useState)("resource");
|
|
17425
17934
|
const kind = managed ? chosen : "data";
|
|
17426
|
-
const [type, setType] = (0,
|
|
17427
|
-
const [name, setName] = (0,
|
|
17935
|
+
const [type, setType] = (0, import_react34.useState)("");
|
|
17936
|
+
const [name, setName] = (0, import_react34.useState)("");
|
|
17428
17937
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "lace-panel-row-card", children: [
|
|
17429
17938
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "lace-panel-subsection-label", children: "Add a resource" }),
|
|
17430
17939
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "lace-panel-row-actions", children: [
|
|
@@ -17475,8 +17984,8 @@ function NewResourceRow({
|
|
|
17475
17984
|
] });
|
|
17476
17985
|
}
|
|
17477
17986
|
function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemove }) {
|
|
17478
|
-
const [draft, setDraft] = (0,
|
|
17479
|
-
const set = (0,
|
|
17987
|
+
const [draft, setDraft] = (0, import_react34.useState)(resource);
|
|
17988
|
+
const set = (0, import_react34.useCallback)(
|
|
17480
17989
|
(field, value) => setDraft((prev) => ({ ...prev, [field]: value })),
|
|
17481
17990
|
[]
|
|
17482
17991
|
);
|
|
@@ -17487,7 +17996,7 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
17487
17996
|
const argumentDupes = findDuplicateIndices(draft.arguments, (a) => a.name);
|
|
17488
17997
|
const hasErrors = argumentDupes.size > 0 || draft.arguments.some((a) => !a.name.trim());
|
|
17489
17998
|
const { status, handleUpdate } = useUpdateState(
|
|
17490
|
-
(0,
|
|
17999
|
+
(0, import_react34.useCallback)(async () => {
|
|
17491
18000
|
if (hasErrors) return;
|
|
17492
18001
|
await onUpdate(resource, draft);
|
|
17493
18002
|
}, [onUpdate, resource, draft, hasErrors])
|
|
@@ -17626,13 +18135,13 @@ function ResourceCard({ resource, dependencyOptions, editable, onUpdate, onRemov
|
|
|
17626
18135
|
|
|
17627
18136
|
// src/components/panels/TerraformConfigPanel.tsx
|
|
17628
18137
|
var import_ui15 = require("@lace-cloud/ui");
|
|
17629
|
-
var
|
|
18138
|
+
var import_react35 = require("react");
|
|
17630
18139
|
var import_panels_shared6 = require("./panels-shared-5JFNYXQ7.css");
|
|
17631
18140
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
17632
18141
|
function TerraformConfigContent({ terraform, onSave }) {
|
|
17633
18142
|
const { editable } = useCanvas();
|
|
17634
|
-
const [requiredVersion, setRequiredVersion] = (0,
|
|
17635
|
-
const [providers, setProviders2] = (0,
|
|
18143
|
+
const [requiredVersion, setRequiredVersion] = (0, import_react35.useState)(terraform?.required_version ?? "");
|
|
18144
|
+
const [providers, setProviders2] = (0, import_react35.useState)(() => {
|
|
17636
18145
|
if (!terraform?.required_providers) return [];
|
|
17637
18146
|
return terraform.required_providers.map((req) => ({
|
|
17638
18147
|
id: crypto.randomUUID(),
|
|
@@ -17642,23 +18151,23 @@ function TerraformConfigContent({ terraform, onSave }) {
|
|
|
17642
18151
|
aliases: (req.configuration_aliases ?? []).join(", ")
|
|
17643
18152
|
}));
|
|
17644
18153
|
});
|
|
17645
|
-
const addProvider = (0,
|
|
18154
|
+
const addProvider = (0, import_react35.useCallback)(() => {
|
|
17646
18155
|
setProviders2((prev) => [
|
|
17647
18156
|
...prev,
|
|
17648
18157
|
{ id: crypto.randomUUID(), name: "", source: "", version: "", aliases: "" }
|
|
17649
18158
|
]);
|
|
17650
18159
|
}, []);
|
|
17651
|
-
const removeProvider = (0,
|
|
18160
|
+
const removeProvider = (0, import_react35.useCallback)((index) => {
|
|
17652
18161
|
setProviders2((prev) => prev.filter((_, i) => i !== index));
|
|
17653
18162
|
}, []);
|
|
17654
|
-
const updateProvider = (0,
|
|
18163
|
+
const updateProvider = (0, import_react35.useCallback)(
|
|
17655
18164
|
(index, field, value) => {
|
|
17656
18165
|
setProviders2((prev) => prev.map((p, i) => i === index ? { ...p, [field]: value } : p));
|
|
17657
18166
|
},
|
|
17658
18167
|
[]
|
|
17659
18168
|
);
|
|
17660
18169
|
const { status: updateStatus, handleUpdate } = useUpdateState(
|
|
17661
|
-
(0,
|
|
18170
|
+
(0, import_react35.useCallback)(async () => {
|
|
17662
18171
|
const block = {
|
|
17663
18172
|
required_version: requiredVersion.trim() || "",
|
|
17664
18173
|
required_providers: providers.filter((p) => p.name.trim()).map((p) => ({
|
|
@@ -17758,7 +18267,7 @@ function assertApplied(result) {
|
|
|
17758
18267
|
var keyOf = (value) => JSON.stringify(value);
|
|
17759
18268
|
function ModuleDetails({ moduleKey, open = [] }) {
|
|
17760
18269
|
const { bundle, runner, editable } = useCanvas();
|
|
17761
|
-
const settings = (0,
|
|
18270
|
+
const settings = (0, import_react36.useMemo)(() => (0, import_proto13.deriveSettingsConfig)(bundle, moduleKey), [bundle, moduleKey]);
|
|
17762
18271
|
if (!settings) return null;
|
|
17763
18272
|
if (settings.reference) return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ReferenceDetails, { settings });
|
|
17764
18273
|
const apply2 = async (actions) => {
|
|
@@ -17840,7 +18349,7 @@ function DirectivesContent({
|
|
|
17840
18349
|
onSave
|
|
17841
18350
|
}) {
|
|
17842
18351
|
const { editable } = useCanvas();
|
|
17843
|
-
const [blocks, setBlocks] = (0,
|
|
18352
|
+
const [blocks, setBlocks] = (0, import_react36.useState)(directives);
|
|
17844
18353
|
const { status, handleUpdate } = useUpdateState(() => onSave(blocks));
|
|
17845
18354
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
17846
18355
|
blocks.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "lace-panel-hint", children: "No moved or import blocks." }),
|
|
@@ -17913,11 +18422,11 @@ function toInputMode(mode) {
|
|
|
17913
18422
|
}
|
|
17914
18423
|
function ModuleConfigPanel({ instance_id, onClose, onModified }) {
|
|
17915
18424
|
const { editable, bundle, runner } = useCanvas();
|
|
17916
|
-
const config = (0,
|
|
17917
|
-
() => (0,
|
|
18425
|
+
const config = (0, import_react37.useMemo)(
|
|
18426
|
+
() => (0, import_proto14.deriveNodeConfig)(bundle, instance_id),
|
|
17918
18427
|
[bundle, instance_id]
|
|
17919
18428
|
);
|
|
17920
|
-
const [inputState, setInputState] = (0,
|
|
18429
|
+
const [inputState, setInputState] = (0, import_react37.useState)({
|
|
17921
18430
|
modes: {},
|
|
17922
18431
|
values: {},
|
|
17923
18432
|
variables: {},
|
|
@@ -17929,26 +18438,26 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
|
|
|
17929
18438
|
variables: localVariables,
|
|
17930
18439
|
expressions: localExpressions
|
|
17931
18440
|
} = inputState;
|
|
17932
|
-
const setLocalModes = (0,
|
|
18441
|
+
const setLocalModes = (0, import_react37.useCallback)(
|
|
17933
18442
|
(fn) => setInputState((s) => ({ ...s, modes: fn(s.modes) })),
|
|
17934
18443
|
[]
|
|
17935
18444
|
);
|
|
17936
|
-
const setLocalValues = (0,
|
|
18445
|
+
const setLocalValues = (0, import_react37.useCallback)(
|
|
17937
18446
|
(fn) => setInputState((s) => ({ ...s, values: fn(s.values) })),
|
|
17938
18447
|
[]
|
|
17939
18448
|
);
|
|
17940
|
-
const setLocalVariables = (0,
|
|
18449
|
+
const setLocalVariables = (0, import_react37.useCallback)(
|
|
17941
18450
|
(fn) => setInputState((s) => ({ ...s, variables: fn(s.variables) })),
|
|
17942
18451
|
[]
|
|
17943
18452
|
);
|
|
17944
|
-
const setLocalExpressions = (0,
|
|
18453
|
+
const setLocalExpressions = (0, import_react37.useCallback)(
|
|
17945
18454
|
(fn) => setInputState((s) => ({ ...s, expressions: fn(s.expressions) })),
|
|
17946
18455
|
[]
|
|
17947
18456
|
);
|
|
17948
|
-
const [localDependsOn, setLocalDependsOn] = (0,
|
|
17949
|
-
const [localProviders, setLocalProviders] = (0,
|
|
17950
|
-
const [localRepetition, setLocalRepetition] = (0,
|
|
17951
|
-
(0,
|
|
18457
|
+
const [localDependsOn, setLocalDependsOn] = (0, import_react37.useState)(/* @__PURE__ */ new Set());
|
|
18458
|
+
const [localProviders, setLocalProviders] = (0, import_react37.useState)([]);
|
|
18459
|
+
const [localRepetition, setLocalRepetition] = (0, import_react37.useState)({ count: "", for_each: "" });
|
|
18460
|
+
(0, import_react37.useEffect)(() => {
|
|
17952
18461
|
if (!config) return;
|
|
17953
18462
|
const modes = {};
|
|
17954
18463
|
const values = {};
|
|
@@ -17967,7 +18476,7 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
|
|
|
17967
18476
|
);
|
|
17968
18477
|
setLocalRepetition({ count: config.count, for_each: config.for_each });
|
|
17969
18478
|
}, [config]);
|
|
17970
|
-
const switchMode = (0,
|
|
18479
|
+
const switchMode = (0, import_react37.useCallback)(
|
|
17971
18480
|
(name, mode, input) => {
|
|
17972
18481
|
setLocalModes((prev) => ({ ...prev, [name]: mode }));
|
|
17973
18482
|
switch (mode) {
|
|
@@ -17995,14 +18504,14 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
|
|
|
17995
18504
|
},
|
|
17996
18505
|
[setLocalModes, setLocalValues, setLocalVariables, setLocalExpressions]
|
|
17997
18506
|
);
|
|
17998
|
-
const { requiredInputs, optionalInputs } = (0,
|
|
18507
|
+
const { requiredInputs, optionalInputs } = (0, import_react37.useMemo)(
|
|
17999
18508
|
() => ({
|
|
18000
18509
|
requiredInputs: (config?.inputs ?? []).filter((i) => i.required),
|
|
18001
18510
|
optionalInputs: (config?.inputs ?? []).filter((i) => !i.required)
|
|
18002
18511
|
}),
|
|
18003
18512
|
[config?.inputs]
|
|
18004
18513
|
);
|
|
18005
|
-
const address = (0,
|
|
18514
|
+
const address = (0, import_react37.useMemo)(() => (0, import_proto14.instanceAddress)(bundle, instance_id), [bundle, instance_id]);
|
|
18006
18515
|
const { status: updateStatus, handleUpdate } = useUpdateState(async () => {
|
|
18007
18516
|
if (!config || !editable) return;
|
|
18008
18517
|
const actions = [];
|
|
@@ -18393,412 +18902,125 @@ function ModuleConfigPanel({ instance_id, onClose, onModified }) {
|
|
|
18393
18902
|
o.description && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "lace-mcp__output-description", children: o.description }),
|
|
18394
18903
|
o.sensitive && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "lace-mcp__output-sensitive", children: "sensitive" })
|
|
18395
18904
|
] }, o.name)) }),
|
|
18396
|
-
config.module_key && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
18397
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "lace-mcp__module-heading", children: [
|
|
18398
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "lace-mcp__title-eyebrow", children: "Called module" }),
|
|
18399
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Identifier, { text: config.module_key })
|
|
18400
|
-
] }),
|
|
18401
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ModuleDetails, { moduleKey: config.module_key }, config.module_key)
|
|
18402
|
-
] })
|
|
18403
|
-
] });
|
|
18404
|
-
}
|
|
18405
|
-
|
|
18406
|
-
// src/core/panels/module-config.ts
|
|
18407
|
-
function ModuleConfigPanel2({ ctx }) {
|
|
18408
|
-
const { setSelection } = useCanvas();
|
|
18409
|
-
const instanceId = ctx.selection.nodes[0];
|
|
18410
|
-
if (!instanceId) return null;
|
|
18411
|
-
return (0, import_react37.createElement)(ModuleConfigPanel, {
|
|
18412
|
-
instance_id: instanceId,
|
|
18413
|
-
onClose: () => setSelection({ nodes: [], edge: null })
|
|
18414
|
-
});
|
|
18415
|
-
}
|
|
18416
|
-
var moduleConfigPanel = {
|
|
18417
|
-
id: "module-config",
|
|
18418
|
-
title: "Module",
|
|
18419
|
-
slot: "drawer",
|
|
18420
|
-
requiredPorts: [],
|
|
18421
|
-
requiredContext: ["selection.node"],
|
|
18422
|
-
Component: ModuleConfigPanel2
|
|
18423
|
-
};
|
|
18424
|
-
|
|
18425
|
-
// src/core/panels/SourceRefusedBanner.tsx
|
|
18426
|
-
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
18427
|
-
var LOCKED = "The canvas can't take this module's .tf, so editing, saving and generating are locked until it can; the Diagnostics tab says why.";
|
|
18428
|
-
var OUT_OF_LACE_SHAPE = "This Terraform is not in lace shape yet, so the canvas shows it read-only.";
|
|
18429
|
-
function SourceRefusedBanner({ ctx }) {
|
|
18430
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
18431
|
-
RowActionBanner,
|
|
18432
|
-
{
|
|
18433
|
-
ctx,
|
|
18434
|
-
panelId: "source-refused",
|
|
18435
|
-
severity: "error",
|
|
18436
|
-
className: "lace-source-refused-banner",
|
|
18437
|
-
opening: keySatisfied(ctx, "needsConversion") ? OUT_OF_LACE_SHAPE : LOCKED
|
|
18438
|
-
}
|
|
18439
|
-
);
|
|
18440
|
-
}
|
|
18441
|
-
var sourceRefusedPanel = {
|
|
18442
|
-
id: "source-refused",
|
|
18443
|
-
title: "Source refused",
|
|
18444
|
-
slot: "banner",
|
|
18445
|
-
requiredPorts: [],
|
|
18446
|
-
requiredContext: ["sourceRefused"],
|
|
18447
|
-
Component: SourceRefusedBanner
|
|
18448
|
-
};
|
|
18449
|
-
|
|
18450
|
-
// src/core/panels/settings.ts
|
|
18451
|
-
var import_ui19 = require("@lace-cloud/ui");
|
|
18452
|
-
var import_react38 = require("react");
|
|
18453
|
-
|
|
18454
|
-
// src/components/panels/UnifiedSettingsPanel.tsx
|
|
18455
|
-
var import_ui18 = require("@lace-cloud/ui");
|
|
18456
|
-
var import_panels_shared9 = require("./panels-shared-5JFNYXQ7.css");
|
|
18457
|
-
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
18458
|
-
function UnifiedSettingsPanel({ onClose }) {
|
|
18459
|
-
const { bundle } = useCanvas();
|
|
18460
|
-
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_ui18.Panel, { title: "Settings", flush: true, onClose, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ModuleDetails, { moduleKey: bundle.entry, open: ["Interface"] }, bundle.entry) });
|
|
18461
|
-
}
|
|
18462
|
-
|
|
18463
|
-
// src/core/panels/settings.ts
|
|
18464
|
-
function SettingsPanel(_props) {
|
|
18465
|
-
const { setSettingsOpen } = useCanvas();
|
|
18466
|
-
return (0, import_react38.createElement)(UnifiedSettingsPanel, {
|
|
18467
|
-
onClose: () => setSettingsOpen(false)
|
|
18468
|
-
});
|
|
18469
|
-
}
|
|
18470
|
-
var settingsPanel = {
|
|
18471
|
-
id: "settings",
|
|
18472
|
-
title: "Settings",
|
|
18473
|
-
slot: "drawer",
|
|
18474
|
-
requiredPorts: [],
|
|
18475
|
-
requiredContext: ["settingsOpen"],
|
|
18476
|
-
Component: SettingsPanel
|
|
18477
|
-
};
|
|
18478
|
-
function SettingsToggle({ ctx }) {
|
|
18479
|
-
const { setSettingsOpen } = useCanvas();
|
|
18480
|
-
return (0, import_react38.createElement)(import_ui19.IconButton, {
|
|
18481
|
-
icon: (0, import_react38.createElement)(CanvasIcon, { name: "settings" }),
|
|
18482
|
-
"aria-label": "Settings",
|
|
18483
|
-
size: "md",
|
|
18484
|
-
tooltipPlacement: "bottom-end",
|
|
18485
|
-
pressed: ctx.settingsOpen,
|
|
18486
|
-
onClick: () => setSettingsOpen(!ctx.settingsOpen)
|
|
18487
|
-
});
|
|
18488
|
-
}
|
|
18489
|
-
var settingsToggle = {
|
|
18490
|
-
id: "settings-toggle",
|
|
18491
|
-
title: "Settings",
|
|
18492
|
-
slot: "toolbar",
|
|
18493
|
-
requiredPorts: [],
|
|
18494
|
-
Component: SettingsToggle
|
|
18495
|
-
};
|
|
18496
|
-
|
|
18497
|
-
// src/core/contributions.ts
|
|
18498
|
-
var CORE_CONTRIBUTIONS = {
|
|
18499
|
-
overlays: [describeOverlay],
|
|
18500
|
-
panels: [
|
|
18501
|
-
conflictPanel,
|
|
18502
|
-
sourceRefusedPanel,
|
|
18503
|
-
unsavedMarker,
|
|
18504
|
-
ungeneratedMarker,
|
|
18505
|
-
diagnosticsPanel,
|
|
18506
|
-
// The drawer shows the first of these that resolves: Settings while it
|
|
18507
|
-
// is open, else the inspector of what is selected.
|
|
18508
|
-
settingsPanel,
|
|
18509
|
-
moduleConfigPanel,
|
|
18510
|
-
edgeInspectorPanel,
|
|
18511
|
-
settingsToggle
|
|
18512
|
-
],
|
|
18513
|
-
actions: [...MODULE_COMMAND_ACTIONS, ...CORE_EDITOR_ACTIONS, disconnectEdge]
|
|
18514
|
-
};
|
|
18515
|
-
|
|
18516
|
-
// src/core/report-fold.ts
|
|
18517
|
-
var REPORT_PATHS = ["module validate", "module convert", "module scan"];
|
|
18518
|
-
var REPORT_PATH_SET = new Set(REPORT_PATHS);
|
|
18519
|
-
function isReportPath(path) {
|
|
18520
|
-
return REPORT_PATH_SET.has(path);
|
|
18521
|
-
}
|
|
18522
|
-
var EMPTY_REPORT_FOLD = /* @__PURE__ */ new Map();
|
|
18523
|
-
function readEntry(path, exitCode, data) {
|
|
18524
|
-
if (carriesFailure(data)) {
|
|
18525
|
-
return { kind: "failure", path, exitCode, failure: parseCommandFailure(data) };
|
|
18526
|
-
}
|
|
18527
|
-
switch (path) {
|
|
18528
|
-
case "module validate":
|
|
18529
|
-
return { kind: "result", path, exitCode, document: parseBound(path, data) };
|
|
18530
|
-
case "module convert":
|
|
18531
|
-
return { kind: "result", path, exitCode, document: parseBound(path, data) };
|
|
18532
|
-
case "module scan":
|
|
18533
|
-
return { kind: "result", path, exitCode, document: parseBound(path, data) };
|
|
18534
|
-
}
|
|
18535
|
-
}
|
|
18536
|
-
function foldReport(prev, result) {
|
|
18537
|
-
if (!isReportPath(result.path)) return prev;
|
|
18538
|
-
const next = new Map(prev);
|
|
18539
|
-
if (result.document === "") next.delete(result.path);
|
|
18540
|
-
else next.set(result.path, readEntry(result.path, result.exitCode, JSON.parse(result.document)));
|
|
18541
|
-
return next;
|
|
18542
|
-
}
|
|
18543
|
-
function treeHashOf(entry) {
|
|
18544
|
-
if (entry.kind === "failure") return void 0;
|
|
18545
|
-
switch (entry.path) {
|
|
18546
|
-
case "module validate":
|
|
18547
|
-
case "module scan":
|
|
18548
|
-
return entry.document.treeHash;
|
|
18549
|
-
case "module convert":
|
|
18550
|
-
return entry.document.validate.treeHash;
|
|
18551
|
-
}
|
|
18552
|
-
}
|
|
18553
|
-
function currentReport(fold, treeHash) {
|
|
18554
|
-
return new Map(
|
|
18555
|
-
[...fold].filter(([, entry]) => {
|
|
18556
|
-
const about = treeHashOf(entry);
|
|
18557
|
-
return about === void 0 || about === treeHash;
|
|
18558
|
-
})
|
|
18559
|
-
);
|
|
18560
|
-
}
|
|
18561
|
-
function diagnosticsOfDocument(document2) {
|
|
18562
|
-
return document2.diagnostics.map((d) => ({
|
|
18563
|
-
severity: d.severity,
|
|
18564
|
-
code: d.code,
|
|
18565
|
-
message: d.message,
|
|
18566
|
-
module_key: d.moduleKey,
|
|
18567
|
-
instance_id: d.instanceId,
|
|
18568
|
-
input_name: d.inputName,
|
|
18569
|
-
file: d.file,
|
|
18570
|
-
line: d.line,
|
|
18571
|
-
column: d.column
|
|
18572
|
-
}));
|
|
18573
|
-
}
|
|
18574
|
-
function diagnosticsOfEntry(entry) {
|
|
18575
|
-
return entry.kind === "failure" ? [{ severity: "error", message: entry.failure.message }] : diagnosticsOfDocument(entry.document);
|
|
18576
|
-
}
|
|
18577
|
-
function reportDiagnostics(fold) {
|
|
18578
|
-
return uniqueDiagnostics(
|
|
18579
|
-
REPORT_PATHS.flatMap((path) => {
|
|
18580
|
-
const entry = fold.get(path);
|
|
18581
|
-
return entry ? diagnosticsOfEntry(entry) : [];
|
|
18582
|
-
})
|
|
18583
|
-
);
|
|
18584
|
-
}
|
|
18585
|
-
|
|
18586
|
-
// src/core/results.ts
|
|
18587
|
-
var SLOT_REDUCERS = {
|
|
18588
|
-
run: reduceRun,
|
|
18589
|
-
preview: reducePreview,
|
|
18590
|
-
report: reduceReport,
|
|
18591
|
-
follow: reduceFollow
|
|
18592
|
-
};
|
|
18593
|
-
function stamp(slot, readOver) {
|
|
18594
|
-
return slot ? { ...slot, readOver } : null;
|
|
18595
|
-
}
|
|
18596
|
-
function applySlot(kind, prev, token, value, readOver) {
|
|
18597
|
-
return stamp(SLOT_REDUCERS[kind](prev, token, value), readOver);
|
|
18598
|
-
}
|
|
18599
|
-
function liveReport(report, current) {
|
|
18600
|
-
const fold = report?.sessions.get(current.session);
|
|
18601
|
-
if (!fold) return null;
|
|
18602
|
-
const live = currentReport(fold, current.treeHash);
|
|
18603
|
-
return live.size > 0 ? live : null;
|
|
18604
|
-
}
|
|
18605
|
-
function liveSlots(slots, current) {
|
|
18606
|
-
const { run, preview: preview2, report } = slots;
|
|
18607
|
-
return {
|
|
18608
|
-
...slots,
|
|
18609
|
-
run: run && (run.outcome.kind === "running" || run.readOver.stack === current.stack) ? run : null,
|
|
18610
|
-
preview: preview2 && preview2.readOver.stack === current.stack ? preview2 : null,
|
|
18611
|
-
report: liveReport(report, current)
|
|
18612
|
-
};
|
|
18613
|
-
}
|
|
18614
|
-
function withPhase(phases, name) {
|
|
18615
|
-
return [...phases.map((p) => ({ ...p, status: "done" })), { name, status: "current" }];
|
|
18616
|
-
}
|
|
18617
|
-
function closePhases(phases) {
|
|
18618
|
-
return phases.map((p) => p.status === "done" ? p : { ...p, status: "done" });
|
|
18619
|
-
}
|
|
18620
|
-
function reduceRun(prev, token, event) {
|
|
18621
|
-
const carried = prev && prev.token === token ? prev : null;
|
|
18622
|
-
const lastLog = event.type === "log" ? event.text : carried?.lastLog ?? null;
|
|
18623
|
-
const phases = event.type === "phase" ? withPhase(carried?.phases ?? [], event.name) : carried?.phases ?? [];
|
|
18624
|
-
const submitted = carried?.submitted || event.type === "phase" && event.name === "submit";
|
|
18625
|
-
if (event.type === "gate" && event.changeRequest !== null) {
|
|
18626
|
-
return {
|
|
18627
|
-
token,
|
|
18628
|
-
outcome: { kind: "awaiting-approval", changeRequest: event.changeRequest, runUrl: null },
|
|
18629
|
-
lastLog,
|
|
18630
|
-
submitted,
|
|
18631
|
-
phases: closePhases(phases)
|
|
18632
|
-
};
|
|
18633
|
-
}
|
|
18634
|
-
if (event.type === "result") {
|
|
18635
|
-
if (carried?.outcome.kind === "awaiting-approval") {
|
|
18636
|
-
return {
|
|
18637
|
-
token,
|
|
18638
|
-
outcome: { ...carried.outcome, runUrl: event.run.url ?? null },
|
|
18639
|
-
lastLog,
|
|
18640
|
-
submitted,
|
|
18641
|
-
phases
|
|
18642
|
-
};
|
|
18643
|
-
}
|
|
18644
|
-
if (event.error)
|
|
18645
|
-
return {
|
|
18646
|
-
token,
|
|
18647
|
-
outcome: { kind: "failed", message: event.error },
|
|
18648
|
-
lastLog,
|
|
18649
|
-
submitted,
|
|
18650
|
-
phases: closePhases(phases)
|
|
18651
|
-
};
|
|
18652
|
-
return {
|
|
18653
|
-
token,
|
|
18654
|
-
outcome: { kind: "succeeded" },
|
|
18655
|
-
lastLog,
|
|
18656
|
-
submitted,
|
|
18657
|
-
phases: closePhases(phases)
|
|
18658
|
-
};
|
|
18659
|
-
}
|
|
18660
|
-
return { token, outcome: { kind: "running" }, lastLog, submitted, phases };
|
|
18661
|
-
}
|
|
18662
|
-
function exitSays(error) {
|
|
18663
|
-
return error.failure ? { message: error.stderrTail, failure: error.failure } : { message: error.stderrTail };
|
|
18905
|
+
config.module_key && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
18906
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "lace-mcp__module-heading", children: [
|
|
18907
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "lace-mcp__title-eyebrow", children: "Called module" }),
|
|
18908
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Identifier, { text: config.module_key })
|
|
18909
|
+
] }),
|
|
18910
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ModuleDetails, { moduleKey: config.module_key }, config.module_key)
|
|
18911
|
+
] })
|
|
18912
|
+
] });
|
|
18664
18913
|
}
|
|
18665
|
-
|
|
18666
|
-
|
|
18667
|
-
|
|
18668
|
-
const
|
|
18669
|
-
const
|
|
18670
|
-
if (
|
|
18671
|
-
|
|
18672
|
-
|
|
18673
|
-
|
|
18674
|
-
|
|
18675
|
-
if (error.code === 143)
|
|
18676
|
-
return { token, outcome: { kind: "detached", submitted }, lastLog, submitted, phases };
|
|
18677
|
-
if (error.code === 7)
|
|
18678
|
-
return {
|
|
18679
|
-
token,
|
|
18680
|
-
outcome: { kind: "blocked", ...exitSays(error) },
|
|
18681
|
-
lastLog,
|
|
18682
|
-
submitted,
|
|
18683
|
-
phases
|
|
18684
|
-
};
|
|
18685
|
-
return {
|
|
18686
|
-
token,
|
|
18687
|
-
outcome: { kind: "failed", ...exitSays(error) },
|
|
18688
|
-
lastLog,
|
|
18689
|
-
submitted,
|
|
18690
|
-
phases
|
|
18691
|
-
};
|
|
18692
|
-
}
|
|
18693
|
-
return {
|
|
18694
|
-
token,
|
|
18695
|
-
outcome: { kind: "failed", message: error instanceof Error ? error.message : String(error) },
|
|
18696
|
-
lastLog,
|
|
18697
|
-
submitted,
|
|
18698
|
-
phases
|
|
18699
|
-
};
|
|
18914
|
+
|
|
18915
|
+
// src/core/panels/module-config.ts
|
|
18916
|
+
function ModuleConfigPanel2({ ctx }) {
|
|
18917
|
+
const { setSelection } = useCanvas();
|
|
18918
|
+
const instanceId = ctx.selection.nodes[0];
|
|
18919
|
+
if (!instanceId) return null;
|
|
18920
|
+
return (0, import_react38.createElement)(ModuleConfigPanel, {
|
|
18921
|
+
instance_id: instanceId,
|
|
18922
|
+
onClose: () => setSelection({ nodes: [], edge: null })
|
|
18923
|
+
});
|
|
18700
18924
|
}
|
|
18701
|
-
|
|
18702
|
-
|
|
18925
|
+
var moduleConfigPanel = {
|
|
18926
|
+
id: "module-config",
|
|
18927
|
+
title: "Module",
|
|
18928
|
+
slot: "drawer",
|
|
18929
|
+
requiredPorts: [],
|
|
18930
|
+
requiredContext: ["selection.node"],
|
|
18931
|
+
Component: ModuleConfigPanel2
|
|
18932
|
+
};
|
|
18933
|
+
|
|
18934
|
+
// src/core/panels/SourceRefusedBanner.tsx
|
|
18935
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
18936
|
+
var LOCKED = "The canvas can't take this module's .tf, so editing, saving and generating are locked until it can; the Diagnostics tab says why.";
|
|
18937
|
+
var OUT_OF_LACE_SHAPE = "This Terraform is not in lace shape yet, so the canvas shows it read-only.";
|
|
18938
|
+
function SourceRefusedBanner({ ctx }) {
|
|
18939
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
18940
|
+
RowActionBanner,
|
|
18941
|
+
{
|
|
18942
|
+
ctx,
|
|
18943
|
+
panelId: "source-refused",
|
|
18944
|
+
severity: "error",
|
|
18945
|
+
className: "lace-source-refused-banner",
|
|
18946
|
+
opening: keySatisfied(ctx, "needsConversion") ? OUT_OF_LACE_SHAPE : LOCKED
|
|
18947
|
+
}
|
|
18948
|
+
);
|
|
18703
18949
|
}
|
|
18704
|
-
|
|
18705
|
-
|
|
18706
|
-
|
|
18950
|
+
var sourceRefusedPanel = {
|
|
18951
|
+
id: "source-refused",
|
|
18952
|
+
title: "Source refused",
|
|
18953
|
+
slot: "banner",
|
|
18954
|
+
requiredPorts: [],
|
|
18955
|
+
requiredContext: ["sourceRefused"],
|
|
18956
|
+
Component: SourceRefusedBanner
|
|
18957
|
+
};
|
|
18958
|
+
|
|
18959
|
+
// src/core/panels/settings.ts
|
|
18960
|
+
var import_ui19 = require("@lace-cloud/ui");
|
|
18961
|
+
var import_react39 = require("react");
|
|
18962
|
+
|
|
18963
|
+
// src/components/panels/UnifiedSettingsPanel.tsx
|
|
18964
|
+
var import_ui18 = require("@lace-cloud/ui");
|
|
18965
|
+
var import_panels_shared9 = require("./panels-shared-5JFNYXQ7.css");
|
|
18966
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
18967
|
+
function UnifiedSettingsPanel({ onClose }) {
|
|
18968
|
+
const { bundle } = useCanvas();
|
|
18969
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_ui18.Panel, { title: "Settings", flush: true, onClose, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ModuleDetails, { moduleKey: bundle.entry, open: ["Interface"] }, bundle.entry) });
|
|
18707
18970
|
}
|
|
18708
|
-
|
|
18709
|
-
|
|
18710
|
-
|
|
18711
|
-
const
|
|
18712
|
-
|
|
18713
|
-
|
|
18971
|
+
|
|
18972
|
+
// src/core/panels/settings.ts
|
|
18973
|
+
function SettingsPanel(_props) {
|
|
18974
|
+
const { setSettingsOpen } = useCanvas();
|
|
18975
|
+
return (0, import_react39.createElement)(UnifiedSettingsPanel, {
|
|
18976
|
+
onClose: () => setSettingsOpen(false)
|
|
18977
|
+
});
|
|
18714
18978
|
}
|
|
18715
|
-
|
|
18716
|
-
|
|
18717
|
-
|
|
18718
|
-
|
|
18719
|
-
|
|
18720
|
-
|
|
18721
|
-
|
|
18722
|
-
|
|
18723
|
-
|
|
18724
|
-
const
|
|
18725
|
-
|
|
18726
|
-
|
|
18727
|
-
|
|
18728
|
-
|
|
18729
|
-
|
|
18730
|
-
|
|
18731
|
-
|
|
18732
|
-
|
|
18733
|
-
return tick;
|
|
18734
|
-
},
|
|
18735
|
-
subscribe(listener) {
|
|
18736
|
-
listeners.add(listener);
|
|
18737
|
-
return () => listeners.delete(listener);
|
|
18738
|
-
},
|
|
18739
|
-
write(kind, token, value, readOver) {
|
|
18740
|
-
if (retiredTokens.has(token)) return;
|
|
18741
|
-
slots = { ...slots, [kind]: applySlot(kind, slots[kind], token, value, readOver) };
|
|
18742
|
-
notify();
|
|
18743
|
-
},
|
|
18744
|
-
fail(kind, token, error) {
|
|
18745
|
-
if (kind !== "run") return false;
|
|
18746
|
-
if (retiredTokens.has(token) || !slots.run) return true;
|
|
18747
|
-
slots = { ...slots, run: stamp(settleRun(slots.run, token, error), slots.run.readOver) };
|
|
18748
|
-
notify();
|
|
18749
|
-
return true;
|
|
18750
|
-
},
|
|
18751
|
-
begin(kind, token, readOver, target) {
|
|
18752
|
-
if (kind === "run") {
|
|
18753
|
-
slots = {
|
|
18754
|
-
...slots,
|
|
18755
|
-
run: {
|
|
18756
|
-
token,
|
|
18757
|
-
outcome: { kind: "running" },
|
|
18758
|
-
lastLog: null,
|
|
18759
|
-
submitted: false,
|
|
18760
|
-
phases: [],
|
|
18761
|
-
readOver
|
|
18762
|
-
}
|
|
18763
|
-
};
|
|
18764
|
-
} else if (kind === "follow") {
|
|
18765
|
-
slots = {
|
|
18766
|
-
...slots,
|
|
18767
|
-
follow: { token, runId: target.runId ?? "", lines: [], done: false, readOver }
|
|
18768
|
-
};
|
|
18769
|
-
} else {
|
|
18770
|
-
return;
|
|
18771
|
-
}
|
|
18772
|
-
notify();
|
|
18773
|
-
},
|
|
18774
|
-
detach(kind, token) {
|
|
18775
|
-
if (kind === "follow" && slots.follow?.token === token) {
|
|
18776
|
-
slots = { ...slots, follow: null };
|
|
18777
|
-
notify();
|
|
18778
|
-
} else if (kind === "report" && slots.report?.sessions.has(token)) {
|
|
18779
|
-
const sessions = new Map(slots.report.sessions);
|
|
18780
|
-
sessions.delete(token);
|
|
18781
|
-
slots = {
|
|
18782
|
-
...slots,
|
|
18783
|
-
report: sessions.size > 0 ? { sessions, readOver: slots.report.readOver } : null
|
|
18784
|
-
};
|
|
18785
|
-
notify();
|
|
18786
|
-
} else if (kind === "run" && slots.run?.token === token) {
|
|
18787
|
-
const settled = settleRun(slots.run, token, new CommandDetachedError());
|
|
18788
|
-
slots = { ...slots, run: stamp(settled, slots.run.readOver) };
|
|
18789
|
-
notify();
|
|
18790
|
-
}
|
|
18791
|
-
retiredTokens.add(token);
|
|
18792
|
-
},
|
|
18793
|
-
isBusy(kind) {
|
|
18794
|
-
return kind === "run" && slots.run?.outcome.kind === "running";
|
|
18795
|
-
},
|
|
18796
|
-
bumpTick() {
|
|
18797
|
-
tick += 1;
|
|
18798
|
-
notify();
|
|
18799
|
-
}
|
|
18800
|
-
};
|
|
18979
|
+
var settingsPanel = {
|
|
18980
|
+
id: "settings",
|
|
18981
|
+
title: "Settings",
|
|
18982
|
+
slot: "drawer",
|
|
18983
|
+
requiredPorts: [],
|
|
18984
|
+
requiredContext: ["settingsOpen"],
|
|
18985
|
+
Component: SettingsPanel
|
|
18986
|
+
};
|
|
18987
|
+
function SettingsToggle({ ctx }) {
|
|
18988
|
+
const { setSettingsOpen } = useCanvas();
|
|
18989
|
+
return (0, import_react39.createElement)(import_ui19.IconButton, {
|
|
18990
|
+
icon: (0, import_react39.createElement)(CanvasIcon, { name: "settings" }),
|
|
18991
|
+
"aria-label": "Settings",
|
|
18992
|
+
size: "md",
|
|
18993
|
+
tooltipPlacement: "bottom-end",
|
|
18994
|
+
pressed: ctx.settingsOpen,
|
|
18995
|
+
onClick: () => setSettingsOpen(!ctx.settingsOpen)
|
|
18996
|
+
});
|
|
18801
18997
|
}
|
|
18998
|
+
var settingsToggle = {
|
|
18999
|
+
id: "settings-toggle",
|
|
19000
|
+
title: "Settings",
|
|
19001
|
+
slot: "toolbar",
|
|
19002
|
+
requiredPorts: [],
|
|
19003
|
+
Component: SettingsToggle
|
|
19004
|
+
};
|
|
19005
|
+
|
|
19006
|
+
// src/core/contributions.ts
|
|
19007
|
+
var CORE_CONTRIBUTIONS = {
|
|
19008
|
+
overlays: [describeOverlay],
|
|
19009
|
+
panels: [
|
|
19010
|
+
conflictPanel,
|
|
19011
|
+
sourceRefusedPanel,
|
|
19012
|
+
unsavedMarker,
|
|
19013
|
+
ungeneratedMarker,
|
|
19014
|
+
diagnosticsPanel,
|
|
19015
|
+
// The drawer shows the first of these that resolves: Settings while it
|
|
19016
|
+
// is open, else the inspector of what is selected.
|
|
19017
|
+
settingsPanel,
|
|
19018
|
+
moduleConfigPanel,
|
|
19019
|
+
edgeInspectorPanel,
|
|
19020
|
+
settingsToggle
|
|
19021
|
+
],
|
|
19022
|
+
actions: [...MODULE_COMMAND_ACTIONS, ...CORE_EDITOR_ACTIONS, disconnectEdge]
|
|
19023
|
+
};
|
|
18802
19024
|
|
|
18803
19025
|
// src/core/run-binding.ts
|
|
18804
19026
|
function createClipboardStore() {
|
|
@@ -18823,7 +19045,19 @@ function createActionRunner(ports, store, options = {}) {
|
|
|
18823
19045
|
const handles = /* @__PURE__ */ new Map();
|
|
18824
19046
|
const tokens = /* @__PURE__ */ new Map();
|
|
18825
19047
|
const clipboard = createClipboardStore();
|
|
18826
|
-
const notifyControllers = /* @__PURE__ */ new
|
|
19048
|
+
const notifyControllers = /* @__PURE__ */ new Map();
|
|
19049
|
+
let edits = 0;
|
|
19050
|
+
const editingListeners = /* @__PURE__ */ new Set();
|
|
19051
|
+
async function asEdit(edit) {
|
|
19052
|
+
edits += 1;
|
|
19053
|
+
if (edits === 1) for (const listener of editingListeners) listener(true);
|
|
19054
|
+
try {
|
|
19055
|
+
return await edit();
|
|
19056
|
+
} finally {
|
|
19057
|
+
edits -= 1;
|
|
19058
|
+
if (edits === 0) for (const listener of editingListeners) listener(false);
|
|
19059
|
+
}
|
|
19060
|
+
}
|
|
18827
19061
|
async function applyWith(editor, actions) {
|
|
18828
19062
|
let result;
|
|
18829
19063
|
try {
|
|
@@ -18863,13 +19097,14 @@ function createActionRunner(ports, store, options = {}) {
|
|
|
18863
19097
|
async function applyActions(actions) {
|
|
18864
19098
|
const editor = ports.editor;
|
|
18865
19099
|
if (!editor) return;
|
|
18866
|
-
return applyWith(editor, actions);
|
|
19100
|
+
return asEdit(() => applyWith(editor, actions));
|
|
18867
19101
|
}
|
|
18868
19102
|
function askConfirm(spec) {
|
|
18869
19103
|
const confirm = ports.presenter.confirm;
|
|
18870
19104
|
return confirm ? confirm(spec) : Promise.resolve(false);
|
|
18871
19105
|
}
|
|
18872
|
-
function runtimeFor(token, readOver, cwd,
|
|
19106
|
+
function runtimeFor(token, readOver, cwd, command, onSettle) {
|
|
19107
|
+
const run = command?.run;
|
|
18873
19108
|
return {
|
|
18874
19109
|
ports,
|
|
18875
19110
|
token,
|
|
@@ -18880,7 +19115,7 @@ function createActionRunner(ports, store, options = {}) {
|
|
|
18880
19115
|
if (run && line !== void 0) options.onRunLog?.(line, run);
|
|
18881
19116
|
},
|
|
18882
19117
|
begin: () => {
|
|
18883
|
-
if (
|
|
19118
|
+
if (command) store.begin(command.run.resultKind, token, readOver, command.started);
|
|
18884
19119
|
},
|
|
18885
19120
|
fail: (error) => run ? store.fail(run.resultKind, token, error) : false,
|
|
18886
19121
|
detach: (kind, tok) => store.detach(kind, tok),
|
|
@@ -18891,6 +19126,15 @@ function createActionRunner(ports, store, options = {}) {
|
|
|
18891
19126
|
function readOverOf(ctx) {
|
|
18892
19127
|
return { stack: ctx.stack?.id };
|
|
18893
19128
|
}
|
|
19129
|
+
function busyOn(resultKind, action, ctx, target) {
|
|
19130
|
+
const on = runsOn(action, ctx, target);
|
|
19131
|
+
return { on, busy: store.busy(resultKind, on) };
|
|
19132
|
+
}
|
|
19133
|
+
function busyOf(action, ctx, target) {
|
|
19134
|
+
const binding = action.binding;
|
|
19135
|
+
if (binding.kind !== "command") return void 0;
|
|
19136
|
+
return busyOn(binding.resultKind, action, ctx, target).busy;
|
|
19137
|
+
}
|
|
18894
19138
|
function cwdOf(action, ctx) {
|
|
18895
19139
|
return (action.requiredContext ?? []).includes("root") ? ctx.root : void 0;
|
|
18896
19140
|
}
|
|
@@ -18903,24 +19147,33 @@ function createActionRunner(ports, store, options = {}) {
|
|
|
18903
19147
|
handles.delete(kind);
|
|
18904
19148
|
tokens.delete(kind);
|
|
18905
19149
|
}
|
|
19150
|
+
function tellFailure(error) {
|
|
19151
|
+
if (error instanceof CommandDetachedError) return;
|
|
19152
|
+
ports.presenter.notify("error", error instanceof Error ? error.message : String(error));
|
|
19153
|
+
}
|
|
18906
19154
|
async function startCommand(action, ctx, target, formArgs) {
|
|
18907
19155
|
const binding = action.binding;
|
|
18908
19156
|
if (binding.kind !== "command") return;
|
|
18909
19157
|
const spec = binding.confirmSpec(ctx, target, formArgs);
|
|
18910
19158
|
if (spec && !await askConfirm(spec)) return;
|
|
18911
|
-
|
|
18912
|
-
|
|
19159
|
+
const { on, busy } = busyOn(binding.resultKind, action, ctx, target);
|
|
19160
|
+
if (busy) {
|
|
19161
|
+
ports.presenter.notify("warn", busyReason(busy));
|
|
18913
19162
|
return;
|
|
18914
19163
|
}
|
|
18915
19164
|
const readOver = readOverOf(ctx);
|
|
18916
19165
|
const cwd = cwdOf(action, ctx);
|
|
18917
19166
|
const token = {};
|
|
18918
19167
|
const run = { token, path: binding.path, resultKind: binding.resultKind, ctx, target };
|
|
19168
|
+
const started = { target, on, path: binding.path, label: action.label };
|
|
18919
19169
|
const controller = new AbortController();
|
|
18920
19170
|
if (binding.resultKind === "notify") {
|
|
18921
|
-
notifyControllers.
|
|
19171
|
+
notifyControllers.set(controller, token);
|
|
18922
19172
|
await binding.start(
|
|
18923
|
-
runtimeFor(token, readOver, cwd, run, () =>
|
|
19173
|
+
runtimeFor(token, readOver, cwd, { run, started }, () => {
|
|
19174
|
+
notifyControllers.delete(controller);
|
|
19175
|
+
store.detach("notify", token);
|
|
19176
|
+
}),
|
|
18924
19177
|
ctx,
|
|
18925
19178
|
target,
|
|
18926
19179
|
formArgs,
|
|
@@ -18932,7 +19185,7 @@ function createActionRunner(ports, store, options = {}) {
|
|
|
18932
19185
|
controllers.set(binding.resultKind, controller);
|
|
18933
19186
|
tokens.set(binding.resultKind, token);
|
|
18934
19187
|
const handle = await binding.start(
|
|
18935
|
-
runtimeFor(token, readOver, cwd, run),
|
|
19188
|
+
runtimeFor(token, readOver, cwd, { run, started }),
|
|
18936
19189
|
ctx,
|
|
18937
19190
|
target,
|
|
18938
19191
|
formArgs,
|
|
@@ -18957,7 +19210,7 @@ function createActionRunner(ports, store, options = {}) {
|
|
|
18957
19210
|
missing: completion.missing,
|
|
18958
19211
|
submit: (values) => {
|
|
18959
19212
|
options.onPendingFormChange?.(null);
|
|
18960
|
-
void startCommand(action, ctx, target, values);
|
|
19213
|
+
void startCommand(action, ctx, target, values).catch(tellFailure);
|
|
18961
19214
|
},
|
|
18962
19215
|
cancel: () => options.onPendingFormChange?.(null)
|
|
18963
19216
|
});
|
|
@@ -18981,7 +19234,7 @@ function createActionRunner(ports, store, options = {}) {
|
|
|
18981
19234
|
...envExtras
|
|
18982
19235
|
};
|
|
18983
19236
|
if (binding.result === "apply") {
|
|
18984
|
-
return binding.run(env);
|
|
19237
|
+
return asEdit(() => binding.run(env));
|
|
18985
19238
|
}
|
|
18986
19239
|
if (binding.result === "generate") {
|
|
18987
19240
|
for await (const event of binding.run(env)) {
|
|
@@ -19009,8 +19262,7 @@ function createActionRunner(ports, store, options = {}) {
|
|
|
19009
19262
|
ports.presenter.notify("warn", unmet);
|
|
19010
19263
|
return;
|
|
19011
19264
|
}
|
|
19012
|
-
const
|
|
19013
|
-
const reason = disabledReason(action, ctx, isBusy);
|
|
19265
|
+
const reason = disabledReason(action, ctx, busyOf(action, ctx, target));
|
|
19014
19266
|
if (reason !== void 0) {
|
|
19015
19267
|
ports.presenter.notify("warn", reason);
|
|
19016
19268
|
return;
|
|
@@ -19031,13 +19283,24 @@ function createActionRunner(ports, store, options = {}) {
|
|
|
19031
19283
|
return;
|
|
19032
19284
|
}
|
|
19033
19285
|
} catch (error) {
|
|
19034
|
-
|
|
19035
|
-
ports.presenter.notify("error", error instanceof Error ? error.message : String(error));
|
|
19286
|
+
tellFailure(error);
|
|
19036
19287
|
}
|
|
19037
19288
|
},
|
|
19038
19289
|
apply(actions) {
|
|
19039
19290
|
return applyActions(actions);
|
|
19040
19291
|
},
|
|
19292
|
+
editing() {
|
|
19293
|
+
return edits > 0;
|
|
19294
|
+
},
|
|
19295
|
+
onEditingChange(listener) {
|
|
19296
|
+
editingListeners.add(listener);
|
|
19297
|
+
return () => {
|
|
19298
|
+
editingListeners.delete(listener);
|
|
19299
|
+
};
|
|
19300
|
+
},
|
|
19301
|
+
busy(action, ctx, target) {
|
|
19302
|
+
return busyOf(action, ctx, target);
|
|
19303
|
+
},
|
|
19041
19304
|
async cancel(kind) {
|
|
19042
19305
|
const handle = handles.get(kind);
|
|
19043
19306
|
if (!handle) return;
|
|
@@ -19049,7 +19312,10 @@ function createActionRunner(ports, store, options = {}) {
|
|
|
19049
19312
|
},
|
|
19050
19313
|
dispose() {
|
|
19051
19314
|
for (const kind of [...controllers.keys()]) detachSlot(kind);
|
|
19052
|
-
for (const controller of notifyControllers)
|
|
19315
|
+
for (const [controller, token] of notifyControllers) {
|
|
19316
|
+
controller.abort();
|
|
19317
|
+
store.detach("notify", token);
|
|
19318
|
+
}
|
|
19053
19319
|
notifyControllers.clear();
|
|
19054
19320
|
}
|
|
19055
19321
|
};
|
|
@@ -19066,8 +19332,8 @@ function OverlayRunner({
|
|
|
19066
19332
|
tick,
|
|
19067
19333
|
onDecorations
|
|
19068
19334
|
}) {
|
|
19069
|
-
const lastErrorRef = (0,
|
|
19070
|
-
const onReadError = (0,
|
|
19335
|
+
const lastErrorRef = (0, import_react41.useRef)(/* @__PURE__ */ new Map());
|
|
19336
|
+
const onReadError = (0, import_react41.useCallback)(
|
|
19071
19337
|
(path, error) => {
|
|
19072
19338
|
const next = error?.message ?? null;
|
|
19073
19339
|
if (lastErrorRef.current.get(path) === next) return;
|
|
@@ -19084,14 +19350,14 @@ function OverlayDecorations({
|
|
|
19084
19350
|
onDecorations
|
|
19085
19351
|
}) {
|
|
19086
19352
|
const decorations = overlay.useDecorations(ctx);
|
|
19087
|
-
(0,
|
|
19353
|
+
(0, import_react41.useEffect)(() => {
|
|
19088
19354
|
onDecorations(overlay.id, decorations);
|
|
19089
19355
|
}, [overlay.id, decorations, onDecorations]);
|
|
19090
19356
|
return null;
|
|
19091
19357
|
}
|
|
19092
19358
|
function PanelSlot({ panel, ctx, tick }) {
|
|
19093
|
-
const [readErrors, setReadErrors] = (0,
|
|
19094
|
-
const onReadError = (0,
|
|
19359
|
+
const [readErrors, setReadErrors] = (0, import_react41.useState)(/* @__PURE__ */ new Map());
|
|
19360
|
+
const onReadError = (0, import_react41.useCallback)((path, error) => {
|
|
19095
19361
|
setReadErrors((prev) => {
|
|
19096
19362
|
if (error === null) {
|
|
19097
19363
|
if (!prev.has(path)) return prev;
|
|
@@ -19128,7 +19394,7 @@ function BottomTabs({
|
|
|
19128
19394
|
ctx,
|
|
19129
19395
|
tick
|
|
19130
19396
|
}) {
|
|
19131
|
-
const [manualId, setManualId] = (0,
|
|
19397
|
+
const [manualId, setManualId] = (0, import_react41.useState)(null);
|
|
19132
19398
|
const manual = manualId !== null ? panels.find((p) => p.id === manualId) : void 0;
|
|
19133
19399
|
const active = manual ?? panels[0] ?? null;
|
|
19134
19400
|
if (panels.length === 0) return null;
|
|
@@ -19157,8 +19423,8 @@ function App({
|
|
|
19157
19423
|
height = "100vh",
|
|
19158
19424
|
results: hostResults
|
|
19159
19425
|
}) {
|
|
19160
|
-
const results = (0,
|
|
19161
|
-
const writeReport = (0,
|
|
19426
|
+
const results = (0, import_react41.useMemo)(() => hostResults ?? createResultStore(), [hostResults]);
|
|
19427
|
+
const writeReport = (0, import_react41.useCallback)(
|
|
19162
19428
|
(result, session2) => {
|
|
19163
19429
|
try {
|
|
19164
19430
|
results.write("report", session2, result, { stack: void 0 });
|
|
@@ -19169,43 +19435,43 @@ function App({
|
|
|
19169
19435
|
},
|
|
19170
19436
|
[results, ports.presenter]
|
|
19171
19437
|
);
|
|
19172
|
-
const dropReport = (0,
|
|
19438
|
+
const dropReport = (0, import_react41.useCallback)((session2) => results.detach("report", session2), [results]);
|
|
19173
19439
|
const { source, end, session } = useCanvasSource(ports.source, writeReport, dropReport);
|
|
19174
|
-
const [arrangement, setArrangement] = (0,
|
|
19440
|
+
const [arrangement, setArrangement] = (0, import_react41.useState)(() => ports.viewState.load());
|
|
19175
19441
|
const stack = ports.context.stack;
|
|
19176
|
-
const [selection, setSelection] = (0,
|
|
19442
|
+
const [selection, setSelection] = (0, import_react41.useState)(
|
|
19177
19443
|
NO_SELECTION
|
|
19178
19444
|
);
|
|
19179
|
-
const [settingsOpen, setSettingsOpen] = (0,
|
|
19180
|
-
const select = (0,
|
|
19445
|
+
const [settingsOpen, setSettingsOpen] = (0, import_react41.useState)(false);
|
|
19446
|
+
const select = (0, import_react41.useCallback)((next) => {
|
|
19181
19447
|
setSelection(next);
|
|
19182
19448
|
if (next.nodes.length > 0 || next.edge !== null) setSettingsOpen(false);
|
|
19183
19449
|
}, []);
|
|
19184
|
-
const [pendingForm, setPendingForm] = (0,
|
|
19185
|
-
const [overlayDecorations, setOverlayDecorations] = (0,
|
|
19186
|
-
const layoutRef = (0,
|
|
19450
|
+
const [pendingForm, setPendingForm] = (0, import_react41.useState)(null);
|
|
19451
|
+
const [overlayDecorations, setOverlayDecorations] = (0, import_react41.useState)({});
|
|
19452
|
+
const layoutRef = (0, import_react41.useRef)({ panIntoView: () => {
|
|
19187
19453
|
} });
|
|
19188
19454
|
const { commands, presenter, editor } = ports;
|
|
19189
|
-
const runner = (0,
|
|
19455
|
+
const runner = (0, import_react41.useMemo)(
|
|
19190
19456
|
() => createActionRunner({ commands, presenter, editor }, results, {
|
|
19191
19457
|
onPendingFormChange: setPendingForm
|
|
19192
19458
|
}),
|
|
19193
19459
|
[commands, presenter, editor, results]
|
|
19194
19460
|
);
|
|
19195
|
-
(0,
|
|
19461
|
+
(0, import_react41.useEffect)(() => {
|
|
19196
19462
|
return () => {
|
|
19197
19463
|
runner.dispose();
|
|
19198
19464
|
};
|
|
19199
19465
|
}, [runner]);
|
|
19200
|
-
const tick = (0,
|
|
19201
|
-
const updateArrangement = (0,
|
|
19466
|
+
const tick = (0, import_react41.useSyncExternalStore)(results.subscribe, results.getTick);
|
|
19467
|
+
const updateArrangement = (0, import_react41.useCallback)(
|
|
19202
19468
|
(next) => {
|
|
19203
19469
|
setArrangement(next);
|
|
19204
19470
|
ports.viewState.save(next);
|
|
19205
19471
|
},
|
|
19206
19472
|
[ports.viewState]
|
|
19207
19473
|
);
|
|
19208
|
-
const gcSeenBundle = (0,
|
|
19474
|
+
const gcSeenBundle = (0, import_react41.useRef)(null);
|
|
19209
19475
|
if (source && gcSeenBundle.current !== source.bundle) {
|
|
19210
19476
|
gcSeenBundle.current = source.bundle;
|
|
19211
19477
|
const gced = gcArrangement(source.bundle, arrangement);
|
|
@@ -19216,12 +19482,18 @@ function App({
|
|
|
19216
19482
|
});
|
|
19217
19483
|
}
|
|
19218
19484
|
}
|
|
19219
|
-
const view = (0,
|
|
19485
|
+
const view = (0, import_react41.useMemo)(
|
|
19220
19486
|
() => source ? projectFrame(source, arrangement) : null,
|
|
19221
19487
|
[source, arrangement]
|
|
19222
19488
|
);
|
|
19489
|
+
const reconciledFrame = (0, import_react41.useRef)(null);
|
|
19490
|
+
(0, import_react41.useLayoutEffect)(() => {
|
|
19491
|
+
if (!source || !view || reconciledFrame.current === source) return;
|
|
19492
|
+
reconciledFrame.current = source;
|
|
19493
|
+
setSelection((current) => reconcileSelection(view, current));
|
|
19494
|
+
}, [source, view]);
|
|
19223
19495
|
const editable = ports.editor !== void 0 && !source?.sourceRefused;
|
|
19224
|
-
const merged = (0,
|
|
19496
|
+
const merged = (0, import_react41.useMemo)(
|
|
19225
19497
|
() => ({
|
|
19226
19498
|
overlays: [...CORE_CONTRIBUTIONS.overlays, ...contributions.overlays],
|
|
19227
19499
|
panels: [...CORE_CONTRIBUTIONS.panels, ...contributions.panels],
|
|
@@ -19229,17 +19501,17 @@ function App({
|
|
|
19229
19501
|
}),
|
|
19230
19502
|
[contributions]
|
|
19231
19503
|
);
|
|
19232
|
-
const resultSlots = (0,
|
|
19504
|
+
const resultSlots = (0, import_react41.useSyncExternalStore)(results.subscribe, results.getSnapshot);
|
|
19233
19505
|
const stackId = stack?.id;
|
|
19234
|
-
const live = (0,
|
|
19506
|
+
const live = (0, import_react41.useMemo)(
|
|
19235
19507
|
() => source && session ? liveSlots(resultSlots, { session, treeHash: source.treeHash, stack: stackId }) : null,
|
|
19236
19508
|
[resultSlots, source, session, stackId]
|
|
19237
19509
|
);
|
|
19238
|
-
const diagnostics = (0,
|
|
19510
|
+
const diagnostics = (0, import_react41.useMemo)(
|
|
19239
19511
|
() => source && live ? diagnosticsOf(source.diagnostics, live.report ? reportDiagnostics(live.report) : []) : [],
|
|
19240
19512
|
[source, live]
|
|
19241
19513
|
);
|
|
19242
|
-
const ctx = (0,
|
|
19514
|
+
const ctx = (0, import_react41.useMemo)(() => {
|
|
19243
19515
|
if (!source || !view) return null;
|
|
19244
19516
|
return {
|
|
19245
19517
|
ports,
|
|
@@ -19256,18 +19528,18 @@ function App({
|
|
|
19256
19528
|
contributions: merged
|
|
19257
19529
|
};
|
|
19258
19530
|
}, [ports, source, view, stack, selection, settingsOpen, merged, diagnostics, editable]);
|
|
19259
|
-
const resolved = (0,
|
|
19531
|
+
const resolved = (0, import_react41.useMemo)(() => {
|
|
19260
19532
|
if (!ctx) return EMPTY_CONTRIBUTIONS;
|
|
19261
19533
|
return resolveContributions(merged, ports, ctx, NO_TARGET2);
|
|
19262
19534
|
}, [merged, ports, ctx]);
|
|
19263
|
-
const setOverlayDecoration = (0,
|
|
19535
|
+
const setOverlayDecoration = (0, import_react41.useCallback)((id, next) => {
|
|
19264
19536
|
setOverlayDecorations((prev) => prev[id] === next ? prev : { ...prev, [id]: next });
|
|
19265
19537
|
}, []);
|
|
19266
|
-
const decorations = (0,
|
|
19538
|
+
const decorations = (0, import_react41.useMemo)(() => {
|
|
19267
19539
|
if (!view || !source) return { nodes: {} };
|
|
19268
19540
|
return decorate(view, Object.values(overlayDecorations), diagnostics);
|
|
19269
19541
|
}, [view, source, overlayDecorations, diagnostics]);
|
|
19270
|
-
const envExtras = (0,
|
|
19542
|
+
const envExtras = (0, import_react41.useMemo)(() => {
|
|
19271
19543
|
if (!source) return null;
|
|
19272
19544
|
return {
|
|
19273
19545
|
bundle: source.bundle,
|
|
@@ -19279,8 +19551,8 @@ function App({
|
|
|
19279
19551
|
resolved.actions.filter((action) => action.placement === "toolbar"),
|
|
19280
19552
|
resolved.panels.filter((panel) => panel.slot === "toolbar")
|
|
19281
19553
|
);
|
|
19282
|
-
const rootRef = (0,
|
|
19283
|
-
(0,
|
|
19554
|
+
const rootRef = (0, import_react41.useRef)(null);
|
|
19555
|
+
(0, import_react41.useEffect)(() => {
|
|
19284
19556
|
if (!ctx) return;
|
|
19285
19557
|
registerKeyTarget(ctx, "app", rootRef.current);
|
|
19286
19558
|
return () => registerKeyTarget(ctx, "app", null);
|
|
@@ -19321,23 +19593,23 @@ function App({
|
|
|
19321
19593
|
)),
|
|
19322
19594
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CanvasContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { ref: rootRef, className: "lace-app", style: { height }, tabIndex: -1, children: [
|
|
19323
19595
|
(toolbar.sections.length > 0 || toolbar.trailing.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-app__toolbar", children: [
|
|
19324
|
-
toolbar.sections.map((section, index) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
19596
|
+
toolbar.sections.map((section, index) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_react41.Fragment, { children: [
|
|
19325
19597
|
index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "lace-app__toolbar-separator", "aria-hidden": "true" }) : null,
|
|
19326
19598
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-app__toolbar-section", children: [
|
|
19327
|
-
section.actions.map((action) =>
|
|
19328
|
-
|
|
19329
|
-
|
|
19599
|
+
section.actions.map((action) => (
|
|
19600
|
+
// `runner.busy` reads the store, whose every write
|
|
19601
|
+
// re-renders App (`resultSlots`).
|
|
19602
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19330
19603
|
ToolbarAction,
|
|
19331
19604
|
{
|
|
19332
19605
|
action,
|
|
19333
|
-
|
|
19606
|
+
...actionState(action, ctx, runner.busy(action, ctx, NO_TARGET2)),
|
|
19334
19607
|
emphasized: isEmphasized(action, ctx),
|
|
19335
|
-
busyLabel: busyLabelOf(action, ctx, commandBusy),
|
|
19336
19608
|
onRun: () => void runner.run(action, ctx, NO_TARGET2, envExtras)
|
|
19337
19609
|
},
|
|
19338
19610
|
action.id
|
|
19339
|
-
)
|
|
19340
|
-
|
|
19611
|
+
)
|
|
19612
|
+
)),
|
|
19341
19613
|
section.panels.map((panel) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelSlot, { panel, ctx, tick }, panel.id))
|
|
19342
19614
|
] })
|
|
19343
19615
|
] }, section.key ?? "")),
|
|
@@ -19346,7 +19618,7 @@ function App({
|
|
|
19346
19618
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "lace-app__banners", children: bannerPanels.map((panel) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelSlot, { panel, ctx, tick }, panel.id)) }),
|
|
19347
19619
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-app__body", children: [
|
|
19348
19620
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "lace-app__main", children: [
|
|
19349
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "lace-app__canvas", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19621
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "lace-app__canvas", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react40.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Canvas, { height: "100%" }) }) }),
|
|
19350
19622
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(BottomTabs, { panels: bottomPanels, ctx, tick })
|
|
19351
19623
|
] }),
|
|
19352
19624
|
drawerPanel && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Drawer, { label: drawerPanel.title, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PanelSlot, { panel: drawerPanel, ctx, tick }, drawerPanel.id) })
|
|
@@ -19668,7 +19940,8 @@ function parseBridgeResponse(raw) {
|
|
|
19668
19940
|
return null;
|
|
19669
19941
|
}
|
|
19670
19942
|
const apiCode = "apiCode" in raw && typeof raw.apiCode === "string" ? raw.apiCode : void 0;
|
|
19671
|
-
|
|
19943
|
+
const requestId = "requestId" in raw && typeof raw.requestId === "string" ? raw.requestId : void 0;
|
|
19944
|
+
return { kind, id, code, message, reason, apiCode, requestId };
|
|
19672
19945
|
}
|
|
19673
19946
|
return null;
|
|
19674
19947
|
}
|
|
@@ -19676,7 +19949,11 @@ function frameError(frame) {
|
|
|
19676
19949
|
return new ConnectError(
|
|
19677
19950
|
frame.code,
|
|
19678
19951
|
frame.message,
|
|
19679
|
-
ReasonDetail.fromJSON({
|
|
19952
|
+
ReasonDetail.fromJSON({
|
|
19953
|
+
reason: frame.reason,
|
|
19954
|
+
api_code: frame.apiCode,
|
|
19955
|
+
request_id: frame.requestId
|
|
19956
|
+
})
|
|
19680
19957
|
);
|
|
19681
19958
|
}
|
|
19682
19959
|
function bridgeCaller(bridge) {
|
|
@@ -19761,7 +20038,7 @@ function bridgeCaller(bridge) {
|
|
|
19761
20038
|
}
|
|
19762
20039
|
|
|
19763
20040
|
// src/adapters/engine/mapping.ts
|
|
19764
|
-
var
|
|
20041
|
+
var import_proto15 = require("@lace-cloud/proto");
|
|
19765
20042
|
|
|
19766
20043
|
// src/utils/deep-equal.ts
|
|
19767
20044
|
function deepEqual(a, b) {
|
|
@@ -19795,9 +20072,9 @@ function isolated(report) {
|
|
|
19795
20072
|
async function initialize(caller) {
|
|
19796
20073
|
const initialize2 = await caller.unary("Initialize", {
|
|
19797
20074
|
client_version: "@lace-cloud/canvas",
|
|
19798
|
-
protocol_version:
|
|
20075
|
+
protocol_version: import_proto15.ENGINE_PROTOCOL_VERSION
|
|
19799
20076
|
});
|
|
19800
|
-
(0,
|
|
20077
|
+
(0, import_proto15.checkEngineProtocol)(initialize2.server_version, initialize2.protocol_version);
|
|
19801
20078
|
return new Set(initialize2.command_paths);
|
|
19802
20079
|
}
|
|
19803
20080
|
async function openEngineCommands(caller, { cwd }) {
|
|
@@ -19822,7 +20099,7 @@ async function openEngineSession(caller, target, options = {}) {
|
|
|
19822
20099
|
let stopped = null;
|
|
19823
20100
|
const revisionWaiters = /* @__PURE__ */ new Set();
|
|
19824
20101
|
function adopt(state) {
|
|
19825
|
-
const published = state.bundle ??
|
|
20102
|
+
const published = state.bundle ?? import_proto15.EMPTY_BUNDLE;
|
|
19826
20103
|
const bundle = currentSource && deepEqual(currentSource.bundle, published) ? currentSource.bundle : published;
|
|
19827
20104
|
sessionGenerating = state.generating;
|
|
19828
20105
|
currentSource = {
|
|
@@ -19834,7 +20111,7 @@ async function openEngineSession(caller, target, options = {}) {
|
|
|
19834
20111
|
conflict: state.conflict ? { baseTreeHash: state.conflict.base_tree_hash, treeHash: state.conflict.tree_hash } : null,
|
|
19835
20112
|
sourceRefused: state.source_refused,
|
|
19836
20113
|
generating: generating(),
|
|
19837
|
-
diagnostics: state.diagnostics.map(
|
|
20114
|
+
diagnostics: state.diagnostics.map(import_proto15.convertDiagnostic),
|
|
19838
20115
|
treeHash: state.tree_hash
|
|
19839
20116
|
};
|
|
19840
20117
|
for (const listener of sourceListeners) deliver(listener, currentSource);
|
|
@@ -19870,6 +20147,7 @@ async function openEngineSession(caller, target, options = {}) {
|
|
|
19870
20147
|
revisionWaiters.clear();
|
|
19871
20148
|
}
|
|
19872
20149
|
function publishCommandResult(result) {
|
|
20150
|
+
commandResults.delete(result.path);
|
|
19873
20151
|
commandResults.set(result.path, result);
|
|
19874
20152
|
for (const listener of commandResultListeners) deliver(listener, result);
|
|
19875
20153
|
}
|
|
@@ -20016,7 +20294,7 @@ function commandsPort(caller, commandPaths, ownCwd) {
|
|
|
20016
20294
|
working_directory: cwd
|
|
20017
20295
|
};
|
|
20018
20296
|
async function* run() {
|
|
20019
|
-
for await (const event of
|
|
20297
|
+
for await (const event of untilExit()) {
|
|
20020
20298
|
if (event.json !== void 0) {
|
|
20021
20299
|
const data = JSON.parse(event.json);
|
|
20022
20300
|
if (carriesFailure(data)) continue;
|
|
@@ -20034,8 +20312,28 @@ function commandsPort(caller, commandPaths, ownCwd) {
|
|
|
20034
20312
|
return;
|
|
20035
20313
|
}
|
|
20036
20314
|
}
|
|
20037
|
-
|
|
20038
|
-
|
|
20315
|
+
}
|
|
20316
|
+
async function* untilExit() {
|
|
20317
|
+
let started = false;
|
|
20318
|
+
const stopped = (error) => {
|
|
20319
|
+
if (signal.aborted) return new CommandDetachedError();
|
|
20320
|
+
if (started) return new CommandUnobservedError();
|
|
20321
|
+
return error;
|
|
20322
|
+
};
|
|
20323
|
+
try {
|
|
20324
|
+
for await (const event of caller.stream("Invoke", request, signal)) {
|
|
20325
|
+
started || (started = event.started !== void 0);
|
|
20326
|
+
yield event;
|
|
20327
|
+
}
|
|
20328
|
+
} catch (error) {
|
|
20329
|
+
throw stopped(error);
|
|
20330
|
+
}
|
|
20331
|
+
throw stopped(
|
|
20332
|
+
new ConnectError(
|
|
20333
|
+
"internal",
|
|
20334
|
+
"the engine ended the Invoke stream before it started the command"
|
|
20335
|
+
)
|
|
20336
|
+
);
|
|
20039
20337
|
}
|
|
20040
20338
|
return {
|
|
20041
20339
|
events: run(),
|
|
@@ -20146,6 +20444,7 @@ function convertCreatedRef(r) {
|
|
|
20146
20444
|
UngeneratedMarker,
|
|
20147
20445
|
UnifiedSettingsPanel,
|
|
20148
20446
|
UnsavedMarker,
|
|
20447
|
+
answering,
|
|
20149
20448
|
bridgeCaller,
|
|
20150
20449
|
carriesFailure,
|
|
20151
20450
|
conflictPanel,
|