agent-transport-system 0.7.26 → 0.7.27

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,7 +27,7 @@ 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.26";
30
+ var version = "0.7.27";
31
31
  var package_default = {
32
32
  $schema: "https://www.schemastore.org/package.json",
33
33
  name: "agent-transport-system",
@@ -45864,6 +45864,7 @@ function renderDaemonReinstallCard(input) {
45864
45864
  }
45865
45865
  function renderDaemonReinstallOutcome(input) {
45866
45866
  emitDaemonReinstallResult(input);
45867
+ if (input.suppressHumanResultCard === true) return;
45867
45868
  renderDaemonReinstallCard(input);
45868
45869
  }
45869
45870
  function createDaemonStartSpinner(input) {
@@ -46180,7 +46181,8 @@ async function runDaemonReinstall(input, options = {}) {
46180
46181
  action: displayAction,
46181
46182
  outcome,
46182
46183
  presenter,
46183
- resolvedView: runtime.resolvedView
46184
+ resolvedView: runtime.resolvedView,
46185
+ suppressHumanResultCard: options.suppressHumanResultCard
46184
46186
  });
46185
46187
  return outcome;
46186
46188
  } catch (error) {
@@ -50171,6 +50173,7 @@ async function runDaemonServiceParticipationInstallAction(input) {
50171
50173
  await runDaemonServiceSafeRefresh({
50172
50174
  atsProfileId: input.input.atsProfileId,
50173
50175
  gatewayUrl: input.input.gatewayUrl,
50176
+ suppressHumanResultCard: input.input.suppressRefreshHumanResultCard,
50174
50177
  view: input.input.view
50175
50178
  });
50176
50179
  return;
@@ -50210,6 +50213,7 @@ async function runDaemonServiceSafeRefresh(input) {
50210
50213
  skipConfirm: true,
50211
50214
  startAfterInstallMode: "always",
50212
50215
  suppressAgentOverview: true,
50216
+ suppressHumanResultCard: input.suppressHumanResultCard,
50213
50217
  suppressInstallOutput: true
50214
50218
  });
50215
50219
  }
@@ -50249,6 +50253,7 @@ async function runDaemonServiceParticipationRefresh(input) {
50249
50253
  const refreshOutcome = await runDaemonServiceSafeRefresh({
50250
50254
  atsProfileId: input.input.atsProfileId,
50251
50255
  gatewayUrl: input.input.gatewayUrl,
50256
+ suppressHumanResultCard: input.input.suppressRefreshHumanResultCard,
50252
50257
  view: input.input.view
50253
50258
  });
50254
50259
  if (refreshOutcome.ok && (refreshOutcome.result === "completed" || refreshOutcome.result === "stopped_safe") && refreshOutcome.serviceState === "stopped") {
@@ -87272,6 +87277,67 @@ function normalizeId(value) {
87272
87277
  return value.trim();
87273
87278
  }
87274
87279
 
87280
+ //#endregion
87281
+ //#region src/ui/setup-human-view.ts
87282
+ async function runWithSetupSpinner(input) {
87283
+ const spinner = createDelayedSpinner({
87284
+ enabled: input.enabled,
87285
+ message: input.message
87286
+ });
87287
+ spinner.start();
87288
+ try {
87289
+ const result = await input.run();
87290
+ spinner.complete();
87291
+ return result;
87292
+ } catch (error) {
87293
+ spinner.fail();
87294
+ throw error;
87295
+ }
87296
+ }
87297
+ function emitSetupHumanHeader(input) {
87298
+ if (input.view !== "human") return;
87299
+ input.presenter.line({
87300
+ code: "setup.header.spacing.start",
87301
+ text: ""
87302
+ });
87303
+ for (const line of renderAtsBrandBlockLines()) input.presenter.line({
87304
+ code: "setup.header.brand",
87305
+ text: line
87306
+ });
87307
+ input.presenter.line({
87308
+ code: "setup.header.spacing.end",
87309
+ text: ""
87310
+ });
87311
+ }
87312
+ function renderSetupStepCard(input) {
87313
+ if (input.view !== "human") return;
87314
+ renderInfoCard({
87315
+ presenter: input.presenter,
87316
+ title: input.title,
87317
+ codePrefix: input.codePrefix,
87318
+ rows: input.rows,
87319
+ sanitize: true,
87320
+ minContentWidth: 52
87321
+ });
87322
+ }
87323
+ function renderSetupAgentHandoffCard(input) {
87324
+ if (input.view !== "human") return;
87325
+ renderInfoCard({
87326
+ presenter: input.presenter,
87327
+ title: "For AI Setup Agents",
87328
+ codePrefix: "setup.complete.agent_handoff.card",
87329
+ rows: [{
87330
+ label: "Structured output",
87331
+ value: `Run ${formatAtsCliCommand(`${input.cliCommandPrefix} setup --view agent`)} to print setup.complete.`
87332
+ }, {
87333
+ label: "Use when",
87334
+ value: "An AI setup agent needs the machine-readable setup facts for follow-up ATS commands."
87335
+ }],
87336
+ sanitize: true,
87337
+ minContentWidth: 52
87338
+ });
87339
+ }
87340
+
87275
87341
  //#endregion
87276
87342
  //#region src/start-foundation/profile-id.ts
87277
87343
  function resolveCliStartFoundationProfileId(profile) {
@@ -91325,6 +91391,10 @@ async function runSetupUnlocked(input) {
91325
91391
  const presenter = createPresenter(runtime);
91326
91392
  const interactive = canUseInteractivePrompts(runtime);
91327
91393
  const gatewayUrl = await resolveBaseUrl();
91394
+ emitSetupHumanHeader({
91395
+ presenter,
91396
+ view: runtime.resolvedView
91397
+ });
91328
91398
  await maybeLogInWithOneTimeToken({
91329
91399
  ott: input.ott,
91330
91400
  view: input.view
@@ -91335,28 +91405,51 @@ async function runSetupUnlocked(input) {
91335
91405
  promptMessage: "Sign in to ATS before setting up this computer.",
91336
91406
  allowPrompt: interactive
91337
91407
  })) return;
91338
- emitSetupStatus(runtime, "Checking local agents", ["Looking for supported local agents on this computer."]);
91339
- const initialReadiness = await collectStartLocalReadiness({ auth: {
91340
- status: "valid",
91341
- email: null,
91342
- authBaseUrl: null,
91343
- gatewayUrl
91344
- } });
91408
+ const initialReadiness = await runWithSetupSpinner({
91409
+ enabled: runtime.resolvedView === "human",
91410
+ message: "Checking local agents...",
91411
+ run: async () => await collectStartLocalReadiness({ auth: {
91412
+ status: "valid",
91413
+ email: null,
91414
+ authBaseUrl: null,
91415
+ gatewayUrl
91416
+ } })
91417
+ });
91345
91418
  const selectedLocalAgentIds = resolveSetupLocalAgentIds({
91346
91419
  localAgent: input.localAgent,
91347
91420
  localAgents: input.localAgents,
91348
91421
  readiness: initialReadiness
91349
91422
  });
91350
- if (selectedLocalAgentIds.length > 0) {
91351
- emitSetupStatus(runtime, "Connecting local agents", [`Connecting ${selectedLocalAgentIds.length} local agent${selectedLocalAgentIds.length === 1 ? "" : "s"} for ATS.`]);
91352
- assertStartLocalAgentsEnableCompleted(await runStartLocalAgentsEnable({
91423
+ if (selectedLocalAgentIds.length > 0) assertStartLocalAgentsEnableCompleted(await runWithSetupSpinner({
91424
+ enabled: runtime.resolvedView === "human",
91425
+ message: "Connecting local agents...",
91426
+ run: async () => await runStartLocalAgentsEnable({
91353
91427
  agent: selectedLocalAgentIds,
91354
91428
  interactive,
91355
91429
  presentation: "handoff",
91356
91430
  view: input.view
91357
- }));
91358
- }
91359
- emitSetupStatus(runtime, "Starting ATS Service", ["Starting or repairing ATS Service for this computer."]);
91431
+ })
91432
+ }));
91433
+ renderSetupStepCard({
91434
+ presenter,
91435
+ view: runtime.resolvedView,
91436
+ title: "✓ Local Agents",
91437
+ codePrefix: "setup.local_agents.card",
91438
+ rows: [
91439
+ {
91440
+ label: "Status",
91441
+ value: selectedLocalAgentIds.length > 0 ? "Connected" : "No local agents selected"
91442
+ },
91443
+ {
91444
+ label: "Found",
91445
+ value: formatSetupLocalAgentCandidateCount(initialReadiness)
91446
+ },
91447
+ {
91448
+ label: "Selected",
91449
+ value: formatSetupCompleteLocalAgents(selectedLocalAgentIds)
91450
+ }
91451
+ ]
91452
+ });
91360
91453
  const serviceGate = await runDaemonServiceParticipationGate({
91361
91454
  intent: "start",
91362
91455
  presenter,
@@ -91366,11 +91459,36 @@ async function runSetupUnlocked(input) {
91366
91459
  gatewayUrl,
91367
91460
  forcePrompt: true,
91368
91461
  refreshIfAuthSessionChanged: true,
91462
+ suppressRefreshHumanResultCard: true,
91369
91463
  view: input.view
91370
91464
  });
91371
91465
  if (serviceGate.status === "cancelled") return;
91372
91466
  if (serviceGate.status !== "aligned") throw new Error(serviceGate.errorMessage ?? "ATS Service could not be started for setup on this computer.");
91373
91467
  const atsServiceRuntimeIdentity = await syncLocalSetupCurrentDeviceTargetFromServiceContract({ gatewayUrl });
91468
+ renderSetupStepCard({
91469
+ presenter,
91470
+ view: runtime.resolvedView,
91471
+ title: "✓ ATS Service",
91472
+ codePrefix: "setup.service.card",
91473
+ rows: [
91474
+ {
91475
+ label: "Status",
91476
+ value: "Connected"
91477
+ },
91478
+ {
91479
+ label: "What happened",
91480
+ value: "ATS checked the background service and aligned it with this setup."
91481
+ },
91482
+ {
91483
+ label: "Current service",
91484
+ value: formatSetupCompleteService(atsServiceRuntimeIdentity)
91485
+ },
91486
+ {
91487
+ label: "Next",
91488
+ value: "No action is required."
91489
+ }
91490
+ ]
91491
+ });
91374
91492
  const finalReadiness = await collectStartLocalReadiness({ auth: {
91375
91493
  status: "valid",
91376
91494
  email: null,
@@ -91387,8 +91505,31 @@ async function runSetupUnlocked(input) {
91387
91505
  });
91388
91506
  assertSelectedLocalRuntimeReportsAccepted(runtimeReports);
91389
91507
  const routeCatalogSync = selectedLocalAgentIds.length > 0 ? await notifyRouteCatalogAfterSetup({ reason: "setup_local_capabilities_reported" }) : null;
91390
- emitSetupStatus(runtime, "Updating ATS skills", ["Updating ATS skills so local agents use the current ATS instructions."]);
91391
- await ensureSetupManagedSkills({ view: input.view });
91508
+ await runWithSetupSpinner({
91509
+ enabled: runtime.resolvedView === "human",
91510
+ message: "Updating ATS skills...",
91511
+ run: async () => await ensureSetupManagedSkills({ view: input.view })
91512
+ });
91513
+ renderSetupStepCard({
91514
+ presenter,
91515
+ view: runtime.resolvedView,
91516
+ title: "✓ ATS Skills",
91517
+ codePrefix: "setup.skills.card",
91518
+ rows: [
91519
+ {
91520
+ label: "Status",
91521
+ value: "Updated"
91522
+ },
91523
+ {
91524
+ label: "What happened",
91525
+ value: "ATS refreshed the local instructions used by supported agents."
91526
+ },
91527
+ {
91528
+ label: "Next",
91529
+ value: "Local agents can use the current ATS guide."
91530
+ }
91531
+ ]
91532
+ });
91392
91533
  emitSetupComplete({
91393
91534
  gatewayUrl,
91394
91535
  localComponents: await finalizeLocalComponentsSetupSnapshot(),
@@ -91466,10 +91607,6 @@ function assertStartLocalAgentsEnableCompleted(result) {
91466
91607
  async function notifyRouteCatalogAfterSetup(input) {
91467
91608
  return await notifyDaemonRouteCatalogChanged({ reason: input.reason });
91468
91609
  }
91469
- function emitSetupStatus(runtime, title, lines) {
91470
- if (runtime.resolvedView !== "human") return;
91471
- console.log([title, ...lines].join("\n"));
91472
- }
91473
91610
  async function emitSetupCompleteForDelegatedPath(input) {
91474
91611
  const runtime = await resolveRuntimeContext({ view: input.view });
91475
91612
  const presenter = createPresenter(runtime);
@@ -91589,17 +91726,13 @@ function emitSetupComplete(input) {
91589
91726
  if (input.view === "human") {
91590
91727
  renderInfoCard({
91591
91728
  presenter: input.presenter,
91592
- title: "ATS Setup Complete",
91729
+ title: "ATS Setup Complete",
91593
91730
  codePrefix: "setup.complete.card",
91594
91731
  sanitize: true,
91595
91732
  rows: [
91596
91733
  {
91597
- label: "CLI prefix",
91598
- value: cliCommandPrefix
91599
- },
91600
- {
91601
- label: "Lane root",
91602
- value: payload.laneRoot
91734
+ label: "Status",
91735
+ value: "Ready"
91603
91736
  },
91604
91737
  {
91605
91738
  label: "Local agents",
@@ -91613,15 +91746,20 @@ function emitSetupComplete(input) {
91613
91746
  label: "Service",
91614
91747
  value: formatSetupCompleteService(input.atsServiceRuntimeIdentity)
91615
91748
  },
91749
+ {
91750
+ label: "Local components",
91751
+ value: input.localComponents.summaryLabel
91752
+ },
91616
91753
  {
91617
91754
  label: "Next",
91618
91755
  value: nextCommands[1] ?? ""
91619
91756
  }
91620
91757
  ]
91621
91758
  });
91622
- emitHumanSetupCompleteAgentHandoff({
91623
- payload,
91624
- presenter: input.presenter
91759
+ renderSetupAgentHandoffCard({
91760
+ cliCommandPrefix,
91761
+ presenter: input.presenter,
91762
+ view: input.view
91625
91763
  });
91626
91764
  return;
91627
91765
  }
@@ -91678,33 +91816,6 @@ async function finalizeLocalComponentsSetupSnapshot() {
91678
91816
  await writeInstalledLocalComponentsSnapshot({ source: "setup" });
91679
91817
  return await resolveLocalComponentsStatus();
91680
91818
  }
91681
- function emitHumanSetupCompleteAgentHandoff(input) {
91682
- input.presenter.line({
91683
- code: "setup.complete.agent_handoff.heading",
91684
- text: "Agent handoff: setup.complete"
91685
- });
91686
- input.presenter.line({
91687
- code: "setup.complete.agent_handoff.detail",
91688
- text: "Your setup agent can read the structured block below for follow-up commands."
91689
- });
91690
- input.presenter.line({
91691
- code: "setup.complete.agent_handoff.begin",
91692
- text: "-----BEGIN ATS SETUP COMPLETE-----"
91693
- });
91694
- const envelope = {
91695
- type: "result",
91696
- code: "setup.complete",
91697
- payload: input.payload
91698
- };
91699
- for (const line of JSON.stringify(envelope, null, 2).split("\n")) input.presenter.line({
91700
- code: "setup.complete.agent_handoff.json",
91701
- text: line
91702
- });
91703
- input.presenter.line({
91704
- code: "setup.complete.agent_handoff.end",
91705
- text: "-----END ATS SETUP COMPLETE-----"
91706
- });
91707
- }
91708
91819
  function formatSetupCompleteLocalAgents(selectedLocalAgentIds) {
91709
91820
  if (selectedLocalAgentIds.length === 0) return "No local agents selected";
91710
91821
  return `${selectedLocalAgentIds.length} detected: ${selectedLocalAgentIds.join(", ")}`;
@@ -91720,6 +91831,11 @@ function formatSetupCompleteService(atsServiceRuntimeIdentity) {
91720
91831
  if (!atsServiceRuntimeIdentity) return "Not connected";
91721
91832
  return `${atsServiceRuntimeIdentity.runtimeLane} - ${shortenIdentifier(atsServiceRuntimeIdentity.deviceId)}`;
91722
91833
  }
91834
+ function formatSetupLocalAgentCandidateCount(readiness) {
91835
+ const supportedCount = readiness.agents.candidates.filter((candidate) => candidate.selectable).length;
91836
+ if (supportedCount === 0) return "No supported local agents found";
91837
+ return `${supportedCount} supported local agent${supportedCount === 1 ? "" : "s"} found`;
91838
+ }
91723
91839
  function shortenIdentifier(value) {
91724
91840
  if (value.length <= 18) return value;
91725
91841
  return `${value.slice(0, 8)}...${value.slice(-4)}`;