@cmmd-center/forge 0.12.0 → 0.13.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.
Files changed (25) hide show
  1. package/dist/bin.cjs +140 -61
  2. package/dist/bin.mjs +137 -60
  3. package/dist/client/assets/{CanvasPanel-CL4T3ptl.js → CanvasPanel-BUdwnabz.js} +2 -2
  4. package/dist/client/assets/{CompositeItem-NATmsDHX.js → CompositeItem-BxaZQRyb.js} +2 -2
  5. package/dist/client/assets/{DiffPanel-29UmSyE3.js → DiffPanel-BOLibNHF.js} +3 -3
  6. package/dist/client/assets/{DiffPanel.logic-D5Bn5tgT.js → DiffPanel.logic-BrRjlJeM.js} +2 -2
  7. package/dist/client/assets/DiffPanelShell-CgycIPfE.js +2531 -0
  8. package/dist/client/assets/{DiffWorkerPoolProvider-BMZL3CsO.js → DiffWorkerPoolProvider-jWJpEXVo.js} +8 -8
  9. package/dist/client/assets/PullRequestCodePanel-BW7XdaG8.js +5 -0
  10. package/dist/client/assets/{Virtualizer-uq0d5TwY.js → Virtualizer-qjNwH1hl.js} +2 -2
  11. package/dist/client/assets/{canvasStateStore-DtidOKbV.js → canvasStateStore-DDwjZ3AG.js} +2 -2
  12. package/dist/client/assets/{cmmdAuthRedirect-CzACd5XJ.js → cmmdAuthRedirect-CPfIOB5Y.js} +2 -2
  13. package/dist/client/assets/index-9clxg-cN.js +151 -0
  14. package/dist/client/assets/index-Dk7T0zVg.css +1 -0
  15. package/dist/client/assets/src-dZ5rHSKC.js +3 -0
  16. package/dist/client/assets/{toggle-pwklbW9N.js → toggle-Bn-2EZmB.js} +2 -2
  17. package/dist/client/assets/{useTriggerFocusGuards-CPLQ8_CW.js → useTriggerFocusGuards-DRINKzwL.js} +2 -2
  18. package/dist/client/index.html +11 -11
  19. package/dist/forge-build.json +1 -1
  20. package/package.json +1 -1
  21. package/dist/client/assets/DiffPanelShell-ClKPX_Pu.js +0 -2531
  22. package/dist/client/assets/PullRequestCodePanel-Cp75delh.js +0 -5
  23. package/dist/client/assets/index-BMcOaHS_.css +0 -1
  24. package/dist/client/assets/index-BOI5P7rG.js +0 -151
  25. package/dist/client/assets/src-BlFkWEsP.js +0 -3
package/dist/bin.mjs CHANGED
@@ -16520,7 +16520,7 @@ function makeNetServiceShape(createServer = Net.createServer) {
16520
16520
  }
16521
16521
  //#endregion
16522
16522
  //#region ../../packages/shared/src/releaseInfo.generated.ts
16523
- const FORGE_RELEASE_VERSION = "0.12.0";
16523
+ const FORGE_RELEASE_VERSION = "0.13.0";
16524
16524
  //#endregion
16525
16525
  //#region ../../packages/shared/src/hostProcess.ts
16526
16526
  /**
@@ -18580,6 +18580,40 @@ const TerminalError = Union([
18580
18580
  TerminalControlSequenceError,
18581
18581
  TerminalSignalError
18582
18582
  ]);
18583
+ const ProjectScript = Struct({
18584
+ id: TrimmedNonEmptyString,
18585
+ name: TrimmedNonEmptyString,
18586
+ command: TrimmedNonEmptyString,
18587
+ icon: Literals([
18588
+ "play",
18589
+ "test",
18590
+ "lint",
18591
+ "configure",
18592
+ "build",
18593
+ "debug"
18594
+ ]),
18595
+ runOnWorktreeCreate: Boolean$1
18596
+ });
18597
+ const ProjectScriptUpdateCommand = Struct({
18598
+ type: Literal("project.script.update"),
18599
+ commandId: CommandId,
18600
+ projectId: ProjectId,
18601
+ mutation: Union([
18602
+ Struct({
18603
+ kind: Literal("add"),
18604
+ script: ProjectScript
18605
+ }),
18606
+ Struct({
18607
+ kind: Literal("update"),
18608
+ script: ProjectScript,
18609
+ expected: ProjectScript
18610
+ }),
18611
+ Struct({
18612
+ kind: Literal("remove"),
18613
+ expected: ProjectScript
18614
+ })
18615
+ ])
18616
+ });
18583
18617
  //#endregion
18584
18618
  //#region ../../packages/contracts/src/model.ts
18585
18619
  const CODEX_REASONING_EFFORT_OPTIONS = [
@@ -19222,20 +19256,6 @@ const UploadChatImageAttachment = Struct({
19222
19256
  });
19223
19257
  const ChatAttachment = Union([ChatImageAttachment]);
19224
19258
  const UploadChatAttachment = Union([UploadChatImageAttachment]);
19225
- const ProjectScript = Struct({
19226
- id: TrimmedNonEmptyString,
19227
- name: TrimmedNonEmptyString,
19228
- command: TrimmedNonEmptyString,
19229
- icon: Literals([
19230
- "play",
19231
- "test",
19232
- "lint",
19233
- "configure",
19234
- "build",
19235
- "debug"
19236
- ]),
19237
- runOnWorktreeCreate: Boolean$1
19238
- });
19239
19259
  /**
19240
19260
  * Availability of the project's `workspaceRoot` on the server's filesystem.
19241
19261
  *
@@ -19865,6 +19885,7 @@ const ThreadSessionStopCommand = Struct({
19865
19885
  const DispatchableClientOrchestrationCommand = Union([
19866
19886
  ProjectCreateCommand,
19867
19887
  ProjectMetaUpdateCommand,
19888
+ ProjectScriptUpdateCommand,
19868
19889
  ProjectDeleteCommand,
19869
19890
  ThreadCreateCommand,
19870
19891
  ThreadDeleteCommand,
@@ -19886,6 +19907,7 @@ const DispatchableClientOrchestrationCommand = Union([
19886
19907
  const ClientOrchestrationCommand = Union([
19887
19908
  ProjectCreateCommand,
19888
19909
  ProjectMetaUpdateCommand,
19910
+ ProjectScriptUpdateCommand,
19889
19911
  ProjectDeleteCommand,
19890
19912
  ThreadCreateCommand,
19891
19913
  ThreadDeleteCommand,
@@ -31554,6 +31576,10 @@ const relayCommandPolicyByType = {
31554
31576
  requiredScope: "project.write",
31555
31577
  deliveryClass: "idempotent-command"
31556
31578
  },
31579
+ "project.script.update": {
31580
+ requiredScope: "project.write",
31581
+ deliveryClass: "idempotent-command"
31582
+ },
31557
31583
  "project.delete": {
31558
31584
  requiredScope: "project.write",
31559
31585
  deliveryClass: "idempotent-command"
@@ -65533,7 +65559,7 @@ function normalizeNumberish(value) {
65533
65559
  }
65534
65560
  //#endregion
65535
65561
  //#region package.json
65536
- var version$1 = "0.12.0";
65562
+ var version$1 = "0.13.0";
65537
65563
  //#endregion
65538
65564
  //#region src/sentry.ts
65539
65565
  const SERVER_APP_NAME = "forge-server";
@@ -95646,6 +95672,10 @@ function threadStatus(thread) {
95646
95672
  if (thread.latestTurn) return "running";
95647
95673
  return "active";
95648
95674
  }
95675
+ function threadProviderAccountId(thread) {
95676
+ const selection = thread.modelSelection;
95677
+ return selection && "providerAccountId" in selection ? selection.providerAccountId ?? null : null;
95678
+ }
95649
95679
  function serializeRuntimeInventory(snapshot, providerInventory) {
95650
95680
  const activeProjects = snapshot.projects.filter((project) => project.availability !== "missing");
95651
95681
  const projectIds = new Set(activeProjects.map((project) => project.id));
@@ -95676,6 +95706,7 @@ function serializeRuntimeInventory(snapshot, providerInventory) {
95676
95706
  status: threadStatus(thread),
95677
95707
  model: thread.modelSelection?.model ?? null,
95678
95708
  provider: thread.modelSelection?.provider ?? null,
95709
+ providerAccountId: threadProviderAccountId(thread),
95679
95710
  branch: thread.branch,
95680
95711
  lastActivityAt: thread.latestUserMessageAt ?? thread.updatedAt,
95681
95712
  kind: thread.kind,
@@ -98907,7 +98938,7 @@ var BrowserManager = class extends Service$1()("forge/browser/Services/Manager/B
98907
98938
  const DEFAULT_PORT_MIN = 5200;
98908
98939
  const DEFAULT_PORT_MAX = 5999;
98909
98940
  var ThreadDevRuntime = class extends Service$1()("forge/threadDevRuntime/ThreadDevRuntime") {};
98910
- function nowIso$4() {
98941
+ function nowIso$5() {
98911
98942
  return (/* @__PURE__ */ new Date()).toISOString();
98912
98943
  }
98913
98944
  function previewUrlForPort(port) {
@@ -98934,7 +98965,7 @@ const ThreadDevRuntimeLive = effect(ThreadDevRuntime, gen(function* () {
98934
98965
  allocatedPort: port,
98935
98966
  status: "allocated",
98936
98967
  previewUrl: previewUrlForPort(port),
98937
- updatedAt: nowIso$4()
98968
+ updatedAt: nowIso$5()
98938
98969
  };
98939
98970
  yield* update$4(byThreadId, (current) => {
98940
98971
  const next = new Map(current);
@@ -98956,7 +98987,7 @@ const ThreadDevRuntimeLive = effect(ThreadDevRuntime, gen(function* () {
98956
98987
  next.set(input.threadId, {
98957
98988
  ...existing,
98958
98989
  status: "released",
98959
- updatedAt: nowIso$4()
98990
+ updatedAt: nowIso$5()
98960
98991
  });
98961
98992
  return next;
98962
98993
  });
@@ -98982,7 +99013,7 @@ const ThreadDevRuntimeLive = effect(ThreadDevRuntime, gen(function* () {
98982
99013
  ...patch.terminalId !== void 0 ? { terminalId: patch.terminalId } : {},
98983
99014
  ...patch.previewUrl !== void 0 ? { previewUrl: patch.previewUrl } : {},
98984
99015
  ...patch.tunnelId !== void 0 ? { tunnelId: patch.tunnelId } : {},
98985
- updatedAt: nowIso$4()
99016
+ updatedAt: nowIso$5()
98986
99017
  };
98987
99018
  yield* update$4(byThreadId, (current) => {
98988
99019
  const next = new Map(current);
@@ -210566,6 +210597,11 @@ const PUBLIC_PROVIDER_LEAK_PATTERNS = [
210566
210597
  /https?:\/\/[^\s'"<>)]*(?:apex|deepseek|moonshot|kimi)[^\s'"<>)]*/i
210567
210598
  ];
210568
210599
  const DEFAULT_PUBLIC_PROVIDER_ERROR = "CMMD is temporarily unavailable. Check the workspace AI connection and retry.";
210600
+ function isProviderRateOrQuotaError(message) {
210601
+ if (!message) return false;
210602
+ const normalized = message.toLowerCase();
210603
+ return /\b(rate[\s-]?limit|too\s+many\s+requests|usage[ _-]limit|usage_limit_reached|quota|insufficient_quota)\b/.test(normalized) || /\b429\b/.test(normalized);
210604
+ }
210569
210605
  /**
210570
210606
  * Infer a SAFE, clearer failure category from a (possibly leaky) provider error.
210571
210607
  *
@@ -210581,7 +210617,7 @@ function categorizePublicProviderError(message) {
210581
210617
  if (/\bforge_runtime_stopped\b/.test(m) || /\bthis turn was interrupted because the environment was stopped\b/.test(m)) return "This turn was interrupted because the environment was stopped. Start the environment and retry.";
210582
210618
  if (/\bforge_provider_model_not_allowed\b/.test(m) || /\bnot\s+scoped\s+to\s+the\s+requested\s+model\b/.test(m)) return "The workspace AI credential does not cover the model this turn asked for. Retry, or pick that model for the thread.";
210583
210619
  if (/\bmodel\b[\s\S]*\b(not\s+(found|available|supported)|does\s+not\s+exist|unsupported|invalid|unknown)\b/.test(m) || /\b(unsupported|unknown|invalid)\b[\s\S]*\bmodel\b/.test(m) || /\b(model_not_found|invalid_model|model_not_supported)\b/.test(m)) return "The selected model isn't available right now. Pick a different model and retry.";
210584
- if (/\b(rate[\s-]?limit|too\s+many\s+requests|quota|insufficient_quota)\b/.test(m) || /\b429\b/.test(m)) return "The AI service is rate-limited or out of quota. Wait a moment and retry.";
210620
+ if (isProviderRateOrQuotaError(m)) return "The AI service is rate-limited or out of quota. Wait a moment and retry.";
210585
210621
  if (/\b(unauthorized|forbidden|authentication\s+(failed|error|required)|invalid\s+api\s+key|expired\s+(token|credential))\b/.test(m) || /\b40[13]\b/.test(m)) return "Workspace AI authentication failed. Reconnect the workspace and retry.";
210586
210622
  if (/\b(timed?\s*out|timeout|overloaded|service\s+unavailable)\b/.test(m) || /\b50[234]\b/.test(m)) return "The AI service is temporarily overloaded. Retry in a moment.";
210587
210623
  return null;
@@ -228212,7 +228248,7 @@ const OpenCodeRuntimeLive = effect(OpenCodeRuntime, makeOpenCodeRuntime).pipe(pr
228212
228248
  //#endregion
228213
228249
  //#region src/provider/Layers/OpenCodeAdapter.ts
228214
228250
  const PROVIDER$5 = "opencode";
228215
- const nowIso$3 = map$3(now, formatIso);
228251
+ const nowIso$4 = map$3(now, formatIso);
228216
228252
  /**
228217
228253
  * Map a tagged OpenCodeRuntimeError produced by {@link runOpenCodeSdk} into
228218
228254
  * the adapter-boundary `ProviderAdapterRequestError`. SDK-method-level call
@@ -228239,7 +228275,7 @@ const toProcessError = (threadId, cause) => new ProviderAdapterProcessError({
228239
228275
  });
228240
228276
  const buildEventBase = (input) => gen(function* () {
228241
228277
  const uuid = yield* nextUUIDv4;
228242
- const createdAt = input.createdAt ?? (yield* nowIso$3);
228278
+ const createdAt = input.createdAt ?? (yield* nowIso$4);
228243
228279
  return {
228244
228280
  eventId: EventId.make(uuid),
228245
228281
  provider: PROVIDER$5,
@@ -228398,7 +228434,7 @@ function sessionErrorMessage(error) {
228398
228434
  }
228399
228435
  function updateProviderSession(context, patch, options) {
228400
228436
  return gen(function* () {
228401
- const updatedAt = yield* nowIso$3;
228437
+ const updatedAt = yield* nowIso$4;
228402
228438
  const nextSession = {
228403
228439
  ...context.session,
228404
228440
  ...patch,
@@ -228520,7 +228556,7 @@ function makeOpenCodeAdapter(openCodeSettings, options) {
228520
228556
  if (("properties" in event ? event.properties.sessionID : void 0) !== context.openCodeSessionId) return;
228521
228557
  const turnId = context.activeTurnId;
228522
228558
  yield* writeNativeEventBestEffort(context.session.threadId, {
228523
- observedAt: yield* nowIso$3,
228559
+ observedAt: yield* nowIso$4,
228524
228560
  event: {
228525
228561
  provider: PROVIDER$5,
228526
228562
  threadId: context.session.threadId,
@@ -228836,7 +228872,7 @@ function makeOpenCodeAdapter(openCodeSettings, options) {
228836
228872
  yield* close(started.sessionScope, void_$3).pipe(ignore);
228837
228873
  return raceWinner.session;
228838
228874
  }
228839
- const createdAt = yield* nowIso$3;
228875
+ const createdAt = yield* nowIso$4;
228840
228876
  const session = {
228841
228877
  provider: PROVIDER$5,
228842
228878
  status: "ready",
@@ -235600,7 +235636,7 @@ function filterEvents(events, options) {
235600
235636
  });
235601
235637
  return options.limit === void 0 ? filtered : filtered.slice(-options.limit);
235602
235638
  }
235603
- function nowIso$2() {
235639
+ function nowIso$3() {
235604
235640
  return (/* @__PURE__ */ new Date()).toISOString();
235605
235641
  }
235606
235642
  //#endregion
@@ -235615,7 +235651,7 @@ var BrowserActionEventRecorder = class {
235615
235651
  type: "browser.action",
235616
235652
  action,
235617
235653
  ...this.sessionFields(),
235618
- timestamp: nowIso$2()
235654
+ timestamp: nowIso$3()
235619
235655
  });
235620
235656
  }
235621
235657
  async result(action) {
@@ -235624,7 +235660,7 @@ var BrowserActionEventRecorder = class {
235624
235660
  action,
235625
235661
  ok: true,
235626
235662
  ...this.sessionFields(),
235627
- timestamp: nowIso$2()
235663
+ timestamp: nowIso$3()
235628
235664
  });
235629
235665
  }
235630
235666
  async error(action, error) {
@@ -235633,7 +235669,7 @@ var BrowserActionEventRecorder = class {
235633
235669
  action,
235634
235670
  error: error instanceof Error ? error.message : String(error),
235635
235671
  ...this.sessionFields(),
235636
- timestamp: nowIso$2()
235672
+ timestamp: nowIso$3()
235637
235673
  });
235638
235674
  }
235639
235675
  sessionFields() {
@@ -236154,7 +236190,7 @@ var AgentBrowser = class {
236154
236190
  await this.options.events?.record({
236155
236191
  type: "browser.safety.confirmation.requested",
236156
236192
  ...request,
236157
- createdAt: nowIso$2()
236193
+ createdAt: nowIso$3()
236158
236194
  });
236159
236195
  const result = await this.resolveConfirmation(request);
236160
236196
  const approved = typeof result === "boolean" ? result : result.approved;
@@ -236162,7 +236198,7 @@ var AgentBrowser = class {
236162
236198
  type: "browser.safety.confirmation.resolved",
236163
236199
  approved,
236164
236200
  requestId: request.requestId,
236165
- resolvedAt: nowIso$2(),
236201
+ resolvedAt: nowIso$3(),
236166
236202
  ...this.events.sessionFields()
236167
236203
  });
236168
236204
  if (!approved) throw new BrowserSafetyError(decision.reason ?? "Browser action was not confirmed.", action, {
@@ -281514,7 +281550,7 @@ const DEFAULT_AGENT_BROWSER_BRIDGE_CLOSE_TIMEOUT_MS = 3e4;
281514
281550
  const DEFAULT_AGENT_BROWSER_PLAYWRIGHT_BACKEND_CLOSE_TIMEOUT_MS = 1e4;
281515
281551
  const REMOTE_WEBRTC_UNAVAILABLE_DETAIL = "Remote WebRTC browser display is not available: the current Agent Browser runtime exposes tab control but does not provide a media transport.";
281516
281552
  const REMOTE_WEBRTC_RELAY_REQUIRED_DETAIL = "Remote WebRTC browser display requires a TURN relay in cloud mode. Configure FORGE_BROWSER_WEBRTC_ICE_SERVERS with authenticated turn: or turns: URLs.";
281517
- function nowIso$1() {
281553
+ function nowIso$2() {
281518
281554
  return (/* @__PURE__ */ new Date()).toISOString();
281519
281555
  }
281520
281556
  function positiveTimeoutMs(value) {
@@ -281614,12 +281650,12 @@ function snapshotAfterTimedOutControl(snapshot, command) {
281614
281650
  case "setViewport": return {
281615
281651
  ...snapshot,
281616
281652
  viewport: command.viewport,
281617
- updatedAt: nowIso$1()
281653
+ updatedAt: nowIso$2()
281618
281654
  };
281619
281655
  case "resetViewport": return {
281620
281656
  ...snapshot,
281621
281657
  viewport: DEFAULT_AGENT_BROWSER_VIEWPORT,
281622
- updatedAt: nowIso$1()
281658
+ updatedAt: nowIso$2()
281623
281659
  };
281624
281660
  default: return snapshot;
281625
281661
  }
@@ -282065,7 +282101,7 @@ function toStreamEvent(input) {
282065
282101
  userId: BrowserUserId.make(input.userId),
282066
282102
  agentId: input.agentId,
282067
282103
  ...input.controlState ? { sessionEpoch: input.controlState.sessionEpoch } : {},
282068
- createdAt: nowIso$1()
282104
+ createdAt: nowIso$2()
282069
282105
  };
282070
282106
  switch (input.event.type) {
282071
282107
  case "session.started": return {
@@ -282366,7 +282402,7 @@ function createAgentBrowserHostBridgeManager(bridge, options) {
282366
282402
  environmentId: event.input.environmentId ?? DEFAULT_BROWSER_ENVIRONMENT_ID,
282367
282403
  userId: event.input.userId ?? "local-user",
282368
282404
  agentId: null,
282369
- createdAt: nowIso$1(),
282405
+ createdAt: nowIso$2(),
282370
282406
  type: "display.iceCandidate",
282371
282407
  payload: {
282372
282408
  sessionId: event.input.sessionId,
@@ -294413,7 +294449,7 @@ function resolveBuildCommitFromEnv(env) {
294413
294449
  * environment descriptor down instead of reporting an honest "unknown".
294414
294450
  */
294415
294451
  function readBakedBuildCommit() {
294416
- return "7695a8221bc664caedd33aa411ac7bcdbb0a3594";
294452
+ return "ebc6c5d85de3dc3324a5054f8f29deb2dd89baa7";
294417
294453
  }
294418
294454
  async function resolveServerBuildCommit(input) {
294419
294455
  if (isFullCommitSha(input.baked)) return input.baked;
@@ -297474,6 +297510,52 @@ function toProjectorDecodeError(eventType) {
297474
297510
  });
297475
297511
  }
297476
297512
  //#endregion
297513
+ //#region src/orchestration/deciderEventBase.ts
297514
+ const nowIso$1 = () => (/* @__PURE__ */ new Date()).toISOString();
297515
+ const defaultMetadata = {
297516
+ eventId: crypto.randomUUID(),
297517
+ aggregateKind: "thread",
297518
+ aggregateId: "",
297519
+ occurredAt: nowIso$1(),
297520
+ commandId: null,
297521
+ causationEventId: null,
297522
+ correlationId: null,
297523
+ metadata: {}
297524
+ };
297525
+ function withEventBase(input) {
297526
+ return {
297527
+ ...defaultMetadata,
297528
+ eventId: crypto.randomUUID(),
297529
+ aggregateKind: input.aggregateKind,
297530
+ aggregateId: input.aggregateId,
297531
+ occurredAt: input.occurredAt,
297532
+ commandId: input.commandId,
297533
+ correlationId: input.commandId,
297534
+ metadata: input.metadata ?? {}
297535
+ };
297536
+ }
297537
+ //#endregion
297538
+ //#region src/orchestration/projectScriptMutation.ts
297539
+ function unchanged(a, b) {
297540
+ return a !== void 0 && a.id === b.id && a.name === b.name && a.command === b.command && a.icon === b.icon && a.runOnWorktreeCreate === b.runOnWorktreeCreate;
297541
+ }
297542
+ const applyProjectScriptMutation = fn$1("applyProjectScriptMutation")(function* (scripts, command) {
297543
+ const mutation = command.mutation;
297544
+ const id = mutation.kind === "add" ? mutation.script.id : mutation.expected.id;
297545
+ const existing = scripts.find((script) => script.id === id);
297546
+ if (mutation.kind === "add" ? existing !== void 0 : !unchanged(existing, mutation.expected)) return yield* new OrchestrationCommandInvariantError({
297547
+ commandType: command.type,
297548
+ detail: "This action changed in another window. Reopen it and try again."
297549
+ });
297550
+ if (mutation.kind === "add") return [...scripts, mutation.script];
297551
+ if (mutation.kind === "remove") return scripts.filter((script) => script.id !== id);
297552
+ if (mutation.script.id !== id) return yield* new OrchestrationCommandInvariantError({
297553
+ commandType: command.type,
297554
+ detail: "An action's ID cannot change during an update."
297555
+ });
297556
+ return scripts.map((script) => script.id === id ? mutation.script : script);
297557
+ });
297558
+ //#endregion
297477
297559
  //#region src/orchestration/turnAccountSelection.ts
297478
297560
  /** A per-turn account choice remains local to the thread and cannot change its provider. */
297479
297561
  function turnAccountSelection(current, requested) {
@@ -297530,28 +297612,6 @@ function requireThreadAbsent(input) {
297530
297612
  //#endregion
297531
297613
  //#region src/orchestration/decider.ts
297532
297614
  const nowIso = () => (/* @__PURE__ */ new Date()).toISOString();
297533
- const defaultMetadata = {
297534
- eventId: crypto.randomUUID(),
297535
- aggregateKind: "thread",
297536
- aggregateId: "",
297537
- occurredAt: nowIso(),
297538
- commandId: null,
297539
- causationEventId: null,
297540
- correlationId: null,
297541
- metadata: {}
297542
- };
297543
- function withEventBase(input) {
297544
- return {
297545
- ...defaultMetadata,
297546
- eventId: crypto.randomUUID(),
297547
- aggregateKind: input.aggregateKind,
297548
- aggregateId: input.aggregateId,
297549
- occurredAt: input.occurredAt,
297550
- commandId: input.commandId,
297551
- correlationId: input.commandId,
297552
- metadata: input.metadata ?? {}
297553
- };
297554
- }
297555
297615
  function requireOrdinaryMessageId(commandType, messageId) {
297556
297616
  return isReservedReplicaSourceMessageId(messageId) ? fail(new OrchestrationCommandInvariantError({
297557
297617
  commandType,
@@ -297604,6 +297664,22 @@ const decideOrchestrationCommand = fn$1("decideOrchestrationCommand")(function*
297604
297664
  updatedAt: command.createdAt
297605
297665
  }
297606
297666
  };
297667
+ case "project.script.update": {
297668
+ const scripts = yield* applyProjectScriptMutation((yield* requireProject({
297669
+ readModel,
297670
+ command,
297671
+ projectId: command.projectId
297672
+ })).scripts, command);
297673
+ return yield* decideOrchestrationCommand({
297674
+ readModel,
297675
+ command: {
297676
+ type: "project.meta.update",
297677
+ commandId: command.commandId,
297678
+ projectId: command.projectId,
297679
+ scripts
297680
+ }
297681
+ });
297682
+ }
297607
297683
  case "project.meta.update": {
297608
297684
  yield* requireProject({
297609
297685
  readModel,
@@ -298890,6 +298966,7 @@ function commandToAggregateRef(command) {
298890
298966
  switch (command.type) {
298891
298967
  case "project.create":
298892
298968
  case "project.meta.update":
298969
+ case "project.script.update":
298893
298970
  case "project.delete": return {
298894
298971
  aggregateKind: "project",
298895
298972
  aggregateId: command.projectId