@flowdesk/opencode-plugin 0.1.8 → 0.1.9

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/dist/server.js CHANGED
@@ -1,16 +1,16 @@
1
- import { mkdirSync, readFileSync, renameSync, writeFileSync, } from "node:fs";
1
+ import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
2
2
  import { join, resolve, sep } from "node:path";
3
- import { applyFlowDeskSessionEvidenceWriteIntentsV1, createFlowDeskChatHookAuthorityProbeV1, evaluateFlowDeskChatIntakeV1, getFlowDeskPortableCommandToolName, getRelease1SchemaArtifact, materializeFlowDeskExactModelCacheEvidenceFromProviderAcquisitionEvidenceV1, materializeFlowDeskRuntimeLaneLaunchPlansFromReviewerFanoutEvidenceV1, planFlowDeskReviewerFanoutFromReloadedCacheEvidenceV1, prepareFlowDeskSessionEvidenceWriteIntentV1, reloadFlowDeskSessionEvidenceV1, validateProjectConfigV1, validateFlowDeskDefaultManagedDispatchAuthorizationV1, validateRunRequestV1, } from "@flowdesk/core";
4
- import { tool } from "@opencode-ai/plugin";
3
+ import { applyFlowDeskSessionEvidenceWriteIntentsV1, createFlowDeskChatHookAuthorityProbeV1, evaluateFlowDeskChatIntakeV1, getFlowDeskPortableCommandToolName, getRelease1SchemaArtifact, materializeFlowDeskExactModelCacheEvidenceFromProviderAcquisitionEvidenceV1, materializeFlowDeskRuntimeLaneLaunchPlansFromReviewerFanoutEvidenceV1, planFlowDeskReviewerFanoutFromReloadedCacheEvidenceV1, prepareFlowDeskSessionEvidenceWriteIntentV1, reloadFlowDeskSessionEvidenceV1, validateFlowDeskDefaultManagedDispatchAuthorizationV1, validateProjectConfigV1, validateRunRequestV1, } from "@flowdesk/core";
4
+ import { tool, } from "@opencode-ai/plugin";
5
5
  import { flowdeskPluginId, flowdeskPluginScaffold, hasProductionOpenCodeRegistration, } from "./index.js";
6
+ import { recordFlowDeskLaneHeartbeatV1, } from "./lane-heartbeat-writer.js";
6
7
  import { createFlowDeskLocalNonDispatchAdapterSession, flowdeskLocalNonDispatchAdapterProfile, hasFlowDeskLocalPlanningEvidenceV1, } from "./local-adapter.js";
7
8
  import { createFlowDeskManagedDispatchBetaDurableReservationStoreV1, createFlowDeskOpenCodeMetadataProviderAcquisitionClientV1, createFlowDeskOpenCodePromptBackedProviderAcquisitionClientV1, dispatchManagedDispatchBetaPromptV1, materializeFlowDeskManagedFallbackRegatePlanEvidenceV1, orchestrateFlowDeskManagedFallbackRegateV1, runFlowDeskExactModelProviderAcquisitionLiveTestV1, } from "./managed-dispatch-adapter.js";
8
- import { executeFlowDeskRuntimeReviewerExecutionBridgeV1, redactedRuntimeReviewerExecutionBlocked, runtimeReviewerExecutionExpectationsFromValue, } from "./runtime-reviewer-execution-bridge.js";
9
- import { executeFlowDeskQuickReviewerRunV1, } from "./quick-reviewer-run.js";
10
9
  import { executeFlowDeskProviderUsageLiveV1, } from "./provider-usage-live-tool.js";
11
- import { executeFlowDeskStatusLiveV1, } from "./status-live-tool.js";
12
10
  import { executeFlowDeskQuickFallbackRunV1, } from "./quick-fallback-run.js";
13
- import { recordFlowDeskLaneHeartbeatV1, } from "./lane-heartbeat-writer.js";
11
+ import { executeFlowDeskQuickReviewerRunV1, } from "./quick-reviewer-run.js";
12
+ import { executeFlowDeskRuntimeReviewerExecutionBridgeV1, redactedRuntimeReviewerExecutionBlocked, runtimeReviewerExecutionExpectationsFromValue, } from "./runtime-reviewer-execution-bridge.js";
13
+ import { executeFlowDeskStatusLiveV1, } from "./status-live-tool.js";
14
14
  import { FLOWDESK_PRE_SPIKE_PLUGIN_TOOL_STUBS, getFlowDeskRelease1HandlerReadinessSummary, getFlowDeskRelease1ProductionReadinessSummary, hasPassingFds1SchemaConversionSpike, runFlowDeskPreSpikePluginToolStub, } from "./tool-stubs.js";
15
15
  export const flowdeskPreSpikeDoctorToolName = "flowdesk_pre_spike_doctor";
16
16
  export const flowdeskChatIntakeToolName = "flowdesk_chat_intake";
@@ -89,7 +89,7 @@ function isManagedDispatchBetaReservationStore(value) {
89
89
  typeof value.recordDispatchFailure === "function");
90
90
  }
91
91
  function isExactModelProviderAcquisitionClient(value) {
92
- return isRecord(value) && typeof value.checkExactModelAvailability === "function";
92
+ return (isRecord(value) && typeof value.checkExactModelAvailability === "function");
93
93
  }
94
94
  function boundedText(value, fallback) {
95
95
  const trimmed = value.trim();
@@ -474,7 +474,9 @@ export function createFlowDeskLocalNonDispatchAdapterTools(now = new Date(), ses
474
474
  description: `FlowDesk local non-dispatch command adapter for ${stub.toolName}; no provider call, real dispatch, or lane launch.`,
475
475
  args,
476
476
  async execute(request) {
477
- const record = isRecord(request) ? request : {};
477
+ const record = isRecord(request)
478
+ ? request
479
+ : {};
478
480
  if (stub.toolName === "flowdesk_run" &&
479
481
  record.run_mode === "managed-dispatch") {
480
482
  return JSON.stringify(await evaluateFlowDeskManagedDispatchRunRoute(record, managedDispatchRunRoute));
@@ -588,7 +590,8 @@ function redactedExactModelProviderAcquisitionToolResult(result, cacheMaterializ
588
590
  persisted: cacheMaterialization.fanout.persisted,
589
591
  persistedEvidenceId: cacheMaterialization.fanout.persistedEvidenceId,
590
592
  persistErrors: cacheMaterialization.fanout.persistErrors,
591
- ...(cacheMaterialization.fanout.runtimeLaunchPlans === undefined
593
+ ...(cacheMaterialization.fanout.runtimeLaunchPlans ===
594
+ undefined
592
595
  ? {}
593
596
  : {
594
597
  runtimeLaunchPlanMaterialization: {
@@ -598,14 +601,12 @@ function redactedExactModelProviderAcquisitionToolResult(result, cacheMaterializ
598
601
  .result.blocked_labels,
599
602
  targetLaunchPlanEvidenceIds: cacheMaterialization.fanout.runtimeLaunchPlans
600
603
  .options.targetLaunchPlanEvidenceIds,
601
- launchPlanStates: cacheMaterialization.fanout.runtimeLaunchPlans
602
- .result.launchPlans.map((plan) => plan.state),
604
+ launchPlanStates: cacheMaterialization.fanout.runtimeLaunchPlans.result.launchPlans.map((plan) => plan.state),
603
605
  launchPlanCount: cacheMaterialization.fanout.runtimeLaunchPlans
604
606
  .result.launchPlans.length,
605
607
  writeIntentCount: cacheMaterialization.fanout.runtimeLaunchPlans
606
608
  .result.writeIntents.length,
607
- launchAttempted: cacheMaterialization.fanout.runtimeLaunchPlans
608
- .result.launchPlans.some((plan) => plan.launch_attempted),
609
+ launchAttempted: cacheMaterialization.fanout.runtimeLaunchPlans.result.launchPlans.some((plan) => plan.launch_attempted),
609
610
  actualLaneLaunch: cacheMaterialization.fanout.runtimeLaunchPlans
610
611
  .result.actualLaneLaunch,
611
612
  providerCall: cacheMaterialization.fanout.runtimeLaunchPlans
@@ -619,8 +620,7 @@ function redactedExactModelProviderAcquisitionToolResult(result, cacheMaterializ
619
620
  runtimeReviewerExecution: {
620
621
  status: cacheMaterialization.fanout
621
622
  .runtimeLaunchPlans
622
- .runtimeReviewerExecution.result
623
- .status,
623
+ .runtimeReviewerExecution.result.status,
624
624
  laneCount: cacheMaterialization.fanout
625
625
  .runtimeLaunchPlans
626
626
  .runtimeReviewerExecution.result
@@ -675,7 +675,8 @@ function providerAcquisitionRuntimeReviewerExecutionFromValue(value) {
675
675
  enabled: true,
676
676
  attemptId: value.attemptId,
677
677
  parentSessionId: value.parentSessionId,
678
- ...(typeof value.observedAt === "string" && value.observedAt.trim().length > 0
678
+ ...(typeof value.observedAt === "string" &&
679
+ value.observedAt.trim().length > 0
679
680
  ? { observedAt: value.observedAt }
680
681
  : {}),
681
682
  consumedReviewerFanoutApproval: value.consumedReviewerFanoutApproval,
@@ -721,7 +722,8 @@ function providerAcquisitionReviewerFanoutPlanningFromValue(value) {
721
722
  attemptId: value.attemptId,
722
723
  parentSessionRef: value.parentSessionRef,
723
724
  agentRef: value.agentRef,
724
- ...(typeof value.requestedAt === "string" && value.requestedAt.trim().length > 0
725
+ ...(typeof value.requestedAt === "string" &&
726
+ value.requestedAt.trim().length > 0
725
727
  ? { requestedAt: value.requestedAt }
726
728
  : {}),
727
729
  ...(Array.isArray(value.requestedPerspectives) &&
@@ -733,7 +735,9 @@ function providerAcquisitionReviewerFanoutPlanningFromValue(value) {
733
735
  ...(typeof value.maxConcurrentLaneCount === "number"
734
736
  ? { maxConcurrentLaneCount: value.maxConcurrentLaneCount }
735
737
  : {}),
736
- ...(typeof value.timeoutMs === "number" ? { timeoutMs: value.timeoutMs } : {}),
738
+ ...(typeof value.timeoutMs === "number"
739
+ ? { timeoutMs: value.timeoutMs }
740
+ : {}),
737
741
  ...(typeof value.orphanMaxAgeMs === "number"
738
742
  ? { orphanMaxAgeMs: value.orphanMaxAgeMs }
739
743
  : {}),
@@ -782,9 +786,7 @@ function exactModelProviderAcquisitionCacheMaterializationFromOptions(options) {
782
786
  cacheMaterialization.entryId.trim().length > 0
783
787
  ? { entryId: cacheMaterialization.entryId }
784
788
  : {}),
785
- ...(reviewerFanoutPlanning === undefined
786
- ? {}
787
- : { reviewerFanoutPlanning }),
789
+ ...(reviewerFanoutPlanning === undefined ? {} : { reviewerFanoutPlanning }),
788
790
  };
789
791
  }
790
792
  function providerAcquisitionFanoutPlanEvidenceId(workflowId, plan) {
@@ -959,8 +961,7 @@ export function createFlowDeskExactModelProviderAcquisitionLiveTestOptInTools(cl
959
961
  rootDir,
960
962
  request,
961
963
  });
962
- const materializationResult = cacheMaterialization !== undefined &&
963
- result.evidenceReloaded === true
964
+ const materializationResult = cacheMaterialization !== undefined && result.evidenceReloaded === true
964
965
  ? materializeFlowDeskExactModelCacheEvidenceFromProviderAcquisitionEvidenceV1({
965
966
  reloadedEvidence: reloadFlowDeskSessionEvidenceV1({
966
967
  workflowId: request.workflowId,
@@ -1000,8 +1001,7 @@ export function createFlowDeskExactModelProviderAcquisitionLiveTestOptInTools(cl
1000
1001
  policyPackHash: request.policyPackHash,
1001
1002
  authAccountBoundaryRef: request.authAccountBoundaryRef,
1002
1003
  attemptId: cacheMaterialization.reviewerFanoutPlanning.attemptId,
1003
- parentSessionRef: cacheMaterialization.reviewerFanoutPlanning
1004
- .parentSessionRef,
1004
+ parentSessionRef: cacheMaterialization.reviewerFanoutPlanning.parentSessionRef,
1005
1005
  agentRef: cacheMaterialization.reviewerFanoutPlanning.agentRef,
1006
1006
  requestedAt: cacheMaterialization.reviewerFanoutPlanning.requestedAt ??
1007
1007
  request.observedAt,
@@ -1025,11 +1025,12 @@ export function createFlowDeskExactModelProviderAcquisitionLiveTestOptInTools(cl
1025
1025
  : {
1026
1026
  timeoutMs: cacheMaterialization.reviewerFanoutPlanning.timeoutMs,
1027
1027
  }),
1028
- ...(cacheMaterialization.reviewerFanoutPlanning.orphanMaxAgeMs ===
1029
- undefined
1028
+ ...(cacheMaterialization.reviewerFanoutPlanning
1029
+ .orphanMaxAgeMs === undefined
1030
1030
  ? {}
1031
1031
  : {
1032
- orphanMaxAgeMs: cacheMaterialization.reviewerFanoutPlanning.orphanMaxAgeMs,
1032
+ orphanMaxAgeMs: cacheMaterialization.reviewerFanoutPlanning
1033
+ .orphanMaxAgeMs,
1033
1034
  }),
1034
1035
  ...(cacheMaterialization.reviewerFanoutPlanning.retryBudget ===
1035
1036
  undefined
@@ -1056,7 +1057,8 @@ export function createFlowDeskExactModelProviderAcquisitionLiveTestOptInTools(cl
1056
1057
  const fanoutPersistedEvidenceId = fanoutResult !== undefined &&
1057
1058
  cacheMaterialization?.reviewerFanoutPlanning
1058
1059
  ?.persistDerivedFanoutPlanEvidence === true
1059
- ? (cacheMaterialization.reviewerFanoutPlanning.fanoutPlanEvidenceId ??
1060
+ ? (cacheMaterialization.reviewerFanoutPlanning
1061
+ .fanoutPlanEvidenceId ??
1060
1062
  providerAcquisitionFanoutPlanEvidenceId(request.workflowId, fanoutResult))
1061
1063
  : undefined;
1062
1064
  const fanoutPersistence = fanoutResult !== undefined && fanoutPersistedEvidenceId !== undefined
@@ -1085,7 +1087,8 @@ export function createFlowDeskExactModelProviderAcquisitionLiveTestOptInTools(cl
1085
1087
  : {
1086
1088
  sdkClientAvailable: runtimeLaunchPlanOptions.sdkClientAvailable,
1087
1089
  }),
1088
- ...(runtimeLaunchPlanOptions.durableEvidenceRootRef === undefined
1090
+ ...(runtimeLaunchPlanOptions.durableEvidenceRootRef ===
1091
+ undefined
1089
1092
  ? {}
1090
1093
  : {
1091
1094
  durableEvidenceRootRef: runtimeLaunchPlanOptions.durableEvidenceRootRef,
@@ -1112,7 +1115,8 @@ export function createFlowDeskExactModelProviderAcquisitionLiveTestOptInTools(cl
1112
1115
  },
1113
1116
  })
1114
1117
  : undefined;
1115
- const redactedMaterialization = cacheMaterialization !== undefined && materializationResult !== undefined
1118
+ const redactedMaterialization = cacheMaterialization !== undefined &&
1119
+ materializationResult !== undefined
1116
1120
  ? {
1117
1121
  options: cacheMaterialization,
1118
1122
  result: materializationResult,
@@ -1133,8 +1137,7 @@ export function createFlowDeskExactModelProviderAcquisitionLiveTestOptInTools(cl
1133
1137
  result: runtimeLaunchPlanResult,
1134
1138
  ...(runtimeReviewerExecutionOptions !==
1135
1139
  undefined &&
1136
- runtimeReviewerExecutionResult !==
1137
- undefined
1140
+ runtimeReviewerExecutionResult !== undefined
1138
1141
  ? {
1139
1142
  runtimeReviewerExecution: {
1140
1143
  options: runtimeReviewerExecutionOptions,
@@ -1353,7 +1356,9 @@ function projectConfigPathFromOptions(options) {
1353
1356
  const raw = options?.[flowdeskProjectConfigOption];
1354
1357
  if (raw !== true && !(isRecord(raw) && raw.enabled === true))
1355
1358
  return undefined;
1356
- const rootDir = isRecord(raw) && typeof raw.rootDir === "string" && raw.rootDir.trim().length > 0
1359
+ const rootDir = isRecord(raw) &&
1360
+ typeof raw.rootDir === "string" &&
1361
+ raw.rootDir.trim().length > 0
1357
1362
  ? raw.rootDir
1358
1363
  : undefined;
1359
1364
  if (rootDir === undefined)
@@ -1364,36 +1369,78 @@ function projectConfigPathFromOptions(options) {
1364
1369
  return undefined;
1365
1370
  return configPath;
1366
1371
  }
1372
+ function localProjectConfigFileOptionsFromOptions(options) {
1373
+ const raw = options?.[flowdeskProjectConfigOption];
1374
+ if (raw !== true && !(isRecord(raw) && raw.enabled === true))
1375
+ return undefined;
1376
+ const rootDir = isRecord(raw) &&
1377
+ typeof raw.rootDir === "string" &&
1378
+ raw.rootDir.trim().length > 0
1379
+ ? raw.rootDir
1380
+ : undefined;
1381
+ if (rootDir === undefined)
1382
+ return undefined;
1383
+ const policyPackPaths = isRecord(raw) && Array.isArray(raw.policyPackPaths)
1384
+ ? raw.policyPackPaths.filter((path) => typeof path === "string")
1385
+ : undefined;
1386
+ return {
1387
+ enabled: true,
1388
+ rootDir,
1389
+ ...(policyPackPaths === undefined ? {} : { policyPackPaths }),
1390
+ };
1391
+ }
1367
1392
  function loadProjectConfigFromOptions(options) {
1368
1393
  const raw = options?.[flowdeskProjectConfigOption];
1369
1394
  if (raw !== true && !(isRecord(raw) && raw.enabled === true))
1370
1395
  return disabledProjectConfigLoad();
1371
1396
  const configPath = projectConfigPathFromOptions(options);
1372
1397
  if (configPath === undefined)
1373
- return { enabled: true, status: "blocked", redactedBlockReason: "projectConfig.enabled=true requires a schema-safe rootDir", ...disabledAuthority };
1398
+ return {
1399
+ enabled: true,
1400
+ status: "blocked",
1401
+ redactedBlockReason: "projectConfig.enabled=true requires a schema-safe rootDir",
1402
+ ...disabledAuthority,
1403
+ };
1374
1404
  try {
1375
1405
  const parsed = JSON.parse(readFileSync(configPath, "utf8"));
1376
1406
  const validation = validateProjectConfigV1(parsed);
1377
1407
  if (!validation.ok)
1378
- return { enabled: true, status: "blocked", redactedBlockReason: validation.errors.join("; ").slice(0, 500), ...disabledAuthority };
1408
+ return {
1409
+ enabled: true,
1410
+ status: "blocked",
1411
+ redactedBlockReason: validation.errors.join("; ").slice(0, 500),
1412
+ ...disabledAuthority,
1413
+ };
1379
1414
  const record = parsed;
1380
1415
  return {
1381
1416
  enabled: true,
1382
1417
  status: "loaded",
1383
1418
  configRef: safeToken(record.config_id, "config-redacted"),
1384
- releaseMode: typeof record.release_mode === "string" ? record.release_mode : undefined,
1385
- chatIntakeMode: typeof record.chat_intake_mode === "string" ? record.chat_intake_mode : undefined,
1386
- hookHarnessMode: typeof record.hook_harness_mode === "string" ? record.hook_harness_mode : undefined,
1387
- disabledModes: Array.isArray(record.disabled_modes) ? record.disabled_modes.filter((mode) => typeof mode === "string") : undefined,
1419
+ releaseMode: typeof record.release_mode === "string"
1420
+ ? record.release_mode
1421
+ : undefined,
1422
+ chatIntakeMode: typeof record.chat_intake_mode === "string"
1423
+ ? record.chat_intake_mode
1424
+ : undefined,
1425
+ hookHarnessMode: typeof record.hook_harness_mode === "string"
1426
+ ? record.hook_harness_mode
1427
+ : undefined,
1428
+ disabledModes: Array.isArray(record.disabled_modes)
1429
+ ? record.disabled_modes.filter((mode) => typeof mode === "string")
1430
+ : undefined,
1388
1431
  ...disabledAuthority,
1389
1432
  };
1390
1433
  }
1391
1434
  catch (error) {
1392
- const code = error instanceof Error && "code" in error ? String(error.code) : "read_failed";
1435
+ const code = error instanceof Error && "code" in error
1436
+ ? String(error.code)
1437
+ : "read_failed";
1393
1438
  return {
1394
1439
  enabled: true,
1395
1440
  status: code === "ENOENT" ? "missing" : "blocked",
1396
- redactedBlockReason: code === "ENOENT" ? "project config file is missing" : "project config file could not be parsed or read",
1441
+ redactedBlockReason: code === "ENOENT"
1442
+ ? "project config file is missing"
1443
+ : "project config file could not be parsed or read",
1397
1444
  ...disabledAuthority,
1398
1445
  };
1399
1446
  }
@@ -1526,7 +1573,8 @@ function exactModelProviderAcquisitionClientFrom(input, options) {
1526
1573
  const option = options?.[flowdeskExactModelProviderAcquisitionLiveTestOption];
1527
1574
  if (isRecord(option) && isExactModelProviderAcquisitionClient(option.client))
1528
1575
  return option.client;
1529
- if (isRecord(input) && isExactModelProviderAcquisitionClient(input.exactModelProviderAcquisitionClient))
1576
+ if (isRecord(input) &&
1577
+ isExactModelProviderAcquisitionClient(input.exactModelProviderAcquisitionClient))
1530
1578
  return input.exactModelProviderAcquisitionClient;
1531
1579
  if (!isRecord(input))
1532
1580
  return undefined;
@@ -1535,8 +1583,12 @@ function exactModelProviderAcquisitionClientFrom(input, options) {
1535
1583
  : undefined;
1536
1584
  const commonOptions = {
1537
1585
  client: input.client,
1538
- ...(typeof input.directory === "string" ? { directory: input.directory } : {}),
1539
- ...(typeof input.workspace === "string" ? { workspace: input.workspace } : {}),
1586
+ ...(typeof input.directory === "string"
1587
+ ? { directory: input.directory }
1588
+ : {}),
1589
+ ...(typeof input.workspace === "string"
1590
+ ? { workspace: input.workspace }
1591
+ : {}),
1540
1592
  };
1541
1593
  if (promptBackedCheck?.enabled === true) {
1542
1594
  const allowedProviderQualifiedModelIds = Array.isArray(promptBackedCheck.allowedProviderQualifiedModelIds)
@@ -1558,7 +1610,9 @@ function exactModelProviderAcquisitionClientFrom(input, options) {
1558
1610
  }
1559
1611
  function exactModelProviderAcquisitionRootFrom(options) {
1560
1612
  const option = options?.[flowdeskExactModelProviderAcquisitionLiveTestOption];
1561
- const optionRoot = isRecord(option) && typeof option.durableStateRoot === "string" && option.durableStateRoot.trim().length > 0
1613
+ const optionRoot = isRecord(option) &&
1614
+ typeof option.durableStateRoot === "string" &&
1615
+ option.durableStateRoot.trim().length > 0
1562
1616
  ? option.durableStateRoot
1563
1617
  : undefined;
1564
1618
  return optionRoot ?? durableStateRootFromOptions(options);
@@ -1568,8 +1622,7 @@ function exactModelProviderAcquisitionRuntimeReviewerExecutionClientFrom(input,
1568
1622
  if (isRecord(option) &&
1569
1623
  isManagedDispatchBetaClient(option.runtimeReviewerExecutionClient))
1570
1624
  return option.runtimeReviewerExecutionClient;
1571
- if (isRecord(option) &&
1572
- isManagedDispatchBetaClient(option.sdkClient))
1625
+ if (isRecord(option) && isManagedDispatchBetaClient(option.sdkClient))
1573
1626
  return option.sdkClient;
1574
1627
  return isRecord(input) && isManagedDispatchBetaClient(input.client)
1575
1628
  ? input.client
@@ -1585,7 +1638,9 @@ function runtimeReviewerExecutionOptionsFrom(options) {
1585
1638
  value.durableStateRoot.trim().length > 0
1586
1639
  ? { durableStateRoot: value.durableStateRoot }
1587
1640
  : {}),
1588
- ...(isManagedDispatchBetaClient(value.client) ? { client: value.client } : {}),
1641
+ ...(isManagedDispatchBetaClient(value.client)
1642
+ ? { client: value.client }
1643
+ : {}),
1589
1644
  };
1590
1645
  }
1591
1646
  function runtimeReviewerExecutionClientFrom(input, options) {
@@ -1598,7 +1653,7 @@ function runtimeReviewerExecutionClientFrom(input, options) {
1598
1653
  }
1599
1654
  function runtimeReviewerExecutionRootFrom(options) {
1600
1655
  const runtimeOptions = runtimeReviewerExecutionOptionsFrom(options);
1601
- return runtimeOptions?.durableStateRoot ?? durableStateRootFromOptions(options);
1656
+ return (runtimeOptions?.durableStateRoot ?? durableStateRootFromOptions(options));
1602
1657
  }
1603
1658
  export function createFlowDeskRuntimeReviewerExecutionOptInTools(client, rootDir) {
1604
1659
  return {
@@ -1818,8 +1873,7 @@ export function createFlowDeskManagedFallbackRegateOptInTools(rootDir) {
1818
1873
  },
1819
1874
  async execute(input) {
1820
1875
  const record = isRecord(input) ? input : {};
1821
- if (!isRecord(record.decision) ||
1822
- !isRecord(record.consumedApproval)) {
1876
+ if (!isRecord(record.decision) || !isRecord(record.consumedApproval)) {
1823
1877
  return JSON.stringify(redactedManagedFallbackRegateBlocked("Managed fallback regate requires both decision and consumedApproval records."));
1824
1878
  }
1825
1879
  const result = orchestrateFlowDeskManagedFallbackRegateV1({
@@ -1911,7 +1965,8 @@ function quickFallbackRunConfigFromOptions(options) {
1911
1965
  if (typeof value.defaultToProvider === "string" &&
1912
1966
  value.defaultToProvider.trim().length > 0)
1913
1967
  config.defaultToProvider = value.defaultToProvider;
1914
- if (typeof value.sourceLabel === "string" && value.sourceLabel.trim().length > 0)
1968
+ if (typeof value.sourceLabel === "string" &&
1969
+ value.sourceLabel.trim().length > 0)
1915
1970
  config.sourceLabel = value.sourceLabel;
1916
1971
  const explicitRoot = typeof value.rootDir === "string" && value.rootDir.trim().length > 0
1917
1972
  ? value.rootDir
@@ -2041,12 +2096,7 @@ export function createFlowDeskLaneHeartbeatWriterOptInTools(config) {
2041
2096
  .string()
2042
2097
  .describe("Concrete provider-qualified model id (e.g. 'openai/gpt-5.4-mini-fast')."),
2043
2098
  state: tool.schema
2044
- .enum([
2045
- "created",
2046
- "running",
2047
- "awaiting_dependency",
2048
- "cooldown",
2049
- ])
2099
+ .enum(["created", "running", "awaiting_dependency", "cooldown"])
2050
2100
  .describe("Active lane state at heartbeat time."),
2051
2101
  progressSummaryLabel: tool.schema
2052
2102
  .string()
@@ -2194,7 +2244,11 @@ export function createFlowDeskProviderUsageLiveOptInTools(config) {
2194
2244
  },
2195
2245
  async execute(input) {
2196
2246
  const request = isRecord(input)
2197
- ? { providerFamily: typeof input.providerFamily === "string" ? input.providerFamily : undefined }
2247
+ ? {
2248
+ providerFamily: typeof input.providerFamily === "string"
2249
+ ? input.providerFamily
2250
+ : undefined,
2251
+ }
2198
2252
  : {};
2199
2253
  const result = await executeFlowDeskProviderUsageLiveV1({
2200
2254
  config,
@@ -2240,19 +2294,20 @@ const flowdeskServerPlugin = async (input, options) => {
2240
2294
  const projectConfigLoad = loadProjectConfigFromOptions(options);
2241
2295
  const naturalLanguageRoutingEnabled = isNaturalLanguageRoutingEnabled(options) &&
2242
2296
  isNaturalLanguageRoutingAllowedByProjectConfig(projectConfigLoad);
2243
- const localSession = isLocalNonDispatchAdapterEnabled(options) ||
2244
- naturalLanguageRoutingEnabled
2297
+ const localSession = isLocalNonDispatchAdapterEnabled(options) || naturalLanguageRoutingEnabled
2245
2298
  ? createFlowDeskLocalNonDispatchAdapterSession(new Date(), undefined, {
2246
2299
  durableStateRootDir: durableStateRootFromOptions(options),
2300
+ projectConfig: localProjectConfigFileOptionsFromOptions(options),
2247
2301
  productionEnablement: productionEnablementFromOptions(options),
2248
2302
  reviewerFanoutDiagnostics: reviewerFanoutDiagnosticsFromOptions(options),
2249
2303
  })
2250
2304
  : undefined;
2251
- const managedDispatchBetaClient = isManagedDispatchBetaAdapterEnabled(options)
2252
- || isDefaultManagedDispatchAuthorized(options)
2305
+ const managedDispatchBetaClient = isManagedDispatchBetaAdapterEnabled(options) ||
2306
+ isDefaultManagedDispatchAuthorized(options)
2253
2307
  ? managedDispatchBetaClientFrom(input, options)
2254
2308
  : undefined;
2255
- const managedDispatchBetaReservationStore = isManagedDispatchBetaAdapterEnabled(options) || isDefaultManagedDispatchAuthorized(options)
2309
+ const managedDispatchBetaReservationStore = isManagedDispatchBetaAdapterEnabled(options) ||
2310
+ isDefaultManagedDispatchAuthorized(options)
2256
2311
  ? (managedDispatchBetaReservationStoreFrom(input, options) ??
2257
2312
  managedDispatchBetaDurableReservationStoreFrom(options))
2258
2313
  : undefined;
@@ -2344,10 +2399,8 @@ const flowdeskServerPlugin = async (input, options) => {
2344
2399
  chatMessageStallAlert: {
2345
2400
  enabled: options?.[flowdeskChatMessageStallAlertOption] === true ||
2346
2401
  (isRecord(options?.[flowdeskChatMessageStallAlertOption]) &&
2347
- (options?.[flowdeskChatMessageStallAlertOption])
2348
- .enabled === true),
2349
- registered: chatMessageStallAlertOptionsFrom(options, statusLiveConfigForDoctor) !==
2350
- undefined,
2402
+ (options?.[flowdeskChatMessageStallAlertOption]).enabled === true),
2403
+ registered: chatMessageStallAlertOptionsFrom(options, statusLiveConfigForDoctor) !== undefined,
2351
2404
  requires: "statusLive.enabled=true and durableStateRoot (top-level or chatMessageStallAlert.rootDir)",
2352
2405
  note: "chat.message hook appends a passive stall card listing stalled lanes and safe next actions; no auto-retry, auto-abort, or auto-fallback.",
2353
2406
  },
@@ -2404,7 +2457,8 @@ const flowdeskServerPlugin = async (input, options) => {
2404
2457
  Object.assign(tools, createFlowDeskNaturalLanguageRoutingTools(new Date(), localSession));
2405
2458
  if (managedDispatchBetaClient !== undefined)
2406
2459
  Object.assign(tools, createFlowDeskManagedDispatchBetaOptInTools(managedDispatchBetaClient, managedDispatchBetaReservationStore, durableStateRootFromOptions(options)));
2407
- if (exactModelProviderAcquisitionClient !== undefined && exactModelProviderAcquisitionRoot !== undefined)
2460
+ if (exactModelProviderAcquisitionClient !== undefined &&
2461
+ exactModelProviderAcquisitionRoot !== undefined)
2408
2462
  Object.assign(tools, createFlowDeskExactModelProviderAcquisitionLiveTestOptInTools(exactModelProviderAcquisitionClient, exactModelProviderAcquisitionRoot, exactModelProviderAcquisitionCacheMaterialization, runtimeReviewerExecutionClient ??
2409
2463
  exactModelProviderAcquisitionRuntimeReviewerExecutionClientFrom(input, options)));
2410
2464
  if (runtimeReviewerExecutionClient !== undefined &&