@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
|
@@ -11,6 +11,7 @@ exports.envelopesText = envelopesText;
|
|
|
11
11
|
exports.envelopeKey = envelopeKey;
|
|
12
12
|
exports.unseenEnvelopes = unseenEnvelopes;
|
|
13
13
|
exports.projectDaemonToolEvents = projectDaemonToolEvents;
|
|
14
|
+
exports.toolEndStatusFromOutcome = toolEndStatusFromOutcome;
|
|
14
15
|
exports.describeToolEnd = describeToolEnd;
|
|
15
16
|
exports.describePermissionDecider = describePermissionDecider;
|
|
16
17
|
exports.projectPermissionResolutions = projectPermissionResolutions;
|
|
@@ -34,6 +35,9 @@ const config_1 = require("./config");
|
|
|
34
35
|
const widgetTerminalText_1 = require("./widgetTerminalText");
|
|
35
36
|
const publicEndpoints_generated_1 = require("./publicEndpoints.generated");
|
|
36
37
|
const dpop_auth_1 = require("./dpop-auth");
|
|
38
|
+
const SQUASH_RE = /\s+/g;
|
|
39
|
+
const HANDLE_PERMISSION_RE = /^y(es)?$/i;
|
|
40
|
+
const TO_WEB_SOCKET_ORIGIN_RE = /\/$/;
|
|
37
41
|
/**
|
|
38
42
|
* Why a question was dismissed when no terminal exists to ask it on. It is the
|
|
39
43
|
* REASON for a dismissal, never an answer: it travels as the value of the
|
|
@@ -452,6 +456,30 @@ function daemonToolEndStatus(ev) {
|
|
|
452
456
|
}
|
|
453
457
|
return status;
|
|
454
458
|
}
|
|
459
|
+
/**
|
|
460
|
+
* The `tool.completed` status a typed operation receipt earns, for an end that names none
|
|
461
|
+
* (OSK-22614).
|
|
462
|
+
*
|
|
463
|
+
* A cloud run's `tool:end` has no `status` field; the daemon-routed path always sets one. So a
|
|
464
|
+
* call that FAILED on the cloud ended as `[tool completed]` here, and `--jsonl` carried the
|
|
465
|
+
* failure only inside `operationOutcome`, where a consumer reading `status` never looked. The
|
|
466
|
+
* receipt is the server's own statement of how the operation ended, so it is read the same way
|
|
467
|
+
* the daemon's status is: failed is failed, and an operation that never ran did not run.
|
|
468
|
+
*
|
|
469
|
+
* `unknown` earns nothing, because nothing is known: that call keeps whatever the end said, which is
|
|
470
|
+
* the status quo, not a claim it succeeded.
|
|
471
|
+
*/
|
|
472
|
+
function toolEndStatusFromOutcome(outcome) {
|
|
473
|
+
const receipt = (0, data_provider_1.readToolOperationOutcome)(outcome);
|
|
474
|
+
if (!receipt)
|
|
475
|
+
return undefined;
|
|
476
|
+
if (receipt.status === 'failed')
|
|
477
|
+
return 'failed';
|
|
478
|
+
if (receipt.status === 'not_run') {
|
|
479
|
+
return receipt.reason === 'permission_denied' ? 'denied' : 'not_run';
|
|
480
|
+
}
|
|
481
|
+
return undefined;
|
|
482
|
+
}
|
|
455
483
|
/**
|
|
456
484
|
* The line printed when a tool call ends, in the words its status earns.
|
|
457
485
|
*
|
|
@@ -734,7 +762,7 @@ function seqGapNotice(gaps, options = {}) {
|
|
|
734
762
|
* stream never showed — and that is the only thing this answers yes to.
|
|
735
763
|
*/
|
|
736
764
|
function streamShowsRecordedText(streamed, recorded) {
|
|
737
|
-
const squash = (s) => s.replace(
|
|
765
|
+
const squash = (s) => s.replace(SQUASH_RE, '');
|
|
738
766
|
return squash(streamed).includes(squash(recorded));
|
|
739
767
|
}
|
|
740
768
|
const defaultStreamDebug = (line) => {
|
|
@@ -774,13 +802,13 @@ function describeRunPermission(event) {
|
|
|
774
802
|
}
|
|
775
803
|
/** `tail` is the end of `whole`, whitespace aside. */
|
|
776
804
|
function endsWithIgnoringWhitespace(whole, tail) {
|
|
777
|
-
const solid = (value) => value.replace(
|
|
805
|
+
const solid = (value) => value.replace(SQUASH_RE, '');
|
|
778
806
|
const wanted = solid(tail);
|
|
779
807
|
return wanted.length > 0 && solid(whole).endsWith(wanted);
|
|
780
808
|
}
|
|
781
809
|
/** `head` is the start of `whole`, whitespace aside. */
|
|
782
810
|
function startsWithIgnoringWhitespace(whole, head) {
|
|
783
|
-
const solid = (value) => value.replace(
|
|
811
|
+
const solid = (value) => value.replace(SQUASH_RE, '');
|
|
784
812
|
const wanted = solid(head);
|
|
785
813
|
return wanted.length > 0 && solid(whole).startsWith(wanted);
|
|
786
814
|
}
|
|
@@ -855,6 +883,8 @@ class AgenticStreamClient {
|
|
|
855
883
|
* ran (OSK-22553).
|
|
856
884
|
*/
|
|
857
885
|
deniedToolUseIds = new Set();
|
|
886
|
+
/** Calls whose denial the terminal already labelled, so the run's own end does not say it twice. */
|
|
887
|
+
deniedLabelled = new Set();
|
|
858
888
|
permissionGenerations = new Map();
|
|
859
889
|
permissionEpochs = new Map();
|
|
860
890
|
/**
|
|
@@ -1082,6 +1112,7 @@ class AgenticStreamClient {
|
|
|
1082
1112
|
this.pendingEnvelopes.clear();
|
|
1083
1113
|
this.browserPermissionRequests.clear();
|
|
1084
1114
|
this.deniedToolUseIds.clear();
|
|
1115
|
+
this.deniedLabelled.clear();
|
|
1085
1116
|
this.permissionGenerations.clear();
|
|
1086
1117
|
this.permissionEpochs.clear();
|
|
1087
1118
|
this.abandonConnectWait?.();
|
|
@@ -1900,7 +1931,7 @@ class AgenticStreamClient {
|
|
|
1900
1931
|
// there is nothing left to answer, and a late "no" would read as a person's.
|
|
1901
1932
|
if (prompt.signal.aborted)
|
|
1902
1933
|
return;
|
|
1903
|
-
const approved =
|
|
1934
|
+
const approved = HANDLE_PERMISSION_RE.test(answer.trim());
|
|
1904
1935
|
// Recorded before the decision is sent, so the call's end can never arrive first.
|
|
1905
1936
|
if (!approved && event.toolUseId)
|
|
1906
1937
|
this.deniedToolUseIds.add(event.toolUseId);
|
|
@@ -2246,6 +2277,14 @@ class AgenticStreamClient {
|
|
|
2246
2277
|
this.emit({ ...event, status: 'denied' });
|
|
2247
2278
|
return;
|
|
2248
2279
|
}
|
|
2280
|
+
// An end that names no status, with a receipt that says how the operation ended (OSK-22614).
|
|
2281
|
+
if (event.type === 'tool.completed' && (event.status === undefined || event.status === null)) {
|
|
2282
|
+
const fromReceipt = toolEndStatusFromOutcome(event.operationOutcome);
|
|
2283
|
+
if (fromReceipt) {
|
|
2284
|
+
this.emit({ ...event, status: fromReceipt });
|
|
2285
|
+
return;
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2249
2288
|
this.emit(event);
|
|
2250
2289
|
}
|
|
2251
2290
|
/**
|
|
@@ -2372,7 +2411,13 @@ class AgenticStreamClient {
|
|
|
2372
2411
|
this.renderedText = this.answerText();
|
|
2373
2412
|
}
|
|
2374
2413
|
else if (event.type === 'tool.completed') {
|
|
2375
|
-
|
|
2414
|
+
const endedId = typeof event.toolUseId === 'string' ? event.toolUseId : undefined;
|
|
2415
|
+
// A refusal this terminal already labelled when it was given is not said a second time.
|
|
2416
|
+
if (!(event.status === 'denied' && endedId && this.deniedLabelled.has(endedId))) {
|
|
2417
|
+
output.write(`${describeToolEnd(event.toolName, event.status)}\n`);
|
|
2418
|
+
if (event.status === 'denied' && endedId)
|
|
2419
|
+
this.deniedLabelled.add(endedId);
|
|
2420
|
+
}
|
|
2376
2421
|
this.renderedText = this.answerText();
|
|
2377
2422
|
}
|
|
2378
2423
|
else if (event.type === 'stream.gap') {
|
|
@@ -2405,6 +2450,12 @@ class AgenticStreamClient {
|
|
|
2405
2450
|
'permission.response_refused',
|
|
2406
2451
|
].includes(event.type)) {
|
|
2407
2452
|
output.write(`\n[permission] ${String(event.message ?? '')}\n`);
|
|
2453
|
+
// A refusal the server recorded is this client's own fact, and the run does not always end
|
|
2454
|
+
// the call afterwards (a cloud run may carry on with its reply), so the label waited on an
|
|
2455
|
+
// event that never came and the denial went unlabelled in half the runs (OSK-22553).
|
|
2456
|
+
if (event.type === 'permission.response_recorded' && event.decision === 'deny') {
|
|
2457
|
+
this.writeRefusalLabel(event, output);
|
|
2458
|
+
}
|
|
2408
2459
|
this.renderedText = this.answerText();
|
|
2409
2460
|
}
|
|
2410
2461
|
else if (event.type === 'permission.cancelled') {
|
|
@@ -2435,6 +2486,12 @@ class AgenticStreamClient {
|
|
|
2435
2486
|
output.write(`\n[permission] ${describePermission(event)} denied: nobody could be asked, and this run was not started with --approve-tools\n`);
|
|
2436
2487
|
this.renderedText = this.answerText();
|
|
2437
2488
|
}
|
|
2489
|
+
else if (event.type === 'permission.denied' &&
|
|
2490
|
+
event.reason !== 'noninteractive_or_not_enabled') {
|
|
2491
|
+
// A person answered `n` and the decision went out the unbound way.
|
|
2492
|
+
this.writeRefusalLabel(event, output);
|
|
2493
|
+
this.renderedText = this.answerText();
|
|
2494
|
+
}
|
|
2438
2495
|
else if (event.type === 'permission.approved' && event.auto === true) {
|
|
2439
2496
|
// Said out loud, because nobody was asked: the flag approved it, and a
|
|
2440
2497
|
// reader of this log should see which tools that covered (OSK-10323).
|
|
@@ -2446,6 +2503,18 @@ class AgenticStreamClient {
|
|
|
2446
2503
|
this.renderedText = this.answerText();
|
|
2447
2504
|
}
|
|
2448
2505
|
}
|
|
2506
|
+
/**
|
|
2507
|
+
* `[tool denied] <tool> (it did not run)`, once per call (OSK-22553). The call's own end prints the
|
|
2508
|
+
* same line when the run reports one; this is the line for the runs that never do.
|
|
2509
|
+
*/
|
|
2510
|
+
writeRefusalLabel(event, output) {
|
|
2511
|
+
const id = typeof event.toolUseId === 'string' ? event.toolUseId : undefined;
|
|
2512
|
+
if (id && this.deniedLabelled.has(id))
|
|
2513
|
+
return;
|
|
2514
|
+
if (id)
|
|
2515
|
+
this.deniedLabelled.add(id);
|
|
2516
|
+
output.write(`\n${describeToolEnd(event.toolName, 'denied')}\n`);
|
|
2517
|
+
}
|
|
2449
2518
|
/**
|
|
2450
2519
|
* Human-mode lines for the hand-over wait. Returns true when the event is
|
|
2451
2520
|
* fully rendered here; false lets the ordinary rendering continue.
|
|
@@ -2790,5 +2859,5 @@ function toWebSocketOrigin(baseURL) {
|
|
|
2790
2859
|
url.pathname = '';
|
|
2791
2860
|
url.search = '';
|
|
2792
2861
|
url.hash = '';
|
|
2793
|
-
return url.toString().replace(
|
|
2862
|
+
return url.toString().replace(TO_WEB_SOCKET_ORIGIN_RE, '');
|
|
2794
2863
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.reasonOnlyCode = reasonOnlyCode;
|
|
4
|
+
const REASON_ONLY_CODE_RE = /^[A-Za-z][A-Za-z0-9]*(?:[_-][A-Za-z0-9]+)+$/;
|
|
4
5
|
/** The reason-only refusal used by session-scoped API routes. */
|
|
5
6
|
function reasonOnlyCode(body) {
|
|
6
7
|
if (!body || typeof body !== 'object' || Array.isArray(body))
|
|
@@ -9,6 +10,6 @@ function reasonOnlyCode(body) {
|
|
|
9
10
|
if (value.ok !== false || typeof value.reason !== 'string')
|
|
10
11
|
return undefined;
|
|
11
12
|
const reason = value.reason.trim();
|
|
12
|
-
return reason.length <= 160 &&
|
|
13
|
+
return reason.length <= 160 && REASON_ONLY_CODE_RE.test(reason)
|
|
13
14
|
? reason : undefined;
|
|
14
15
|
}
|
package/dist/lib/api-fetch.js
CHANGED
|
@@ -51,6 +51,8 @@ const task_runtime_headers_1 = require("./task-runtime-headers");
|
|
|
51
51
|
const non_json_response_1 = require("./non-json-response");
|
|
52
52
|
const rate_limit_retry_1 = require("./rate-limit-retry");
|
|
53
53
|
const memory_history_session_1 = require("./memory-history-session");
|
|
54
|
+
const API_FETCH_RE = /^https?:\/\//i;
|
|
55
|
+
const API_FETCH_RE_2 = /\/+$/;
|
|
54
56
|
class ApiFetchError extends Error {
|
|
55
57
|
status;
|
|
56
58
|
body;
|
|
@@ -118,11 +120,11 @@ async function apiFetch(pathOrUrl, opts = {}) {
|
|
|
118
120
|
: sessionCredential;
|
|
119
121
|
const baseURL = autonomousCredential ? trustedAutonomousBaseUrl() : (0, config_1.loadConfig)().baseURL;
|
|
120
122
|
const method = opts.method ?? 'GET';
|
|
121
|
-
const url = historyRead?.url ?? (
|
|
123
|
+
const url = historyRead?.url ?? (API_FETCH_RE.test(pathOrUrl)
|
|
122
124
|
? autonomousCredential
|
|
123
125
|
? assertTrustedAutonomousUrl(pathOrUrl, baseURL)
|
|
124
126
|
: pathOrUrl
|
|
125
|
-
: `${baseURL.replace(
|
|
127
|
+
: `${baseURL.replace(API_FETCH_RE_2, '')}${pathOrUrl.startsWith('/') ? '' : '/'}${pathOrUrl}`);
|
|
126
128
|
// A FormData body passes through untouched — fetch sets the multipart
|
|
127
129
|
// boundary itself, and stringifying would destroy it. Upload commands
|
|
128
130
|
// (tasks attachments) need this on the session-scoped path, which is not
|
|
@@ -408,7 +410,7 @@ function assertTrustedAutonomousUrl(url, baseURL) {
|
|
|
408
410
|
}
|
|
409
411
|
function isAuthEndpoint(pathOrUrl) {
|
|
410
412
|
try {
|
|
411
|
-
const path =
|
|
413
|
+
const path = API_FETCH_RE.test(pathOrUrl) ? new URL(pathOrUrl).pathname : pathOrUrl;
|
|
412
414
|
return path.includes('/api/auth/');
|
|
413
415
|
}
|
|
414
416
|
catch {
|
package/dist/lib/appData.js
CHANGED
|
@@ -34,6 +34,10 @@ exports.formatQueryResult = formatQueryResult;
|
|
|
34
34
|
*/
|
|
35
35
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
36
36
|
const appsFs_1 = require("./appsFs");
|
|
37
|
+
// eslint-disable-next-line no-control-regex, no-misleading-character-class -- the point of the pattern is to match control, combining and invisible characters
|
|
38
|
+
const SAFE_FOR_TERMINAL_RE =
|
|
39
|
+
// eslint-disable-next-line no-control-regex, no-misleading-character-class
|
|
40
|
+
/[\u0000-\u001f\u007f-\u009f\u00ad\u034f\u061c\u115f\u1160\u17b4\u17b5\u180b-\u180e\u200b-\u200f\u2028-\u202e\u2060-\u206f\u2800\u3164\ufe00-\ufe0f\ufeff\uffa0\ufff9-\ufffb\u{1d173}-\u{1d17a}\u{e0000}-\u{e03ff}]/gu;
|
|
37
41
|
// ── what a document is, and where it comes from ─────────────────────────────
|
|
38
42
|
/** Why the input could not be used; never carries what was in it. */
|
|
39
43
|
class AppDataInputError extends Error {
|
|
@@ -230,13 +234,9 @@ function describePersonDataConflict(failure, target, bin) {
|
|
|
230
234
|
* already escapes everything below U+0020, but not these.
|
|
231
235
|
*/
|
|
232
236
|
function safeForTerminal(text) {
|
|
233
|
-
return text.replace(
|
|
234
|
-
// eslint-disable-next-line no-control-regex, no-misleading-character-class -- the point of the pattern is to match control, combining and invisible characters
|
|
235
|
-
/[\u0000-\u001f\u007f-\u009f\u00ad\u034f\u061c\u115f\u1160\u17b4\u17b5\u180b-\u180e\u200b-\u200f\u2028-\u202e\u2060-\u206f\u2800\u3164\ufe00-\ufe0f\ufeff\uffa0\ufff9-\ufffb\u{1d173}-\u{1d17a}\u{e0000}-\u{e03ff}]/gu, (c) => {
|
|
237
|
+
return text.replace(SAFE_FOR_TERMINAL_RE, (c) => {
|
|
236
238
|
const code = c.codePointAt(0) ?? 0;
|
|
237
|
-
return code > 0xffff
|
|
238
|
-
? `\\u{${code.toString(16)}}`
|
|
239
|
-
: `\\u${code.toString(16).padStart(4, '0')}`;
|
|
239
|
+
return code > 0xffff ? `\\u{${code.toString(16)}}` : `\\u${code.toString(16).padStart(4, '0')}`;
|
|
240
240
|
});
|
|
241
241
|
}
|
|
242
242
|
const DATA_LINE_MAX = 400;
|
|
@@ -41,6 +41,11 @@ exports.installationRefusalExit = installationRefusalExit;
|
|
|
41
41
|
* next step.
|
|
42
42
|
*/
|
|
43
43
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
44
|
+
const DESCRIBE_SCHEDULE_RE = /s$/;
|
|
45
|
+
const FORMAT_JOB_STATES_RE = /<installation>/g;
|
|
46
|
+
const ITEM_LINES_RE = /_/g;
|
|
47
|
+
const FORMAT_DISCLOSURE_RE = /^ {4}/;
|
|
48
|
+
const FORMAT_DISCLOSURE_RE_2 = /^ {4}(?=- )/;
|
|
44
49
|
// ── what an installation is, in a line ──────────────────────────────────────
|
|
45
50
|
const AVAILABILITY_WORDS = {
|
|
46
51
|
ready: 'ready',
|
|
@@ -137,7 +142,7 @@ function describeSchedule(schedule) {
|
|
|
137
142
|
case 'daily':
|
|
138
143
|
return `every day at ${reading.times.join(' and ')}`;
|
|
139
144
|
case 'every':
|
|
140
|
-
return `every ${reading.count === 1 ? reading.unit.replace(
|
|
145
|
+
return `every ${reading.count === 1 ? reading.unit.replace(DESCRIBE_SCHEDULE_RE, '') : `${reading.count} ${reading.unit}`}`;
|
|
141
146
|
case 'configured':
|
|
142
147
|
return "on a schedule set in the app's settings";
|
|
143
148
|
default:
|
|
@@ -280,7 +285,7 @@ function formatJobStates(jobStates, installationId) {
|
|
|
280
285
|
}
|
|
281
286
|
lines.push(` job ${(0, data_provider_1.plainAppLabel)(job.id, 64)}: NOT SCHEDULED: ${words.what}`);
|
|
282
287
|
if (words.next) {
|
|
283
|
-
lines.push(` next: ${words.next.replace(
|
|
288
|
+
lines.push(` next: ${words.next.replace(FORMAT_JOB_STATES_RE, installationId)}`);
|
|
284
289
|
}
|
|
285
290
|
}
|
|
286
291
|
return lines;
|
|
@@ -338,7 +343,7 @@ function jobNextLine(job) {
|
|
|
338
343
|
if (stateReason.state === 'unknown' && live) {
|
|
339
344
|
return [];
|
|
340
345
|
}
|
|
341
|
-
return [` next: ${stateReason.next.replace(
|
|
346
|
+
return [` next: ${stateReason.next.replace(FORMAT_JOB_STATES_RE, '<installation id>')}`];
|
|
342
347
|
}
|
|
343
348
|
function itemLines(item) {
|
|
344
349
|
switch (item.kind) {
|
|
@@ -367,7 +372,7 @@ function itemLines(item) {
|
|
|
367
372
|
case 'service': {
|
|
368
373
|
const declaration = item.declaration;
|
|
369
374
|
const lines = [
|
|
370
|
-
`run a background program (${declaration.protocol}, ${declaration.liveness.replace(
|
|
375
|
+
`run a background program (${declaration.protocol}, ${declaration.liveness.replace(ITEM_LINES_RE, ' ')}), ${ISOLATION_WORDS[declaration.isolation] ?? declaration.isolation}; this stops working if the app's code changes, until you approve again${mark(item.consent)}`,
|
|
371
376
|
` command: ${declaration.command.join(' ')}`,
|
|
372
377
|
];
|
|
373
378
|
if (declaration.secretNames.length > 0) {
|
|
@@ -448,7 +453,7 @@ function formatDisclosure(raw, facts) {
|
|
|
448
453
|
const [first, ...rest] = itemLines(item);
|
|
449
454
|
if (first !== undefined) {
|
|
450
455
|
lines.push(` - ${first}`);
|
|
451
|
-
lines.push(...rest.map((line) => ` ${line.replace(
|
|
456
|
+
lines.push(...rest.map((line) => ` ${line.replace(FORMAT_DISCLOSURE_RE, '')}`.replace(FORMAT_DISCLOSURE_RE_2, ' ')));
|
|
452
457
|
}
|
|
453
458
|
}
|
|
454
459
|
}
|
package/dist/lib/appsCheck.js
CHANGED
|
@@ -53,6 +53,7 @@ exports.formatAppCheckReport = formatAppCheckReport;
|
|
|
53
53
|
const vm = __importStar(require("node:vm"));
|
|
54
54
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
55
55
|
const widgetStaticScan_1 = require("./widgetStaticScan");
|
|
56
|
+
const COMPILE_SCRIPT_RE = /^app\.js:(\d+)/;
|
|
56
57
|
/** Compile `source` as a classic script and say what is wrong with it, or null. */
|
|
57
58
|
function compileScript(source) {
|
|
58
59
|
try {
|
|
@@ -63,7 +64,7 @@ function compileScript(source) {
|
|
|
63
64
|
const message = error?.message;
|
|
64
65
|
const stack = error?.stack;
|
|
65
66
|
const head = typeof stack === 'string' ? stack.split('\n')[0] : '';
|
|
66
|
-
const at =
|
|
67
|
+
const at = COMPILE_SCRIPT_RE.exec(head);
|
|
67
68
|
return {
|
|
68
69
|
message: typeof message === 'string' ? message : String(error),
|
|
69
70
|
...(at ? { line: Number(at[1]) } : {}),
|
package/dist/lib/auth-failure.js
CHANGED
|
@@ -16,6 +16,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
16
|
exports.refusalFromResponse = refusalFromResponse;
|
|
17
17
|
exports.describeRefreshRefusal = describeRefreshRefusal;
|
|
18
18
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
19
|
+
const DESCRIBE_REFRESH_REFUSAL_RE = /bound to a different daemon/i;
|
|
19
20
|
/**
|
|
20
21
|
* OSK-16941 — the refusal an API 401 body describes, when it is a revoked
|
|
21
22
|
* session (`{ code: 'SESSION_REVOKED', reason }`). Lets the 401 explain itself
|
|
@@ -64,7 +65,7 @@ function describeRefreshRefusal(refusal, opts) {
|
|
|
64
65
|
// read refuses a bundle bound to another cliId before presenting it, so this
|
|
65
66
|
// is now reached only when the server's binding disagrees with a token that
|
|
66
67
|
// carries no readable `did`.
|
|
67
|
-
if (
|
|
68
|
+
if (DESCRIBE_REFRESH_REFUSAL_RE.test(message)) {
|
|
68
69
|
return {
|
|
69
70
|
code,
|
|
70
71
|
message: `This profile's stored sign-in could not be renewed${said}. The credential in its ` +
|
package/dist/lib/auth-storage.js
CHANGED
|
@@ -104,6 +104,7 @@ const cred_envelope_1 = require("./cred-envelope");
|
|
|
104
104
|
const config_1 = require("./config");
|
|
105
105
|
const cli_id_1 = require("./cli-id");
|
|
106
106
|
const harness_context_1 = require("./harness-context");
|
|
107
|
+
const NORMALIZE_SERVER_ORIGIN_RE = /\/+$/;
|
|
107
108
|
/** Filename for the non-darwin file backend. Parallel to the daemon's
|
|
108
109
|
* `auth.json`, deliberately distinct so the two binaries never clobber
|
|
109
110
|
* each other's tokens (CLI holds scope=cli, daemon holds scope=daemon). */
|
|
@@ -898,7 +899,7 @@ function normalizeServerOrigin(value) {
|
|
|
898
899
|
const parsed = new URL((0, config_1.canonicalizeKnownBaseURL)(value.trim()));
|
|
899
900
|
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:')
|
|
900
901
|
return null;
|
|
901
|
-
const pathName = parsed.pathname.replace(
|
|
902
|
+
const pathName = parsed.pathname.replace(NORMALIZE_SERVER_ORIGIN_RE, '');
|
|
902
903
|
return `${parsed.origin}${pathName}`;
|
|
903
904
|
}
|
|
904
905
|
catch {
|
package/dist/lib/balance.js
CHANGED
|
@@ -21,6 +21,9 @@ exports.formatCreditsWithUsd = formatCreditsWithUsd;
|
|
|
21
21
|
exports.formatTransactionAmount = formatTransactionAmount;
|
|
22
22
|
exports.formatBalanceTimestamp = formatBalanceTimestamp;
|
|
23
23
|
const api_fetch_1 = require("./api-fetch");
|
|
24
|
+
const DESCRIBE_CHARGE_RE = /([a-z0-9])([A-Z])/g;
|
|
25
|
+
const DESCRIBE_CHARGE_RE_2 = /[_-]+/g;
|
|
26
|
+
const DESCRIBE_CHARGE_RE_3 = /^./;
|
|
24
27
|
/** The account's current credits, limit and period usage. */
|
|
25
28
|
async function getBalance() {
|
|
26
29
|
return (0, api_fetch_1.apiFetch)('/api/balance');
|
|
@@ -223,9 +226,9 @@ function describeCharge(context) {
|
|
|
223
226
|
return KNOWN[context];
|
|
224
227
|
}
|
|
225
228
|
return context
|
|
226
|
-
.replace(
|
|
227
|
-
.replace(
|
|
228
|
-
.replace(
|
|
229
|
+
.replace(DESCRIBE_CHARGE_RE, '$1 $2')
|
|
230
|
+
.replace(DESCRIBE_CHARGE_RE_2, ' ')
|
|
231
|
+
.replace(DESCRIBE_CHARGE_RE_3, (c) => c.toUpperCase());
|
|
229
232
|
}
|
|
230
233
|
/**
|
|
231
234
|
* A credit is a MICRO-DOLLAR. This is the bridge between the spend surfaces,
|
|
@@ -66,6 +66,8 @@ exports.auditCommitmentTermCoverage = auditCommitmentTermCoverage;
|
|
|
66
66
|
const fs = __importStar(require("node:fs"));
|
|
67
67
|
const path = __importStar(require("node:path"));
|
|
68
68
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
69
|
+
const PARSE_DECLARED_FLAGS_RE = /static\s+override\s+flags\s*=\s*\{/;
|
|
70
|
+
const PARSE_DECLARED_FLAGS_RE_2 = /^['"]?([a-zA-Z][\w-]*)['"]?\s*:/;
|
|
69
71
|
/** `commitments:attach` → `commitments/attach.ts` */
|
|
70
72
|
function commandIdToFile(commandsRoot, commandId) {
|
|
71
73
|
return path.join(commandsRoot, `${commandId.split(':').join(path.sep)}.ts`);
|
|
@@ -78,7 +80,7 @@ function commandIdToFile(commandsRoot, commandId) {
|
|
|
78
80
|
* depth counting rather than a lazy regex, because flag definitions nest.
|
|
79
81
|
*/
|
|
80
82
|
function parseDeclaredFlags(source) {
|
|
81
|
-
const start = source.search(
|
|
83
|
+
const start = source.search(PARSE_DECLARED_FLAGS_RE);
|
|
82
84
|
if (start === -1)
|
|
83
85
|
return [];
|
|
84
86
|
const openBrace = source.indexOf('{', start);
|
|
@@ -106,7 +108,7 @@ function parseDeclaredFlags(source) {
|
|
|
106
108
|
for (const line of block.split('\n')) {
|
|
107
109
|
const trimmed = line.trim();
|
|
108
110
|
if (localDepth === 0) {
|
|
109
|
-
const match =
|
|
111
|
+
const match = PARSE_DECLARED_FLAGS_RE_2.exec(trimmed);
|
|
110
112
|
if (match)
|
|
111
113
|
names.push(match[1]);
|
|
112
114
|
}
|
package/dist/lib/cli-runtime.js
CHANGED
|
@@ -39,6 +39,7 @@ exports.buildCliSourceMetadata = buildCliSourceMetadata;
|
|
|
39
39
|
const fs = __importStar(require("node:fs"));
|
|
40
40
|
const path = __importStar(require("node:path"));
|
|
41
41
|
const runtime_context_1 = require("./runtime-context");
|
|
42
|
+
const COMMAND_ID_TO_INVOCATION_RE = /:/g;
|
|
42
43
|
let cachedVersion = null;
|
|
43
44
|
function getCliVersion(rootDir) {
|
|
44
45
|
if (cachedVersion)
|
|
@@ -63,7 +64,7 @@ function getCliVersion(rootDir) {
|
|
|
63
64
|
return 'unknown';
|
|
64
65
|
}
|
|
65
66
|
function commandIdToInvocation(commandId) {
|
|
66
|
-
return commandId ? commandId.replace(
|
|
67
|
+
return commandId ? commandId.replace(COMMAND_ID_TO_INVOCATION_RE, ' ') : 'unknown';
|
|
67
68
|
}
|
|
68
69
|
function buildCliSourceMetadata({ commandId, rootDir, }) {
|
|
69
70
|
const sessionId = optionalString(process.env.OVERSKY_SESSION_ID);
|
|
@@ -17,12 +17,16 @@ exports.classifySessionExportError = classifySessionExportError;
|
|
|
17
17
|
exports.renderSessionTranscript = renderSessionTranscript;
|
|
18
18
|
exports.matchAgent = matchAgent;
|
|
19
19
|
const auth_core_1 = require("@skrr-ai/auth-core");
|
|
20
|
+
const PARSE_GIT_HUB_REPO_RE = /github\.com[:/]([^/\s]+)\/(.+?)(?:\.git)?\/?$/i;
|
|
21
|
+
const CLASSIFY_SESSION_EXPORT_ERROR_RE = /unknown (command|subcommand)|unrecognized|not a valid|did you mean|usage:/i;
|
|
22
|
+
const CLASSIFY_SESSION_EXPORT_ERROR_RE_2 = /(no such|cannot find|could not find|not found|does not exist|unknown)[\s\S]{0,60}session/i;
|
|
23
|
+
const CLASSIFY_SESSION_EXPORT_ERROR_RE_3 = /session[\s\S]{0,60}(no such|not found|does not exist|missing|unknown)/i;
|
|
20
24
|
/** `owner/name` from any GitHub remote URL shape. */
|
|
21
25
|
function parseGitHubRepo(remoteUrl) {
|
|
22
26
|
if (!remoteUrl || !remoteUrl.trim()) {
|
|
23
27
|
return null;
|
|
24
28
|
}
|
|
25
|
-
const match = remoteUrl.trim().match(
|
|
29
|
+
const match = remoteUrl.trim().match(PARSE_GIT_HUB_REPO_RE);
|
|
26
30
|
if (!match) {
|
|
27
31
|
return null;
|
|
28
32
|
}
|
|
@@ -118,8 +122,9 @@ function classifySessionExportError(err) {
|
|
|
118
122
|
// "session <id> not found" is an unknown session; "unknown command: session"
|
|
119
123
|
// is an engine that predates the contract. Both contain the words 'session'
|
|
120
124
|
// and 'unknown', so the command-not-understood phrasing is excluded FIRST.
|
|
121
|
-
const commandNotUnderstood =
|
|
122
|
-
const sessionMissing =
|
|
125
|
+
const commandNotUnderstood = CLASSIFY_SESSION_EXPORT_ERROR_RE.test(stderr);
|
|
126
|
+
const sessionMissing = CLASSIFY_SESSION_EXPORT_ERROR_RE_2.test(stderr) ||
|
|
127
|
+
CLASSIFY_SESSION_EXPORT_ERROR_RE_3.test(stderr);
|
|
123
128
|
if (!commandNotUnderstood && sessionMissing) {
|
|
124
129
|
return { kind: 'unknown-session', detail: stderr || (err.message ?? '') };
|
|
125
130
|
}
|
|
@@ -38,6 +38,20 @@ exports.auditCommands = auditCommands;
|
|
|
38
38
|
const fs = __importStar(require("node:fs"));
|
|
39
39
|
const path = __importStar(require("node:path"));
|
|
40
40
|
const usage_discovery_1 = require("./usage-discovery");
|
|
41
|
+
const READ_COMMAND_SOURCE_RE = /\/\*[\s\S]*?\*\//g;
|
|
42
|
+
const READ_COMMAND_SOURCE_RE_2 = /\/\/.*$/gm;
|
|
43
|
+
const READ_COMMAND_SOURCE_RE_3 = /^export\s*\{\s*default\s*\}\s*from\s*['"](\.{1,2}\/[^'"]+)['"]\s*;?$/;
|
|
44
|
+
const AUDIT_COMMANDS_RE = /['"]from-json['"]/;
|
|
45
|
+
const AUDIT_COMMANDS_RE_2 = /json:\s*Flags\.boolean/;
|
|
46
|
+
const AUDIT_COMMANDS_RE_3 = /Args\.string\(\{[\s\S]*?\}\)/g;
|
|
47
|
+
const AUDIT_COMMANDS_RE_4 = /ignoreStdin:\s*true/;
|
|
48
|
+
const AUDIT_COMMANDS_RE_5 = /\.\.\.[\w.]*Flags\b/;
|
|
49
|
+
const AUDIT_COMMANDS_RE_6 = /static (?:override )?description\s*=/;
|
|
50
|
+
const AUDIT_COMMANDS_RE_7 = /this\.error\(/;
|
|
51
|
+
const AUDIT_COMMANDS_RE_8 = /:archive$/;
|
|
52
|
+
const AUDIT_COMMANDS_RE_9 = /:/g;
|
|
53
|
+
const COMMAND_ID_FROM_RELATIVE_PATH_RE = /\.ts$/;
|
|
54
|
+
const COMMAND_ID_FROM_RELATIVE_PATH_RE_2 = /[/\\]/g;
|
|
41
55
|
const provided = (note) => ({ status: 'provided', note });
|
|
42
56
|
const missing = (note) => ({ status: 'missing', note });
|
|
43
57
|
const notApplicable = (note) => ({
|
|
@@ -469,10 +483,10 @@ const AGENT_CRITICAL_COMMANDS = [
|
|
|
469
483
|
function readCommandSource(file) {
|
|
470
484
|
const source = fs.readFileSync(file, 'utf8');
|
|
471
485
|
const code = source
|
|
472
|
-
.replace(
|
|
473
|
-
.replace(
|
|
486
|
+
.replace(READ_COMMAND_SOURCE_RE, '')
|
|
487
|
+
.replace(READ_COMMAND_SOURCE_RE_2, '')
|
|
474
488
|
.trim();
|
|
475
|
-
const alias = code.match(
|
|
489
|
+
const alias = code.match(READ_COMMAND_SOURCE_RE_3);
|
|
476
490
|
if (!alias)
|
|
477
491
|
return source;
|
|
478
492
|
const target = path.resolve(path.dirname(file), alias[1]);
|
|
@@ -544,13 +558,13 @@ function auditCommands({ rootDir, manifest, }) {
|
|
|
544
558
|
const source = readCommandSource(file);
|
|
545
559
|
const command = commandIdFromRelativePath(rel);
|
|
546
560
|
sourceCommandIds.add(command);
|
|
547
|
-
const hasFromJson =
|
|
548
|
-
const hasJson =
|
|
561
|
+
const hasFromJson = AUDIT_COMMANDS_RE.test(source);
|
|
562
|
+
const hasJson = AUDIT_COMMANDS_RE_2.test(source);
|
|
549
563
|
if (hasFromJson)
|
|
550
564
|
fromJsonCommands += 1;
|
|
551
|
-
for (const block of source.matchAll(
|
|
565
|
+
for (const block of source.matchAll(AUDIT_COMMANDS_RE_3)) {
|
|
552
566
|
argsStringBlocks += 1;
|
|
553
|
-
if (
|
|
567
|
+
if (!AUDIT_COMMANDS_RE_4.test(block[0])) {
|
|
554
568
|
issues.push({
|
|
555
569
|
code: 'ARG_IMPLICIT_STDIN_ENABLED',
|
|
556
570
|
severity: 'error',
|
|
@@ -566,7 +580,7 @@ function auditCommands({ rootDir, manifest, }) {
|
|
|
566
580
|
if (!manifest && isEnforcedDomain(command)) {
|
|
567
581
|
// A spread of a shared flag set (`...paginatedExportFlags(...)`) may carry
|
|
568
582
|
// --json from another file; only the manifest can tell, so do not guess.
|
|
569
|
-
const spreadsSharedFlags =
|
|
583
|
+
const spreadsSharedFlags = AUDIT_COMMANDS_RE_5.test(source);
|
|
570
584
|
if (!hasJson && !spreadsSharedFlags && isMachineRelevantCommand(command)) {
|
|
571
585
|
issues.push({
|
|
572
586
|
code: 'JSON_SUCCESS_OUTPUT_MISSING',
|
|
@@ -576,7 +590,7 @@ function auditCommands({ rootDir, manifest, }) {
|
|
|
576
590
|
message: 'Machine-relevant command has no --json success-output flag. Keep human-only commands intentional.',
|
|
577
591
|
});
|
|
578
592
|
}
|
|
579
|
-
if (
|
|
593
|
+
if (!AUDIT_COMMANDS_RE_6.test(source)) {
|
|
580
594
|
issues.push({
|
|
581
595
|
code: 'COMMAND_DESCRIPTION_MISSING',
|
|
582
596
|
severity: 'error',
|
|
@@ -595,7 +609,7 @@ function auditCommands({ rootDir, manifest, }) {
|
|
|
595
609
|
message: 'Commands that accept --from-json must also expose --json for machine output.',
|
|
596
610
|
});
|
|
597
611
|
}
|
|
598
|
-
if (hasJson &&
|
|
612
|
+
if (hasJson && AUDIT_COMMANDS_RE_7.test(source)) {
|
|
599
613
|
issues.push({
|
|
600
614
|
code: 'LOCAL_ERROR_RELIES_ON_BASE_JSON_TRANSLATION',
|
|
601
615
|
severity: 'warning',
|
|
@@ -640,7 +654,7 @@ function auditCommands({ rootDir, manifest, }) {
|
|
|
640
654
|
code: 'VERB_GRAMMAR_INVERSE_AS_FLAG',
|
|
641
655
|
severity: 'warning',
|
|
642
656
|
command: id,
|
|
643
|
-
message: `Naming grammar: a state flip is its own verb (\`${id.replace(
|
|
657
|
+
message: `Naming grammar: a state flip is its own verb (\`${id.replace(AUDIT_COMMANDS_RE_8, ':unarchive').replace(AUDIT_COMMANDS_RE_9, ' ')}\`), not --unarchive on the forward verb. Keep the flag as a deprecated alias when adding the verb.`,
|
|
644
658
|
});
|
|
645
659
|
}
|
|
646
660
|
}
|
|
@@ -689,7 +703,9 @@ function walkTypeScriptFiles(dir) {
|
|
|
689
703
|
return files.sort();
|
|
690
704
|
}
|
|
691
705
|
function commandIdFromRelativePath(relativePath) {
|
|
692
|
-
return relativePath
|
|
706
|
+
return relativePath
|
|
707
|
+
.replace(COMMAND_ID_FROM_RELATIVE_PATH_RE, '')
|
|
708
|
+
.replace(COMMAND_ID_FROM_RELATIVE_PATH_RE_2, ':');
|
|
693
709
|
}
|
|
694
710
|
function hasJsonFlag(flags) {
|
|
695
711
|
return Boolean(flags && typeof flags === 'object' && 'json' in flags);
|
|
@@ -40,6 +40,9 @@ exports.visibleCommandEntries = visibleCommandEntries;
|
|
|
40
40
|
exports.searchVisibleCommandEntries = searchVisibleCommandEntries;
|
|
41
41
|
const fs = __importStar(require("node:fs"));
|
|
42
42
|
const path = __importStar(require("node:path"));
|
|
43
|
+
const COMMAND_KEY_RE = /\s+/g;
|
|
44
|
+
const VISIBLE_COMMAND_ENTRIES_RE = /:/g;
|
|
45
|
+
const SEARCH_VISIBLE_COMMAND_ENTRIES_RE = /\s+/;
|
|
43
46
|
function manifestPath(rootDir) {
|
|
44
47
|
return path.join(rootDir, 'oclif.manifest.json');
|
|
45
48
|
}
|
|
@@ -49,7 +52,7 @@ function loadCommandManifest(rootDir) {
|
|
|
49
52
|
return JSON.parse(raw);
|
|
50
53
|
}
|
|
51
54
|
function commandKey(command) {
|
|
52
|
-
return command.trim().replace(
|
|
55
|
+
return command.trim().replace(COMMAND_KEY_RE, ':');
|
|
53
56
|
}
|
|
54
57
|
function visibleCommandEntries(manifest) {
|
|
55
58
|
const commands = manifest.commands ?? {};
|
|
@@ -58,7 +61,7 @@ function visibleCommandEntries(manifest) {
|
|
|
58
61
|
.sort(([a], [b]) => a.localeCompare(b))
|
|
59
62
|
.map(([id, command]) => ({
|
|
60
63
|
id,
|
|
61
|
-
command: id.replace(
|
|
64
|
+
command: id.replace(VISIBLE_COMMAND_ENTRIES_RE, ' '),
|
|
62
65
|
description: command.description ?? '',
|
|
63
66
|
aliases: command.aliases ?? [],
|
|
64
67
|
args: command.args ?? {},
|
|
@@ -73,7 +76,7 @@ function visibleCommandEntries(manifest) {
|
|
|
73
76
|
* also makes the same semantics available to future catalog surfaces.
|
|
74
77
|
*/
|
|
75
78
|
function searchVisibleCommandEntries(entries, query) {
|
|
76
|
-
const terms = query?.trim().toLowerCase().split(
|
|
79
|
+
const terms = query?.trim().toLowerCase().split(SEARCH_VISIBLE_COMMAND_ENTRIES_RE).filter(Boolean) ?? [];
|
|
77
80
|
if (terms.length === 0)
|
|
78
81
|
return entries;
|
|
79
82
|
return entries.filter((entry) => {
|
|
@@ -21,6 +21,7 @@ exports.describeEventSources = describeEventSources;
|
|
|
21
21
|
exports.quietHoursInputProblem = quietHoursInputProblem;
|
|
22
22
|
exports.describeQuietHours = describeQuietHours;
|
|
23
23
|
exports.describeQuietHoursEnd = describeQuietHoursEnd;
|
|
24
|
+
const PARSE_MAX_NUDGES_FLAG_RE = /^\d+$/;
|
|
24
25
|
/** What the owner can type for `--max-nudges`, as `--help` prints it. */
|
|
25
26
|
exports.MAX_NUDGES_FLAG_HELP = 'Daily limit on messages that interrupt you: a whole number from 0 up (0 mutes it: ' +
|
|
26
27
|
'it never contacts you) or "unlimited" to remove the limit. Left unset it is unlimited';
|
|
@@ -34,7 +35,7 @@ function parseMaxNudgesFlag(raw) {
|
|
|
34
35
|
const value = raw.trim().toLowerCase();
|
|
35
36
|
if (value === 'unlimited')
|
|
36
37
|
return null;
|
|
37
|
-
if (
|
|
38
|
+
if (PARSE_MAX_NUDGES_FLAG_RE.test(value)) {
|
|
38
39
|
const parsed = Number(value);
|
|
39
40
|
if (Number.isSafeInteger(parsed))
|
|
40
41
|
return parsed;
|
|
@@ -33,6 +33,15 @@ function eventWakeLines(caps) {
|
|
|
33
33
|
` (${gap.impact === 'evidence_read' ? 'needed by' : 'blocks'} ${(gap.events ?? []).join(', ')})`)
|
|
34
34
|
.join('; ')} — the routing GitHub installation does not hold the permission`);
|
|
35
35
|
}
|
|
36
|
+
if ((caps.selectedEvents ?? []).length) {
|
|
37
|
+
lines.push(' selected events:');
|
|
38
|
+
for (const item of caps.selectedEvents) {
|
|
39
|
+
const name = `${item.source ?? 'source'}: ${item.event ?? '(incomplete selection)'}`;
|
|
40
|
+
lines.push(item.verdict === 'set_aside'
|
|
41
|
+
? ` ${name} — set aside: ${item.detail ?? item.reason ?? 'it cannot wake this Commitment'}`
|
|
42
|
+
: ` ${name} — can wake`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
36
45
|
if (caps.degradedReason)
|
|
37
46
|
lines.push(` degraded: ${caps.degradedReason}`);
|
|
38
47
|
return lines;
|