@skrr-ai/cli 0.1.146 → 0.1.148
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/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/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 +3 -1
- package/dist/commands/agents/schedule.js +2 -1
- package/dist/commands/agents/spawn.js +9 -6
- package/dist/commands/agents/tools/auth.js +2 -1
- package/dist/commands/agents/tools/calls.js +2 -1
- package/dist/commands/agents/triggers/policy.js +11 -1
- package/dist/commands/agents/visibility.js +2 -1
- package/dist/commands/balance/show.js +28 -5
- 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/preflight.js +5 -1
- package/dist/commands/commitments/trigger-status.js +2 -1
- package/dist/commands/commitments/wake-capabilities.d.ts +2 -0
- package/dist/commands/commitments/wake-capabilities.js +16 -0
- 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/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.js +8 -5
- 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.d.ts +33 -3
- package/dist/lib/balance.js +39 -7
- 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 +13 -0
- package/dist/lib/commitments.js +24 -9
- 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.js +8 -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/ingress.js +2 -1
- 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/preflight-copy.js +31 -0
- 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.js +2 -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 +21 -0
- package/dist/lib/triggers.js +41 -3
- 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 +20519 -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 +17 -2
- package/package.json +1 -1
|
@@ -7,6 +7,17 @@ const node_crypto_1 = require("node:crypto");
|
|
|
7
7
|
const core_1 = require("@oclif/core");
|
|
8
8
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
9
9
|
const base_command_1 = require("../../../base-command");
|
|
10
|
+
const DECODE_ENTITIES_RE = /&/g;
|
|
11
|
+
const DECODE_ENTITIES_RE_2 = /</g;
|
|
12
|
+
const DECODE_ENTITIES_RE_3 = />/g;
|
|
13
|
+
const DECODE_ENTITIES_RE_4 = /"/g;
|
|
14
|
+
const DECODE_ENTITIES_RE_5 = /'|'/g;
|
|
15
|
+
const DECODE_ENTITIES_RE_6 = / /g;
|
|
16
|
+
const ATTR_ESCAPE_RE = /&/g;
|
|
17
|
+
const ATTR_ESCAPE_RE_2 = /"/g;
|
|
18
|
+
const ATTR_ESCAPE_RE_3 = /</g;
|
|
19
|
+
const RUN_RE = /<[^>]+>/g;
|
|
20
|
+
const RUN_RE_2 = /\s+/g;
|
|
10
21
|
/**
|
|
11
22
|
* Server-side validator on `commentMarkId` (api/server/routes/tasks.js).
|
|
12
23
|
* Keep in lockstep — the regex below is the source of truth for what a
|
|
@@ -62,16 +73,19 @@ function tokenizeHtml(html) {
|
|
|
62
73
|
/** Decode the HTML entities the editor actually emits. Keep narrow on purpose. */
|
|
63
74
|
function decodeEntities(s) {
|
|
64
75
|
return s
|
|
65
|
-
.replace(
|
|
66
|
-
.replace(
|
|
67
|
-
.replace(
|
|
68
|
-
.replace(
|
|
69
|
-
.replace(
|
|
70
|
-
.replace(
|
|
76
|
+
.replace(DECODE_ENTITIES_RE, '&')
|
|
77
|
+
.replace(DECODE_ENTITIES_RE_2, '<')
|
|
78
|
+
.replace(DECODE_ENTITIES_RE_3, '>')
|
|
79
|
+
.replace(DECODE_ENTITIES_RE_4, '"')
|
|
80
|
+
.replace(DECODE_ENTITIES_RE_5, "'")
|
|
81
|
+
.replace(DECODE_ENTITIES_RE_6, ' ');
|
|
71
82
|
}
|
|
72
83
|
/** Minimal attr-safe escape for values we inject. */
|
|
73
84
|
function attrEscape(s) {
|
|
74
|
-
return s
|
|
85
|
+
return s
|
|
86
|
+
.replace(ATTR_ESCAPE_RE, '&')
|
|
87
|
+
.replace(ATTR_ESCAPE_RE_2, '"')
|
|
88
|
+
.replace(ATTR_ESCAPE_RE_3, '<');
|
|
75
89
|
}
|
|
76
90
|
/**
|
|
77
91
|
* Map a visible-text offset (post-entity-decoding) back to the raw HTML offset
|
|
@@ -261,8 +275,8 @@ class TasksCommentsAnchor extends base_command_1.BaseCommand {
|
|
|
261
275
|
const wrap = wrapInlineComment(originalDescription, quote, markId, flags.occurrence);
|
|
262
276
|
if (!wrap) {
|
|
263
277
|
const preview = originalDescription
|
|
264
|
-
.replace(
|
|
265
|
-
.replace(
|
|
278
|
+
.replace(RUN_RE, ' ')
|
|
279
|
+
.replace(RUN_RE_2, ' ')
|
|
266
280
|
.trim()
|
|
267
281
|
.slice(0, 200);
|
|
268
282
|
this.error([
|
|
@@ -12,6 +12,8 @@ const session_task_write_1 = require("../../lib/session-task-write");
|
|
|
12
12
|
const task_resolver_1 = require("../../lib/task-resolver");
|
|
13
13
|
const task_extras_1 = require("../../lib/task-extras");
|
|
14
14
|
const web_url_1 = require("../../lib/web-url");
|
|
15
|
+
const PARSE_REFERENCE_RE = /^[a-z][a-z0-9+.-]*:/i;
|
|
16
|
+
const DESCRIBE_PENDING_REVIEW_RE = /expectation/i;
|
|
15
17
|
function parseJson(value, label) {
|
|
16
18
|
if (!value)
|
|
17
19
|
return undefined;
|
|
@@ -29,7 +31,7 @@ function parseReference(raw) {
|
|
|
29
31
|
}
|
|
30
32
|
const kind = raw.slice(0, split);
|
|
31
33
|
const value = raw.slice(split + 1);
|
|
32
|
-
return
|
|
34
|
+
return PARSE_REFERENCE_RE.test(value) || value.startsWith('/')
|
|
33
35
|
? { kind, uri: value }
|
|
34
36
|
: { kind, id: value };
|
|
35
37
|
}
|
|
@@ -53,7 +55,7 @@ function describePendingReview({ statusType, taskId, resultId, bin, advisories,
|
|
|
53
55
|
// as needing review — and the command it handed over failed every time, both
|
|
54
56
|
// because the block was elsewhere and because a submitter may not accept their
|
|
55
57
|
// own Result (`TASK_REVIEW_SELF_ACCEPTANCE`).
|
|
56
|
-
const expectationAdvisory = (advisories || []).find((row) => row.code === 'task_acceptance_not_met' ||
|
|
58
|
+
const expectationAdvisory = (advisories || []).find((row) => row.code === 'task_acceptance_not_met' || DESCRIBE_PENDING_REVIEW_RE.test(row.code || ''));
|
|
57
59
|
if (expectationAdvisory) {
|
|
58
60
|
return ('The Result was submitted, but the Task is not done yet: its Expectations are not all ' +
|
|
59
61
|
`settled. ${expectationAdvisory.message} ` +
|
|
@@ -21,6 +21,10 @@ const json_output_1 = require("../../lib/json-output");
|
|
|
21
21
|
const web_url_1 = require("../../lib/web-url");
|
|
22
22
|
const task_spec_verification_1 = require("../../lib/task-spec-verification");
|
|
23
23
|
const tasks_1 = require("../../lib/tasks");
|
|
24
|
+
const INTERRUPT_RE = / --resume$/;
|
|
25
|
+
const QUOTE_RE = /^[\w@%+=:,./-]+$/;
|
|
26
|
+
const QUOTE_RE_2 = /'/g;
|
|
27
|
+
const VISIT_RE = /\/+$/;
|
|
24
28
|
/**
|
|
25
29
|
* Nodes a re-run could not recognize: no externalKey of their own and no
|
|
26
30
|
* `--external-key-prefix` to derive one. Re-running a partly applied tree
|
|
@@ -509,7 +513,7 @@ class TasksCreateTree extends base_command_1.BaseCommand {
|
|
|
509
513
|
const confirmed = Object.keys(mapping).length;
|
|
510
514
|
const unknown = [...submitted].filter((key) => !mapping[key]).length;
|
|
511
515
|
const recovery = unkeyedNodes(planned).length === 0
|
|
512
|
-
? `Run ${next.replace(
|
|
516
|
+
? `Run ${next.replace(INTERRUPT_RE, ' --verify')} to reconcile, then ${next} to continue.`
|
|
513
517
|
: 'Inspect the Space using the mapping before retrying: unkeyed nodes may be duplicated.';
|
|
514
518
|
// Signals can arrive while the network request is pending. Do not wait for
|
|
515
519
|
// it or claim it was cancelled: the server may still complete submitted rows.
|
|
@@ -998,7 +1002,7 @@ class TasksCreateTree extends base_command_1.BaseCommand {
|
|
|
998
1002
|
* came from stdin and cannot be replayed from a path.
|
|
999
1003
|
*/
|
|
1000
1004
|
nextCommand(flags) {
|
|
1001
|
-
const quote = (value) =>
|
|
1005
|
+
const quote = (value) => QUOTE_RE.test(value) ? value : `'${value.replace(QUOTE_RE_2, `'\\''`)}'`;
|
|
1002
1006
|
const input = flags['from-json'];
|
|
1003
1007
|
const parts = [
|
|
1004
1008
|
this.config.bin,
|
|
@@ -1101,7 +1105,7 @@ function planTree(roots, opts) {
|
|
|
1101
1105
|
const payload = nodePayload(node, opts.defaults);
|
|
1102
1106
|
let keyDerived = false;
|
|
1103
1107
|
if (!payload.externalKey && opts.externalKeyPrefix) {
|
|
1104
|
-
payload.externalKey = `${opts.externalKeyPrefix.replace(
|
|
1108
|
+
payload.externalKey = `${opts.externalKeyPrefix.replace(VISIT_RE, '')}/${key}`;
|
|
1105
1109
|
keyDerived = true;
|
|
1106
1110
|
}
|
|
1107
1111
|
planned.push({
|
|
@@ -13,6 +13,7 @@ const prompt_1 = require("../../lib/prompt");
|
|
|
13
13
|
const tasks_1 = require("../../lib/tasks");
|
|
14
14
|
const task_instruction_offer_1 = require("../../lib/task-instruction-offer");
|
|
15
15
|
const web_url_1 = require("../../lib/web-url");
|
|
16
|
+
const TASK_CREATE_MAY_HAVE_COMMITTED_RE = /fetch failed|socket hang up|timed? ?out/i;
|
|
16
17
|
/**
|
|
17
18
|
* Whether the estimate we asked for survived the write. (S3 dogfood finding)
|
|
18
19
|
*
|
|
@@ -93,7 +94,7 @@ function taskCreateMayHaveCommitted(error) {
|
|
|
93
94
|
const code = failure?.code || '';
|
|
94
95
|
if (['ECONNRESET', 'ETIMEDOUT', 'EAI_AGAIN', 'ENOTFOUND'].includes(code))
|
|
95
96
|
return true;
|
|
96
|
-
return
|
|
97
|
+
return TASK_CREATE_MAY_HAVE_COMMITTED_RE.test(failure?.message || '');
|
|
97
98
|
}
|
|
98
99
|
function taskMatchesCreateIdentity(task, payload) {
|
|
99
100
|
for (const field of [
|
|
@@ -45,6 +45,7 @@ const task_asset_upload_1 = require("../../../lib/task-asset-upload");
|
|
|
45
45
|
const api_fetch_1 = require("../../../lib/api-fetch");
|
|
46
46
|
const session_task_write_1 = require("../../../lib/session-task-write");
|
|
47
47
|
const tasks_1 = require("../../../lib/tasks");
|
|
48
|
+
const ASSERT_ARCHIVED_DELIVERABLE_RECEIPT_RE = /^[a-f0-9]{64}$/i;
|
|
48
49
|
function defaultDeliverableIdempotencyKey() {
|
|
49
50
|
return `task-deliverable_${(0, node_crypto_1.randomUUID)()}`;
|
|
50
51
|
}
|
|
@@ -313,7 +314,7 @@ function assertArchivedDeliverableReceipt(asset) {
|
|
|
313
314
|
const versionDigest = receipt?.version?.contentDigest;
|
|
314
315
|
if (asset?.status !== 'ready' || ids.some((id) => typeof id !== 'string' || !id.trim()) ||
|
|
315
316
|
receipt?.observation?.status !== 'available' || typeof stored !== 'string' ||
|
|
316
|
-
|
|
317
|
+
!ASSERT_ARCHIVED_DELIVERABLE_RECEIPT_RE.test(stored) || typeof versionDigest !== 'string' ||
|
|
317
318
|
versionDigest.toLowerCase() !== `sha256:${stored.toLowerCase()}`) {
|
|
318
319
|
throw new Error('The server did not confirm a ready archived Deliverable with its exact Resource receipt. ' +
|
|
319
320
|
'Re-read the Task attachments and Deliverables before retrying.');
|
|
@@ -40,6 +40,7 @@ const data_provider_1 = require("@skrr-ai/data-provider");
|
|
|
40
40
|
const base_command_1 = require("../../../base-command");
|
|
41
41
|
const task_resolver_1 = require("../../../lib/task-resolver");
|
|
42
42
|
const task_asset_upload_1 = require("../../../lib/task-asset-upload");
|
|
43
|
+
const CLASSIFY_RE = /^[a-z][a-z0-9+.-]*:\/\//i;
|
|
43
44
|
/**
|
|
44
45
|
* `skrr tasks deliverable archive <task>`
|
|
45
46
|
*
|
|
@@ -178,7 +179,7 @@ function classify(row, maxBytes) {
|
|
|
178
179
|
if (!identity) {
|
|
179
180
|
return { ...base, reason: 'no coordinate to resolve' };
|
|
180
181
|
}
|
|
181
|
-
if (
|
|
182
|
+
if (CLASSIFY_RE.test(row.location || identity)) {
|
|
182
183
|
return { ...base, reason: 'remote locator — nothing local to archive' };
|
|
183
184
|
}
|
|
184
185
|
for (const candidate of [row.location, identity]) {
|
|
@@ -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 task_resolver_1 = require("../../../lib/task-resolver");
|
|
9
|
+
const VERSION_LABEL_RE = /^wrv_/;
|
|
9
10
|
/**
|
|
10
11
|
* `locator_only` is the storage word, and it appeared on nearly every row with
|
|
11
12
|
* nothing saying what it meant. It is not a defect — it is the honest statement
|
|
@@ -36,7 +37,7 @@ function versionLabel(item) {
|
|
|
36
37
|
const [algo, hex] = item.contentDigest.split(':');
|
|
37
38
|
return `digest ${algo}:${(hex || '').slice(0, 12)}`;
|
|
38
39
|
}
|
|
39
|
-
const id = (item.resourceVersionId || '').replace(
|
|
40
|
+
const id = (item.resourceVersionId || '').replace(VERSION_LABEL_RE, '');
|
|
40
41
|
return id ? `version ${id.slice(0, 12)}` : 'version unpinned';
|
|
41
42
|
}
|
|
42
43
|
/**
|
|
@@ -8,6 +8,7 @@ const task_resolver_1 = require("../../../lib/task-resolver");
|
|
|
8
8
|
const api_fetch_1 = require("../../../lib/api-fetch");
|
|
9
9
|
const session_task_write_1 = require("../../../lib/session-task-write");
|
|
10
10
|
const task_write_attribution_1 = require("../../../lib/task-write-attribution");
|
|
11
|
+
const RUN_RE = /^https?:|^file:/;
|
|
11
12
|
class TasksExpectationsAssess extends base_command_1.BaseCommand {
|
|
12
13
|
static description = 'Assess one current Task Expectation with evidence and a reason';
|
|
13
14
|
// Both positionals are declared optional because oclif REJECTS an args table
|
|
@@ -114,7 +115,7 @@ class TasksExpectationsAssess extends base_command_1.BaseCommand {
|
|
|
114
115
|
this.error('--evidence must be <kind>:<id-or-uri>', { exit: 1 });
|
|
115
116
|
const kind = raw.slice(0, split);
|
|
116
117
|
const value = raw.slice(split + 1);
|
|
117
|
-
return
|
|
118
|
+
return RUN_RE.test(value) ? { kind, uri: value } : { kind, id: value };
|
|
118
119
|
});
|
|
119
120
|
const payload = {
|
|
120
121
|
decision: flags.decision,
|
|
@@ -5,6 +5,7 @@ const data_provider_1 = require("@skrr-ai/data-provider");
|
|
|
5
5
|
const base_command_1 = require("../../../base-command");
|
|
6
6
|
const prompt_1 = require("../../../lib/prompt");
|
|
7
7
|
const label_scope_1 = require("../../../lib/label-scope");
|
|
8
|
+
const RUN_RE = /^#/;
|
|
8
9
|
// Accept both `#e11d48` and `e11d48` forms; the server's Zod regex
|
|
9
10
|
// (`api/server/routes/tasks.js:206`) is `/^[0-9a-fA-F]{6}$/` — NO leading
|
|
10
11
|
// `#`. We normalize before sending so users can pass either form.
|
|
@@ -52,7 +53,7 @@ class TasksLabelsCreate extends base_command_1.BaseCommand {
|
|
|
52
53
|
this.error(`Invalid color "${String(payload.color)}". Must be a 6-digit hex color, e.g. e11d48.`, { exit: 1 });
|
|
53
54
|
}
|
|
54
55
|
// Strip the optional leading '#' — server Zod rejects it.
|
|
55
|
-
payload.color = payload.color.replace(
|
|
56
|
+
payload.color = payload.color.replace(RUN_RE, '');
|
|
56
57
|
}
|
|
57
58
|
let result;
|
|
58
59
|
try {
|
|
@@ -5,6 +5,8 @@ const data_provider_1 = require("@skrr-ai/data-provider");
|
|
|
5
5
|
const base_command_1 = require("../../base-command");
|
|
6
6
|
const task_resolver_1 = require("../../lib/task-resolver");
|
|
7
7
|
const task_preflight_1 = require("../../lib/task-preflight");
|
|
8
|
+
const RUN_RE = /^[A-Z]+-\d+$/i;
|
|
9
|
+
const RUN_RE_2 = /^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/i;
|
|
8
10
|
class TasksPreflight extends base_command_1.BaseCommand {
|
|
9
11
|
static description = 'Inspect workflow blockers and execution prerequisites without starting work or probing a machine';
|
|
10
12
|
static args = {
|
|
@@ -40,7 +42,7 @@ class TasksPreflight extends base_command_1.BaseCommand {
|
|
|
40
42
|
// Native endpoints accept identifiers, so BaseCommand intentionally keeps
|
|
41
43
|
// OSK-123 unchanged. Correlating two diagnostic records needs the returned
|
|
42
44
|
// canonical identity; UUID/title-resolved callers keep their request count.
|
|
43
|
-
if (
|
|
45
|
+
if (RUN_RE.test(taskId)) {
|
|
44
46
|
let task;
|
|
45
47
|
try {
|
|
46
48
|
task = await data_provider_1.dataService.getTask(taskId, { enrich: false });
|
|
@@ -48,7 +50,7 @@ class TasksPreflight extends base_command_1.BaseCommand {
|
|
|
48
50
|
catch (error) {
|
|
49
51
|
this.handleApiError(error);
|
|
50
52
|
}
|
|
51
|
-
if (typeof task?.id !== 'string' ||
|
|
53
|
+
if (typeof task?.id !== 'string' || !RUN_RE_2.test(task.id) ||
|
|
52
54
|
(task.identifier !== undefined && (typeof task.identifier !== 'string' || task.identifier.toUpperCase() !== taskId.toUpperCase()))) {
|
|
53
55
|
this.failWithCliError({
|
|
54
56
|
code: 'TASK_PREFLIGHT_IDENTITY_UNCONFIRMED',
|
|
@@ -6,6 +6,7 @@ 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
8
|
const web_url_1 = require("../../lib/web-url");
|
|
9
|
+
const CLARIFY_MISSING_REQUIRED_FLAG_RE = /Missing required flag ([A-Za-z0-9][\w-]*)$/gm;
|
|
9
10
|
/**
|
|
10
11
|
* Repair oclif's required-flag copy for a flag named after a preposition. (S4 dogfood finding)
|
|
11
12
|
*
|
|
@@ -29,7 +30,7 @@ const web_url_1 = require("../../lib/web-url");
|
|
|
29
30
|
* actually harmful.
|
|
30
31
|
*/
|
|
31
32
|
function clarifyMissingRequiredFlag(message) {
|
|
32
|
-
return message.replace(
|
|
33
|
+
return message.replace(CLARIFY_MISSING_REQUIRED_FLAG_RE, (_full, name) => `Missing required flag --${name}`);
|
|
33
34
|
}
|
|
34
35
|
class TasksReady extends base_command_1.BaseCommand {
|
|
35
36
|
static description = 'List tasks ready for a Human or Agent, using server-owned readiness';
|
|
@@ -10,6 +10,7 @@ const api_fetch_1 = require("../../../lib/api-fetch");
|
|
|
10
10
|
const task_closure_1 = require("../../../lib/task-closure");
|
|
11
11
|
const session_task_write_1 = require("../../../lib/session-task-write");
|
|
12
12
|
const task_write_attribution_1 = require("../../../lib/task-write-attribution");
|
|
13
|
+
const RUN_RE = /^https?:|^file:/;
|
|
13
14
|
function parseJson(value, label) {
|
|
14
15
|
if (!value)
|
|
15
16
|
return undefined;
|
|
@@ -93,7 +94,7 @@ class TasksResultSubmit extends base_command_1.BaseCommand {
|
|
|
93
94
|
this.error('--evidence must be <kind>:<id-or-uri>', { exit: 1 });
|
|
94
95
|
const kind = raw.slice(0, split);
|
|
95
96
|
const value = raw.slice(split + 1);
|
|
96
|
-
return
|
|
97
|
+
return RUN_RE.test(value) ? { kind, uri: value } : { kind, id: value };
|
|
97
98
|
});
|
|
98
99
|
// --attach: upload first so the Result cites real asset ids. Uploads land
|
|
99
100
|
// before the idempotency key is derived, so a retry sees the same refs.
|
|
@@ -7,6 +7,7 @@ const base_command_1 = require("../../../base-command");
|
|
|
7
7
|
const task_resolver_1 = require("../../../lib/task-resolver");
|
|
8
8
|
const api_fetch_1 = require("../../../lib/api-fetch");
|
|
9
9
|
const session_task_write_1 = require("../../../lib/session-task-write");
|
|
10
|
+
const RUN_RE = /^https?:|^file:/;
|
|
10
11
|
function parseJsonObject(value, label) {
|
|
11
12
|
if (!value)
|
|
12
13
|
return undefined;
|
|
@@ -104,7 +105,7 @@ class TasksUpdatesAdd extends base_command_1.BaseCommand {
|
|
|
104
105
|
this.error('--reference must be <kind>:<id-or-uri>', { exit: 1 });
|
|
105
106
|
const kind = raw.slice(0, split);
|
|
106
107
|
const value = raw.slice(split + 1);
|
|
107
|
-
return
|
|
108
|
+
return RUN_RE.test(value) ? { kind, uri: value } : { kind, id: value };
|
|
108
109
|
});
|
|
109
110
|
// --attach: upload first so the Update can cite the asset ids. For
|
|
110
111
|
// finding/verification the citation lands in data.evidenceRefs where the
|
|
@@ -4,6 +4,7 @@ const core_1 = require("@oclif/core");
|
|
|
4
4
|
const base_command_1 = require("../../base-command");
|
|
5
5
|
const task_resolver_1 = require("../../lib/task-resolver");
|
|
6
6
|
const task_execution_1 = require("../../lib/task-execution");
|
|
7
|
+
const PARSE_DURATION_MS_RE = /^(\d+)(ms|s|m|h)?$/i;
|
|
7
8
|
class TasksWait extends base_command_1.BaseCommand {
|
|
8
9
|
static description = 'Wait for task executions to reach a target status';
|
|
9
10
|
static examples = [
|
|
@@ -129,7 +130,7 @@ function formatProgress(snapshot) {
|
|
|
129
130
|
function parseDurationMs(value) {
|
|
130
131
|
if (!value)
|
|
131
132
|
return null;
|
|
132
|
-
const match = value.trim().match(
|
|
133
|
+
const match = value.trim().match(PARSE_DURATION_MS_RE);
|
|
133
134
|
if (!match)
|
|
134
135
|
throw new Error(`Invalid --timeout value: ${value}`);
|
|
135
136
|
const amount = Number(match[1]);
|
|
@@ -5,6 +5,7 @@ const core_1 = require("@oclif/core");
|
|
|
5
5
|
const base_command_1 = require("../../base-command");
|
|
6
6
|
const api_fetch_1 = require("../../lib/api-fetch");
|
|
7
7
|
const format_1 = require("../../lib/format");
|
|
8
|
+
const RUN_RE = /^[a-fA-F0-9]{24}$/;
|
|
8
9
|
const SESSION_KINDS = ['web', 'daemon', 'cli', 'ci'];
|
|
9
10
|
/**
|
|
10
11
|
* `skrr token list`
|
|
@@ -83,7 +84,7 @@ class TokenList extends base_command_1.BaseCommand {
|
|
|
83
84
|
break;
|
|
84
85
|
const next = page?.nextCursor;
|
|
85
86
|
if (typeof next !== 'string' ||
|
|
86
|
-
|
|
87
|
+
!RUN_RE.test(next) ||
|
|
87
88
|
seenCursors.has(next) ||
|
|
88
89
|
rows.length === 0) {
|
|
89
90
|
cannotPage = true;
|
|
@@ -4,6 +4,7 @@ const core_1 = require("@oclif/core");
|
|
|
4
4
|
const base_command_1 = require("../../base-command");
|
|
5
5
|
const api_fetch_1 = require("../../lib/api-fetch");
|
|
6
6
|
const device_id_1 = require("../../lib/device-id");
|
|
7
|
+
const RUN_RE = /'/g;
|
|
7
8
|
/**
|
|
8
9
|
* `skrr token mint`
|
|
9
10
|
*
|
|
@@ -117,7 +118,7 @@ class TokenMint extends base_command_1.BaseCommand {
|
|
|
117
118
|
}
|
|
118
119
|
// shell
|
|
119
120
|
for (const [k, v] of pairs) {
|
|
120
|
-
const escaped = v.replace(
|
|
121
|
+
const escaped = v.replace(RUN_RE, "'\\''");
|
|
121
122
|
this.log(`export ${k}='${escaped}'`);
|
|
122
123
|
}
|
|
123
124
|
}
|
|
@@ -12,6 +12,14 @@ const http_error_1 = require("../../lib/http-error");
|
|
|
12
12
|
const space_charter_1 = require("../../lib/space-charter");
|
|
13
13
|
const web_url_1 = require("../../lib/web-url");
|
|
14
14
|
const wiki_1 = require("../../lib/wiki");
|
|
15
|
+
const SLUGIFY_LIKE_SERVER_RE = /[/\\]+/g;
|
|
16
|
+
// eslint-disable-next-line no-control-regex
|
|
17
|
+
const SLUGIFY_LIKE_SERVER_RE_2 = /[\u0000-\u001f\u007f]/g;
|
|
18
|
+
const SLUGIFY_LIKE_SERVER_RE_3 = /\s+/g;
|
|
19
|
+
const SLUGIFY_LIKE_SERVER_RE_4 = /-{2,}/g;
|
|
20
|
+
const SLUGIFY_LIKE_SERVER_RE_5 = /^-+|-+$/g;
|
|
21
|
+
const CREATED_SLUG_COLLIDED_RE = /^\d+$/;
|
|
22
|
+
const CREATED_SLUG_COLLIDED_RE_2 = /^[0-9a-f]{8}$/;
|
|
15
23
|
/**
|
|
16
24
|
* The page lookup below goes through `dataService`, whose adapter throws a
|
|
17
25
|
* plain `Error` carrying `status` — not an `ApiFetchError` and not an
|
|
@@ -54,12 +62,11 @@ function slugifyLikeServer(input) {
|
|
|
54
62
|
const base = String(input || '')
|
|
55
63
|
.trim()
|
|
56
64
|
.toLowerCase()
|
|
57
|
-
.replace(
|
|
58
|
-
|
|
59
|
-
.replace(
|
|
60
|
-
.replace(
|
|
61
|
-
.replace(
|
|
62
|
-
.replace(/^-+|-+$/g, '')
|
|
65
|
+
.replace(SLUGIFY_LIKE_SERVER_RE, '-')
|
|
66
|
+
.replace(SLUGIFY_LIKE_SERVER_RE_2, '')
|
|
67
|
+
.replace(SLUGIFY_LIKE_SERVER_RE_3, '-')
|
|
68
|
+
.replace(SLUGIFY_LIKE_SERVER_RE_4, '-')
|
|
69
|
+
.replace(SLUGIFY_LIKE_SERVER_RE_5, '')
|
|
63
70
|
.slice(0, MAX_SLUG_LENGTH);
|
|
64
71
|
return base || 'untitled';
|
|
65
72
|
}
|
|
@@ -90,7 +97,7 @@ function createdSlugCollided(requestedSlug, createdSlug) {
|
|
|
90
97
|
const suffix = createdSlug.slice(base.length + 1);
|
|
91
98
|
// `allocateSlug` appends either an ordinal (`-2`) or, in its pathological
|
|
92
99
|
// fallback, an 8-char uuid head.
|
|
93
|
-
return
|
|
100
|
+
return CREATED_SLUG_COLLIDED_RE.test(suffix) || CREATED_SLUG_COLLIDED_RE_2.test(suffix);
|
|
94
101
|
}
|
|
95
102
|
/**
|
|
96
103
|
* The warning for `--kind` on a write that landed in a page that already
|
|
@@ -5,6 +5,7 @@ const command_manifest_1 = require("../lib/command-manifest");
|
|
|
5
5
|
const usage_discovery_1 = require("../lib/usage-discovery");
|
|
6
6
|
const command_miss_1 = require("../lib/command-miss");
|
|
7
7
|
const json_mode_1 = require("../lib/json-mode");
|
|
8
|
+
const VIRTUAL_USAGE_FLAGS_RE = /^--page=(.+)$/;
|
|
8
9
|
/**
|
|
9
10
|
* Turn "command not found" back into the truth when the command DOES exist.
|
|
10
11
|
*
|
|
@@ -116,7 +117,7 @@ function virtualUsageFlags(argv) {
|
|
|
116
117
|
json = true;
|
|
117
118
|
continue;
|
|
118
119
|
}
|
|
119
|
-
const suppliedPage = token === '--page' ? argv[++index] : token.match(
|
|
120
|
+
const suppliedPage = token === '--page' ? argv[++index] : token.match(VIRTUAL_USAGE_FLAGS_RE)?.[1];
|
|
120
121
|
if (suppliedPage !== undefined) {
|
|
121
122
|
const parsed = Number(suppliedPage);
|
|
122
123
|
if (!Number.isInteger(parsed) || parsed < 1) {
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agent-chat-start.ts — start an agent turn so that "no answer" never means "abandoned".
|
|
3
|
+
*
|
|
4
|
+
* `POST /api/agentic/chat` is an acceptance, not the turn: the server admits the
|
|
5
|
+
* request, reserves the balance for it, queues the run, and only then answers. When
|
|
6
|
+
* that answer is lost — the edge gives up with a 504, the API answers 503 while it is
|
|
7
|
+
* restarting, the socket drops — the CLI cannot tell "never admitted" from "admitted
|
|
8
|
+
* and running". Reporting it as a plain failure (`retryable: false`) is the wrong
|
|
9
|
+
* half of that ambiguity: the turn is usually live, its balance hold is open, and its
|
|
10
|
+
* permission prompts can no longer be answered because the process that would answer
|
|
11
|
+
* them has exited (OSK-22631).
|
|
12
|
+
*
|
|
13
|
+
* The server already has the right contract. A request that carries a
|
|
14
|
+
* `clientRequestId` is admitted exactly once per (user, id): a replay of an accepted
|
|
15
|
+
* request returns the original acceptance (`idempotentReplay: true`, same session and
|
|
16
|
+
* conversation), a replay of one still being admitted answers
|
|
17
|
+
* `409 agentic_request_in_progress` ("retry shortly with the same clientRequestId"),
|
|
18
|
+
* and a different message under the same id is refused. So the client's job is small:
|
|
19
|
+
* name the start, and when the outcome is unknown, send the SAME request again.
|
|
20
|
+
*
|
|
21
|
+
* What is NOT replayed: a refusal that says it cannot help (`retryable: false`, an
|
|
22
|
+
* unconfirmed previous admission, a changed release), any 4xx, and anything that is not
|
|
23
|
+
* an HTTP failure of the transport. Those describe a state the caller has to change
|
|
24
|
+
* first, and replaying them only repeats the refusal.
|
|
25
|
+
*/
|
|
26
|
+
export declare const START_KEY_RULE = "1-128 characters: letters, numbers, dot, underscore, colon, hyphen";
|
|
27
|
+
/**
|
|
28
|
+
* Waits between replays. The first replay is quick because most unknown outcomes are a
|
|
29
|
+
* lost answer to a start that already succeeded; the later ones give a restarting API
|
|
30
|
+
* time to come back. Roughly 44 seconds of waiting in total, on top of each attempt.
|
|
31
|
+
*/
|
|
32
|
+
export declare const DEFAULT_REPLAY_DELAYS_MS: readonly number[];
|
|
33
|
+
/** A fresh key for one invocation. Reused by every replay of that invocation, never across them. */
|
|
34
|
+
export declare function newStartKey(): string;
|
|
35
|
+
/** Whether a caller-supplied key is one the server will accept. */
|
|
36
|
+
export declare function isValidStartKey(value: string): boolean;
|
|
37
|
+
export type StartVerdict = 'replay' | 'surface';
|
|
38
|
+
/**
|
|
39
|
+
* Whether a failed start may be sent again under the same key.
|
|
40
|
+
*
|
|
41
|
+
* `replay` is exactly the set of failures where the outcome is unknown or the server
|
|
42
|
+
* said "still being admitted"; `surface` is everything the caller has to act on.
|
|
43
|
+
*/
|
|
44
|
+
export declare function classifyStartFailure(err: unknown): StartVerdict;
|
|
45
|
+
/** Raised when every replay of a start ended without the server confirming the outcome. */
|
|
46
|
+
export declare class StartNotConfirmed extends Error {
|
|
47
|
+
readonly attempts: number;
|
|
48
|
+
readonly lastError: unknown;
|
|
49
|
+
constructor(lastError: unknown, attempts: number);
|
|
50
|
+
}
|
|
51
|
+
export interface ReplayInfo {
|
|
52
|
+
/** The replay about to be sent, 1-based. */
|
|
53
|
+
attempt: number;
|
|
54
|
+
/** How many replays this start will make at most. */
|
|
55
|
+
of: number;
|
|
56
|
+
waitMs: number;
|
|
57
|
+
error: unknown;
|
|
58
|
+
}
|
|
59
|
+
export interface StartReplayOptions {
|
|
60
|
+
delaysMs?: readonly number[];
|
|
61
|
+
sleep?: (ms: number) => Promise<void>;
|
|
62
|
+
onReplay?: (info: ReplayInfo) => void;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Run `start`; when it fails with an unknown outcome, run it again — the SAME call, so the
|
|
66
|
+
* same key — after a short wait, up to `delaysMs.length` more times.
|
|
67
|
+
*
|
|
68
|
+
* A failure that is not replayable is thrown untouched on whichever attempt it happens, so
|
|
69
|
+
* existing error handling (and its message) is unchanged. Only running out of replays turns
|
|
70
|
+
* into `StartNotConfirmed`, which carries the last transport error for the caller to render.
|
|
71
|
+
*/
|
|
72
|
+
export declare function startWithReplay<T>(start: () => Promise<T>, options?: StartReplayOptions): Promise<T>;
|
|
73
|
+
/**
|
|
74
|
+
* What to tell a person when the server never confirmed the start. The turn may be running,
|
|
75
|
+
* so the advice is to re-attach with the same key rather than start a second turn.
|
|
76
|
+
*/
|
|
77
|
+
export declare function startNotConfirmedHint(key: string, attempts: number): string;
|