@skrr-ai/cli 0.1.146 → 0.1.148
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base-command.js +38 -21
- package/dist/commands/agent/message/send.d.ts +11 -0
- package/dist/commands/agent/message/send.js +34 -8
- package/dist/commands/agent-worker.js +2 -1
- package/dist/commands/agents/activity.js +2 -1
- package/dist/commands/agents/badge.js +10 -5
- package/dist/commands/agents/categories/index.js +2 -1
- package/dist/commands/agents/chat.d.ts +1 -0
- package/dist/commands/agents/chat.js +29 -1
- package/dist/commands/agents/create.js +4 -1
- package/dist/commands/agents/overview.js +2 -1
- package/dist/commands/agents/releases/create.js +2 -1
- package/dist/commands/agents/schedule-overview.js +3 -1
- package/dist/commands/agents/schedule.js +2 -1
- package/dist/commands/agents/spawn.js +9 -6
- package/dist/commands/agents/tools/auth.js +2 -1
- package/dist/commands/agents/tools/calls.js +2 -1
- package/dist/commands/agents/triggers/policy.js +11 -1
- package/dist/commands/agents/visibility.js +2 -1
- package/dist/commands/balance/show.js +28 -5
- package/dist/commands/balance/statement.js +2 -1
- package/dist/commands/commands.js +2 -1
- package/dist/commands/commitments/create.js +2 -1
- package/dist/commands/commitments/delivery.js +2 -1
- package/dist/commands/commitments/doctor.js +2 -1
- package/dist/commands/commitments/observations.js +2 -2
- package/dist/commands/commitments/operating-review.js +2 -1
- package/dist/commands/commitments/pack/preflight.js +2 -1
- package/dist/commands/commitments/preflight.js +5 -1
- package/dist/commands/commitments/trigger-status.js +2 -1
- package/dist/commands/commitments/wake-capabilities.d.ts +2 -0
- package/dist/commands/commitments/wake-capabilities.js +16 -0
- package/dist/commands/convos/messages.js +2 -1
- package/dist/commands/daemon/logs.js +18 -9
- package/dist/commands/daemon/usage.js +2 -1
- package/dist/commands/dm/messages.js +2 -1
- package/dist/commands/dm/thread/messages.js +2 -1
- package/dist/commands/dm/threads.js +2 -1
- package/dist/commands/doctor.js +2 -1
- package/dist/commands/goals/key-results/assess.js +2 -1
- package/dist/commands/goals/key-results/history.js +2 -1
- package/dist/commands/harnesses/forget.js +2 -1
- package/dist/commands/harnesses/show.js +12 -6
- package/dist/commands/inbox/index.js +4 -3
- package/dist/commands/initiatives/decide.js +2 -1
- package/dist/commands/instructions/diff.js +2 -1
- package/dist/commands/instructions/show.js +2 -1
- package/dist/commands/login.js +4 -2
- package/dist/commands/machines/dedicated/cp.js +2 -1
- package/dist/commands/machines/dedicated/power/set.js +2 -1
- package/dist/commands/machines/show.js +2 -1
- package/dist/commands/memory/maintain.js +2 -1
- package/dist/commands/memory/read.js +2 -1
- package/dist/commands/memory/rebuild-index.js +2 -1
- package/dist/commands/memory/rebuild.js +2 -1
- package/dist/commands/memory/search.js +2 -1
- package/dist/commands/messages/list.js +2 -1
- package/dist/commands/revoke-daemon.js +2 -1
- package/dist/commands/revoke-token.js +2 -1
- package/dist/commands/search/all.js +14 -7
- package/dist/commands/search/workspace.js +2 -1
- package/dist/commands/set-capabilities.js +2 -1
- package/dist/commands/skills/browse.js +8 -2
- package/dist/commands/spaces/auto-executor/preview.js +3 -2
- package/dist/commands/spaces/auto-executor/runs.js +4 -1
- package/dist/commands/spaces/workflow-templates/extract.d.ts +1 -0
- package/dist/commands/spaces/workflow-templates/extract.js +9 -1
- package/dist/commands/spaces/workflows/events.js +6 -3
- package/dist/commands/spaces/workflows/run.js +5 -3
- package/dist/commands/spaces/workflows/update.js +2 -1
- package/dist/commands/store/gallery-admissions/preview.js +2 -1
- package/dist/commands/store/publishers/profile/handle.js +2 -1
- package/dist/commands/tasks/comments/anchor.js +23 -9
- package/dist/commands/tasks/complete.js +4 -2
- package/dist/commands/tasks/create-tree.js +7 -3
- package/dist/commands/tasks/create.js +2 -1
- package/dist/commands/tasks/deliverable/add.js +2 -1
- package/dist/commands/tasks/deliverable/archive.js +2 -1
- package/dist/commands/tasks/deliverable/list.js +2 -1
- package/dist/commands/tasks/expectations/assess.js +2 -1
- package/dist/commands/tasks/labels/create.js +2 -1
- package/dist/commands/tasks/preflight.js +4 -2
- package/dist/commands/tasks/ready.js +2 -1
- package/dist/commands/tasks/result/submit.js +2 -1
- package/dist/commands/tasks/updates/add.js +2 -1
- package/dist/commands/tasks/wait.js +2 -1
- package/dist/commands/token/list.js +2 -1
- package/dist/commands/token/mint.js +2 -1
- package/dist/commands/wiki/write.js +14 -7
- package/dist/hooks/command-not-found.js +2 -1
- package/dist/lib/agent-chat-start.d.ts +77 -0
- package/dist/lib/agent-chat-start.js +169 -0
- package/dist/lib/agent-config.js +2 -1
- package/dist/lib/agent-endpoints.js +4 -2
- package/dist/lib/agent-evals.js +2 -1
- package/dist/lib/agent-guide-reference-gate.js +22 -11
- package/dist/lib/agent-guides.js +4 -1
- package/dist/lib/agent-instructions.js +5 -1
- package/dist/lib/agent-ref.js +8 -4
- package/dist/lib/agent-trigger-listing.js +2 -1
- package/dist/lib/agentic-stream.js +8 -5
- package/dist/lib/api-error-reason.js +2 -1
- package/dist/lib/api-fetch.js +5 -3
- package/dist/lib/appData.js +6 -6
- package/dist/lib/appInstallations.js +10 -5
- package/dist/lib/appsCheck.js +2 -1
- package/dist/lib/auth-failure.js +2 -1
- package/dist/lib/auth-storage.js +2 -1
- package/dist/lib/balance.d.ts +33 -3
- package/dist/lib/balance.js +39 -7
- package/dist/lib/capability-matrix.js +4 -2
- package/dist/lib/cli-runtime.js +2 -1
- package/dist/lib/code-handover.js +8 -3
- package/dist/lib/command-hygiene.js +28 -12
- package/dist/lib/command-manifest.js +6 -3
- package/dist/lib/commitment-attention-copy.js +2 -1
- package/dist/lib/commitment-event-wakes.js +9 -0
- package/dist/lib/commitment-product.js +5 -3
- package/dist/lib/commitment-terms.js +2 -1
- package/dist/lib/commitments.d.ts +13 -0
- package/dist/lib/commitments.js +24 -9
- package/dist/lib/compasses.js +2 -1
- package/dist/lib/completion-index.js +2 -1
- package/dist/lib/computer-files.js +8 -6
- package/dist/lib/config.js +11 -5
- package/dist/lib/conversation-search.js +4 -2
- package/dist/lib/daemon-installer.js +6 -2
- package/dist/lib/daemon-maintenance.js +2 -1
- package/dist/lib/daemon-ref.js +2 -1
- package/dist/lib/daemonBroker.js +6 -3
- package/dist/lib/daemonBrokerRefusal.js +4 -2
- package/dist/lib/daemonHandoff.js +14 -7
- package/dist/lib/daemonIslandProfile.js +2 -1
- package/dist/lib/dedicated-copy.js +9 -3
- package/dist/lib/dedicated-exec.js +2 -1
- package/dist/lib/dedicated-keep-awake.js +2 -1
- package/dist/lib/dedicated-machines.js +9 -5
- package/dist/lib/dedicated-service.js +2 -1
- package/dist/lib/dedicated-ssh.js +5 -3
- package/dist/lib/deployed-build.js +2 -1
- package/dist/lib/device-code.js +4 -3
- package/dist/lib/dpop-auth.js +2 -1
- package/dist/lib/earnings.js +2 -1
- package/dist/lib/exec-runtime-binary.js +5 -3
- package/dist/lib/first-party-harness-broker.js +4 -3
- package/dist/lib/first-party-harness-managed.js +2 -1
- package/dist/lib/first-party-harness-startup-update.js +8 -4
- package/dist/lib/first-party-harness-update.js +2 -1
- package/dist/lib/first-party-harness.js +2 -1
- package/dist/lib/format.js +8 -4
- package/dist/lib/git-task.js +10 -5
- package/dist/lib/github-tools.js +6 -3
- package/dist/lib/harnesses.js +4 -2
- package/dist/lib/hosted-machines.js +2 -1
- package/dist/lib/html-text.js +33 -16
- package/dist/lib/ingress.js +2 -1
- package/dist/lib/instruction-blocks.js +2 -1
- package/dist/lib/iso-instant.js +5 -3
- package/dist/lib/keychain.js +15 -5
- package/dist/lib/label-scope.js +2 -1
- package/dist/lib/live-runtime-binary.js +10 -7
- package/dist/lib/local-skills.js +10 -6
- package/dist/lib/login.js +3 -2
- package/dist/lib/machine-audit.js +2 -1
- package/dist/lib/machine-daemon-log.js +2 -1
- package/dist/lib/machine-services.js +2 -1
- package/dist/lib/memory-history-session.js +2 -1
- package/dist/lib/memory-sync.js +6 -2
- package/dist/lib/message-intent.d.ts +10 -0
- package/dist/lib/node-adapter.js +4 -2
- package/dist/lib/northstars.js +4 -2
- package/dist/lib/oauthLogin.js +16 -7
- package/dist/lib/open-target.js +8 -4
- package/dist/lib/option-hint.js +2 -4
- package/dist/lib/outbox.js +2 -1
- package/dist/lib/planOutcome.d.ts +5 -3
- package/dist/lib/planOutcome.js +7 -4
- package/dist/lib/platform-update-local.js +2 -3
- package/dist/lib/preflight-copy.js +31 -0
- package/dist/lib/rate-limit-retry.js +2 -1
- package/dist/lib/reflection.js +2 -1
- package/dist/lib/request-field-flags.js +2 -1
- package/dist/lib/runtime-start-verification.js +2 -1
- package/dist/lib/schedule.js +2 -1
- package/dist/lib/scoped-memory-command.js +7 -3
- package/dist/lib/search-display.js +11 -4
- package/dist/lib/skill-store-pagination.js +2 -1
- package/dist/lib/space-notebook.js +5 -3
- package/dist/lib/store-listing.js +2 -1
- package/dist/lib/task-agent-context-capabilities.js +2 -1
- package/dist/lib/task-asset-upload.js +7 -3
- package/dist/lib/task-closure.js +2 -1
- package/dist/lib/task-economics.js +2 -1
- package/dist/lib/task-execution.js +16 -8
- package/dist/lib/task-extras.js +4 -2
- package/dist/lib/task-operation-watch.js +2 -1
- package/dist/lib/task-preflight.js +3 -2
- package/dist/lib/task-recurrence-summary.js +4 -2
- package/dist/lib/task-runtime-headers.js +10 -5
- package/dist/lib/task-transcript.js +3 -2
- package/dist/lib/task-transfer.js +9 -5
- package/dist/lib/tasks.js +2 -1
- package/dist/lib/triggers.d.ts +21 -0
- package/dist/lib/triggers.js +41 -3
- package/dist/lib/update-check.js +12 -7
- package/dist/lib/usage-discovery.js +2 -1
- package/dist/lib/usd-micros.js +2 -1
- package/dist/lib/web-url.js +2 -1
- package/dist/lib/widgetCheck.js +15 -9
- package/dist/lib/widgetStaticScan.js +26 -14
- package/dist/lib/workflow-run-view.js +5 -3
- package/dist/lib/workflow-templates.d.ts +10 -0
- package/dist/lib/workflow-templates.js +47 -0
- package/dist/lib/write-target.js +4 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/authHelper.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/commitmentExecutionContract.js +22 -12
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerUse.js +4 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelope.js +7 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.js +6 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonConsentProof.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonPair.js +16 -7
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +4 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/desktopDaemonProof.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/desktopWire.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.js +11 -7
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceKey.js +7 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/dpop.js +8 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarness.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessChannels.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessUpdater.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/githubPushRefusal.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/guidedUpdate.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/independentMachineReservation.js +8 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/kek/macos.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/liveState.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/loginWithLocalhost.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/loopbackHttp.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/machineUuid.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profileStateDir.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/recoveryCode.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.js +3 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releasePolicy.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releaseVersions.js +6 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/restartArtifact.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/spawnEnv.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/telemetryRedaction.js +7 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/authHelper.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/commitmentExecutionContract.js +27 -18
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerUse.js +6 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelope.js +11 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.js +6 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonConsentProof.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonPair.js +20 -8
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +5 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/desktopDaemonProof.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/desktopWire.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.js +11 -7
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceKey.js +11 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/dpop.js +12 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarness.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessChannels.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessUpdater.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/githubPushRefusal.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/guidedUpdate.js +5 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/independentMachineReservation.js +10 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/kek/macos.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/liveState.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/loginWithLocalhost.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/loopbackHttp.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/machineUuid.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profileStateDir.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/recoveryCode.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.js +3 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releasePolicy.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releaseVersions.js +6 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/restartArtifact.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/spawnEnv.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/telemetryRedaction.js +11 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +20519 -20130
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/loopback-server.js +4 -2
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.js +10 -6
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/loopback-server.js +4 -2
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.js +10 -6
- package/dist/node_modules/@skrr-ai/inference-broker/package.json +1 -1
- package/oclif.manifest.json +17 -2
- package/package.json +1 -1
|
@@ -67,6 +67,8 @@ const base_command_1 = require("../base-command");
|
|
|
67
67
|
const api_fetch_1 = require("./api-fetch");
|
|
68
68
|
const dedicated_machines_1 = require("./dedicated-machines");
|
|
69
69
|
const dedicated_file_retry_1 = require("./dedicated-file-retry");
|
|
70
|
+
const PARSE_COMPUTER_FILE_TAG_RE = /^\d+$/;
|
|
71
|
+
const DESCRIBE_COMPUTER_FILE_REFUSAL_RE = /path|file|folder|directory/i;
|
|
70
72
|
/**
|
|
71
73
|
* The lease could not say which generation is running — a server that does not
|
|
72
74
|
* publish it yet, or a lease with none. File calls cannot be fenced without
|
|
@@ -371,10 +373,10 @@ function parseComputerFileTag(text) {
|
|
|
371
373
|
}
|
|
372
374
|
const parts = trimmed.split(':');
|
|
373
375
|
if ((parts.length === 3 || parts.length === 4) &&
|
|
374
|
-
|
|
375
|
-
|
|
376
|
+
PARSE_COMPUTER_FILE_TAG_RE.test(parts[0]) &&
|
|
377
|
+
PARSE_COMPUTER_FILE_TAG_RE.test(parts[1]) &&
|
|
376
378
|
Number.isSafeInteger(Number(parts[1])) &&
|
|
377
|
-
|
|
379
|
+
PARSE_COMPUTER_FILE_TAG_RE.test(parts[2]) &&
|
|
378
380
|
(parts.length === 3 || CONTENTS_TAG.test(parts[3]))) {
|
|
379
381
|
return {
|
|
380
382
|
inode: parts[0],
|
|
@@ -397,12 +399,12 @@ function entityTagOf(tag) {
|
|
|
397
399
|
function isEntityTag(value) {
|
|
398
400
|
const tag = value;
|
|
399
401
|
return (typeof tag?.inode === 'string' &&
|
|
400
|
-
|
|
402
|
+
PARSE_COMPUTER_FILE_TAG_RE.test(tag.inode) &&
|
|
401
403
|
typeof tag?.size === 'number' &&
|
|
402
404
|
Number.isSafeInteger(tag.size) &&
|
|
403
405
|
tag.size >= 0 &&
|
|
404
406
|
typeof tag?.mtimeNs === 'string' &&
|
|
405
|
-
|
|
407
|
+
PARSE_COMPUTER_FILE_TAG_RE.test(tag.mtimeNs) &&
|
|
406
408
|
(tag.contents === undefined ||
|
|
407
409
|
(typeof tag.contents === 'string' && CONTENTS_TAG.test(tag.contents))));
|
|
408
410
|
}
|
|
@@ -617,7 +619,7 @@ function describeComputerFileRefusal(refusal, ctx) {
|
|
|
617
619
|
case 'not_found': {
|
|
618
620
|
// `details.path` marks a path refusal; without it the machine itself was
|
|
619
621
|
// not found — "No computer exists by that machine id."
|
|
620
|
-
if (refusal.details?.path ||
|
|
622
|
+
if (refusal.details?.path || DESCRIBE_COMPUTER_FILE_REFUSAL_RE.test(refusal.message)) {
|
|
621
623
|
return `${refusal.message} Look with \`${bin} machines dedicated ls ${lease} <dir>\`.`;
|
|
622
624
|
}
|
|
623
625
|
return `${refusal.message} List your machines with \`${bin} machines dedicated list\`.`;
|
package/dist/lib/config.js
CHANGED
|
@@ -60,6 +60,10 @@ const auth_diagnostics_1 = require("./auth-diagnostics");
|
|
|
60
60
|
const cli_id_1 = require("./cli-id");
|
|
61
61
|
const device_id_1 = require("./device-id");
|
|
62
62
|
const publicEndpoints_generated_1 = require("./publicEndpoints.generated");
|
|
63
|
+
const ENVIRONMENT_FOR_BASE_URL_RE = /\/+$/;
|
|
64
|
+
const CANONICALIZE_KNOWN_BASE_URL_RE = /^http:\/\//;
|
|
65
|
+
const CANONICALIZE_KNOWN_BASE_URL_RE_2 = /^https:\/\/www\./;
|
|
66
|
+
const ENV_OVERLAY_VALUE_RE = /^OVERSKY_/;
|
|
63
67
|
// Both from config/public-endpoints.json, the one domain contract, rather than a
|
|
64
68
|
// fourth hand-copied pair. The CLI previously knew only about dev — there was no
|
|
65
69
|
// prod constant at all — which matters more here than it looks: baseURL decides
|
|
@@ -90,7 +94,9 @@ exports.ENVIRONMENT_BASE_URLS = {
|
|
|
90
94
|
};
|
|
91
95
|
/** Which deployment a base URL denotes, or null for a self-hosted server. */
|
|
92
96
|
function environmentForBaseURL(value) {
|
|
93
|
-
const normalized = canonicalizeKnownBaseURL(value)
|
|
97
|
+
const normalized = canonicalizeKnownBaseURL(value)
|
|
98
|
+
.replace(ENVIRONMENT_FOR_BASE_URL_RE, '')
|
|
99
|
+
.toLowerCase();
|
|
94
100
|
for (const [name, url] of Object.entries(exports.ENVIRONMENT_BASE_URLS)) {
|
|
95
101
|
if (normalized === url.toLowerCase())
|
|
96
102
|
return name;
|
|
@@ -124,11 +130,11 @@ function describeDeployment(baseURL) {
|
|
|
124
130
|
return env ? `${env} (${baseURL})` : baseURL;
|
|
125
131
|
}
|
|
126
132
|
function canonicalizeKnownBaseURL(value) {
|
|
127
|
-
const trimmed = value.trim().replace(
|
|
128
|
-
const normalized = trimmed.toLowerCase().replace(
|
|
133
|
+
const trimmed = value.trim().replace(ENVIRONMENT_FOR_BASE_URL_RE, '');
|
|
134
|
+
const normalized = trimmed.toLowerCase().replace(CANONICALIZE_KNOWN_BASE_URL_RE, 'https://');
|
|
129
135
|
if (normalized === exports.LEGACY_DEV_BASE_URL)
|
|
130
136
|
return exports.CANONICAL_DEV_BASE_URL;
|
|
131
|
-
const withoutWww = normalized.replace(
|
|
137
|
+
const withoutWww = normalized.replace(CANONICALIZE_KNOWN_BASE_URL_RE_2, 'https://');
|
|
132
138
|
// Checked after `www.` is stripped, so `https://www.oversky.ai` folds too.
|
|
133
139
|
if (withoutWww === exports.LEGACY_PROD_BASE_URL)
|
|
134
140
|
return exports.CANONICAL_PROD_BASE_URL;
|
|
@@ -201,7 +207,7 @@ const ENV_VAR = {
|
|
|
201
207
|
let warnedEnvPrefixConflict = false;
|
|
202
208
|
function envOverlayValue(key) {
|
|
203
209
|
const legacyName = ENV_VAR[key];
|
|
204
|
-
const renamedName = legacyName.replace(
|
|
210
|
+
const renamedName = legacyName.replace(ENV_OVERLAY_VALUE_RE, 'SKRR_');
|
|
205
211
|
const legacy = process.env[legacyName]?.trim();
|
|
206
212
|
const renamed = process.env[renamedName]?.trim();
|
|
207
213
|
if (legacy && renamed && legacy !== renamed && !warnedEnvPrefixConflict) {
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizedSnippetLength = normalizedSnippetLength;
|
|
4
4
|
exports.compactMessageSearchHit = compactMessageSearchHit;
|
|
5
|
+
const FIND_QUERY_MATCH_RE = /[^\p{L}\p{N}]+/u;
|
|
6
|
+
const COMPACT_MESSAGE_SEARCH_HIT_RE = /\s+/g;
|
|
5
7
|
const MAX_SEARCH_SNIPPET_CHARS = 4000;
|
|
6
8
|
function normalizedSnippetLength(value) {
|
|
7
9
|
if (!Number.isFinite(value))
|
|
@@ -21,7 +23,7 @@ function findQueryMatch(text, query) {
|
|
|
21
23
|
// present, center on the earliest substantive query token so the bounded CLI
|
|
22
24
|
// result still explains why it matched instead of truncating just before the
|
|
23
25
|
// highlighted word returned by the server crop.
|
|
24
|
-
const tokens = Array.from(new Set(normalizedQuery.split(
|
|
26
|
+
const tokens = Array.from(new Set(normalizedQuery.split(FIND_QUERY_MATCH_RE).filter((token) => token.length >= 2)));
|
|
25
27
|
let best = null;
|
|
26
28
|
for (const token of tokens) {
|
|
27
29
|
const at = loweredText.indexOf(token);
|
|
@@ -34,7 +36,7 @@ function findQueryMatch(text, query) {
|
|
|
34
36
|
function compactMessageSearchHit(message, requestedSnippetLength, query = '') {
|
|
35
37
|
const limit = normalizedSnippetLength(requestedSnippetLength);
|
|
36
38
|
const normalizedText = String(message.text ?? '')
|
|
37
|
-
.replace(
|
|
39
|
+
.replace(COMPACT_MESSAGE_SEARCH_HIT_RE, ' ')
|
|
38
40
|
.trim();
|
|
39
41
|
const normalizedQuery = query.trim();
|
|
40
42
|
let text = normalizedText;
|
|
@@ -63,6 +63,8 @@ const node_os_1 = __importDefault(require("node:os"));
|
|
|
63
63
|
const node_path_1 = __importDefault(require("node:path"));
|
|
64
64
|
const auth_core_1 = require("@skrr-ai/auth-core");
|
|
65
65
|
Object.defineProperty(exports, "isTrustedArtifactOrigin", { enumerable: true, get: function () { return auth_core_1.isTrustedArtifactOrigin; } });
|
|
66
|
+
const DAEMON_FEED_BASE_RE = /\/+$/;
|
|
67
|
+
const GET_BYTES_WITH_TIMEOUT_RE = /^\d+$/;
|
|
66
68
|
/** Public CloudFront feed. Mirrors the daemon's own `CLOUDFRONT_FEED_BASE`. */
|
|
67
69
|
exports.DEFAULT_DAEMON_FEED_BASE = 'https://updates.skrr.ai/daemon';
|
|
68
70
|
/** Same override the daemon honours, so one env var steers both. */
|
|
@@ -74,7 +76,7 @@ const MAX_ARTIFACT_BYTES = 256 * 1_024 * 1_024;
|
|
|
74
76
|
const MANIFEST_TIMEOUT_MS = 30_000;
|
|
75
77
|
const ARTIFACT_TIMEOUT_MS = 10 * 60_000;
|
|
76
78
|
function daemonFeedBase(env = process.env) {
|
|
77
|
-
return (env[exports.DAEMON_FEED_BASE_ENV]?.trim() || exports.DEFAULT_DAEMON_FEED_BASE).replace(
|
|
79
|
+
return (env[exports.DAEMON_FEED_BASE_ENV]?.trim() || exports.DEFAULT_DAEMON_FEED_BASE).replace(DAEMON_FEED_BASE_RE, '');
|
|
78
80
|
}
|
|
79
81
|
/**
|
|
80
82
|
* Where the fetched binary lands. `exec-runtime-binary.ts` already looks here, so a
|
|
@@ -158,7 +160,9 @@ async function getBytesWithTimeout(url, timeoutMs, maxBytes, fetchImpl, signal)
|
|
|
158
160
|
if (!response.ok)
|
|
159
161
|
throw new Error(`returned HTTP ${response.status}`);
|
|
160
162
|
const contentLength = response.headers.get('content-length');
|
|
161
|
-
if (contentLength &&
|
|
163
|
+
if (contentLength &&
|
|
164
|
+
GET_BYTES_WITH_TIMEOUT_RE.test(contentLength.trim()) &&
|
|
165
|
+
Number(contentLength) > maxBytes) {
|
|
162
166
|
throw new DownloadSizeLimitError(maxBytes);
|
|
163
167
|
}
|
|
164
168
|
if (!response.body)
|
|
@@ -22,6 +22,7 @@ const data_provider_1 = require("@skrr-ai/data-provider");
|
|
|
22
22
|
const format_1 = require("./format");
|
|
23
23
|
const hosted_machines_1 = require("./hosted-machines");
|
|
24
24
|
const machines_1 = require("./machines");
|
|
25
|
+
const NORMALIZE_SPACES_RE = /\s+/g;
|
|
25
26
|
/**
|
|
26
27
|
* daemon-maintenance.ts — the owner's pause on one of their own machines, from the
|
|
27
28
|
* terminal (`skrr daemon maintenance status | hold | resume | attest`; OSK-19107,
|
|
@@ -709,7 +710,7 @@ async function runStatus(input, io) {
|
|
|
709
710
|
};
|
|
710
711
|
}
|
|
711
712
|
function normalizeSpaces(text) {
|
|
712
|
-
return text.replace(
|
|
713
|
+
return text.replace(NORMALIZE_SPACES_RE, ' ').trim();
|
|
713
714
|
}
|
|
714
715
|
/**
|
|
715
716
|
* `hold`: take the hold, and optionally wait for the machine to be ready.
|
package/dist/lib/daemon-ref.js
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
exports.formatDaemonRef = formatDaemonRef;
|
|
21
21
|
exports.normalizeDaemonRef = normalizeDaemonRef;
|
|
22
|
+
const NORMALIZE_DAEMON_REF_RE = /(?:\.{3}|…)$/;
|
|
22
23
|
/** Prefix the short form carries so a truncated id is visibly truncated. */
|
|
23
24
|
const DISPLAY_PREFIX = 'd_';
|
|
24
25
|
/**
|
|
@@ -42,6 +43,6 @@ function normalizeDaemonRef(input) {
|
|
|
42
43
|
let out = input.trim();
|
|
43
44
|
if (out.toLowerCase().startsWith(DISPLAY_PREFIX))
|
|
44
45
|
out = out.slice(DISPLAY_PREFIX.length);
|
|
45
|
-
out = out.replace(
|
|
46
|
+
out = out.replace(NORMALIZE_DAEMON_REF_RE, '');
|
|
46
47
|
return out.trim();
|
|
47
48
|
}
|
package/dist/lib/daemonBroker.js
CHANGED
|
@@ -108,6 +108,9 @@ const harness_context_1 = require("./harness-context");
|
|
|
108
108
|
const cli_identity_1 = require("./cli-identity");
|
|
109
109
|
const daemonRestartWait_1 = require("./daemonRestartWait");
|
|
110
110
|
const keychain_1 = require("./keychain");
|
|
111
|
+
const NORMALIZE_BASE_URL_RE = /\/+$/;
|
|
112
|
+
const RESOLVE_PROFILE_BOOTSTRAP_PATHS_RE = /^daemon-island\.(?!default\.json$)[^.]+\.json$/;
|
|
113
|
+
const ADOPTION_LOCK_PATH_RE = /[^A-Za-z0-9._-]/g;
|
|
111
114
|
const REQUEST_TIMEOUT_MS = 20_000;
|
|
112
115
|
/**
|
|
113
116
|
* Normalize a base URL for equality comparison. Mirrors the daemon-side
|
|
@@ -118,7 +121,7 @@ const REQUEST_TIMEOUT_MS = 20_000;
|
|
|
118
121
|
function normalizeBaseUrl(u) {
|
|
119
122
|
if (typeof u !== 'string' || u.length === 0)
|
|
120
123
|
return null;
|
|
121
|
-
const trimmed = u.trim().replace(
|
|
124
|
+
const trimmed = u.trim().replace(NORMALIZE_BASE_URL_RE, '');
|
|
122
125
|
if (trimmed.length === 0)
|
|
123
126
|
return null;
|
|
124
127
|
try {
|
|
@@ -160,7 +163,7 @@ function resolveBootstrapPath(profile = 'default') {
|
|
|
160
163
|
/** Build deterministic non-default bootstrap paths from a daemon config directory. */
|
|
161
164
|
function resolveProfileBootstrapPaths(primary, entryNames) {
|
|
162
165
|
const extras = entryNames
|
|
163
|
-
.filter((name) =>
|
|
166
|
+
.filter((name) => RESOLVE_PROFILE_BOOTSTRAP_PATHS_RE.test(name))
|
|
164
167
|
.sort()
|
|
165
168
|
.map((name) => path.join(path.dirname(primary), name));
|
|
166
169
|
return [primary, ...extras];
|
|
@@ -1280,7 +1283,7 @@ function daemonDidNotAnswer(failure) {
|
|
|
1280
1283
|
}
|
|
1281
1284
|
/** The adoption lock: one per config root and profile. */
|
|
1282
1285
|
function adoptionLockPath(profile) {
|
|
1283
|
-
const safe = profile.replace(
|
|
1286
|
+
const safe = profile.replace(ADOPTION_LOCK_PATH_RE, '_') || 'default';
|
|
1284
1287
|
return path.join((0, config_1.configRoot)(), `cli-session-adopt.${safe}.lock`);
|
|
1285
1288
|
}
|
|
1286
1289
|
function storedAccessToken(baseURL) {
|
|
@@ -6,6 +6,8 @@ exports.describeGuestDaemonUnavailable = describeGuestDaemonUnavailable;
|
|
|
6
6
|
exports.describeLocalDaemonUnavailable = describeLocalDaemonUnavailable;
|
|
7
7
|
exports.describeBrokerFailure = describeBrokerFailure;
|
|
8
8
|
const daemon_command_hint_1 = require("./daemon-command-hint");
|
|
9
|
+
const SENTENCE_RE = /[.!?]$/;
|
|
10
|
+
const DESCRIBE_LOCAL_DAEMON_UNAVAILABLE_RE = /[.]$/;
|
|
9
11
|
/**
|
|
10
12
|
* True when a daemon ANSWERED the hand-off and refused it — as opposed to no
|
|
11
13
|
* daemon being there to ask (`no_bootstrap`, a stale descriptor nobody listens
|
|
@@ -54,7 +56,7 @@ function sentence(detail) {
|
|
|
54
56
|
const d = (detail ?? '').trim();
|
|
55
57
|
if (!d)
|
|
56
58
|
return '';
|
|
57
|
-
return
|
|
59
|
+
return SENTENCE_RE.test(d) ? ` ${d}` : ` ${d}.`;
|
|
58
60
|
}
|
|
59
61
|
/**
|
|
60
62
|
* Describe a broker failure for a person, or null when there is nothing to
|
|
@@ -254,7 +256,7 @@ function describeLocalDaemonUnavailable(failure, bin = 'skrr') {
|
|
|
254
256
|
else if (failure.reason === 'bootstrap_parse' ||
|
|
255
257
|
failure.descriptorState === 'unreadable' ||
|
|
256
258
|
failure.descriptorState === 'invalid') {
|
|
257
|
-
headline = `${who} is not available: its sign-in hand-off${where} could not be read${failure.detail ? ` (${failure.detail.replace(
|
|
259
|
+
headline = `${who} is not available: its sign-in hand-off${where} could not be read${failure.detail ? ` (${failure.detail.replace(DESCRIBE_LOCAL_DAEMON_UNAVAILABLE_RE, '')})` : ''}.`;
|
|
258
260
|
}
|
|
259
261
|
else if (failure.descriptorState === 'dead_pid') {
|
|
260
262
|
headline =
|
|
@@ -11,6 +11,13 @@ const dedicated_service_1 = require("./dedicated-service");
|
|
|
11
11
|
const exec_runtime_binary_1 = require("./exec-runtime-binary");
|
|
12
12
|
const auth_core_1 = require("@skrr-ai/auth-core");
|
|
13
13
|
const keychain_1 = require("./keychain");
|
|
14
|
+
const WINDOWS_SHIM_RE = /\.(cmd|bat)$/i;
|
|
15
|
+
const PARSE_ID_PROVENANCE_RE = /id-source=([A-Za-z0-9._:-]+)/;
|
|
16
|
+
const PARSE_ID_PROVENANCE_RE_2 = /machine-uuid=([A-Za-z0-9._:-]+)/;
|
|
17
|
+
const PARSE_ID_PROVENANCE_RE_3 = /server=(\S+)/;
|
|
18
|
+
const CANONICAL_SERVER_RE = /\/+$/;
|
|
19
|
+
const FIRST_MEANINGFUL_LINE_RE = /^[{}]/;
|
|
20
|
+
const CHECK_LOCAL_DAEMON_MACHINE_IDENTITY_RE = /unknown command/i;
|
|
14
21
|
/**
|
|
15
22
|
* Ceilings, not expectations. Both calls finish in milliseconds when anything is
|
|
16
23
|
* working; these exist so that when something is NOT working the login ends.
|
|
@@ -39,7 +46,7 @@ function runOversky(binary, args, opts) {
|
|
|
39
46
|
// failed on EVERY Windows login and reported it as the daemon refusing the
|
|
40
47
|
// bundle. Restricted to the shim case so real binaries keep the argv-array
|
|
41
48
|
// exec path, which needs no quoting rules to be right.
|
|
42
|
-
const isWinShim = process.platform === 'win32' &&
|
|
49
|
+
const isWinShim = process.platform === 'win32' && WINDOWS_SHIM_RE.test(binary);
|
|
43
50
|
const child = (0, node_child_process_1.spawn)(binary, (0, exec_runtime_binary_1.normalizeRuntimeGlobalArgs)(args), {
|
|
44
51
|
// stderr is CAPTURED, not discarded. Discarding it cost a debugging cycle
|
|
45
52
|
// on the first real run: the daemon exited non-zero with
|
|
@@ -118,11 +125,11 @@ function parseIdProvenance(stderr) {
|
|
|
118
125
|
const line = stderr.split('\n').find((l) => l.includes('skrrd:accept-handoff'));
|
|
119
126
|
if (!line)
|
|
120
127
|
return {};
|
|
121
|
-
const idSource =
|
|
122
|
-
const machineUuid =
|
|
128
|
+
const idSource = PARSE_ID_PROVENANCE_RE.exec(line)?.[1];
|
|
129
|
+
const machineUuid = PARSE_ID_PROVENANCE_RE_2.exec(line)?.[1];
|
|
123
130
|
// Any non-space run: this one is a URL, and a URL contains characters the
|
|
124
131
|
// other two never do.
|
|
125
|
-
const daemonServer =
|
|
132
|
+
const daemonServer = PARSE_ID_PROVENANCE_RE_3.exec(line)?.[1];
|
|
126
133
|
return { idSource, machineUuid, daemonServer };
|
|
127
134
|
}
|
|
128
135
|
/**
|
|
@@ -161,7 +168,7 @@ function describeDelivery(opts) {
|
|
|
161
168
|
* is the fold the rest of the CLI already compares through.
|
|
162
169
|
*/
|
|
163
170
|
function canonicalServer(url) {
|
|
164
|
-
return (0, config_1.canonicalizeKnownBaseURL)(url).trim().replace(
|
|
171
|
+
return (0, config_1.canonicalizeKnownBaseURL)(url).trim().replace(CANONICAL_SERVER_RE, '').toLowerCase();
|
|
165
172
|
}
|
|
166
173
|
/** The most useful line of a failure, so a remedy can name the cause. */
|
|
167
174
|
function firstMeaningfulLine(text) {
|
|
@@ -170,7 +177,7 @@ function firstMeaningfulLine(text) {
|
|
|
170
177
|
.map((l) => l.trim())
|
|
171
178
|
.find((l) => l &&
|
|
172
179
|
!l.startsWith('at ') &&
|
|
173
|
-
|
|
180
|
+
!FIRST_MEANINGFUL_LINE_RE.test(l) &&
|
|
174
181
|
// The provenance line is a protocol between these two programs, not a
|
|
175
182
|
// diagnosis. Reporting it as one would answer "why did this fail?" with
|
|
176
183
|
// a machine's own bookkeeping.
|
|
@@ -413,7 +420,7 @@ async function checkLocalDaemonMachineIdentity(profile, binary = (0, exec_runtim
|
|
|
413
420
|
if (!printed.ok) {
|
|
414
421
|
// A daemon too old to have `accept-handoff` answers "unknown command": it is
|
|
415
422
|
// older than per-profile identities too, which is the skew itself.
|
|
416
|
-
if (
|
|
423
|
+
if (CHECK_LOCAL_DAEMON_MACHINE_IDENTITY_RE.test(printed.stderr)) {
|
|
417
424
|
return (0, daemon_machine_identity_1.daemonMachineIdentitySkew)({ profile, binary, reported: null });
|
|
418
425
|
}
|
|
419
426
|
// Any other failed probe says nothing about the daemon's identity, and
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.bootstrapDescriptorProfile = bootstrapDescriptorProfile;
|
|
7
7
|
const node_os_1 = __importDefault(require("node:os"));
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const BOOTSTRAP_DESCRIPTOR_PROFILE_RE = /^daemon-island\.([^.]+)\.json$/;
|
|
9
10
|
/**
|
|
10
11
|
* The daemon profile an island descriptor belongs to, read from its path, or
|
|
11
12
|
* null when the path names none (a Dedicated Runtime or Hosted Machine hand-off
|
|
@@ -28,7 +29,7 @@ function bootstrapDescriptorProfile(descriptorPath) {
|
|
|
28
29
|
if (!descriptorPath)
|
|
29
30
|
return null;
|
|
30
31
|
const base = node_path_1.default.basename(descriptorPath);
|
|
31
|
-
const named =
|
|
32
|
+
const named = BOOTSTRAP_DESCRIPTOR_PROFILE_RE.exec(base);
|
|
32
33
|
if (named)
|
|
33
34
|
return named[1];
|
|
34
35
|
if (base !== 'daemon-island.json')
|
|
@@ -15,6 +15,10 @@ const node_path_1 = require("node:path");
|
|
|
15
15
|
const computer_files_1 = require("./computer-files");
|
|
16
16
|
const dedicated_file_retry_1 = require("./dedicated-file-retry");
|
|
17
17
|
const dedicated_machines_1 = require("./dedicated-machines");
|
|
18
|
+
const NAMES_REMOTE_DIRECTORY_RE = /(^|\/)\.?$/;
|
|
19
|
+
const INTO_REMOTE_DIRECTORY_RE = /\/\.?$/;
|
|
20
|
+
const INTO_REMOTE_DIRECTORY_RE_2 = /^\.$/;
|
|
21
|
+
const STAT_DESTINATION_RE = /path|file|folder|directory/i;
|
|
18
22
|
/**
|
|
19
23
|
* A refusal the CLI makes itself, with the code the server uses for the same
|
|
20
24
|
* cause. A file over the limit, a file that changed and a file that is missing
|
|
@@ -133,11 +137,13 @@ function isContinuousIntegration(env = process.env) {
|
|
|
133
137
|
}
|
|
134
138
|
/** `dir/`, `dir/.` or `.`: a machine path that names a directory to copy into. */
|
|
135
139
|
function namesRemoteDirectory(remotePath) {
|
|
136
|
-
return
|
|
140
|
+
return NAMES_REMOTE_DIRECTORY_RE.test(remotePath);
|
|
137
141
|
}
|
|
138
142
|
/** `name` inside the machine directory `directory`, however it was spelled. */
|
|
139
143
|
function intoRemoteDirectory(directory, name) {
|
|
140
|
-
const parent = directory
|
|
144
|
+
const parent = directory
|
|
145
|
+
.replace(INTO_REMOTE_DIRECTORY_RE, '')
|
|
146
|
+
.replace(INTO_REMOTE_DIRECTORY_RE_2, '');
|
|
141
147
|
return parent ? `${parent}/${name}` : name;
|
|
142
148
|
}
|
|
143
149
|
/**
|
|
@@ -155,7 +161,7 @@ async function statDestination(statPath, leaseId, remotePath, generation, scope,
|
|
|
155
161
|
// `details.path` (or a path-shaped message) marks a missing PATH; without
|
|
156
162
|
// it the machine itself was not found, which is not a destination to create.
|
|
157
163
|
if (refusal?.code === 'not_found' &&
|
|
158
|
-
(refusal.details?.path !== undefined ||
|
|
164
|
+
(refusal.details?.path !== undefined || STAT_DESTINATION_RE.test(refusal.message))) {
|
|
159
165
|
return { kind: 'absent' };
|
|
160
166
|
}
|
|
161
167
|
throw err;
|
|
@@ -8,6 +8,7 @@ exports.describeTruncation = describeTruncation;
|
|
|
8
8
|
const node_crypto_1 = require("node:crypto");
|
|
9
9
|
const api_fetch_1 = require("./api-fetch");
|
|
10
10
|
const dedicated_machines_1 = require("./dedicated-machines");
|
|
11
|
+
const IS_UNANSWERED_REQUEST_RE = /fetch failed|socket hang up|network|terminated|other side closed/i;
|
|
11
12
|
/**
|
|
12
13
|
* `skrr machines dedicated exec`, as a start and a series of short observations
|
|
13
14
|
* (OSK-8705).
|
|
@@ -143,7 +144,7 @@ function isUnansweredRequest(err) {
|
|
|
143
144
|
if (['ECONNRESET', 'ECONNREFUSED', 'ETIMEDOUT', 'EPIPE', 'ENOTFOUND', 'EAI_AGAIN'].includes(code)) {
|
|
144
145
|
return true;
|
|
145
146
|
}
|
|
146
|
-
return
|
|
147
|
+
return IS_UNANSWERED_REQUEST_RE.test(e.message || '');
|
|
147
148
|
}
|
|
148
149
|
function backoff(attempt) {
|
|
149
150
|
return Math.min(1000 * 2 ** Math.max(0, attempt - 1), MAX_BACKOFF_MS);
|
|
@@ -10,6 +10,7 @@ const data_provider_1 = require("@skrr-ai/data-provider");
|
|
|
10
10
|
const api_fetch_1 = require("./api-fetch");
|
|
11
11
|
const format_1 = require("./format");
|
|
12
12
|
const dedicated_machines_1 = require("./dedicated-machines");
|
|
13
|
+
const PARSE_KEEP_AWAKE_DURATION_RE = /^(\d+)\s*(m|h|d)?$/i;
|
|
13
14
|
/**
|
|
14
15
|
* Domain lib for `skrr machines dedicated power keep-awake` (K1). Keep-awake is a
|
|
15
16
|
* temporary override that forbids AUTOMATIC stop; it never starts the machine.
|
|
@@ -31,7 +32,7 @@ function clearDedicatedKeepAwake(leaseId, scope = {}) {
|
|
|
31
32
|
* minutes (the unit the API speaks). Returns minutes, or throws a plain message.
|
|
32
33
|
*/
|
|
33
34
|
function parseKeepAwakeDuration(value) {
|
|
34
|
-
const match = value.trim().match(
|
|
35
|
+
const match = value.trim().match(PARSE_KEEP_AWAKE_DURATION_RE);
|
|
35
36
|
if (!match) {
|
|
36
37
|
throw new Error(`Invalid --for value "${value}". Use a number with m, h or d, such as 90m, 2h or 3d.`);
|
|
37
38
|
}
|
|
@@ -61,6 +61,10 @@ const machine_spend_cap_1 = require("./machine-spend-cap");
|
|
|
61
61
|
const web_url_1 = require("./web-url");
|
|
62
62
|
const edge_error_page_1 = require("./edge-error-page");
|
|
63
63
|
const harnesses_1 = require("./harnesses");
|
|
64
|
+
const VERSION_PARTS_RE = /^v?(\d+)\.(\d+)\.(\d+)/;
|
|
65
|
+
const IS_DEDICATED_REPOSITORY_REF_RE = /^(?:https?:\/\/)?(?:github\.com\/)?[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+?(?:\.git)?$/i;
|
|
66
|
+
const FORMAT_INVOICE_AMOUNT_RE = /^[A-Z]{3}$/;
|
|
67
|
+
const DEDICATED_DELETION_LINES_RE = /^unless /;
|
|
64
68
|
exports.DEDICATED_LEASE_ACTIONS = [
|
|
65
69
|
'start',
|
|
66
70
|
'stop',
|
|
@@ -82,7 +86,7 @@ function describeDedicatedCheckpoint(lease) {
|
|
|
82
86
|
return (0, data_provider_1.describeMachineCheckpointOutcome)(operation.checkpoint, { action: operation.action });
|
|
83
87
|
}
|
|
84
88
|
function versionParts(version) {
|
|
85
|
-
const match =
|
|
89
|
+
const match = VERSION_PARTS_RE.exec(String(version || '').trim());
|
|
86
90
|
return match ? match.slice(1, 4).map(Number) : null;
|
|
87
91
|
}
|
|
88
92
|
/** -1 / 0 / 1, or null when either side is not a version. */
|
|
@@ -238,7 +242,7 @@ function dedicatedRuntimeCreateInput(input) {
|
|
|
238
242
|
* billable request is sent.
|
|
239
243
|
*/
|
|
240
244
|
function isDedicatedRepositoryRef(value) {
|
|
241
|
-
return
|
|
245
|
+
return IS_DEDICATED_REPOSITORY_REF_RE.test(value.trim());
|
|
242
246
|
}
|
|
243
247
|
// Takes the finished path rather than composing one from a suffix, so the route
|
|
244
248
|
// each call reaches is a literal at the call site. `cli/src/__tests__/helpers/
|
|
@@ -910,7 +914,7 @@ const LEGACY_DELETION_REMEDY_TEXT = {
|
|
|
910
914
|
/** An invoice's amount in its own currency, from Stripe's minor units. */
|
|
911
915
|
function formatInvoiceAmount(amountDue, currency) {
|
|
912
916
|
const code = String(currency || '').toUpperCase();
|
|
913
|
-
if (
|
|
917
|
+
if (!FORMAT_INVOICE_AMOUNT_RE.test(code) || !Number.isSafeInteger(amountDue))
|
|
914
918
|
return null;
|
|
915
919
|
try {
|
|
916
920
|
const format = new Intl.NumberFormat('en-US', { style: 'currency', currency: code });
|
|
@@ -1014,7 +1018,7 @@ function dedicatedDeletionLines(lease, now = new Date()) {
|
|
|
1014
1018
|
// Until its files are about to be deleted, clearing the cause still stops it.
|
|
1015
1019
|
remedyApplies = plan.cancellable === true;
|
|
1016
1020
|
lines.push(remedyApplies
|
|
1017
|
-
? `workspace is being deleted — not too late: it stops, with every file kept, ${remedy.clause.replace(
|
|
1021
|
+
? `workspace is being deleted — not too late: it stops, with every file kept, ${remedy.clause.replace(DEDICATED_DELETION_LINES_RE, 'if ')}`
|
|
1018
1022
|
: 'workspace is being deleted');
|
|
1019
1023
|
}
|
|
1020
1024
|
else if (plan.status === 'scheduled') {
|
|
@@ -1023,7 +1027,7 @@ function dedicatedDeletionLines(lease, now = new Date()) {
|
|
|
1023
1027
|
}
|
|
1024
1028
|
else {
|
|
1025
1029
|
remedyApplies = true;
|
|
1026
|
-
lines.push(`files kept until at least ${formatDedicatedDeadline(plan.retentionEndsAt, now)}; no deletion date until a deletion notice reaches your email, then at least ${plan.noticeFloorDays || 30} days; no deletion at all ${remedy.clause.replace(
|
|
1030
|
+
lines.push(`files kept until at least ${formatDedicatedDeadline(plan.retentionEndsAt, now)}; no deletion date until a deletion notice reaches your email, then at least ${plan.noticeFloorDays || 30} days; no deletion at all ${remedy.clause.replace(DEDICATED_DELETION_LINES_RE, 'if ')}`);
|
|
1027
1031
|
}
|
|
1028
1032
|
if (remedyApplies)
|
|
1029
1033
|
lines.push(...remedy.lines);
|
|
@@ -28,6 +28,7 @@ const data_provider_1 = require("@skrr-ai/data-provider");
|
|
|
28
28
|
const agentic_stream_1 = require("./agentic-stream");
|
|
29
29
|
const dpop_auth_1 = require("./dpop-auth");
|
|
30
30
|
const format_1 = require("./format");
|
|
31
|
+
const CALL_EVENT_RE = /^[A-Za-z0-9_.:-]{1,128}$/;
|
|
31
32
|
/**
|
|
32
33
|
* Declared services on a Dedicated Runtime — the CLI half of
|
|
33
34
|
* docs/architecture/dedicated-runtime-always-on-workloads-2026-09-21.md (§5.3
|
|
@@ -545,7 +546,7 @@ class DedicatedServiceChannel {
|
|
|
545
546
|
// socket response can be inspected or replayed without a second effect.
|
|
546
547
|
// Other verbs retain their historical per-call id generation.
|
|
547
548
|
const supplied = payload.requestId;
|
|
548
|
-
const requestId = typeof supplied === 'string' &&
|
|
549
|
+
const requestId = typeof supplied === 'string' && CALL_EVENT_RE.test(supplied)
|
|
549
550
|
? supplied
|
|
550
551
|
: `svc-${(0, node_crypto_1.randomUUID)()}`;
|
|
551
552
|
return new Promise((resolve, reject) => {
|
|
@@ -24,6 +24,8 @@ const data_provider_1 = require("@skrr-ai/data-provider");
|
|
|
24
24
|
const agentic_stream_1 = require("./agentic-stream");
|
|
25
25
|
const dpop_auth_1 = require("./dpop-auth");
|
|
26
26
|
const ssh_ordered_bytes_1 = require("./ssh-ordered-bytes");
|
|
27
|
+
const ENSURE_SSH_IDENTITY_RE = /\s+/;
|
|
28
|
+
const WRITE_KNOWN_HOSTS_RE = /^[A-Za-z0-9+/]+=*$/;
|
|
27
29
|
/**
|
|
28
30
|
* Owner SSH to a Dedicated Runtime — SSH protocol over the admitted relay.
|
|
29
31
|
*
|
|
@@ -121,7 +123,7 @@ function ensureSshIdentity(home = (0, node_os_1.homedir)()) {
|
|
|
121
123
|
(0, node_fs_1.chmodSync)(publicKeyPath, 0o644);
|
|
122
124
|
}
|
|
123
125
|
const line = (0, node_fs_1.readFileSync)(publicKeyPath, 'utf8').trim();
|
|
124
|
-
const [keyType, keyBlob] = line.split(
|
|
126
|
+
const [keyType, keyBlob] = line.split(ENSURE_SSH_IDENTITY_RE);
|
|
125
127
|
if (!keyType || !keyBlob) {
|
|
126
128
|
throw new DedicatedSshError(`could not read ${publicKeyPath}`, 'SSH_KEY_UNREADABLE');
|
|
127
129
|
}
|
|
@@ -141,7 +143,7 @@ function writeKnownHosts(host, hostKeys, home = (0, node_os_1.homedir)()) {
|
|
|
141
143
|
(0, node_fs_1.mkdirSync)(dir, { recursive: true, mode: 0o700 });
|
|
142
144
|
(0, node_fs_1.chmodSync)(dir, 0o700);
|
|
143
145
|
const lines = hostKeys
|
|
144
|
-
.filter((k) => k && HOSTKEY_TYPES.has(k.type) &&
|
|
146
|
+
.filter((k) => k && HOSTKEY_TYPES.has(k.type) && WRITE_KNOWN_HOSTS_RE.test(k.key))
|
|
145
147
|
.map((k) => `${host} ${k.type} ${k.key}`);
|
|
146
148
|
if (lines.length === 0)
|
|
147
149
|
return false;
|
|
@@ -155,7 +157,7 @@ function writeKnownHosts(host, hostKeys, home = (0, node_os_1.homedir)()) {
|
|
|
155
157
|
catch {
|
|
156
158
|
/* first connect */
|
|
157
159
|
}
|
|
158
|
-
const kept = existing.filter((l) => l.split(
|
|
160
|
+
const kept = existing.filter((l) => l.split(ENSURE_SSH_IDENTITY_RE)[0] !== host);
|
|
159
161
|
const tmp = `${target}.${process.pid}.${(0, node_crypto_1.randomUUID)()}.tmp`;
|
|
160
162
|
(0, node_fs_1.writeFileSync)(tmp, `${[...kept, ...lines].join('\n')}\n`, { mode: 0o600 });
|
|
161
163
|
(0, node_fs_1.renameSync)(tmp, target);
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
22
|
exports.readDeployedBuild = readDeployedBuild;
|
|
23
23
|
exports.deployedBuildLines = deployedBuildLines;
|
|
24
|
+
const READ_DEPLOYED_BUILD_RE = /\/+$/;
|
|
24
25
|
const COMMIT = /^[a-f0-9]{40}$/;
|
|
25
26
|
const TIMEOUT_MS = 5_000;
|
|
26
27
|
async function readCommit(url, pick, unstamped, fetchImpl) {
|
|
@@ -46,7 +47,7 @@ async function readCommit(url, pick, unstamped, fetchImpl) {
|
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
async function readDeployedBuild(baseURL, fetchImpl = fetch) {
|
|
49
|
-
const origin = baseURL.replace(
|
|
50
|
+
const origin = baseURL.replace(READ_DEPLOYED_BUILD_RE, '');
|
|
50
51
|
const [api, web] = await Promise.all([
|
|
51
52
|
readCommit(`${origin}/api/health`, (body) => body?.build?.commit, 'the server does not report the commit its API was built from', fetchImpl),
|
|
52
53
|
readCommit(`${origin}/web-version.json`, (body) => body?.sha, 'the published web shell carries no commit', fetchImpl),
|
package/dist/lib/device-code.js
CHANGED
|
@@ -25,6 +25,7 @@ exports.DeviceCodeLoginCancelledError = void 0;
|
|
|
25
25
|
exports.startDeviceCode = startDeviceCode;
|
|
26
26
|
exports.pollDeviceCode = pollDeviceCode;
|
|
27
27
|
exports.revokeDeviceRefreshToken = revokeDeviceRefreshToken;
|
|
28
|
+
const START_DEVICE_CODE_RE = /\/$/;
|
|
28
29
|
const DEFAULT_POLL_INTERVAL_MS = 2_000;
|
|
29
30
|
/** Server-side TTL is 300s; we add a small safety margin for clock drift. */
|
|
30
31
|
const DEFAULT_OVERALL_TIMEOUT_MS = 320_000;
|
|
@@ -49,7 +50,7 @@ exports.DeviceCodeLoginCancelledError = DeviceCodeLoginCancelledError;
|
|
|
49
50
|
* default to `'daemon'`, which still works for the CLI's REST surface.
|
|
50
51
|
*/
|
|
51
52
|
async function startDeviceCode(baseURL, daemonId) {
|
|
52
|
-
const res = await fetch(`${baseURL.replace(
|
|
53
|
+
const res = await fetch(`${baseURL.replace(START_DEVICE_CODE_RE, '')}/api/daemons/device-code`, {
|
|
53
54
|
method: 'POST',
|
|
54
55
|
headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
|
|
55
56
|
body: JSON.stringify({ daemonId, source: 'cli' }),
|
|
@@ -88,7 +89,7 @@ async function pollDeviceCode(baseURL, code, opts = {}) {
|
|
|
88
89
|
}
|
|
89
90
|
let res;
|
|
90
91
|
try {
|
|
91
|
-
res = await fetch(`${baseURL.replace(
|
|
92
|
+
res = await fetch(`${baseURL.replace(START_DEVICE_CODE_RE, '')}/api/daemons/device-code/${encodeURIComponent(code)}/status`, { method: 'GET', headers: { Accept: 'application/json' }, ...(signal ? { signal } : {}) });
|
|
92
93
|
}
|
|
93
94
|
catch {
|
|
94
95
|
if (signal?.aborted)
|
|
@@ -137,7 +138,7 @@ async function pollDeviceCode(baseURL, code, opts = {}) {
|
|
|
137
138
|
async function revokeDeviceRefreshToken(baseURL, refreshToken) {
|
|
138
139
|
if (!refreshToken)
|
|
139
140
|
return;
|
|
140
|
-
const url = `${baseURL.replace(
|
|
141
|
+
const url = `${baseURL.replace(START_DEVICE_CODE_RE, '')}/api/daemons/token/revoke`;
|
|
141
142
|
const controller = new AbortController();
|
|
142
143
|
const timer = setTimeout(() => controller.abort(), 5_000);
|
|
143
144
|
try {
|
package/dist/lib/dpop-auth.js
CHANGED
|
@@ -18,6 +18,7 @@ exports.dpopHeadersFor = dpopHeadersFor;
|
|
|
18
18
|
exports.socketHandshakeHtu = socketHandshakeHtu;
|
|
19
19
|
exports.socketAuthWithDpop = socketAuthWithDpop;
|
|
20
20
|
const brokered_dpop_1 = require("./brokered-dpop");
|
|
21
|
+
const SOCKET_HANDSHAKE_HTU_RE = /\/+$/;
|
|
21
22
|
/** RFC 9449 §4.1. */
|
|
22
23
|
exports.DPOP_HEADER = 'DPoP';
|
|
23
24
|
/** Headers to add to one HTTP request made with `token`; `{}` when unbound. */
|
|
@@ -35,7 +36,7 @@ async function dpopHeadersFor(token, method, url) {
|
|
|
35
36
|
function socketHandshakeHtu(wsOrigin, ioPath = '/ws/agentic') {
|
|
36
37
|
const u = new URL(wsOrigin);
|
|
37
38
|
u.protocol = u.protocol === 'wss:' ? 'https:' : u.protocol === 'ws:' ? 'http:' : u.protocol;
|
|
38
|
-
u.pathname = ioPath.replace(
|
|
39
|
+
u.pathname = ioPath.replace(SOCKET_HANDSHAKE_HTU_RE, '');
|
|
39
40
|
u.search = '';
|
|
40
41
|
u.hash = '';
|
|
41
42
|
return u.toString();
|
package/dist/lib/earnings.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.renderStatement = renderStatement;
|
|
|
7
7
|
exports.renderPayoutHistory = renderPayoutHistory;
|
|
8
8
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
9
9
|
const format_1 = require("./format");
|
|
10
|
+
const DOLLARS_RE = /^\$/;
|
|
10
11
|
/**
|
|
11
12
|
* earnings.ts — the read-only publisher payout surface (OSK-12272).
|
|
12
13
|
*
|
|
@@ -34,7 +35,7 @@ exports.PERIOD_PATTERN = /^\d{4}-(0[1-9]|1[0-2])$/;
|
|
|
34
35
|
function dollars(usd) {
|
|
35
36
|
if (usd == null || usd === '')
|
|
36
37
|
return '-';
|
|
37
|
-
const trimmed = String(usd).replace(
|
|
38
|
+
const trimmed = String(usd).replace(DOLLARS_RE, '');
|
|
38
39
|
return trimmed.startsWith('-') ? `-$${trimmed.slice(1)}` : `$${trimmed}`;
|
|
39
40
|
}
|
|
40
41
|
function day(value) {
|
|
@@ -33,6 +33,8 @@ exports.runtimeBinarySupportsSubcommand = runtimeBinarySupportsSubcommand;
|
|
|
33
33
|
const node_child_process_1 = require("node:child_process");
|
|
34
34
|
const node_fs_1 = require("node:fs");
|
|
35
35
|
const node_path_1 = __importDefault(require("node:path"));
|
|
36
|
+
const EXEC_RUNTIME_BINARY_RE = /\.(cmd|bat)$/i;
|
|
37
|
+
const RUNTIME_BINARY_SUPPORTS_SUBCOMMAND_RE = /[.*+?^${}()|[\]\\]/g;
|
|
36
38
|
/** Runtime binary names, current first. */
|
|
37
39
|
exports.RUNTIME_BINARY_NAMES = ['skrrd', 'oversky'];
|
|
38
40
|
/**
|
|
@@ -240,7 +242,7 @@ function execRuntimeBinary(args, opts = {}) {
|
|
|
240
242
|
// binaries keep the safer argv-array exec path. Node 20.12+ (required
|
|
241
243
|
// by package.json engines `>=20.0.0` — pin at install time) quotes
|
|
242
244
|
// args when shell:true on Windows per CVE-2024-27980's fix.
|
|
243
|
-
const isWinShim = process.platform === 'win32' &&
|
|
245
|
+
const isWinShim = process.platform === 'win32' && EXEC_RUNTIME_BINARY_RE.test(bin);
|
|
244
246
|
const child = (0, node_child_process_1.spawn)(bin, normalizeRuntimeGlobalArgs(args), {
|
|
245
247
|
stdio: 'inherit',
|
|
246
248
|
env: runtimeEnv(),
|
|
@@ -272,7 +274,7 @@ function execRuntimeBinaryCapture(args, opts = {}) {
|
|
|
272
274
|
reject(new Error('runtime-binary-not-installed'));
|
|
273
275
|
return;
|
|
274
276
|
}
|
|
275
|
-
const isWinShim = process.platform === 'win32' &&
|
|
277
|
+
const isWinShim = process.platform === 'win32' && EXEC_RUNTIME_BINARY_RE.test(bin);
|
|
276
278
|
const child = (0, node_child_process_1.spawn)(bin, normalizeRuntimeGlobalArgs(args), {
|
|
277
279
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
278
280
|
env: runtimeEnv(),
|
|
@@ -353,7 +355,7 @@ function runtimeBinarySupportsSubcommand(subcommand) {
|
|
|
353
355
|
child.on('exit', (code) => {
|
|
354
356
|
if (code !== 0)
|
|
355
357
|
return settle(null);
|
|
356
|
-
const escaped = subcommand.replace(
|
|
358
|
+
const escaped = subcommand.replace(RUNTIME_BINARY_SUPPORTS_SUBCOMMAND_RE, '\\$&');
|
|
357
359
|
settle(new RegExp(`^\\s*${escaped}(?:\\s|$)`, 'm').test(output));
|
|
358
360
|
});
|
|
359
361
|
});
|