@skrr-ai/cli 0.1.145 → 0.1.147
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base-command.js +38 -21
- package/dist/commands/agenda/plan.d.ts +14 -0
- package/dist/commands/agenda/plan.js +29 -0
- package/dist/commands/agent/message/approve.js +5 -1
- package/dist/commands/agent/message/decline.js +5 -1
- package/dist/commands/agent/message/send.d.ts +11 -0
- package/dist/commands/agent/message/send.js +34 -8
- package/dist/commands/agent-worker.js +2 -1
- package/dist/commands/agents/activity.js +2 -1
- package/dist/commands/agents/always-on/enable.js +1 -1
- package/dist/commands/agents/badge.js +10 -5
- package/dist/commands/agents/categories/index.js +2 -1
- package/dist/commands/agents/chat.d.ts +1 -0
- package/dist/commands/agents/chat.js +29 -1
- package/dist/commands/agents/create.js +4 -1
- package/dist/commands/agents/overview.js +2 -1
- package/dist/commands/agents/releases/create.js +2 -1
- package/dist/commands/agents/schedule-overview.js +12 -11
- package/dist/commands/agents/schedule.js +2 -1
- package/dist/commands/agents/spawn.d.ts +38 -1
- package/dist/commands/agents/spawn.js +112 -9
- package/dist/commands/agents/tools/auth.js +2 -1
- package/dist/commands/agents/tools/calls.js +2 -1
- package/dist/commands/agents/triggers/fire.js +20 -0
- package/dist/commands/agents/visibility.js +2 -1
- package/dist/commands/balance/show.js +17 -2
- package/dist/commands/balance/statement.js +2 -1
- package/dist/commands/commands.js +2 -1
- package/dist/commands/commitments/create.js +2 -1
- package/dist/commands/commitments/delivery.js +2 -1
- package/dist/commands/commitments/doctor.js +2 -1
- package/dist/commands/commitments/observations.js +2 -2
- package/dist/commands/commitments/operating-review.js +2 -1
- package/dist/commands/commitments/pack/preflight.js +2 -1
- package/dist/commands/commitments/trigger-status.js +2 -1
- package/dist/commands/convos/messages.js +2 -1
- package/dist/commands/daemon/logs.js +18 -9
- package/dist/commands/daemon/usage.js +2 -1
- package/dist/commands/dm/messages.js +2 -1
- package/dist/commands/dm/thread/messages.js +2 -1
- package/dist/commands/dm/threads.js +2 -1
- package/dist/commands/doctor.js +2 -1
- package/dist/commands/goals/key-results/assess.js +2 -1
- package/dist/commands/goals/key-results/history.js +2 -1
- package/dist/commands/harnesses/forget.js +2 -1
- package/dist/commands/harnesses/show.js +12 -6
- package/dist/commands/inbox/index.js +4 -3
- package/dist/commands/initiatives/decide.js +2 -1
- package/dist/commands/instructions/diff.js +2 -1
- package/dist/commands/instructions/show.js +2 -1
- package/dist/commands/login.js +4 -2
- package/dist/commands/machines/dedicated/cp.js +2 -1
- package/dist/commands/machines/dedicated/power/set.js +2 -1
- package/dist/commands/machines/show.js +2 -1
- package/dist/commands/memory/maintain.js +2 -1
- package/dist/commands/memory/read.js +2 -1
- package/dist/commands/memory/rebuild-index.js +2 -1
- package/dist/commands/memory/rebuild.js +2 -1
- package/dist/commands/memory/search.js +2 -1
- package/dist/commands/messages/list.js +2 -1
- package/dist/commands/revoke-daemon.js +2 -1
- package/dist/commands/revoke-token.js +2 -1
- package/dist/commands/search/all.js +14 -7
- package/dist/commands/search/workspace.js +2 -1
- package/dist/commands/set-capabilities.js +2 -1
- package/dist/commands/skills/browse.js +8 -2
- package/dist/commands/spaces/auto-executor/preview.js +3 -2
- package/dist/commands/spaces/auto-executor/runs.js +4 -1
- package/dist/commands/spaces/workflow-templates/extract.d.ts +1 -0
- package/dist/commands/spaces/workflow-templates/extract.js +9 -1
- package/dist/commands/spaces/workflows/events.js +6 -3
- package/dist/commands/spaces/workflows/run.js +5 -3
- package/dist/commands/spaces/workflows/update.js +2 -1
- package/dist/commands/store/gallery-admissions/preview.js +2 -1
- package/dist/commands/store/publishers/profile/handle.js +2 -1
- package/dist/commands/tasks/comments/anchor.js +23 -9
- package/dist/commands/tasks/complete.js +4 -2
- package/dist/commands/tasks/create-tree.js +7 -3
- package/dist/commands/tasks/create.js +2 -1
- package/dist/commands/tasks/deliverable/add.js +2 -1
- package/dist/commands/tasks/deliverable/archive.js +2 -1
- package/dist/commands/tasks/deliverable/list.js +2 -1
- package/dist/commands/tasks/expectations/assess.js +2 -1
- package/dist/commands/tasks/labels/create.js +2 -1
- package/dist/commands/tasks/preflight.js +4 -2
- package/dist/commands/tasks/ready.js +2 -1
- package/dist/commands/tasks/result/submit.js +2 -1
- package/dist/commands/tasks/updates/add.js +2 -1
- package/dist/commands/tasks/wait.js +2 -1
- package/dist/commands/token/list.js +2 -1
- package/dist/commands/token/mint.js +2 -1
- package/dist/commands/triggers/audit.js +1 -1
- package/dist/commands/triggers/fire.js +19 -0
- package/dist/commands/wiki/write.js +14 -7
- package/dist/hooks/command-not-found.js +2 -1
- package/dist/lib/agent-chat-start.d.ts +77 -0
- package/dist/lib/agent-chat-start.js +169 -0
- package/dist/lib/agent-config.js +2 -1
- package/dist/lib/agent-endpoints.js +4 -2
- package/dist/lib/agent-evals.js +2 -1
- package/dist/lib/agent-guide-reference-gate.js +22 -11
- package/dist/lib/agent-guides.js +4 -1
- package/dist/lib/agent-instructions.js +5 -1
- package/dist/lib/agent-ref.js +8 -4
- package/dist/lib/agent-trigger-listing.js +2 -1
- package/dist/lib/agentic-stream.d.ts +21 -0
- package/dist/lib/agentic-stream.js +75 -6
- package/dist/lib/api-error-reason.js +2 -1
- package/dist/lib/api-fetch.js +5 -3
- package/dist/lib/appData.js +6 -6
- package/dist/lib/appInstallations.js +10 -5
- package/dist/lib/appsCheck.js +2 -1
- package/dist/lib/auth-failure.js +2 -1
- package/dist/lib/auth-storage.js +2 -1
- package/dist/lib/balance.js +6 -3
- package/dist/lib/capability-matrix.js +4 -2
- package/dist/lib/cli-runtime.js +2 -1
- package/dist/lib/code-handover.js +8 -3
- package/dist/lib/command-hygiene.js +28 -12
- package/dist/lib/command-manifest.js +6 -3
- package/dist/lib/commitment-attention-copy.js +2 -1
- package/dist/lib/commitment-event-wakes.js +9 -0
- package/dist/lib/commitment-product.js +5 -3
- package/dist/lib/commitment-terms.js +2 -1
- package/dist/lib/commitments.d.ts +8 -0
- package/dist/lib/commitments.js +8 -4
- package/dist/lib/compasses.js +2 -1
- package/dist/lib/completion-index.js +2 -1
- package/dist/lib/computer-files.js +8 -6
- package/dist/lib/config.js +11 -5
- package/dist/lib/conversation-search.js +4 -2
- package/dist/lib/daemon-installer.js +6 -2
- package/dist/lib/daemon-maintenance.js +2 -1
- package/dist/lib/daemon-ref.js +2 -1
- package/dist/lib/daemonBroker.js +6 -3
- package/dist/lib/daemonBrokerRefusal.js +4 -2
- package/dist/lib/daemonHandoff.js +14 -7
- package/dist/lib/daemonIslandProfile.js +2 -1
- package/dist/lib/dedicated-copy.js +9 -3
- package/dist/lib/dedicated-exec.js +2 -1
- package/dist/lib/dedicated-keep-awake.js +2 -1
- package/dist/lib/dedicated-machines.js +9 -5
- package/dist/lib/dedicated-service.js +2 -1
- package/dist/lib/dedicated-ssh.js +5 -3
- package/dist/lib/deployed-build.js +2 -1
- package/dist/lib/device-code.js +4 -3
- package/dist/lib/dpop-auth.js +2 -1
- package/dist/lib/earnings.js +2 -1
- package/dist/lib/exec-runtime-binary.js +5 -3
- package/dist/lib/first-party-harness-broker.js +4 -3
- package/dist/lib/first-party-harness-managed.js +2 -1
- package/dist/lib/first-party-harness-startup-update.js +8 -4
- package/dist/lib/first-party-harness-update.js +2 -1
- package/dist/lib/first-party-harness.js +2 -1
- package/dist/lib/format.d.ts +5 -0
- package/dist/lib/format.js +24 -4
- package/dist/lib/git-task.js +10 -5
- package/dist/lib/github-tools.js +6 -3
- package/dist/lib/harnesses.js +4 -2
- package/dist/lib/hosted-machines.js +2 -1
- package/dist/lib/html-text.js +33 -16
- package/dist/lib/instruction-blocks.js +2 -1
- package/dist/lib/iso-instant.js +5 -3
- package/dist/lib/keychain.js +15 -5
- package/dist/lib/label-scope.js +2 -1
- package/dist/lib/live-runtime-binary.js +10 -7
- package/dist/lib/local-skills.js +10 -6
- package/dist/lib/login.js +3 -2
- package/dist/lib/machine-audit.js +2 -1
- package/dist/lib/machine-daemon-log.js +2 -1
- package/dist/lib/machine-services.js +2 -1
- package/dist/lib/memory-history-session.js +2 -1
- package/dist/lib/memory-sync.js +6 -2
- package/dist/lib/message-intent.d.ts +10 -0
- package/dist/lib/node-adapter.js +4 -2
- package/dist/lib/northstars.js +4 -2
- package/dist/lib/oauthLogin.js +16 -7
- package/dist/lib/open-target.js +8 -4
- package/dist/lib/option-hint.js +2 -4
- package/dist/lib/outbox.js +2 -1
- package/dist/lib/planOutcome.d.ts +5 -3
- package/dist/lib/planOutcome.js +7 -4
- package/dist/lib/platform-update-local.js +2 -3
- package/dist/lib/proactiveApi.d.ts +38 -1
- package/dist/lib/proactiveApi.js +17 -1
- package/dist/lib/rate-limit-retry.js +2 -1
- package/dist/lib/reflection.js +2 -1
- package/dist/lib/request-field-flags.js +2 -1
- package/dist/lib/runtime-start-verification.js +2 -1
- package/dist/lib/schedule.d.ts +15 -0
- package/dist/lib/schedule.js +16 -1
- package/dist/lib/scoped-memory-command.js +7 -3
- package/dist/lib/search-display.js +11 -4
- package/dist/lib/skill-store-pagination.js +2 -1
- package/dist/lib/space-notebook.js +5 -3
- package/dist/lib/store-listing.js +2 -1
- package/dist/lib/task-agent-context-capabilities.js +2 -1
- package/dist/lib/task-asset-upload.js +7 -3
- package/dist/lib/task-closure.js +2 -1
- package/dist/lib/task-economics.js +2 -1
- package/dist/lib/task-execution.js +16 -8
- package/dist/lib/task-extras.js +4 -2
- package/dist/lib/task-operation-watch.js +2 -1
- package/dist/lib/task-preflight.js +3 -2
- package/dist/lib/task-recurrence-summary.js +4 -2
- package/dist/lib/task-runtime-headers.js +10 -5
- package/dist/lib/task-transcript.js +3 -2
- package/dist/lib/task-transfer.js +9 -5
- package/dist/lib/tasks.js +2 -1
- package/dist/lib/triggers.d.ts +144 -3
- package/dist/lib/triggers.js +280 -23
- package/dist/lib/update-check.js +12 -7
- package/dist/lib/usage-discovery.js +2 -1
- package/dist/lib/usd-micros.js +2 -1
- package/dist/lib/web-url.js +2 -1
- package/dist/lib/widgetCheck.js +15 -9
- package/dist/lib/widgetStaticScan.js +26 -14
- package/dist/lib/workflow-run-view.js +5 -3
- package/dist/lib/workflow-templates.d.ts +10 -0
- package/dist/lib/workflow-templates.js +47 -0
- package/dist/lib/write-target.js +4 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/authHelper.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/commitmentExecutionContract.js +22 -12
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerUse.js +4 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelope.js +7 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.js +6 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonConsentProof.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonPair.js +16 -7
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +4 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/desktopDaemonProof.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/desktopWire.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.js +11 -7
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceKey.js +7 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/dpop.js +8 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarness.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessChannels.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessUpdater.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/githubPushRefusal.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/guidedUpdate.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/independentMachineReservation.js +8 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/kek/macos.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/liveState.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/loginWithLocalhost.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/loopbackHttp.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/machineUuid.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profileStateDir.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/recoveryCode.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.js +3 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releasePolicy.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releaseVersions.js +6 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/restartArtifact.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/spawnEnv.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/telemetryRedaction.js +7 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/authHelper.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/commitmentExecutionContract.js +27 -18
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerUse.js +6 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelope.js +11 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.js +6 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonConsentProof.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonPair.js +20 -8
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +5 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/desktopDaemonProof.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/desktopWire.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.js +11 -7
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceKey.js +11 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/dpop.js +12 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarness.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessChannels.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessUpdater.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/githubPushRefusal.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/guidedUpdate.js +5 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/independentMachineReservation.js +10 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/kek/macos.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/liveState.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/loginWithLocalhost.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/loopbackHttp.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/machineUuid.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profileStateDir.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/recoveryCode.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.js +3 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releasePolicy.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releaseVersions.js +6 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/restartArtifact.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/spawnEnv.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/telemetryRedaction.js +11 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +20520 -20130
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/loopback-server.js +4 -2
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.js +10 -6
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/loopback-server.js +4 -2
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.js +10 -6
- package/dist/node_modules/@skrr-ai/inference-broker/package.json +1 -1
- package/oclif.manifest.json +24 -2
- package/package.json +1 -1
|
@@ -31,6 +31,9 @@ __export(daemonWire_exports, {
|
|
|
31
31
|
module.exports = __toCommonJS(daemonWire_exports);
|
|
32
32
|
var import_desktopWire = require("./desktopWire.js");
|
|
33
33
|
var import_computerWire = require("./computerWire.js");
|
|
34
|
+
const MODULE_RE = /(\{[a-zA-Z]+\})/;
|
|
35
|
+
const MODULE_RE_2 = /^\{[a-zA-Z]+\}$/;
|
|
36
|
+
const MODULE_RE_3 = /[.*+?^${}()|[\]\\]/g;
|
|
34
37
|
const DAEMON_WIRE_DIRECTIONS = [
|
|
35
38
|
"server_to_daemon",
|
|
36
39
|
"daemon_to_server",
|
|
@@ -571,7 +574,7 @@ const DAEMON_WIRE_NAMES = Object.freeze(DAEMON_WIRE.map((e) => e.name));
|
|
|
571
574
|
const BY_NAME = new Map(DAEMON_WIRE.map((e) => [e.name, e]));
|
|
572
575
|
const TEMPLATED = DAEMON_WIRE.filter((e) => e.name.includes("{")).map((e) => ({
|
|
573
576
|
entry: e,
|
|
574
|
-
pattern: new RegExp(`^${e.name.split(
|
|
577
|
+
pattern: new RegExp(`^${e.name.split(MODULE_RE).map((part) => MODULE_RE_2.test(part) ? "[a-z0-9][a-z0-9-]*" : part.replace(MODULE_RE_3, "\\$&")).join("")}$`)
|
|
575
578
|
}));
|
|
576
579
|
function daemonWireEntry(name) {
|
|
577
580
|
const exact = BY_NAME.get(name);
|
|
@@ -28,6 +28,7 @@ __export(desktopDaemonProof_exports, {
|
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(desktopDaemonProof_exports);
|
|
30
30
|
var import_node_crypto = require("node:crypto");
|
|
31
|
+
const PROOF_FOR_PURPOSE_RE = /^[a-f0-9]{64}$/;
|
|
31
32
|
const DESKTOP_DAEMON_PROOF_NAMESPACE = "/desktop-proof-v1";
|
|
32
33
|
const DESKTOP_DAEMON_RENEWAL_NAMESPACE = "/desktop-renewal-v1";
|
|
33
34
|
function normalizeDesktopDaemonOwner(input) {
|
|
@@ -54,7 +55,7 @@ function desktopRenewalProof(secret, role, challenge) {
|
|
|
54
55
|
function proofForPurpose(secret, role, challenge, domain) {
|
|
55
56
|
const key = Buffer.from(secret, "base64");
|
|
56
57
|
const owner = normalizeDesktopDaemonOwner(challenge.owner);
|
|
57
|
-
if (key.length !== 32 || key.toString("base64") !== secret || !owner || !Number.isInteger(challenge.port) || challenge.port < 1 || challenge.port > 65535 ||
|
|
58
|
+
if (key.length !== 32 || key.toString("base64") !== secret || !owner || !Number.isInteger(challenge.port) || challenge.port < 1 || challenge.port > 65535 || !PROOF_FOR_PURPOSE_RE.test(challenge.clientNonce) || !PROOF_FOR_PURPOSE_RE.test(challenge.serverNonce)) {
|
|
58
59
|
throw new Error("Invalid desktop daemon challenge");
|
|
59
60
|
}
|
|
60
61
|
return (0, import_node_crypto.createHmac)("sha256", key).update(domain).update(JSON.stringify([
|
|
@@ -67,7 +68,7 @@ function proofForPurpose(secret, role, challenge, domain) {
|
|
|
67
68
|
])).digest("hex");
|
|
68
69
|
}
|
|
69
70
|
function verifyDesktopDaemonProof(secret, role, challenge, proof) {
|
|
70
|
-
if (typeof proof !== "string" ||
|
|
71
|
+
if (typeof proof !== "string" || !PROOF_FOR_PURPOSE_RE.test(proof))
|
|
71
72
|
return false;
|
|
72
73
|
try {
|
|
73
74
|
return (0, import_node_crypto.timingSafeEqual)(Buffer.from(proof, "hex"), Buffer.from(desktopDaemonProof(secret, role, challenge), "hex"));
|
|
@@ -76,7 +77,7 @@ function verifyDesktopDaemonProof(secret, role, challenge, proof) {
|
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
79
|
function verifyDesktopRenewalProof(secret, role, challenge, proof) {
|
|
79
|
-
if (typeof proof !== "string" ||
|
|
80
|
+
if (typeof proof !== "string" || !PROOF_FOR_PURPOSE_RE.test(proof))
|
|
80
81
|
return false;
|
|
81
82
|
try {
|
|
82
83
|
return (0, import_node_crypto.timingSafeEqual)(Buffer.from(proof, "hex"), Buffer.from(desktopRenewalProof(secret, role, challenge), "hex"));
|
|
@@ -28,6 +28,7 @@ __export(desktopWire_exports, {
|
|
|
28
28
|
isComputerDesktopBase64: () => isComputerDesktopBase64
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(desktopWire_exports);
|
|
31
|
+
const IS_COMPUTER_DESKTOP_BASE64_RE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
|
|
31
32
|
const COMPUTER_DESKTOP_CAPABILITY = "computer_desktop_observe_v1";
|
|
32
33
|
const COMPUTER_DESKTOP_SURFACE_ID = "desktop:main";
|
|
33
34
|
const COMPUTER_DESKTOP_EVENTS = {
|
|
@@ -57,7 +58,7 @@ const COMPUTER_DESKTOP_CLOSED_REASONS = ["unavailable", "revoked", "protocol_err
|
|
|
57
58
|
function isComputerDesktopBase64(value, maxChars) {
|
|
58
59
|
if (typeof value !== "string" || !value.length || value.length > maxChars || value.length % 4 !== 0)
|
|
59
60
|
return false;
|
|
60
|
-
if (
|
|
61
|
+
if (!IS_COMPUTER_DESKTOP_BASE64_RE.test(value))
|
|
61
62
|
return false;
|
|
62
63
|
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
63
64
|
if (value.endsWith("=="))
|
|
@@ -70,6 +70,10 @@ var import_profileStateDir = require("./profileStateDir.js");
|
|
|
70
70
|
var import_liveState = require("./liveState.js");
|
|
71
71
|
var import_runtime = require("./runtime.js");
|
|
72
72
|
var import_stateFiles = require("./stateFiles.js");
|
|
73
|
+
const PROFILE_CONFIG_DIR_RE = /^desktop-bg-[a-f0-9]{32}$/i;
|
|
74
|
+
const INIT_DEVICE_IDENTITY_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
|
|
75
|
+
const RETIRE_SOFTWARE_KEY_RE = /[:.]/g;
|
|
76
|
+
const ENROLL_WITH_SERVER_RE = /\/+$/;
|
|
73
77
|
const DEVICE_KEY_UNREADABLE_CREDENTIAL_HINT = "stored device key is unreadable on this machine \u2014 only an interactive daemon sign-in replaces it";
|
|
74
78
|
const PUBLIC_KEY_FILENAME = "device-public-key.jwk";
|
|
75
79
|
const PRIVATE_KEY_FILENAME = "device-private-key";
|
|
@@ -213,7 +217,7 @@ function __getStateForTest() {
|
|
|
213
217
|
return _state;
|
|
214
218
|
}
|
|
215
219
|
function profileConfigDir(profile) {
|
|
216
|
-
if (
|
|
220
|
+
if (PROFILE_CONFIG_DIR_RE.test(profile))
|
|
217
221
|
return (0, import_profileStateDir.profileStateDir)(profile);
|
|
218
222
|
return (0, import_profileStateDir.resolveProfileStateDir)(profile, PRIVATE_KEY_FILENAME).dir;
|
|
219
223
|
}
|
|
@@ -332,7 +336,7 @@ function readIndependentIdentityFile(file, sealed) {
|
|
|
332
336
|
function loadStoredKey(profile) {
|
|
333
337
|
const pubPath = publicKeyPath(profile);
|
|
334
338
|
const privPath = privateKeyPath(profile);
|
|
335
|
-
const independent =
|
|
339
|
+
const independent = PROFILE_CONFIG_DIR_RE.test(profile);
|
|
336
340
|
if (!independent && (!import_node_fs.default.existsSync(pubPath) || !import_node_fs.default.existsSync(privPath)))
|
|
337
341
|
return null;
|
|
338
342
|
const pubRaw = independent ? readIndependentIdentityFile(pubPath, false) : import_node_fs.default.readFileSync(pubPath, "utf-8");
|
|
@@ -465,7 +469,7 @@ async function initDeviceIdentity(profile, options = {}) {
|
|
|
465
469
|
return _initializing;
|
|
466
470
|
if (_state.kind !== "uninit")
|
|
467
471
|
return;
|
|
468
|
-
if (typeof profile !== "string" ||
|
|
472
|
+
if (typeof profile !== "string" || !INIT_DEVICE_IDENTITY_RE.test(profile)) {
|
|
469
473
|
_state = { kind: "disabled", reason: "init_failed" };
|
|
470
474
|
emit("init_failed", false, { reason: "invalid_profile" });
|
|
471
475
|
return;
|
|
@@ -491,7 +495,7 @@ async function initDeviceIdentity(profile, options = {}) {
|
|
|
491
495
|
}
|
|
492
496
|
}
|
|
493
497
|
async function initDeviceIdentityLocked(profile, options = {}) {
|
|
494
|
-
const independent =
|
|
498
|
+
const independent = PROFILE_CONFIG_DIR_RE.test(profile);
|
|
495
499
|
if (!independent)
|
|
496
500
|
await consolidateDeviceIdentity(profile);
|
|
497
501
|
let stored = null;
|
|
@@ -612,7 +616,7 @@ async function resetDeviceIdentity(opts) {
|
|
|
612
616
|
_activeSeen = null;
|
|
613
617
|
}
|
|
614
618
|
async function prepareHardwareKeyCandidate(profile) {
|
|
615
|
-
if (
|
|
619
|
+
if (PROFILE_CONFIG_DIR_RE.test(profile))
|
|
616
620
|
return { ok: false, reason: "independent_profile" };
|
|
617
621
|
if (_state.kind === "active" && _state.key.custody === "hardware") {
|
|
618
622
|
return { ok: false, reason: "already_hardware" };
|
|
@@ -662,7 +666,7 @@ function retireSoftwareKey(profile) {
|
|
|
662
666
|
const raw = import_node_fs.default.readFileSync(priv, "utf-8");
|
|
663
667
|
if ((0, import_deviceKeyHardware.parseHardwareKeyRecord)(raw))
|
|
664
668
|
return;
|
|
665
|
-
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(
|
|
669
|
+
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(RETIRE_SOFTWARE_KEY_RE, "-");
|
|
666
670
|
(0, import_stateFiles.atomicWrite0600)(`${priv}${import_profileStateDir.RETIRED_COPY_SUFFIX}.${stamp}`, raw, `keep the replaced software device key for profile ${profile}`);
|
|
667
671
|
try {
|
|
668
672
|
(0, import_stateFiles.atomicWrite0600)(`${publicKeyPath(profile)}${import_profileStateDir.RETIRED_COPY_SUFFIX}.${stamp}`, import_node_fs.default.readFileSync(publicKeyPath(profile), "utf-8"), `keep the replaced software device public key for profile ${profile}`);
|
|
@@ -928,7 +932,7 @@ async function enrollWithServer(opts) {
|
|
|
928
932
|
}
|
|
929
933
|
}
|
|
930
934
|
}
|
|
931
|
-
const base = serverUrl.replace(
|
|
935
|
+
const base = serverUrl.replace(ENROLL_WITH_SERVER_RE, "");
|
|
932
936
|
const htu = `${base}/api/daemon-resources/enroll-device-key`;
|
|
933
937
|
let proofJws;
|
|
934
938
|
try {
|
|
@@ -48,12 +48,17 @@ __export(deviceKey_exports, {
|
|
|
48
48
|
});
|
|
49
49
|
module.exports = __toCommonJS(deviceKey_exports);
|
|
50
50
|
var import_node_crypto = __toESM(require("node:crypto"), 1);
|
|
51
|
+
const B64U_RE = /=+$/;
|
|
52
|
+
const B64U_RE_2 = /\+/g;
|
|
53
|
+
const B64U_RE_3 = /\//g;
|
|
54
|
+
const B64U_DECODE_RE = /-/g;
|
|
55
|
+
const B64U_DECODE_RE_2 = /_/g;
|
|
51
56
|
const DEVICE_KEY_ALGS = ["ES256", "EdDSA"];
|
|
52
57
|
function b64u(buf) {
|
|
53
|
-
return buf.toString("base64").replace(
|
|
58
|
+
return buf.toString("base64").replace(B64U_RE, "").replace(B64U_RE_2, "-").replace(B64U_RE_3, "_");
|
|
54
59
|
}
|
|
55
60
|
function b64uDecode(s) {
|
|
56
|
-
const padded = s.replace(
|
|
61
|
+
const padded = s.replace(B64U_DECODE_RE, "+").replace(B64U_DECODE_RE_2, "/");
|
|
57
62
|
const pad = padded.length % 4;
|
|
58
63
|
return Buffer.from(pad === 0 ? padded : padded + "=".repeat(4 - pad), "base64");
|
|
59
64
|
}
|
|
@@ -44,6 +44,11 @@ __export(dpop_exports, {
|
|
|
44
44
|
module.exports = __toCommonJS(dpop_exports);
|
|
45
45
|
var crypto = __toESM(require("node:crypto"), 1);
|
|
46
46
|
var import_deviceKey = require("./deviceKey.js");
|
|
47
|
+
const B64U_RE = /=+$/;
|
|
48
|
+
const B64U_RE_2 = /\+/g;
|
|
49
|
+
const B64U_RE_3 = /\//g;
|
|
50
|
+
const BUILD_DPOP_PROOF_WITH_KEY_RE = /^[A-Za-z]{3,10}$/;
|
|
51
|
+
const IS_ATH_RE = /^[A-Za-z0-9_-]{43}$/;
|
|
47
52
|
const DPOP_PROOF_TYP = "dpop+jwt";
|
|
48
53
|
const DPOP_HEADER = "DPoP";
|
|
49
54
|
const DPOP_MAX_AGE_SECONDS = 60;
|
|
@@ -67,10 +72,10 @@ function createDpopKey() {
|
|
|
67
72
|
});
|
|
68
73
|
}
|
|
69
74
|
function b64u(buf) {
|
|
70
|
-
return buf.toString("base64").replace(
|
|
75
|
+
return buf.toString("base64").replace(B64U_RE, "").replace(B64U_RE_2, "-").replace(B64U_RE_3, "_");
|
|
71
76
|
}
|
|
72
77
|
function buildDpopProofWithKey(privateKey, publicJwk, req) {
|
|
73
|
-
if (typeof req.htm !== "string" ||
|
|
78
|
+
if (typeof req.htm !== "string" || !BUILD_DPOP_PROOF_WITH_KEY_RE.test(req.htm)) {
|
|
74
79
|
throw new Error("dpop: htm must be an HTTP method");
|
|
75
80
|
}
|
|
76
81
|
if (typeof req.htu !== "string" || req.htu.length === 0) {
|
|
@@ -99,7 +104,7 @@ function accessTokenHash(accessToken) {
|
|
|
99
104
|
return (0, import_deviceKey.tokenHash)(accessToken);
|
|
100
105
|
}
|
|
101
106
|
function isAth(value) {
|
|
102
|
-
return typeof value === "string" &&
|
|
107
|
+
return typeof value === "string" && IS_ATH_RE.test(value);
|
|
103
108
|
}
|
|
104
109
|
const isJwkThumbprint = isAth;
|
|
105
110
|
function verifyDpopProof(jws, opts) {
|
|
@@ -57,6 +57,7 @@ __export(firstPartyHarness_exports, {
|
|
|
57
57
|
wireHarnessProvider: () => wireHarnessProvider
|
|
58
58
|
});
|
|
59
59
|
module.exports = __toCommonJS(firstPartyHarness_exports);
|
|
60
|
+
const ENGINE_ENV_NAME_RE = /-/g;
|
|
60
61
|
const SLUG = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
61
62
|
function defineIdentity(identity) {
|
|
62
63
|
const spellings = [identity.provider, ...identity.aliases];
|
|
@@ -273,7 +274,7 @@ const ENGINE_ENV_SUFFIXES = Object.freeze({
|
|
|
273
274
|
sessionId: "SESSION_ID"
|
|
274
275
|
});
|
|
275
276
|
function engineEnvName(appName, key) {
|
|
276
|
-
return `${appName.toUpperCase().replace(
|
|
277
|
+
return `${appName.toUpperCase().replace(ENGINE_ENV_NAME_RE, "_")}_${ENGINE_ENV_SUFFIXES[key]}`;
|
|
277
278
|
}
|
|
278
279
|
function engineEnvTable(appName) {
|
|
279
280
|
return Object.freeze(Object.fromEntries(Object.keys(ENGINE_ENV_SUFFIXES).map((key) => [
|
|
@@ -29,6 +29,7 @@ __export(firstPartyHarnessChannels_exports, {
|
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(firstPartyHarnessChannels_exports);
|
|
31
31
|
var import_firstPartyHarness = require("./firstPartyHarness.js");
|
|
32
|
+
const RESOLVE_CHANNEL_MANIFEST_URL_RE = /\/+$/;
|
|
32
33
|
const FIRST_PARTY_HARNESS_CHANNELS = ["internal", "canary", "beta", "stable"];
|
|
33
34
|
const DEFAULT_FIRST_PARTY_HARNESS_CHANNEL = "stable";
|
|
34
35
|
function isFirstPartyHarnessChannel(value) {
|
|
@@ -51,7 +52,7 @@ function firstPartyHarnessChannelPrefix(channel) {
|
|
|
51
52
|
return `channels/${channel}/`;
|
|
52
53
|
}
|
|
53
54
|
function resolveChannelManifestUrl(input) {
|
|
54
|
-
const base = input.base.replace(
|
|
55
|
+
const base = input.base.replace(RESOLVE_CHANNEL_MANIFEST_URL_RE, "");
|
|
55
56
|
if (input.pinnedVersion) {
|
|
56
57
|
return `${base}/releases/${input.pinnedVersion}/${input.manifestFilename}`;
|
|
57
58
|
}
|
|
@@ -59,10 +60,10 @@ function resolveChannelManifestUrl(input) {
|
|
|
59
60
|
}
|
|
60
61
|
function firstPartyHarnessFeedBase(env = process.env) {
|
|
61
62
|
const override = (0, import_firstPartyHarness.readFirstPartyHarnessEnv)(env, "updateFeedBase").value;
|
|
62
|
-
return (override || (0, import_firstPartyHarness.firstPartyHarnessDefaultFeedBase)()).replace(
|
|
63
|
+
return (override || (0, import_firstPartyHarness.firstPartyHarnessDefaultFeedBase)()).replace(RESOLVE_CHANNEL_MANIFEST_URL_RE, "");
|
|
63
64
|
}
|
|
64
65
|
function firstPartyHarnessFeedCandidates(env = process.env, options = {}) {
|
|
65
|
-
const override = (0, import_firstPartyHarness.readFirstPartyHarnessEnv)(env, "updateFeedBase").value?.replace(
|
|
66
|
+
const override = (0, import_firstPartyHarness.readFirstPartyHarnessEnv)(env, "updateFeedBase").value?.replace(RESOLVE_CHANNEL_MANIFEST_URL_RE, "");
|
|
66
67
|
const spellings = options.pinnedRelease ? (0, import_firstPartyHarness.firstPartyHarnessArtifactSpellings)() : (0, import_firstPartyHarness.firstPartyHarnessSpellings)();
|
|
67
68
|
return spellings.map((provider) => ({
|
|
68
69
|
base: override || (0, import_firstPartyHarness.firstPartyHarnessDefaultFeedBase)(provider),
|
|
@@ -63,6 +63,7 @@ var import_releasePolicy = require("./releasePolicy.js");
|
|
|
63
63
|
var import_firstPartyHarnessReleaseKeys2 = require("./firstPartyHarnessReleaseKeys.js");
|
|
64
64
|
var import_firstPartyHarnessChannels2 = require("./firstPartyHarnessChannels.js");
|
|
65
65
|
var import_firstPartyHarness2 = require("./firstPartyHarness.js");
|
|
66
|
+
const VALIDATE_ARTIFACT_RE = /^[a-fA-F0-9]{64}$/;
|
|
66
67
|
const PREVIOUS_SUFFIX = import_firstPartyHarnessHome.FIRST_PARTY_HARNESS_PREVIOUS_SUFFIX;
|
|
67
68
|
const PROVENANCE_SUFFIX = import_firstPartyHarnessHome.FIRST_PARTY_HARNESS_PROVENANCE_SUFFIX;
|
|
68
69
|
const MAX_ARTIFACT_BYTES = 400 * 1024 * 1024;
|
|
@@ -421,7 +422,7 @@ function migrateFlatLayout(env, _progress) {
|
|
|
421
422
|
function validateArtifact(options) {
|
|
422
423
|
const keys = options.keys ?? import_firstPartyHarnessReleaseKeys.FIRST_PARTY_HARNESS_RELEASE_PUBLIC_KEYS;
|
|
423
424
|
const record = options.provenance;
|
|
424
|
-
if (!record || typeof record !== "object" || typeof record.version !== "string" || typeof record.platform !== "string" || typeof record.sha256 !== "string" ||
|
|
425
|
+
if (!record || typeof record !== "object" || typeof record.version !== "string" || typeof record.platform !== "string" || typeof record.sha256 !== "string" || !VALIDATE_ARTIFACT_RE.test(record.sha256) || typeof record.url !== "string" || typeof record.sig !== "string" || !Buffer.isBuffer(options.binary))
|
|
425
426
|
return fail("artifact-unverified", "artifact provenance is malformed");
|
|
426
427
|
if (!keys.length)
|
|
427
428
|
return fail("no-pinned-keys", "no pinned engine release keys; refusing activation");
|
|
@@ -23,12 +23,14 @@ __export(githubPushRefusal_exports, {
|
|
|
23
23
|
isWorkflowPath: () => isWorkflowPath
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(githubPushRefusal_exports);
|
|
26
|
+
const WORKFLOW_PATH_RE = /^\.github\/workflows\/[A-Za-z0-9_. /-]+$/;
|
|
27
|
+
const CLASSIFY_GIT_HUB_PUSH_REFUSAL_PATTERN = /refusing to allow (?:a|an) (GitHub App|OAuth App|Personal Access Token) to create or update workflow [`'"]([^`'"\r\n]+)[`'"] without [`'"]workflows?[`'"] (?:permission|scope)/gi;
|
|
26
28
|
const GITHUB_WORKFLOW_PERMISSION_REQUIRED = "github_workflow_permission_required";
|
|
27
29
|
function workflowPath(value) {
|
|
28
30
|
if (typeof value !== "string" || value.length > 240)
|
|
29
31
|
return null;
|
|
30
32
|
const path = value.replaceAll("\\", "/");
|
|
31
|
-
if (
|
|
33
|
+
if (!WORKFLOW_PATH_RE.test(path))
|
|
32
34
|
return null;
|
|
33
35
|
const parts = path.split("/");
|
|
34
36
|
if (parts.some((part) => !part.trim() || part !== part.trim() || part === "." || part === ".."))
|
|
@@ -42,10 +44,9 @@ function classifyGitHubPushRefusal(text) {
|
|
|
42
44
|
if (typeof text !== "string")
|
|
43
45
|
return null;
|
|
44
46
|
const input = text.slice(-64 * 1024);
|
|
45
|
-
const pattern = /refusing to allow (?:a|an) (GitHub App|OAuth App|Personal Access Token) to create or update workflow [`'"]([^`'"\r\n]+)[`'"] without [`'"]workflows?[`'"] (?:permission|scope)/gi;
|
|
46
47
|
const paths = [];
|
|
47
48
|
let tokenKind = "unknown";
|
|
48
|
-
for (const match of input.matchAll(
|
|
49
|
+
for (const match of input.matchAll(CLASSIFY_GIT_HUB_PUSH_REFUSAL_PATTERN)) {
|
|
49
50
|
const path = workflowPath(match[2]);
|
|
50
51
|
if (!path)
|
|
51
52
|
continue;
|
|
@@ -38,6 +38,7 @@ __export(guidedUpdate_exports, {
|
|
|
38
38
|
verifyReplacement: () => verifyReplacement
|
|
39
39
|
});
|
|
40
40
|
module.exports = __toCommonJS(guidedUpdate_exports);
|
|
41
|
+
const SANITIZE_BLOCKER_TEXT_RE = /\s+/g;
|
|
41
42
|
const GUIDED_SERVER_SOURCES = [
|
|
42
43
|
"claims",
|
|
43
44
|
"receipts",
|
|
@@ -134,7 +135,7 @@ function sanitizeBlockerText(value, max = BLOCKER_TEXT_MAX) {
|
|
|
134
135
|
const cleaned = Array.from(value, (ch) => {
|
|
135
136
|
const code = ch.charCodeAt(0);
|
|
136
137
|
return code < 32 || code === 127 ? " " : ch;
|
|
137
|
-
}).join("").replace(
|
|
138
|
+
}).join("").replace(SANITIZE_BLOCKER_TEXT_RE, " ").trim();
|
|
138
139
|
if (!cleaned || PATHLIKE.test(cleaned))
|
|
139
140
|
return void 0;
|
|
140
141
|
return cleaned.length > max ? `${cleaned.slice(0, max - 1)}\u2026` : cleaned;
|
|
@@ -39,6 +39,11 @@ var import_node_crypto = __toESM(require("node:crypto"), 1);
|
|
|
39
39
|
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
40
40
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
41
41
|
var import_liveState = require("./liveState.js");
|
|
42
|
+
const VALID_SECRET_RE = /^[A-Za-z0-9_-]{43}$/;
|
|
43
|
+
const RESERVE_INDEPENDENT_MACHINE_PROFILE_RE = /^[a-fA-F0-9]{24}$/;
|
|
44
|
+
const READ_INDEPENDENT_MACHINE_RESERVATION_RE = /^[a-f0-9]{24}$/;
|
|
45
|
+
const READ_INDEPENDENT_MACHINE_RESERVATION_RE_2 = /^[a-f0-9]{64}$/;
|
|
46
|
+
const READ_INDEPENDENT_MACHINE_RESERVATION_RE_3 = /^[A-Za-z0-9+/]+={0,2}$/;
|
|
42
47
|
const INDEPENDENT_MACHINE_PROFILE_RE = /^desktop-bg-[a-f0-9]{32}$/;
|
|
43
48
|
const INDEPENDENT_MACHINE_RESERVATION_FILE = "independent-machine-attempt.json";
|
|
44
49
|
function canonicalOrigin(input) {
|
|
@@ -51,7 +56,7 @@ function canonicalOrigin(input) {
|
|
|
51
56
|
}
|
|
52
57
|
}
|
|
53
58
|
function validSecret(secret) {
|
|
54
|
-
return typeof secret === "string" &&
|
|
59
|
+
return typeof secret === "string" && VALID_SECRET_RE.test(secret) && Buffer.from(secret, "base64url").length === 32 && Buffer.from(secret, "base64url").toString("base64url") === secret;
|
|
55
60
|
}
|
|
56
61
|
function hashSecret(profile, ownerId, origin, secret) {
|
|
57
62
|
return import_node_crypto.default.createHash("sha256").update("independent-machine-reservation:v2\0").update(profile).update("\0").update(ownerId).update("\0").update(origin).update("\0").update(secret).digest();
|
|
@@ -63,7 +68,7 @@ function reservationPath(root, profile) {
|
|
|
63
68
|
return import_node_path.default.join(root, "profiles", profile, INDEPENDENT_MACHINE_RESERVATION_FILE);
|
|
64
69
|
}
|
|
65
70
|
function reserveIndependentMachineProfile(options) {
|
|
66
|
-
if (!import_node_path.default.isAbsolute(options.root) ||
|
|
71
|
+
if (!import_node_path.default.isAbsolute(options.root) || !RESERVE_INDEPENDENT_MACHINE_PROFILE_RE.test(options.ownerId) || !canonicalOrigin(options.origin))
|
|
67
72
|
throw new Error("Invalid background authorization context");
|
|
68
73
|
const secret = import_node_crypto.default.randomBytes(32).toString("base64url");
|
|
69
74
|
const encrypted = options.encrypt(secret);
|
|
@@ -138,7 +143,7 @@ function readIndependentMachineReservation(root, profile) {
|
|
|
138
143
|
import_node_fs.default.closeSync(fd);
|
|
139
144
|
}
|
|
140
145
|
const value = JSON.parse(raw);
|
|
141
|
-
if (value.version !== 2 || value.profile !== profile || typeof value.ownerId !== "string" ||
|
|
146
|
+
if (value.version !== 2 || value.profile !== profile || typeof value.ownerId !== "string" || !READ_INDEPENDENT_MACHINE_RESERVATION_RE.test(value.ownerId) || typeof value.origin !== "string" || !canonicalOrigin(value.origin) || typeof value.secretHash !== "string" || !READ_INDEPENDENT_MACHINE_RESERVATION_RE_2.test(value.secretHash) || typeof value.encryptedSecret !== "string" || !READ_INDEPENDENT_MACHINE_RESERVATION_RE_3.test(value.encryptedSecret) || typeof value.createdAt !== "string" || !Number.isFinite(Date.parse(value.createdAt)))
|
|
142
147
|
return null;
|
|
143
148
|
return value;
|
|
144
149
|
} catch {
|
|
@@ -49,6 +49,8 @@ var import_types = require("./types.js");
|
|
|
49
49
|
var import_zeroize_registry = require("./zeroize-registry.js");
|
|
50
50
|
var import_masterKekService = require("./masterKekService.js");
|
|
51
51
|
var import_liveState = require("../liveState.js");
|
|
52
|
+
const RESOLVE_LOGIN_KEYCHAIN_RE = /"([^"]+)"/;
|
|
53
|
+
const READ_KEK_FROM_KEYCHAIN_RE = /\n$/;
|
|
52
54
|
const KIND_SHELLOUT = "macos-keychain-shellout";
|
|
53
55
|
const KEYCHAIN_SERVICE = import_masterKekService.MASTER_KEK_KEYCHAIN_SERVICE;
|
|
54
56
|
const KEYCHAIN_ACCOUNT = import_masterKekService.MASTER_KEK_KEYCHAIN_ACCOUNT;
|
|
@@ -97,7 +99,7 @@ async function resolveLoginKeychain() {
|
|
|
97
99
|
return _resolvedKeychainCache;
|
|
98
100
|
try {
|
|
99
101
|
const { stdout } = await exec("security", ["default-keychain", "-d", "user"]);
|
|
100
|
-
const match = stdout.match(
|
|
102
|
+
const match = stdout.match(RESOLVE_LOGIN_KEYCHAIN_RE);
|
|
101
103
|
if (match && match[1] && import_node_fs.default.existsSync(match[1])) {
|
|
102
104
|
_resolvedKeychainCache = match[1];
|
|
103
105
|
return _resolvedKeychainCache;
|
|
@@ -135,7 +137,7 @@ async function readKekFromKeychain(service, account) {
|
|
|
135
137
|
"-w",
|
|
136
138
|
keychainPath
|
|
137
139
|
]);
|
|
138
|
-
const trimmed = stdout.replace(
|
|
140
|
+
const trimmed = stdout.replace(READ_KEK_FROM_KEYCHAIN_RE, "").trim();
|
|
139
141
|
if (trimmed.length === 0)
|
|
140
142
|
return null;
|
|
141
143
|
let raw;
|
|
@@ -60,6 +60,8 @@ var import_node_os = __toESM(require("node:os"), 1);
|
|
|
60
60
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
61
61
|
var import_masterKekService = require("./kek/masterKekService.js");
|
|
62
62
|
var import_localIdentity = require("./localIdentity.js");
|
|
63
|
+
const USER_DATABASE_HOME_RE = /^NFSHomeDirectory:\s*/;
|
|
64
|
+
const KEYCHAIN_SUFFIX_FOR_DIR_RE = /\/+$/;
|
|
63
65
|
const ALLOW_LIVE_STATE_ENV = "SKRR_TEST_ALLOW_LIVE_STATE";
|
|
64
66
|
const HERMETIC_HOME_ENV = "SKRR_TEST_HERMETIC_HOME";
|
|
65
67
|
const LIVE_STATE_REFUSED_CODE = "SKRR_TEST_LIVE_STATE";
|
|
@@ -104,7 +106,7 @@ function userDatabaseHome() {
|
|
|
104
106
|
`/Users/${import_node_os.default.userInfo().username}`,
|
|
105
107
|
"NFSHomeDirectory"
|
|
106
108
|
]);
|
|
107
|
-
const home = out.replace(
|
|
109
|
+
const home = out.replace(USER_DATABASE_HOME_RE, "").trim();
|
|
108
110
|
return home || null;
|
|
109
111
|
}
|
|
110
112
|
if (process.platform === "linux" && typeof process.getuid === "function") {
|
|
@@ -208,7 +210,7 @@ const DAEMON_BYOK_KEYCHAIN_SERVICE_BASE = `${import_localIdentity.NATIVE_ID_PREF
|
|
|
208
210
|
const LEGACY_DAEMON_KEYCHAIN_SERVICE = "ai.oversky.daemon";
|
|
209
211
|
const LIVE_DEFAULT_PROFILE = "default";
|
|
210
212
|
function keychainSuffixForDir(dir) {
|
|
211
|
-
const resolved = import_node_path.default.resolve(dir.replace(
|
|
213
|
+
const resolved = import_node_path.default.resolve(dir.replace(KEYCHAIN_SUFFIX_FOR_DIR_RE, ""));
|
|
212
214
|
return `-${(0, import_node_crypto.createHash)("sha256").update(resolved).digest("hex").toLowerCase().slice(0, 8)}`;
|
|
213
215
|
}
|
|
214
216
|
const UNVERIFIABLE_DEFAULT_SLOT_RE = new RegExp(`^(?:${DAEMON_KEYCHAIN_SERVICE_BASE.replace(/\./g, "\\.")}|${DAEMON_BYOK_KEYCHAIN_SERVICE_BASE.replace(/\./g, "\\.")})\\.${LIVE_DEFAULT_PROFILE}-[0-9a-f]{8}$`);
|
|
@@ -26,6 +26,7 @@ module.exports = __toCommonJS(loginWithLocalhost_exports);
|
|
|
26
26
|
var import_pkce = require("./pkce.js");
|
|
27
27
|
var import_loginLocalhost = require("./loginLocalhost.js");
|
|
28
28
|
var import_runtime = require("./runtime.js");
|
|
29
|
+
const LOGIN_WITH_LOCALHOST_RE = /\/+$/;
|
|
29
30
|
const DEFAULT_SCOPE = "daemon";
|
|
30
31
|
class LoginInitError extends Error {
|
|
31
32
|
code;
|
|
@@ -60,7 +61,7 @@ async function loginWithLocalhost(opts) {
|
|
|
60
61
|
throw new TypeError("loginWithLocalhost: globalThis.fetch is missing \u2014 pass fetchImpl or run under Node \u2265 20");
|
|
61
62
|
}
|
|
62
63
|
const scope = opts.scope ?? DEFAULT_SCOPE;
|
|
63
|
-
const serverUrl = opts.serverUrl.replace(
|
|
64
|
+
const serverUrl = opts.serverUrl.replace(LOGIN_WITH_LOCALHOST_RE, "");
|
|
64
65
|
const codeVerifier = (0, import_pkce.generateVerifier)();
|
|
65
66
|
const codeChallenge = (0, import_pkce.challenge)(codeVerifier, "S256");
|
|
66
67
|
const state = (0, import_pkce.generateState)();
|
|
@@ -39,6 +39,7 @@ module.exports = __toCommonJS(loopbackHttp_exports);
|
|
|
39
39
|
var import_node_dns = __toESM(require("node:dns"), 1);
|
|
40
40
|
var import_node_http = __toESM(require("node:http"), 1);
|
|
41
41
|
var import_node_net = __toESM(require("node:net"), 1);
|
|
42
|
+
const IS_LOOPBACK_ADDRESS_RE = /^([0-9a-f]{1,4}):[0-9a-f]{1,4}$/;
|
|
42
43
|
const LOOPBACK_NAMES = /* @__PURE__ */ new Set(["localhost"]);
|
|
43
44
|
const LOOPBACK_DEFAULT_MAX_BODY_BYTES = 16 * 1024 * 1024;
|
|
44
45
|
const NULL_BODY_STATUSES = /* @__PURE__ */ new Set([101, 103, 204, 205, 304]);
|
|
@@ -63,7 +64,7 @@ function isLoopbackAddress(address) {
|
|
|
63
64
|
const rest = value.slice("::ffff:".length);
|
|
64
65
|
if (import_node_net.default.isIPv4(rest))
|
|
65
66
|
return isLoopbackAddress(rest);
|
|
66
|
-
const high =
|
|
67
|
+
const high = IS_LOOPBACK_ADDRESS_RE.exec(rest);
|
|
67
68
|
return high ? parseInt(high[1], 16) >> 8 === 127 : false;
|
|
68
69
|
}
|
|
69
70
|
return false;
|
|
@@ -49,6 +49,8 @@ var import_node_child_process = require("node:child_process");
|
|
|
49
49
|
var import_configRoot = require("./configRoot.js");
|
|
50
50
|
var import_liveState = require("./liveState.js");
|
|
51
51
|
var import_stateFiles = require("./stateFiles.js");
|
|
52
|
+
const READ_MACHINE_UUID_DARWIN_RE = /IOPlatformUUID"?\s*=\s*"?([0-9A-F-]{36})/i;
|
|
53
|
+
const READ_MACHINE_UUID_WINDOWS_RE = /MachineGuid\s+REG_SZ\s+([0-9A-Fa-f-]{36})/;
|
|
52
54
|
const HOSTED_RUNTIME_MACHINE_SOURCES = /* @__PURE__ */ new Set([
|
|
53
55
|
"hosted-machine",
|
|
54
56
|
"cloud-coding",
|
|
@@ -72,7 +74,7 @@ function readMachineUuidDarwin() {
|
|
|
72
74
|
timeout: 2e3,
|
|
73
75
|
stdio: ["ignore", "pipe", "ignore"]
|
|
74
76
|
});
|
|
75
|
-
const match = out.match(
|
|
77
|
+
const match = out.match(READ_MACHINE_UUID_DARWIN_RE);
|
|
76
78
|
return match ? match[1].toLowerCase() : null;
|
|
77
79
|
} catch {
|
|
78
80
|
return null;
|
|
@@ -92,7 +94,7 @@ function readMachineUuidLinux() {
|
|
|
92
94
|
function readMachineUuidWindows() {
|
|
93
95
|
try {
|
|
94
96
|
const out = (0, import_node_child_process.execFileSync)("reg", ["query", "HKLM\\SOFTWARE\\Microsoft\\Cryptography", "/v", "MachineGuid"], { encoding: "utf-8", timeout: 2e3, stdio: ["ignore", "pipe", "ignore"] });
|
|
95
|
-
const match = out.match(
|
|
97
|
+
const match = out.match(READ_MACHINE_UUID_WINDOWS_RE);
|
|
96
98
|
return match ? match[1].toLowerCase() : null;
|
|
97
99
|
} catch {
|
|
98
100
|
return null;
|
|
@@ -46,6 +46,7 @@ var import_node_fs = __toESM(require("node:fs"), 1);
|
|
|
46
46
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
47
47
|
var import_runtime = require("./runtime.js");
|
|
48
48
|
var import_stateFiles = require("./stateFiles.js");
|
|
49
|
+
const MOVE_ASIDE_RE = /[:.]/g;
|
|
49
50
|
const PROFILES_SEGMENT = "profiles";
|
|
50
51
|
const SUPERSEDED_MARKER_SUFFIX = ".superseded.json";
|
|
51
52
|
const SUPERSEDED_COPY_SUFFIX = ".superseded";
|
|
@@ -206,7 +207,7 @@ function adopt(fromDir, toDir, files, dryRun) {
|
|
|
206
207
|
return { written, supersededAside: [] };
|
|
207
208
|
}
|
|
208
209
|
function moveAside(dir, files, suffix = SUPERSEDED_COPY_SUFFIX) {
|
|
209
|
-
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(
|
|
210
|
+
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(MOVE_ASIDE_RE, "-");
|
|
210
211
|
const aside = [];
|
|
211
212
|
for (const name of files) {
|
|
212
213
|
const target = import_node_path.default.join(dir, name);
|
|
@@ -24,6 +24,7 @@ __export(recoveryCode_exports, {
|
|
|
24
24
|
parseRecoveryCode: () => parseRecoveryCode
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(recoveryCode_exports);
|
|
27
|
+
const NORMALIZE_RAW_RE = /[\s-]/g;
|
|
27
28
|
const BASE32_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
28
29
|
const TOTAL_CHARS = 55;
|
|
29
30
|
const GROUP_COUNT = 11;
|
|
@@ -73,7 +74,7 @@ function base32ToBytes(chars) {
|
|
|
73
74
|
return Buffer.from(bytes);
|
|
74
75
|
}
|
|
75
76
|
function normalizeRaw(input) {
|
|
76
|
-
const upper = input.toUpperCase().replace(
|
|
77
|
+
const upper = input.toUpperCase().replace(NORMALIZE_RAW_RE, "");
|
|
77
78
|
for (let i = 0; i < upper.length; i++) {
|
|
78
79
|
const ch = upper[i];
|
|
79
80
|
const code = ch.charCodeAt(0);
|
|
@@ -54,6 +54,7 @@ var import_liveState = require("./liveState.js");
|
|
|
54
54
|
var import_refreshClassification = require("./refreshClassification.js");
|
|
55
55
|
var import_stateFiles = require("./stateFiles.js");
|
|
56
56
|
var import_types = require("./types.js");
|
|
57
|
+
const REVOKE_DAEMON_REFRESH_SESSION_REPORTED_RE = /\/+$/;
|
|
57
58
|
const LOCK_STALE_MS = 5e3;
|
|
58
59
|
const LOCK_RETRY_MS = 100;
|
|
59
60
|
const LOCK_MAX_RETRIES = 50;
|
|
@@ -257,7 +258,7 @@ async function revokeDaemonRefreshSession(serverUrl, refreshToken) {
|
|
|
257
258
|
async function revokeDaemonRefreshSessionReported(serverUrl, refreshToken) {
|
|
258
259
|
if (!refreshToken)
|
|
259
260
|
return { outcome: "unreachable", detail: "no refresh token to present" };
|
|
260
|
-
const url = `${serverUrl.replace(
|
|
261
|
+
const url = `${serverUrl.replace(REVOKE_DAEMON_REFRESH_SESSION_REPORTED_RE, "")}/api/daemons/token/revoke`;
|
|
261
262
|
const controller = new AbortController();
|
|
262
263
|
const timer = setTimeout(() => controller.abort(), 5e3);
|
|
263
264
|
const refreshTokenHash = import_node_crypto.default.createHash("sha256").update(refreshToken, "utf8").digest("hex");
|
|
@@ -286,7 +287,7 @@ async function doRefresh(serverUrl, currentRefreshToken, daemonId, options = {})
|
|
|
286
287
|
success: true,
|
|
287
288
|
metadata: { event: "refresh_start", daemonId }
|
|
288
289
|
});
|
|
289
|
-
const url = `${serverUrl.replace(
|
|
290
|
+
const url = `${serverUrl.replace(REVOKE_DAEMON_REFRESH_SESSION_REPORTED_RE, "")}/api/daemons/token/refresh`;
|
|
290
291
|
const body = {
|
|
291
292
|
refreshToken: currentRefreshToken,
|
|
292
293
|
daemonId
|
|
@@ -26,6 +26,7 @@ __export(releasePolicy_exports, {
|
|
|
26
26
|
module.exports = __toCommonJS(releasePolicy_exports);
|
|
27
27
|
var import_node_crypto = require("node:crypto");
|
|
28
28
|
var import_releaseKeys = require("./releaseKeys.js");
|
|
29
|
+
const POLICY_SHAPE_IS_VALID_RE = /^[0-9A-Za-z._:-]+$/;
|
|
29
30
|
const MAX_SIGS = 8;
|
|
30
31
|
function stableJson(value) {
|
|
31
32
|
if (value === null || typeof value === "boolean" || typeof value === "number" || typeof value === "string") {
|
|
@@ -63,7 +64,7 @@ function verifyOne(message, signature, keys) {
|
|
|
63
64
|
return { ok: false, reason: "signature did not verify against any pinned key" };
|
|
64
65
|
}
|
|
65
66
|
function policyShapeIsValid(policy) {
|
|
66
|
-
if (!policy || typeof policy !== "object" || policy.schemaVersion !== 1 ||
|
|
67
|
+
if (!policy || typeof policy !== "object" || policy.schemaVersion !== 1 || !POLICY_SHAPE_IS_VALID_RE.test(policy.releaseId) || !["stable", "canary", "beta", "internal"].includes(policy.channel) || !Number.isInteger(policy.rolloutBasisPoints) || policy.rolloutBasisPoints < 0 || policy.rolloutBasisPoints > 1e4 || typeof policy.cohortSeed !== "string" || policy.cohortSeed.length < 8 || !policy.components || typeof policy.components !== "object" || Array.isArray(policy.components)) {
|
|
67
68
|
return false;
|
|
68
69
|
}
|
|
69
70
|
const issued = Date.parse(policy.issuedAt);
|
|
@@ -21,15 +21,17 @@ __export(releaseVersions_exports, {
|
|
|
21
21
|
compareReleaseVersions: () => compareReleaseVersions
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(releaseVersions_exports);
|
|
24
|
+
const PARSE_RE = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|
|
25
|
+
const PARSE_RE_2 = /^\d+$/;
|
|
24
26
|
function compareReleaseVersions(a, b) {
|
|
25
27
|
const parse = (value) => {
|
|
26
28
|
if (typeof value !== "string")
|
|
27
29
|
return null;
|
|
28
|
-
const match =
|
|
30
|
+
const match = PARSE_RE.exec(value.trim());
|
|
29
31
|
if (!match)
|
|
30
32
|
return null;
|
|
31
33
|
const prerelease = match[4]?.split(".") ?? [];
|
|
32
|
-
if (prerelease.some((part) =>
|
|
34
|
+
if (prerelease.some((part) => PARSE_RE_2.test(part) && part.length > 1 && part[0] === "0"))
|
|
33
35
|
return null;
|
|
34
36
|
return { core: match.slice(1, 4).map(BigInt), prerelease };
|
|
35
37
|
};
|
|
@@ -51,8 +53,8 @@ function compareReleaseVersions(a, b) {
|
|
|
51
53
|
return l === r ? 0 : l === void 0 ? -1 : 1;
|
|
52
54
|
if (l === r)
|
|
53
55
|
continue;
|
|
54
|
-
const ln =
|
|
55
|
-
const rn =
|
|
56
|
+
const ln = PARSE_RE_2.test(l);
|
|
57
|
+
const rn = PARSE_RE_2.test(r);
|
|
56
58
|
if (ln && rn)
|
|
57
59
|
return BigInt(l) < BigInt(r) ? -1 : 1;
|
|
58
60
|
if (ln !== rn)
|
|
@@ -24,6 +24,7 @@ module.exports = __toCommonJS(restartArtifact_exports);
|
|
|
24
24
|
var import_node_crypto = require("node:crypto");
|
|
25
25
|
var import_node_fs = require("node:fs");
|
|
26
26
|
var import_node_path = require("node:path");
|
|
27
|
+
const WALK_RE = /\.(?:test|spec)\.[cm]?js$/;
|
|
27
28
|
const CODE_EXTENSIONS = /* @__PURE__ */ new Set([".js", ".cjs", ".mjs", ".json", ".node", ".wasm"]);
|
|
28
29
|
const OMIT_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", ".git", "__tests__", "__fixtures__"]);
|
|
29
30
|
const MAX_FILES = 25e3;
|
|
@@ -111,7 +112,7 @@ function captureRestartArtifact(input) {
|
|
|
111
112
|
throw new Error("Restart build contains a linked or special code file");
|
|
112
113
|
if (info.isDirectory()) {
|
|
113
114
|
walk(file, depth + 1);
|
|
114
|
-
} else if (CODE_EXTENSIONS.has((0, import_node_path.extname)(name)) &&
|
|
115
|
+
} else if (CODE_EXTENSIONS.has((0, import_node_path.extname)(name)) && !WALK_RE.test(name)) {
|
|
115
116
|
if (!info.isFile())
|
|
116
117
|
throw new Error("Restart build contains a linked or special code file");
|
|
117
118
|
addFile(file, (0, import_node_path.relative)(root, file).split("\\").join("/"));
|
|
@@ -31,6 +31,7 @@ __export(spawnEnv_exports, {
|
|
|
31
31
|
withLoopbackNoProxy: () => withLoopbackNoProxy
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(spawnEnv_exports);
|
|
34
|
+
const APPEND_NO_PROXY_HOSTS_RE = /[\s,]+$/;
|
|
34
35
|
const SENSITIVE_ENV_VARS = /* @__PURE__ */ new Set([
|
|
35
36
|
"CLAUDE_CODE_OAUTH_TOKEN",
|
|
36
37
|
"OVERSKY_TOKEN",
|
|
@@ -166,7 +167,7 @@ function appendNoProxyHosts(list, hosts) {
|
|
|
166
167
|
const missing = hosts.filter((host) => !entries.includes(host));
|
|
167
168
|
if (missing.length === 0)
|
|
168
169
|
return list;
|
|
169
|
-
const kept = list.replace(
|
|
170
|
+
const kept = list.replace(APPEND_NO_PROXY_HOSTS_RE, "");
|
|
170
171
|
return kept ? `${kept},${missing.join(",")}` : missing.join(",");
|
|
171
172
|
}
|
|
172
173
|
function withLoopbackNoProxy(env) {
|