agent-transport-system 0.7.32 → 0.7.33

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/ats.js CHANGED
@@ -27,12 +27,12 @@ import wrapAnsi from "wrap-ansi";
27
27
  import { Box, Container, Editor, Key, ProcessTerminal, TUI, Text, getEditorKeybindings, matchesKey } from "@mariozechner/pi-tui";
28
28
 
29
29
  //#region package.json
30
- var version = "0.7.32";
30
+ var version = "0.7.33";
31
31
  var package_default = {
32
32
  $schema: "https://www.schemastore.org/package.json",
33
33
  name: "agent-transport-system",
34
34
  version,
35
- atsReleaseDate: "2026-06-04",
35
+ atsReleaseDate: "2026-06-05",
36
36
  description: "Agent Transport System CLI - https://ats.sh",
37
37
  license: "MIT",
38
38
  type: "module",
@@ -56,7 +56,7 @@ var package_default = {
56
56
  "typecheck": "tsc -p tsconfig.json --noEmit",
57
57
  "check": "ultracite check && tsc -p tsconfig.json --noEmit",
58
58
  "test": "vitest run --config vitest.config.ts",
59
- "test:integration": "vitest run --config vitest.integration.config.ts",
59
+ "test:integration": "node scripts/run-integration-tests.mjs",
60
60
  "test:full": "pnpm run test && pnpm run test:integration",
61
61
  "test:daemon": "vitest run --config vitest.integration.config.ts tests/daemon-state.integration.test.ts tests/daemon-command.integration.test.ts tests/daemon-menu.integration.test.ts tests/daemon-run.integration.test.ts tests/daemon-bootstrap-recommendation.integration.test.ts",
62
62
  "test:watch": "vitest"
@@ -27664,6 +27664,134 @@ function toErrorMessage$18(error) {
27664
27664
  return String(error);
27665
27665
  }
27666
27666
 
27667
+ //#endregion
27668
+ //#region src/runtime/view-argv.ts
27669
+ const PASSIVE_CLI_QUERY_FLAGS = new Set([
27670
+ "--help",
27671
+ "--version",
27672
+ "-V",
27673
+ "-h"
27674
+ ]);
27675
+ function isStandaloneViewQueryArgv(argv) {
27676
+ const args = argv.slice(2);
27677
+ return args.length === 1 && args[0] === "--view";
27678
+ }
27679
+ function parseViewFromArgv(argv, options) {
27680
+ const allowMissingValue = options?.allowMissingValue === true;
27681
+ for (let i = 2; i < argv.length; i += 1) {
27682
+ const arg = argv[i];
27683
+ if (typeof arg !== "string") continue;
27684
+ if (arg === "--") break;
27685
+ if (arg === "--view") {
27686
+ const next = argv[i + 1];
27687
+ if (typeof next !== "string" || next.startsWith("-")) {
27688
+ if (allowMissingValue) return null;
27689
+ throw new Error("missing --view value (use auto|human|agent)");
27690
+ }
27691
+ return parseCliViewMode(next);
27692
+ }
27693
+ if (arg.startsWith("--view=")) return parseCliViewMode(arg.slice(7));
27694
+ }
27695
+ return null;
27696
+ }
27697
+ function parseStandaloneViewSwitchArgv(argv) {
27698
+ const args = argv.slice(2);
27699
+ if (args.length === 0) return null;
27700
+ let view = null;
27701
+ for (let i = 0; i < args.length; i += 1) {
27702
+ const arg = args[i];
27703
+ if (typeof arg !== "string") continue;
27704
+ if (arg === "--view") {
27705
+ const next = args[i + 1];
27706
+ if (typeof next !== "string" || next.startsWith("-")) return null;
27707
+ view = next.trim().toLowerCase();
27708
+ i += 1;
27709
+ continue;
27710
+ }
27711
+ if (arg.startsWith("--view=")) {
27712
+ view = arg.slice(7).trim().toLowerCase();
27713
+ continue;
27714
+ }
27715
+ return null;
27716
+ }
27717
+ return view;
27718
+ }
27719
+ function parseFirstCommandTokenFromArgv(argv) {
27720
+ return parseLeadingCommandTokensFromArgv(argv, 1)[0] ?? null;
27721
+ }
27722
+ function parseLeadingCommandTokensFromArgv(argv, maxTokens = 2) {
27723
+ if (maxTokens <= 0) return [];
27724
+ const args = argv.slice(2);
27725
+ const tokens = [];
27726
+ for (let i = 0; i < args.length; i += 1) {
27727
+ if (collectTokensAfterTerminator(args, i, tokens, maxTokens)) return tokens;
27728
+ if (shouldSkipKnownGlobalFlag(args, i)) {
27729
+ i += 1;
27730
+ continue;
27731
+ }
27732
+ const arg = args[i];
27733
+ if (typeof arg !== "string" || shouldSkipInlineGlobalFlag(arg)) continue;
27734
+ if (pushLeadingCommandToken(arg, tokens, maxTokens)) return tokens;
27735
+ }
27736
+ return tokens;
27737
+ }
27738
+ function isPassiveCliQueryArgv(argv) {
27739
+ const args = argv.slice(2);
27740
+ for (let i = 0; i < args.length; i += 1) {
27741
+ const arg = args[i];
27742
+ if (typeof arg !== "string") continue;
27743
+ if (arg === "--") return false;
27744
+ if (isKnownGlobalFlagExpectValue(arg) && isGlobalFlagValueCandidate(args[i + 1])) {
27745
+ i += 1;
27746
+ continue;
27747
+ }
27748
+ if (arg.startsWith("--view=") || arg.startsWith("--service-auto-install=")) continue;
27749
+ if (arg === "help" || PASSIVE_CLI_QUERY_FLAGS.has(arg)) return true;
27750
+ }
27751
+ return false;
27752
+ }
27753
+ function hasJsonOutputArgv(argv) {
27754
+ for (let i = 2; i < argv.length; i += 1) {
27755
+ const arg = argv[i];
27756
+ if (typeof arg !== "string") continue;
27757
+ if (arg === "--") return false;
27758
+ if (arg === "--json" || arg.startsWith("--json=")) return true;
27759
+ }
27760
+ return false;
27761
+ }
27762
+ function shouldUseAgentViewForNonInteractiveStart(argv, interactive) {
27763
+ if (interactive) return false;
27764
+ if (parseViewFromArgv(argv, { allowMissingValue: true }) !== null) return false;
27765
+ return parseFirstCommandTokenFromArgv(argv) === "start";
27766
+ }
27767
+ function isKnownGlobalFlagExpectValue(value) {
27768
+ return value === "--view" || value === "--service-auto-install";
27769
+ }
27770
+ function isGlobalFlagValueCandidate(value) {
27771
+ return typeof value === "string" && value.length > 0 && !value.startsWith("-");
27772
+ }
27773
+ function collectTokensAfterTerminator(args, index, tokens, maxTokens) {
27774
+ if (args[index] !== "--") return false;
27775
+ for (let i = index + 1; i < args.length; i += 1) {
27776
+ const next = args[i];
27777
+ if (typeof next !== "string" || next.length === 0) continue;
27778
+ tokens.push(next);
27779
+ if (tokens.length >= maxTokens) break;
27780
+ }
27781
+ return true;
27782
+ }
27783
+ function shouldSkipKnownGlobalFlag(args, index) {
27784
+ return isKnownGlobalFlagExpectValue(args[index] ?? "") && isGlobalFlagValueCandidate(args[index + 1]);
27785
+ }
27786
+ function shouldSkipInlineGlobalFlag(value) {
27787
+ return value.startsWith("--view=") || value.startsWith("--service-auto-install=");
27788
+ }
27789
+ function pushLeadingCommandToken(value, tokens, maxTokens) {
27790
+ if (value.startsWith("-")) return false;
27791
+ tokens.push(value);
27792
+ return tokens.length >= maxTokens;
27793
+ }
27794
+
27667
27795
  //#endregion
27668
27796
  //#region src/command-entry-checks/build-agent-check-result.ts
27669
27797
  function buildAgentCheckResult(input) {
@@ -28440,6 +28568,7 @@ function resolveFreshCachedLatestVersion(input) {
28440
28568
  return state.latest_version;
28441
28569
  }
28442
28570
  function shouldCheckNpmCliUpdate(context) {
28571
+ if (hasJsonOutputArgv(context.argv)) return false;
28443
28572
  return context.environmentTarget.preset === "prod" && context.environmentTarget.userFacingCommand === "ats";
28444
28573
  }
28445
28574
 
@@ -46917,6 +47046,14 @@ async function runDaemonStatus(input) {
46917
47046
  profile: input.profile,
46918
47047
  view: input.view
46919
47048
  });
47049
+ if (input.json === true) {
47050
+ outJsonLine(buildDaemonStatusJsonPayload({
47051
+ environmentTarget: await resolveAtsEnvironmentTarget({ gatewayUrl: input.gatewayUrl }),
47052
+ localSnapshot: await resolveDaemonLocalStatusSnapshot(),
47053
+ snapshot: await resolveDaemonStatusSnapshot({ runtime })
47054
+ }));
47055
+ return;
47056
+ }
46920
47057
  const presenter = createPresenter(runtime);
46921
47058
  emitDaemonOverviewIfAgent({
46922
47059
  presenter,
@@ -47208,33 +47345,55 @@ async function runDaemonStatusFlow(input) {
47208
47345
  await runDaemonStatus(input);
47209
47346
  return "completed";
47210
47347
  }
47348
+ function buildDaemonStatusJsonPayload(input) {
47349
+ return {
47350
+ schemaVersion: 1,
47351
+ type: "daemon.status",
47352
+ localResult: buildDaemonAgentLocalStatusPayload({
47353
+ environmentTarget: input.environmentTarget,
47354
+ snapshot: input.localSnapshot
47355
+ }),
47356
+ result: buildDaemonAgentStatusPayload({
47357
+ environmentTarget: input.environmentTarget,
47358
+ snapshot: input.snapshot
47359
+ }),
47360
+ runtimeProjection: input.snapshot.currentReplyReadiness.runtimeProjection ?? null
47361
+ };
47362
+ }
47363
+ function buildDaemonAgentStatusPayload(input) {
47364
+ const { environmentTarget, snapshot } = input;
47365
+ const currentProfileWorkspace = buildProfileWorkspacePresentation(snapshot.currentReplyReadiness.profileWorkspaceRuntimeResolution);
47366
+ return {
47367
+ ...snapshot.currentReplyReadiness.daemonStatus,
47368
+ environmentTarget,
47369
+ ...snapshot.currentReplyReadiness.runtimeStatus ? { runtime: snapshot.currentReplyReadiness.runtimeStatus } : {},
47370
+ ...snapshot.runtimeContractRepairReport ? { runtimeContractRepair: snapshot.runtimeContractRepairReport } : {},
47371
+ ...snapshot.currentReplyReadiness.inventory ? { inventory: {
47372
+ anomalies: snapshot.currentReplyReadiness.inventory.anomalies,
47373
+ ...snapshot.currentReplyReadiness.inventory.runtimeContractCompatibility ? { runtimeContractCompatibility: snapshot.currentReplyReadiness.inventory.runtimeContractCompatibility } : {},
47374
+ cleanupPlan: buildDaemonServiceCleanupPlan({
47375
+ intent: "status_cleanup",
47376
+ inventory: snapshot.currentReplyReadiness.inventory
47377
+ })
47378
+ } } : {},
47379
+ daemonRouteObservation: snapshot.currentReplyReadiness.daemonRouteObservation,
47380
+ diagnostics: buildDaemonLocalReplyReadinessEvidenceDiagnostics({
47381
+ deviceReplyReadiness: snapshot.currentReplyReadiness.deviceReplyReadiness,
47382
+ legacyAgentReplyReadiness: snapshot.currentReplyReadiness.agentReplyReadiness
47383
+ }),
47384
+ currentProfileWorkspace,
47385
+ ...snapshot.attention ? { attention: snapshot.attention } : {},
47386
+ ...snapshot.latestLifecycleEvent ? { latestLifecycleEvent: snapshot.latestLifecycleEvent } : {}
47387
+ };
47388
+ }
47211
47389
  function emitDaemonAgentStatus(input) {
47212
47390
  const { environmentTarget, presenter, snapshot } = input;
47213
- const currentProfileWorkspace = buildProfileWorkspacePresentation(snapshot.currentReplyReadiness.profileWorkspaceRuntimeResolution);
47214
47391
  presenter.data({
47215
47392
  code: "daemon.status.result",
47216
- payload: {
47217
- ...snapshot.currentReplyReadiness.daemonStatus,
47393
+ payload: buildDaemonAgentStatusPayload({
47218
47394
  environmentTarget,
47219
- ...snapshot.currentReplyReadiness.runtimeStatus ? { runtime: snapshot.currentReplyReadiness.runtimeStatus } : {},
47220
- ...snapshot.runtimeContractRepairReport ? { runtimeContractRepair: snapshot.runtimeContractRepairReport } : {},
47221
- ...snapshot.currentReplyReadiness.inventory ? { inventory: {
47222
- anomalies: snapshot.currentReplyReadiness.inventory.anomalies,
47223
- ...snapshot.currentReplyReadiness.inventory.runtimeContractCompatibility ? { runtimeContractCompatibility: snapshot.currentReplyReadiness.inventory.runtimeContractCompatibility } : {},
47224
- cleanupPlan: buildDaemonServiceCleanupPlan({
47225
- intent: "status_cleanup",
47226
- inventory: snapshot.currentReplyReadiness.inventory
47227
- })
47228
- } } : {},
47229
- daemonRouteObservation: snapshot.currentReplyReadiness.daemonRouteObservation,
47230
- diagnostics: buildDaemonLocalReplyReadinessEvidenceDiagnostics({
47231
- deviceReplyReadiness: snapshot.currentReplyReadiness.deviceReplyReadiness,
47232
- legacyAgentReplyReadiness: snapshot.currentReplyReadiness.agentReplyReadiness
47233
- }),
47234
- currentProfileWorkspace,
47235
- ...snapshot.attention ? { attention: snapshot.attention } : {},
47236
- ...snapshot.latestLifecycleEvent ? { latestLifecycleEvent: snapshot.latestLifecycleEvent } : {}
47237
- }
47395
+ snapshot
47396
+ })
47238
47397
  });
47239
47398
  if (!snapshot.currentReplyReadiness.runtimeProjection) return;
47240
47399
  presenter.data({
@@ -47248,28 +47407,35 @@ function buildDaemonLocalReplyReadinessEvidenceDiagnostics(input) {
47248
47407
  agentEvidence: input.legacyAgentReplyReadiness
47249
47408
  });
47250
47409
  }
47410
+ function buildDaemonAgentLocalStatusPayload(input) {
47411
+ const { environmentTarget, snapshot } = input;
47412
+ return {
47413
+ ...snapshot.daemonStatus,
47414
+ environmentTarget,
47415
+ statusScope: "local_service",
47416
+ ...snapshot.runtimeStatus ? { runtime: snapshot.runtimeStatus } : {},
47417
+ ...snapshot.serviceManagerStatus ? { serviceManagerStatus: snapshot.serviceManagerStatus } : {},
47418
+ ...snapshot.runtimeContractRepairReport ? { runtimeContractRepair: snapshot.runtimeContractRepairReport } : {},
47419
+ ...snapshot.inventory ? { inventory: {
47420
+ anomalies: snapshot.inventory.anomalies,
47421
+ ...snapshot.inventory.runtimeContractCompatibility ? { runtimeContractCompatibility: snapshot.inventory.runtimeContractCompatibility } : {},
47422
+ cleanupPlan: buildDaemonServiceCleanupPlan({
47423
+ intent: "status_cleanup",
47424
+ inventory: snapshot.inventory
47425
+ })
47426
+ } } : {},
47427
+ ...snapshot.attention ? { attention: snapshot.attention } : {},
47428
+ ...snapshot.latestLifecycleEvent ? { latestLifecycleEvent: snapshot.latestLifecycleEvent } : {}
47429
+ };
47430
+ }
47251
47431
  function emitDaemonAgentLocalStatus(input) {
47252
47432
  const { environmentTarget, presenter, snapshot } = input;
47253
47433
  presenter.data({
47254
47434
  code: "daemon.status.local_result",
47255
- payload: {
47256
- ...snapshot.daemonStatus,
47435
+ payload: buildDaemonAgentLocalStatusPayload({
47257
47436
  environmentTarget,
47258
- statusScope: "local_service",
47259
- ...snapshot.runtimeStatus ? { runtime: snapshot.runtimeStatus } : {},
47260
- ...snapshot.serviceManagerStatus ? { serviceManagerStatus: snapshot.serviceManagerStatus } : {},
47261
- ...snapshot.runtimeContractRepairReport ? { runtimeContractRepair: snapshot.runtimeContractRepairReport } : {},
47262
- ...snapshot.inventory ? { inventory: {
47263
- anomalies: snapshot.inventory.anomalies,
47264
- ...snapshot.inventory.runtimeContractCompatibility ? { runtimeContractCompatibility: snapshot.inventory.runtimeContractCompatibility } : {},
47265
- cleanupPlan: buildDaemonServiceCleanupPlan({
47266
- intent: "status_cleanup",
47267
- inventory: snapshot.inventory
47268
- })
47269
- } } : {},
47270
- ...snapshot.attention ? { attention: snapshot.attention } : {},
47271
- ...snapshot.latestLifecycleEvent ? { latestLifecycleEvent: snapshot.latestLifecycleEvent } : {}
47272
- }
47437
+ snapshot
47438
+ })
47273
47439
  });
47274
47440
  }
47275
47441
  async function emitDaemonStatusForView(input) {
@@ -94562,125 +94728,6 @@ function addExplicitProfileToSpaceHint(hint) {
94562
94728
  return `ats space ${subcommand} --profile <profile-id>${rest}`;
94563
94729
  }
94564
94730
 
94565
- //#endregion
94566
- //#region src/runtime/view-argv.ts
94567
- const PASSIVE_CLI_QUERY_FLAGS = new Set([
94568
- "--help",
94569
- "--version",
94570
- "-V",
94571
- "-h"
94572
- ]);
94573
- function isStandaloneViewQueryArgv(argv) {
94574
- const args = argv.slice(2);
94575
- return args.length === 1 && args[0] === "--view";
94576
- }
94577
- function parseViewFromArgv(argv, options) {
94578
- const allowMissingValue = options?.allowMissingValue === true;
94579
- for (let i = 2; i < argv.length; i += 1) {
94580
- const arg = argv[i];
94581
- if (typeof arg !== "string") continue;
94582
- if (arg === "--") break;
94583
- if (arg === "--view") {
94584
- const next = argv[i + 1];
94585
- if (typeof next !== "string" || next.startsWith("-")) {
94586
- if (allowMissingValue) return null;
94587
- throw new Error("missing --view value (use auto|human|agent)");
94588
- }
94589
- return parseCliViewMode(next);
94590
- }
94591
- if (arg.startsWith("--view=")) return parseCliViewMode(arg.slice(7));
94592
- }
94593
- return null;
94594
- }
94595
- function parseStandaloneViewSwitchArgv(argv) {
94596
- const args = argv.slice(2);
94597
- if (args.length === 0) return null;
94598
- let view = null;
94599
- for (let i = 0; i < args.length; i += 1) {
94600
- const arg = args[i];
94601
- if (typeof arg !== "string") continue;
94602
- if (arg === "--view") {
94603
- const next = args[i + 1];
94604
- if (typeof next !== "string" || next.startsWith("-")) return null;
94605
- view = next.trim().toLowerCase();
94606
- i += 1;
94607
- continue;
94608
- }
94609
- if (arg.startsWith("--view=")) {
94610
- view = arg.slice(7).trim().toLowerCase();
94611
- continue;
94612
- }
94613
- return null;
94614
- }
94615
- return view;
94616
- }
94617
- function parseFirstCommandTokenFromArgv(argv) {
94618
- return parseLeadingCommandTokensFromArgv(argv, 1)[0] ?? null;
94619
- }
94620
- function parseLeadingCommandTokensFromArgv(argv, maxTokens = 2) {
94621
- if (maxTokens <= 0) return [];
94622
- const args = argv.slice(2);
94623
- const tokens = [];
94624
- for (let i = 0; i < args.length; i += 1) {
94625
- if (collectTokensAfterTerminator(args, i, tokens, maxTokens)) return tokens;
94626
- if (shouldSkipKnownGlobalFlag(args, i)) {
94627
- i += 1;
94628
- continue;
94629
- }
94630
- const arg = args[i];
94631
- if (typeof arg !== "string" || shouldSkipInlineGlobalFlag(arg)) continue;
94632
- if (pushLeadingCommandToken(arg, tokens, maxTokens)) return tokens;
94633
- }
94634
- return tokens;
94635
- }
94636
- function isPassiveCliQueryArgv(argv) {
94637
- const args = argv.slice(2);
94638
- for (let i = 0; i < args.length; i += 1) {
94639
- const arg = args[i];
94640
- if (typeof arg !== "string") continue;
94641
- if (arg === "--") return false;
94642
- if (isKnownGlobalFlagExpectValue(arg) && isGlobalFlagValueCandidate(args[i + 1])) {
94643
- i += 1;
94644
- continue;
94645
- }
94646
- if (arg.startsWith("--view=") || arg.startsWith("--service-auto-install=")) continue;
94647
- if (arg === "help" || PASSIVE_CLI_QUERY_FLAGS.has(arg)) return true;
94648
- }
94649
- return false;
94650
- }
94651
- function shouldUseAgentViewForNonInteractiveStart(argv, interactive) {
94652
- if (interactive) return false;
94653
- if (parseViewFromArgv(argv, { allowMissingValue: true }) !== null) return false;
94654
- return parseFirstCommandTokenFromArgv(argv) === "start";
94655
- }
94656
- function isKnownGlobalFlagExpectValue(value) {
94657
- return value === "--view" || value === "--service-auto-install";
94658
- }
94659
- function isGlobalFlagValueCandidate(value) {
94660
- return typeof value === "string" && value.length > 0 && !value.startsWith("-");
94661
- }
94662
- function collectTokensAfterTerminator(args, index, tokens, maxTokens) {
94663
- if (args[index] !== "--") return false;
94664
- for (let i = index + 1; i < args.length; i += 1) {
94665
- const next = args[i];
94666
- if (typeof next !== "string" || next.length === 0) continue;
94667
- tokens.push(next);
94668
- if (tokens.length >= maxTokens) break;
94669
- }
94670
- return true;
94671
- }
94672
- function shouldSkipKnownGlobalFlag(args, index) {
94673
- return isKnownGlobalFlagExpectValue(args[index] ?? "") && isGlobalFlagValueCandidate(args[index + 1]);
94674
- }
94675
- function shouldSkipInlineGlobalFlag(value) {
94676
- return value.startsWith("--view=") || value.startsWith("--service-auto-install=");
94677
- }
94678
- function pushLeadingCommandToken(value, tokens, maxTokens) {
94679
- if (value.startsWith("-")) return false;
94680
- tokens.push(value);
94681
- return tokens.length >= maxTokens;
94682
- }
94683
-
94684
94731
  //#endregion
94685
94732
  //#region src/runtime/retired-command-argv.ts
94686
94733
  const RETIRED_CLI_COMMANDS = [{
@@ -97188,6 +97235,10 @@ function buildCommandHelpExamples(title, examples) {
97188
97235
  async function runCommandWithEntryChecks(input) {
97189
97236
  const entryName = resolveCommandEntryNameFromTokens(input.routeTokens);
97190
97237
  if (!entryName) throw new Error(`missing command entry mapping for route: ${input.routeTokens.join(" ")}`);
97238
+ if (hasJsonOutputArgv(process.argv)) {
97239
+ await input.run();
97240
+ return;
97241
+ }
97191
97242
  const requirements = getCommandCheckRequirements(entryName);
97192
97243
  const environmentTarget = await resolveAtsEnvironmentTarget({ gatewayUrl: input.gatewayUrl });
97193
97244
  const normalizedGatewayUrl = await resolveGatewayUrlForEntryChecks({
@@ -97831,18 +97882,20 @@ const serviceCmd = program.command("service").alias("daemon").description("Manag
97831
97882
  });
97832
97883
  serviceCmd.command("start").description("Start ATS Service on this device.").option("--mode <mode>", "Start mode: background (default) or foreground").option("--gateway-url <url>", "ATS gateway URL (command line, ATS_GATEWAY_URL, or saved ATS settings)").option("--profile <id-or-name>", "Optional ATS profile override used for owner resolution").option("--device-id <id>", "Override daemon device id for this run").option("--heartbeat-ms <n>", "Heartbeat interval in milliseconds (default: 25000)").action(runServiceStartCliAction);
97833
97884
  serviceCmd.command("run").description("Legacy alias for `ats service start`.").option("--mode <mode>", "Run mode: background (default) or foreground").option("--gateway-url <url>", "ATS gateway URL (command line, ATS_GATEWAY_URL, or saved ATS settings)").option("--profile <id-or-name>", "Optional ATS profile override used for owner resolution").option("--device-id <id>", "Override daemon device id for this run").option("--heartbeat-ms <n>", "Heartbeat interval in milliseconds (default: 25000)").action(runServiceStartCliAction);
97834
- serviceCmd.command("status").description("Show ATS Service status on this device.").option("--profile <id-or-name>", "Optional ATS profile context for local service diagnostics").action(async (opts) => {
97835
- const view = getGlobalViewOption();
97885
+ serviceCmd.command("status").description("Show ATS Service status on this device.").option("--json", "Print machine-readable JSON.", false).option("--profile <id-or-name>", "Optional ATS profile context for local service diagnostics").action(async (opts) => {
97886
+ const json = opts.json === true;
97887
+ const view = json ? "agent" : getGlobalViewOption();
97836
97888
  await runCommandWithEntryChecks({
97837
97889
  routeTokens: ["service", "status"],
97838
97890
  profile: opts.profile,
97839
97891
  view,
97840
97892
  run: async () => {
97841
97893
  await runDaemonStatusFlow({
97894
+ json,
97842
97895
  profile: opts.profile,
97843
97896
  view
97844
97897
  });
97845
- await maybeRunAgentViewRecoveryAfterSuccess({ view });
97898
+ if (!json) await maybeRunAgentViewRecoveryAfterSuccess({ view });
97846
97899
  }
97847
97900
  });
97848
97901
  });
@@ -99050,6 +99103,7 @@ async function runRootCommand() {
99050
99103
  }
99051
99104
  }
99052
99105
  async function shouldPrintTagline(argv, effectiveView) {
99106
+ if (hasJsonOutputArgv(argv)) return false;
99053
99107
  if ((effectiveView === "auto" ? (await resolveRuntimeContext({ view: "auto" })).resolvedView : effectiveView) === "agent") return false;
99054
99108
  const [firstCommand, secondCommand] = parseLeadingCommandTokensFromArgv(argv, 2);
99055
99109
  if (firstCommand === "setup" || firstCommand === "agents" && secondCommand === "prepare") return false;