@lace-cloud/canvas 0.23.0 → 0.25.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 +13 -3
- package/dist/PaperGrid-JG4GBRDP.css +19 -0
- package/dist/{chunk-GV2FO3E2.mjs → chunk-YLJWYH7B.mjs} +211 -68
- package/dist/chunk-YLJWYH7B.mjs.map +1 -0
- package/dist/engine/index.cjs +210 -63
- 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 +781 -673
- 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 +366 -399
- package/dist/index.mjs.map +1 -1
- package/dist/{mapping-B2QFbLmE.d.ts → registry-CdHLt_qh.d.mts} +154 -20
- package/dist/{mapping-B2QFbLmE.d.mts → registry-CdHLt_qh.d.ts} +154 -20
- package/package.json +3 -3
- package/dist/PaperGrid-WFRL3N4P.css +0 -25
- package/dist/chunk-GV2FO3E2.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -75,6 +75,11 @@ if (apply) await runner.run(apply, { root, stack }, {});
|
|
|
75
75
|
// results.getSnapshot().run is the run's phases, last log line and outcome.
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
+
A command that failed says why as data (`CommandExitError.failure`), and
|
|
79
|
+
`answering(CORE_COMMAND_ACTIONS, failure)` is what a host offers on it:
|
|
80
|
+
the actions that answer that failure's reason (Import the rest answers
|
|
81
|
+
`import_residual`), each run the same way with `{ failure }` as its target.
|
|
82
|
+
|
|
78
83
|
A host that mounts the canvas can own its result store too: pass it as
|
|
79
84
|
`<App ports={ports} results={results} />` and call `results.bumpTick()`
|
|
80
85
|
when something outside the canvas changed what `stack describe` reports
|
|
@@ -122,8 +127,9 @@ const { ports, close } = await openEngineSession(caller, { root: '/path/to/autho
|
|
|
122
127
|
iterable throws it). Every `source` frame names the
|
|
123
128
|
tree the session last observed (`treeHash`), and a subscriber that
|
|
124
129
|
passes `onCommandResult` receives the result of every command that ran
|
|
125
|
-
in the session's root, the last per command path replayed
|
|
126
|
-
late — the input of `foldReport`,
|
|
130
|
+
in the session's root, the last per command path replayed in the order
|
|
131
|
+
they were published when it joins late — the input of `foldReport`,
|
|
132
|
+
whose `currentReport` keeps the
|
|
127
133
|
entries about that tree. The stream's end reaches every
|
|
128
134
|
`source` subscriber as `{ kind: 'closed' }` — the session is gone — or
|
|
129
135
|
`{ kind: 'failed', error }` — the stream is gone and the session
|
|
@@ -138,7 +144,11 @@ const { ports, close } = await openEngineSession(caller, { root: '/path/to/autho
|
|
|
138
144
|
`Invocation.cancel()` sends `CancelInvoke`
|
|
139
145
|
only and leaves `events` running until the command's own exit — a
|
|
140
146
|
`signal` abort or `close()` detaches the stream instead, without
|
|
141
|
-
cancelling the command's remote effects.
|
|
147
|
+
cancelling the command's remote effects. An `Invoke` stream that ends
|
|
148
|
+
before the command's exit rejects `events` with `CommandDetachedError`
|
|
149
|
+
when the consumer's `signal` aborted, and with `CommandUnobservedError`
|
|
150
|
+
when the consumer was still listening: the command ran in the engine
|
|
151
|
+
and its outcome never arrived.
|
|
142
152
|
- `openEngineCommands(caller, { cwd })` is the commands mapping:
|
|
143
153
|
`Initialize` once, `Invoke` per command, no session and no Subscribe.
|
|
144
154
|
- Both mappings name the protocol version this package speaks
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* The canvas's paper (PaperGrid.tsx): a layer filling the flow pane behind
|
|
2
|
+
* the graph, painted by the tokens' `.lace-paper-layers` recipe at the shell
|
|
3
|
+
* paper's pitch and threads, and still while the graph moves over it. */
|
|
4
|
+
.lace-canvas-paper {
|
|
5
|
+
position: absolute;
|
|
6
|
+
inset: 0;
|
|
7
|
+
z-index: -1;
|
|
8
|
+
pointer-events: none;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* On a screen with two or more device pixels to the CSS pixel, its threads
|
|
12
|
+
* are drawn one device pixel thick, half the shell's, so the paper stays
|
|
13
|
+
* under the graph drawn on it. A 1x screen has no line finer than 1px, so
|
|
14
|
+
* there the threads keep the shell's width. */
|
|
15
|
+
@media (min-resolution: 2dppx) {
|
|
16
|
+
.lace-canvas-paper {
|
|
17
|
+
--lace-paper-thread-width: 0.5px;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -3379,6 +3379,11 @@ var Reason = /* @__PURE__ */ ((Reason2) => {
|
|
|
3379
3379
|
Reason2[Reason2["REASON_TOOL_MISSING"] = 14] = "REASON_TOOL_MISSING";
|
|
3380
3380
|
Reason2[Reason2["REASON_CROSS_SCOPE"] = 15] = "REASON_CROSS_SCOPE";
|
|
3381
3381
|
Reason2[Reason2["REASON_UNAUTHENTICATED"] = 16] = "REASON_UNAUTHENTICATED";
|
|
3382
|
+
Reason2[Reason2["REASON_IMPORT_RESIDUAL"] = 17] = "REASON_IMPORT_RESIDUAL";
|
|
3383
|
+
Reason2[Reason2["REASON_STACK_HAS_STATE"] = 18] = "REASON_STACK_HAS_STATE";
|
|
3384
|
+
Reason2[Reason2["REASON_NO_ORIGIN_REMOTE"] = 19] = "REASON_NO_ORIGIN_REMOTE";
|
|
3385
|
+
Reason2[Reason2["REASON_IMPORT_UNDECLARED"] = 20] = "REASON_IMPORT_UNDECLARED";
|
|
3386
|
+
Reason2[Reason2["REASON_ALREADY_IMPORTED"] = 21] = "REASON_ALREADY_IMPORTED";
|
|
3382
3387
|
Reason2[Reason2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
3383
3388
|
return Reason2;
|
|
3384
3389
|
})(Reason || {});
|
|
@@ -3435,6 +3440,21 @@ function reasonFromJSON(object) {
|
|
|
3435
3440
|
case 16:
|
|
3436
3441
|
case "REASON_UNAUTHENTICATED":
|
|
3437
3442
|
return 16 /* REASON_UNAUTHENTICATED */;
|
|
3443
|
+
case 17:
|
|
3444
|
+
case "REASON_IMPORT_RESIDUAL":
|
|
3445
|
+
return 17 /* REASON_IMPORT_RESIDUAL */;
|
|
3446
|
+
case 18:
|
|
3447
|
+
case "REASON_STACK_HAS_STATE":
|
|
3448
|
+
return 18 /* REASON_STACK_HAS_STATE */;
|
|
3449
|
+
case 19:
|
|
3450
|
+
case "REASON_NO_ORIGIN_REMOTE":
|
|
3451
|
+
return 19 /* REASON_NO_ORIGIN_REMOTE */;
|
|
3452
|
+
case 20:
|
|
3453
|
+
case "REASON_IMPORT_UNDECLARED":
|
|
3454
|
+
return 20 /* REASON_IMPORT_UNDECLARED */;
|
|
3455
|
+
case 21:
|
|
3456
|
+
case "REASON_ALREADY_IMPORTED":
|
|
3457
|
+
return 21 /* REASON_ALREADY_IMPORTED */;
|
|
3438
3458
|
case -1:
|
|
3439
3459
|
case "UNRECOGNIZED":
|
|
3440
3460
|
default:
|
|
@@ -3477,6 +3497,16 @@ function reasonToJSON(object) {
|
|
|
3477
3497
|
return "REASON_CROSS_SCOPE";
|
|
3478
3498
|
case 16 /* REASON_UNAUTHENTICATED */:
|
|
3479
3499
|
return "REASON_UNAUTHENTICATED";
|
|
3500
|
+
case 17 /* REASON_IMPORT_RESIDUAL */:
|
|
3501
|
+
return "REASON_IMPORT_RESIDUAL";
|
|
3502
|
+
case 18 /* REASON_STACK_HAS_STATE */:
|
|
3503
|
+
return "REASON_STACK_HAS_STATE";
|
|
3504
|
+
case 19 /* REASON_NO_ORIGIN_REMOTE */:
|
|
3505
|
+
return "REASON_NO_ORIGIN_REMOTE";
|
|
3506
|
+
case 20 /* REASON_IMPORT_UNDECLARED */:
|
|
3507
|
+
return "REASON_IMPORT_UNDECLARED";
|
|
3508
|
+
case 21 /* REASON_ALREADY_IMPORTED */:
|
|
3509
|
+
return "REASON_ALREADY_IMPORTED";
|
|
3480
3510
|
case -1 /* UNRECOGNIZED */:
|
|
3481
3511
|
default:
|
|
3482
3512
|
return "UNRECOGNIZED";
|
|
@@ -10398,6 +10428,13 @@ var CommandDetachedError = class extends Error {
|
|
|
10398
10428
|
super("command detached: the invoking consumer stopped listening");
|
|
10399
10429
|
}
|
|
10400
10430
|
};
|
|
10431
|
+
var CommandUnobservedError = class extends Error {
|
|
10432
|
+
constructor() {
|
|
10433
|
+
super(
|
|
10434
|
+
"the engine's stream ended before the command exited: the command ran and may have made changes, but its outcome is unknown"
|
|
10435
|
+
);
|
|
10436
|
+
}
|
|
10437
|
+
};
|
|
10401
10438
|
|
|
10402
10439
|
// src/adapters/engine/connect-frame.ts
|
|
10403
10440
|
var END_STREAM_FLAG = 2;
|
|
@@ -10434,8 +10471,13 @@ async function* readConnectFrames(body, signal) {
|
|
|
10434
10471
|
try {
|
|
10435
10472
|
while (!signal.aborted) {
|
|
10436
10473
|
const { value, done } = await reader.read();
|
|
10437
|
-
if (done) return;
|
|
10438
10474
|
if (signal.aborted) return;
|
|
10475
|
+
if (done) {
|
|
10476
|
+
throw new ConnectError(
|
|
10477
|
+
"internal",
|
|
10478
|
+
"the engine's stream was cut off before its end-of-stream frame"
|
|
10479
|
+
);
|
|
10480
|
+
}
|
|
10439
10481
|
if (!value) continue;
|
|
10440
10482
|
chunks.push(value);
|
|
10441
10483
|
bufferedLen += value.length;
|
|
@@ -12062,6 +12104,31 @@ function completeArgs(path, partial) {
|
|
|
12062
12104
|
|
|
12063
12105
|
// src/contracts/schemas.ts
|
|
12064
12106
|
import { z } from "zod";
|
|
12107
|
+
var REASON_PREFIX = "REASON_";
|
|
12108
|
+
function reasonWire(reason) {
|
|
12109
|
+
return reasonToJSON(reason).slice(REASON_PREFIX.length).toLowerCase();
|
|
12110
|
+
}
|
|
12111
|
+
var LACE_REASONS = new Set(
|
|
12112
|
+
Object.values(Reason).filter((value) => typeof value === "number" && value !== -1 /* UNRECOGNIZED */).map(reasonWire)
|
|
12113
|
+
);
|
|
12114
|
+
var laceReasonSchema = z.custom(
|
|
12115
|
+
(value) => typeof value === "string" && LACE_REASONS.has(value),
|
|
12116
|
+
{ message: "not a reason of Lace\u2019s own" }
|
|
12117
|
+
);
|
|
12118
|
+
var importResidualSchema = z.object({
|
|
12119
|
+
address: z.string(),
|
|
12120
|
+
type: z.string(),
|
|
12121
|
+
reason: z.string()
|
|
12122
|
+
});
|
|
12123
|
+
var commandFailureSchema = z.strictObject({
|
|
12124
|
+
reason: laceReasonSchema,
|
|
12125
|
+
message: z.string(),
|
|
12126
|
+
url: z.string().optional(),
|
|
12127
|
+
tool: z.string().optional(),
|
|
12128
|
+
importResiduals: z.array(importResidualSchema).optional(),
|
|
12129
|
+
addresses: z.array(z.string()).optional(),
|
|
12130
|
+
apiCode: z.string().optional()
|
|
12131
|
+
});
|
|
12065
12132
|
var moduleValidateDeviationSchema = z.object({
|
|
12066
12133
|
notCompositional: z.boolean(),
|
|
12067
12134
|
clusters: z.array(z.unknown()),
|
|
@@ -12113,6 +12180,7 @@ var moduleValidateResultSchema = z.object({
|
|
|
12113
12180
|
}).optional(),
|
|
12114
12181
|
modules: z.array(z.object({ address: z.string(), version: z.string(), treeHash: z.string() })).optional(),
|
|
12115
12182
|
exitClass: z.string(),
|
|
12183
|
+
failure: commandFailureSchema.optional(),
|
|
12116
12184
|
diagnostics: z.array(commandDiagnosticSchema)
|
|
12117
12185
|
});
|
|
12118
12186
|
var moduleConvertResultSchema = z.object({
|
|
@@ -12223,6 +12291,7 @@ var registryDescribeSchema = z.object({
|
|
|
12223
12291
|
)
|
|
12224
12292
|
})
|
|
12225
12293
|
});
|
|
12294
|
+
var stackIdentSchema = z.object({ id: z.string(), slug: z.string() });
|
|
12226
12295
|
var stackSourceSchema = z.object({
|
|
12227
12296
|
kind: z.literal("git"),
|
|
12228
12297
|
repoUrl: z.string(),
|
|
@@ -12406,7 +12475,7 @@ var previewEntrySchema = z.discriminatedUnion("kind", [
|
|
|
12406
12475
|
})
|
|
12407
12476
|
]);
|
|
12408
12477
|
var stackPreviewSchema = z.object({
|
|
12409
|
-
stack:
|
|
12478
|
+
stack: stackIdentSchema,
|
|
12410
12479
|
treeHash: z.string(),
|
|
12411
12480
|
plan: z.object({ summary: planSummarySchema, human: z.string() }),
|
|
12412
12481
|
policy: z.object({
|
|
@@ -12453,16 +12522,19 @@ var gateChangeRequestSchema = z.object({
|
|
|
12453
12522
|
z.object({
|
|
12454
12523
|
id: z.string(),
|
|
12455
12524
|
state: z.string(),
|
|
12456
|
-
decidedBy: z.enum(["lace", "ecm"])
|
|
12525
|
+
decidedBy: z.enum(["lace", "ecm"]),
|
|
12526
|
+
recordId: z.string().nullable()
|
|
12457
12527
|
})
|
|
12458
12528
|
),
|
|
12459
12529
|
records: z.array(
|
|
12460
12530
|
z.object({
|
|
12531
|
+
id: z.string(),
|
|
12461
12532
|
externalSystemId: z.string(),
|
|
12462
12533
|
kind: z.string(),
|
|
12463
12534
|
externalRef: z.string().nullable(),
|
|
12464
12535
|
externalUrl: z.string().nullable(),
|
|
12465
|
-
state: z.string().nullable()
|
|
12536
|
+
state: z.string().nullable(),
|
|
12537
|
+
decision: z.enum(["approved", "rejected"]).nullable()
|
|
12466
12538
|
})
|
|
12467
12539
|
)
|
|
12468
12540
|
});
|
|
@@ -12486,6 +12558,7 @@ var runEventSchema = z.discriminatedUnion("type", [
|
|
|
12486
12558
|
})
|
|
12487
12559
|
]);
|
|
12488
12560
|
var stackScanSchema = z.object({
|
|
12561
|
+
stack: stackIdentSchema,
|
|
12489
12562
|
triggered: z.boolean(),
|
|
12490
12563
|
reason: z.string().nullable(),
|
|
12491
12564
|
settled: z.object({
|
|
@@ -12493,15 +12566,15 @@ var stackScanSchema = z.object({
|
|
|
12493
12566
|
driftCount: z.number(),
|
|
12494
12567
|
scannedAt: z.string(),
|
|
12495
12568
|
undeterminedReason: z.string().nullable(),
|
|
12569
|
+
standingDriftFindings: z.number(),
|
|
12570
|
+
footprintDestroyed: z.boolean(),
|
|
12496
12571
|
drift: driftSchema
|
|
12497
12572
|
}).nullable()
|
|
12498
12573
|
});
|
|
12499
|
-
var stackImportSchema =
|
|
12500
|
-
stack:
|
|
12501
|
-
written: z.array(z.string()),
|
|
12574
|
+
var stackImportSchema = moduleConvertResultSchema.extend({
|
|
12575
|
+
stack: stackIdentSchema,
|
|
12502
12576
|
importBlocks: z.number(),
|
|
12503
|
-
importResiduals: z.array(
|
|
12504
|
-
validate: moduleValidateResultSchema
|
|
12577
|
+
importResiduals: z.array(importResidualSchema)
|
|
12505
12578
|
});
|
|
12506
12579
|
var artifactRefSchema = z.object({ url: z.string(), key: z.string() });
|
|
12507
12580
|
var runPlanSchema = z.object({
|
|
@@ -12612,24 +12685,6 @@ function isBoundPath(path) {
|
|
|
12612
12685
|
function parseBound(path, data) {
|
|
12613
12686
|
return SCHEMAS[path].parse(data);
|
|
12614
12687
|
}
|
|
12615
|
-
var REASON_PREFIX = "REASON_";
|
|
12616
|
-
function reasonWire(reason) {
|
|
12617
|
-
return reasonToJSON(reason).slice(REASON_PREFIX.length).toLowerCase();
|
|
12618
|
-
}
|
|
12619
|
-
var LACE_REASONS = new Set(
|
|
12620
|
-
Object.values(Reason).filter((value) => typeof value === "number" && value !== -1 /* UNRECOGNIZED */).map(reasonWire)
|
|
12621
|
-
);
|
|
12622
|
-
var laceReasonSchema = z.custom(
|
|
12623
|
-
(value) => typeof value === "string" && LACE_REASONS.has(value),
|
|
12624
|
-
{ message: "not a reason of Lace\u2019s own" }
|
|
12625
|
-
);
|
|
12626
|
-
var commandFailureSchema = z.strictObject({
|
|
12627
|
-
reason: laceReasonSchema,
|
|
12628
|
-
message: z.string(),
|
|
12629
|
-
url: z.string().optional(),
|
|
12630
|
-
tool: z.string().optional(),
|
|
12631
|
-
apiCode: z.string().optional()
|
|
12632
|
-
});
|
|
12633
12688
|
var failureMarkSchema = z.object({ reason: z.string(), message: z.string() });
|
|
12634
12689
|
function carriesFailure(data) {
|
|
12635
12690
|
return failureMarkSchema.safeParse(data).success;
|
|
@@ -12637,6 +12692,12 @@ function carriesFailure(data) {
|
|
|
12637
12692
|
function parseCommandFailure(data) {
|
|
12638
12693
|
return commandFailureSchema.parse(data);
|
|
12639
12694
|
}
|
|
12695
|
+
function resultFailure(path, data) {
|
|
12696
|
+
const result = parseBound(path, data);
|
|
12697
|
+
if ("failure" in result) return result.failure;
|
|
12698
|
+
if ("validate" in result) return result.validate.failure;
|
|
12699
|
+
return void 0;
|
|
12700
|
+
}
|
|
12640
12701
|
|
|
12641
12702
|
// src/utils/is-plain-object.ts
|
|
12642
12703
|
function isPlainObject(val) {
|
|
@@ -12750,6 +12811,7 @@ async function openEngineSession(caller, target, options = {}) {
|
|
|
12750
12811
|
revisionWaiters.clear();
|
|
12751
12812
|
}
|
|
12752
12813
|
function publishCommandResult(result) {
|
|
12814
|
+
commandResults.delete(result.path);
|
|
12753
12815
|
commandResults.set(result.path, result);
|
|
12754
12816
|
for (const listener of commandResultListeners) deliver(listener, result);
|
|
12755
12817
|
}
|
|
@@ -12908,13 +12970,14 @@ function commandsPort(caller, commandPaths, ownCwd) {
|
|
|
12908
12970
|
throw new CommandExitError(
|
|
12909
12971
|
event.exit.code,
|
|
12910
12972
|
event.exit.stderr_tail,
|
|
12911
|
-
exitFailure(event.exit.document)
|
|
12973
|
+
exitFailure(path, event.exit.document)
|
|
12912
12974
|
);
|
|
12913
12975
|
}
|
|
12914
12976
|
return;
|
|
12915
12977
|
}
|
|
12916
12978
|
}
|
|
12917
|
-
throw new CommandDetachedError();
|
|
12979
|
+
if (signal.aborted) throw new CommandDetachedError();
|
|
12980
|
+
throw new CommandUnobservedError();
|
|
12918
12981
|
}
|
|
12919
12982
|
return {
|
|
12920
12983
|
events: run(),
|
|
@@ -12925,10 +12988,10 @@ function commandsPort(caller, commandPaths, ownCwd) {
|
|
|
12925
12988
|
}
|
|
12926
12989
|
};
|
|
12927
12990
|
}
|
|
12928
|
-
function exitFailure(document) {
|
|
12991
|
+
function exitFailure(path, document) {
|
|
12929
12992
|
if (document === "") return void 0;
|
|
12930
12993
|
const data = JSON.parse(document);
|
|
12931
|
-
return carriesFailure(data) ? parseCommandFailure(data) :
|
|
12994
|
+
return carriesFailure(data) ? parseCommandFailure(data) : resultFailure(path, data);
|
|
12932
12995
|
}
|
|
12933
12996
|
async function openSession(caller, target) {
|
|
12934
12997
|
if ("fixture" in target) {
|
|
@@ -13010,7 +13073,7 @@ function defineCommand(binding) {
|
|
|
13010
13073
|
if (!binding.confirm) return void 0;
|
|
13011
13074
|
const merged = completeArgs(binding.path, { ...binding.args(ctx, target), ...formArgs });
|
|
13012
13075
|
if (!merged.ok) return void 0;
|
|
13013
|
-
return binding.confirm(ctx, merged.args);
|
|
13076
|
+
return binding.confirm(ctx, merged.args, target);
|
|
13014
13077
|
},
|
|
13015
13078
|
async start(rt, ctx, target, formArgs, signal) {
|
|
13016
13079
|
const merged = completeArgs(binding.path, { ...binding.args(ctx, target), ...formArgs });
|
|
@@ -13069,6 +13132,21 @@ var destroy = defineCommand({
|
|
|
13069
13132
|
invalidates: "start+settle",
|
|
13070
13133
|
result: slotSink("run")
|
|
13071
13134
|
});
|
|
13135
|
+
function scanNotice(e) {
|
|
13136
|
+
const { slug } = e.stack;
|
|
13137
|
+
const settled = e.settled;
|
|
13138
|
+
if (!settled) {
|
|
13139
|
+
return e.triggered ? `Drift scan triggered for stack ${slug} (${e.stack.id}).` : `Drift scan already in progress for stack ${slug}.`;
|
|
13140
|
+
}
|
|
13141
|
+
if (settled.undeterminedReason !== null) return void 0;
|
|
13142
|
+
if (settled.footprintDestroyed) {
|
|
13143
|
+
return `Drift scan complete for stack ${slug}: IN_SYNC (0 drifted) \u2014 its resources were destroyed, so there was nothing to compare.`;
|
|
13144
|
+
}
|
|
13145
|
+
if (settled.standingDriftFindings > 0) {
|
|
13146
|
+
return `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.`;
|
|
13147
|
+
}
|
|
13148
|
+
return `Drift scan complete for stack ${slug}: ${settled.driftStatus} (${settled.driftCount} drifted).`;
|
|
13149
|
+
}
|
|
13072
13150
|
var scan = defineCommand({
|
|
13073
13151
|
kind: "command",
|
|
13074
13152
|
path: "stack scan",
|
|
@@ -13077,14 +13155,8 @@ var scan = defineCommand({
|
|
|
13077
13155
|
result: {
|
|
13078
13156
|
kind: "notify",
|
|
13079
13157
|
consume: (rt, e) => {
|
|
13080
|
-
|
|
13081
|
-
|
|
13082
|
-
return;
|
|
13083
|
-
}
|
|
13084
|
-
rt.ports.presenter.notify(
|
|
13085
|
-
"info",
|
|
13086
|
-
e.settled ? `Scan complete \u2014 ${e.settled.driftStatus}` : "Scan triggered"
|
|
13087
|
-
);
|
|
13158
|
+
const notice = scanNotice(e);
|
|
13159
|
+
if (notice !== void 0) rt.ports.presenter.notify("info", notice);
|
|
13088
13160
|
}
|
|
13089
13161
|
}
|
|
13090
13162
|
});
|
|
@@ -13098,15 +13170,50 @@ var create = defineCommand({
|
|
|
13098
13170
|
consume: (rt, e) => rt.ports.presenter.notify("info", `Created stack ${e.slug}`)
|
|
13099
13171
|
}
|
|
13100
13172
|
});
|
|
13173
|
+
function residualAddresses(residuals) {
|
|
13174
|
+
return residuals.map((r) => r.address).join(", ");
|
|
13175
|
+
}
|
|
13176
|
+
function treeChanges(e) {
|
|
13177
|
+
return [
|
|
13178
|
+
...e.written.length === 0 ? [] : [`rewriting ${e.written.join(", ")} in place`],
|
|
13179
|
+
...e.removed.length === 0 ? [] : [`removing ${e.removed.join(", ")}`]
|
|
13180
|
+
];
|
|
13181
|
+
}
|
|
13182
|
+
function importNotice(e) {
|
|
13183
|
+
const { slug } = e.stack;
|
|
13184
|
+
const changes = treeChanges(e);
|
|
13185
|
+
const files = changes.length > 0 ? `, ${changes.join(" and ")}` : "";
|
|
13186
|
+
const imported = `Imported ${e.importBlocks} resource(s) into ${slug}${files}.`;
|
|
13187
|
+
if (e.validate.exitClass !== "ok") {
|
|
13188
|
+
return ["warn", `${imported} The tree did not validate: fix it before you commit it.`];
|
|
13189
|
+
}
|
|
13190
|
+
const adopt = e.changed ? ` Review the change in git, commit it, then apply ${slug} to adopt them.` : "";
|
|
13191
|
+
if (e.importResiduals.length === 0) return ["info", `${imported}${adopt}`];
|
|
13192
|
+
return [
|
|
13193
|
+
"warn",
|
|
13194
|
+
`${imported}${adopt} Not adopted: ${residualAddresses(e.importResiduals)}; supply their import ids before applying, or the apply creates them anew.`
|
|
13195
|
+
];
|
|
13196
|
+
}
|
|
13197
|
+
var importResult = {
|
|
13198
|
+
kind: "notify",
|
|
13199
|
+
consume: (rt, e) => rt.ports.presenter.notify(...importNotice(e))
|
|
13200
|
+
};
|
|
13101
13201
|
var importStack = defineCommand({
|
|
13102
13202
|
kind: "command",
|
|
13103
13203
|
path: "stack import",
|
|
13104
13204
|
args: (ctx) => ({ stack: ctx.stack?.id }),
|
|
13105
13205
|
invalidates: true,
|
|
13106
|
-
result:
|
|
13107
|
-
|
|
13108
|
-
|
|
13109
|
-
|
|
13206
|
+
result: importResult
|
|
13207
|
+
});
|
|
13208
|
+
var importPartial = defineCommand({
|
|
13209
|
+
kind: "command",
|
|
13210
|
+
path: "stack import",
|
|
13211
|
+
args: (ctx) => ({ stack: ctx.stack?.id, allowPartial: true }),
|
|
13212
|
+
confirm: (ctx, _args, target) => ({
|
|
13213
|
+
text: `Import into ${ctx.stack?.slug} without adopting ${residualAddresses(target.failure?.importResiduals ?? [])}? Lace writes no import block for them, so the stack's apply creates them anew beside the live ones.`
|
|
13214
|
+
}),
|
|
13215
|
+
invalidates: true,
|
|
13216
|
+
result: importResult
|
|
13110
13217
|
});
|
|
13111
13218
|
var validate = defineCommand({
|
|
13112
13219
|
kind: "command",
|
|
@@ -13174,12 +13281,14 @@ var MODULE_COMMAND_ACTIONS = [
|
|
|
13174
13281
|
requiredContext: ["root"],
|
|
13175
13282
|
binding: convert
|
|
13176
13283
|
},
|
|
13177
|
-
//
|
|
13178
|
-
// the same `module convert` the toolbar runs
|
|
13179
|
-
//
|
|
13284
|
+
// Convert on the source-refused banner while the tree is out of lace
|
|
13285
|
+
// shape: the same `module convert` the toolbar runs, and the choice the
|
|
13286
|
+
// banner says of it. The engine re-derives the tree it writes, which
|
|
13287
|
+
// accepts it and lifts the lock.
|
|
13180
13288
|
{
|
|
13181
13289
|
id: "convert-refused",
|
|
13182
13290
|
label: "Convert",
|
|
13291
|
+
choice: "Convert restructures it in place; a stack's apply creates only what its state does not hold yet.",
|
|
13183
13292
|
icon: "convert",
|
|
13184
13293
|
placement: { row: "source-refused" },
|
|
13185
13294
|
requiredPorts: ["commands"],
|
|
@@ -13229,7 +13338,7 @@ var STACK_COMMAND_ACTIONS = [
|
|
|
13229
13338
|
},
|
|
13230
13339
|
{
|
|
13231
13340
|
id: "import",
|
|
13232
|
-
label: "Import
|
|
13341
|
+
label: "Import existing resources",
|
|
13233
13342
|
placement: "toolbar",
|
|
13234
13343
|
requiredPorts: ["commands"],
|
|
13235
13344
|
// `stack import` writes the directory it runs in, the same way
|
|
@@ -13237,6 +13346,15 @@ var STACK_COMMAND_ACTIONS = [
|
|
|
13237
13346
|
requiredContext: ["root", "stack"],
|
|
13238
13347
|
binding: importStack
|
|
13239
13348
|
},
|
|
13349
|
+
{
|
|
13350
|
+
id: "import-partial",
|
|
13351
|
+
label: "Import the rest",
|
|
13352
|
+
placement: { row: "failure" },
|
|
13353
|
+
requiredPorts: ["commands"],
|
|
13354
|
+
requiredContext: ["root", "stack"],
|
|
13355
|
+
answers: ["import_residual"],
|
|
13356
|
+
binding: importPartial
|
|
13357
|
+
},
|
|
13240
13358
|
{
|
|
13241
13359
|
id: "preview",
|
|
13242
13360
|
label: "Preview",
|
|
@@ -13300,10 +13418,10 @@ function diagnosticsOf(sourceDiagnostics, reportFindings) {
|
|
|
13300
13418
|
|
|
13301
13419
|
// src/core/report-fold.ts
|
|
13302
13420
|
var REPORT_PATHS = ["module validate", "module convert", "module scan"];
|
|
13303
|
-
var
|
|
13304
|
-
|
|
13305
|
-
|
|
13306
|
-
|
|
13421
|
+
var FOLDS_AS = new Map([
|
|
13422
|
+
...REPORT_PATHS.map((path) => [path, path]),
|
|
13423
|
+
["stack import", "module convert"]
|
|
13424
|
+
]);
|
|
13307
13425
|
var EMPTY_REPORT_FOLD = /* @__PURE__ */ new Map();
|
|
13308
13426
|
function readEntry(path, exitCode, data) {
|
|
13309
13427
|
if (carriesFailure(data)) {
|
|
@@ -13319,10 +13437,11 @@ function readEntry(path, exitCode, data) {
|
|
|
13319
13437
|
}
|
|
13320
13438
|
}
|
|
13321
13439
|
function foldReport(prev, result) {
|
|
13322
|
-
|
|
13440
|
+
const path = FOLDS_AS.get(result.path);
|
|
13441
|
+
if (path === void 0) return prev;
|
|
13323
13442
|
const next = new Map(prev);
|
|
13324
|
-
if (result.document === "") next.delete(
|
|
13325
|
-
else next.set(
|
|
13443
|
+
if (result.document === "") next.delete(path);
|
|
13444
|
+
else next.set(path, readEntry(path, result.exitCode, JSON.parse(result.document)));
|
|
13326
13445
|
return next;
|
|
13327
13446
|
}
|
|
13328
13447
|
function treeHashOf(entry) {
|
|
@@ -13410,7 +13529,7 @@ function reduceRun(prev, token, event) {
|
|
|
13410
13529
|
if (event.type === "gate" && event.changeRequest !== null) {
|
|
13411
13530
|
return {
|
|
13412
13531
|
token,
|
|
13413
|
-
outcome: { kind: "awaiting-approval", changeRequest: event.changeRequest },
|
|
13532
|
+
outcome: { kind: "awaiting-approval", changeRequest: event.changeRequest, runUrl: null },
|
|
13414
13533
|
lastLog,
|
|
13415
13534
|
submitted,
|
|
13416
13535
|
phases: closePhases(phases)
|
|
@@ -13418,7 +13537,13 @@ function reduceRun(prev, token, event) {
|
|
|
13418
13537
|
}
|
|
13419
13538
|
if (event.type === "result") {
|
|
13420
13539
|
if (carried?.outcome.kind === "awaiting-approval") {
|
|
13421
|
-
return {
|
|
13540
|
+
return {
|
|
13541
|
+
token,
|
|
13542
|
+
outcome: { ...carried.outcome, runUrl: event.run.url ?? null },
|
|
13543
|
+
lastLog,
|
|
13544
|
+
submitted,
|
|
13545
|
+
phases
|
|
13546
|
+
};
|
|
13422
13547
|
}
|
|
13423
13548
|
if (event.error)
|
|
13424
13549
|
return {
|
|
@@ -13446,7 +13571,7 @@ function settleRun(prev, token, error) {
|
|
|
13446
13571
|
const lastLog = carried?.lastLog ?? null;
|
|
13447
13572
|
const submitted = carried?.submitted ?? false;
|
|
13448
13573
|
const phases = closePhases(carried?.phases ?? []);
|
|
13449
|
-
if (error instanceof CommandDetachedError)
|
|
13574
|
+
if (error instanceof CommandDetachedError || error instanceof CommandUnobservedError)
|
|
13450
13575
|
return { token, outcome: { kind: "detached", submitted }, lastLog, submitted, phases };
|
|
13451
13576
|
if (error instanceof CommandExitError) {
|
|
13452
13577
|
if (error.code === 130)
|
|
@@ -13590,7 +13715,7 @@ var CONTEXT_NEEDS = {
|
|
|
13590
13715
|
resolved: "no open Keep or Reload conflict",
|
|
13591
13716
|
conflict: "an open Keep or Reload conflict",
|
|
13592
13717
|
sourceRefused: "the source-refused lock",
|
|
13593
|
-
needsConversion: "a tree
|
|
13718
|
+
needsConversion: "a tree out of lace shape",
|
|
13594
13719
|
"selection.node": "a selected node",
|
|
13595
13720
|
"selection.edge": "a selected connection",
|
|
13596
13721
|
diagnostics: "diagnostics to show",
|
|
@@ -13605,7 +13730,8 @@ var TARGET_NEEDS = {
|
|
|
13605
13730
|
nodeId: "a node",
|
|
13606
13731
|
groupId: "a group",
|
|
13607
13732
|
diagnostic: "a diagnostic",
|
|
13608
|
-
runId: "a run"
|
|
13733
|
+
runId: "a run",
|
|
13734
|
+
failure: "a failed command"
|
|
13609
13735
|
};
|
|
13610
13736
|
var BUSY_REASON = "A run is in progress";
|
|
13611
13737
|
function keySatisfied(ctx, key) {
|
|
@@ -13669,6 +13795,16 @@ function asksConfirm(binding) {
|
|
|
13669
13795
|
return binding.confirm !== void 0;
|
|
13670
13796
|
}
|
|
13671
13797
|
}
|
|
13798
|
+
var FAILURE_ROW = "failure";
|
|
13799
|
+
function placedOn(action, row) {
|
|
13800
|
+
return typeof action.placement === "object" && action.placement.row === row;
|
|
13801
|
+
}
|
|
13802
|
+
function answersFailure(action, failure) {
|
|
13803
|
+
return action.answers?.includes(failure.reason) === true;
|
|
13804
|
+
}
|
|
13805
|
+
function answering(actions, failure) {
|
|
13806
|
+
return actions.filter((a) => placedOn(a, FAILURE_ROW) && answersFailure(a, failure));
|
|
13807
|
+
}
|
|
13672
13808
|
function unmetRequirement(action, ports, ctx, target) {
|
|
13673
13809
|
const { label, binding } = action;
|
|
13674
13810
|
const port = missingPort(ports, action.requiredPorts);
|
|
@@ -13680,6 +13816,10 @@ function unmetRequirement(action, ports, ctx, target) {
|
|
|
13680
13816
|
if (key !== void 0) return `${label} needs ${CONTEXT_NEEDS[key]}`;
|
|
13681
13817
|
const targetKey = (action.requiredTarget ?? []).find((k) => target[k] === void 0);
|
|
13682
13818
|
if (targetKey !== void 0) return `${label} needs ${TARGET_NEEDS[targetKey]}`;
|
|
13819
|
+
if (placedOn(action, FAILURE_ROW) || action.answers !== void 0) {
|
|
13820
|
+
if (target.failure === void 0) return `${label} needs ${TARGET_NEEDS.failure}`;
|
|
13821
|
+
if (!answersFailure(action, target.failure)) return `${label} does not answer this failure`;
|
|
13822
|
+
}
|
|
13683
13823
|
if (binding.kind === "command" && !availableCommands(ports).has(binding.path)) {
|
|
13684
13824
|
return `${label} runs lace ${binding.path}, which this host does not route`;
|
|
13685
13825
|
}
|
|
@@ -13697,9 +13837,7 @@ function resolveContributions(all, ports, ctx, target = NO_TARGET) {
|
|
|
13697
13837
|
};
|
|
13698
13838
|
}
|
|
13699
13839
|
function rowActions(resolved, panelId) {
|
|
13700
|
-
return resolved.actions.filter(
|
|
13701
|
-
(a) => typeof a.placement === "object" && a.placement.row === panelId
|
|
13702
|
-
);
|
|
13840
|
+
return resolved.actions.filter((a) => placedOn(a, panelId));
|
|
13703
13841
|
}
|
|
13704
13842
|
|
|
13705
13843
|
// src/core/run-binding.ts
|
|
@@ -13805,6 +13943,10 @@ function createActionRunner(ports, store, options = {}) {
|
|
|
13805
13943
|
handles.delete(kind);
|
|
13806
13944
|
tokens.delete(kind);
|
|
13807
13945
|
}
|
|
13946
|
+
function tellFailure(error) {
|
|
13947
|
+
if (error instanceof CommandDetachedError) return;
|
|
13948
|
+
ports.presenter.notify("error", error instanceof Error ? error.message : String(error));
|
|
13949
|
+
}
|
|
13808
13950
|
async function startCommand(action, ctx, target, formArgs) {
|
|
13809
13951
|
const binding = action.binding;
|
|
13810
13952
|
if (binding.kind !== "command") return;
|
|
@@ -13859,7 +14001,7 @@ function createActionRunner(ports, store, options = {}) {
|
|
|
13859
14001
|
missing: completion.missing,
|
|
13860
14002
|
submit: (values) => {
|
|
13861
14003
|
options.onPendingFormChange?.(null);
|
|
13862
|
-
void startCommand(action, ctx, target, values);
|
|
14004
|
+
void startCommand(action, ctx, target, values).catch(tellFailure);
|
|
13863
14005
|
},
|
|
13864
14006
|
cancel: () => options.onPendingFormChange?.(null)
|
|
13865
14007
|
});
|
|
@@ -13933,8 +14075,7 @@ function createActionRunner(ports, store, options = {}) {
|
|
|
13933
14075
|
return;
|
|
13934
14076
|
}
|
|
13935
14077
|
} catch (error) {
|
|
13936
|
-
|
|
13937
|
-
ports.presenter.notify("error", error instanceof Error ? error.message : String(error));
|
|
14078
|
+
tellFailure(error);
|
|
13938
14079
|
}
|
|
13939
14080
|
},
|
|
13940
14081
|
apply(actions) {
|
|
@@ -14049,6 +14190,7 @@ export {
|
|
|
14049
14190
|
diagnosticsOf,
|
|
14050
14191
|
keySatisfied,
|
|
14051
14192
|
disabledReason,
|
|
14193
|
+
answering,
|
|
14052
14194
|
resolveContributions,
|
|
14053
14195
|
rowActions,
|
|
14054
14196
|
Bundle,
|
|
@@ -14059,12 +14201,13 @@ export {
|
|
|
14059
14201
|
CommandExitError,
|
|
14060
14202
|
ConnectError,
|
|
14061
14203
|
CommandDetachedError,
|
|
14204
|
+
CommandUnobservedError,
|
|
14062
14205
|
COMMANDS,
|
|
14063
14206
|
toArgv,
|
|
14207
|
+
reasonWire,
|
|
14064
14208
|
SCHEMAS,
|
|
14065
14209
|
isBoundPath,
|
|
14066
14210
|
parseBound,
|
|
14067
|
-
reasonWire,
|
|
14068
14211
|
carriesFailure,
|
|
14069
14212
|
parseCommandFailure,
|
|
14070
14213
|
defineCommand,
|
|
@@ -14091,4 +14234,4 @@ export {
|
|
|
14091
14234
|
AutosaveEndedError,
|
|
14092
14235
|
autosave
|
|
14093
14236
|
};
|
|
14094
|
-
//# sourceMappingURL=chunk-
|
|
14237
|
+
//# sourceMappingURL=chunk-YLJWYH7B.mjs.map
|