@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/dist/engine/index.cjs
CHANGED
|
@@ -26,6 +26,7 @@ __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,
|
|
@@ -3441,6 +3442,11 @@ var Reason = /* @__PURE__ */ ((Reason2) => {
|
|
|
3441
3442
|
Reason2[Reason2["REASON_TOOL_MISSING"] = 14] = "REASON_TOOL_MISSING";
|
|
3442
3443
|
Reason2[Reason2["REASON_CROSS_SCOPE"] = 15] = "REASON_CROSS_SCOPE";
|
|
3443
3444
|
Reason2[Reason2["REASON_UNAUTHENTICATED"] = 16] = "REASON_UNAUTHENTICATED";
|
|
3445
|
+
Reason2[Reason2["REASON_IMPORT_RESIDUAL"] = 17] = "REASON_IMPORT_RESIDUAL";
|
|
3446
|
+
Reason2[Reason2["REASON_STACK_HAS_STATE"] = 18] = "REASON_STACK_HAS_STATE";
|
|
3447
|
+
Reason2[Reason2["REASON_NO_ORIGIN_REMOTE"] = 19] = "REASON_NO_ORIGIN_REMOTE";
|
|
3448
|
+
Reason2[Reason2["REASON_IMPORT_UNDECLARED"] = 20] = "REASON_IMPORT_UNDECLARED";
|
|
3449
|
+
Reason2[Reason2["REASON_ALREADY_IMPORTED"] = 21] = "REASON_ALREADY_IMPORTED";
|
|
3444
3450
|
Reason2[Reason2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
3445
3451
|
return Reason2;
|
|
3446
3452
|
})(Reason || {});
|
|
@@ -3497,6 +3503,21 @@ function reasonFromJSON(object) {
|
|
|
3497
3503
|
case 16:
|
|
3498
3504
|
case "REASON_UNAUTHENTICATED":
|
|
3499
3505
|
return 16 /* REASON_UNAUTHENTICATED */;
|
|
3506
|
+
case 17:
|
|
3507
|
+
case "REASON_IMPORT_RESIDUAL":
|
|
3508
|
+
return 17 /* REASON_IMPORT_RESIDUAL */;
|
|
3509
|
+
case 18:
|
|
3510
|
+
case "REASON_STACK_HAS_STATE":
|
|
3511
|
+
return 18 /* REASON_STACK_HAS_STATE */;
|
|
3512
|
+
case 19:
|
|
3513
|
+
case "REASON_NO_ORIGIN_REMOTE":
|
|
3514
|
+
return 19 /* REASON_NO_ORIGIN_REMOTE */;
|
|
3515
|
+
case 20:
|
|
3516
|
+
case "REASON_IMPORT_UNDECLARED":
|
|
3517
|
+
return 20 /* REASON_IMPORT_UNDECLARED */;
|
|
3518
|
+
case 21:
|
|
3519
|
+
case "REASON_ALREADY_IMPORTED":
|
|
3520
|
+
return 21 /* REASON_ALREADY_IMPORTED */;
|
|
3500
3521
|
case -1:
|
|
3501
3522
|
case "UNRECOGNIZED":
|
|
3502
3523
|
default:
|
|
@@ -3539,6 +3560,16 @@ function reasonToJSON(object) {
|
|
|
3539
3560
|
return "REASON_CROSS_SCOPE";
|
|
3540
3561
|
case 16 /* REASON_UNAUTHENTICATED */:
|
|
3541
3562
|
return "REASON_UNAUTHENTICATED";
|
|
3563
|
+
case 17 /* REASON_IMPORT_RESIDUAL */:
|
|
3564
|
+
return "REASON_IMPORT_RESIDUAL";
|
|
3565
|
+
case 18 /* REASON_STACK_HAS_STATE */:
|
|
3566
|
+
return "REASON_STACK_HAS_STATE";
|
|
3567
|
+
case 19 /* REASON_NO_ORIGIN_REMOTE */:
|
|
3568
|
+
return "REASON_NO_ORIGIN_REMOTE";
|
|
3569
|
+
case 20 /* REASON_IMPORT_UNDECLARED */:
|
|
3570
|
+
return "REASON_IMPORT_UNDECLARED";
|
|
3571
|
+
case 21 /* REASON_ALREADY_IMPORTED */:
|
|
3572
|
+
return "REASON_ALREADY_IMPORTED";
|
|
3542
3573
|
case -1 /* UNRECOGNIZED */:
|
|
3543
3574
|
default:
|
|
3544
3575
|
return "UNRECOGNIZED";
|
|
@@ -10446,6 +10477,13 @@ var CommandDetachedError = class extends Error {
|
|
|
10446
10477
|
super("command detached: the invoking consumer stopped listening");
|
|
10447
10478
|
}
|
|
10448
10479
|
};
|
|
10480
|
+
var CommandUnobservedError = class extends Error {
|
|
10481
|
+
constructor() {
|
|
10482
|
+
super(
|
|
10483
|
+
"the engine's stream ended before the command exited: the command ran and may have made changes, but its outcome is unknown"
|
|
10484
|
+
);
|
|
10485
|
+
}
|
|
10486
|
+
};
|
|
10449
10487
|
|
|
10450
10488
|
// src/adapters/engine/connect-frame.ts
|
|
10451
10489
|
var END_STREAM_FLAG = 2;
|
|
@@ -10482,8 +10520,13 @@ async function* readConnectFrames(body, signal) {
|
|
|
10482
10520
|
try {
|
|
10483
10521
|
while (!signal.aborted) {
|
|
10484
10522
|
const { value, done } = await reader.read();
|
|
10485
|
-
if (done) return;
|
|
10486
10523
|
if (signal.aborted) return;
|
|
10524
|
+
if (done) {
|
|
10525
|
+
throw new ConnectError(
|
|
10526
|
+
"internal",
|
|
10527
|
+
"the engine's stream was cut off before its end-of-stream frame"
|
|
10528
|
+
);
|
|
10529
|
+
}
|
|
10487
10530
|
if (!value) continue;
|
|
10488
10531
|
chunks.push(value);
|
|
10489
10532
|
bufferedLen += value.length;
|
|
@@ -12105,6 +12148,31 @@ function completeArgs(path, partial) {
|
|
|
12105
12148
|
|
|
12106
12149
|
// src/contracts/schemas.ts
|
|
12107
12150
|
var import_zod = require("zod");
|
|
12151
|
+
var REASON_PREFIX = "REASON_";
|
|
12152
|
+
function reasonWire(reason) {
|
|
12153
|
+
return reasonToJSON(reason).slice(REASON_PREFIX.length).toLowerCase();
|
|
12154
|
+
}
|
|
12155
|
+
var LACE_REASONS = new Set(
|
|
12156
|
+
Object.values(Reason).filter((value) => typeof value === "number" && value !== -1 /* UNRECOGNIZED */).map(reasonWire)
|
|
12157
|
+
);
|
|
12158
|
+
var laceReasonSchema = import_zod.z.custom(
|
|
12159
|
+
(value) => typeof value === "string" && LACE_REASONS.has(value),
|
|
12160
|
+
{ message: "not a reason of Lace\u2019s own" }
|
|
12161
|
+
);
|
|
12162
|
+
var importResidualSchema = import_zod.z.object({
|
|
12163
|
+
address: import_zod.z.string(),
|
|
12164
|
+
type: import_zod.z.string(),
|
|
12165
|
+
reason: import_zod.z.string()
|
|
12166
|
+
});
|
|
12167
|
+
var commandFailureSchema = import_zod.z.strictObject({
|
|
12168
|
+
reason: laceReasonSchema,
|
|
12169
|
+
message: import_zod.z.string(),
|
|
12170
|
+
url: import_zod.z.string().optional(),
|
|
12171
|
+
tool: import_zod.z.string().optional(),
|
|
12172
|
+
importResiduals: import_zod.z.array(importResidualSchema).optional(),
|
|
12173
|
+
addresses: import_zod.z.array(import_zod.z.string()).optional(),
|
|
12174
|
+
apiCode: import_zod.z.string().optional()
|
|
12175
|
+
});
|
|
12108
12176
|
var moduleValidateDeviationSchema = import_zod.z.object({
|
|
12109
12177
|
notCompositional: import_zod.z.boolean(),
|
|
12110
12178
|
clusters: import_zod.z.array(import_zod.z.unknown()),
|
|
@@ -12156,6 +12224,7 @@ var moduleValidateResultSchema = import_zod.z.object({
|
|
|
12156
12224
|
}).optional(),
|
|
12157
12225
|
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
12226
|
exitClass: import_zod.z.string(),
|
|
12227
|
+
failure: commandFailureSchema.optional(),
|
|
12159
12228
|
diagnostics: import_zod.z.array(commandDiagnosticSchema)
|
|
12160
12229
|
});
|
|
12161
12230
|
var moduleConvertResultSchema = import_zod.z.object({
|
|
@@ -12266,6 +12335,7 @@ var registryDescribeSchema = import_zod.z.object({
|
|
|
12266
12335
|
)
|
|
12267
12336
|
})
|
|
12268
12337
|
});
|
|
12338
|
+
var stackIdentSchema = import_zod.z.object({ id: import_zod.z.string(), slug: import_zod.z.string() });
|
|
12269
12339
|
var stackSourceSchema = import_zod.z.object({
|
|
12270
12340
|
kind: import_zod.z.literal("git"),
|
|
12271
12341
|
repoUrl: import_zod.z.string(),
|
|
@@ -12449,7 +12519,7 @@ var previewEntrySchema = import_zod.z.discriminatedUnion("kind", [
|
|
|
12449
12519
|
})
|
|
12450
12520
|
]);
|
|
12451
12521
|
var stackPreviewSchema = import_zod.z.object({
|
|
12452
|
-
stack:
|
|
12522
|
+
stack: stackIdentSchema,
|
|
12453
12523
|
treeHash: import_zod.z.string(),
|
|
12454
12524
|
plan: import_zod.z.object({ summary: planSummarySchema, human: import_zod.z.string() }),
|
|
12455
12525
|
policy: import_zod.z.object({
|
|
@@ -12489,27 +12559,28 @@ var stackPreviewSchema = import_zod.z.object({
|
|
|
12489
12559
|
bound: import_zod.z.number().optional()
|
|
12490
12560
|
})
|
|
12491
12561
|
});
|
|
12492
|
-
var
|
|
12562
|
+
var gateChangeRequestSchema = import_zod.z.object({
|
|
12493
12563
|
id: import_zod.z.string(),
|
|
12494
|
-
orgId: import_zod.z.string(),
|
|
12495
|
-
teamId: import_zod.z.string(),
|
|
12496
|
-
runId: import_zod.z.string(),
|
|
12497
|
-
bindingId: import_zod.z.string().nullable(),
|
|
12498
|
-
invocationId: import_zod.z.string().nullable(),
|
|
12499
12564
|
state: import_zod.z.string(),
|
|
12500
|
-
|
|
12501
|
-
|
|
12502
|
-
|
|
12503
|
-
|
|
12504
|
-
|
|
12505
|
-
|
|
12506
|
-
|
|
12507
|
-
|
|
12508
|
-
|
|
12509
|
-
|
|
12510
|
-
|
|
12511
|
-
|
|
12512
|
-
|
|
12565
|
+
requirements: import_zod.z.array(
|
|
12566
|
+
import_zod.z.object({
|
|
12567
|
+
id: import_zod.z.string(),
|
|
12568
|
+
state: import_zod.z.string(),
|
|
12569
|
+
decidedBy: import_zod.z.enum(["lace", "ecm"]),
|
|
12570
|
+
recordId: import_zod.z.string().nullable()
|
|
12571
|
+
})
|
|
12572
|
+
),
|
|
12573
|
+
records: import_zod.z.array(
|
|
12574
|
+
import_zod.z.object({
|
|
12575
|
+
id: import_zod.z.string(),
|
|
12576
|
+
externalSystemId: import_zod.z.string(),
|
|
12577
|
+
kind: import_zod.z.string(),
|
|
12578
|
+
externalRef: import_zod.z.string().nullable(),
|
|
12579
|
+
externalUrl: import_zod.z.string().nullable(),
|
|
12580
|
+
state: import_zod.z.string().nullable(),
|
|
12581
|
+
decision: import_zod.z.enum(["approved", "rejected"]).nullable()
|
|
12582
|
+
})
|
|
12583
|
+
)
|
|
12513
12584
|
});
|
|
12514
12585
|
var runEventSchema = import_zod.z.discriminatedUnion("type", [
|
|
12515
12586
|
import_zod.z.object({ type: import_zod.z.literal("log"), text: import_zod.z.string() }),
|
|
@@ -12517,8 +12588,11 @@ var runEventSchema = import_zod.z.discriminatedUnion("type", [
|
|
|
12517
12588
|
import_zod.z.object({
|
|
12518
12589
|
type: import_zod.z.literal("gate"),
|
|
12519
12590
|
resolution: import_zod.z.object({ mode: import_zod.z.string(), reason: import_zod.z.string().optional() }),
|
|
12520
|
-
changeRequest:
|
|
12521
|
-
})
|
|
12591
|
+
changeRequest: gateChangeRequestSchema.nullable()
|
|
12592
|
+
}).refine(
|
|
12593
|
+
(gate) => gate.resolution.mode === "awaiting_approval" === (gate.changeRequest !== null),
|
|
12594
|
+
{ message: "a gate event carries a change request exactly when it holds the Run" }
|
|
12595
|
+
),
|
|
12522
12596
|
import_zod.z.object({
|
|
12523
12597
|
type: import_zod.z.literal("result"),
|
|
12524
12598
|
run: runSchema,
|
|
@@ -12528,6 +12602,7 @@ var runEventSchema = import_zod.z.discriminatedUnion("type", [
|
|
|
12528
12602
|
})
|
|
12529
12603
|
]);
|
|
12530
12604
|
var stackScanSchema = import_zod.z.object({
|
|
12605
|
+
stack: stackIdentSchema,
|
|
12531
12606
|
triggered: import_zod.z.boolean(),
|
|
12532
12607
|
reason: import_zod.z.string().nullable(),
|
|
12533
12608
|
settled: import_zod.z.object({
|
|
@@ -12535,14 +12610,17 @@ var stackScanSchema = import_zod.z.object({
|
|
|
12535
12610
|
driftCount: import_zod.z.number(),
|
|
12536
12611
|
scannedAt: import_zod.z.string(),
|
|
12537
12612
|
undeterminedReason: import_zod.z.string().nullable(),
|
|
12613
|
+
standingDriftFindings: import_zod.z.number(),
|
|
12614
|
+
footprintDestroyed: import_zod.z.boolean(),
|
|
12538
12615
|
drift: driftSchema
|
|
12539
12616
|
}).nullable()
|
|
12540
12617
|
});
|
|
12541
12618
|
var stackImportSchema = import_zod.z.object({
|
|
12542
|
-
stack:
|
|
12619
|
+
stack: stackIdentSchema,
|
|
12543
12620
|
written: import_zod.z.array(import_zod.z.string()),
|
|
12621
|
+
removed: import_zod.z.array(import_zod.z.string()),
|
|
12544
12622
|
importBlocks: import_zod.z.number(),
|
|
12545
|
-
importResiduals: import_zod.z.array(
|
|
12623
|
+
importResiduals: import_zod.z.array(importResidualSchema),
|
|
12546
12624
|
validate: moduleValidateResultSchema
|
|
12547
12625
|
});
|
|
12548
12626
|
var artifactRefSchema = import_zod.z.object({ url: import_zod.z.string(), key: import_zod.z.string() });
|
|
@@ -12654,24 +12732,6 @@ function isBoundPath(path) {
|
|
|
12654
12732
|
function parseBound(path, data) {
|
|
12655
12733
|
return SCHEMAS[path].parse(data);
|
|
12656
12734
|
}
|
|
12657
|
-
var REASON_PREFIX = "REASON_";
|
|
12658
|
-
function reasonWire(reason) {
|
|
12659
|
-
return reasonToJSON(reason).slice(REASON_PREFIX.length).toLowerCase();
|
|
12660
|
-
}
|
|
12661
|
-
var LACE_REASONS = new Set(
|
|
12662
|
-
Object.values(Reason).filter((value) => typeof value === "number" && value !== -1 /* UNRECOGNIZED */).map(reasonWire)
|
|
12663
|
-
);
|
|
12664
|
-
var laceReasonSchema = import_zod.z.custom(
|
|
12665
|
-
(value) => typeof value === "string" && LACE_REASONS.has(value),
|
|
12666
|
-
{ message: "not a reason of Lace\u2019s own" }
|
|
12667
|
-
);
|
|
12668
|
-
var commandFailureSchema = import_zod.z.strictObject({
|
|
12669
|
-
reason: laceReasonSchema,
|
|
12670
|
-
message: import_zod.z.string(),
|
|
12671
|
-
url: import_zod.z.string().optional(),
|
|
12672
|
-
tool: import_zod.z.string().optional(),
|
|
12673
|
-
apiCode: import_zod.z.string().optional()
|
|
12674
|
-
});
|
|
12675
12735
|
var failureMarkSchema = import_zod.z.object({ reason: import_zod.z.string(), message: import_zod.z.string() });
|
|
12676
12736
|
function carriesFailure(data) {
|
|
12677
12737
|
return failureMarkSchema.safeParse(data).success;
|
|
@@ -12679,6 +12739,12 @@ function carriesFailure(data) {
|
|
|
12679
12739
|
function parseCommandFailure(data) {
|
|
12680
12740
|
return commandFailureSchema.parse(data);
|
|
12681
12741
|
}
|
|
12742
|
+
function resultFailure(path, data) {
|
|
12743
|
+
const result = parseBound(path, data);
|
|
12744
|
+
if ("failure" in result) return result.failure;
|
|
12745
|
+
if ("validate" in result) return result.validate.failure;
|
|
12746
|
+
return void 0;
|
|
12747
|
+
}
|
|
12682
12748
|
|
|
12683
12749
|
// src/utils/is-plain-object.ts
|
|
12684
12750
|
function isPlainObject(val) {
|
|
@@ -12950,13 +13016,14 @@ function commandsPort(caller, commandPaths, ownCwd) {
|
|
|
12950
13016
|
throw new CommandExitError(
|
|
12951
13017
|
event.exit.code,
|
|
12952
13018
|
event.exit.stderr_tail,
|
|
12953
|
-
exitFailure(event.exit.document)
|
|
13019
|
+
exitFailure(path, event.exit.document)
|
|
12954
13020
|
);
|
|
12955
13021
|
}
|
|
12956
13022
|
return;
|
|
12957
13023
|
}
|
|
12958
13024
|
}
|
|
12959
|
-
throw new CommandDetachedError();
|
|
13025
|
+
if (signal.aborted) throw new CommandDetachedError();
|
|
13026
|
+
throw new CommandUnobservedError();
|
|
12960
13027
|
}
|
|
12961
13028
|
return {
|
|
12962
13029
|
events: run(),
|
|
@@ -12967,10 +13034,10 @@ function commandsPort(caller, commandPaths, ownCwd) {
|
|
|
12967
13034
|
}
|
|
12968
13035
|
};
|
|
12969
13036
|
}
|
|
12970
|
-
function exitFailure(document) {
|
|
13037
|
+
function exitFailure(path, document) {
|
|
12971
13038
|
if (document === "") return void 0;
|
|
12972
13039
|
const data = JSON.parse(document);
|
|
12973
|
-
return carriesFailure(data) ? parseCommandFailure(data) :
|
|
13040
|
+
return carriesFailure(data) ? parseCommandFailure(data) : resultFailure(path, data);
|
|
12974
13041
|
}
|
|
12975
13042
|
async function openSession(caller, target) {
|
|
12976
13043
|
if ("fixture" in target) {
|
|
@@ -13052,7 +13119,7 @@ function defineCommand(binding) {
|
|
|
13052
13119
|
if (!binding.confirm) return void 0;
|
|
13053
13120
|
const merged = completeArgs(binding.path, { ...binding.args(ctx, target), ...formArgs });
|
|
13054
13121
|
if (!merged.ok) return void 0;
|
|
13055
|
-
return binding.confirm(ctx, merged.args);
|
|
13122
|
+
return binding.confirm(ctx, merged.args, target);
|
|
13056
13123
|
},
|
|
13057
13124
|
async start(rt, ctx, target, formArgs, signal) {
|
|
13058
13125
|
const merged = completeArgs(binding.path, { ...binding.args(ctx, target), ...formArgs });
|
|
@@ -13111,6 +13178,21 @@ var destroy = defineCommand({
|
|
|
13111
13178
|
invalidates: "start+settle",
|
|
13112
13179
|
result: slotSink("run")
|
|
13113
13180
|
});
|
|
13181
|
+
function scanNotice(e) {
|
|
13182
|
+
const { slug } = e.stack;
|
|
13183
|
+
const settled = e.settled;
|
|
13184
|
+
if (!settled) {
|
|
13185
|
+
return e.triggered ? `Drift scan triggered for stack ${slug} (${e.stack.id}).` : `Drift scan already in progress for stack ${slug}.`;
|
|
13186
|
+
}
|
|
13187
|
+
if (settled.undeterminedReason !== null) return void 0;
|
|
13188
|
+
if (settled.footprintDestroyed) {
|
|
13189
|
+
return `Drift scan complete for stack ${slug}: IN_SYNC (0 drifted) \u2014 its resources were destroyed, so there was nothing to compare.`;
|
|
13190
|
+
}
|
|
13191
|
+
if (settled.standingDriftFindings > 0) {
|
|
13192
|
+
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.`;
|
|
13193
|
+
}
|
|
13194
|
+
return `Drift scan complete for stack ${slug}: ${settled.driftStatus} (${settled.driftCount} drifted).`;
|
|
13195
|
+
}
|
|
13114
13196
|
var scan = defineCommand({
|
|
13115
13197
|
kind: "command",
|
|
13116
13198
|
path: "stack scan",
|
|
@@ -13119,14 +13201,8 @@ var scan = defineCommand({
|
|
|
13119
13201
|
result: {
|
|
13120
13202
|
kind: "notify",
|
|
13121
13203
|
consume: (rt, e) => {
|
|
13122
|
-
|
|
13123
|
-
|
|
13124
|
-
return;
|
|
13125
|
-
}
|
|
13126
|
-
rt.ports.presenter.notify(
|
|
13127
|
-
"info",
|
|
13128
|
-
e.settled ? `Scan complete \u2014 ${e.settled.driftStatus}` : "Scan triggered"
|
|
13129
|
-
);
|
|
13204
|
+
const notice = scanNotice(e);
|
|
13205
|
+
if (notice !== void 0) rt.ports.presenter.notify("info", notice);
|
|
13130
13206
|
}
|
|
13131
13207
|
}
|
|
13132
13208
|
});
|
|
@@ -13140,15 +13216,51 @@ var create = defineCommand({
|
|
|
13140
13216
|
consume: (rt, e) => rt.ports.presenter.notify("info", `Created stack ${e.slug}`)
|
|
13141
13217
|
}
|
|
13142
13218
|
});
|
|
13219
|
+
function residualAddresses(residuals) {
|
|
13220
|
+
return residuals.map((r) => r.address).join(", ");
|
|
13221
|
+
}
|
|
13222
|
+
function treeChanges(e) {
|
|
13223
|
+
return [
|
|
13224
|
+
...e.written.length === 0 ? [] : [`rewriting ${e.written.join(", ")} in place`],
|
|
13225
|
+
...e.removed.length === 0 ? [] : [`removing ${e.removed.join(", ")}`]
|
|
13226
|
+
];
|
|
13227
|
+
}
|
|
13228
|
+
function importNotice(e) {
|
|
13229
|
+
const { slug } = e.stack;
|
|
13230
|
+
const changes = treeChanges(e);
|
|
13231
|
+
const changed = changes.length > 0;
|
|
13232
|
+
const files = changed ? `, ${changes.join(" and ")}` : "";
|
|
13233
|
+
const imported = `Imported ${e.importBlocks} resource(s) into ${slug}${files}.`;
|
|
13234
|
+
if (e.validate.exitClass !== "ok") {
|
|
13235
|
+
return ["warn", `${imported} The tree did not validate: fix it before you commit it.`];
|
|
13236
|
+
}
|
|
13237
|
+
const adopt = changed ? ` Review the change in git, commit it, then apply ${slug} to adopt them.` : "";
|
|
13238
|
+
if (e.importResiduals.length === 0) return ["info", `${imported}${adopt}`];
|
|
13239
|
+
return [
|
|
13240
|
+
"warn",
|
|
13241
|
+
`${imported}${adopt} Not adopted: ${residualAddresses(e.importResiduals)}; supply their import ids before applying, or the apply creates them anew.`
|
|
13242
|
+
];
|
|
13243
|
+
}
|
|
13244
|
+
var importResult = {
|
|
13245
|
+
kind: "notify",
|
|
13246
|
+
consume: (rt, e) => rt.ports.presenter.notify(...importNotice(e))
|
|
13247
|
+
};
|
|
13143
13248
|
var importStack = defineCommand({
|
|
13144
13249
|
kind: "command",
|
|
13145
13250
|
path: "stack import",
|
|
13146
13251
|
args: (ctx) => ({ stack: ctx.stack?.id }),
|
|
13147
13252
|
invalidates: true,
|
|
13148
|
-
result:
|
|
13149
|
-
|
|
13150
|
-
|
|
13151
|
-
|
|
13253
|
+
result: importResult
|
|
13254
|
+
});
|
|
13255
|
+
var importPartial = defineCommand({
|
|
13256
|
+
kind: "command",
|
|
13257
|
+
path: "stack import",
|
|
13258
|
+
args: (ctx) => ({ stack: ctx.stack?.id, allowPartial: true }),
|
|
13259
|
+
confirm: (ctx, _args, target) => ({
|
|
13260
|
+
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.`
|
|
13261
|
+
}),
|
|
13262
|
+
invalidates: true,
|
|
13263
|
+
result: importResult
|
|
13152
13264
|
});
|
|
13153
13265
|
var validate = defineCommand({
|
|
13154
13266
|
kind: "command",
|
|
@@ -13216,12 +13328,14 @@ var MODULE_COMMAND_ACTIONS = [
|
|
|
13216
13328
|
requiredContext: ["root"],
|
|
13217
13329
|
binding: convert
|
|
13218
13330
|
},
|
|
13219
|
-
//
|
|
13220
|
-
// the same `module convert` the toolbar runs
|
|
13221
|
-
//
|
|
13331
|
+
// Convert on the source-refused banner while the tree is out of lace
|
|
13332
|
+
// shape: the same `module convert` the toolbar runs, and the choice the
|
|
13333
|
+
// banner says of it. The engine re-derives the tree it writes, which
|
|
13334
|
+
// accepts it and lifts the lock.
|
|
13222
13335
|
{
|
|
13223
13336
|
id: "convert-refused",
|
|
13224
13337
|
label: "Convert",
|
|
13338
|
+
choice: "Convert restructures it in place; a stack's apply creates only what its state does not hold yet.",
|
|
13225
13339
|
icon: "convert",
|
|
13226
13340
|
placement: { row: "source-refused" },
|
|
13227
13341
|
requiredPorts: ["commands"],
|
|
@@ -13271,7 +13385,7 @@ var STACK_COMMAND_ACTIONS = [
|
|
|
13271
13385
|
},
|
|
13272
13386
|
{
|
|
13273
13387
|
id: "import",
|
|
13274
|
-
label: "Import
|
|
13388
|
+
label: "Import existing resources",
|
|
13275
13389
|
placement: "toolbar",
|
|
13276
13390
|
requiredPorts: ["commands"],
|
|
13277
13391
|
// `stack import` writes the directory it runs in, the same way
|
|
@@ -13279,6 +13393,15 @@ var STACK_COMMAND_ACTIONS = [
|
|
|
13279
13393
|
requiredContext: ["root", "stack"],
|
|
13280
13394
|
binding: importStack
|
|
13281
13395
|
},
|
|
13396
|
+
{
|
|
13397
|
+
id: "import-partial",
|
|
13398
|
+
label: "Import the rest",
|
|
13399
|
+
placement: { row: "failure" },
|
|
13400
|
+
requiredPorts: ["commands"],
|
|
13401
|
+
requiredContext: ["root", "stack"],
|
|
13402
|
+
answers: ["import_residual"],
|
|
13403
|
+
binding: importPartial
|
|
13404
|
+
},
|
|
13282
13405
|
{
|
|
13283
13406
|
id: "preview",
|
|
13284
13407
|
label: "Preview",
|
|
@@ -13449,10 +13572,10 @@ function reduceRun(prev, token, event) {
|
|
|
13449
13572
|
const lastLog = event.type === "log" ? event.text : carried?.lastLog ?? null;
|
|
13450
13573
|
const phases = event.type === "phase" ? withPhase(carried?.phases ?? [], event.name) : carried?.phases ?? [];
|
|
13451
13574
|
const submitted = carried?.submitted || event.type === "phase" && event.name === "submit";
|
|
13452
|
-
if (event.type === "gate" && event.
|
|
13575
|
+
if (event.type === "gate" && event.changeRequest !== null) {
|
|
13453
13576
|
return {
|
|
13454
13577
|
token,
|
|
13455
|
-
outcome: { kind: "awaiting-approval",
|
|
13578
|
+
outcome: { kind: "awaiting-approval", changeRequest: event.changeRequest, runUrl: null },
|
|
13456
13579
|
lastLog,
|
|
13457
13580
|
submitted,
|
|
13458
13581
|
phases: closePhases(phases)
|
|
@@ -13460,7 +13583,13 @@ function reduceRun(prev, token, event) {
|
|
|
13460
13583
|
}
|
|
13461
13584
|
if (event.type === "result") {
|
|
13462
13585
|
if (carried?.outcome.kind === "awaiting-approval") {
|
|
13463
|
-
return {
|
|
13586
|
+
return {
|
|
13587
|
+
token,
|
|
13588
|
+
outcome: { ...carried.outcome, runUrl: event.run.url ?? null },
|
|
13589
|
+
lastLog,
|
|
13590
|
+
submitted,
|
|
13591
|
+
phases
|
|
13592
|
+
};
|
|
13464
13593
|
}
|
|
13465
13594
|
if (event.error)
|
|
13466
13595
|
return {
|
|
@@ -13488,7 +13617,7 @@ function settleRun(prev, token, error) {
|
|
|
13488
13617
|
const lastLog = carried?.lastLog ?? null;
|
|
13489
13618
|
const submitted = carried?.submitted ?? false;
|
|
13490
13619
|
const phases = closePhases(carried?.phases ?? []);
|
|
13491
|
-
if (error instanceof CommandDetachedError)
|
|
13620
|
+
if (error instanceof CommandDetachedError || error instanceof CommandUnobservedError)
|
|
13492
13621
|
return { token, outcome: { kind: "detached", submitted }, lastLog, submitted, phases };
|
|
13493
13622
|
if (error instanceof CommandExitError) {
|
|
13494
13623
|
if (error.code === 130)
|
|
@@ -13632,7 +13761,7 @@ var CONTEXT_NEEDS = {
|
|
|
13632
13761
|
resolved: "no open Keep or Reload conflict",
|
|
13633
13762
|
conflict: "an open Keep or Reload conflict",
|
|
13634
13763
|
sourceRefused: "the source-refused lock",
|
|
13635
|
-
needsConversion: "a tree
|
|
13764
|
+
needsConversion: "a tree out of lace shape",
|
|
13636
13765
|
"selection.node": "a selected node",
|
|
13637
13766
|
"selection.edge": "a selected connection",
|
|
13638
13767
|
diagnostics: "diagnostics to show",
|
|
@@ -13647,7 +13776,8 @@ var TARGET_NEEDS = {
|
|
|
13647
13776
|
nodeId: "a node",
|
|
13648
13777
|
groupId: "a group",
|
|
13649
13778
|
diagnostic: "a diagnostic",
|
|
13650
|
-
runId: "a run"
|
|
13779
|
+
runId: "a run",
|
|
13780
|
+
failure: "a failed command"
|
|
13651
13781
|
};
|
|
13652
13782
|
var BUSY_REASON = "A run is in progress";
|
|
13653
13783
|
function keySatisfied(ctx, key) {
|
|
@@ -13704,6 +13834,12 @@ function unmetRequirement(action, ports, ctx, target) {
|
|
|
13704
13834
|
if (key !== void 0) return `${label} needs ${CONTEXT_NEEDS[key]}`;
|
|
13705
13835
|
const targetKey = (action.requiredTarget ?? []).find((k) => target[k] === void 0);
|
|
13706
13836
|
if (targetKey !== void 0) return `${label} needs ${TARGET_NEEDS[targetKey]}`;
|
|
13837
|
+
if (action.answers !== void 0) {
|
|
13838
|
+
if (target.failure === void 0) return `${label} needs ${TARGET_NEEDS.failure}`;
|
|
13839
|
+
if (!action.answers.includes(target.failure.reason)) {
|
|
13840
|
+
return `${label} does not answer this failure`;
|
|
13841
|
+
}
|
|
13842
|
+
}
|
|
13707
13843
|
if (binding.kind === "command" && !availableCommands(ports).has(binding.path)) {
|
|
13708
13844
|
return `${label} runs lace ${binding.path}, which this host does not route`;
|
|
13709
13845
|
}
|
|
@@ -14059,6 +14195,7 @@ function autosave(source, save, policy, report) {
|
|
|
14059
14195
|
CORE_COMMAND_ACTIONS,
|
|
14060
14196
|
CommandDetachedError,
|
|
14061
14197
|
CommandExitError,
|
|
14198
|
+
CommandUnobservedError,
|
|
14062
14199
|
ConnectError,
|
|
14063
14200
|
EMPTY_REPORT_FOLD,
|
|
14064
14201
|
InputMode,
|