@skrr-ai/cli 0.1.145 → 0.1.147
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.js +38 -21
- package/dist/commands/agenda/plan.d.ts +14 -0
- package/dist/commands/agenda/plan.js +29 -0
- package/dist/commands/agent/message/approve.js +5 -1
- package/dist/commands/agent/message/decline.js +5 -1
- package/dist/commands/agent/message/send.d.ts +11 -0
- package/dist/commands/agent/message/send.js +34 -8
- package/dist/commands/agent-worker.js +2 -1
- package/dist/commands/agents/activity.js +2 -1
- package/dist/commands/agents/always-on/enable.js +1 -1
- package/dist/commands/agents/badge.js +10 -5
- package/dist/commands/agents/categories/index.js +2 -1
- package/dist/commands/agents/chat.d.ts +1 -0
- package/dist/commands/agents/chat.js +29 -1
- package/dist/commands/agents/create.js +4 -1
- package/dist/commands/agents/overview.js +2 -1
- package/dist/commands/agents/releases/create.js +2 -1
- package/dist/commands/agents/schedule-overview.js +12 -11
- package/dist/commands/agents/schedule.js +2 -1
- package/dist/commands/agents/spawn.d.ts +38 -1
- package/dist/commands/agents/spawn.js +112 -9
- package/dist/commands/agents/tools/auth.js +2 -1
- package/dist/commands/agents/tools/calls.js +2 -1
- package/dist/commands/agents/triggers/fire.js +20 -0
- package/dist/commands/agents/visibility.js +2 -1
- package/dist/commands/balance/show.js +17 -2
- package/dist/commands/balance/statement.js +2 -1
- package/dist/commands/commands.js +2 -1
- package/dist/commands/commitments/create.js +2 -1
- package/dist/commands/commitments/delivery.js +2 -1
- package/dist/commands/commitments/doctor.js +2 -1
- package/dist/commands/commitments/observations.js +2 -2
- package/dist/commands/commitments/operating-review.js +2 -1
- package/dist/commands/commitments/pack/preflight.js +2 -1
- package/dist/commands/commitments/trigger-status.js +2 -1
- package/dist/commands/convos/messages.js +2 -1
- package/dist/commands/daemon/logs.js +18 -9
- package/dist/commands/daemon/usage.js +2 -1
- package/dist/commands/dm/messages.js +2 -1
- package/dist/commands/dm/thread/messages.js +2 -1
- package/dist/commands/dm/threads.js +2 -1
- package/dist/commands/doctor.js +2 -1
- package/dist/commands/goals/key-results/assess.js +2 -1
- package/dist/commands/goals/key-results/history.js +2 -1
- package/dist/commands/harnesses/forget.js +2 -1
- package/dist/commands/harnesses/show.js +12 -6
- package/dist/commands/inbox/index.js +4 -3
- package/dist/commands/initiatives/decide.js +2 -1
- package/dist/commands/instructions/diff.js +2 -1
- package/dist/commands/instructions/show.js +2 -1
- package/dist/commands/login.js +4 -2
- package/dist/commands/machines/dedicated/cp.js +2 -1
- package/dist/commands/machines/dedicated/power/set.js +2 -1
- package/dist/commands/machines/show.js +2 -1
- package/dist/commands/memory/maintain.js +2 -1
- package/dist/commands/memory/read.js +2 -1
- package/dist/commands/memory/rebuild-index.js +2 -1
- package/dist/commands/memory/rebuild.js +2 -1
- package/dist/commands/memory/search.js +2 -1
- package/dist/commands/messages/list.js +2 -1
- package/dist/commands/revoke-daemon.js +2 -1
- package/dist/commands/revoke-token.js +2 -1
- package/dist/commands/search/all.js +14 -7
- package/dist/commands/search/workspace.js +2 -1
- package/dist/commands/set-capabilities.js +2 -1
- package/dist/commands/skills/browse.js +8 -2
- package/dist/commands/spaces/auto-executor/preview.js +3 -2
- package/dist/commands/spaces/auto-executor/runs.js +4 -1
- package/dist/commands/spaces/workflow-templates/extract.d.ts +1 -0
- package/dist/commands/spaces/workflow-templates/extract.js +9 -1
- package/dist/commands/spaces/workflows/events.js +6 -3
- package/dist/commands/spaces/workflows/run.js +5 -3
- package/dist/commands/spaces/workflows/update.js +2 -1
- package/dist/commands/store/gallery-admissions/preview.js +2 -1
- package/dist/commands/store/publishers/profile/handle.js +2 -1
- package/dist/commands/tasks/comments/anchor.js +23 -9
- package/dist/commands/tasks/complete.js +4 -2
- package/dist/commands/tasks/create-tree.js +7 -3
- package/dist/commands/tasks/create.js +2 -1
- package/dist/commands/tasks/deliverable/add.js +2 -1
- package/dist/commands/tasks/deliverable/archive.js +2 -1
- package/dist/commands/tasks/deliverable/list.js +2 -1
- package/dist/commands/tasks/expectations/assess.js +2 -1
- package/dist/commands/tasks/labels/create.js +2 -1
- package/dist/commands/tasks/preflight.js +4 -2
- package/dist/commands/tasks/ready.js +2 -1
- package/dist/commands/tasks/result/submit.js +2 -1
- package/dist/commands/tasks/updates/add.js +2 -1
- package/dist/commands/tasks/wait.js +2 -1
- package/dist/commands/token/list.js +2 -1
- package/dist/commands/token/mint.js +2 -1
- package/dist/commands/triggers/audit.js +1 -1
- package/dist/commands/triggers/fire.js +19 -0
- package/dist/commands/wiki/write.js +14 -7
- package/dist/hooks/command-not-found.js +2 -1
- package/dist/lib/agent-chat-start.d.ts +77 -0
- package/dist/lib/agent-chat-start.js +169 -0
- package/dist/lib/agent-config.js +2 -1
- package/dist/lib/agent-endpoints.js +4 -2
- package/dist/lib/agent-evals.js +2 -1
- package/dist/lib/agent-guide-reference-gate.js +22 -11
- package/dist/lib/agent-guides.js +4 -1
- package/dist/lib/agent-instructions.js +5 -1
- package/dist/lib/agent-ref.js +8 -4
- package/dist/lib/agent-trigger-listing.js +2 -1
- package/dist/lib/agentic-stream.d.ts +21 -0
- package/dist/lib/agentic-stream.js +75 -6
- package/dist/lib/api-error-reason.js +2 -1
- package/dist/lib/api-fetch.js +5 -3
- package/dist/lib/appData.js +6 -6
- package/dist/lib/appInstallations.js +10 -5
- package/dist/lib/appsCheck.js +2 -1
- package/dist/lib/auth-failure.js +2 -1
- package/dist/lib/auth-storage.js +2 -1
- package/dist/lib/balance.js +6 -3
- package/dist/lib/capability-matrix.js +4 -2
- package/dist/lib/cli-runtime.js +2 -1
- package/dist/lib/code-handover.js +8 -3
- package/dist/lib/command-hygiene.js +28 -12
- package/dist/lib/command-manifest.js +6 -3
- package/dist/lib/commitment-attention-copy.js +2 -1
- package/dist/lib/commitment-event-wakes.js +9 -0
- package/dist/lib/commitment-product.js +5 -3
- package/dist/lib/commitment-terms.js +2 -1
- package/dist/lib/commitments.d.ts +8 -0
- package/dist/lib/commitments.js +8 -4
- package/dist/lib/compasses.js +2 -1
- package/dist/lib/completion-index.js +2 -1
- package/dist/lib/computer-files.js +8 -6
- package/dist/lib/config.js +11 -5
- package/dist/lib/conversation-search.js +4 -2
- package/dist/lib/daemon-installer.js +6 -2
- package/dist/lib/daemon-maintenance.js +2 -1
- package/dist/lib/daemon-ref.js +2 -1
- package/dist/lib/daemonBroker.js +6 -3
- package/dist/lib/daemonBrokerRefusal.js +4 -2
- package/dist/lib/daemonHandoff.js +14 -7
- package/dist/lib/daemonIslandProfile.js +2 -1
- package/dist/lib/dedicated-copy.js +9 -3
- package/dist/lib/dedicated-exec.js +2 -1
- package/dist/lib/dedicated-keep-awake.js +2 -1
- package/dist/lib/dedicated-machines.js +9 -5
- package/dist/lib/dedicated-service.js +2 -1
- package/dist/lib/dedicated-ssh.js +5 -3
- package/dist/lib/deployed-build.js +2 -1
- package/dist/lib/device-code.js +4 -3
- package/dist/lib/dpop-auth.js +2 -1
- package/dist/lib/earnings.js +2 -1
- package/dist/lib/exec-runtime-binary.js +5 -3
- package/dist/lib/first-party-harness-broker.js +4 -3
- package/dist/lib/first-party-harness-managed.js +2 -1
- package/dist/lib/first-party-harness-startup-update.js +8 -4
- package/dist/lib/first-party-harness-update.js +2 -1
- package/dist/lib/first-party-harness.js +2 -1
- package/dist/lib/format.d.ts +5 -0
- package/dist/lib/format.js +24 -4
- package/dist/lib/git-task.js +10 -5
- package/dist/lib/github-tools.js +6 -3
- package/dist/lib/harnesses.js +4 -2
- package/dist/lib/hosted-machines.js +2 -1
- package/dist/lib/html-text.js +33 -16
- package/dist/lib/instruction-blocks.js +2 -1
- package/dist/lib/iso-instant.js +5 -3
- package/dist/lib/keychain.js +15 -5
- package/dist/lib/label-scope.js +2 -1
- package/dist/lib/live-runtime-binary.js +10 -7
- package/dist/lib/local-skills.js +10 -6
- package/dist/lib/login.js +3 -2
- package/dist/lib/machine-audit.js +2 -1
- package/dist/lib/machine-daemon-log.js +2 -1
- package/dist/lib/machine-services.js +2 -1
- package/dist/lib/memory-history-session.js +2 -1
- package/dist/lib/memory-sync.js +6 -2
- package/dist/lib/message-intent.d.ts +10 -0
- package/dist/lib/node-adapter.js +4 -2
- package/dist/lib/northstars.js +4 -2
- package/dist/lib/oauthLogin.js +16 -7
- package/dist/lib/open-target.js +8 -4
- package/dist/lib/option-hint.js +2 -4
- package/dist/lib/outbox.js +2 -1
- package/dist/lib/planOutcome.d.ts +5 -3
- package/dist/lib/planOutcome.js +7 -4
- package/dist/lib/platform-update-local.js +2 -3
- package/dist/lib/proactiveApi.d.ts +38 -1
- package/dist/lib/proactiveApi.js +17 -1
- package/dist/lib/rate-limit-retry.js +2 -1
- package/dist/lib/reflection.js +2 -1
- package/dist/lib/request-field-flags.js +2 -1
- package/dist/lib/runtime-start-verification.js +2 -1
- package/dist/lib/schedule.d.ts +15 -0
- package/dist/lib/schedule.js +16 -1
- package/dist/lib/scoped-memory-command.js +7 -3
- package/dist/lib/search-display.js +11 -4
- package/dist/lib/skill-store-pagination.js +2 -1
- package/dist/lib/space-notebook.js +5 -3
- package/dist/lib/store-listing.js +2 -1
- package/dist/lib/task-agent-context-capabilities.js +2 -1
- package/dist/lib/task-asset-upload.js +7 -3
- package/dist/lib/task-closure.js +2 -1
- package/dist/lib/task-economics.js +2 -1
- package/dist/lib/task-execution.js +16 -8
- package/dist/lib/task-extras.js +4 -2
- package/dist/lib/task-operation-watch.js +2 -1
- package/dist/lib/task-preflight.js +3 -2
- package/dist/lib/task-recurrence-summary.js +4 -2
- package/dist/lib/task-runtime-headers.js +10 -5
- package/dist/lib/task-transcript.js +3 -2
- package/dist/lib/task-transfer.js +9 -5
- package/dist/lib/tasks.js +2 -1
- package/dist/lib/triggers.d.ts +144 -3
- package/dist/lib/triggers.js +280 -23
- package/dist/lib/update-check.js +12 -7
- package/dist/lib/usage-discovery.js +2 -1
- package/dist/lib/usd-micros.js +2 -1
- package/dist/lib/web-url.js +2 -1
- package/dist/lib/widgetCheck.js +15 -9
- package/dist/lib/widgetStaticScan.js +26 -14
- package/dist/lib/workflow-run-view.js +5 -3
- package/dist/lib/workflow-templates.d.ts +10 -0
- package/dist/lib/workflow-templates.js +47 -0
- package/dist/lib/write-target.js +4 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/authHelper.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/commitmentExecutionContract.js +22 -12
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerUse.js +4 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelope.js +7 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.js +6 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonConsentProof.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonPair.js +16 -7
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +4 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/desktopDaemonProof.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/desktopWire.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.js +11 -7
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceKey.js +7 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/dpop.js +8 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarness.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessChannels.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessUpdater.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/githubPushRefusal.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/guidedUpdate.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/independentMachineReservation.js +8 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/kek/macos.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/liveState.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/loginWithLocalhost.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/loopbackHttp.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/machineUuid.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profileStateDir.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/recoveryCode.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.js +3 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releasePolicy.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releaseVersions.js +6 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/restartArtifact.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/spawnEnv.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/telemetryRedaction.js +7 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/authHelper.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/commitmentExecutionContract.js +27 -18
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerUse.js +6 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelope.js +11 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.js +6 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonConsentProof.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonPair.js +20 -8
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +5 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/desktopDaemonProof.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/desktopWire.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.js +11 -7
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceKey.js +11 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/dpop.js +12 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarness.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessChannels.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessUpdater.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/githubPushRefusal.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/guidedUpdate.js +5 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/independentMachineReservation.js +10 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/kek/macos.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/liveState.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/loginWithLocalhost.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/loopbackHttp.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/machineUuid.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profileStateDir.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/recoveryCode.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.js +3 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releasePolicy.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releaseVersions.js +6 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/restartArtifact.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/spawnEnv.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/telemetryRedaction.js +11 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +20520 -20130
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/loopback-server.js +4 -2
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.js +10 -6
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/loopback-server.js +4 -2
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.js +10 -6
- package/dist/node_modules/@skrr-ai/inference-broker/package.json +1 -1
- package/oclif.manifest.json +24 -2
- package/package.json +1 -1
|
@@ -14,6 +14,7 @@ const triggers_1 = require("../../lib/triggers");
|
|
|
14
14
|
const schedule_1 = require("../../lib/schedule");
|
|
15
15
|
const planOutcome_1 = require("../../lib/planOutcome");
|
|
16
16
|
const reflection_1 = require("../../lib/reflection");
|
|
17
|
+
const COLLECT_ERRORS_RE = /R$/;
|
|
17
18
|
/** Board statuses that mean "still open / not done" for the tasks section. */
|
|
18
19
|
const OPEN_TASK_STATUSES = new Set(['backlog', 'todo', 'in_progress', 'in_review', 'blocked']);
|
|
19
20
|
/**
|
|
@@ -109,19 +110,19 @@ class AgentsScheduleOverview extends base_command_1.BaseCommand {
|
|
|
109
110
|
if (note)
|
|
110
111
|
this.log(note);
|
|
111
112
|
}
|
|
112
|
-
// FUTURE.
|
|
113
|
+
// FUTURE. One named zone for every time below, as `agents upcoming` does (OSK-22643).
|
|
113
114
|
this.log('');
|
|
114
|
-
this.log(`■ Upcoming (next ${flags['horizon-days']}d)`);
|
|
115
|
+
this.log(`■ Upcoming (next ${flags['horizon-days']}d, times in ${(0, schedule_1.describeTimeZone)(todayZone)})`);
|
|
115
116
|
reportError(upcomingR, (line) => this.log(` ${line}`));
|
|
116
117
|
if (upcoming.length === 0) {
|
|
117
118
|
this.log(' Nothing upcoming.');
|
|
118
119
|
}
|
|
119
120
|
else {
|
|
120
121
|
(0, format_1.renderTable)(upcoming.map((item) => ({
|
|
121
|
-
when: formatStamp(item.fireAt),
|
|
122
|
+
when: formatStamp(item.fireAt, todayZone),
|
|
122
123
|
kind: item.kind,
|
|
123
|
-
title: titleOf(item),
|
|
124
|
-
detail: detailOf(item),
|
|
124
|
+
title: (0, format_1.localizeIsoInstants)(titleOf(item), todayZone),
|
|
125
|
+
detail: (0, format_1.localizeIsoInstants)(detailOf(item), todayZone),
|
|
125
126
|
})), [
|
|
126
127
|
{ key: 'when', header: 'WHEN', maxWidth: 26 },
|
|
127
128
|
{ key: 'kind', header: 'KIND', maxWidth: 14 },
|
|
@@ -162,7 +163,7 @@ class AgentsScheduleOverview extends base_command_1.BaseCommand {
|
|
|
162
163
|
this.log('');
|
|
163
164
|
this.log('■ Recent fires');
|
|
164
165
|
reportError(firesR, (line) => this.log(` ${line}`));
|
|
165
|
-
(0, triggers_1.renderFireAudit)(fires, (line) => this.log(line));
|
|
166
|
+
(0, triggers_1.renderFireAudit)(fires, (line) => this.log(line), undefined, { timeZone: todayZone });
|
|
166
167
|
// Open tasks assigned to this agent.
|
|
167
168
|
this.log('');
|
|
168
169
|
this.log('■ Open tasks (assigned to this agent)');
|
|
@@ -175,7 +176,7 @@ class AgentsScheduleOverview extends base_command_1.BaseCommand {
|
|
|
175
176
|
ref: String(t.identifier ?? (t.taskNumber ? `#${t.taskNumber}` : '-')),
|
|
176
177
|
title: String(t.title ?? '-'),
|
|
177
178
|
status: String(t.status ?? '-'),
|
|
178
|
-
when: t.scheduledFor ? formatStamp(String(t.scheduledFor)) : '-',
|
|
179
|
+
when: t.scheduledFor ? formatStamp(String(t.scheduledFor), todayZone) : '-',
|
|
179
180
|
id: String(t.id ?? t._id ?? '-'),
|
|
180
181
|
})), [
|
|
181
182
|
{ key: 'ref', header: 'REF' },
|
|
@@ -284,16 +285,16 @@ function collectErrors(results) {
|
|
|
284
285
|
for (const [key, result] of Object.entries(results)) {
|
|
285
286
|
if (result.status === 'rejected') {
|
|
286
287
|
const reason = result.reason;
|
|
287
|
-
errors[key.replace(
|
|
288
|
+
errors[key.replace(COLLECT_ERRORS_RE, '')] =
|
|
289
|
+
reason instanceof Error ? reason.message : String(reason);
|
|
288
290
|
}
|
|
289
291
|
}
|
|
290
292
|
return Object.keys(errors).length > 0 ? errors : undefined;
|
|
291
293
|
}
|
|
292
|
-
function formatStamp(iso) {
|
|
294
|
+
function formatStamp(iso, zone) {
|
|
293
295
|
if (!iso)
|
|
294
296
|
return '-';
|
|
295
|
-
|
|
296
|
-
return Number.isNaN(d.getTime()) ? iso : d.toISOString();
|
|
297
|
+
return (0, format_1.zonedTime)(iso, zone, { seconds: false });
|
|
297
298
|
}
|
|
298
299
|
function titleOf(item) {
|
|
299
300
|
if (item.kind === 'message')
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
4
|
const base_command_1 = require("../../base-command");
|
|
5
5
|
const triggers_1 = require("../../lib/triggers");
|
|
6
|
+
const DERIVE_LABEL_RE = /\s+/g;
|
|
6
7
|
/**
|
|
7
8
|
* `skrr agents schedule <agent-id>` — the one-liner for the most common agent
|
|
8
9
|
* automation: "run this agent on a cron" or "run it once at a time", sending a
|
|
@@ -150,6 +151,6 @@ class AgentsSchedule extends base_command_1.BaseCommand {
|
|
|
150
151
|
exports.default = AgentsSchedule;
|
|
151
152
|
/** Derive a short label from the prompt when the caller doesn't supply one. */
|
|
152
153
|
function deriveLabel(prompt) {
|
|
153
|
-
const trimmed = prompt.trim().replace(
|
|
154
|
+
const trimmed = prompt.trim().replace(DERIVE_LABEL_RE, ' ');
|
|
154
155
|
return trimmed.length <= 60 ? trimmed : `${trimmed.slice(0, 57)}...`;
|
|
155
156
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseCommand } from '../../base-command';
|
|
2
|
-
import { type InstallPlanItem, type ProactiveAgentSpec, type ApplyProactiveAgentResponse } from '../../lib/proactiveApi';
|
|
2
|
+
import { type InstallPlanItem, type SpawnOperation, type ProactiveAgentSpec, type ApplyProactiveAgentResponse } from '../../lib/proactiveApi';
|
|
3
3
|
export type ProactiveInstallReadiness = {
|
|
4
4
|
status: 'ready' | 'degraded';
|
|
5
5
|
message: string;
|
|
@@ -57,6 +57,35 @@ export declare const SPEC_FORMAT_HELP: string;
|
|
|
57
57
|
* visible as what is.
|
|
58
58
|
*/
|
|
59
59
|
export declare function installPlanLines(items: InstallPlanItem[], bin: string): string[];
|
|
60
|
+
export declare const SPAWN_FOLLOW_POLL_MS = 3000;
|
|
61
|
+
/** Longer than an install has taken; past it the CLI says where to read the receipt instead. */
|
|
62
|
+
export declare const SPAWN_FOLLOW_MAX_WAIT_MS: number;
|
|
63
|
+
export type SpawnFollowOutcome = {
|
|
64
|
+
kind: 'done';
|
|
65
|
+
result: NonNullable<SpawnOperation['result']>;
|
|
66
|
+
} | {
|
|
67
|
+
kind: 'failed';
|
|
68
|
+
message: string;
|
|
69
|
+
code?: string;
|
|
70
|
+
} | {
|
|
71
|
+
kind: 'quiet';
|
|
72
|
+
} | {
|
|
73
|
+
kind: 'timeout';
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Follow a spawn the server answered 202 for until it reports a receipt or a failure. The install is
|
|
77
|
+
* not cut short by the edge's 60 s any more, but its receipt used to be lost with the 504 (OSK-22623).
|
|
78
|
+
* A read that fails (a 5xx, the network) is waited through; a 4xx other than "not yet" is the answer.
|
|
79
|
+
*/
|
|
80
|
+
export declare function followSpawnOperation(options: {
|
|
81
|
+
operationId: string;
|
|
82
|
+
read?: (operationId: string) => Promise<SpawnOperation | undefined>;
|
|
83
|
+
sleep?: (ms: number) => Promise<void>;
|
|
84
|
+
now?: () => number;
|
|
85
|
+
pollMs?: number;
|
|
86
|
+
maxWaitMs?: number;
|
|
87
|
+
onWaiting?: (elapsedMs: number) => void;
|
|
88
|
+
}): Promise<SpawnFollowOutcome>;
|
|
60
89
|
/** What `--minimal` / `--without` say when the server cannot honour them. */
|
|
61
90
|
export declare const DECLINE_UNSUPPORTED_MESSAGE = "This server does not support --minimal/--without yet; nothing was opted out.";
|
|
62
91
|
/** A value as one POSIX shell word, so a printed command can be pasted as it is. */
|
|
@@ -104,6 +133,7 @@ export default class AgentsSpawn extends BaseCommand {
|
|
|
104
133
|
'apply-recommendation': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
105
134
|
'spec-hash': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
106
135
|
'from-spec': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
136
|
+
follow: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
107
137
|
'print-spec-template': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
108
138
|
minimal: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
109
139
|
without: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -122,6 +152,13 @@ export default class AgentsSpawn extends BaseCommand {
|
|
|
122
152
|
*/
|
|
123
153
|
private readInstallPlan;
|
|
124
154
|
private printInstallPlan;
|
|
155
|
+
/**
|
|
156
|
+
* An apply answer in hand: a receipt passes through; a `202` is followed to its receipt. An install
|
|
157
|
+
* takes longer than the edge allows, and the CLI used to print a 504 for one that completed with its
|
|
158
|
+
* receipt lost (OSK-22623).
|
|
159
|
+
*/
|
|
160
|
+
private resolveApplyAnswer;
|
|
161
|
+
private followToReceipt;
|
|
125
162
|
/**
|
|
126
163
|
* Refuse BEFORE creating anything when `--minimal` / `--without` were asked for and this server
|
|
127
164
|
* cannot honour them. A server that predates the options ignores them, applies every default and
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DECLINE_UNSUPPORTED_MESSAGE = exports.SPEC_FORMAT_HELP = exports.SPEC_TEMPLATE = void 0;
|
|
3
|
+
exports.DECLINE_UNSUPPORTED_MESSAGE = exports.SPAWN_FOLLOW_MAX_WAIT_MS = exports.SPAWN_FOLLOW_POLL_MS = exports.SPEC_FORMAT_HELP = exports.SPEC_TEMPLATE = void 0;
|
|
4
4
|
exports.workerPolicyWindowLines = workerPolicyWindowLines;
|
|
5
5
|
exports.specWithEffectiveWindowFlags = specWithEffectiveWindowFlags;
|
|
6
6
|
exports.installPlanLines = installPlanLines;
|
|
7
|
+
exports.followSpawnOperation = followSpawnOperation;
|
|
7
8
|
exports.shellQuote = shellQuote;
|
|
8
9
|
exports.initializeSummary = initializeSummary;
|
|
9
10
|
exports.proactiveInstallReadiness = proactiveInstallReadiness;
|
|
@@ -14,6 +15,8 @@ const format_1 = require("../../lib/format");
|
|
|
14
15
|
const http_error_1 = require("../../lib/http-error");
|
|
15
16
|
const web_url_1 = require("../../lib/web-url");
|
|
16
17
|
const proactiveApi_1 = require("../../lib/proactiveApi");
|
|
18
|
+
const SHELL_QUOTE_RE = /'/g;
|
|
19
|
+
const PROACTIVE_INSTALL_READINESS_RE = /^[A-Za-z0-9_-]+$/;
|
|
17
20
|
function workerPolicyWindowLines(policy) {
|
|
18
21
|
const lines = [];
|
|
19
22
|
for (const [label, window] of [
|
|
@@ -117,11 +120,52 @@ function installPlanLines(items, bin) {
|
|
|
117
120
|
}
|
|
118
121
|
return lines;
|
|
119
122
|
}
|
|
123
|
+
exports.SPAWN_FOLLOW_POLL_MS = 3_000;
|
|
124
|
+
/** Longer than an install has taken; past it the CLI says where to read the receipt instead. */
|
|
125
|
+
exports.SPAWN_FOLLOW_MAX_WAIT_MS = 10 * 60 * 1000;
|
|
126
|
+
/**
|
|
127
|
+
* Follow a spawn the server answered 202 for until it reports a receipt or a failure. The install is
|
|
128
|
+
* not cut short by the edge's 60 s any more, but its receipt used to be lost with the 504 (OSK-22623).
|
|
129
|
+
* A read that fails (a 5xx, the network) is waited through; a 4xx other than "not yet" is the answer.
|
|
130
|
+
*/
|
|
131
|
+
async function followSpawnOperation(options) {
|
|
132
|
+
const { operationId, read = async (id) => (await proactiveApi_1.proactiveApi.spawnOperation(id)).operation, sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)), now = Date.now, pollMs = exports.SPAWN_FOLLOW_POLL_MS, maxWaitMs = exports.SPAWN_FOLLOW_MAX_WAIT_MS, onWaiting, } = options;
|
|
133
|
+
const startedAt = now();
|
|
134
|
+
for (;;) {
|
|
135
|
+
let operation;
|
|
136
|
+
try {
|
|
137
|
+
operation = await read(operationId);
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
const status = (0, http_error_1.httpStatusOf)(error);
|
|
141
|
+
if (status !== undefined && status < 500)
|
|
142
|
+
throw error;
|
|
143
|
+
}
|
|
144
|
+
if (operation?.state === 'succeeded' && operation.result) {
|
|
145
|
+
return { kind: 'done', result: operation.result };
|
|
146
|
+
}
|
|
147
|
+
if (operation?.state === 'failed') {
|
|
148
|
+
const body = operation.failure?.body;
|
|
149
|
+
return {
|
|
150
|
+
kind: 'failed',
|
|
151
|
+
message: body?.error || body?.message || 'The install failed.',
|
|
152
|
+
...(body?.code ? { code: body.code } : {}),
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
if (operation?.state === 'unknown')
|
|
156
|
+
return { kind: 'quiet' };
|
|
157
|
+
const elapsed = now() - startedAt;
|
|
158
|
+
if (elapsed >= maxWaitMs)
|
|
159
|
+
return { kind: 'timeout' };
|
|
160
|
+
onWaiting?.(elapsed);
|
|
161
|
+
await sleep(pollMs);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
120
164
|
/** What `--minimal` / `--without` say when the server cannot honour them. */
|
|
121
165
|
exports.DECLINE_UNSUPPORTED_MESSAGE = 'This server does not support --minimal/--without yet; nothing was opted out.';
|
|
122
166
|
/** A value as one POSIX shell word, so a printed command can be pasted as it is. */
|
|
123
167
|
function shellQuote(value) {
|
|
124
|
-
return `'${value.replace(
|
|
168
|
+
return `'${value.replace(SHELL_QUOTE_RE, `'\\''`)}'`;
|
|
125
169
|
}
|
|
126
170
|
/**
|
|
127
171
|
* One line for the goals, tasks and jobs a spec seeded. The text receipt printed
|
|
@@ -157,7 +201,7 @@ function proactiveInstallReadiness(result, bin) {
|
|
|
157
201
|
// READY describes setup, not what the Agent does next. A new Agent with Always-On on starts its
|
|
158
202
|
// first runs in the background, and one that fails shows up in the operating review, not here:
|
|
159
203
|
// a spawned Agent read READY while its first run had already failed (OSK-22359).
|
|
160
|
-
const safeAgent =
|
|
204
|
+
const safeAgent = PROACTIVE_INSTALL_READINESS_RE.test(result.agentId) ? result.agentId : null;
|
|
161
205
|
const firstRuns = result.installed.alwaysOn?.desiredEnabled === true && safeAgent;
|
|
162
206
|
return {
|
|
163
207
|
status: 'ready',
|
|
@@ -180,9 +224,8 @@ function proactiveInstallReadiness(result, bin) {
|
|
|
180
224
|
'Change its title and apply the spec again if you want it back.',
|
|
181
225
|
};
|
|
182
226
|
}
|
|
183
|
-
const ids = [...new Set(affected.map((commitment) => commitment.id))]
|
|
184
|
-
|
|
185
|
-
const safeAgentId = /^[A-Za-z0-9_-]+$/.test(result.agentId) ? result.agentId : null;
|
|
227
|
+
const ids = [...new Set(affected.map((commitment) => commitment.id))].filter((id) => typeof id === 'string' && PROACTIVE_INSTALL_READINESS_RE.test(id));
|
|
228
|
+
const safeAgentId = PROACTIVE_INSTALL_READINESS_RE.test(result.agentId) ? result.agentId : null;
|
|
186
229
|
// Always-On was still starting when setup finished, so the only thing that
|
|
187
230
|
// stopped activation was a gate that clears by itself. Say so and name the
|
|
188
231
|
// command that finishes the job; `commitments preflight` is a dry run that
|
|
@@ -201,6 +244,21 @@ function proactiveInstallReadiness(result, bin) {
|
|
|
201
244
|
: `${bin} commitments list --agent ${safeAgentId ?? '<agent-id>'} --status draft`,
|
|
202
245
|
};
|
|
203
246
|
}
|
|
247
|
+
// A draft held only because Always-On is off names that gate in its `blockedBy` (no activation
|
|
248
|
+
// diagnostic exists, since nothing refused it). The repair is turning Always-On on, not a dry
|
|
249
|
+
// run; `commitments preflight` told the owner so one step later (OSK-22629).
|
|
250
|
+
const heldByAlwaysOff = affected.length > 0 &&
|
|
251
|
+
affected.every((commitment) => commitment.status === 'draft' &&
|
|
252
|
+
(commitment.blockedBy || []).some((entry) => entry.gate === 'always_on' && entry.reason === 'always_on_disabled'));
|
|
253
|
+
if (heldByAlwaysOff && safeAgentId && ids.length) {
|
|
254
|
+
return {
|
|
255
|
+
status: 'degraded',
|
|
256
|
+
message: `Always-On is off, so the Commitment${ids.length === 1 ? '' : 's'} ${ids.join(', ')} ` +
|
|
257
|
+
`${ids.length === 1 ? 'was' : 'were'} left as ${ids.length === 1 ? 'a draft' : 'drafts'}. ` +
|
|
258
|
+
'Turn Always-On on if you want it to run, then resume it.',
|
|
259
|
+
repairCommand: `${bin} agents always-on enable ${safeAgentId}`,
|
|
260
|
+
};
|
|
261
|
+
}
|
|
204
262
|
return {
|
|
205
263
|
status: 'degraded',
|
|
206
264
|
message: ids.length
|
|
@@ -242,7 +300,9 @@ function proactiveInstallReadiness(result, bin) {
|
|
|
242
300
|
const provisioningOnly = result.warnings.length > 0 &&
|
|
243
301
|
result.warnings.every((warning) => warning.code === 'proactive_provisioning_incomplete');
|
|
244
302
|
if (provisioningOnly) {
|
|
245
|
-
const inspectAgent =
|
|
303
|
+
const inspectAgent = PROACTIVE_INSTALL_READINESS_RE.test(result.agentId)
|
|
304
|
+
? result.agentId
|
|
305
|
+
: null;
|
|
246
306
|
return {
|
|
247
307
|
status: 'degraded',
|
|
248
308
|
message: 'What the spec asked for is installed. Part of the new Agent\u2019s own setup did not finish; ' +
|
|
@@ -328,6 +388,9 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
328
388
|
'from-spec': core_1.Flags.string({
|
|
329
389
|
description: 'Path to a spec JSON (or "-" for stdin) to apply directly (requires --approve). Its shape is under SPEC FORMAT below; --print-spec-template prints a valid one. An explicit empty systems list skips implicit baseline watchers.',
|
|
330
390
|
}),
|
|
391
|
+
follow: core_1.Flags.string({
|
|
392
|
+
description: 'Read the receipt of an install that outlived its request, by the operation id the 202 named, and exit',
|
|
393
|
+
}),
|
|
331
394
|
'print-spec-template': core_1.Flags.boolean({
|
|
332
395
|
description: 'Print a valid spec JSON to edit and pass to --from-spec, and exit (creates nothing)',
|
|
333
396
|
}),
|
|
@@ -359,6 +422,16 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
359
422
|
return;
|
|
360
423
|
}
|
|
361
424
|
this.requireAuth();
|
|
425
|
+
if (flags.follow) {
|
|
426
|
+
try {
|
|
427
|
+
const result = await this.followToReceipt(flags.follow);
|
|
428
|
+
this.renderApplyResult(result, flags.json, false);
|
|
429
|
+
}
|
|
430
|
+
catch (err) {
|
|
431
|
+
this.handleApiError(err);
|
|
432
|
+
}
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
362
435
|
// A recommendation is approved and applied as reviewed, with no way to decline a default;
|
|
363
436
|
// refusing here is better than a --minimal that silently installs everything.
|
|
364
437
|
if ((flags.minimal || (flags.without ?? []).length > 0) &&
|
|
@@ -427,6 +500,34 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
427
500
|
for (const line of installPlanLines(items, this.config.bin))
|
|
428
501
|
this.log(line);
|
|
429
502
|
}
|
|
503
|
+
/**
|
|
504
|
+
* An apply answer in hand: a receipt passes through; a `202` is followed to its receipt. An install
|
|
505
|
+
* takes longer than the edge allows, and the CLI used to print a 504 for one that completed with its
|
|
506
|
+
* receipt lost (OSK-22623).
|
|
507
|
+
*/
|
|
508
|
+
async resolveApplyAnswer(answer) {
|
|
509
|
+
if (!(0, proactiveApi_1.isSpawnAccepted)(answer))
|
|
510
|
+
return answer;
|
|
511
|
+
process.stderr.write(`The install is running on the server (operation ${answer.operation.id}); waiting for its receipt...\n`);
|
|
512
|
+
return this.followToReceipt(answer.operation.id);
|
|
513
|
+
}
|
|
514
|
+
async followToReceipt(operationId) {
|
|
515
|
+
const outcome = await followSpawnOperation({ operationId });
|
|
516
|
+
if (outcome.kind === 'done')
|
|
517
|
+
return outcome.result;
|
|
518
|
+
const again = `${this.config.bin} agents spawn --follow ${operationId}`;
|
|
519
|
+
if (outcome.kind === 'failed') {
|
|
520
|
+
return this.error(`The install failed: ${outcome.message}${outcome.code ? ` (${outcome.code})` : ''}`, {
|
|
521
|
+
exit: 1,
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
if (outcome.kind === 'quiet') {
|
|
525
|
+
return this.error(`The server no longer reports on this install (operation ${operationId}); it may have been interrupted. ` +
|
|
526
|
+
`Check what exists with \`${this.config.bin} agents list\`; applying the same spec with --agent-id converges it.`, { exit: 1 });
|
|
527
|
+
}
|
|
528
|
+
return this.error(`The install is still running after ${Math.round(exports.SPAWN_FOLLOW_MAX_WAIT_MS / 60000)} minutes. ` +
|
|
529
|
+
`It was not cut short; read its receipt with \`${again}\`.`, { exit: 1 });
|
|
530
|
+
}
|
|
430
531
|
/**
|
|
431
532
|
* Refuse BEFORE creating anything when `--minimal` / `--without` were asked for and this server
|
|
432
533
|
* cannot honour them. A server that predates the options ignores them, applies every default and
|
|
@@ -483,13 +584,14 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
483
584
|
return;
|
|
484
585
|
}
|
|
485
586
|
await this.assertServerDeclinesDefaults(spec, flags, true);
|
|
486
|
-
const
|
|
587
|
+
const applied = await proactiveApi_1.proactiveApi.applyProactiveAgentSpec({
|
|
487
588
|
spec,
|
|
488
589
|
...(flags['agent-id'] ? { agentId: flags['agent-id'] } : {}),
|
|
489
590
|
...(flags.timezone ? { timezone: flags.timezone } : {}),
|
|
490
591
|
fromReviewedSpec: true,
|
|
491
592
|
...this.declineOptions(flags),
|
|
492
593
|
});
|
|
594
|
+
const result = await this.resolveApplyAnswer(applied);
|
|
493
595
|
this.renderApplyResult(result, flags.json, Boolean(flags['agent-id']));
|
|
494
596
|
this.assertDeclinesApplied(result, flags);
|
|
495
597
|
}
|
|
@@ -574,13 +676,14 @@ class AgentsSpawn extends base_command_1.BaseCommand {
|
|
|
574
676
|
return;
|
|
575
677
|
}
|
|
576
678
|
await this.assertServerDeclinesDefaults(spec, flags, false);
|
|
577
|
-
const
|
|
679
|
+
const applied = await proactiveApi_1.proactiveApi.applyProactiveAgentSpec({
|
|
578
680
|
spec,
|
|
579
681
|
...(flags['agent-id'] ? { agentId: flags['agent-id'] } : {}),
|
|
580
682
|
...(flags.timezone ? { timezone: flags.timezone } : {}),
|
|
581
683
|
fromReviewedSpec: false,
|
|
582
684
|
...this.declineOptions(flags),
|
|
583
685
|
});
|
|
686
|
+
const result = await this.resolveApplyAnswer(applied);
|
|
584
687
|
this.renderApplyResult(result, flags.json, Boolean(flags['agent-id']));
|
|
585
688
|
this.assertDeclinesApplied(result, flags);
|
|
586
689
|
}
|
|
@@ -5,13 +5,14 @@ const core_1 = require("@oclif/core");
|
|
|
5
5
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
6
6
|
const base_command_1 = require("../../../base-command");
|
|
7
7
|
const html_text_1 = require("../../../lib/html-text");
|
|
8
|
+
const CREDENTIAL_HELP_TEXT_RE = /<a\s[^>]*href=['"]([^'"]+)['"][^>]*>(.*?)<\/a>/gi;
|
|
8
9
|
/**
|
|
9
10
|
* A credential's help text for a terminal. Plugin manifests write it as HTML
|
|
10
11
|
* with the signup link in an anchor; stripping the tags alone would keep
|
|
11
12
|
* "see Our Docs" and drop the URL, which is the part worth printing.
|
|
12
13
|
*/
|
|
13
14
|
function credentialHelpText(description) {
|
|
14
|
-
return (0, html_text_1.htmlToDisplayText)(description.replace(
|
|
15
|
+
return (0, html_text_1.htmlToDisplayText)(description.replace(CREDENTIAL_HELP_TEXT_RE, '$2 ($1)'));
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* Whether this account has credentials for one tool.
|
|
@@ -5,13 +5,14 @@ const core_1 = require("@oclif/core");
|
|
|
5
5
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
6
6
|
const base_command_1 = require("../../../base-command");
|
|
7
7
|
const format_1 = require("../../../lib/format");
|
|
8
|
+
const CLIP_RE = /\s+/g;
|
|
8
9
|
const clip = (value, width) => {
|
|
9
10
|
const text = value == null
|
|
10
11
|
? ''
|
|
11
12
|
: typeof value === 'string'
|
|
12
13
|
? value
|
|
13
14
|
: (JSON.stringify(value) ?? String(value));
|
|
14
|
-
const flat = text.replace(
|
|
15
|
+
const flat = text.replace(CLIP_RE, ' ').trim();
|
|
15
16
|
return flat.length > width ? `${flat.slice(0, width - 1)}…` : flat;
|
|
16
17
|
};
|
|
17
18
|
/**
|
|
@@ -50,6 +50,26 @@ class AgentsTriggersFire extends base_command_1.BaseCommand {
|
|
|
50
50
|
this.error(err.message, { exit: 4 });
|
|
51
51
|
this.handleApiError(err);
|
|
52
52
|
}
|
|
53
|
+
// A watcher fire can run for minutes; the server answers 202 with the occurrence once it has
|
|
54
|
+
// outlived a short wait, and the result is followed here (OSK-22624).
|
|
55
|
+
const settled = await (0, triggers_1.settleFireAnswer)({
|
|
56
|
+
triggerId: args.triggerId,
|
|
57
|
+
agentId: args.agentId,
|
|
58
|
+
bin: this.config.bin,
|
|
59
|
+
answer: result,
|
|
60
|
+
note: (line) => process.stderr.write(`${line}\n`),
|
|
61
|
+
});
|
|
62
|
+
if (settled.running) {
|
|
63
|
+
if (flags.json) {
|
|
64
|
+
this.printJsonResult({ ...settled.answer, ok: true });
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
this.log(`Fire accepted and still running (occurrence ${settled.answer.occurrenceId ?? '-'}).`);
|
|
68
|
+
this.log(`Read its result later: ${settled.command}`);
|
|
69
|
+
}
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
result = settled.result;
|
|
53
73
|
const refused = flags.strict && !(0, triggers_1.fireWasAccepted)(result);
|
|
54
74
|
const refusal = refused ? (0, triggers_1.describeStrictFireRefusal)(result) : null;
|
|
55
75
|
if (flags.json) {
|
|
@@ -10,6 +10,7 @@ const node_fs_1 = require("node:fs");
|
|
|
10
10
|
const core_1 = require("@oclif/core");
|
|
11
11
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
12
12
|
const base_command_1 = require("../../base-command");
|
|
13
|
+
const PARSE_RELEASE_DEPENDENCIES_RE = /^(skill|action):([^@]+)@(store_release_[A-Za-z0-9_-]+)$/;
|
|
13
14
|
/**
|
|
14
15
|
* `--capability-rationale <permission-key>=<note>` → the publisher notes a
|
|
15
16
|
* release carries beside its capability manifest. Split on the FIRST `=`, so a
|
|
@@ -39,7 +40,7 @@ function parseReleaseDependencies(entries) {
|
|
|
39
40
|
return {};
|
|
40
41
|
const dependencies = [];
|
|
41
42
|
for (const entry of entries) {
|
|
42
|
-
const match =
|
|
43
|
+
const match = PARSE_RELEASE_DEPENDENCIES_RE.exec(entry);
|
|
43
44
|
if (!match) {
|
|
44
45
|
return {
|
|
45
46
|
error: `--dependency expects skill:<id>@<store-release-id> or action:<id>@<store-release-id>, got "${entry}".`,
|
|
@@ -68,6 +68,14 @@ function renderSessionBillingAccount(target, balance, log, bin = 'skrr') {
|
|
|
68
68
|
else {
|
|
69
69
|
for (const line of (0, balance_1.workspaceBalanceLines)(balance))
|
|
70
70
|
log(line);
|
|
71
|
+
// The workspace view is the one that decides whether a session can start, and it printed
|
|
72
|
+
// Held with no account of it at all. Held is reservations, not spend: a running agent turn
|
|
73
|
+
// reserves its maximum cost up front, and one that ended unsettled stays held (OSK-22651).
|
|
74
|
+
if (balance.heldMicros > 0) {
|
|
75
|
+
log(' Held is reserved for hosted sessions, including turns that ended without settling; ' +
|
|
76
|
+
`\`${bin} balance statement --workspace ${target.workspaceId}\` lists the \`hold\` and ` +
|
|
77
|
+
'`exception` entries.');
|
|
78
|
+
}
|
|
71
79
|
if (balance.availableMicros <= 0) {
|
|
72
80
|
log(' WARNING: nothing available — managed sessions billed here are refused for credit, ' +
|
|
73
81
|
'whatever your personal balance below says.');
|
|
@@ -224,8 +232,15 @@ class BalanceShow extends base_command_1.BaseCommand {
|
|
|
224
232
|
// printed in dollars only, so it read as a different quantity from the
|
|
225
233
|
// Credits above it (OSK-4827).
|
|
226
234
|
this.log(` Held: ${(0, balance_1.formatCreditsWithUsd)(balance.heldMicros)}`);
|
|
227
|
-
|
|
228
|
-
|
|
235
|
+
// Not all of it is "in flight". A running hosted agent turn reserves its maximum cost
|
|
236
|
+
// up front and settles for what it used; one that ends without settling expires into an
|
|
237
|
+
// `exception` and stays held until billing releases it (OSK-22651). Saying "in flight"
|
|
238
|
+
// for all of it made a frozen reservation read as a session that was still running.
|
|
239
|
+
this.log(' (reserved for hosted sessions: a running agent turn reserves');
|
|
240
|
+
this.log(' its maximum cost up front and settles for what it used; one');
|
|
241
|
+
this.log(' that ends without settling stays held until billing releases');
|
|
242
|
+
this.log(' it. See the `hold` and `exception` entries in');
|
|
243
|
+
this.log(' `skrr balance statement`)');
|
|
229
244
|
}
|
|
230
245
|
if (balance.balanceSource === 'legacy') {
|
|
231
246
|
// The unified account is missing for this user, so the figure above is
|
|
@@ -11,6 +11,7 @@ const base_command_1 = require("../../base-command");
|
|
|
11
11
|
const format_1 = require("../../lib/format");
|
|
12
12
|
const harness_provider_input_1 = require("../../lib/harness-provider-input");
|
|
13
13
|
const balance_1 = require("../../lib/balance");
|
|
14
|
+
const IS_OWNER_ONLY_REFUSAL_RE = /owner/i;
|
|
14
15
|
/**
|
|
15
16
|
* The canonical stored-value ledger — what a charge was FOR, and what incurred it.
|
|
16
17
|
*
|
|
@@ -289,7 +290,7 @@ function isOwnerOnlyRefusal(err) {
|
|
|
289
290
|
return false;
|
|
290
291
|
try {
|
|
291
292
|
const body = JSON.parse(e.body ?? '');
|
|
292
|
-
return typeof body.error === 'string' &&
|
|
293
|
+
return typeof body.error === 'string' && IS_OWNER_ONLY_REFUSAL_RE.test(body.error);
|
|
293
294
|
}
|
|
294
295
|
catch {
|
|
295
296
|
return false;
|
|
@@ -4,6 +4,7 @@ const core_1 = require("@oclif/core");
|
|
|
4
4
|
const base_command_1 = require("../base-command");
|
|
5
5
|
const command_manifest_1 = require("../lib/command-manifest");
|
|
6
6
|
const command_hygiene_1 = require("../lib/command-hygiene");
|
|
7
|
+
const RUN_RE = /:/g;
|
|
7
8
|
class Commands extends base_command_1.BaseCommand {
|
|
8
9
|
static description = 'List skrr commands or print a machine-readable command schema';
|
|
9
10
|
static examples = [
|
|
@@ -101,7 +102,7 @@ class Commands extends base_command_1.BaseCommand {
|
|
|
101
102
|
}
|
|
102
103
|
const payload = {
|
|
103
104
|
id: key,
|
|
104
|
-
command: key.replace(
|
|
105
|
+
command: key.replace(RUN_RE, ' '),
|
|
105
106
|
description: command.description ?? '',
|
|
106
107
|
aliases: command.aliases ?? [],
|
|
107
108
|
args: command.args ?? {},
|
|
@@ -15,6 +15,7 @@ const commitment_attention_copy_1 = require("../../lib/commitment-attention-copy
|
|
|
15
15
|
const triggers_1 = require("../../lib/triggers");
|
|
16
16
|
const commitment_product_1 = require("../../lib/commitment-product");
|
|
17
17
|
const commitments_1 = require("../../lib/commitments");
|
|
18
|
+
const COMMITMENT_ACTIVATION_REFUSAL_RE = /^[A-Za-z][A-Za-z0-9_]*$/;
|
|
18
19
|
const DEFAULT_EVENT_DRIVEN_BACKSTOP_MS = 24 * 60 * 60 * 1000;
|
|
19
20
|
const DEFAULT_EVENT_SOURCES = new Set(['github', 'slack', 'email', 'calendar']);
|
|
20
21
|
/**
|
|
@@ -212,7 +213,7 @@ function commitmentActivationRefusal(err, { id, bin }) {
|
|
|
212
213
|
const blockers = activationBlockers(refusal.body);
|
|
213
214
|
const errorField = refusal.body?.error;
|
|
214
215
|
const code = refusal.code ||
|
|
215
|
-
(typeof errorField === 'string' &&
|
|
216
|
+
(typeof errorField === 'string' && COMMITMENT_ACTIVATION_REFUSAL_RE.test(errorField)
|
|
216
217
|
? errorField
|
|
217
218
|
: undefined) ||
|
|
218
219
|
'COMMITMENT_ACTIVATION_REFUSED';
|
|
@@ -6,6 +6,7 @@ const base_command_1 = require("../../base-command");
|
|
|
6
6
|
const commitments_1 = require("../../lib/commitments");
|
|
7
7
|
const commitment_product_1 = require("../../lib/commitment-product");
|
|
8
8
|
const web_url_1 = require("../../lib/web-url");
|
|
9
|
+
const MODULE_RE = /-/g;
|
|
9
10
|
class CommitmentsDelivery extends base_command_1.BaseCommand {
|
|
10
11
|
static description = 'Declare the destination for Commitment work';
|
|
11
12
|
static examples = [
|
|
@@ -19,7 +20,7 @@ class CommitmentsDelivery extends base_command_1.BaseCommand {
|
|
|
19
20
|
description: 'Delivery destination.',
|
|
20
21
|
options: [
|
|
21
22
|
...commitment_product_1.COMMITMENT_DELIVERY_CHOICES,
|
|
22
|
-
...commitment_product_1.COMMITMENT_DELIVERY_CHOICES.map((mode) => mode.replace(
|
|
23
|
+
...commitment_product_1.COMMITMENT_DELIVERY_CHOICES.map((mode) => mode.replace(MODULE_RE, '_')),
|
|
23
24
|
],
|
|
24
25
|
}),
|
|
25
26
|
};
|
|
@@ -6,6 +6,7 @@ const core_1 = require("@oclif/core");
|
|
|
6
6
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
7
7
|
const base_command_1 = require("../../base-command");
|
|
8
8
|
const commitments_1 = require("../../lib/commitments");
|
|
9
|
+
const DOCTOR_VERDICT_RE = /^status_([a-z_]+)$/;
|
|
9
10
|
function doctorVerdict(input) {
|
|
10
11
|
const commitment = input.commitment || {};
|
|
11
12
|
const preflight = input.preflight || {};
|
|
@@ -14,7 +15,7 @@ function doctorVerdict(input) {
|
|
|
14
15
|
if (blocker?.code) {
|
|
15
16
|
// A lifecycle stop is a state, not a fault: a Commitment its owner paused is `paused`, with the
|
|
16
17
|
// way back as its next step, not `blocked` (OSK-15423).
|
|
17
|
-
const lifecycle =
|
|
18
|
+
const lifecycle = DOCTOR_VERDICT_RE.exec(String(blocker.code));
|
|
18
19
|
return {
|
|
19
20
|
verdict: lifecycle ? lifecycle[1] : blocker.code === 'deleted' ? 'deleted' : 'blocked',
|
|
20
21
|
// A typed blocker carries no remedy, only what happened (OSK-16230).
|
|
@@ -6,10 +6,10 @@ const core_1 = require("@oclif/core");
|
|
|
6
6
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
7
7
|
const base_command_1 = require("../../base-command");
|
|
8
8
|
const commitments_1 = require("../../lib/commitments");
|
|
9
|
+
const TIMESTAMP_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/;
|
|
9
10
|
/** Explicit ISO FROM/TO intervals avoid local-time or rolling-window ambiguity. */
|
|
10
11
|
function parseObservationWindow(value) {
|
|
11
12
|
const parts = value.split('/');
|
|
12
|
-
const timestamp = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/;
|
|
13
13
|
const [from, to] = parts.map((entry) => new Date(entry).getTime());
|
|
14
14
|
const realCalendarDay = (part) => {
|
|
15
15
|
const day = part.slice(0, 10);
|
|
@@ -17,7 +17,7 @@ function parseObservationWindow(value) {
|
|
|
17
17
|
return Number.isFinite(parsed.getTime()) && parsed.toISOString().slice(0, 10) === day;
|
|
18
18
|
};
|
|
19
19
|
if (parts.length !== 2 ||
|
|
20
|
-
!parts.every((part) =>
|
|
20
|
+
!parts.every((part) => TIMESTAMP_RE.test(part) && realCalendarDay(part)) ||
|
|
21
21
|
!Number.isFinite(from) ||
|
|
22
22
|
!Number.isFinite(to) ||
|
|
23
23
|
to <= from ||
|
|
@@ -6,6 +6,7 @@ const core_1 = require("@oclif/core");
|
|
|
6
6
|
const base_command_1 = require("../../base-command");
|
|
7
7
|
const commitment_loop_status_1 = require("../../lib/commitment-loop-status");
|
|
8
8
|
const commitments_1 = require("../../lib/commitments");
|
|
9
|
+
const RUN_RE = /^obj_/;
|
|
9
10
|
/** What each silent loop is for, in the owner's terms rather than the role key. */
|
|
10
11
|
const ROLE_PURPOSE = {
|
|
11
12
|
conversation_continuity: 'remembers what we are working on',
|
|
@@ -124,7 +125,7 @@ class CommitmentsOperatingReview extends base_command_1.BaseCommand {
|
|
|
124
125
|
this.requireAuth();
|
|
125
126
|
const { args, flags } = await this.parse(CommitmentsOperatingReview);
|
|
126
127
|
// A Commitment id here answered "Agent not found" without saying an Agent id was wanted.
|
|
127
|
-
if (
|
|
128
|
+
if (RUN_RE.test(args.agentId)) {
|
|
128
129
|
this.error(`${args.agentId} is a Commitment id; operating-review takes an Agent id. ` +
|
|
129
130
|
`Use \`skrr commitments status ${args.agentId}\` for one Commitment.`, { exit: 1 });
|
|
130
131
|
}
|
|
@@ -4,6 +4,7 @@ const core_1 = require("@oclif/core");
|
|
|
4
4
|
const base_command_1 = require("../../../base-command");
|
|
5
5
|
const commitments_1 = require("../../../lib/commitments");
|
|
6
6
|
const preflight_1 = require("../preflight");
|
|
7
|
+
const RUN_RE = /_/g;
|
|
7
8
|
/**
|
|
8
9
|
* Re-run a bound Pack's readiness probe and REWRITE its stored receipt.
|
|
9
10
|
*
|
|
@@ -52,7 +53,7 @@ class CommitmentsPackPreflight extends base_command_1.BaseCommand {
|
|
|
52
53
|
}
|
|
53
54
|
const receipt = result.preflight;
|
|
54
55
|
this.log(`Pack: ${result.pack?.id}@${result.pack?.version}`);
|
|
55
|
-
this.log(`Preflight: ${String(receipt?.verdict).replace(
|
|
56
|
+
this.log(`Preflight: ${String(receipt?.verdict).replace(RUN_RE, ' ')}`);
|
|
56
57
|
this.log(`Recorded: ${receipt?.at}`);
|
|
57
58
|
this.log('\nAdapters:');
|
|
58
59
|
for (const adapter of receipt?.adapterStatuses || []) {
|