@skrr-ai/cli 0.1.146 → 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/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/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/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.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.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/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/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 +15 -0
- package/dist/lib/triggers.js +32 -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
|
@@ -5,6 +5,15 @@ exports.assertMcpGuideToolReferences = assertMcpGuideToolReferences;
|
|
|
5
5
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
6
6
|
const command_miss_1 = require("./command-miss");
|
|
7
7
|
const command_manifest_1 = require("./command-manifest");
|
|
8
|
+
const COMMAND_WORDS_RE = /\s+/;
|
|
9
|
+
const COMMAND_WORDS_RE_2 = /^[a-z][a-z0-9-]*$/i;
|
|
10
|
+
const COMMAND_CATALOG_RE = /:/g;
|
|
11
|
+
const COMMAND_CATALOG_RE_2 = /^--/;
|
|
12
|
+
const ASSERT_CLI_GUIDE_REFERENCES_RE = /\bskrr(?:\s+[^\s`]+)*/g;
|
|
13
|
+
const IS_TOOL_REFERENCE_RE = /\b(?:call|use|invoke|run)\s*$/i;
|
|
14
|
+
const IS_TOOL_REFERENCE_RE_2 = /\b(?:MCP\s+)?tools?\s*$/i;
|
|
15
|
+
const IS_TOOL_REFERENCE_RE_3 = /^\s*(?:MCP\s+)?tool\b/i;
|
|
16
|
+
const IS_TOOL_REFERENCE_RE_4 = /^\s*(?:[-*]|\d+\.)\s*$/;
|
|
8
17
|
const FENCE = /^ {0,3}(`{3,}|~{3,})(.*)$/;
|
|
9
18
|
const INLINE_CODE = /`([^`\n]+)`/g;
|
|
10
19
|
const FLAG = /(?<!-)--([a-z][a-z0-9-]*)\b/g;
|
|
@@ -16,10 +25,10 @@ function location(document, line, problem) {
|
|
|
16
25
|
}
|
|
17
26
|
function commandWords(text) {
|
|
18
27
|
const words = [];
|
|
19
|
-
for (const token of text.trim().split(
|
|
28
|
+
for (const token of text.trim().split(COMMAND_WORDS_RE)) {
|
|
20
29
|
if (token.startsWith('--') || token.startsWith('<') || token.startsWith('['))
|
|
21
30
|
break;
|
|
22
|
-
if (
|
|
31
|
+
if (!COMMAND_WORDS_RE_2.test(token))
|
|
23
32
|
break;
|
|
24
33
|
words.push(token.toLowerCase());
|
|
25
34
|
}
|
|
@@ -59,7 +68,7 @@ function commandCatalog(manifest) {
|
|
|
59
68
|
for (const entry of (0, command_manifest_1.visibleCommandEntries)(manifest)) {
|
|
60
69
|
ids.push(entry.id);
|
|
61
70
|
for (const name of [entry.command, ...entry.aliases]) {
|
|
62
|
-
const words = commandWords(name.replace(
|
|
71
|
+
const words = commandWords(name.replace(COMMAND_CATALOG_RE, ' '));
|
|
63
72
|
if (words.length)
|
|
64
73
|
spellings.push({ words, id: entry.id });
|
|
65
74
|
}
|
|
@@ -72,7 +81,7 @@ function commandCatalog(manifest) {
|
|
|
72
81
|
if (Array.isArray(aliases)) {
|
|
73
82
|
for (const alias of aliases) {
|
|
74
83
|
if (typeof alias === 'string')
|
|
75
|
-
flags.add(alias.replace(
|
|
84
|
+
flags.add(alias.replace(COMMAND_CATALOG_RE_2, ''));
|
|
76
85
|
}
|
|
77
86
|
}
|
|
78
87
|
}
|
|
@@ -83,12 +92,12 @@ function commandCatalog(manifest) {
|
|
|
83
92
|
function assertCliGuideReferences(documents, manifest, globalFlags = []) {
|
|
84
93
|
const catalog = commandCatalog(manifest);
|
|
85
94
|
for (const flag of globalFlags)
|
|
86
|
-
catalog.flags.add(flag.replace(
|
|
95
|
+
catalog.flags.add(flag.replace(COMMAND_CATALOG_RE_2, ''));
|
|
87
96
|
for (const document of documents) {
|
|
88
97
|
if (document.surface !== 'cli')
|
|
89
98
|
continue;
|
|
90
99
|
for (const span of codeSpans(document)) {
|
|
91
|
-
for (const match of span.text.matchAll(
|
|
100
|
+
for (const match of span.text.matchAll(ASSERT_CLI_GUIDE_REFERENCES_RE)) {
|
|
92
101
|
const typed = commandWords(match[0].slice('skrr'.length));
|
|
93
102
|
if (!typed.length)
|
|
94
103
|
continue;
|
|
@@ -103,7 +112,9 @@ function assertCliGuideReferences(documents, manifest, globalFlags = []) {
|
|
|
103
112
|
if (catalog.ids.some((known) => known.startsWith(`${id}:`)))
|
|
104
113
|
continue;
|
|
105
114
|
const nearest = (0, command_miss_1.nearestCommands)(id, catalog.ids)[0];
|
|
106
|
-
throw location(document, span.line, `unknown \`skrr ${typed.join(' ')}\` command${nearest
|
|
115
|
+
throw location(document, span.line, `unknown \`skrr ${typed.join(' ')}\` command${nearest
|
|
116
|
+
? `; nearest real command: \`skrr ${nearest.replace(COMMAND_CATALOG_RE, ' ')}\``
|
|
117
|
+
: ''}`);
|
|
107
118
|
}
|
|
108
119
|
}
|
|
109
120
|
for (const source of document.lines) {
|
|
@@ -122,12 +133,12 @@ function isToolReference(line, start, end, name, known) {
|
|
|
122
133
|
return true;
|
|
123
134
|
const before = line.slice(0, start);
|
|
124
135
|
const after = line.slice(end);
|
|
125
|
-
return (
|
|
136
|
+
return (IS_TOOL_REFERENCE_RE.test(before) ||
|
|
126
137
|
// "the `x` tool" / "tool `x`": the word must sit beside the name, since a
|
|
127
138
|
// line that mentions tools elsewhere often names an argument too.
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
139
|
+
IS_TOOL_REFERENCE_RE_2.test(before) ||
|
|
140
|
+
IS_TOOL_REFERENCE_RE_3.test(after) ||
|
|
141
|
+
IS_TOOL_REFERENCE_RE_4.test(before));
|
|
131
142
|
}
|
|
132
143
|
function nearestTool(name, names) {
|
|
133
144
|
return (0, data_provider_1.nearestAgentGuideIds)(name, names, 1)[0] ?? '';
|
package/dist/lib/agent-guides.js
CHANGED
|
@@ -19,6 +19,7 @@ const http_error_1 = require("./http-error");
|
|
|
19
19
|
const keychain_1 = require("./keychain");
|
|
20
20
|
const config_1 = require("./config");
|
|
21
21
|
const node_adapter_1 = require("./node-adapter");
|
|
22
|
+
const GUIDE_READ_TELEMETRY_HEADERS_RE = /[\r\n]/;
|
|
22
23
|
const bundle = agent_guides_json_1.default;
|
|
23
24
|
/**
|
|
24
25
|
* An opaque correlation hint for guide-read telemetry. It is not
|
|
@@ -31,7 +32,9 @@ exports.GUIDE_READ_CONTEXT_HEADER = 'X-Oversky-Guide-Read-Context';
|
|
|
31
32
|
const GUIDE_READ_CONTEXT_MAX_CHARS = 256;
|
|
32
33
|
function guideReadTelemetryHeaders(env = process.env) {
|
|
33
34
|
const context = (env.OVERSKY_GUIDE_READ_CONTEXT ?? env.OVERSKY_SESSION_ID ?? '').trim();
|
|
34
|
-
if (!context ||
|
|
35
|
+
if (!context ||
|
|
36
|
+
context.length > GUIDE_READ_CONTEXT_MAX_CHARS ||
|
|
37
|
+
GUIDE_READ_TELEMETRY_HEADERS_RE.test(context)) {
|
|
35
38
|
return undefined;
|
|
36
39
|
}
|
|
37
40
|
return { [exports.GUIDE_READ_CONTEXT_HEADER]: context };
|
|
@@ -7,6 +7,7 @@ exports.renderCompositionLines = renderCompositionLines;
|
|
|
7
7
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
8
8
|
const agent_resolver_1 = require("./agent-resolver");
|
|
9
9
|
const instruction_blocks_1 = require("./instruction-blocks");
|
|
10
|
+
const RENDER_COMPOSITION_LINES_RE = /\s+/g;
|
|
10
11
|
/** Positional and --agent forms agree with the existing `agents tone` UX. */
|
|
11
12
|
async function resolveInstructionAgentId(argument, flag) {
|
|
12
13
|
return (0, agent_resolver_1.resolveAgentId)((0, agent_resolver_1.mergeExplicitAgentInputs)([
|
|
@@ -36,7 +37,10 @@ function renderCompositionLines(composition) {
|
|
|
36
37
|
return composition.entries.flatMap((entry, index) => {
|
|
37
38
|
const state = entry.enabled ? 'on' : 'off';
|
|
38
39
|
if (entry.source.kind === 'inline') {
|
|
39
|
-
const preview = entry.source.body
|
|
40
|
+
const preview = entry.source.body
|
|
41
|
+
.trim()
|
|
42
|
+
.replace(RENDER_COMPOSITION_LINES_RE, ' ')
|
|
43
|
+
.slice(0, 140);
|
|
40
44
|
return [
|
|
41
45
|
`${index + 1}. ${state.padEnd(3)} inline ${entry.source.title} (${entry.instanceId})`,
|
|
42
46
|
` ${preview || '(empty)'}`,
|
package/dist/lib/agent-ref.js
CHANGED
|
@@ -9,6 +9,10 @@ exports.shellQuote = shellQuote;
|
|
|
9
9
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
10
10
|
const http_error_1 = require("./http-error");
|
|
11
11
|
const web_url_1 = require("./web-url");
|
|
12
|
+
const RESOLVE_BY_CODE_RE = /_/g;
|
|
13
|
+
const RESOLVE_AGENT_REF_RE = /^[a-z][a-z0-9+.-]*:\/\//i;
|
|
14
|
+
const SHELL_QUOTE_RE = /^[A-Za-z0-9_@%+=:,./-]+$/;
|
|
15
|
+
const SHELL_QUOTE_RE_2 = /'/g;
|
|
12
16
|
class AgentRefError extends Error {
|
|
13
17
|
code;
|
|
14
18
|
constructor(message, code) {
|
|
@@ -94,7 +98,7 @@ async function resolveByCode(value, attribution, options) {
|
|
|
94
98
|
'unpublished, or the link was copied incompletely.', 'AGENT_REF_CODE_UNRESOLVED');
|
|
95
99
|
}
|
|
96
100
|
if (resolved.entity.kind !== 'agent') {
|
|
97
|
-
throw new AgentRefError(`"${value}" is a link to a ${resolved.entity.kind.replace(
|
|
101
|
+
throw new AgentRefError(`"${value}" is a link to a ${resolved.entity.kind.replace(RESOLVE_BY_CODE_RE, ' ')}, not an agent.`, 'AGENT_REF_NOT_AN_AGENT');
|
|
98
102
|
}
|
|
99
103
|
return {
|
|
100
104
|
agentId: resolved.entity.id,
|
|
@@ -115,7 +119,7 @@ async function resolveAgentRef(input, options = {}) {
|
|
|
115
119
|
firstPartyHosts: cliFirstPartyHosts(options.baseURL),
|
|
116
120
|
});
|
|
117
121
|
if (!inspected) {
|
|
118
|
-
throw
|
|
122
|
+
throw RESOLVE_AGENT_REF_RE.test(value)
|
|
119
123
|
? new AgentRefError(`"${value}" is not a ${data_provider_1.BRAND.displayName} link, so it was not followed. Pass an agent ` +
|
|
120
124
|
`id or a link on ${data_provider_1.BRAND.displayName}'s own site.`, 'AGENT_REF_FOREIGN')
|
|
121
125
|
: unsupported(value);
|
|
@@ -137,7 +141,7 @@ async function resolveAgentRef(input, options = {}) {
|
|
|
137
141
|
return resolveByCode(value, attribution, options);
|
|
138
142
|
throw unsupported(value);
|
|
139
143
|
default:
|
|
140
|
-
throw new AgentRefError(`"${value}" is a link to a ${link.kind.replace(
|
|
144
|
+
throw new AgentRefError(`"${value}" is a link to a ${link.kind.replace(RESOLVE_BY_CODE_RE, ' ')}, not an agent.`, 'AGENT_REF_NOT_AN_AGENT');
|
|
141
145
|
}
|
|
142
146
|
}
|
|
143
147
|
function unsupported(value) {
|
|
@@ -164,5 +168,5 @@ function installAttribution(attribution) {
|
|
|
164
168
|
}
|
|
165
169
|
/** Quote a URL for a POSIX shell: `?` and `&` in an attributed link are metacharacters. */
|
|
166
170
|
function shellQuote(value) {
|
|
167
|
-
return
|
|
171
|
+
return SHELL_QUOTE_RE.test(value) ? value : `'${value.replace(SHELL_QUOTE_RE_2, `'\\''`)}'`;
|
|
168
172
|
}
|
|
@@ -17,6 +17,7 @@ exports.triggersMissingFromAgentList = triggersMissingFromAgentList;
|
|
|
17
17
|
exports.isSuspended = isSuspended;
|
|
18
18
|
exports.sourceLabel = sourceLabel;
|
|
19
19
|
exports.systemManagedLegend = systemManagedLegend;
|
|
20
|
+
const IS_SYSTEM_MANAGED_RE = /^commitment-(check|reflect):/;
|
|
20
21
|
function idOf(row) {
|
|
21
22
|
return typeof row.id === 'string' ? row.id : '';
|
|
22
23
|
}
|
|
@@ -26,7 +27,7 @@ function scopeKindOf(row) {
|
|
|
26
27
|
}
|
|
27
28
|
/** Created and run by the platform for a Commitment, not authored by the person. */
|
|
28
29
|
function isSystemManaged(row) {
|
|
29
|
-
return row.producerOwned === true ||
|
|
30
|
+
return row.producerOwned === true || IS_SYSTEM_MANAGED_RE.test(idOf(row));
|
|
30
31
|
}
|
|
31
32
|
/**
|
|
32
33
|
* The universal-list rows the per-agent facade did not return, each tagged `systemManaged`.
|
|
@@ -35,6 +35,9 @@ const config_1 = require("./config");
|
|
|
35
35
|
const widgetTerminalText_1 = require("./widgetTerminalText");
|
|
36
36
|
const publicEndpoints_generated_1 = require("./publicEndpoints.generated");
|
|
37
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 = /\/$/;
|
|
38
41
|
/**
|
|
39
42
|
* Why a question was dismissed when no terminal exists to ask it on. It is the
|
|
40
43
|
* REASON for a dismissal, never an answer: it travels as the value of the
|
|
@@ -759,7 +762,7 @@ function seqGapNotice(gaps, options = {}) {
|
|
|
759
762
|
* stream never showed — and that is the only thing this answers yes to.
|
|
760
763
|
*/
|
|
761
764
|
function streamShowsRecordedText(streamed, recorded) {
|
|
762
|
-
const squash = (s) => s.replace(
|
|
765
|
+
const squash = (s) => s.replace(SQUASH_RE, '');
|
|
763
766
|
return squash(streamed).includes(squash(recorded));
|
|
764
767
|
}
|
|
765
768
|
const defaultStreamDebug = (line) => {
|
|
@@ -799,13 +802,13 @@ function describeRunPermission(event) {
|
|
|
799
802
|
}
|
|
800
803
|
/** `tail` is the end of `whole`, whitespace aside. */
|
|
801
804
|
function endsWithIgnoringWhitespace(whole, tail) {
|
|
802
|
-
const solid = (value) => value.replace(
|
|
805
|
+
const solid = (value) => value.replace(SQUASH_RE, '');
|
|
803
806
|
const wanted = solid(tail);
|
|
804
807
|
return wanted.length > 0 && solid(whole).endsWith(wanted);
|
|
805
808
|
}
|
|
806
809
|
/** `head` is the start of `whole`, whitespace aside. */
|
|
807
810
|
function startsWithIgnoringWhitespace(whole, head) {
|
|
808
|
-
const solid = (value) => value.replace(
|
|
811
|
+
const solid = (value) => value.replace(SQUASH_RE, '');
|
|
809
812
|
const wanted = solid(head);
|
|
810
813
|
return wanted.length > 0 && solid(whole).startsWith(wanted);
|
|
811
814
|
}
|
|
@@ -1928,7 +1931,7 @@ class AgenticStreamClient {
|
|
|
1928
1931
|
// there is nothing left to answer, and a late "no" would read as a person's.
|
|
1929
1932
|
if (prompt.signal.aborted)
|
|
1930
1933
|
return;
|
|
1931
|
-
const approved =
|
|
1934
|
+
const approved = HANDLE_PERMISSION_RE.test(answer.trim());
|
|
1932
1935
|
// Recorded before the decision is sent, so the call's end can never arrive first.
|
|
1933
1936
|
if (!approved && event.toolUseId)
|
|
1934
1937
|
this.deniedToolUseIds.add(event.toolUseId);
|
|
@@ -2856,5 +2859,5 @@ function toWebSocketOrigin(baseURL) {
|
|
|
2856
2859
|
url.pathname = '';
|
|
2857
2860
|
url.search = '';
|
|
2858
2861
|
url.hash = '';
|
|
2859
|
-
return url.toString().replace(
|
|
2862
|
+
return url.toString().replace(TO_WEB_SOCKET_ORIGIN_RE, '');
|
|
2860
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);
|