@lace-cloud/canvas 0.27.0 → 0.29.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.
@@ -36,6 +36,7 @@ __export(engine_exports, {
36
36
  autosave: () => autosave,
37
37
  bridgeCaller: () => bridgeCaller,
38
38
  carriesFailure: () => carriesFailure,
39
+ commandUnderWay: () => commandUnderWay,
39
40
  connectCaller: () => connectCaller,
40
41
  createActionRunner: () => createActionRunner,
41
42
  createResultStore: () => createResultStore,
@@ -10551,10 +10552,9 @@ var CommandDetachedError = class extends Error {
10551
10552
  }
10552
10553
  };
10553
10554
  var CommandUnobservedError = class extends Error {
10554
- constructor() {
10555
- super(
10556
- "the engine's stream ended before the command exited: the command ran and may have made changes, but its outcome is unknown"
10557
- );
10555
+ constructor(path) {
10556
+ super(`the engine's stream ended before \`lace ${path}\` exited`);
10557
+ this.path = path;
10558
10558
  }
10559
10559
  };
10560
10560
 
@@ -10994,6 +10994,7 @@ var COMMANDS = {
10994
10994
  "type": "string"
10995
10995
  }
10996
10996
  },
10997
+ "effect": "write",
10997
10998
  "hidden": false,
10998
10999
  "yes": false
10999
11000
  },
@@ -11020,6 +11021,7 @@ var COMMANDS = {
11020
11021
  "type": "string"
11021
11022
  }
11022
11023
  },
11024
+ "effect": "read",
11023
11025
  "hidden": false,
11024
11026
  "yes": false
11025
11027
  },
@@ -11044,6 +11046,7 @@ var COMMANDS = {
11044
11046
  "type": "string"
11045
11047
  }
11046
11048
  },
11049
+ "effect": "read",
11047
11050
  "hidden": false,
11048
11051
  "yes": false
11049
11052
  },
@@ -11058,6 +11061,7 @@ var COMMANDS = {
11058
11061
  "type": "string"
11059
11062
  }
11060
11063
  },
11064
+ "effect": "write",
11061
11065
  "hidden": false,
11062
11066
  "yes": false
11063
11067
  },
@@ -11069,6 +11073,7 @@ var COMMANDS = {
11069
11073
  "type": "string"
11070
11074
  }
11071
11075
  },
11076
+ "effect": "write",
11072
11077
  "hidden": false,
11073
11078
  "yes": false
11074
11079
  },
@@ -11080,6 +11085,7 @@ var COMMANDS = {
11080
11085
  "type": "bool"
11081
11086
  }
11082
11087
  },
11088
+ "effect": "read",
11083
11089
  "hidden": false,
11084
11090
  "yes": false
11085
11091
  },
@@ -11107,6 +11113,7 @@ var COMMANDS = {
11107
11113
  "type": "string"
11108
11114
  }
11109
11115
  },
11116
+ "effect": "write",
11110
11117
  "hidden": false,
11111
11118
  "yes": false
11112
11119
  },
@@ -11122,6 +11129,7 @@ var COMMANDS = {
11122
11129
  ]
11123
11130
  }
11124
11131
  },
11132
+ "effect": "write",
11125
11133
  "hidden": false,
11126
11134
  "yes": false
11127
11135
  },
@@ -11140,6 +11148,7 @@ var COMMANDS = {
11140
11148
  "type": "string"
11141
11149
  }
11142
11150
  },
11151
+ "effect": "rewrite",
11143
11152
  "hidden": false,
11144
11153
  "yes": false
11145
11154
  },
@@ -11163,6 +11172,7 @@ var COMMANDS = {
11163
11172
  "type": "string"
11164
11173
  }
11165
11174
  },
11175
+ "effect": "write",
11166
11176
  "hidden": false,
11167
11177
  "yes": false
11168
11178
  },
@@ -11190,6 +11200,33 @@ var COMMANDS = {
11190
11200
  "type": "bool"
11191
11201
  }
11192
11202
  },
11203
+ "effect": "rewrite",
11204
+ "hidden": false,
11205
+ "yes": false
11206
+ },
11207
+ "module lock": {
11208
+ "path": "module lock",
11209
+ "positionals": [],
11210
+ "flags": {
11211
+ "org": {
11212
+ "type": "string"
11213
+ },
11214
+ "output": {
11215
+ "type": "string",
11216
+ "values": [
11217
+ "table",
11218
+ "json"
11219
+ ]
11220
+ },
11221
+ "path": {
11222
+ "type": "string"
11223
+ },
11224
+ "upgrade": {
11225
+ "type": "stringArray",
11226
+ "repeated": true
11227
+ }
11228
+ },
11229
+ "effect": "write",
11193
11230
  "hidden": false,
11194
11231
  "yes": false
11195
11232
  },
@@ -11224,6 +11261,7 @@ var COMMANDS = {
11224
11261
  "type": "bool"
11225
11262
  }
11226
11263
  },
11264
+ "effect": "read",
11227
11265
  "hidden": false,
11228
11266
  "yes": false
11229
11267
  },
@@ -11252,6 +11290,7 @@ var COMMANDS = {
11252
11290
  ]
11253
11291
  }
11254
11292
  },
11293
+ "effect": "write",
11255
11294
  "hidden": false,
11256
11295
  "yes": false
11257
11296
  },
@@ -11267,6 +11306,7 @@ var COMMANDS = {
11267
11306
  ]
11268
11307
  }
11269
11308
  },
11309
+ "effect": "read",
11270
11310
  "hidden": false,
11271
11311
  "yes": false
11272
11312
  },
@@ -11282,6 +11322,7 @@ var COMMANDS = {
11282
11322
  ]
11283
11323
  }
11284
11324
  },
11325
+ "effect": "read",
11285
11326
  "hidden": false,
11286
11327
  "yes": false
11287
11328
  },
@@ -11302,6 +11343,7 @@ var COMMANDS = {
11302
11343
  ]
11303
11344
  }
11304
11345
  },
11346
+ "effect": "write",
11305
11347
  "hidden": false,
11306
11348
  "yes": false
11307
11349
  },
@@ -11328,6 +11370,7 @@ var COMMANDS = {
11328
11370
  "type": "string"
11329
11371
  }
11330
11372
  },
11373
+ "effect": "read",
11331
11374
  "hidden": false,
11332
11375
  "yes": false
11333
11376
  },
@@ -11352,6 +11395,7 @@ var COMMANDS = {
11352
11395
  "type": "string"
11353
11396
  }
11354
11397
  },
11398
+ "effect": "read",
11355
11399
  "hidden": false,
11356
11400
  "yes": false
11357
11401
  },
@@ -11378,6 +11422,7 @@ var COMMANDS = {
11378
11422
  "type": "string"
11379
11423
  }
11380
11424
  },
11425
+ "effect": "read",
11381
11426
  "hidden": false,
11382
11427
  "yes": false
11383
11428
  },
@@ -11407,6 +11452,7 @@ var COMMANDS = {
11407
11452
  ]
11408
11453
  }
11409
11454
  },
11455
+ "effect": "read",
11410
11456
  "hidden": false,
11411
11457
  "yes": false
11412
11458
  },
@@ -11449,6 +11495,7 @@ var COMMANDS = {
11449
11495
  "type": "string"
11450
11496
  }
11451
11497
  },
11498
+ "effect": "read",
11452
11499
  "hidden": false,
11453
11500
  "yes": false
11454
11501
  },
@@ -11481,6 +11528,7 @@ var COMMANDS = {
11481
11528
  "type": "string"
11482
11529
  }
11483
11530
  },
11531
+ "effect": "read",
11484
11532
  "hidden": false,
11485
11533
  "yes": false
11486
11534
  },
@@ -11506,6 +11554,7 @@ var COMMANDS = {
11506
11554
  "type": "string"
11507
11555
  }
11508
11556
  },
11557
+ "effect": "read",
11509
11558
  "hidden": false,
11510
11559
  "yes": false
11511
11560
  },
@@ -11535,6 +11584,7 @@ var COMMANDS = {
11535
11584
  "type": "string"
11536
11585
  }
11537
11586
  },
11587
+ "effect": "write",
11538
11588
  "hidden": false,
11539
11589
  "yes": false
11540
11590
  },
@@ -11564,6 +11614,7 @@ var COMMANDS = {
11564
11614
  "type": "string"
11565
11615
  }
11566
11616
  },
11617
+ "effect": "read",
11567
11618
  "hidden": false,
11568
11619
  "yes": false
11569
11620
  },
@@ -11606,6 +11657,7 @@ var COMMANDS = {
11606
11657
  "type": "string"
11607
11658
  }
11608
11659
  },
11660
+ "effect": "read",
11609
11661
  "hidden": false,
11610
11662
  "yes": false
11611
11663
  },
@@ -11635,6 +11687,7 @@ var COMMANDS = {
11635
11687
  "type": "string"
11636
11688
  }
11637
11689
  },
11690
+ "effect": "read",
11638
11691
  "hidden": false,
11639
11692
  "yes": false
11640
11693
  },
@@ -11661,6 +11714,7 @@ var COMMANDS = {
11661
11714
  "type": "string"
11662
11715
  }
11663
11716
  },
11717
+ "effect": "read",
11664
11718
  "hidden": false,
11665
11719
  "yes": false
11666
11720
  },
@@ -11707,6 +11761,7 @@ var COMMANDS = {
11707
11761
  "repeated": true
11708
11762
  }
11709
11763
  },
11764
+ "effect": "write",
11710
11765
  "hidden": false,
11711
11766
  "yes": false
11712
11767
  },
@@ -11755,6 +11810,7 @@ var COMMANDS = {
11755
11810
  "type": "string"
11756
11811
  }
11757
11812
  },
11813
+ "effect": "write",
11758
11814
  "hidden": false,
11759
11815
  "yes": false
11760
11816
  },
@@ -11784,6 +11840,7 @@ var COMMANDS = {
11784
11840
  "type": "bool"
11785
11841
  }
11786
11842
  },
11843
+ "effect": "write",
11787
11844
  "hidden": false,
11788
11845
  "yes": true
11789
11846
  },
@@ -11816,6 +11873,7 @@ var COMMANDS = {
11816
11873
  "type": "string"
11817
11874
  }
11818
11875
  },
11876
+ "effect": "read",
11819
11877
  "hidden": false,
11820
11878
  "yes": false
11821
11879
  },
@@ -11868,6 +11926,7 @@ var COMMANDS = {
11868
11926
  "type": "bool"
11869
11927
  }
11870
11928
  },
11929
+ "effect": "write",
11871
11930
  "hidden": false,
11872
11931
  "yes": true
11873
11932
  },
@@ -11897,6 +11956,7 @@ var COMMANDS = {
11897
11956
  "type": "string"
11898
11957
  }
11899
11958
  },
11959
+ "effect": "read",
11900
11960
  "hidden": false,
11901
11961
  "yes": false
11902
11962
  },
@@ -11933,6 +11993,7 @@ var COMMANDS = {
11933
11993
  "type": "string"
11934
11994
  }
11935
11995
  },
11996
+ "effect": "rewrite",
11936
11997
  "hidden": false,
11937
11998
  "yes": false
11938
11999
  },
@@ -11966,6 +12027,7 @@ var COMMANDS = {
11966
12027
  "type": "string"
11967
12028
  }
11968
12029
  },
12030
+ "effect": "read",
11969
12031
  "hidden": false,
11970
12032
  "yes": false
11971
12033
  },
@@ -12000,6 +12062,7 @@ var COMMANDS = {
12000
12062
  "repeated": true
12001
12063
  }
12002
12064
  },
12065
+ "effect": "write",
12003
12066
  "hidden": false,
12004
12067
  "yes": false
12005
12068
  },
@@ -12035,6 +12098,7 @@ var COMMANDS = {
12035
12098
  "type": "duration"
12036
12099
  }
12037
12100
  },
12101
+ "effect": "write",
12038
12102
  "hidden": false,
12039
12103
  "yes": false
12040
12104
  },
@@ -12076,6 +12140,7 @@ var COMMANDS = {
12076
12140
  "type": "string"
12077
12141
  }
12078
12142
  },
12143
+ "effect": "write",
12079
12144
  "hidden": false,
12080
12145
  "yes": false
12081
12146
  },
@@ -12094,6 +12159,7 @@ var COMMANDS = {
12094
12159
  ]
12095
12160
  }
12096
12161
  },
12162
+ "effect": "read",
12097
12163
  "hidden": false,
12098
12164
  "yes": false
12099
12165
  },
@@ -12118,6 +12184,7 @@ var COMMANDS = {
12118
12184
  ]
12119
12185
  }
12120
12186
  },
12187
+ "effect": "read",
12121
12188
  "hidden": false,
12122
12189
  "yes": false
12123
12190
  },
@@ -12141,6 +12208,7 @@ var COMMANDS = {
12141
12208
  ]
12142
12209
  }
12143
12210
  },
12211
+ "effect": "write",
12144
12212
  "hidden": false,
12145
12213
  "yes": false
12146
12214
  },
@@ -12156,6 +12224,7 @@ var COMMANDS = {
12156
12224
  ]
12157
12225
  }
12158
12226
  },
12227
+ "effect": "read",
12159
12228
  "hidden": false,
12160
12229
  "yes": false
12161
12230
  },
@@ -12171,6 +12240,7 @@ var COMMANDS = {
12171
12240
  ]
12172
12241
  }
12173
12242
  },
12243
+ "effect": "read",
12174
12244
  "hidden": false,
12175
12245
  "yes": false
12176
12246
  }
@@ -12306,10 +12376,18 @@ var moduleValidateResultSchema = import_zod.z.object({
12306
12376
  failure: commandFailureSchema.optional(),
12307
12377
  diagnostics: import_zod.z.array(commandDiagnosticSchema)
12308
12378
  });
12379
+ var moduleLockResultSchema = import_zod.z.object({
12380
+ path: import_zod.z.string(),
12381
+ lockfile: import_zod.z.string(),
12382
+ providers: import_zod.z.array(
12383
+ import_zod.z.object({ address: import_zod.z.string(), version: import_zod.z.string(), platforms: import_zod.z.array(import_zod.z.string()) })
12384
+ )
12385
+ });
12309
12386
  var moduleConvertResultSchema = import_zod.z.object({
12310
12387
  changed: import_zod.z.boolean(),
12311
12388
  written: import_zod.z.array(import_zod.z.string()),
12312
12389
  removed: import_zod.z.array(import_zod.z.string()),
12390
+ lock: moduleLockResultSchema.nullable(),
12313
12391
  validate: moduleValidateResultSchema,
12314
12392
  diagnostics: import_zod.z.array(commandDiagnosticSchema)
12315
12393
  });
@@ -12389,6 +12467,12 @@ var moduleFmtResultSchema = import_zod.z.object({ changed: import_zod.z.array(im
12389
12467
  var moduleDocsResultSchema = import_zod.z.object({ markdown: import_zod.z.string() });
12390
12468
  var moduleScanResultSchema = import_zod.z.object({
12391
12469
  treeHash: import_zod.z.string(),
12470
+ tool: import_zod.z.object({
12471
+ name: import_zod.z.string(),
12472
+ version: import_zod.z.string().nullable(),
12473
+ path: import_zod.z.string(),
12474
+ source: import_zod.z.enum(["env", "path", "cache"])
12475
+ }),
12392
12476
  diagnostics: import_zod.z.array(commandDiagnosticSchema)
12393
12477
  });
12394
12478
  var registryDescribeSchema = import_zod.z.object({
@@ -12542,6 +12626,22 @@ var runSchema = import_zod.z.object({
12542
12626
  // a portal mount reading the API body sees it absent — optional so both
12543
12627
  // bodies parse. A host opens this link and never composes a portal route.
12544
12628
  url: import_zod.z.string().optional(),
12629
+ // The provider versions the Run's lockfile pins, each with the
12630
+ // organization's admission it ran under when the version is one admitted
12631
+ // outside the curated range. A single-run read carries it; a list does
12632
+ // not, and the CLI omits an empty one.
12633
+ providers: import_zod.z.array(
12634
+ import_zod.z.object({
12635
+ address: import_zod.z.string(),
12636
+ version: import_zod.z.string(),
12637
+ admission: import_zod.z.object({
12638
+ id: import_zod.z.string(),
12639
+ admittedBy: import_zod.z.string(),
12640
+ admittedByName: import_zod.z.string().nullable(),
12641
+ admittedAt: import_zod.z.string()
12642
+ }).optional()
12643
+ })
12644
+ ).optional(),
12545
12645
  // The CLI's own `api.Run` decode struct (apps/cli/internal/api/runs.go) has no
12546
12646
  // json tag for these, so every CLI JSON golden omits them; the API always sends
12547
12647
  // them (apps/api/src/openapi/schemas/runs.ts) — optional so both bodies parse.
@@ -12761,16 +12861,22 @@ var currentSelectionSchema = import_zod.z.union([
12761
12861
  import_zod.z.object({ slug: import_zod.z.null(), source: import_zod.z.null() })
12762
12862
  ]);
12763
12863
  var loginUserSchema = import_zod.z.object({ id: import_zod.z.string(), email: import_zod.z.string(), name: import_zod.z.string() });
12764
- var logoutSchema = import_zod.z.object({ loggedOut: import_zod.z.boolean() });
12864
+ var keyRevocationSchema = import_zod.z.object({
12865
+ revocation: import_zod.z.enum(["revoked", "refused", "unreachable", "unreadable", "none"]),
12866
+ detail: import_zod.z.string().optional(),
12867
+ portalUrl: import_zod.z.string().optional()
12868
+ });
12869
+ var logoutSchema = keyRevocationSchema.extend({ loggedOut: import_zod.z.boolean() });
12765
12870
  var loginEventSchema = import_zod.z.discriminatedUnion("type", [
12766
12871
  import_zod.z.object({ type: import_zod.z.literal("code"), code: import_zod.z.string(), verificationUrl: import_zod.z.string().optional() }),
12767
12872
  import_zod.z.object({ type: import_zod.z.literal("url"), url: import_zod.z.string() }),
12768
12873
  import_zod.z.object({ type: import_zod.z.literal("email_sent"), email: import_zod.z.string() }),
12769
- import_zod.z.object({ type: import_zod.z.literal("result"), user: loginUserSchema })
12874
+ import_zod.z.object({ type: import_zod.z.literal("result"), user: loginUserSchema, replacedKey: keyRevocationSchema })
12770
12875
  ]);
12771
12876
  var SCHEMAS = {
12772
12877
  "module validate": moduleValidateResultSchema,
12773
12878
  "module convert": moduleConvertResultSchema,
12879
+ "module lock": moduleLockResultSchema,
12774
12880
  "module fmt": moduleFmtResultSchema,
12775
12881
  "module docs": moduleDocsResultSchema,
12776
12882
  "module scan": moduleScanResultSchema,
@@ -13105,7 +13211,7 @@ function commandsPort(caller, commandPaths, ownCwd) {
13105
13211
  let started = false;
13106
13212
  const stopped = (error) => {
13107
13213
  if (signal.aborted) return new CommandDetachedError();
13108
- if (started) return new CommandUnobservedError();
13214
+ if (started) return new CommandUnobservedError(path);
13109
13215
  return error;
13110
13216
  };
13111
13217
  try {
@@ -13323,6 +13429,13 @@ function liveSlots(slots, current) {
13323
13429
  report: liveReport(report, current)
13324
13430
  };
13325
13431
  }
13432
+ function commandUnderWay({
13433
+ run,
13434
+ preview: preview2,
13435
+ running
13436
+ }) {
13437
+ return run?.outcome.kind === "running" || preview2?.outcome.kind === "running" || running.size > 0;
13438
+ }
13326
13439
  function withPhase(phases, name) {
13327
13440
  return [...phases.map((p) => ({ ...p, status: "done" })), { name, status: "current" }];
13328
13441
  }
@@ -13368,18 +13481,19 @@ function runningFor(slot, token) {
13368
13481
  if (slot?.token !== token) return false;
13369
13482
  return "done" in slot ? !slot.done : slot.outcome.kind === "running";
13370
13483
  }
13371
- function failureSays(error, command) {
13484
+ function failureSays(error) {
13372
13485
  if (error instanceof CommandExitError) {
13373
13486
  if (error.failure) return { message: error.failure.message, failure: error.failure };
13374
13487
  const stderr = error.stderrTail.trim();
13375
13488
  return { message: stderr || `the command exited with code ${error.code} and wrote nothing` };
13376
13489
  }
13377
- if (error instanceof CommandUnobservedError && command.kind === "read") {
13378
- return { message: `the stream ended before \`lace ${command.path}\` finished; run it again` };
13490
+ if (error instanceof CommandUnobservedError) {
13491
+ return {
13492
+ message: COMMANDS[error.path].effect === "read" ? `${error.message}; run it again` : `${error.message}: it ran and may have made changes, but its outcome is unknown`
13493
+ };
13379
13494
  }
13380
13495
  return { message: error instanceof Error ? error.message : String(error) };
13381
13496
  }
13382
- var RUN = { kind: "write" };
13383
13497
  function settleRun(prev, token, error) {
13384
13498
  const carried = prev && prev.token === token ? prev : null;
13385
13499
  const lastLog = carried?.lastLog ?? null;
@@ -13395,7 +13509,7 @@ function settleRun(prev, token, error) {
13395
13509
  if (error.code === 7)
13396
13510
  return {
13397
13511
  token,
13398
- outcome: { kind: "blocked", ...failureSays(error, RUN) },
13512
+ outcome: { kind: "blocked", ...failureSays(error) },
13399
13513
  lastLog,
13400
13514
  submitted,
13401
13515
  phases
@@ -13403,7 +13517,7 @@ function settleRun(prev, token, error) {
13403
13517
  }
13404
13518
  return {
13405
13519
  token,
13406
- outcome: { kind: "failed", ...failureSays(error, RUN) },
13520
+ outcome: { kind: "failed", ...failureSays(error) },
13407
13521
  lastLog,
13408
13522
  submitted,
13409
13523
  phases
@@ -13572,10 +13686,7 @@ function defineCommand(binding) {
13572
13686
  } catch (err) {
13573
13687
  const settledByDocument = rendered && binding.result.kind === "notify" && (err instanceof CommandExitError || err instanceof CommandUnobservedError);
13574
13688
  if (!rt.fail(err) && !(err instanceof CommandDetachedError) && !settledByDocument) {
13575
- const { message, failure } = failureSays(
13576
- err,
13577
- binding.result.kind === "preview" || binding.result.kind === "follow" ? { kind: "read", path: binding.path } : { kind: "write" }
13578
- );
13689
+ const { message, failure } = failureSays(err);
13579
13690
  rt.ports.presenter.notify("error", message, ...failure ? [failure] : []);
13580
13691
  }
13581
13692
  if (binding.invalidates) rt.tick();
@@ -14416,6 +14527,7 @@ function autosave(source, save, policy, report) {
14416
14527
  autosave,
14417
14528
  bridgeCaller,
14418
14529
  carriesFailure,
14530
+ commandUnderWay,
14419
14531
  connectCaller,
14420
14532
  createActionRunner,
14421
14533
  createResultStore,