@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/dist/engine/index.cjs
CHANGED
|
@@ -26,11 +26,13 @@ __export(engine_exports, {
|
|
|
26
26
|
CORE_COMMAND_ACTIONS: () => CORE_COMMAND_ACTIONS,
|
|
27
27
|
CommandDetachedError: () => CommandDetachedError,
|
|
28
28
|
CommandExitError: () => CommandExitError,
|
|
29
|
+
CommandUnobservedError: () => CommandUnobservedError,
|
|
29
30
|
ConnectError: () => ConnectError,
|
|
30
31
|
EMPTY_REPORT_FOLD: () => EMPTY_REPORT_FOLD,
|
|
31
32
|
InputMode: () => InputMode,
|
|
32
33
|
Reason: () => Reason,
|
|
33
34
|
SCHEMAS: () => SCHEMAS,
|
|
35
|
+
answering: () => answering,
|
|
34
36
|
autosave: () => autosave,
|
|
35
37
|
bridgeCaller: () => bridgeCaller,
|
|
36
38
|
carriesFailure: () => carriesFailure,
|
|
@@ -3441,6 +3443,11 @@ var Reason = /* @__PURE__ */ ((Reason2) => {
|
|
|
3441
3443
|
Reason2[Reason2["REASON_TOOL_MISSING"] = 14] = "REASON_TOOL_MISSING";
|
|
3442
3444
|
Reason2[Reason2["REASON_CROSS_SCOPE"] = 15] = "REASON_CROSS_SCOPE";
|
|
3443
3445
|
Reason2[Reason2["REASON_UNAUTHENTICATED"] = 16] = "REASON_UNAUTHENTICATED";
|
|
3446
|
+
Reason2[Reason2["REASON_IMPORT_RESIDUAL"] = 17] = "REASON_IMPORT_RESIDUAL";
|
|
3447
|
+
Reason2[Reason2["REASON_STACK_HAS_STATE"] = 18] = "REASON_STACK_HAS_STATE";
|
|
3448
|
+
Reason2[Reason2["REASON_NO_ORIGIN_REMOTE"] = 19] = "REASON_NO_ORIGIN_REMOTE";
|
|
3449
|
+
Reason2[Reason2["REASON_IMPORT_UNDECLARED"] = 20] = "REASON_IMPORT_UNDECLARED";
|
|
3450
|
+
Reason2[Reason2["REASON_ALREADY_IMPORTED"] = 21] = "REASON_ALREADY_IMPORTED";
|
|
3444
3451
|
Reason2[Reason2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
3445
3452
|
return Reason2;
|
|
3446
3453
|
})(Reason || {});
|
|
@@ -3497,6 +3504,21 @@ function reasonFromJSON(object) {
|
|
|
3497
3504
|
case 16:
|
|
3498
3505
|
case "REASON_UNAUTHENTICATED":
|
|
3499
3506
|
return 16 /* REASON_UNAUTHENTICATED */;
|
|
3507
|
+
case 17:
|
|
3508
|
+
case "REASON_IMPORT_RESIDUAL":
|
|
3509
|
+
return 17 /* REASON_IMPORT_RESIDUAL */;
|
|
3510
|
+
case 18:
|
|
3511
|
+
case "REASON_STACK_HAS_STATE":
|
|
3512
|
+
return 18 /* REASON_STACK_HAS_STATE */;
|
|
3513
|
+
case 19:
|
|
3514
|
+
case "REASON_NO_ORIGIN_REMOTE":
|
|
3515
|
+
return 19 /* REASON_NO_ORIGIN_REMOTE */;
|
|
3516
|
+
case 20:
|
|
3517
|
+
case "REASON_IMPORT_UNDECLARED":
|
|
3518
|
+
return 20 /* REASON_IMPORT_UNDECLARED */;
|
|
3519
|
+
case 21:
|
|
3520
|
+
case "REASON_ALREADY_IMPORTED":
|
|
3521
|
+
return 21 /* REASON_ALREADY_IMPORTED */;
|
|
3500
3522
|
case -1:
|
|
3501
3523
|
case "UNRECOGNIZED":
|
|
3502
3524
|
default:
|
|
@@ -3539,6 +3561,16 @@ function reasonToJSON(object) {
|
|
|
3539
3561
|
return "REASON_CROSS_SCOPE";
|
|
3540
3562
|
case 16 /* REASON_UNAUTHENTICATED */:
|
|
3541
3563
|
return "REASON_UNAUTHENTICATED";
|
|
3564
|
+
case 17 /* REASON_IMPORT_RESIDUAL */:
|
|
3565
|
+
return "REASON_IMPORT_RESIDUAL";
|
|
3566
|
+
case 18 /* REASON_STACK_HAS_STATE */:
|
|
3567
|
+
return "REASON_STACK_HAS_STATE";
|
|
3568
|
+
case 19 /* REASON_NO_ORIGIN_REMOTE */:
|
|
3569
|
+
return "REASON_NO_ORIGIN_REMOTE";
|
|
3570
|
+
case 20 /* REASON_IMPORT_UNDECLARED */:
|
|
3571
|
+
return "REASON_IMPORT_UNDECLARED";
|
|
3572
|
+
case 21 /* REASON_ALREADY_IMPORTED */:
|
|
3573
|
+
return "REASON_ALREADY_IMPORTED";
|
|
3542
3574
|
case -1 /* UNRECOGNIZED */:
|
|
3543
3575
|
default:
|
|
3544
3576
|
return "UNRECOGNIZED";
|
|
@@ -10446,6 +10478,13 @@ var CommandDetachedError = class extends Error {
|
|
|
10446
10478
|
super("command detached: the invoking consumer stopped listening");
|
|
10447
10479
|
}
|
|
10448
10480
|
};
|
|
10481
|
+
var CommandUnobservedError = class extends Error {
|
|
10482
|
+
constructor() {
|
|
10483
|
+
super(
|
|
10484
|
+
"the engine's stream ended before the command exited: the command ran and may have made changes, but its outcome is unknown"
|
|
10485
|
+
);
|
|
10486
|
+
}
|
|
10487
|
+
};
|
|
10449
10488
|
|
|
10450
10489
|
// src/adapters/engine/connect-frame.ts
|
|
10451
10490
|
var END_STREAM_FLAG = 2;
|
|
@@ -10482,8 +10521,13 @@ async function* readConnectFrames(body, signal) {
|
|
|
10482
10521
|
try {
|
|
10483
10522
|
while (!signal.aborted) {
|
|
10484
10523
|
const { value, done } = await reader.read();
|
|
10485
|
-
if (done) return;
|
|
10486
10524
|
if (signal.aborted) return;
|
|
10525
|
+
if (done) {
|
|
10526
|
+
throw new ConnectError(
|
|
10527
|
+
"internal",
|
|
10528
|
+
"the engine's stream was cut off before its end-of-stream frame"
|
|
10529
|
+
);
|
|
10530
|
+
}
|
|
10487
10531
|
if (!value) continue;
|
|
10488
10532
|
chunks.push(value);
|
|
10489
10533
|
bufferedLen += value.length;
|
|
@@ -12105,6 +12149,31 @@ function completeArgs(path, partial) {
|
|
|
12105
12149
|
|
|
12106
12150
|
// src/contracts/schemas.ts
|
|
12107
12151
|
var import_zod = require("zod");
|
|
12152
|
+
var REASON_PREFIX = "REASON_";
|
|
12153
|
+
function reasonWire(reason) {
|
|
12154
|
+
return reasonToJSON(reason).slice(REASON_PREFIX.length).toLowerCase();
|
|
12155
|
+
}
|
|
12156
|
+
var LACE_REASONS = new Set(
|
|
12157
|
+
Object.values(Reason).filter((value) => typeof value === "number" && value !== -1 /* UNRECOGNIZED */).map(reasonWire)
|
|
12158
|
+
);
|
|
12159
|
+
var laceReasonSchema = import_zod.z.custom(
|
|
12160
|
+
(value) => typeof value === "string" && LACE_REASONS.has(value),
|
|
12161
|
+
{ message: "not a reason of Lace\u2019s own" }
|
|
12162
|
+
);
|
|
12163
|
+
var importResidualSchema = import_zod.z.object({
|
|
12164
|
+
address: import_zod.z.string(),
|
|
12165
|
+
type: import_zod.z.string(),
|
|
12166
|
+
reason: import_zod.z.string()
|
|
12167
|
+
});
|
|
12168
|
+
var commandFailureSchema = import_zod.z.strictObject({
|
|
12169
|
+
reason: laceReasonSchema,
|
|
12170
|
+
message: import_zod.z.string(),
|
|
12171
|
+
url: import_zod.z.string().optional(),
|
|
12172
|
+
tool: import_zod.z.string().optional(),
|
|
12173
|
+
importResiduals: import_zod.z.array(importResidualSchema).optional(),
|
|
12174
|
+
addresses: import_zod.z.array(import_zod.z.string()).optional(),
|
|
12175
|
+
apiCode: import_zod.z.string().optional()
|
|
12176
|
+
});
|
|
12108
12177
|
var moduleValidateDeviationSchema = import_zod.z.object({
|
|
12109
12178
|
notCompositional: import_zod.z.boolean(),
|
|
12110
12179
|
clusters: import_zod.z.array(import_zod.z.unknown()),
|
|
@@ -12156,6 +12225,7 @@ var moduleValidateResultSchema = import_zod.z.object({
|
|
|
12156
12225
|
}).optional(),
|
|
12157
12226
|
modules: import_zod.z.array(import_zod.z.object({ address: import_zod.z.string(), version: import_zod.z.string(), treeHash: import_zod.z.string() })).optional(),
|
|
12158
12227
|
exitClass: import_zod.z.string(),
|
|
12228
|
+
failure: commandFailureSchema.optional(),
|
|
12159
12229
|
diagnostics: import_zod.z.array(commandDiagnosticSchema)
|
|
12160
12230
|
});
|
|
12161
12231
|
var moduleConvertResultSchema = import_zod.z.object({
|
|
@@ -12266,6 +12336,7 @@ var registryDescribeSchema = import_zod.z.object({
|
|
|
12266
12336
|
)
|
|
12267
12337
|
})
|
|
12268
12338
|
});
|
|
12339
|
+
var stackIdentSchema = import_zod.z.object({ id: import_zod.z.string(), slug: import_zod.z.string() });
|
|
12269
12340
|
var stackSourceSchema = import_zod.z.object({
|
|
12270
12341
|
kind: import_zod.z.literal("git"),
|
|
12271
12342
|
repoUrl: import_zod.z.string(),
|
|
@@ -12449,7 +12520,7 @@ var previewEntrySchema = import_zod.z.discriminatedUnion("kind", [
|
|
|
12449
12520
|
})
|
|
12450
12521
|
]);
|
|
12451
12522
|
var stackPreviewSchema = import_zod.z.object({
|
|
12452
|
-
stack:
|
|
12523
|
+
stack: stackIdentSchema,
|
|
12453
12524
|
treeHash: import_zod.z.string(),
|
|
12454
12525
|
plan: import_zod.z.object({ summary: planSummarySchema, human: import_zod.z.string() }),
|
|
12455
12526
|
policy: import_zod.z.object({
|
|
@@ -12496,16 +12567,19 @@ var gateChangeRequestSchema = import_zod.z.object({
|
|
|
12496
12567
|
import_zod.z.object({
|
|
12497
12568
|
id: import_zod.z.string(),
|
|
12498
12569
|
state: import_zod.z.string(),
|
|
12499
|
-
decidedBy: import_zod.z.enum(["lace", "ecm"])
|
|
12570
|
+
decidedBy: import_zod.z.enum(["lace", "ecm"]),
|
|
12571
|
+
recordId: import_zod.z.string().nullable()
|
|
12500
12572
|
})
|
|
12501
12573
|
),
|
|
12502
12574
|
records: import_zod.z.array(
|
|
12503
12575
|
import_zod.z.object({
|
|
12576
|
+
id: import_zod.z.string(),
|
|
12504
12577
|
externalSystemId: import_zod.z.string(),
|
|
12505
12578
|
kind: import_zod.z.string(),
|
|
12506
12579
|
externalRef: import_zod.z.string().nullable(),
|
|
12507
12580
|
externalUrl: import_zod.z.string().nullable(),
|
|
12508
|
-
state: import_zod.z.string().nullable()
|
|
12581
|
+
state: import_zod.z.string().nullable(),
|
|
12582
|
+
decision: import_zod.z.enum(["approved", "rejected"]).nullable()
|
|
12509
12583
|
})
|
|
12510
12584
|
)
|
|
12511
12585
|
});
|
|
@@ -12529,6 +12603,7 @@ var runEventSchema = import_zod.z.discriminatedUnion("type", [
|
|
|
12529
12603
|
})
|
|
12530
12604
|
]);
|
|
12531
12605
|
var stackScanSchema = import_zod.z.object({
|
|
12606
|
+
stack: stackIdentSchema,
|
|
12532
12607
|
triggered: import_zod.z.boolean(),
|
|
12533
12608
|
reason: import_zod.z.string().nullable(),
|
|
12534
12609
|
settled: import_zod.z.object({
|
|
@@ -12536,15 +12611,15 @@ var stackScanSchema = import_zod.z.object({
|
|
|
12536
12611
|
driftCount: import_zod.z.number(),
|
|
12537
12612
|
scannedAt: import_zod.z.string(),
|
|
12538
12613
|
undeterminedReason: import_zod.z.string().nullable(),
|
|
12614
|
+
standingDriftFindings: import_zod.z.number(),
|
|
12615
|
+
footprintDestroyed: import_zod.z.boolean(),
|
|
12539
12616
|
drift: driftSchema
|
|
12540
12617
|
}).nullable()
|
|
12541
12618
|
});
|
|
12542
|
-
var stackImportSchema =
|
|
12543
|
-
stack:
|
|
12544
|
-
written: import_zod.z.array(import_zod.z.string()),
|
|
12619
|
+
var stackImportSchema = moduleConvertResultSchema.extend({
|
|
12620
|
+
stack: stackIdentSchema,
|
|
12545
12621
|
importBlocks: import_zod.z.number(),
|
|
12546
|
-
importResiduals: import_zod.z.array(
|
|
12547
|
-
validate: moduleValidateResultSchema
|
|
12622
|
+
importResiduals: import_zod.z.array(importResidualSchema)
|
|
12548
12623
|
});
|
|
12549
12624
|
var artifactRefSchema = import_zod.z.object({ url: import_zod.z.string(), key: import_zod.z.string() });
|
|
12550
12625
|
var runPlanSchema = import_zod.z.object({
|
|
@@ -12655,24 +12730,6 @@ function isBoundPath(path) {
|
|
|
12655
12730
|
function parseBound(path, data) {
|
|
12656
12731
|
return SCHEMAS[path].parse(data);
|
|
12657
12732
|
}
|
|
12658
|
-
var REASON_PREFIX = "REASON_";
|
|
12659
|
-
function reasonWire(reason) {
|
|
12660
|
-
return reasonToJSON(reason).slice(REASON_PREFIX.length).toLowerCase();
|
|
12661
|
-
}
|
|
12662
|
-
var LACE_REASONS = new Set(
|
|
12663
|
-
Object.values(Reason).filter((value) => typeof value === "number" && value !== -1 /* UNRECOGNIZED */).map(reasonWire)
|
|
12664
|
-
);
|
|
12665
|
-
var laceReasonSchema = import_zod.z.custom(
|
|
12666
|
-
(value) => typeof value === "string" && LACE_REASONS.has(value),
|
|
12667
|
-
{ message: "not a reason of Lace\u2019s own" }
|
|
12668
|
-
);
|
|
12669
|
-
var commandFailureSchema = import_zod.z.strictObject({
|
|
12670
|
-
reason: laceReasonSchema,
|
|
12671
|
-
message: import_zod.z.string(),
|
|
12672
|
-
url: import_zod.z.string().optional(),
|
|
12673
|
-
tool: import_zod.z.string().optional(),
|
|
12674
|
-
apiCode: import_zod.z.string().optional()
|
|
12675
|
-
});
|
|
12676
12733
|
var failureMarkSchema = import_zod.z.object({ reason: import_zod.z.string(), message: import_zod.z.string() });
|
|
12677
12734
|
function carriesFailure(data) {
|
|
12678
12735
|
return failureMarkSchema.safeParse(data).success;
|
|
@@ -12680,6 +12737,12 @@ function carriesFailure(data) {
|
|
|
12680
12737
|
function parseCommandFailure(data) {
|
|
12681
12738
|
return commandFailureSchema.parse(data);
|
|
12682
12739
|
}
|
|
12740
|
+
function resultFailure(path, data) {
|
|
12741
|
+
const result = parseBound(path, data);
|
|
12742
|
+
if ("failure" in result) return result.failure;
|
|
12743
|
+
if ("validate" in result) return result.validate.failure;
|
|
12744
|
+
return void 0;
|
|
12745
|
+
}
|
|
12683
12746
|
|
|
12684
12747
|
// src/utils/is-plain-object.ts
|
|
12685
12748
|
function isPlainObject(val) {
|
|
@@ -12793,6 +12856,7 @@ async function openEngineSession(caller, target, options = {}) {
|
|
|
12793
12856
|
revisionWaiters.clear();
|
|
12794
12857
|
}
|
|
12795
12858
|
function publishCommandResult(result) {
|
|
12859
|
+
commandResults.delete(result.path);
|
|
12796
12860
|
commandResults.set(result.path, result);
|
|
12797
12861
|
for (const listener of commandResultListeners) deliver(listener, result);
|
|
12798
12862
|
}
|
|
@@ -12951,13 +13015,14 @@ function commandsPort(caller, commandPaths, ownCwd) {
|
|
|
12951
13015
|
throw new CommandExitError(
|
|
12952
13016
|
event.exit.code,
|
|
12953
13017
|
event.exit.stderr_tail,
|
|
12954
|
-
exitFailure(event.exit.document)
|
|
13018
|
+
exitFailure(path, event.exit.document)
|
|
12955
13019
|
);
|
|
12956
13020
|
}
|
|
12957
13021
|
return;
|
|
12958
13022
|
}
|
|
12959
13023
|
}
|
|
12960
|
-
throw new CommandDetachedError();
|
|
13024
|
+
if (signal.aborted) throw new CommandDetachedError();
|
|
13025
|
+
throw new CommandUnobservedError();
|
|
12961
13026
|
}
|
|
12962
13027
|
return {
|
|
12963
13028
|
events: run(),
|
|
@@ -12968,10 +13033,10 @@ function commandsPort(caller, commandPaths, ownCwd) {
|
|
|
12968
13033
|
}
|
|
12969
13034
|
};
|
|
12970
13035
|
}
|
|
12971
|
-
function exitFailure(document) {
|
|
13036
|
+
function exitFailure(path, document) {
|
|
12972
13037
|
if (document === "") return void 0;
|
|
12973
13038
|
const data = JSON.parse(document);
|
|
12974
|
-
return carriesFailure(data) ? parseCommandFailure(data) :
|
|
13039
|
+
return carriesFailure(data) ? parseCommandFailure(data) : resultFailure(path, data);
|
|
12975
13040
|
}
|
|
12976
13041
|
async function openSession(caller, target) {
|
|
12977
13042
|
if ("fixture" in target) {
|
|
@@ -13053,7 +13118,7 @@ function defineCommand(binding) {
|
|
|
13053
13118
|
if (!binding.confirm) return void 0;
|
|
13054
13119
|
const merged = completeArgs(binding.path, { ...binding.args(ctx, target), ...formArgs });
|
|
13055
13120
|
if (!merged.ok) return void 0;
|
|
13056
|
-
return binding.confirm(ctx, merged.args);
|
|
13121
|
+
return binding.confirm(ctx, merged.args, target);
|
|
13057
13122
|
},
|
|
13058
13123
|
async start(rt, ctx, target, formArgs, signal) {
|
|
13059
13124
|
const merged = completeArgs(binding.path, { ...binding.args(ctx, target), ...formArgs });
|
|
@@ -13112,6 +13177,21 @@ var destroy = defineCommand({
|
|
|
13112
13177
|
invalidates: "start+settle",
|
|
13113
13178
|
result: slotSink("run")
|
|
13114
13179
|
});
|
|
13180
|
+
function scanNotice(e) {
|
|
13181
|
+
const { slug } = e.stack;
|
|
13182
|
+
const settled = e.settled;
|
|
13183
|
+
if (!settled) {
|
|
13184
|
+
return e.triggered ? `Drift scan triggered for stack ${slug} (${e.stack.id}).` : `Drift scan already in progress for stack ${slug}.`;
|
|
13185
|
+
}
|
|
13186
|
+
if (settled.undeterminedReason !== null) return void 0;
|
|
13187
|
+
if (settled.footprintDestroyed) {
|
|
13188
|
+
return `Drift scan complete for stack ${slug}: IN_SYNC (0 drifted) \u2014 its resources were destroyed, so there was nothing to compare.`;
|
|
13189
|
+
}
|
|
13190
|
+
if (settled.standingDriftFindings > 0) {
|
|
13191
|
+
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.`;
|
|
13192
|
+
}
|
|
13193
|
+
return `Drift scan complete for stack ${slug}: ${settled.driftStatus} (${settled.driftCount} drifted).`;
|
|
13194
|
+
}
|
|
13115
13195
|
var scan = defineCommand({
|
|
13116
13196
|
kind: "command",
|
|
13117
13197
|
path: "stack scan",
|
|
@@ -13120,14 +13200,8 @@ var scan = defineCommand({
|
|
|
13120
13200
|
result: {
|
|
13121
13201
|
kind: "notify",
|
|
13122
13202
|
consume: (rt, e) => {
|
|
13123
|
-
|
|
13124
|
-
|
|
13125
|
-
return;
|
|
13126
|
-
}
|
|
13127
|
-
rt.ports.presenter.notify(
|
|
13128
|
-
"info",
|
|
13129
|
-
e.settled ? `Scan complete \u2014 ${e.settled.driftStatus}` : "Scan triggered"
|
|
13130
|
-
);
|
|
13203
|
+
const notice = scanNotice(e);
|
|
13204
|
+
if (notice !== void 0) rt.ports.presenter.notify("info", notice);
|
|
13131
13205
|
}
|
|
13132
13206
|
}
|
|
13133
13207
|
});
|
|
@@ -13141,15 +13215,50 @@ var create = defineCommand({
|
|
|
13141
13215
|
consume: (rt, e) => rt.ports.presenter.notify("info", `Created stack ${e.slug}`)
|
|
13142
13216
|
}
|
|
13143
13217
|
});
|
|
13218
|
+
function residualAddresses(residuals) {
|
|
13219
|
+
return residuals.map((r) => r.address).join(", ");
|
|
13220
|
+
}
|
|
13221
|
+
function treeChanges(e) {
|
|
13222
|
+
return [
|
|
13223
|
+
...e.written.length === 0 ? [] : [`rewriting ${e.written.join(", ")} in place`],
|
|
13224
|
+
...e.removed.length === 0 ? [] : [`removing ${e.removed.join(", ")}`]
|
|
13225
|
+
];
|
|
13226
|
+
}
|
|
13227
|
+
function importNotice(e) {
|
|
13228
|
+
const { slug } = e.stack;
|
|
13229
|
+
const changes = treeChanges(e);
|
|
13230
|
+
const files = changes.length > 0 ? `, ${changes.join(" and ")}` : "";
|
|
13231
|
+
const imported = `Imported ${e.importBlocks} resource(s) into ${slug}${files}.`;
|
|
13232
|
+
if (e.validate.exitClass !== "ok") {
|
|
13233
|
+
return ["warn", `${imported} The tree did not validate: fix it before you commit it.`];
|
|
13234
|
+
}
|
|
13235
|
+
const adopt = e.changed ? ` Review the change in git, commit it, then apply ${slug} to adopt them.` : "";
|
|
13236
|
+
if (e.importResiduals.length === 0) return ["info", `${imported}${adopt}`];
|
|
13237
|
+
return [
|
|
13238
|
+
"warn",
|
|
13239
|
+
`${imported}${adopt} Not adopted: ${residualAddresses(e.importResiduals)}; supply their import ids before applying, or the apply creates them anew.`
|
|
13240
|
+
];
|
|
13241
|
+
}
|
|
13242
|
+
var importResult = {
|
|
13243
|
+
kind: "notify",
|
|
13244
|
+
consume: (rt, e) => rt.ports.presenter.notify(...importNotice(e))
|
|
13245
|
+
};
|
|
13144
13246
|
var importStack = defineCommand({
|
|
13145
13247
|
kind: "command",
|
|
13146
13248
|
path: "stack import",
|
|
13147
13249
|
args: (ctx) => ({ stack: ctx.stack?.id }),
|
|
13148
13250
|
invalidates: true,
|
|
13149
|
-
result:
|
|
13150
|
-
|
|
13151
|
-
|
|
13152
|
-
|
|
13251
|
+
result: importResult
|
|
13252
|
+
});
|
|
13253
|
+
var importPartial = defineCommand({
|
|
13254
|
+
kind: "command",
|
|
13255
|
+
path: "stack import",
|
|
13256
|
+
args: (ctx) => ({ stack: ctx.stack?.id, allowPartial: true }),
|
|
13257
|
+
confirm: (ctx, _args, target) => ({
|
|
13258
|
+
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.`
|
|
13259
|
+
}),
|
|
13260
|
+
invalidates: true,
|
|
13261
|
+
result: importResult
|
|
13153
13262
|
});
|
|
13154
13263
|
var validate = defineCommand({
|
|
13155
13264
|
kind: "command",
|
|
@@ -13217,12 +13326,14 @@ var MODULE_COMMAND_ACTIONS = [
|
|
|
13217
13326
|
requiredContext: ["root"],
|
|
13218
13327
|
binding: convert
|
|
13219
13328
|
},
|
|
13220
|
-
//
|
|
13221
|
-
// the same `module convert` the toolbar runs
|
|
13222
|
-
//
|
|
13329
|
+
// Convert on the source-refused banner while the tree is out of lace
|
|
13330
|
+
// shape: the same `module convert` the toolbar runs, and the choice the
|
|
13331
|
+
// banner says of it. The engine re-derives the tree it writes, which
|
|
13332
|
+
// accepts it and lifts the lock.
|
|
13223
13333
|
{
|
|
13224
13334
|
id: "convert-refused",
|
|
13225
13335
|
label: "Convert",
|
|
13336
|
+
choice: "Convert restructures it in place; a stack's apply creates only what its state does not hold yet.",
|
|
13226
13337
|
icon: "convert",
|
|
13227
13338
|
placement: { row: "source-refused" },
|
|
13228
13339
|
requiredPorts: ["commands"],
|
|
@@ -13272,7 +13383,7 @@ var STACK_COMMAND_ACTIONS = [
|
|
|
13272
13383
|
},
|
|
13273
13384
|
{
|
|
13274
13385
|
id: "import",
|
|
13275
|
-
label: "Import
|
|
13386
|
+
label: "Import existing resources",
|
|
13276
13387
|
placement: "toolbar",
|
|
13277
13388
|
requiredPorts: ["commands"],
|
|
13278
13389
|
// `stack import` writes the directory it runs in, the same way
|
|
@@ -13280,6 +13391,15 @@ var STACK_COMMAND_ACTIONS = [
|
|
|
13280
13391
|
requiredContext: ["root", "stack"],
|
|
13281
13392
|
binding: importStack
|
|
13282
13393
|
},
|
|
13394
|
+
{
|
|
13395
|
+
id: "import-partial",
|
|
13396
|
+
label: "Import the rest",
|
|
13397
|
+
placement: { row: "failure" },
|
|
13398
|
+
requiredPorts: ["commands"],
|
|
13399
|
+
requiredContext: ["root", "stack"],
|
|
13400
|
+
answers: ["import_residual"],
|
|
13401
|
+
binding: importPartial
|
|
13402
|
+
},
|
|
13283
13403
|
{
|
|
13284
13404
|
id: "preview",
|
|
13285
13405
|
label: "Preview",
|
|
@@ -13343,10 +13463,10 @@ function diagnosticsOf(sourceDiagnostics, reportFindings) {
|
|
|
13343
13463
|
|
|
13344
13464
|
// src/core/report-fold.ts
|
|
13345
13465
|
var REPORT_PATHS = ["module validate", "module convert", "module scan"];
|
|
13346
|
-
var
|
|
13347
|
-
|
|
13348
|
-
|
|
13349
|
-
|
|
13466
|
+
var FOLDS_AS = new Map([
|
|
13467
|
+
...REPORT_PATHS.map((path) => [path, path]),
|
|
13468
|
+
["stack import", "module convert"]
|
|
13469
|
+
]);
|
|
13350
13470
|
var EMPTY_REPORT_FOLD = /* @__PURE__ */ new Map();
|
|
13351
13471
|
function readEntry(path, exitCode, data) {
|
|
13352
13472
|
if (carriesFailure(data)) {
|
|
@@ -13362,10 +13482,11 @@ function readEntry(path, exitCode, data) {
|
|
|
13362
13482
|
}
|
|
13363
13483
|
}
|
|
13364
13484
|
function foldReport(prev, result) {
|
|
13365
|
-
|
|
13485
|
+
const path = FOLDS_AS.get(result.path);
|
|
13486
|
+
if (path === void 0) return prev;
|
|
13366
13487
|
const next = new Map(prev);
|
|
13367
|
-
if (result.document === "") next.delete(
|
|
13368
|
-
else next.set(
|
|
13488
|
+
if (result.document === "") next.delete(path);
|
|
13489
|
+
else next.set(path, readEntry(path, result.exitCode, JSON.parse(result.document)));
|
|
13369
13490
|
return next;
|
|
13370
13491
|
}
|
|
13371
13492
|
function treeHashOf(entry) {
|
|
@@ -13453,7 +13574,7 @@ function reduceRun(prev, token, event) {
|
|
|
13453
13574
|
if (event.type === "gate" && event.changeRequest !== null) {
|
|
13454
13575
|
return {
|
|
13455
13576
|
token,
|
|
13456
|
-
outcome: { kind: "awaiting-approval", changeRequest: event.changeRequest },
|
|
13577
|
+
outcome: { kind: "awaiting-approval", changeRequest: event.changeRequest, runUrl: null },
|
|
13457
13578
|
lastLog,
|
|
13458
13579
|
submitted,
|
|
13459
13580
|
phases: closePhases(phases)
|
|
@@ -13461,7 +13582,13 @@ function reduceRun(prev, token, event) {
|
|
|
13461
13582
|
}
|
|
13462
13583
|
if (event.type === "result") {
|
|
13463
13584
|
if (carried?.outcome.kind === "awaiting-approval") {
|
|
13464
|
-
return {
|
|
13585
|
+
return {
|
|
13586
|
+
token,
|
|
13587
|
+
outcome: { ...carried.outcome, runUrl: event.run.url ?? null },
|
|
13588
|
+
lastLog,
|
|
13589
|
+
submitted,
|
|
13590
|
+
phases
|
|
13591
|
+
};
|
|
13465
13592
|
}
|
|
13466
13593
|
if (event.error)
|
|
13467
13594
|
return {
|
|
@@ -13489,7 +13616,7 @@ function settleRun(prev, token, error) {
|
|
|
13489
13616
|
const lastLog = carried?.lastLog ?? null;
|
|
13490
13617
|
const submitted = carried?.submitted ?? false;
|
|
13491
13618
|
const phases = closePhases(carried?.phases ?? []);
|
|
13492
|
-
if (error instanceof CommandDetachedError)
|
|
13619
|
+
if (error instanceof CommandDetachedError || error instanceof CommandUnobservedError)
|
|
13493
13620
|
return { token, outcome: { kind: "detached", submitted }, lastLog, submitted, phases };
|
|
13494
13621
|
if (error instanceof CommandExitError) {
|
|
13495
13622
|
if (error.code === 130)
|
|
@@ -13633,7 +13760,7 @@ var CONTEXT_NEEDS = {
|
|
|
13633
13760
|
resolved: "no open Keep or Reload conflict",
|
|
13634
13761
|
conflict: "an open Keep or Reload conflict",
|
|
13635
13762
|
sourceRefused: "the source-refused lock",
|
|
13636
|
-
needsConversion: "a tree
|
|
13763
|
+
needsConversion: "a tree out of lace shape",
|
|
13637
13764
|
"selection.node": "a selected node",
|
|
13638
13765
|
"selection.edge": "a selected connection",
|
|
13639
13766
|
diagnostics: "diagnostics to show",
|
|
@@ -13648,7 +13775,8 @@ var TARGET_NEEDS = {
|
|
|
13648
13775
|
nodeId: "a node",
|
|
13649
13776
|
groupId: "a group",
|
|
13650
13777
|
diagnostic: "a diagnostic",
|
|
13651
|
-
runId: "a run"
|
|
13778
|
+
runId: "a run",
|
|
13779
|
+
failure: "a failed command"
|
|
13652
13780
|
};
|
|
13653
13781
|
var BUSY_REASON = "A run is in progress";
|
|
13654
13782
|
function keySatisfied(ctx, key) {
|
|
@@ -13694,6 +13822,16 @@ function asksConfirm(binding) {
|
|
|
13694
13822
|
return binding.confirm !== void 0;
|
|
13695
13823
|
}
|
|
13696
13824
|
}
|
|
13825
|
+
var FAILURE_ROW = "failure";
|
|
13826
|
+
function placedOn(action, row) {
|
|
13827
|
+
return typeof action.placement === "object" && action.placement.row === row;
|
|
13828
|
+
}
|
|
13829
|
+
function answersFailure(action, failure) {
|
|
13830
|
+
return action.answers?.includes(failure.reason) === true;
|
|
13831
|
+
}
|
|
13832
|
+
function answering(actions, failure) {
|
|
13833
|
+
return actions.filter((a) => placedOn(a, FAILURE_ROW) && answersFailure(a, failure));
|
|
13834
|
+
}
|
|
13697
13835
|
function unmetRequirement(action, ports, ctx, target) {
|
|
13698
13836
|
const { label, binding } = action;
|
|
13699
13837
|
const port = missingPort(ports, action.requiredPorts);
|
|
@@ -13705,6 +13843,10 @@ function unmetRequirement(action, ports, ctx, target) {
|
|
|
13705
13843
|
if (key !== void 0) return `${label} needs ${CONTEXT_NEEDS[key]}`;
|
|
13706
13844
|
const targetKey = (action.requiredTarget ?? []).find((k) => target[k] === void 0);
|
|
13707
13845
|
if (targetKey !== void 0) return `${label} needs ${TARGET_NEEDS[targetKey]}`;
|
|
13846
|
+
if (placedOn(action, FAILURE_ROW) || action.answers !== void 0) {
|
|
13847
|
+
if (target.failure === void 0) return `${label} needs ${TARGET_NEEDS.failure}`;
|
|
13848
|
+
if (!answersFailure(action, target.failure)) return `${label} does not answer this failure`;
|
|
13849
|
+
}
|
|
13708
13850
|
if (binding.kind === "command" && !availableCommands(ports).has(binding.path)) {
|
|
13709
13851
|
return `${label} runs lace ${binding.path}, which this host does not route`;
|
|
13710
13852
|
}
|
|
@@ -13814,6 +13956,10 @@ function createActionRunner(ports, store, options = {}) {
|
|
|
13814
13956
|
handles.delete(kind);
|
|
13815
13957
|
tokens.delete(kind);
|
|
13816
13958
|
}
|
|
13959
|
+
function tellFailure(error) {
|
|
13960
|
+
if (error instanceof CommandDetachedError) return;
|
|
13961
|
+
ports.presenter.notify("error", error instanceof Error ? error.message : String(error));
|
|
13962
|
+
}
|
|
13817
13963
|
async function startCommand(action, ctx, target, formArgs) {
|
|
13818
13964
|
const binding = action.binding;
|
|
13819
13965
|
if (binding.kind !== "command") return;
|
|
@@ -13868,7 +14014,7 @@ function createActionRunner(ports, store, options = {}) {
|
|
|
13868
14014
|
missing: completion.missing,
|
|
13869
14015
|
submit: (values) => {
|
|
13870
14016
|
options.onPendingFormChange?.(null);
|
|
13871
|
-
void startCommand(action, ctx, target, values);
|
|
14017
|
+
void startCommand(action, ctx, target, values).catch(tellFailure);
|
|
13872
14018
|
},
|
|
13873
14019
|
cancel: () => options.onPendingFormChange?.(null)
|
|
13874
14020
|
});
|
|
@@ -13942,8 +14088,7 @@ function createActionRunner(ports, store, options = {}) {
|
|
|
13942
14088
|
return;
|
|
13943
14089
|
}
|
|
13944
14090
|
} catch (error) {
|
|
13945
|
-
|
|
13946
|
-
ports.presenter.notify("error", error instanceof Error ? error.message : String(error));
|
|
14091
|
+
tellFailure(error);
|
|
13947
14092
|
}
|
|
13948
14093
|
},
|
|
13949
14094
|
apply(actions) {
|
|
@@ -14060,11 +14205,13 @@ function autosave(source, save, policy, report) {
|
|
|
14060
14205
|
CORE_COMMAND_ACTIONS,
|
|
14061
14206
|
CommandDetachedError,
|
|
14062
14207
|
CommandExitError,
|
|
14208
|
+
CommandUnobservedError,
|
|
14063
14209
|
ConnectError,
|
|
14064
14210
|
EMPTY_REPORT_FOLD,
|
|
14065
14211
|
InputMode,
|
|
14066
14212
|
Reason,
|
|
14067
14213
|
SCHEMAS,
|
|
14214
|
+
answering,
|
|
14068
14215
|
autosave,
|
|
14069
14216
|
bridgeCaller,
|
|
14070
14217
|
carriesFailure,
|