@skrr-ai/cli 0.1.162 → 0.1.164

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 (95) hide show
  1. package/dist/base-command.d.ts +5 -2
  2. package/dist/base-command.js +108 -39
  3. package/dist/commands/activity/list.d.ts +7 -0
  4. package/dist/commands/activity/list.js +17 -0
  5. package/dist/commands/activity/scan-older.d.ts +2 -2
  6. package/dist/commands/activity/scan-older.js +6 -5
  7. package/dist/commands/activity/show.d.ts +0 -2
  8. package/dist/commands/activity/show.js +21 -42
  9. package/dist/commands/agents/always-on/release-run.d.ts +3 -3
  10. package/dist/commands/agents/always-on/release-run.js +5 -6
  11. package/dist/commands/agents/mini-computer/app/reset.d.ts +1 -0
  12. package/dist/commands/agents/mini-computer/app/reset.js +5 -2
  13. package/dist/commands/agents/mini-computer/app/set.js +1 -1
  14. package/dist/commands/agents/mini-computer/show.js +10 -2
  15. package/dist/commands/agents/mini-computer/tasks-view.js +2 -2
  16. package/dist/commands/agents/supervision.d.ts +25 -0
  17. package/dist/commands/agents/supervision.js +129 -0
  18. package/dist/commands/agents/triggers/replay.js +1 -1
  19. package/dist/commands/agents/triggers/runs.d.ts +2 -3
  20. package/dist/commands/agents/triggers/runs.js +4 -5
  21. package/dist/commands/apps/auto-apply.js +31 -10
  22. package/dist/commands/apps/check.js +8 -0
  23. package/dist/commands/apps/data/batch.js +16 -5
  24. package/dist/commands/apps/data/collections.js +1 -1
  25. package/dist/commands/apps/data/delete.js +12 -4
  26. package/dist/commands/apps/data/patch.js +11 -4
  27. package/dist/commands/apps/data/put.js +13 -6
  28. package/dist/commands/apps/data/query.js +3 -3
  29. package/dist/commands/apps/install.js +24 -7
  30. package/dist/commands/apps/installations/events.d.ts +1 -0
  31. package/dist/commands/apps/installations/events.js +63 -10
  32. package/dist/commands/apps/installations/show.js +26 -5
  33. package/dist/commands/apps/installations/snapshot.js +1 -1
  34. package/dist/commands/apps/installations/versions.js +25 -9
  35. package/dist/commands/apps/logs.js +4 -1
  36. package/dist/commands/apps/push.js +10 -2
  37. package/dist/commands/apps/reconsent.js +7 -1
  38. package/dist/commands/apps/rollback.js +2 -2
  39. package/dist/commands/apps/settings/set.js +81 -4
  40. package/dist/commands/apps/settings/show.js +38 -7
  41. package/dist/commands/duties/action-proposal.js +19 -11
  42. package/dist/commands/duties/cadence-decisions.js +7 -0
  43. package/dist/commands/duties/status.js +20 -15
  44. package/dist/commands/duties/trigger-status.js +2 -2
  45. package/dist/commands/duties/wake-capabilities.js +12 -6
  46. package/dist/commands/outbox/drop.js +21 -15
  47. package/dist/commands/outbox/list.d.ts +2 -1
  48. package/dist/commands/outbox/list.js +20 -11
  49. package/dist/commands/outbox/retry.d.ts +8 -11
  50. package/dist/commands/outbox/retry.js +135 -92
  51. package/dist/commands/spaces/create.js +1 -1
  52. package/dist/commands/tasks/comments/add.js +1 -1
  53. package/dist/commands/triggers/audit.js +3 -5
  54. package/dist/commands/triggers/fire-detail.js +7 -1
  55. package/dist/commands/triggers/replay.js +1 -1
  56. package/dist/commands/triggers/runs.d.ts +2 -4
  57. package/dist/commands/triggers/runs.js +3 -5
  58. package/dist/generated/agent-guides.json +19 -19
  59. package/dist/lib/agent-activity.d.ts +21 -1
  60. package/dist/lib/agent-activity.js +98 -29
  61. package/dist/lib/api-fetch.d.ts +2 -0
  62. package/dist/lib/api-fetch.js +5 -5
  63. package/dist/lib/appData.d.ts +43 -5
  64. package/dist/lib/appData.js +117 -25
  65. package/dist/lib/appInstallations.d.ts +5 -5
  66. package/dist/lib/appInstallations.js +232 -74
  67. package/dist/lib/appSettings.d.ts +2 -0
  68. package/dist/lib/appSettings.js +36 -3
  69. package/dist/lib/apps-command.d.ts +9 -0
  70. package/dist/lib/apps-command.js +191 -7
  71. package/dist/lib/appsCheck.js +40 -3
  72. package/dist/lib/appsFs.d.ts +1 -1
  73. package/dist/lib/chat-supervision.d.ts +21 -0
  74. package/dist/lib/chat-supervision.js +37 -0
  75. package/dist/lib/duties.d.ts +4 -0
  76. package/dist/lib/json-output.d.ts +4 -0
  77. package/dist/lib/json-output.js +38 -0
  78. package/dist/lib/miniComputer.d.ts +1 -0
  79. package/dist/lib/miniComputer.js +16 -4
  80. package/dist/lib/miniComputerCommand.js +4 -1
  81. package/dist/lib/node-adapter.js +35 -2
  82. package/dist/lib/outbox.d.ts +20 -5
  83. package/dist/lib/outbox.js +233 -76
  84. package/dist/lib/rate-limit-retry.d.ts +3 -2
  85. package/dist/lib/rate-limit-retry.js +3 -2
  86. package/dist/lib/roles.d.ts +1 -1
  87. package/dist/lib/triggers.d.ts +3 -0
  88. package/dist/lib/triggers.js +10 -0
  89. package/dist/lib/widgetCheck.js +30 -4
  90. package/dist/lib/widgetStaticScan.d.ts +17 -6
  91. package/dist/lib/widgetStaticScan.js +336 -94
  92. package/dist/node_modules/@skrr-ai/data-provider/APP_HTML_PARSER_LICENSES.txt +36 -0
  93. package/dist/node_modules/@skrr-ai/data-provider/index.js +15543 -10133
  94. package/oclif.manifest.json +334 -47
  95. package/package.json +5 -3
@@ -43,6 +43,7 @@ exports.formatVersionDiff = formatVersionDiff;
43
43
  * next step.
44
44
  */
45
45
  const data_provider_1 = require("@skrr-ai/data-provider");
46
+ const appData_1 = require("./appData");
46
47
  const DESCRIBE_SCHEDULE_RE = /s$/;
47
48
  const FORMAT_JOB_STATES_RE = /<installation>/g;
48
49
  const ITEM_LINES_RE = /_/g;
@@ -73,9 +74,9 @@ function describeAvailability(availability) {
73
74
  */
74
75
  const TRUST_WORDS = {
75
76
  platform: 'built in',
76
- reviewed: 'public; only automatic checks have looked at it (no person has reviewed it, and the checks do not show it is safe)',
77
- workspace: 'published to a workspace and marked approved (who approved it is not recorded here)',
78
- self: 'private: nobody but its maker has looked at it',
77
+ reviewed: 'public or beta and marked approved; automatic checks do not show it is safe, and this screen does not establish who reviewed it',
78
+ workspace: 'marked approved for workspace distribution (who approved it is not recorded here)',
79
+ self: 'not identified as an approved public, beta or workspace app; review history is not known here',
79
80
  };
80
81
  function describeTrust(trust) {
81
82
  return typeof trust === 'string' ? (TRUST_WORDS[trust] ?? trust) : 'unknown';
@@ -83,9 +84,9 @@ function describeTrust(trust) {
83
84
  /** The same four tiers in a few words, for a table: never the raw tier word, which reads as a verdict. */
84
85
  const TRUST_SHORT = {
85
86
  platform: 'built in',
86
- reviewed: 'automatic checks only',
87
+ reviewed: 'public or beta',
87
88
  workspace: 'workspace',
88
- self: 'private',
89
+ self: 'unconfirmed',
89
90
  };
90
91
  function describeTrustShort(trust) {
91
92
  return typeof trust === 'string' ? (TRUST_SHORT[trust] ?? trust) : 'unknown';
@@ -123,7 +124,7 @@ function mark(consent) {
123
124
  }
124
125
  /** What each item of the `host` capability says (the contract's `APP_HOST_ITEMS`); an item a newer server sent is named, not dropped. */
125
126
  const HOST_ITEM_WORDS = {
126
- notify: 'ask the host to show notices from it in your notification centre (it sends nothing to anyone)',
127
+ notify: `ask the host to keep notices in the viewer’s browser, not send device push notifications. Agent installations can show them in that Agent’s Mini Computer; personal installations may not show them. Browser storage can preserve notices after the viewer closes the page; updates that cannot be saved last only in the viewer’s current page. When stored notices are loaded or a notice is added, notices older than ${data_provider_1.APP_PRESENTATION_LIMITS.noticeKeptMs / 86_400_000} days are filtered; count limits may remove them sooner`,
127
128
  badge: 'ask the host to put a number on its icon',
128
129
  open_app: 'ask the host to open another of your apps from it',
129
130
  };
@@ -133,14 +134,16 @@ const ISOLATION_WORDS = {
133
134
  microvm: 'inside its own microVM',
134
135
  };
135
136
  /**
136
- * Who can change a collection, as the words in the brackets. "The app's own code can change it" and "only your
137
- * agent can change it" are different promises, so they are different sentences.
137
+ * Who can change a collection, as the words in the brackets. App code and an authorized agent are different
138
+ * writers, so the disclosure must not imply that one can write when only the other is allowed.
138
139
  */
139
140
  const STORE_WRITER_WORDS = {
140
- app_and_agent: "the app's own code can read and change it, including what your agent writes there",
141
+ app_person_and_agent: "the app's own code, people with edit access and agents acting for them can read and change it",
142
+ app_and_person: "the app's own code and people with edit access can read and change it",
143
+ app_and_agent: "the app's own code can read and change it, including what agents acting for people with edit access write there",
141
144
  app: "the app's own code can read and change it",
142
- person_and_agent: "only people and your agent can change it; the app's own code can only read it",
143
- agent: "only your agent can change it; the app's own code can only read it",
145
+ person_and_agent: "only people with edit access and agents acting for them can change it; the app's own code can only read it",
146
+ agent: "only agents acting for people with edit access can change it; the app's own code can only read it",
144
147
  person: "only people can change it; the app's own code can only read it",
145
148
  };
146
149
  /** A job's schedule in words, beside the text the author wrote (which is always still shown). */
@@ -153,8 +156,8 @@ function describeSchedule(schedule) {
153
156
  return `every ${reading.count === 1 ? reading.unit.replace(DESCRIBE_SCHEDULE_RE, '') : `${reading.count} ${reading.unit}`}`;
154
157
  case 'event':
155
158
  return reading.source === 'webhook'
156
- ? `when the app's "${reading.name}" webhook delivers an event (not on a clock)`
157
- : `when a person or the app changes "${reading.name}" (never when your agent does; not on a clock)`;
159
+ ? `can wake when the app's "${reading.name}" webhook delivers an event (not on a clock)`
160
+ : `can wake on a permitted person or app-window write to "${reading.name}" (see collection permissions; agent and webhook writes do not trigger this change wake; not on a clock)`;
158
161
  case 'configured':
159
162
  return "on a schedule set in the app's settings";
160
163
  default:
@@ -275,7 +278,7 @@ function describeJobScheduling(jobState) {
275
278
  case 'removed_by_person':
276
279
  return {
277
280
  state: 'removed_by_person',
278
- what: 'you deleted its schedule; it stays deleted for this version',
281
+ what: 'a person removed its trigger',
279
282
  next: null,
280
283
  };
281
284
  default:
@@ -283,7 +286,7 @@ function describeJobScheduling(jobState) {
283
286
  }
284
287
  }
285
288
  /** The lines `skrr apps installations show` prints for the jobs' states: one per job, the reason and the next step under a job that is not scheduled. */
286
- function formatJobStates(jobStates, installationId) {
289
+ function formatJobStates(jobStates, installationId, jobTriggers) {
287
290
  if (!Array.isArray(jobStates)) {
288
291
  // a server that predates the record: say so, since silence would read as "all scheduled"
289
292
  return [' (this server does not say whether the jobs are scheduled)'];
@@ -292,12 +295,39 @@ function formatJobStates(jobStates, installationId) {
292
295
  for (const job of jobStates) {
293
296
  const words = describeJobScheduling(job);
294
297
  if (!words) {
295
- lines.push(` job ${(0, data_provider_1.plainAppLabel)(job.id, 64)}: scheduled`);
296
- continue;
298
+ lines.push(` job ${(0, data_provider_1.plainAppLabel)(job.id, 64)}: a previous scheduling check recorded scheduled`);
297
299
  }
298
- lines.push(` job ${(0, data_provider_1.plainAppLabel)(job.id, 64)}: NOT SCHEDULED: ${words.what}`);
299
- if (words.next) {
300
- lines.push(` next: ${words.next.replace(FORMAT_JOB_STATES_RE, installationId)}`);
300
+ else {
301
+ lines.push(` job ${(0, data_provider_1.plainAppLabel)(job.id, 64)}: last reconciliation: ${words.what}`);
302
+ if (words.next) {
303
+ lines.push(` guidance for that outcome: ${words.next.replace(FORMAT_JOB_STATES_RE, installationId)}`);
304
+ }
305
+ }
306
+ const raw = jobTriggers?.[job.id];
307
+ const trigger = raw && typeof raw === 'object' && !Array.isArray(raw)
308
+ ? raw
309
+ : null;
310
+ switch (trigger?.state) {
311
+ case 'paused_by_person':
312
+ lines.push(' trigger: paused by a person');
313
+ break;
314
+ case 'paused_by_platform':
315
+ lines.push(' trigger: paused by the platform');
316
+ break;
317
+ case 'removed_by_person':
318
+ lines.push(' trigger: removed by a person');
319
+ break;
320
+ case 'missing':
321
+ lines.push(' trigger: missing');
322
+ break;
323
+ case 'managed':
324
+ case 'detached':
325
+ lines.push(trigger.enabled === true
326
+ ? ` trigger: enabled${trigger.state === 'detached' ? ' (edited by a person; app upgrades no longer update it)' : ''}`
327
+ : ' trigger: enabled state not confirmed');
328
+ break;
329
+ default:
330
+ lines.push(' trigger: current state not confirmed');
301
331
  }
302
332
  }
303
333
  return lines;
@@ -308,35 +338,38 @@ function formatJobStates(jobStates, installationId) {
308
338
  */
309
339
  function describeJobState(job) {
310
340
  const scheduling = describeJobScheduling(job.jobState);
311
- // The platform tried to schedule it and was REFUSED: the most useful thing to read, even when an older trigger is
312
- // still there (it runs the text from before the refusal).
313
- if (scheduling?.state === 'refused') {
314
- return ` [NOT SCHEDULED: ${scheduling.what}]`;
315
- }
341
+ const history = scheduling && scheduling.state !== 'unknown'
342
+ ? ` [last reconciliation: ${scheduling.what}]`
343
+ : '';
316
344
  const trigger = job.trigger;
317
345
  if (trigger) {
318
346
  switch (trigger.state) {
319
347
  case 'paused_by_person':
320
- return ' [you turned this job off]';
348
+ return `${history} [a person turned this job off]`;
321
349
  case 'paused_by_platform': {
322
350
  const reason = trigger.platformDisabled?.reason;
323
351
  const words = reason ? (DISABLE_REASON_WORDS[reason] ?? reason) : 'no reason recorded';
324
- return ` [turned off by the platform: ${words}]`;
352
+ return `${history} [turned off by the platform: ${words}]`;
325
353
  }
326
354
  case 'removed_by_person':
327
- return ' [you deleted its schedule; it stays deleted for this version]';
355
+ return `${history} [a person removed its trigger]`;
356
+ case 'managed':
357
+ case 'detached':
358
+ return history
359
+ ? `${history} [trigger ${trigger.enabled === true ? 'enabled' : 'enabled state not confirmed'}]`
360
+ : '';
361
+ case 'missing':
362
+ return `${history} [no trigger right now]`;
328
363
  default:
329
364
  break;
330
365
  }
331
366
  }
332
367
  // no trigger to speak for the job: what the platform recorded about it, or that it recorded nothing
333
- if (scheduling && scheduling.state !== 'unknown') {
334
- return ` [not scheduled: ${scheduling.what}]`;
368
+ if (!trigger && job.jobState?.state === 'scheduled') {
369
+ return ' [a previous scheduling check recorded scheduled; current trigger state not confirmed]';
335
370
  }
336
- if (trigger?.state === 'missing') {
337
- return scheduling
338
- ? ` [not scheduled right now; ${scheduling.what}]`
339
- : ' [not scheduled right now]';
371
+ if (history) {
372
+ return `${history} [current trigger state not confirmed]`;
340
373
  }
341
374
  if (scheduling && !trigger) {
342
375
  return ` [${scheduling.what}]`;
@@ -372,7 +405,12 @@ function itemLines(item) {
372
405
  return `keep its own data in "${collection.name}" (${words})${mark(collection.consent)}`;
373
406
  });
374
407
  case 'query':
375
- return item.contracts.map((contract) => `read "${contract.name}" from the platform, as whoever is looking (each person sees only what they may see)${mark(contract.consent)}`);
408
+ return item.contracts.map((contract) => {
409
+ const known = (0, data_provider_1.getAppQueryContract)(contract.name);
410
+ return known
411
+ ? `read platform data: ${known.summary} (${contract.name}; read as the person looking)${mark(contract.consent)}`
412
+ : `This CLI cannot explain what "${contract.name}" reads. Update the CLI and review this access before approving.${mark(contract.consent)}`;
413
+ });
376
414
  case 'tools':
377
415
  return item.tools.map((tool) => `call the tool "${tool.name}"${tool.connector ? ` (your ${tool.connector} connection)` : ''}${mark(tool.consent)}`);
378
416
  case 'http':
@@ -382,7 +420,7 @@ function itemLines(item) {
382
420
  case 'act':
383
421
  return item.effects.map((effect) => `ask to "${effect.effect}"; it only asks, and a person releases each one under their own name${mark(effect.consent)}`);
384
422
  case 'webhooks':
385
- return item.hooks.map((hook) => `let an outside system that holds a secret address add entries to "${hook.collection}" (the hook "${hook.name}"${hook.title ? `, "${hook.title}"` : ''}); entries are only stored there, nothing runs because one arrived${mark(hook.consent)}`);
423
+ return item.hooks.map((hook) => `let an outside system holding the webhook credentials (bearer token and signing secret) add entries to "${hook.collection}" (the hook "${hook.name}"${hook.title ? `, "${hook.title}"` : ''}); a delivery can wake a job declared for this webhook, which can run with the permissions of the person who approved the installation${mark(hook.consent)}`);
386
424
  case 'service': {
387
425
  const declaration = item.declaration;
388
426
  const lines = [
@@ -398,11 +436,20 @@ function itemLines(item) {
398
436
  }
399
437
  case 'jobs':
400
438
  return [
401
- `run these jobs on a schedule, unattended. ${item.statement} That is accepted when you install it, and each job is listed so you can weigh it:`,
439
+ `run these jobs automatically, unattended. ${item.statement} That is accepted when you install it, and each job is listed so you can weigh it:`,
402
440
  ...item.jobs.flatMap((job) => [
403
441
  ` - ${(0, data_provider_1.plainAppLabel)(job.title)} (${job.schedule}): ${describeSchedule(job.schedule)}${job.guide ? `, following ${job.guide}` : ''}${mark(job.consent)}${describeJobState(job)}`,
404
442
  ...jobNextLine(job),
405
443
  ]),
444
+ ...(item.jobs.some((job) => {
445
+ const kind = (0, data_provider_1.readAppJobSchedule)(job.schedule).kind;
446
+ return kind === 'event' || kind === 'configured';
447
+ })
448
+ ? [' If a job is event-triggered, limits or delivery failures can cause it to miss events. A recorded change or webhook delivery does not guarantee a run.']
449
+ : []),
450
+ ...(item.jobs.some((job) => (0, data_provider_1.readAppJobSchedule)(job.schedule).kind === 'configured')
451
+ ? [' If a settings-based schedule resolves to an event, the job may not wake at all. A scheduled status does not confirm it can wake.']
452
+ : []),
406
453
  ...(item.notices?.some((notice) => notice.kind === 'trigger_detached')
407
454
  ? [
408
455
  ' (a job someone edited in Triggers no longer follows this app: an upgrade will not change it)',
@@ -426,6 +473,43 @@ function describeGrantReasons(kinds) {
426
473
  const words = REASON_WORDS;
427
474
  return kinds.map((kind) => words[kind] ?? kind);
428
475
  }
476
+ /**
477
+ * The sentences of the note on an app installed on a PERSON that are true of this app, and none of the others (OSK-23975).
478
+ * The note used to be one fixed paragraph for every app, so an app that keeps no data and "asks for nothing" was still
479
+ * told that "data in its own app store is private to your account". Each sentence is a claim about one kind of
480
+ * capability, so it is said only when the disclosure lists that kind.
481
+ *
482
+ * THIS IS THE WEB'S RULE, WORD FOR WORD. The web dialog's copy of it is `userScopeNoteKeys`
483
+ * (`client/src/components/AgentApps/AppDisclosureView.tsx`) and its sentences are the `com_app_disclosure_user_scope_*`
484
+ * keys in `client/src/locales/en/translation.json`. Change one and change the other, or the two surfaces say different
485
+ * things about the same app. (Neither is in `@skrr-ai/data-provider` yet; moving them there is a separate decision.)
486
+ *
487
+ * - store privacy: the disclosure has a `store` item;
488
+ * - "may send data elsewhere": the platform contacts websites for it (`http`), it runs a background program (`service`),
489
+ * or a tool is named through a connector (`tools` with a `connector`). A registry tool is the platform's own read
490
+ * (connector null); `act` only asks and a person releases it; `host` only draws; `webhooks` bring entries in; `jobs`
491
+ * have their own note. None of those says it;
492
+ * - "platform reads depend on your permissions": it has a read contract (`query`) or tools.
493
+ *
494
+ * Computed from the WHOLE list of what it can do, in the order they are read. Empty for an app with none of these.
495
+ */
496
+ function userScopeSentences(can) {
497
+ const has = (kind) => can.some((item) => item.kind === kind);
498
+ const sentences = [];
499
+ if (has('store')) {
500
+ sentences.push('Data in its own app store is private to your account, and no other person can open it through the app. Your own sign-ins, and tools you give your account to, can see it as you can.');
501
+ }
502
+ const mayLeave = can.some((item) => item.kind === 'http' ||
503
+ item.kind === 'service' ||
504
+ (item.kind === 'tools' && item.tools.some((tool) => tool.connector !== null)));
505
+ if (mayLeave) {
506
+ sentences.push('Some of what it can do may send data elsewhere.');
507
+ }
508
+ if (has('query') || has('tools')) {
509
+ sentences.push('Platform reads depend on your permissions and the capabilities described below.');
510
+ }
511
+ return sentences;
512
+ }
429
513
  /**
430
514
  * A disclosure as the lines a person reads before they approve. `null` (a disclosure this CLI cannot read) is
431
515
  * said plainly: "cannot show what you would be approving" is never "nothing to approve".
@@ -442,20 +526,25 @@ function formatDisclosure(raw, facts) {
442
526
  lines.push(`${disclosure.app.name}${disclosure.bundleHash ? ` (bundle ${disclosure.bundleHash.slice(0, 12)})` : ''}`);
443
527
  if (facts) {
444
528
  // who is asking to be trusted, beside what it asks
445
- lines.push(`Version ${facts.version}, published by ${facts.publisher.name ?? 'someone the platform cannot name'}; ${describeTrust(facts.trust)}.`);
529
+ lines.push(`Version ${facts.version}, by ${facts.publisher.name ?? 'someone the platform cannot name'}; ${describeTrust(facts.trust)}.`);
446
530
  }
447
531
  if (disclosure.app.description) {
448
532
  lines.push(disclosure.app.description);
449
533
  }
450
534
  if (disclosure.scope) {
451
- // WHERE it is installed, and no claim about how far it reaches: the list below says what it can do, and a
535
+ // The scope being described may be a proposed installation, not an existing one. The list below says what it can do, and a
452
536
  // sentence that said "nothing else" over a list with jobs, tools and outbound requests would contradict it
453
537
  if (disclosure.scope.principal.kind === 'user') {
454
- // an app on a PERSON: say whose it is and what that means in words, and what does not happen for it yet
455
- lines.push('Installed on you. It is private to your account: what it keeps is not visible to any other person through it (your own sign-ins, and tools you give your account to, can see it as you can), and what it reads from the platform it reads as you.');
538
+ // an app on a PERSON: say whose it is, then what that means for the person's data when the app has any. Only a sentence
539
+ // for a capability the list below names is said (`userScopeSentences`), so an app that asks for nothing gets the
540
+ // scope line alone
541
+ const note = userScopeSentences(disclosure.can);
542
+ lines.push(note.length > 0
543
+ ? `For an installation on you: ${note.join(' ')}`
544
+ : 'For an installation on you.');
456
545
  }
457
546
  else {
458
- lines.push(`Installed on ${disclosure.scope.principal.kind} ${disclosure.scope.principal.id}.`);
547
+ lines.push(`For an installation on ${disclosure.scope.principal.kind} ${disclosure.scope.principal.id}.`);
459
548
  }
460
549
  }
461
550
  if (disclosure.can.length === 0) {
@@ -694,7 +783,14 @@ const CHECK_OUTCOME_WORDS = {
694
783
  findings: 'found things to look at',
695
784
  nothing_found: 'found nothing it looks for',
696
785
  };
697
- const LIMITS_REMINDER = 'That is not a statement that the app is safe, and no person reviews an app.';
786
+ /**
787
+ * The check's rule for a call the app's window has and the platform has nothing to run (`unansweredIssue` in
788
+ * data-provider's `appCheck.ts`; its title and `why` are in `appCheckRules.ts`). The rule id is the contract's, spelled
789
+ * here because the summary names a rule by it; `apps-installation-commands.spec.ts` fails if the contract stops having it.
790
+ */
791
+ const UNANSWERED_CALL_RULE = 'capability/unanswered';
792
+ const REVIEW_LIMIT_REMINDER = 'This automatic check does not include a human review and cannot tell whether anyone else has reviewed the app.';
793
+ const KNOWN_SAFETY_HEADLINE = 'This is an automatic check of the files in the package. It can find obvious problems; it cannot show that an app is safe.';
698
794
  /**
699
795
  * What the automatic check recorded for this version, in lines. It is never a verdict of "safe", and the three states
700
796
  * a surface must keep apart are kept apart: a result, no result on record (the version predates the check), and a
@@ -716,16 +812,35 @@ function describeDisclosureCheck(check) {
716
812
  }
717
813
  const { summary } = check;
718
814
  const { counts } = summary;
815
+ // Only the known headline is guaranteed to include the safety warning. Preserve it for any other record.
816
+ const safetyReminder = summary.limitations.headline === KNOWN_SAFETY_HEADLINE
817
+ ? ''
818
+ : ' It does not establish that the app is safe.';
719
819
  const lines = [
720
- `Automatic check: ${CHECK_OUTCOME_WORDS[summary.outcome] ?? summary.outcome}. ${LIMITS_REMINDER}`,
820
+ `Automatic check: ${CHECK_OUTCOME_WORDS[summary.outcome] ?? summary.outcome}. ${REVIEW_LIMIT_REMINDER}${safetyReminder}`,
721
821
  ];
722
822
  if (counts.block + counts.warn + counts.info + counts.unanalyzable > 0) {
723
823
  lines.push(` ${counts.block} would keep it out of the store, ${counts.warn} to read, ${counts.info} low-key, ${counts.unanalyzable} could not be read`);
724
824
  }
825
+ let unansweredWhySaid = false;
725
826
  for (const found of summary.findings.slice(0, 5)) {
726
827
  const title = summary.rules[found.rule]?.title ?? found.rule;
727
828
  const place = found.path ? ` (${found.line ? `${found.path}:${found.line}` : found.path})` : '';
728
829
  lines.push(` - ${(0, data_provider_1.plainAppLabel)(title, 160)}${place}`);
830
+ if (found.rule === UNANSWERED_CALL_RULE) {
831
+ // The title alone ("A call the platform cannot answer yet") does not say WHICH call, or that it fails every time.
832
+ // The finding's own message does, and the rule's `why` says what that means for the app. Both are the server's
833
+ // words, so the web screen says the same; both are drawn as plain one-line text.
834
+ const message = (0, data_provider_1.plainAppLabel)(found.message, 400);
835
+ if (message) {
836
+ lines.push(` ${message}`);
837
+ }
838
+ const why = (0, data_provider_1.plainAppLabel)(summary.rules[found.rule]?.why, 600);
839
+ if (why && !unansweredWhySaid) {
840
+ lines.push(` ${why}`);
841
+ unansweredWhySaid = true;
842
+ }
843
+ }
729
844
  }
730
845
  const more = summary.findings.length - 5 + summary.omitted;
731
846
  if (more > 0) {
@@ -804,7 +919,7 @@ const CONFLICT_WORDS = {
804
919
  forbidden: (refusal) => FORBIDDEN_REASON_WORDS[refusal.reason ?? ''] ?? 'You may not do this.',
805
920
  app_not_found: () => 'There is no such app that you can use. Check the id, or ask its owner to share it.',
806
921
  version_not_found: () => 'There is no such version of that app that you can use.',
807
- version_not_installable: (_refusal, bin) => `That version cannot be installed (it was withdrawn, replaced, or is a beta your update channel does not see). Name another with --version, or list them with \`${bin} apps versions\`.`,
922
+ version_not_installable: () => 'That version is not available for this action. If an install or version change was attempted, check the installation list for the same account and destination, then inspect its current state and data before deciding what to do next; do not retry blindly.',
808
923
  manifest_invalid: () => "That version's manifest is not one this platform will run, so it was not installed.",
809
924
  consent_mismatch: (_refusal, bin) => `The bundle you were shown is not the one on record for that version. Nothing was installed. Run \`${bin} apps disclosure\` again and approve what it shows.`,
810
925
  version_changed: (refusal, bin) => `The installation moved to another version while you were deciding${refusal.current ? ` (now ${refusal.current.versionId})` : ''}. Nothing was changed. Read \`${bin} apps disclosure\` again and approve what it shows.`,
@@ -812,7 +927,7 @@ const CONFLICT_WORDS = {
812
927
  binding_required: (refusal) => describeBindingRefusal(refusal),
813
928
  already_installed: (refusal, bin) => `That app is already installed on this agent${refusal.installationId ? ` (${refusal.installationId})` : ''}. Move it to a newer version with \`${bin} apps upgrade\`.`,
814
929
  not_found: () => 'There is no such installation that you can see.',
815
- changed: (_refusal, bin) => `The installation changed while this was running. Nothing was written. Read it again with \`${bin} apps installations show\` and retry.`,
930
+ changed: () => 'The installation changed while this was running. Read its current state before deciding what to do next.',
816
931
  not_auto_updatable: () => 'That installation does not update on its own.',
817
932
  data_deletion_not_confirmed: (refusal) => `Removing this app also deletes its data (${refusal.docCount ?? 'some'} document${refusal.docCount === 1 ? '' : 's'}), which is yours to confirm. Nothing was removed. Say it, with --delete-data, if you mean it.`,
818
933
  installation_incomplete: () => 'This installation points at a version that can no longer be read. It can be removed, not run.',
@@ -824,14 +939,17 @@ const CONFLICT_WORDS = {
824
939
  const issues = Array.isArray(refusal.issues)
825
940
  ? refusal.issues.length
826
941
  : 0;
827
- return `${issues > 0 ? `${issues} of this app's scheduled jobs have` : 'A scheduled job has'} a schedule that runs more often than allowed (at most once a minute) or cannot be read. Nothing was installed. Check it with \`${bin} apps check\`.`;
942
+ return `${issues > 0 ? `${issues} of this app's scheduled jobs have` : 'A scheduled job has'} a schedule or event target that cannot be used. Review the selected settings and declared targets; \`${bin} apps check\` checks the app package.`;
828
943
  },
829
944
  };
830
945
  /** The sentence for a refusal the server made on an installation call, or null for one that is not. */
831
- function describeInstallationConflict(refusal, bin) {
946
+ function describeInstallationConflict(refusal, bin, subject) {
832
947
  if (!(0, data_provider_1.isAppInstallationConflict)(refusal.error)) {
833
948
  return null;
834
949
  }
950
+ if (refusal.error === 'changed' && subject && /^appi_[A-Za-z0-9_-]{1,60}(?![\s\S])/.test(subject)) {
951
+ return `The installation changed while this was running. Read its current state with \`${bin} apps installations show ${subject}\` using the same account, deployment, profile and workspace before deciding what to do next.`;
952
+ }
835
953
  return CONFLICT_WORDS[refusal.error](refusal, bin);
836
954
  }
837
955
  /** The machine code of every installation refusal: `APP_<REASON>`. */
@@ -982,80 +1100,120 @@ function installationRefusalExit(conflict) {
982
1100
  /** Why a version that needs no new approval was still not applied by the opt-in, in a clause. */
983
1101
  const AUTO_APPLY_HOLD_WORDS = {
984
1102
  installation_suspended: 'the installation is paused',
985
- cut_by_another_person: "another person made it, and the opt-in is for your own agents' versions (apply it yourself if you trust it)",
1103
+ cut_by_another_person: "it was not made by the person who enabled automatic updates or their own agents (apply it yourself if you trust it)",
986
1104
  version_not_installable: 'the version was rejected or withdrawn',
987
1105
  principal_scope_unserved: 'it declares something this installation cannot serve',
988
1106
  };
1107
+ /** Names come from an app's version; show a bounded summary and keep the full disclosure as the review step. */
1108
+ function pendingReasonDetails(reason) {
1109
+ const fields = [
1110
+ ['capability', reason.key === undefined ? [] : [reason.key]],
1111
+ ['capabilities', reason.keys],
1112
+ ['items', reason.items],
1113
+ ['jobs', reason.jobIds],
1114
+ ];
1115
+ const lines = [];
1116
+ for (const [label, raw] of fields) {
1117
+ if (!Array.isArray(raw))
1118
+ continue;
1119
+ const values = raw.filter((value) => typeof value === 'string');
1120
+ const shown = values.slice(0, 8).map((value) => (0, data_provider_1.plainAppLabel)(value, 80) || '(unnamed)');
1121
+ if (shown.length === 0)
1122
+ continue;
1123
+ lines.push(`${label}: ${shown.join(', ')}${values.length > shown.length ? ` (+${values.length - shown.length} more)` : ''}`);
1124
+ }
1125
+ return lines;
1126
+ }
989
1127
  /**
990
- * What the versions view says, as lines a person reads: which version runs, what is waiting and what it needs, the opt-in
991
- * and where a rollback goes. `needs_reconsent` is said as "asks for more than you approved", never as a verdict on the
1128
+ * What the versions view says, as lines a person reads: which version is installed, what is waiting and what it needs,
1129
+ * the opt-in and the currently observed rollback target. `needs_reconsent` is said as "asks for more than you approved", never as a verdict on the
992
1130
  * version, and nothing here says an automatic check makes a version safe.
993
1131
  */
994
- function formatInstallationVersions(view, bin) {
1132
+ function formatInstallationVersions(view, bin, requestedInstallationId) {
1133
+ // The response is typed, not runtime-validated. Never copy response identifiers into shell
1134
+ // commands unless they match the requested installation and are safe as unquoted arguments.
1135
+ const safeId = (value) => typeof value === 'string' && /^[A-Za-z0-9_][A-Za-z0-9_-]{0,63}(?![\s\S])/.test(value);
1136
+ const safeVersion = (value) => Number.isSafeInteger(value) && Number(value) > 0;
1137
+ if (!view || !safeId(requestedInstallationId) || view.installationId !== requestedInstallationId ||
1138
+ !safeId(view.installationId) || !/^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}(?![\s\S])/.test(bin) ||
1139
+ !view.current || !safeId(view.current.versionId) || !safeVersion(view.current.version) ||
1140
+ typeof view.viewer?.canManage !== 'boolean' || typeof view.autoApply?.enabled !== 'boolean' ||
1141
+ !Array.isArray(view.history) ||
1142
+ (view.pending && (!safeId(view.pending.versionId) || !safeVersion(view.pending.version))) ||
1143
+ (view.rollback && (!safeId(view.rollback.versionId) || !safeVersion(view.rollback.version)))) {
1144
+ return null;
1145
+ }
995
1146
  const lines = [];
996
- lines.push(`${view.installationId} runs v${view.current.version} (${view.current.versionId})`);
1147
+ lines.push(`${view.installationId}: installed version v${view.current.version} (${view.current.versionId})`);
1148
+ lines.push(`For its current availability, run \`${bin} apps installations show ${view.installationId}\` using the same account, deployment, profile and workspace.`);
997
1149
  lines.push(view.autoApply.enabled
998
- ? "automatic updates: on (a new version that asks for nothing you haven't approved takes effect by itself)"
1150
+ ? 'automatic updates: on (eligible versions covered by your approval may be applied automatically; some can be held)'
999
1151
  : 'automatic updates: off (a new version waits for you to apply it)');
1000
1152
  if (!view.viewer.canManage) {
1001
- lines.push('You can see which version runs. Applying, going back and the history are for people who can edit this installation.');
1002
- return lines;
1153
+ lines.push('You can see which version is installed. Applying, going back and the history are for people who can edit this installation.');
1154
+ return lines.map(appData_1.safeForTerminal);
1003
1155
  }
1004
1156
  if (view.pending) {
1005
1157
  const pending = view.pending;
1006
1158
  lines.push(`waiting: v${pending.version} (${pending.versionId})${pending.changelog ? ` - ${(0, data_provider_1.plainAppLabel)(pending.changelog, 120)}` : ''}`);
1007
1159
  if (pending.status === 'needs_reconsent') {
1008
1160
  lines.push(' it asks for more than you approved, so it does not run until you approve it:');
1009
- for (const line of describeGrantReasons(pending.reasons.map((reason) => reason.kind))) {
1010
- lines.push(` ${line}`);
1161
+ for (const reason of pending.reasons) {
1162
+ for (const line of describeGrantReasons([reason.kind]))
1163
+ lines.push(` ${line}`);
1164
+ for (const line of pendingReasonDetails(reason))
1165
+ lines.push(` ${line}`);
1011
1166
  }
1012
- lines.push(` Review: \`${bin} apps disclosure ${pending.versionId} --installation ${view.installationId}\`; apply: \`${bin} apps upgrade ${view.installationId} --version ${pending.versionId}\`, then \`${bin} apps reconsent ${view.installationId} --yes\`.`);
1167
+ lines.push(` Review: \`${bin} apps disclosure ${pending.versionId} --installation ${view.installationId}\`; apply: \`${bin} apps upgrade ${view.installationId} --version ${pending.versionId} --expected-version ${view.current.versionId}\`, then review the current version with \`${bin} apps reconsent ${view.installationId}\`. A later --yes reads the then-current version and attempts to approve it.`);
1168
+ }
1169
+ else if (pending.status !== 'ready') {
1170
+ lines.push(' The status of this version is not understood by this CLI. Review it before taking action.');
1013
1171
  }
1014
1172
  else if (pending.heldBecause) {
1015
1173
  lines.push(` it asks for nothing new, but was not applied by itself: ${AUTO_APPLY_HOLD_WORDS[pending.heldBecause]}.`);
1016
- lines.push(` Apply it with \`${bin} apps upgrade ${view.installationId} --version ${pending.versionId}\`.`);
1174
+ lines.push(` Apply it with \`${bin} apps upgrade ${view.installationId} --version ${pending.versionId} --expected-version ${view.current.versionId}\`.`);
1017
1175
  }
1018
1176
  else {
1019
- lines.push(` it asks for nothing you haven't approved. Apply it with \`${bin} apps upgrade ${view.installationId} --version ${pending.versionId}\`${view.autoApply.enabled ? '' : `, or turn on automatic updates with \`${bin} apps auto-apply ${view.installationId} on\``}.`);
1177
+ lines.push(` it asks for nothing you haven't approved. Apply it with \`${bin} apps upgrade ${view.installationId} --version ${pending.versionId} --expected-version ${view.current.versionId}\`${view.autoApply.enabled ? '' : `, or turn on automatic updates with \`${bin} apps auto-apply ${view.installationId} on\``}.`);
1020
1178
  }
1021
1179
  }
1022
1180
  else {
1023
- lines.push('waiting: nothing (it runs the newest version)');
1181
+ lines.push('waiting: no newer version is shown as waiting; the installed version may still need approval.');
1024
1182
  }
1025
1183
  lines.push(view.rollback
1026
- ? `going back: v${view.rollback.version} (${view.rollback.versionId}) with \`${bin} apps rollback ${view.installationId}\``
1027
- : 'going back: nothing to go back to');
1184
+ ? `going back: the currently observed previous version is v${view.rollback.version} (${view.rollback.versionId}). Run \`${bin} apps rollback ${view.installationId} --expected-version ${view.current.versionId}\` to request a rollback. The server selects the target from its history when it handles the request; --expected-version checks the current version, not the target or history.`
1185
+ : 'going back: no rollback option is available right now');
1028
1186
  for (const move of view.history.slice(-5)) {
1029
1187
  lines.push(` ${move.at} ${move.cause}${move.by === 'policy' ? ' (by the platform, on your opt-in)' : ` (${move.by})`} ${move.from} -> ${move.to}`);
1030
1188
  }
1031
- return lines;
1189
+ return lines.map((line) => (0, appData_1.safeForTerminal)(line.slice(0, 4096)));
1032
1190
  }
1033
1191
  /** A diff between two versions, as lines: the capability and job changes first (they are what needs deciding), then the files. */
1034
1192
  function formatVersionDiff(diff) {
1035
1193
  const lines = [`v${diff.from.version} -> v${diff.to.version}`];
1036
1194
  for (const change of diff.capabilities) {
1037
1195
  for (const item of change.added)
1038
- lines.push(`+ ${change.key}: ${(0, data_provider_1.plainAppLabel)(item, 120)}`);
1196
+ lines.push(`+ ${(0, appData_1.safeForTerminal)(change.key)}: ${(0, data_provider_1.plainAppLabel)(item, 120)}`);
1039
1197
  for (const item of change.removed)
1040
- lines.push(`- ${change.key}: ${(0, data_provider_1.plainAppLabel)(item, 120)}`);
1198
+ lines.push(`- ${(0, appData_1.safeForTerminal)(change.key)}: ${(0, data_provider_1.plainAppLabel)(item, 120)}`);
1041
1199
  }
1042
1200
  for (const pair of diff.storeWriters.added)
1043
- lines.push(`+ who may write: ${pair}`);
1201
+ lines.push(`+ who may write: ${(0, appData_1.safeForTerminal)(pair)}`);
1044
1202
  for (const pair of diff.storeWriters.removed)
1045
- lines.push(`- who may write: ${pair}`);
1203
+ lines.push(`- who may write: ${(0, appData_1.safeForTerminal)(pair)}`);
1046
1204
  for (const job of diff.jobs.added)
1047
- lines.push(`+ job ${job.id}: ${(0, data_provider_1.plainAppLabel)(job.title, 80)} (${job.schedule ?? 'no schedule'})`);
1205
+ lines.push(`+ job ${(0, appData_1.safeForTerminal)(job.id)}: ${(0, data_provider_1.plainAppLabel)(job.title, 80)} (${(0, appData_1.safeForTerminal)(job.schedule ?? 'no schedule')})`);
1048
1206
  for (const job of diff.jobs.removed)
1049
- lines.push(`- job ${job.id}: ${(0, data_provider_1.plainAppLabel)(job.title, 80)}`);
1207
+ lines.push(`- job ${(0, appData_1.safeForTerminal)(job.id)}: ${(0, data_provider_1.plainAppLabel)(job.title, 80)}`);
1050
1208
  for (const job of diff.jobs.changed)
1051
- lines.push(`~ job ${job.id}: ${(0, data_provider_1.plainAppLabel)(job.title, 80)} changed (${(job.what ?? []).join(', ')})`);
1209
+ lines.push(`~ job ${(0, appData_1.safeForTerminal)(job.id)}: ${(0, data_provider_1.plainAppLabel)(job.title, 80)} changed (${(job.what ?? []).map(appData_1.safeForTerminal).join(', ')})`);
1052
1210
  for (const file of diff.files) {
1053
1211
  const counts = file.added === undefined ? '' : ` (+${file.added} -${file.removed})`;
1054
- lines.push(`${file.change} ${file.path}${counts}${file.omitted ? ` [lines not shown: ${file.omitted}]` : ''}`);
1212
+ lines.push(`${(0, appData_1.safeForTerminal)(file.change)} ${(0, appData_1.safeForTerminal)(file.path)}${counts}${file.omitted ? ` [lines not shown: ${(0, appData_1.safeForTerminal)(file.omitted)}]` : ''}`);
1055
1213
  for (const hunk of file.hunks ?? []) {
1056
1214
  lines.push(` @@ -${hunk.oldStart} +${hunk.newStart} @@`);
1057
1215
  for (const line of hunk.lines) {
1058
- lines.push(` ${line.op === 'add' ? '+' : line.op === 'remove' ? '-' : ' '}${line.text}`);
1216
+ lines.push(` ${line.op === 'add' ? '+' : line.op === 'remove' ? '-' : ' '}${(0, appData_1.safeForTerminal)(line.text)}${line.truncated === true ? ' [line shortened]' : ''}`);
1059
1217
  }
1060
1218
  }
1061
1219
  }
@@ -1,3 +1,5 @@
1
1
  import type { AppSettings, AppSettingsManifest } from '@skrr-ai/data-provider';
2
2
  export declare function readAppSettingsFile(file: string, manifest: AppSettingsManifest): AppSettings;
3
3
  export declare function formatAppSettings(manifest: AppSettingsManifest, settings: AppSettings, timezone?: string): string[];
4
+ /** Describe defaults without changing the settings sent to the server. The declaration is untrusted. */
5
+ export declare function formatInstallDefaults(configuration: unknown, settings?: AppSettings, source?: 'file' | 'saved'): string[];
@@ -35,8 +35,10 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.readAppSettingsFile = readAppSettingsFile;
37
37
  exports.formatAppSettings = formatAppSettings;
38
+ exports.formatInstallDefaults = formatInstallDefaults;
38
39
  const fs = __importStar(require("node:fs"));
39
40
  const data_provider_1 = require("@skrr-ai/data-provider");
41
+ const json_output_1 = require("./json-output");
40
42
  function readAppSettingsFile(file, manifest) {
41
43
  // Bound before reading: the UTF-8 file cannot exceed four bytes per permitted UTF-16 character.
42
44
  if (fs.statSync(file).size > data_provider_1.APP_SETTINGS_LIMITS.settingsJsonMaxChars * 4)
@@ -60,12 +62,43 @@ function formatAppSettings(manifest, settings, timezone = 'your account timezone
60
62
  .map((job) => `${(0, data_provider_1.plainAppLabel)(job.title)}: ${job.problem}`)
61
63
  .join('; '));
62
64
  return [
63
- `Settings: ${JSON.stringify(settings)}`,
64
- ...jobs.map((job) => `${(0, data_provider_1.plainAppLabel)(job.title)}: ${job.schedule} (${timezone})`),
65
+ `Settings: ${(0, json_output_1.escapeJsonForTerminal)(JSON.stringify(settings))}`,
66
+ ...jobs.map((job) => {
67
+ const schedule = job.schedule ?? '';
68
+ const zone = (0, data_provider_1.readAppJobSchedule)(schedule).kind === 'daily' ? ` (${(0, data_provider_1.plainAppLabel)(timezone)})` : '';
69
+ return `${(0, data_provider_1.plainAppLabel)(job.title)}: ${(0, data_provider_1.plainAppLabel)(schedule, 8192)}${zone}`;
70
+ }),
65
71
  ...(jobs.length
66
72
  ? [
67
- 'These jobs run under your existing installer authority and may use model/runtime quota. Saving explicitly approves these settings and schedules.',
73
+ 'This preview checks schedule format; it does not confirm whether these jobs can run.',
74
+ 'If these jobs run, they use your existing installer authority and may use model/runtime quota. Approval covers these settings and schedules; check job state after saving.',
68
75
  ]
69
76
  : []),
70
77
  ];
71
78
  }
79
+ /** Describe defaults without changing the settings sent to the server. The declaration is untrusted. */
80
+ function formatInstallDefaults(configuration, settings, source = 'file') {
81
+ if (configuration === undefined)
82
+ return ['Settings: the server did not include configuration details; this app may have none.'];
83
+ const parsed = data_provider_1.AppSettingsManifestSchema.safeParse(configuration);
84
+ if (!parsed.success)
85
+ return ['Settings: this CLI cannot read the configuration declaration.'];
86
+ const fields = (parsed.data.config?.fields ?? []).filter((field) => !settings || !Object.prototype.hasOwnProperty.call(settings, field.key) ||
87
+ (source === 'saved' && (0, data_provider_1.acceptedAppConfigValue)(field, settings[field.key]) === undefined));
88
+ const values = (0, data_provider_1.resolveAppConfigValues)(parsed.data, {});
89
+ const printable = (value) => (0, json_output_1.escapeJsonForTerminal)(JSON.stringify(value));
90
+ return [
91
+ ...(fields.length ? [settings
92
+ ? source === 'saved'
93
+ ? 'Fields without an accepted saved value (declared defaults where available):'
94
+ : 'Settings omitted from the file, using the current app defaults (not saved as explicit settings):'
95
+ : 'Settings, using the current app defaults (not saved as explicit settings):'] : []),
96
+ ...fields.map((field) => Object.prototype.hasOwnProperty.call(values, field.key)
97
+ ? ` ${(0, data_provider_1.plainAppLabel)(field.label)} (${field.key}): ${printable(values[field.key])}`
98
+ : ` ${(0, data_provider_1.plainAppLabel)(field.label)} (${field.key}): not set`),
99
+ ...(fields.length && !settings ? ['To choose different values, pass --settings-file with a JSON object before approving.'] : []),
100
+ ...(settings ? [] : (0, data_provider_1.appSettingsSchedulePreview)(parsed.data, {}).flatMap((job) => job.problem
101
+ ? [` ${(0, data_provider_1.plainAppLabel)(job.title)}: default schedule has a problem (${(0, data_provider_1.plainAppLabel)(job.problem)})`]
102
+ : [` ${(0, data_provider_1.plainAppLabel)(job.title)}: ${(0, data_provider_1.plainAppLabel)(job.schedule, 8192)} (using defaults; job availability not verified)`])),
103
+ ];
104
+ }