wicked-crew 0.18.21 → 0.18.23

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.
Files changed (297) hide show
  1. package/dist/api/audit-view.d.ts.map +1 -1
  2. package/dist/api/audit-view.js +1 -0
  3. package/dist/api/audit-view.js.map +1 -1
  4. package/dist/api/audit.d.ts +28 -1
  5. package/dist/api/audit.d.ts.map +1 -1
  6. package/dist/api/audit.js +90 -9
  7. package/dist/api/audit.js.map +1 -1
  8. package/dist/api/auth.d.ts +7 -0
  9. package/dist/api/auth.d.ts.map +1 -1
  10. package/dist/api/auth.js +53 -10
  11. package/dist/api/auth.js.map +1 -1
  12. package/dist/api/capture.d.ts +11 -2
  13. package/dist/api/capture.d.ts.map +1 -1
  14. package/dist/api/capture.js +7 -2
  15. package/dist/api/capture.js.map +1 -1
  16. package/dist/api/chat-context.d.ts +6 -1
  17. package/dist/api/chat-context.d.ts.map +1 -1
  18. package/dist/api/chat-context.js +45 -11
  19. package/dist/api/chat-context.js.map +1 -1
  20. package/dist/api/chat-proposals.d.ts +24 -7
  21. package/dist/api/chat-proposals.d.ts.map +1 -1
  22. package/dist/api/chat-proposals.js +98 -18
  23. package/dist/api/chat-proposals.js.map +1 -1
  24. package/dist/api/chat-scope.d.ts +6 -2
  25. package/dist/api/chat-scope.d.ts.map +1 -1
  26. package/dist/api/chat-scope.js +13 -7
  27. package/dist/api/chat-scope.js.map +1 -1
  28. package/dist/api/cluster-status.d.ts +17 -0
  29. package/dist/api/cluster-status.d.ts.map +1 -1
  30. package/dist/api/cluster-status.js +70 -3
  31. package/dist/api/cluster-status.js.map +1 -1
  32. package/dist/api/compose-facts.d.ts +35 -0
  33. package/dist/api/compose-facts.d.ts.map +1 -0
  34. package/dist/api/compose-facts.js +46 -0
  35. package/dist/api/compose-facts.js.map +1 -0
  36. package/dist/api/cut-read.d.ts +62 -0
  37. package/dist/api/cut-read.d.ts.map +1 -0
  38. package/dist/api/cut-read.js +101 -0
  39. package/dist/api/cut-read.js.map +1 -0
  40. package/dist/api/desk-snoozes.d.ts +77 -0
  41. package/dist/api/desk-snoozes.d.ts.map +1 -0
  42. package/dist/api/desk-snoozes.js +220 -0
  43. package/dist/api/desk-snoozes.js.map +1 -0
  44. package/dist/api/diagnostics.d.ts +4 -0
  45. package/dist/api/diagnostics.d.ts.map +1 -1
  46. package/dist/api/diagnostics.js +15 -7
  47. package/dist/api/diagnostics.js.map +1 -1
  48. package/dist/api/disk-stores.d.ts +66 -0
  49. package/dist/api/disk-stores.d.ts.map +1 -0
  50. package/dist/api/disk-stores.js +206 -0
  51. package/dist/api/disk-stores.js.map +1 -0
  52. package/dist/api/domain-model.d.ts +56 -0
  53. package/dist/api/domain-model.d.ts.map +1 -0
  54. package/dist/api/domain-model.js +281 -0
  55. package/dist/api/domain-model.js.map +1 -0
  56. package/dist/api/domain-scope.d.ts +52 -0
  57. package/dist/api/domain-scope.d.ts.map +1 -0
  58. package/dist/api/domain-scope.js +156 -0
  59. package/dist/api/domain-scope.js.map +1 -0
  60. package/dist/api/eval-rule-store.d.ts +32 -0
  61. package/dist/api/eval-rule-store.d.ts.map +1 -0
  62. package/dist/api/eval-rule-store.js +77 -0
  63. package/dist/api/eval-rule-store.js.map +1 -0
  64. package/dist/api/gate-cache.d.ts +8 -0
  65. package/dist/api/gate-cache.d.ts.map +1 -1
  66. package/dist/api/gate-cache.js +8 -1
  67. package/dist/api/gate-cache.js.map +1 -1
  68. package/dist/api/mcp.d.ts +19 -0
  69. package/dist/api/mcp.d.ts.map +1 -1
  70. package/dist/api/mcp.js +166 -3
  71. package/dist/api/mcp.js.map +1 -1
  72. package/dist/api/needs.d.ts +3 -0
  73. package/dist/api/needs.d.ts.map +1 -1
  74. package/dist/api/needs.js +7 -3
  75. package/dist/api/needs.js.map +1 -1
  76. package/dist/api/post-hoc-deliver.d.ts +7 -0
  77. package/dist/api/post-hoc-deliver.d.ts.map +1 -1
  78. package/dist/api/post-hoc-deliver.js +16 -5
  79. package/dist/api/post-hoc-deliver.js.map +1 -1
  80. package/dist/api/product-publish.d.ts +242 -0
  81. package/dist/api/product-publish.d.ts.map +1 -0
  82. package/dist/api/product-publish.js +902 -0
  83. package/dist/api/product-publish.js.map +1 -0
  84. package/dist/api/product.d.ts +5 -6
  85. package/dist/api/product.d.ts.map +1 -1
  86. package/dist/api/product.js +4 -4
  87. package/dist/api/product.js.map +1 -1
  88. package/dist/api/proposal-cut.d.ts +95 -0
  89. package/dist/api/proposal-cut.d.ts.map +1 -0
  90. package/dist/api/proposal-cut.js +231 -0
  91. package/dist/api/proposal-cut.js.map +1 -0
  92. package/dist/api/requirements.d.ts +6 -4
  93. package/dist/api/requirements.d.ts.map +1 -1
  94. package/dist/api/requirements.js +6 -3
  95. package/dist/api/requirements.js.map +1 -1
  96. package/dist/api/routes.d.ts +21 -0
  97. package/dist/api/routes.d.ts.map +1 -1
  98. package/dist/api/routes.js +578 -94
  99. package/dist/api/routes.js.map +1 -1
  100. package/dist/api/run-liveness.d.ts.map +1 -1
  101. package/dist/api/run-liveness.js +3 -1
  102. package/dist/api/run-liveness.js.map +1 -1
  103. package/dist/api/run-timing-index.d.ts +10 -0
  104. package/dist/api/run-timing-index.d.ts.map +1 -1
  105. package/dist/api/run-timing-index.js +29 -9
  106. package/dist/api/run-timing-index.js.map +1 -1
  107. package/dist/api/seat-container-login.d.ts +11 -17
  108. package/dist/api/seat-container-login.d.ts.map +1 -1
  109. package/dist/api/seat-container-login.js +36 -69
  110. package/dist/api/seat-container-login.js.map +1 -1
  111. package/dist/api/server.d.ts.map +1 -1
  112. package/dist/api/server.js +1 -0
  113. package/dist/api/server.js.map +1 -1
  114. package/dist/api/system-snapshot.d.ts +5 -2
  115. package/dist/api/system-snapshot.d.ts.map +1 -1
  116. package/dist/api/system-snapshot.js +18 -6
  117. package/dist/api/system-snapshot.js.map +1 -1
  118. package/dist/api/testing.d.ts.map +1 -1
  119. package/dist/api/testing.js +11 -8
  120. package/dist/api/testing.js.map +1 -1
  121. package/dist/api/ui-text.d.ts.map +1 -1
  122. package/dist/api/ui-text.js +3 -1
  123. package/dist/api/ui-text.js.map +1 -1
  124. package/dist/apps/actions/write-path.d.ts +6 -2
  125. package/dist/apps/actions/write-path.d.ts.map +1 -1
  126. package/dist/apps/actions/write-path.js +7 -3
  127. package/dist/apps/actions/write-path.js.map +1 -1
  128. package/dist/apps/store.d.ts +11 -0
  129. package/dist/apps/store.d.ts.map +1 -1
  130. package/dist/apps/store.js +47 -0
  131. package/dist/apps/store.js.map +1 -1
  132. package/dist/apps-server/server/lib/bundle/server.mjs +19 -5
  133. package/dist/cli/index.d.ts.map +1 -1
  134. package/dist/cli/index.js +38 -52
  135. package/dist/cli/index.js.map +1 -1
  136. package/dist/cli/mcp.d.ts +14 -0
  137. package/dist/cli/mcp.d.ts.map +1 -1
  138. package/dist/cli/mcp.js +27 -10
  139. package/dist/cli/mcp.js.map +1 -1
  140. package/dist/cli/start-stand-ins.d.ts +13 -0
  141. package/dist/cli/start-stand-ins.d.ts.map +1 -0
  142. package/dist/cli/start-stand-ins.js +30 -0
  143. package/dist/cli/start-stand-ins.js.map +1 -0
  144. package/dist/core/adapter.d.ts +57 -6
  145. package/dist/core/adapter.d.ts.map +1 -1
  146. package/dist/core/adapter.js +208 -30
  147. package/dist/core/adapter.js.map +1 -1
  148. package/dist/core/ado-env.d.ts +17 -0
  149. package/dist/core/ado-env.d.ts.map +1 -0
  150. package/dist/core/ado-env.js +34 -0
  151. package/dist/core/ado-env.js.map +1 -0
  152. package/dist/core/deliver-text.d.ts +17 -0
  153. package/dist/core/deliver-text.d.ts.map +1 -1
  154. package/dist/core/deliver-text.js +76 -1
  155. package/dist/core/deliver-text.js.map +1 -1
  156. package/dist/core/deliver.d.ts +6 -0
  157. package/dist/core/deliver.d.ts.map +1 -1
  158. package/dist/core/deliver.js +12 -4
  159. package/dist/core/deliver.js.map +1 -1
  160. package/dist/core/exec.d.ts +1 -10
  161. package/dist/core/exec.d.ts.map +1 -1
  162. package/dist/core/exec.js +4 -17
  163. package/dist/core/exec.js.map +1 -1
  164. package/dist/core/governance-store.d.ts +3 -1
  165. package/dist/core/governance-store.d.ts.map +1 -1
  166. package/dist/core/governance-store.js +7 -2
  167. package/dist/core/governance-store.js.map +1 -1
  168. package/dist/core/launch-posture.d.ts +3 -0
  169. package/dist/core/launch-posture.d.ts.map +1 -1
  170. package/dist/core/launch-posture.js +4 -0
  171. package/dist/core/launch-posture.js.map +1 -1
  172. package/dist/core/repo-clone.d.ts.map +1 -1
  173. package/dist/core/repo-clone.js +2 -1
  174. package/dist/core/repo-clone.js.map +1 -1
  175. package/dist/core/run-log-facts.d.ts +56 -0
  176. package/dist/core/run-log-facts.d.ts.map +1 -0
  177. package/dist/core/run-log-facts.js +230 -0
  178. package/dist/core/run-log-facts.js.map +1 -0
  179. package/dist/core/shutdown.d.ts +27 -0
  180. package/dist/core/shutdown.d.ts.map +1 -1
  181. package/dist/core/shutdown.js +72 -0
  182. package/dist/core/shutdown.js.map +1 -1
  183. package/dist/core/stand-in.d.ts +62 -0
  184. package/dist/core/stand-in.d.ts.map +1 -0
  185. package/dist/core/stand-in.js +153 -0
  186. package/dist/core/stand-in.js.map +1 -0
  187. package/dist/core/types.d.ts +22 -0
  188. package/dist/core/types.d.ts.map +1 -1
  189. package/dist/core/types.js.map +1 -1
  190. package/dist/editors/pack-extras.d.ts +162 -0
  191. package/dist/editors/pack-extras.d.ts.map +1 -0
  192. package/dist/editors/pack-extras.js +596 -0
  193. package/dist/editors/pack-extras.js.map +1 -0
  194. package/dist/editors/pack-install.d.ts +15 -7
  195. package/dist/editors/pack-install.d.ts.map +1 -1
  196. package/dist/editors/pack-install.js +140 -19
  197. package/dist/editors/pack-install.js.map +1 -1
  198. package/dist/editors/registry.d.ts +42 -3
  199. package/dist/editors/registry.d.ts.map +1 -1
  200. package/dist/editors/registry.js +114 -11
  201. package/dist/editors/registry.js.map +1 -1
  202. package/dist/editors/routes.d.ts +10 -5
  203. package/dist/editors/routes.d.ts.map +1 -1
  204. package/dist/editors/routes.js +45 -11
  205. package/dist/editors/routes.js.map +1 -1
  206. package/dist/interactive/bridge-pool.d.ts +5 -2
  207. package/dist/interactive/bridge-pool.d.ts.map +1 -1
  208. package/dist/interactive/bridge-pool.js +4 -1
  209. package/dist/interactive/bridge-pool.js.map +1 -1
  210. package/dist/interactive/landing-guard.d.ts.map +1 -1
  211. package/dist/interactive/landing-guard.js +79 -5
  212. package/dist/interactive/landing-guard.js.map +1 -1
  213. package/dist/knowledge/adapters/toolbox/memory.d.ts.map +1 -1
  214. package/dist/knowledge/adapters/toolbox/memory.js +3 -2
  215. package/dist/knowledge/adapters/toolbox/memory.js.map +1 -1
  216. package/dist/knowledge/trackers/set.d.ts +28 -0
  217. package/dist/knowledge/trackers/set.d.ts.map +1 -1
  218. package/dist/knowledge/trackers/set.js +26 -0
  219. package/dist/knowledge/trackers/set.js.map +1 -1
  220. package/dist/mcp/policies.d.ts +44 -0
  221. package/dist/mcp/policies.d.ts.map +1 -1
  222. package/dist/mcp/policies.js +153 -1
  223. package/dist/mcp/policies.js.map +1 -1
  224. package/dist/mcp/registry-store.d.ts +10 -0
  225. package/dist/mcp/registry-store.d.ts.map +1 -1
  226. package/dist/mcp/registry-store.js.map +1 -1
  227. package/dist/mcp/registry.d.ts +43 -3
  228. package/dist/mcp/registry.d.ts.map +1 -1
  229. package/dist/mcp/registry.js +224 -16
  230. package/dist/mcp/registry.js.map +1 -1
  231. package/dist/mcp/trigger-names.d.ts +32 -0
  232. package/dist/mcp/trigger-names.d.ts.map +1 -0
  233. package/dist/mcp/trigger-names.js +529 -0
  234. package/dist/mcp/trigger-names.js.map +1 -0
  235. package/dist/persona/routes.d.ts +1 -1
  236. package/dist/persona/store.d.ts +1 -1
  237. package/dist/schedules/routes.d.ts.map +1 -1
  238. package/dist/schedules/routes.js +6 -0
  239. package/dist/schedules/routes.js.map +1 -1
  240. package/dist/skills/store.d.ts +11 -1
  241. package/dist/skills/store.d.ts.map +1 -1
  242. package/dist/skills/store.js +37 -3
  243. package/dist/skills/store.js.map +1 -1
  244. package/dist/sources/routes.d.ts +2 -2
  245. package/dist/sources/routes.d.ts.map +1 -1
  246. package/dist/studio/apps-standalone/fixture.js +3 -3
  247. package/dist/studio/assets/{KnowledgeGraph-yP4WsnST.js → KnowledgeGraph-BrHcKpFT.js} +1 -1
  248. package/dist/studio/assets/index-BCVvMebl.css +32 -0
  249. package/dist/studio/assets/{index-DW53FKuT.js → index-BqB2Ydq-.js} +337 -311
  250. package/dist/studio/editors/wicked-apps/editor.json +1 -1
  251. package/dist/studio/editors/wicked-apps/index.html +1 -1
  252. package/dist/studio/editors/wicked-deck/editor.json +1 -1
  253. package/dist/studio/editors/wicked-deck/index.html +1 -1
  254. package/dist/studio/editors/wicked-doc/editor.json +1 -1
  255. package/dist/studio/editors/wicked-doc/index.html +1 -1
  256. package/dist/studio/editors/wicked-insights/editor.json +1 -1
  257. package/dist/studio/editors/wicked-insights/index.html +1 -1
  258. package/dist/studio/editors/wicked-page/editor.json +1 -1
  259. package/dist/studio/editors/wicked-page/index.html +1 -1
  260. package/dist/studio/editors/wicked-video/editor.json +1 -1
  261. package/dist/studio/editors/wicked-video/index.html +1 -1
  262. package/dist/studio/index.html +2 -2
  263. package/dist/studio/testid-inventory.json +953 -107
  264. package/dist/team/routes.d.ts +4 -1
  265. package/dist/team/routes.d.ts.map +1 -1
  266. package/dist/team/routes.js +1 -1
  267. package/dist/team/routes.js.map +1 -1
  268. package/dist/voice/tts.d.ts +6 -0
  269. package/dist/voice/tts.d.ts.map +1 -1
  270. package/dist/voice/tts.js +16 -1
  271. package/dist/voice/tts.js.map +1 -1
  272. package/endpoint-manifest.json +100 -6
  273. package/package.json +4 -4
  274. package/voice-locks/darwin-arm64-cp310.txt +12 -0
  275. package/voice-locks/darwin-arm64-cp311.txt +8 -0
  276. package/voice-locks/darwin-arm64-cp312.txt +8 -0
  277. package/voice-locks/darwin-arm64-cp313.txt +8 -0
  278. package/voice-locks/darwin-arm64-cp314.txt +8 -0
  279. package/voice-locks/darwin-arm64-cp39.txt +12 -0
  280. package/voice-locks/darwin-x64-cp310.txt +12 -0
  281. package/voice-locks/darwin-x64-cp311.txt +12 -0
  282. package/voice-locks/darwin-x64-cp312.txt +12 -0
  283. package/voice-locks/darwin-x64-cp313.txt +12 -0
  284. package/voice-locks/darwin-x64-cp39.txt +12 -0
  285. package/voice-locks/linux-arm64-cp310.txt +12 -0
  286. package/voice-locks/linux-arm64-cp311.txt +8 -0
  287. package/voice-locks/linux-arm64-cp312.txt +8 -0
  288. package/voice-locks/linux-arm64-cp313.txt +8 -0
  289. package/voice-locks/linux-arm64-cp314.txt +8 -0
  290. package/voice-locks/linux-arm64-cp39.txt +12 -0
  291. package/voice-locks/linux-x64-cp310.txt +12 -0
  292. package/voice-locks/linux-x64-cp311.txt +8 -0
  293. package/voice-locks/linux-x64-cp312.txt +8 -0
  294. package/voice-locks/linux-x64-cp313.txt +8 -0
  295. package/voice-locks/linux-x64-cp314.txt +8 -0
  296. package/voice-locks/linux-x64-cp39.txt +12 -0
  297. package/dist/studio/assets/index-DNaLjJ7M.css +0 -32
@@ -48,6 +48,7 @@ import { documentPathPlan } from '../interactive/source-packet.js';
48
48
  import { tornTailPrefix } from './chat-transcripts.js';
49
49
  import { catalogDigest, detect, detectable } from '../workflow-catalog/detect.js';
50
50
  import { OnboardBlock, resolveOnboard } from './proposal-onboard.js';
51
+ import { CUT_BLOCKING, CutBlock, cutInterruptedWords, resolveCut } from './proposal-cut.js';
51
52
  // ── the block ──────────────────────────────────────────────────────────────────────────────────────────────────────
52
53
  /** Sources a block may name. */
53
54
  export const PROPOSAL_SOURCES_MAX = 12;
@@ -108,7 +109,7 @@ export function parseMakeBlock(body) {
108
109
  if (raw === null || typeof raw !== 'object' || Array.isArray(raw))
109
110
  return null;
110
111
  const o = raw;
111
- const ops = ['entry', 'refine', 'theme', 'onboard'].filter((k) => o[k] !== undefined && o[k] !== null);
112
+ const ops = ['entry', 'refine', 'theme', 'onboard', 'cut'].filter((k) => o[k] !== undefined && o[k] !== null);
112
113
  if (ops.length !== 1)
113
114
  return null;
114
115
  if (ops[0] === 'entry') {
@@ -124,6 +125,11 @@ export function parseMakeBlock(body) {
124
125
  const r = OnboardBlock.safeParse(o);
125
126
  return r.success ? { op: 'onboard', ...r.data } : null;
126
127
  }
128
+ if (ops[0] === 'cut') {
129
+ // studio#1140 (a): a change to the demo video open in the chat (resolved by `proposal-cut.ts`).
130
+ const r = CutBlock.safeParse(o);
131
+ return r.success ? { op: 'cut', ...r.data } : null;
132
+ }
127
133
  const r = ThemeBlock.safeParse(o);
128
134
  return r.success ? { op: 'theme', ...r.data } : null;
129
135
  }
@@ -357,9 +363,10 @@ export class LaunchOnceRegistry {
357
363
  /** The run this identity names, when it exists (adopted, never started again), with whether a stub took it. */
358
364
  async find(kind, identity) {
359
365
  const d = this.dispatchers.get(kind);
360
- if (d === undefined || !(await d.find(identity)))
366
+ const found = d === undefined ? false : await d.find(identity);
367
+ if (d === undefined || found === false)
361
368
  return null;
362
- return { stub: d.stub === true };
369
+ return { stub: d.stub === true, ...(typeof found === 'object' ? { version: found.version } : {}) };
363
370
  }
364
371
  async live(kind, runId, runs) {
365
372
  const d = this.dispatchers.get(kind);
@@ -382,13 +389,15 @@ export class LaunchOnceRegistry {
382
389
  return Promise.reject(new Error(`nothing can start a ${dispatch.kind} on this daemon yet`));
383
390
  return this.lock.run(dispatch.identity.runId, async () => {
384
391
  const base = { runId: dispatch.identity.runId, artifactRef: dispatch.identity.artifactRef, stub: d.stub === true };
385
- if (await d.find(dispatch.identity))
386
- return { ...base, adopted: true };
387
- await d.launch(dispatch);
392
+ const found = await d.find(dispatch.identity);
393
+ if (found !== false)
394
+ return { ...base, adopted: true, ...(typeof found === 'object' ? { version: found.version } : {}) };
395
+ const made = await d.launch(dispatch);
388
396
  const ref = dispatch.identity.artifactRef;
389
- if (ref !== null)
397
+ // A cut starts no run: nothing of it is live after its launch (its version is its outcome).
398
+ if (ref !== null && dispatch.kind !== 'cut')
390
399
  this.byArtifact.set(ref, [...(this.byArtifact.get(ref) ?? []).slice(-15), { kind: dispatch.kind, runId: dispatch.identity.runId }]);
391
- return { ...base, adopted: false };
400
+ return { ...base, adopted: false, ...(made !== undefined && made !== null ? { version: made.version } : {}) };
392
401
  });
393
402
  }
394
403
  }
@@ -490,7 +499,7 @@ export const PROPOSAL_WORKFLOWS = {
490
499
  demo: 'demo',
491
500
  };
492
501
  /** studio#1140: why a refine of a demo cut is blocked (the card says it after the document's title). */
493
- export const CUT_BLOCKED = "a demo video: this chat can't change it. Change it by hand in the video editor (chapters, trims, captions, theme)";
502
+ export const CUT_BLOCKED = "a demo video: ask for its change in this chat as a video change, not a page change (or change it by hand in the video editor)";
494
503
  const STOPS = {
495
504
  create: 'Stops for you if the check fails. The plan or an escalation may also ask.',
496
505
  refine: 'Stops for you if the check fails. The plan or an escalation may also ask.',
@@ -782,6 +791,8 @@ export class ChatProposals {
782
791
  // crew-0182: the onboard block, for a client that draws the card (its seat is told only then).
783
792
  // `o.onboard`: this message's own declaration (the chat's stored one changes only once the message is accepted).
784
793
  ...(on && f.onboard === true && chatId !== undefined && this.deps.onboard !== undefined && (o.onboard ?? this.deps.acceptsOnboard?.(chatId)) === true ? { onboard: true } : {}),
794
+ // crew#1814: the cut block, for a client that draws the card (crew's note on an open video says when it fits).
795
+ ...(on && f.cut === true && chatId !== undefined && this.deps.cut !== undefined && (o.cut ?? this.deps.acceptsCut?.(chatId)) === true ? { cut: true } : {}),
785
796
  entries,
786
797
  ...(jobs !== undefined ? { jobs } : {}),
787
798
  };
@@ -931,6 +942,15 @@ export class ChatProposals {
931
942
  return this.refused(chatId, 'onboard');
932
943
  return resolveOnboard(block, { pid, chatId, turnId, seat, chatProjectId: chat.projectId === null || chat.projectId === 'default' ? null : chat.projectId, words }, this.deps.onboard);
933
944
  }
945
+ if (block.op === 'cut') {
946
+ // Only for a client that draws the card (its seat was told the block exists only then), and only for the video
947
+ // open in this very turn.
948
+ if (flags.cut !== true || this.deps.cut === undefined || this.deps.acceptsCut?.(chatId) !== true)
949
+ return this.refused(chatId, 'cut');
950
+ const projectId = chat.projectId === null || chat.projectId === 'default' ? null : chat.projectId;
951
+ const f = await filedIn(projectId);
952
+ return resolveCut(block, { pid, chatId, turnId, seat, binding: turnHas ? binding : null, projectId, filedInLabel: f.label }, this.deps.cut);
953
+ }
934
954
  if (block.op === 'theme') {
935
955
  if (!flags.theme)
936
956
  return this.refused(chatId, 'theme');
@@ -1385,16 +1405,32 @@ export class ChatProposals {
1385
1405
  }
1386
1406
  if (folded.state === 'accepting' && folded.accepting !== undefined) {
1387
1407
  const acc = folded.accepting;
1388
- const found = await this.deps.registry.find(kind, acc.identity);
1408
+ let found;
1409
+ try {
1410
+ found = await this.deps.registry.find(kind, acc.identity);
1411
+ }
1412
+ catch (err) {
1413
+ // studio#1140 (a): a cut still rendering is neither decided nor declined; a deleted video blocks its card; a
1414
+ // video tool that can't answer leaves the Go interrupted (Go again asks again).
1415
+ if (err instanceof LaunchRefusal && kind === 'cut' && err.body['code'] === 'cut_pending') {
1416
+ return { code: 409, body: { code: 'cut_pending', error: err.message, view: viewOf(folded) } };
1417
+ }
1418
+ if (err instanceof LaunchRefusal && kind === 'cut' && CUT_BLOCKING.has(err.body['code'])) {
1419
+ return this.blockCut(chatId, folded, acc.resolution, instance, err.body['code'], err.message);
1420
+ }
1421
+ if (kind !== 'cut')
1422
+ throw err;
1423
+ return { code: 502, body: { code: 'launch_failed', error: cutInterruptedWords(err instanceof Error ? err.message : String(err)), view: viewOf(folded) } };
1424
+ }
1389
1425
  if (found !== null) {
1390
1426
  // Its run exists: adopt it and decide (a crash after the launch, or a lost response).
1391
- const result = { runId: acc.identity.runId, artifactRef: acc.identity.artifactRef, adopted: true, stub: found.stub };
1427
+ const result = { runId: acc.identity.runId, artifactRef: acc.identity.artifactRef, adopted: true, stub: found.stub, ...(found.version !== undefined ? { version: found.version } : {}) };
1392
1428
  if (!this.decided(chatId, folded.turnId, pid, actor, 'go', result, acc.resolution, acc.edits, instance))
1393
1429
  return this.gone(chatId);
1394
1430
  const after = reread();
1395
1431
  if (body.decision === 'go')
1396
1432
  return ok(after);
1397
- return { code: 409, body: { code: 'proposal_decided', error: 'this proposal had already started', view: viewOf(after) } };
1433
+ return { code: 409, body: { code: 'proposal_decided', error: kind === 'cut' ? `The new version was already made${found.version !== undefined ? ` (version ${found.version})` : ''}, so it stays. Undo in the video's editor brings back the one before.` : 'this proposal had already started', view: viewOf(after) } };
1398
1434
  }
1399
1435
  if (body.decision === 'not_now') {
1400
1436
  if (!this.decided(chatId, folded.turnId, pid, actor, 'not_now', null, acc.resolution, acc.edits, instance))
@@ -1576,12 +1612,25 @@ export class ChatProposals {
1576
1612
  return { code: 409, body: { code: 'source_gone', error: gone, view: viewOf(folded) } };
1577
1613
  // A theme is no job (§15.2): applying colours never waits for a run of this chat.
1578
1614
  // An onboard card starts no job of this chat either (crew-0182): it registers a repository.
1579
- const busy = kind === 'theme' || kind === 'onboard' ? null : await this.busy(chatId, identity.artifactRef, resolution);
1615
+ // A cut starts no run either (studio#1140): the video tool's queue serializes it with the person's hand edits.
1616
+ const busy = kind === 'theme' || kind === 'onboard' || kind === 'cut' ? null : await this.busy(chatId, identity.artifactRef, resolution);
1580
1617
  if (busy !== null)
1581
1618
  return { code: 409, body: { code: busy.code, error: busy.reason, view: viewOf(folded) } };
1582
1619
  // A refine is on the head it was proposed on; else the card re-resolves (same pid, the new base). Read last, right
1583
1620
  // before the record: the landing itself is checked against this base (`expect_head`, slices I1 and A5).
1584
- if (resolution.target !== undefined) {
1621
+ if (kind === 'cut' && resolution.target !== undefined) {
1622
+ // studio#1140 (a): a cut is never rebased. A fresh Go on a moved video blocks the card; Go again (an accepting
1623
+ // record) skips this check, because the video tool checks the Go's request id before its head (DES-B7 R3).
1624
+ const ref = parseArtifactRef(resolution.target.ref);
1625
+ const root = await this.deps.docsRoot(ref.projectId);
1626
+ const head = root === null ? null : artifactHead(root, ref.doc);
1627
+ if (head === null)
1628
+ return this.blockCut(chatId, folded, resolution, instance, 'cut_gone', `${resolution.target.title} is gone.`);
1629
+ if (folded.state !== 'accepting' && head !== resolution.target.base) {
1630
+ return this.blockCut(chatId, folded, resolution, instance, 'cut_moved', `The video changed since this was proposed (now version ${head}). Ask again to change the new version.`);
1631
+ }
1632
+ }
1633
+ else if (resolution.target !== undefined) {
1585
1634
  const ref = parseArtifactRef(resolution.target.ref);
1586
1635
  const root = await this.deps.docsRoot(ref.projectId);
1587
1636
  const head = root === null ? null : artifactHead(root, ref.doc);
@@ -1653,6 +1702,16 @@ export class ChatProposals {
1653
1702
  catch (err) {
1654
1703
  // crew#1695: every refusal after this Go's accepting write names that record (`acceptingAt`), so a client marks
1655
1704
  // only it stopped, never another tab's newer Go.
1705
+ // studio#1140 (a): a cut the video tool refused is blocked with its words (asking again is the way on); one still
1706
+ // rendering keeps its accepting record.
1707
+ if (err instanceof LaunchRefusal && kind === 'cut' && err.body['code'] === 'cut_pending') {
1708
+ return { code: 409, body: { code: 'cut_pending', error: err.message, acceptingAt: accepting.at, view: viewOf(foldProposals(this.deps.records(chatId)).get(pid) ?? folded) } };
1709
+ }
1710
+ if (err instanceof LaunchRefusal && kind === 'cut' && CUT_BLOCKING.has(err.body['code'])) {
1711
+ this.deps.audit('chat.proposal.launch_refused', actor, { chatId, pid, code: err.body['code'], error: err.message });
1712
+ const r = this.blockCut(chatId, folded, resolution, instance, err.body['code'], err.message, err.status);
1713
+ return { code: r.code, body: { ...r.body, acceptingAt: accepting.at } };
1714
+ }
1656
1715
  if (err instanceof LaunchRefusal) {
1657
1716
  const reopened = this.reopenLaunch(chatId, folded, resolution, instance);
1658
1717
  if (reopened === null)
@@ -1669,13 +1728,23 @@ export class ChatProposals {
1669
1728
  const msg = err instanceof Error ? err.message : String(err);
1670
1729
  this.deps.audit('chat.proposal.launch_failed', actor, { chatId, pid, error: msg, ...(power !== undefined ? { power } : {}) });
1671
1730
  const after = foldProposals(this.deps.records(chatId)).get(pid);
1672
- return { code: 502, body: { code: 'launch_failed', error: `could not start it: ${msg}. Go again resumes the same job.`, acceptingAt: accepting.at, ...(after !== undefined ? { view: viewOf(after) } : {}) } };
1731
+ // A cut starts no run: its card says crew's own sentence and what Go again does (R2 C1).
1732
+ const said = resolution.kind === 'cut' ? cutInterruptedWords(msg) : `could not start it: ${msg}. Go again resumes the same job.`;
1733
+ return { code: 502, body: { code: 'launch_failed', error: said, acceptingAt: accepting.at, ...(after !== undefined ? { view: viewOf(after) } : {}) } };
1673
1734
  }
1674
1735
  if (!this.decided(chatId, folded.turnId, pid, actor, 'go', result, resolution, edits, instance, power))
1675
1736
  return this.gone(chatId, accepting.at);
1676
1737
  const after = foldProposals(this.deps.records(chatId)).get(pid) ?? folded;
1677
1738
  return { code: 200, body: { view: viewOf(after) } };
1678
1739
  }
1740
+ /** studio#1140 (a): a cut card that can't make its change any more is re-written blocked with the words (no rebase,
1741
+ * no Go). The person asks again for a new card. */
1742
+ blockCut(chatId, folded, resolution, instance, code, words, status = 409) {
1743
+ if (!this.write(chatId, { at: this.now(), turnId: folded.turnId, kind: 'proposal', proposal: { ...resolution, blocked: words } }, instance))
1744
+ return this.gone(chatId);
1745
+ const after = foldProposals(this.deps.records(chatId)).get(resolution.pid);
1746
+ return { code: status, body: { code, error: words, ...(after !== undefined ? { view: viewOf(after) } : {}) } };
1747
+ }
1679
1748
  reopenLaunch(chatId, folded, resolution, instance) {
1680
1749
  const proposal = { ...resolution };
1681
1750
  // A Go-only opt-in belongs to that attempt; a reshape card keeps its own prior choice.
@@ -1720,7 +1789,7 @@ export class ChatProposals {
1720
1789
  /** The identity a Go is named by (DES §4.3 step 2). */
1721
1790
  identityOf(p) {
1722
1791
  const runId = proposalRunId(p.pid);
1723
- if (p.kind === 'refine')
1792
+ if (p.kind === 'refine' || p.kind === 'cut')
1724
1793
  return { artifactRef: p.target?.ref ?? null, runId };
1725
1794
  if (p.kind === 'create') {
1726
1795
  // A retry fills the same document again (§4.3: artifact identity and attempt identity are separate).
@@ -1833,6 +1902,8 @@ export class ChatProposals {
1833
1902
  demo: ['audience', 'show', 'helpers'],
1834
1903
  // An onboard card is changed by saying so in the chat (a new proposal replaces it); Go takes no edits.
1835
1904
  onboard: [],
1905
+ // So is a cut card (studio#1140): its ops are frozen with the head they were proposed on.
1906
+ cut: [],
1836
1907
  };
1837
1908
  const kindAllowed = allowed[p.kind];
1838
1909
  for (const k of Object.keys(edits)) {
@@ -3548,10 +3619,19 @@ export class ChatProposals {
3548
3619
  const acc = f?.accepting;
3549
3620
  if (f === undefined || acc === undefined || f.state !== 'accepting')
3550
3621
  return false;
3551
- const found = await this.deps.registry.find(f.proposal.kind, acc.identity);
3622
+ let found;
3623
+ try {
3624
+ found = await this.deps.registry.find(f.proposal.kind, acc.identity);
3625
+ }
3626
+ catch (err) {
3627
+ // A cut still rendering, or a video tool that can't answer, settles at the person's Go again.
3628
+ if (f.proposal.kind === 'cut')
3629
+ return false;
3630
+ throw err;
3631
+ }
3552
3632
  if (found === null)
3553
3633
  return false;
3554
- const result = { runId: acc.identity.runId, artifactRef: acc.identity.artifactRef, adopted: true, stub: found.stub };
3634
+ const result = { runId: acc.identity.runId, artifactRef: acc.identity.artifactRef, adopted: true, stub: found.stub, ...(found.version !== undefined ? { version: found.version } : {}) };
3555
3635
  const actor = { id: acc.actor, kind: 'human', trust: 'operator' };
3556
3636
  return this.decided(chatId, f.turnId, pid, actor, 'go', result, acc.resolution, acc.edits, instance);
3557
3637
  });