@lace-cloud/canvas 0.22.0 → 0.24.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 +5 -1
- package/dist/PaperGrid-JG4GBRDP.css +19 -0
- package/dist/{chunk-WNBCPSQJ.mjs → chunk-HZWABSPP.mjs} +208 -72
- package/dist/chunk-HZWABSPP.mjs.map +1 -0
- package/dist/engine/index.cjs +207 -70
- 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 +3 -1
- package/dist/index.cjs +777 -677
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +364 -399
- package/dist/index.mjs.map +1 -1
- package/dist/{mapping-DpFUMDvW.d.ts → mapping-Z-STJQRP.d.mts} +177 -52
- package/dist/{mapping-DpFUMDvW.d.mts → mapping-Z-STJQRP.d.ts} +177 -52
- package/package.json +3 -3
- package/dist/PaperGrid-WFRL3N4P.css +0 -25
- package/dist/chunk-WNBCPSQJ.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -138,7 +138,11 @@ const { ports, close } = await openEngineSession(caller, { root: '/path/to/autho
|
|
|
138
138
|
`Invocation.cancel()` sends `CancelInvoke`
|
|
139
139
|
only and leaves `events` running until the command's own exit — a
|
|
140
140
|
`signal` abort or `close()` detaches the stream instead, without
|
|
141
|
-
cancelling the command's remote effects.
|
|
141
|
+
cancelling the command's remote effects. An `Invoke` stream that ends
|
|
142
|
+
before the command's exit rejects `events` with `CommandDetachedError`
|
|
143
|
+
when the consumer's `signal` aborted, and with `CommandUnobservedError`
|
|
144
|
+
when the consumer was still listening: the command ran in the engine
|
|
145
|
+
and its outcome never arrived.
|
|
142
146
|
- `openEngineCommands(caller, { cwd })` is the commands mapping:
|
|
143
147
|
`Initialize` once, `Invoke` per command, no session and no Subscribe.
|
|
144
148
|
- 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({
|
|
@@ -12446,27 +12515,28 @@ var stackPreviewSchema = z.object({
|
|
|
12446
12515
|
bound: z.number().optional()
|
|
12447
12516
|
})
|
|
12448
12517
|
});
|
|
12449
|
-
var
|
|
12518
|
+
var gateChangeRequestSchema = z.object({
|
|
12450
12519
|
id: z.string(),
|
|
12451
|
-
orgId: z.string(),
|
|
12452
|
-
teamId: z.string(),
|
|
12453
|
-
runId: z.string(),
|
|
12454
|
-
bindingId: z.string().nullable(),
|
|
12455
|
-
invocationId: z.string().nullable(),
|
|
12456
12520
|
state: z.string(),
|
|
12457
|
-
|
|
12458
|
-
|
|
12459
|
-
|
|
12460
|
-
|
|
12461
|
-
|
|
12462
|
-
|
|
12463
|
-
|
|
12464
|
-
|
|
12465
|
-
|
|
12466
|
-
|
|
12467
|
-
|
|
12468
|
-
|
|
12469
|
-
|
|
12521
|
+
requirements: z.array(
|
|
12522
|
+
z.object({
|
|
12523
|
+
id: z.string(),
|
|
12524
|
+
state: z.string(),
|
|
12525
|
+
decidedBy: z.enum(["lace", "ecm"]),
|
|
12526
|
+
recordId: z.string().nullable()
|
|
12527
|
+
})
|
|
12528
|
+
),
|
|
12529
|
+
records: z.array(
|
|
12530
|
+
z.object({
|
|
12531
|
+
id: z.string(),
|
|
12532
|
+
externalSystemId: z.string(),
|
|
12533
|
+
kind: z.string(),
|
|
12534
|
+
externalRef: z.string().nullable(),
|
|
12535
|
+
externalUrl: z.string().nullable(),
|
|
12536
|
+
state: z.string().nullable(),
|
|
12537
|
+
decision: z.enum(["approved", "rejected"]).nullable()
|
|
12538
|
+
})
|
|
12539
|
+
)
|
|
12470
12540
|
});
|
|
12471
12541
|
var runEventSchema = z.discriminatedUnion("type", [
|
|
12472
12542
|
z.object({ type: z.literal("log"), text: z.string() }),
|
|
@@ -12474,8 +12544,11 @@ var runEventSchema = z.discriminatedUnion("type", [
|
|
|
12474
12544
|
z.object({
|
|
12475
12545
|
type: z.literal("gate"),
|
|
12476
12546
|
resolution: z.object({ mode: z.string(), reason: z.string().optional() }),
|
|
12477
|
-
changeRequest:
|
|
12478
|
-
})
|
|
12547
|
+
changeRequest: gateChangeRequestSchema.nullable()
|
|
12548
|
+
}).refine(
|
|
12549
|
+
(gate) => gate.resolution.mode === "awaiting_approval" === (gate.changeRequest !== null),
|
|
12550
|
+
{ message: "a gate event carries a change request exactly when it holds the Run" }
|
|
12551
|
+
),
|
|
12479
12552
|
z.object({
|
|
12480
12553
|
type: z.literal("result"),
|
|
12481
12554
|
run: runSchema,
|
|
@@ -12485,6 +12558,7 @@ var runEventSchema = z.discriminatedUnion("type", [
|
|
|
12485
12558
|
})
|
|
12486
12559
|
]);
|
|
12487
12560
|
var stackScanSchema = z.object({
|
|
12561
|
+
stack: stackIdentSchema,
|
|
12488
12562
|
triggered: z.boolean(),
|
|
12489
12563
|
reason: z.string().nullable(),
|
|
12490
12564
|
settled: z.object({
|
|
@@ -12492,14 +12566,17 @@ var stackScanSchema = z.object({
|
|
|
12492
12566
|
driftCount: z.number(),
|
|
12493
12567
|
scannedAt: z.string(),
|
|
12494
12568
|
undeterminedReason: z.string().nullable(),
|
|
12569
|
+
standingDriftFindings: z.number(),
|
|
12570
|
+
footprintDestroyed: z.boolean(),
|
|
12495
12571
|
drift: driftSchema
|
|
12496
12572
|
}).nullable()
|
|
12497
12573
|
});
|
|
12498
12574
|
var stackImportSchema = z.object({
|
|
12499
|
-
stack:
|
|
12575
|
+
stack: stackIdentSchema,
|
|
12500
12576
|
written: z.array(z.string()),
|
|
12577
|
+
removed: z.array(z.string()),
|
|
12501
12578
|
importBlocks: z.number(),
|
|
12502
|
-
importResiduals: z.array(
|
|
12579
|
+
importResiduals: z.array(importResidualSchema),
|
|
12503
12580
|
validate: moduleValidateResultSchema
|
|
12504
12581
|
});
|
|
12505
12582
|
var artifactRefSchema = z.object({ url: z.string(), key: z.string() });
|
|
@@ -12611,24 +12688,6 @@ function isBoundPath(path) {
|
|
|
12611
12688
|
function parseBound(path, data) {
|
|
12612
12689
|
return SCHEMAS[path].parse(data);
|
|
12613
12690
|
}
|
|
12614
|
-
var REASON_PREFIX = "REASON_";
|
|
12615
|
-
function reasonWire(reason) {
|
|
12616
|
-
return reasonToJSON(reason).slice(REASON_PREFIX.length).toLowerCase();
|
|
12617
|
-
}
|
|
12618
|
-
var LACE_REASONS = new Set(
|
|
12619
|
-
Object.values(Reason).filter((value) => typeof value === "number" && value !== -1 /* UNRECOGNIZED */).map(reasonWire)
|
|
12620
|
-
);
|
|
12621
|
-
var laceReasonSchema = z.custom(
|
|
12622
|
-
(value) => typeof value === "string" && LACE_REASONS.has(value),
|
|
12623
|
-
{ message: "not a reason of Lace\u2019s own" }
|
|
12624
|
-
);
|
|
12625
|
-
var commandFailureSchema = z.strictObject({
|
|
12626
|
-
reason: laceReasonSchema,
|
|
12627
|
-
message: z.string(),
|
|
12628
|
-
url: z.string().optional(),
|
|
12629
|
-
tool: z.string().optional(),
|
|
12630
|
-
apiCode: z.string().optional()
|
|
12631
|
-
});
|
|
12632
12691
|
var failureMarkSchema = z.object({ reason: z.string(), message: z.string() });
|
|
12633
12692
|
function carriesFailure(data) {
|
|
12634
12693
|
return failureMarkSchema.safeParse(data).success;
|
|
@@ -12636,6 +12695,12 @@ function carriesFailure(data) {
|
|
|
12636
12695
|
function parseCommandFailure(data) {
|
|
12637
12696
|
return commandFailureSchema.parse(data);
|
|
12638
12697
|
}
|
|
12698
|
+
function resultFailure(path, data) {
|
|
12699
|
+
const result = parseBound(path, data);
|
|
12700
|
+
if ("failure" in result) return result.failure;
|
|
12701
|
+
if ("validate" in result) return result.validate.failure;
|
|
12702
|
+
return void 0;
|
|
12703
|
+
}
|
|
12639
12704
|
|
|
12640
12705
|
// src/utils/is-plain-object.ts
|
|
12641
12706
|
function isPlainObject(val) {
|
|
@@ -12907,13 +12972,14 @@ function commandsPort(caller, commandPaths, ownCwd) {
|
|
|
12907
12972
|
throw new CommandExitError(
|
|
12908
12973
|
event.exit.code,
|
|
12909
12974
|
event.exit.stderr_tail,
|
|
12910
|
-
exitFailure(event.exit.document)
|
|
12975
|
+
exitFailure(path, event.exit.document)
|
|
12911
12976
|
);
|
|
12912
12977
|
}
|
|
12913
12978
|
return;
|
|
12914
12979
|
}
|
|
12915
12980
|
}
|
|
12916
|
-
throw new CommandDetachedError();
|
|
12981
|
+
if (signal.aborted) throw new CommandDetachedError();
|
|
12982
|
+
throw new CommandUnobservedError();
|
|
12917
12983
|
}
|
|
12918
12984
|
return {
|
|
12919
12985
|
events: run(),
|
|
@@ -12924,10 +12990,10 @@ function commandsPort(caller, commandPaths, ownCwd) {
|
|
|
12924
12990
|
}
|
|
12925
12991
|
};
|
|
12926
12992
|
}
|
|
12927
|
-
function exitFailure(document) {
|
|
12993
|
+
function exitFailure(path, document) {
|
|
12928
12994
|
if (document === "") return void 0;
|
|
12929
12995
|
const data = JSON.parse(document);
|
|
12930
|
-
return carriesFailure(data) ? parseCommandFailure(data) :
|
|
12996
|
+
return carriesFailure(data) ? parseCommandFailure(data) : resultFailure(path, data);
|
|
12931
12997
|
}
|
|
12932
12998
|
async function openSession(caller, target) {
|
|
12933
12999
|
if ("fixture" in target) {
|
|
@@ -13009,7 +13075,7 @@ function defineCommand(binding) {
|
|
|
13009
13075
|
if (!binding.confirm) return void 0;
|
|
13010
13076
|
const merged = completeArgs(binding.path, { ...binding.args(ctx, target), ...formArgs });
|
|
13011
13077
|
if (!merged.ok) return void 0;
|
|
13012
|
-
return binding.confirm(ctx, merged.args);
|
|
13078
|
+
return binding.confirm(ctx, merged.args, target);
|
|
13013
13079
|
},
|
|
13014
13080
|
async start(rt, ctx, target, formArgs, signal) {
|
|
13015
13081
|
const merged = completeArgs(binding.path, { ...binding.args(ctx, target), ...formArgs });
|
|
@@ -13068,6 +13134,21 @@ var destroy = defineCommand({
|
|
|
13068
13134
|
invalidates: "start+settle",
|
|
13069
13135
|
result: slotSink("run")
|
|
13070
13136
|
});
|
|
13137
|
+
function scanNotice(e) {
|
|
13138
|
+
const { slug } = e.stack;
|
|
13139
|
+
const settled = e.settled;
|
|
13140
|
+
if (!settled) {
|
|
13141
|
+
return e.triggered ? `Drift scan triggered for stack ${slug} (${e.stack.id}).` : `Drift scan already in progress for stack ${slug}.`;
|
|
13142
|
+
}
|
|
13143
|
+
if (settled.undeterminedReason !== null) return void 0;
|
|
13144
|
+
if (settled.footprintDestroyed) {
|
|
13145
|
+
return `Drift scan complete for stack ${slug}: IN_SYNC (0 drifted) \u2014 its resources were destroyed, so there was nothing to compare.`;
|
|
13146
|
+
}
|
|
13147
|
+
if (settled.standingDriftFindings > 0) {
|
|
13148
|
+
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.`;
|
|
13149
|
+
}
|
|
13150
|
+
return `Drift scan complete for stack ${slug}: ${settled.driftStatus} (${settled.driftCount} drifted).`;
|
|
13151
|
+
}
|
|
13071
13152
|
var scan = defineCommand({
|
|
13072
13153
|
kind: "command",
|
|
13073
13154
|
path: "stack scan",
|
|
@@ -13076,14 +13157,8 @@ var scan = defineCommand({
|
|
|
13076
13157
|
result: {
|
|
13077
13158
|
kind: "notify",
|
|
13078
13159
|
consume: (rt, e) => {
|
|
13079
|
-
|
|
13080
|
-
|
|
13081
|
-
return;
|
|
13082
|
-
}
|
|
13083
|
-
rt.ports.presenter.notify(
|
|
13084
|
-
"info",
|
|
13085
|
-
e.settled ? `Scan complete \u2014 ${e.settled.driftStatus}` : "Scan triggered"
|
|
13086
|
-
);
|
|
13160
|
+
const notice = scanNotice(e);
|
|
13161
|
+
if (notice !== void 0) rt.ports.presenter.notify("info", notice);
|
|
13087
13162
|
}
|
|
13088
13163
|
}
|
|
13089
13164
|
});
|
|
@@ -13097,15 +13172,51 @@ var create = defineCommand({
|
|
|
13097
13172
|
consume: (rt, e) => rt.ports.presenter.notify("info", `Created stack ${e.slug}`)
|
|
13098
13173
|
}
|
|
13099
13174
|
});
|
|
13175
|
+
function residualAddresses(residuals) {
|
|
13176
|
+
return residuals.map((r) => r.address).join(", ");
|
|
13177
|
+
}
|
|
13178
|
+
function treeChanges(e) {
|
|
13179
|
+
return [
|
|
13180
|
+
...e.written.length === 0 ? [] : [`rewriting ${e.written.join(", ")} in place`],
|
|
13181
|
+
...e.removed.length === 0 ? [] : [`removing ${e.removed.join(", ")}`]
|
|
13182
|
+
];
|
|
13183
|
+
}
|
|
13184
|
+
function importNotice(e) {
|
|
13185
|
+
const { slug } = e.stack;
|
|
13186
|
+
const changes = treeChanges(e);
|
|
13187
|
+
const changed = changes.length > 0;
|
|
13188
|
+
const files = changed ? `, ${changes.join(" and ")}` : "";
|
|
13189
|
+
const imported = `Imported ${e.importBlocks} resource(s) into ${slug}${files}.`;
|
|
13190
|
+
if (e.validate.exitClass !== "ok") {
|
|
13191
|
+
return ["warn", `${imported} The tree did not validate: fix it before you commit it.`];
|
|
13192
|
+
}
|
|
13193
|
+
const adopt = changed ? ` Review the change in git, commit it, then apply ${slug} to adopt them.` : "";
|
|
13194
|
+
if (e.importResiduals.length === 0) return ["info", `${imported}${adopt}`];
|
|
13195
|
+
return [
|
|
13196
|
+
"warn",
|
|
13197
|
+
`${imported}${adopt} Not adopted: ${residualAddresses(e.importResiduals)}; supply their import ids before applying, or the apply creates them anew.`
|
|
13198
|
+
];
|
|
13199
|
+
}
|
|
13200
|
+
var importResult = {
|
|
13201
|
+
kind: "notify",
|
|
13202
|
+
consume: (rt, e) => rt.ports.presenter.notify(...importNotice(e))
|
|
13203
|
+
};
|
|
13100
13204
|
var importStack = defineCommand({
|
|
13101
13205
|
kind: "command",
|
|
13102
13206
|
path: "stack import",
|
|
13103
13207
|
args: (ctx) => ({ stack: ctx.stack?.id }),
|
|
13104
13208
|
invalidates: true,
|
|
13105
|
-
result:
|
|
13106
|
-
|
|
13107
|
-
|
|
13108
|
-
|
|
13209
|
+
result: importResult
|
|
13210
|
+
});
|
|
13211
|
+
var importPartial = defineCommand({
|
|
13212
|
+
kind: "command",
|
|
13213
|
+
path: "stack import",
|
|
13214
|
+
args: (ctx) => ({ stack: ctx.stack?.id, allowPartial: true }),
|
|
13215
|
+
confirm: (ctx, _args, target) => ({
|
|
13216
|
+
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.`
|
|
13217
|
+
}),
|
|
13218
|
+
invalidates: true,
|
|
13219
|
+
result: importResult
|
|
13109
13220
|
});
|
|
13110
13221
|
var validate = defineCommand({
|
|
13111
13222
|
kind: "command",
|
|
@@ -13173,12 +13284,14 @@ var MODULE_COMMAND_ACTIONS = [
|
|
|
13173
13284
|
requiredContext: ["root"],
|
|
13174
13285
|
binding: convert
|
|
13175
13286
|
},
|
|
13176
|
-
//
|
|
13177
|
-
// the same `module convert` the toolbar runs
|
|
13178
|
-
//
|
|
13287
|
+
// Convert on the source-refused banner while the tree is out of lace
|
|
13288
|
+
// shape: the same `module convert` the toolbar runs, and the choice the
|
|
13289
|
+
// banner says of it. The engine re-derives the tree it writes, which
|
|
13290
|
+
// accepts it and lifts the lock.
|
|
13179
13291
|
{
|
|
13180
13292
|
id: "convert-refused",
|
|
13181
13293
|
label: "Convert",
|
|
13294
|
+
choice: "Convert restructures it in place; a stack's apply creates only what its state does not hold yet.",
|
|
13182
13295
|
icon: "convert",
|
|
13183
13296
|
placement: { row: "source-refused" },
|
|
13184
13297
|
requiredPorts: ["commands"],
|
|
@@ -13228,7 +13341,7 @@ var STACK_COMMAND_ACTIONS = [
|
|
|
13228
13341
|
},
|
|
13229
13342
|
{
|
|
13230
13343
|
id: "import",
|
|
13231
|
-
label: "Import
|
|
13344
|
+
label: "Import existing resources",
|
|
13232
13345
|
placement: "toolbar",
|
|
13233
13346
|
requiredPorts: ["commands"],
|
|
13234
13347
|
// `stack import` writes the directory it runs in, the same way
|
|
@@ -13236,6 +13349,15 @@ var STACK_COMMAND_ACTIONS = [
|
|
|
13236
13349
|
requiredContext: ["root", "stack"],
|
|
13237
13350
|
binding: importStack
|
|
13238
13351
|
},
|
|
13352
|
+
{
|
|
13353
|
+
id: "import-partial",
|
|
13354
|
+
label: "Import the rest",
|
|
13355
|
+
placement: { row: "failure" },
|
|
13356
|
+
requiredPorts: ["commands"],
|
|
13357
|
+
requiredContext: ["root", "stack"],
|
|
13358
|
+
answers: ["import_residual"],
|
|
13359
|
+
binding: importPartial
|
|
13360
|
+
},
|
|
13239
13361
|
{
|
|
13240
13362
|
id: "preview",
|
|
13241
13363
|
label: "Preview",
|
|
@@ -13406,10 +13528,10 @@ function reduceRun(prev, token, event) {
|
|
|
13406
13528
|
const lastLog = event.type === "log" ? event.text : carried?.lastLog ?? null;
|
|
13407
13529
|
const phases = event.type === "phase" ? withPhase(carried?.phases ?? [], event.name) : carried?.phases ?? [];
|
|
13408
13530
|
const submitted = carried?.submitted || event.type === "phase" && event.name === "submit";
|
|
13409
|
-
if (event.type === "gate" && event.
|
|
13531
|
+
if (event.type === "gate" && event.changeRequest !== null) {
|
|
13410
13532
|
return {
|
|
13411
13533
|
token,
|
|
13412
|
-
outcome: { kind: "awaiting-approval",
|
|
13534
|
+
outcome: { kind: "awaiting-approval", changeRequest: event.changeRequest, runUrl: null },
|
|
13413
13535
|
lastLog,
|
|
13414
13536
|
submitted,
|
|
13415
13537
|
phases: closePhases(phases)
|
|
@@ -13417,7 +13539,13 @@ function reduceRun(prev, token, event) {
|
|
|
13417
13539
|
}
|
|
13418
13540
|
if (event.type === "result") {
|
|
13419
13541
|
if (carried?.outcome.kind === "awaiting-approval") {
|
|
13420
|
-
return {
|
|
13542
|
+
return {
|
|
13543
|
+
token,
|
|
13544
|
+
outcome: { ...carried.outcome, runUrl: event.run.url ?? null },
|
|
13545
|
+
lastLog,
|
|
13546
|
+
submitted,
|
|
13547
|
+
phases
|
|
13548
|
+
};
|
|
13421
13549
|
}
|
|
13422
13550
|
if (event.error)
|
|
13423
13551
|
return {
|
|
@@ -13445,7 +13573,7 @@ function settleRun(prev, token, error) {
|
|
|
13445
13573
|
const lastLog = carried?.lastLog ?? null;
|
|
13446
13574
|
const submitted = carried?.submitted ?? false;
|
|
13447
13575
|
const phases = closePhases(carried?.phases ?? []);
|
|
13448
|
-
if (error instanceof CommandDetachedError)
|
|
13576
|
+
if (error instanceof CommandDetachedError || error instanceof CommandUnobservedError)
|
|
13449
13577
|
return { token, outcome: { kind: "detached", submitted }, lastLog, submitted, phases };
|
|
13450
13578
|
if (error instanceof CommandExitError) {
|
|
13451
13579
|
if (error.code === 130)
|
|
@@ -13589,7 +13717,7 @@ var CONTEXT_NEEDS = {
|
|
|
13589
13717
|
resolved: "no open Keep or Reload conflict",
|
|
13590
13718
|
conflict: "an open Keep or Reload conflict",
|
|
13591
13719
|
sourceRefused: "the source-refused lock",
|
|
13592
|
-
needsConversion: "a tree
|
|
13720
|
+
needsConversion: "a tree out of lace shape",
|
|
13593
13721
|
"selection.node": "a selected node",
|
|
13594
13722
|
"selection.edge": "a selected connection",
|
|
13595
13723
|
diagnostics: "diagnostics to show",
|
|
@@ -13604,7 +13732,8 @@ var TARGET_NEEDS = {
|
|
|
13604
13732
|
nodeId: "a node",
|
|
13605
13733
|
groupId: "a group",
|
|
13606
13734
|
diagnostic: "a diagnostic",
|
|
13607
|
-
runId: "a run"
|
|
13735
|
+
runId: "a run",
|
|
13736
|
+
failure: "a failed command"
|
|
13608
13737
|
};
|
|
13609
13738
|
var BUSY_REASON = "A run is in progress";
|
|
13610
13739
|
function keySatisfied(ctx, key) {
|
|
@@ -13679,6 +13808,12 @@ function unmetRequirement(action, ports, ctx, target) {
|
|
|
13679
13808
|
if (key !== void 0) return `${label} needs ${CONTEXT_NEEDS[key]}`;
|
|
13680
13809
|
const targetKey = (action.requiredTarget ?? []).find((k) => target[k] === void 0);
|
|
13681
13810
|
if (targetKey !== void 0) return `${label} needs ${TARGET_NEEDS[targetKey]}`;
|
|
13811
|
+
if (action.answers !== void 0) {
|
|
13812
|
+
if (target.failure === void 0) return `${label} needs ${TARGET_NEEDS.failure}`;
|
|
13813
|
+
if (!action.answers.includes(target.failure.reason)) {
|
|
13814
|
+
return `${label} does not answer this failure`;
|
|
13815
|
+
}
|
|
13816
|
+
}
|
|
13682
13817
|
if (binding.kind === "command" && !availableCommands(ports).has(binding.path)) {
|
|
13683
13818
|
return `${label} runs lace ${binding.path}, which this host does not route`;
|
|
13684
13819
|
}
|
|
@@ -14058,12 +14193,13 @@ export {
|
|
|
14058
14193
|
CommandExitError,
|
|
14059
14194
|
ConnectError,
|
|
14060
14195
|
CommandDetachedError,
|
|
14196
|
+
CommandUnobservedError,
|
|
14061
14197
|
COMMANDS,
|
|
14062
14198
|
toArgv,
|
|
14199
|
+
reasonWire,
|
|
14063
14200
|
SCHEMAS,
|
|
14064
14201
|
isBoundPath,
|
|
14065
14202
|
parseBound,
|
|
14066
|
-
reasonWire,
|
|
14067
14203
|
carriesFailure,
|
|
14068
14204
|
parseCommandFailure,
|
|
14069
14205
|
defineCommand,
|
|
@@ -14090,4 +14226,4 @@ export {
|
|
|
14090
14226
|
AutosaveEndedError,
|
|
14091
14227
|
autosave
|
|
14092
14228
|
};
|
|
14093
|
-
//# sourceMappingURL=chunk-
|
|
14229
|
+
//# sourceMappingURL=chunk-HZWABSPP.mjs.map
|