@skrr-ai/cli 0.1.161 → 0.1.163
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/base-command.d.ts +5 -2
- package/dist/base-command.js +96 -39
- package/dist/commands/activity/list.d.ts +7 -0
- package/dist/commands/activity/list.js +17 -0
- package/dist/commands/activity/scan-older.d.ts +2 -2
- package/dist/commands/activity/scan-older.js +6 -5
- package/dist/commands/activity/show.d.ts +0 -2
- package/dist/commands/activity/show.js +21 -42
- package/dist/commands/agents/always-on/release-run.d.ts +3 -3
- package/dist/commands/agents/always-on/release-run.js +5 -6
- package/dist/commands/agents/mini-computer/app/reset.d.ts +1 -0
- package/dist/commands/agents/mini-computer/app/reset.js +5 -2
- package/dist/commands/agents/mini-computer/app/set.js +1 -1
- package/dist/commands/agents/mini-computer/show.js +4 -2
- package/dist/commands/agents/mini-computer/tasks-view.js +2 -2
- package/dist/commands/agents/triggers/replay.js +1 -1
- package/dist/commands/agents/triggers/runs.d.ts +2 -3
- package/dist/commands/agents/triggers/runs.js +4 -5
- package/dist/commands/apps/auto-apply.js +31 -10
- package/dist/commands/apps/check.js +8 -0
- package/dist/commands/apps/data/batch.js +16 -5
- package/dist/commands/apps/data/collections.js +1 -1
- package/dist/commands/apps/data/delete.js +12 -4
- package/dist/commands/apps/data/patch.js +11 -4
- package/dist/commands/apps/data/put.js +13 -6
- package/dist/commands/apps/data/query.js +3 -3
- package/dist/commands/apps/install.js +24 -7
- package/dist/commands/apps/installations/events.d.ts +1 -0
- package/dist/commands/apps/installations/events.js +63 -10
- package/dist/commands/apps/installations/show.js +26 -5
- package/dist/commands/apps/installations/snapshot.js +1 -1
- package/dist/commands/apps/installations/versions.js +25 -9
- package/dist/commands/apps/logs.js +4 -1
- package/dist/commands/apps/push.js +10 -2
- package/dist/commands/apps/reconsent.js +7 -1
- package/dist/commands/apps/rollback.js +2 -2
- package/dist/commands/apps/settings/set.js +81 -4
- package/dist/commands/apps/settings/show.js +38 -7
- package/dist/commands/balance/usage/breakdown.d.ts +1 -1
- package/dist/commands/balance/usage/breakdown.js +4 -4
- package/dist/commands/balance/usage/events.d.ts +1 -1
- package/dist/commands/balance/usage/events.js +4 -4
- package/dist/commands/duties/status.js +20 -15
- package/dist/commands/goals/create.js +18 -1
- package/dist/commands/outbox/drop.js +21 -15
- package/dist/commands/outbox/list.d.ts +2 -1
- package/dist/commands/outbox/list.js +20 -11
- package/dist/commands/outbox/retry.d.ts +8 -11
- package/dist/commands/outbox/retry.js +135 -92
- package/dist/commands/spaces/create.js +1 -1
- package/dist/commands/tasks/comments/add.js +1 -1
- package/dist/commands/triggers/audit.js +3 -5
- package/dist/commands/triggers/fire-detail.js +7 -1
- package/dist/commands/triggers/preflight.js +15 -10
- package/dist/commands/triggers/replay.js +1 -1
- package/dist/commands/triggers/runs.d.ts +2 -4
- package/dist/commands/triggers/runs.js +3 -5
- package/dist/generated/agent-guides.json +19 -19
- package/dist/lib/agent-activity.d.ts +21 -1
- package/dist/lib/agent-activity.js +98 -29
- package/dist/lib/api-fetch.d.ts +2 -0
- package/dist/lib/api-fetch.js +5 -5
- package/dist/lib/appData.d.ts +43 -5
- package/dist/lib/appData.js +117 -25
- package/dist/lib/appInstallations.d.ts +5 -5
- package/dist/lib/appInstallations.js +211 -74
- package/dist/lib/appSettings.d.ts +2 -0
- package/dist/lib/appSettings.js +36 -3
- package/dist/lib/apps-command.d.ts +9 -0
- package/dist/lib/apps-command.js +191 -7
- package/dist/lib/appsCheck.js +29 -3
- package/dist/lib/appsFs.d.ts +1 -1
- package/dist/lib/balance.d.ts +5 -5
- package/dist/lib/balance.js +4 -4
- package/dist/lib/dedicated-power.js +4 -3
- package/dist/lib/json-output.d.ts +4 -0
- package/dist/lib/json-output.js +38 -0
- package/dist/lib/miniComputer.js +9 -2
- package/dist/lib/node-adapter.js +35 -2
- package/dist/lib/outbox.d.ts +20 -5
- package/dist/lib/outbox.js +233 -76
- package/dist/lib/rate-limit-retry.d.ts +3 -2
- package/dist/lib/rate-limit-retry.js +3 -2
- package/dist/lib/roles.d.ts +1 -1
- package/dist/lib/triggers.d.ts +3 -0
- package/dist/lib/triggers.js +10 -0
- package/dist/lib/widgetStaticScan.d.ts +3 -1
- package/dist/lib/widgetStaticScan.js +182 -47
- package/dist/node_modules/@skrr-ai/data-provider/index.js +10442 -9507
- package/oclif.manifest.json +138 -45
- package/package.json +4 -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;
|
|
77
|
-
workspace: '
|
|
78
|
-
self: '
|
|
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: '
|
|
87
|
+
reviewed: 'public or beta',
|
|
87
88
|
workspace: 'workspace',
|
|
88
|
-
self: '
|
|
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:
|
|
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.
|
|
137
|
-
*
|
|
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
|
-
|
|
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
|
|
143
|
-
agent: "only
|
|
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
|
-
: `
|
|
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: '
|
|
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
|
-
|
|
299
|
-
|
|
300
|
-
|
|
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
|
-
|
|
312
|
-
|
|
313
|
-
|
|
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
|
|
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
|
|
352
|
+
return `${history} [turned off by the platform: ${words}]`;
|
|
325
353
|
}
|
|
326
354
|
case 'removed_by_person':
|
|
327
|
-
return
|
|
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 (
|
|
334
|
-
return
|
|
368
|
+
if (!trigger && job.jobState?.state === 'scheduled') {
|
|
369
|
+
return ' [a previous scheduling check recorded scheduled; current trigger state not confirmed]';
|
|
335
370
|
}
|
|
336
|
-
if (
|
|
337
|
-
return
|
|
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) =>
|
|
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
|
|
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
|
|
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},
|
|
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
|
-
//
|
|
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
|
|
455
|
-
|
|
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(`
|
|
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,8 @@ 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
|
|
786
|
+
const REVIEW_LIMIT_REMINDER = 'This automatic check does not include a human review and cannot tell whether anyone else has reviewed the app.';
|
|
787
|
+
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
788
|
/**
|
|
699
789
|
* What the automatic check recorded for this version, in lines. It is never a verdict of "safe", and the three states
|
|
700
790
|
* a surface must keep apart are kept apart: a result, no result on record (the version predates the check), and a
|
|
@@ -716,8 +806,12 @@ function describeDisclosureCheck(check) {
|
|
|
716
806
|
}
|
|
717
807
|
const { summary } = check;
|
|
718
808
|
const { counts } = summary;
|
|
809
|
+
// Only the known headline is guaranteed to include the safety warning. Preserve it for any other record.
|
|
810
|
+
const safetyReminder = summary.limitations.headline === KNOWN_SAFETY_HEADLINE
|
|
811
|
+
? ''
|
|
812
|
+
: ' It does not establish that the app is safe.';
|
|
719
813
|
const lines = [
|
|
720
|
-
`Automatic check: ${CHECK_OUTCOME_WORDS[summary.outcome] ?? summary.outcome}. ${
|
|
814
|
+
`Automatic check: ${CHECK_OUTCOME_WORDS[summary.outcome] ?? summary.outcome}. ${REVIEW_LIMIT_REMINDER}${safetyReminder}`,
|
|
721
815
|
];
|
|
722
816
|
if (counts.block + counts.warn + counts.info + counts.unanalyzable > 0) {
|
|
723
817
|
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`);
|
|
@@ -804,7 +898,7 @@ const CONFLICT_WORDS = {
|
|
|
804
898
|
forbidden: (refusal) => FORBIDDEN_REASON_WORDS[refusal.reason ?? ''] ?? 'You may not do this.',
|
|
805
899
|
app_not_found: () => 'There is no such app that you can use. Check the id, or ask its owner to share it.',
|
|
806
900
|
version_not_found: () => 'There is no such version of that app that you can use.',
|
|
807
|
-
version_not_installable: (
|
|
901
|
+
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
902
|
manifest_invalid: () => "That version's manifest is not one this platform will run, so it was not installed.",
|
|
809
903
|
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
904
|
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 +906,7 @@ const CONFLICT_WORDS = {
|
|
|
812
906
|
binding_required: (refusal) => describeBindingRefusal(refusal),
|
|
813
907
|
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
908
|
not_found: () => 'There is no such installation that you can see.',
|
|
815
|
-
changed: (
|
|
909
|
+
changed: () => 'The installation changed while this was running. Read its current state before deciding what to do next.',
|
|
816
910
|
not_auto_updatable: () => 'That installation does not update on its own.',
|
|
817
911
|
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
912
|
installation_incomplete: () => 'This installation points at a version that can no longer be read. It can be removed, not run.',
|
|
@@ -824,14 +918,17 @@ const CONFLICT_WORDS = {
|
|
|
824
918
|
const issues = Array.isArray(refusal.issues)
|
|
825
919
|
? refusal.issues.length
|
|
826
920
|
: 0;
|
|
827
|
-
return `${issues > 0 ? `${issues} of this app's scheduled jobs have` : 'A scheduled job has'} a schedule
|
|
921
|
+
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
922
|
},
|
|
829
923
|
};
|
|
830
924
|
/** The sentence for a refusal the server made on an installation call, or null for one that is not. */
|
|
831
|
-
function describeInstallationConflict(refusal, bin) {
|
|
925
|
+
function describeInstallationConflict(refusal, bin, subject) {
|
|
832
926
|
if (!(0, data_provider_1.isAppInstallationConflict)(refusal.error)) {
|
|
833
927
|
return null;
|
|
834
928
|
}
|
|
929
|
+
if (refusal.error === 'changed' && subject && /^appi_[A-Za-z0-9_-]{1,60}(?![\s\S])/.test(subject)) {
|
|
930
|
+
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.`;
|
|
931
|
+
}
|
|
835
932
|
return CONFLICT_WORDS[refusal.error](refusal, bin);
|
|
836
933
|
}
|
|
837
934
|
/** The machine code of every installation refusal: `APP_<REASON>`. */
|
|
@@ -982,80 +1079,120 @@ function installationRefusalExit(conflict) {
|
|
|
982
1079
|
/** Why a version that needs no new approval was still not applied by the opt-in, in a clause. */
|
|
983
1080
|
const AUTO_APPLY_HOLD_WORDS = {
|
|
984
1081
|
installation_suspended: 'the installation is paused',
|
|
985
|
-
cut_by_another_person: "
|
|
1082
|
+
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
1083
|
version_not_installable: 'the version was rejected or withdrawn',
|
|
987
1084
|
principal_scope_unserved: 'it declares something this installation cannot serve',
|
|
988
1085
|
};
|
|
1086
|
+
/** Names come from an app's version; show a bounded summary and keep the full disclosure as the review step. */
|
|
1087
|
+
function pendingReasonDetails(reason) {
|
|
1088
|
+
const fields = [
|
|
1089
|
+
['capability', reason.key === undefined ? [] : [reason.key]],
|
|
1090
|
+
['capabilities', reason.keys],
|
|
1091
|
+
['items', reason.items],
|
|
1092
|
+
['jobs', reason.jobIds],
|
|
1093
|
+
];
|
|
1094
|
+
const lines = [];
|
|
1095
|
+
for (const [label, raw] of fields) {
|
|
1096
|
+
if (!Array.isArray(raw))
|
|
1097
|
+
continue;
|
|
1098
|
+
const values = raw.filter((value) => typeof value === 'string');
|
|
1099
|
+
const shown = values.slice(0, 8).map((value) => (0, data_provider_1.plainAppLabel)(value, 80) || '(unnamed)');
|
|
1100
|
+
if (shown.length === 0)
|
|
1101
|
+
continue;
|
|
1102
|
+
lines.push(`${label}: ${shown.join(', ')}${values.length > shown.length ? ` (+${values.length - shown.length} more)` : ''}`);
|
|
1103
|
+
}
|
|
1104
|
+
return lines;
|
|
1105
|
+
}
|
|
989
1106
|
/**
|
|
990
|
-
* What the versions view says, as lines a person reads: which version
|
|
991
|
-
* and
|
|
1107
|
+
* What the versions view says, as lines a person reads: which version is installed, what is waiting and what it needs,
|
|
1108
|
+
* 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
1109
|
* version, and nothing here says an automatic check makes a version safe.
|
|
993
1110
|
*/
|
|
994
|
-
function formatInstallationVersions(view, bin) {
|
|
1111
|
+
function formatInstallationVersions(view, bin, requestedInstallationId) {
|
|
1112
|
+
// The response is typed, not runtime-validated. Never copy response identifiers into shell
|
|
1113
|
+
// commands unless they match the requested installation and are safe as unquoted arguments.
|
|
1114
|
+
const safeId = (value) => typeof value === 'string' && /^[A-Za-z0-9_][A-Za-z0-9_-]{0,63}(?![\s\S])/.test(value);
|
|
1115
|
+
const safeVersion = (value) => Number.isSafeInteger(value) && Number(value) > 0;
|
|
1116
|
+
if (!view || !safeId(requestedInstallationId) || view.installationId !== requestedInstallationId ||
|
|
1117
|
+
!safeId(view.installationId) || !/^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}(?![\s\S])/.test(bin) ||
|
|
1118
|
+
!view.current || !safeId(view.current.versionId) || !safeVersion(view.current.version) ||
|
|
1119
|
+
typeof view.viewer?.canManage !== 'boolean' || typeof view.autoApply?.enabled !== 'boolean' ||
|
|
1120
|
+
!Array.isArray(view.history) ||
|
|
1121
|
+
(view.pending && (!safeId(view.pending.versionId) || !safeVersion(view.pending.version))) ||
|
|
1122
|
+
(view.rollback && (!safeId(view.rollback.versionId) || !safeVersion(view.rollback.version)))) {
|
|
1123
|
+
return null;
|
|
1124
|
+
}
|
|
995
1125
|
const lines = [];
|
|
996
|
-
lines.push(`${view.installationId}
|
|
1126
|
+
lines.push(`${view.installationId}: installed version v${view.current.version} (${view.current.versionId})`);
|
|
1127
|
+
lines.push(`For its current availability, run \`${bin} apps installations show ${view.installationId}\` using the same account, deployment, profile and workspace.`);
|
|
997
1128
|
lines.push(view.autoApply.enabled
|
|
998
|
-
?
|
|
1129
|
+
? 'automatic updates: on (eligible versions covered by your approval may be applied automatically; some can be held)'
|
|
999
1130
|
: 'automatic updates: off (a new version waits for you to apply it)');
|
|
1000
1131
|
if (!view.viewer.canManage) {
|
|
1001
|
-
lines.push('You can see which version
|
|
1002
|
-
return lines;
|
|
1132
|
+
lines.push('You can see which version is installed. Applying, going back and the history are for people who can edit this installation.');
|
|
1133
|
+
return lines.map(appData_1.safeForTerminal);
|
|
1003
1134
|
}
|
|
1004
1135
|
if (view.pending) {
|
|
1005
1136
|
const pending = view.pending;
|
|
1006
1137
|
lines.push(`waiting: v${pending.version} (${pending.versionId})${pending.changelog ? ` - ${(0, data_provider_1.plainAppLabel)(pending.changelog, 120)}` : ''}`);
|
|
1007
1138
|
if (pending.status === 'needs_reconsent') {
|
|
1008
1139
|
lines.push(' it asks for more than you approved, so it does not run until you approve it:');
|
|
1009
|
-
for (const
|
|
1010
|
-
|
|
1140
|
+
for (const reason of pending.reasons) {
|
|
1141
|
+
for (const line of describeGrantReasons([reason.kind]))
|
|
1142
|
+
lines.push(` ${line}`);
|
|
1143
|
+
for (const line of pendingReasonDetails(reason))
|
|
1144
|
+
lines.push(` ${line}`);
|
|
1011
1145
|
}
|
|
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
|
|
1146
|
+
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.`);
|
|
1147
|
+
}
|
|
1148
|
+
else if (pending.status !== 'ready') {
|
|
1149
|
+
lines.push(' The status of this version is not understood by this CLI. Review it before taking action.');
|
|
1013
1150
|
}
|
|
1014
1151
|
else if (pending.heldBecause) {
|
|
1015
1152
|
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}\`.`);
|
|
1153
|
+
lines.push(` Apply it with \`${bin} apps upgrade ${view.installationId} --version ${pending.versionId} --expected-version ${view.current.versionId}\`.`);
|
|
1017
1154
|
}
|
|
1018
1155
|
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\``}.`);
|
|
1156
|
+
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
1157
|
}
|
|
1021
1158
|
}
|
|
1022
1159
|
else {
|
|
1023
|
-
lines.push('waiting:
|
|
1160
|
+
lines.push('waiting: no newer version is shown as waiting; the installed version may still need approval.');
|
|
1024
1161
|
}
|
|
1025
1162
|
lines.push(view.rollback
|
|
1026
|
-
? `going back: v${view.rollback.version} (${view.rollback.versionId})
|
|
1027
|
-
: 'going back:
|
|
1163
|
+
? `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.`
|
|
1164
|
+
: 'going back: no rollback option is available right now');
|
|
1028
1165
|
for (const move of view.history.slice(-5)) {
|
|
1029
1166
|
lines.push(` ${move.at} ${move.cause}${move.by === 'policy' ? ' (by the platform, on your opt-in)' : ` (${move.by})`} ${move.from} -> ${move.to}`);
|
|
1030
1167
|
}
|
|
1031
|
-
return lines;
|
|
1168
|
+
return lines.map((line) => (0, appData_1.safeForTerminal)(line.slice(0, 4096)));
|
|
1032
1169
|
}
|
|
1033
1170
|
/** A diff between two versions, as lines: the capability and job changes first (they are what needs deciding), then the files. */
|
|
1034
1171
|
function formatVersionDiff(diff) {
|
|
1035
1172
|
const lines = [`v${diff.from.version} -> v${diff.to.version}`];
|
|
1036
1173
|
for (const change of diff.capabilities) {
|
|
1037
1174
|
for (const item of change.added)
|
|
1038
|
-
lines.push(`+ ${change.key}: ${(0, data_provider_1.plainAppLabel)(item, 120)}`);
|
|
1175
|
+
lines.push(`+ ${(0, appData_1.safeForTerminal)(change.key)}: ${(0, data_provider_1.plainAppLabel)(item, 120)}`);
|
|
1039
1176
|
for (const item of change.removed)
|
|
1040
|
-
lines.push(`- ${change.key}: ${(0, data_provider_1.plainAppLabel)(item, 120)}`);
|
|
1177
|
+
lines.push(`- ${(0, appData_1.safeForTerminal)(change.key)}: ${(0, data_provider_1.plainAppLabel)(item, 120)}`);
|
|
1041
1178
|
}
|
|
1042
1179
|
for (const pair of diff.storeWriters.added)
|
|
1043
|
-
lines.push(`+ who may write: ${pair}`);
|
|
1180
|
+
lines.push(`+ who may write: ${(0, appData_1.safeForTerminal)(pair)}`);
|
|
1044
1181
|
for (const pair of diff.storeWriters.removed)
|
|
1045
|
-
lines.push(`- who may write: ${pair}`);
|
|
1182
|
+
lines.push(`- who may write: ${(0, appData_1.safeForTerminal)(pair)}`);
|
|
1046
1183
|
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'})`);
|
|
1184
|
+
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
1185
|
for (const job of diff.jobs.removed)
|
|
1049
|
-
lines.push(`- job ${job.id}: ${(0, data_provider_1.plainAppLabel)(job.title, 80)}`);
|
|
1186
|
+
lines.push(`- job ${(0, appData_1.safeForTerminal)(job.id)}: ${(0, data_provider_1.plainAppLabel)(job.title, 80)}`);
|
|
1050
1187
|
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(', ')})`);
|
|
1188
|
+
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
1189
|
for (const file of diff.files) {
|
|
1053
1190
|
const counts = file.added === undefined ? '' : ` (+${file.added} -${file.removed})`;
|
|
1054
|
-
lines.push(`${file.change} ${file.path}${counts}${file.omitted ? ` [lines not shown: ${file.omitted}]` : ''}`);
|
|
1191
|
+
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
1192
|
for (const hunk of file.hunks ?? []) {
|
|
1056
1193
|
lines.push(` @@ -${hunk.oldStart} +${hunk.newStart} @@`);
|
|
1057
1194
|
for (const line of hunk.lines) {
|
|
1058
|
-
lines.push(` ${line.op === 'add' ? '+' : line.op === 'remove' ? '-' : ' '}${line.text}`);
|
|
1195
|
+
lines.push(` ${line.op === 'add' ? '+' : line.op === 'remove' ? '-' : ' '}${(0, appData_1.safeForTerminal)(line.text)}${line.truncated === true ? ' [line shortened]' : ''}`);
|
|
1059
1196
|
}
|
|
1060
1197
|
}
|
|
1061
1198
|
}
|
|
@@ -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[];
|
package/dist/lib/appSettings.js
CHANGED
|
@@ -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) =>
|
|
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
|
-
'
|
|
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
|
+
}
|
|
@@ -9,6 +9,8 @@ import { BaseCommand } from '../base-command';
|
|
|
9
9
|
* know (forbidden, not found, the server being down) are the base command's to say.
|
|
10
10
|
*/
|
|
11
11
|
export declare abstract class AppsCommand extends BaseCommand {
|
|
12
|
+
/** A successful response was already received; do not turn a synchronous output failure into a request failure. */
|
|
13
|
+
protected failConfirmedDataOutput(): never;
|
|
12
14
|
/** The id of the app the person named (an id or a slug). */
|
|
13
15
|
protected appId(ref: string): Promise<string>;
|
|
14
16
|
/**
|
|
@@ -31,6 +33,13 @@ export declare abstract class AppsCommand extends BaseCommand {
|
|
|
31
33
|
collection: string;
|
|
32
34
|
id?: string;
|
|
33
35
|
verb?: 'put' | 'patch' | 'delete' | 'batch';
|
|
36
|
+
operation?: 'query';
|
|
37
|
+
requestStarted?: boolean;
|
|
38
|
+
batchHasGeneratedIds?: boolean;
|
|
39
|
+
batchTargets?: Array<{
|
|
40
|
+
collection?: unknown;
|
|
41
|
+
id?: unknown;
|
|
42
|
+
}>;
|
|
34
43
|
}): never;
|
|
35
44
|
/**
|
|
36
45
|
* Say what went wrong with a REPORT: the refusals only a report makes (a reason the Store does not take, a
|