@skrr-ai/cli 0.1.146 → 0.1.147
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base-command.js +38 -21
- package/dist/commands/agent/message/send.d.ts +11 -0
- package/dist/commands/agent/message/send.js +34 -8
- package/dist/commands/agent-worker.js +2 -1
- package/dist/commands/agents/activity.js +2 -1
- package/dist/commands/agents/badge.js +10 -5
- package/dist/commands/agents/categories/index.js +2 -1
- package/dist/commands/agents/chat.d.ts +1 -0
- package/dist/commands/agents/chat.js +29 -1
- package/dist/commands/agents/create.js +4 -1
- package/dist/commands/agents/overview.js +2 -1
- package/dist/commands/agents/releases/create.js +2 -1
- package/dist/commands/agents/schedule-overview.js +3 -1
- package/dist/commands/agents/schedule.js +2 -1
- package/dist/commands/agents/spawn.js +9 -6
- package/dist/commands/agents/tools/auth.js +2 -1
- package/dist/commands/agents/tools/calls.js +2 -1
- package/dist/commands/agents/visibility.js +2 -1
- package/dist/commands/balance/show.js +17 -2
- package/dist/commands/balance/statement.js +2 -1
- package/dist/commands/commands.js +2 -1
- package/dist/commands/commitments/create.js +2 -1
- package/dist/commands/commitments/delivery.js +2 -1
- package/dist/commands/commitments/doctor.js +2 -1
- package/dist/commands/commitments/observations.js +2 -2
- package/dist/commands/commitments/operating-review.js +2 -1
- package/dist/commands/commitments/pack/preflight.js +2 -1
- package/dist/commands/commitments/trigger-status.js +2 -1
- package/dist/commands/convos/messages.js +2 -1
- package/dist/commands/daemon/logs.js +18 -9
- package/dist/commands/daemon/usage.js +2 -1
- package/dist/commands/dm/messages.js +2 -1
- package/dist/commands/dm/thread/messages.js +2 -1
- package/dist/commands/dm/threads.js +2 -1
- package/dist/commands/doctor.js +2 -1
- package/dist/commands/goals/key-results/assess.js +2 -1
- package/dist/commands/goals/key-results/history.js +2 -1
- package/dist/commands/harnesses/forget.js +2 -1
- package/dist/commands/harnesses/show.js +12 -6
- package/dist/commands/inbox/index.js +4 -3
- package/dist/commands/initiatives/decide.js +2 -1
- package/dist/commands/instructions/diff.js +2 -1
- package/dist/commands/instructions/show.js +2 -1
- package/dist/commands/login.js +4 -2
- package/dist/commands/machines/dedicated/cp.js +2 -1
- package/dist/commands/machines/dedicated/power/set.js +2 -1
- package/dist/commands/machines/show.js +2 -1
- package/dist/commands/memory/maintain.js +2 -1
- package/dist/commands/memory/read.js +2 -1
- package/dist/commands/memory/rebuild-index.js +2 -1
- package/dist/commands/memory/rebuild.js +2 -1
- package/dist/commands/memory/search.js +2 -1
- package/dist/commands/messages/list.js +2 -1
- package/dist/commands/revoke-daemon.js +2 -1
- package/dist/commands/revoke-token.js +2 -1
- package/dist/commands/search/all.js +14 -7
- package/dist/commands/search/workspace.js +2 -1
- package/dist/commands/set-capabilities.js +2 -1
- package/dist/commands/skills/browse.js +8 -2
- package/dist/commands/spaces/auto-executor/preview.js +3 -2
- package/dist/commands/spaces/auto-executor/runs.js +4 -1
- package/dist/commands/spaces/workflow-templates/extract.d.ts +1 -0
- package/dist/commands/spaces/workflow-templates/extract.js +9 -1
- package/dist/commands/spaces/workflows/events.js +6 -3
- package/dist/commands/spaces/workflows/run.js +5 -3
- package/dist/commands/spaces/workflows/update.js +2 -1
- package/dist/commands/store/gallery-admissions/preview.js +2 -1
- package/dist/commands/store/publishers/profile/handle.js +2 -1
- package/dist/commands/tasks/comments/anchor.js +23 -9
- package/dist/commands/tasks/complete.js +4 -2
- package/dist/commands/tasks/create-tree.js +7 -3
- package/dist/commands/tasks/create.js +2 -1
- package/dist/commands/tasks/deliverable/add.js +2 -1
- package/dist/commands/tasks/deliverable/archive.js +2 -1
- package/dist/commands/tasks/deliverable/list.js +2 -1
- package/dist/commands/tasks/expectations/assess.js +2 -1
- package/dist/commands/tasks/labels/create.js +2 -1
- package/dist/commands/tasks/preflight.js +4 -2
- package/dist/commands/tasks/ready.js +2 -1
- package/dist/commands/tasks/result/submit.js +2 -1
- package/dist/commands/tasks/updates/add.js +2 -1
- package/dist/commands/tasks/wait.js +2 -1
- package/dist/commands/token/list.js +2 -1
- package/dist/commands/token/mint.js +2 -1
- package/dist/commands/wiki/write.js +14 -7
- package/dist/hooks/command-not-found.js +2 -1
- package/dist/lib/agent-chat-start.d.ts +77 -0
- package/dist/lib/agent-chat-start.js +169 -0
- package/dist/lib/agent-config.js +2 -1
- package/dist/lib/agent-endpoints.js +4 -2
- package/dist/lib/agent-evals.js +2 -1
- package/dist/lib/agent-guide-reference-gate.js +22 -11
- package/dist/lib/agent-guides.js +4 -1
- package/dist/lib/agent-instructions.js +5 -1
- package/dist/lib/agent-ref.js +8 -4
- package/dist/lib/agent-trigger-listing.js +2 -1
- package/dist/lib/agentic-stream.js +8 -5
- package/dist/lib/api-error-reason.js +2 -1
- package/dist/lib/api-fetch.js +5 -3
- package/dist/lib/appData.js +6 -6
- package/dist/lib/appInstallations.js +10 -5
- package/dist/lib/appsCheck.js +2 -1
- package/dist/lib/auth-failure.js +2 -1
- package/dist/lib/auth-storage.js +2 -1
- package/dist/lib/balance.js +6 -3
- package/dist/lib/capability-matrix.js +4 -2
- package/dist/lib/cli-runtime.js +2 -1
- package/dist/lib/code-handover.js +8 -3
- package/dist/lib/command-hygiene.js +28 -12
- package/dist/lib/command-manifest.js +6 -3
- package/dist/lib/commitment-attention-copy.js +2 -1
- package/dist/lib/commitment-event-wakes.js +9 -0
- package/dist/lib/commitment-product.js +5 -3
- package/dist/lib/commitment-terms.js +2 -1
- package/dist/lib/commitments.d.ts +8 -0
- package/dist/lib/commitments.js +8 -4
- package/dist/lib/compasses.js +2 -1
- package/dist/lib/completion-index.js +2 -1
- package/dist/lib/computer-files.js +8 -6
- package/dist/lib/config.js +11 -5
- package/dist/lib/conversation-search.js +4 -2
- package/dist/lib/daemon-installer.js +6 -2
- package/dist/lib/daemon-maintenance.js +2 -1
- package/dist/lib/daemon-ref.js +2 -1
- package/dist/lib/daemonBroker.js +6 -3
- package/dist/lib/daemonBrokerRefusal.js +4 -2
- package/dist/lib/daemonHandoff.js +14 -7
- package/dist/lib/daemonIslandProfile.js +2 -1
- package/dist/lib/dedicated-copy.js +9 -3
- package/dist/lib/dedicated-exec.js +2 -1
- package/dist/lib/dedicated-keep-awake.js +2 -1
- package/dist/lib/dedicated-machines.js +9 -5
- package/dist/lib/dedicated-service.js +2 -1
- package/dist/lib/dedicated-ssh.js +5 -3
- package/dist/lib/deployed-build.js +2 -1
- package/dist/lib/device-code.js +4 -3
- package/dist/lib/dpop-auth.js +2 -1
- package/dist/lib/earnings.js +2 -1
- package/dist/lib/exec-runtime-binary.js +5 -3
- package/dist/lib/first-party-harness-broker.js +4 -3
- package/dist/lib/first-party-harness-managed.js +2 -1
- package/dist/lib/first-party-harness-startup-update.js +8 -4
- package/dist/lib/first-party-harness-update.js +2 -1
- package/dist/lib/first-party-harness.js +2 -1
- package/dist/lib/format.js +8 -4
- package/dist/lib/git-task.js +10 -5
- package/dist/lib/github-tools.js +6 -3
- package/dist/lib/harnesses.js +4 -2
- package/dist/lib/hosted-machines.js +2 -1
- package/dist/lib/html-text.js +33 -16
- package/dist/lib/instruction-blocks.js +2 -1
- package/dist/lib/iso-instant.js +5 -3
- package/dist/lib/keychain.js +15 -5
- package/dist/lib/label-scope.js +2 -1
- package/dist/lib/live-runtime-binary.js +10 -7
- package/dist/lib/local-skills.js +10 -6
- package/dist/lib/login.js +3 -2
- package/dist/lib/machine-audit.js +2 -1
- package/dist/lib/machine-daemon-log.js +2 -1
- package/dist/lib/machine-services.js +2 -1
- package/dist/lib/memory-history-session.js +2 -1
- package/dist/lib/memory-sync.js +6 -2
- package/dist/lib/message-intent.d.ts +10 -0
- package/dist/lib/node-adapter.js +4 -2
- package/dist/lib/northstars.js +4 -2
- package/dist/lib/oauthLogin.js +16 -7
- package/dist/lib/open-target.js +8 -4
- package/dist/lib/option-hint.js +2 -4
- package/dist/lib/outbox.js +2 -1
- package/dist/lib/planOutcome.d.ts +5 -3
- package/dist/lib/planOutcome.js +7 -4
- package/dist/lib/platform-update-local.js +2 -3
- package/dist/lib/rate-limit-retry.js +2 -1
- package/dist/lib/reflection.js +2 -1
- package/dist/lib/request-field-flags.js +2 -1
- package/dist/lib/runtime-start-verification.js +2 -1
- package/dist/lib/schedule.js +2 -1
- package/dist/lib/scoped-memory-command.js +7 -3
- package/dist/lib/search-display.js +11 -4
- package/dist/lib/skill-store-pagination.js +2 -1
- package/dist/lib/space-notebook.js +5 -3
- package/dist/lib/store-listing.js +2 -1
- package/dist/lib/task-agent-context-capabilities.js +2 -1
- package/dist/lib/task-asset-upload.js +7 -3
- package/dist/lib/task-closure.js +2 -1
- package/dist/lib/task-economics.js +2 -1
- package/dist/lib/task-execution.js +16 -8
- package/dist/lib/task-extras.js +4 -2
- package/dist/lib/task-operation-watch.js +2 -1
- package/dist/lib/task-preflight.js +3 -2
- package/dist/lib/task-recurrence-summary.js +4 -2
- package/dist/lib/task-runtime-headers.js +10 -5
- package/dist/lib/task-transcript.js +3 -2
- package/dist/lib/task-transfer.js +9 -5
- package/dist/lib/tasks.js +2 -1
- package/dist/lib/triggers.d.ts +15 -0
- package/dist/lib/triggers.js +32 -3
- package/dist/lib/update-check.js +12 -7
- package/dist/lib/usage-discovery.js +2 -1
- package/dist/lib/usd-micros.js +2 -1
- package/dist/lib/web-url.js +2 -1
- package/dist/lib/widgetCheck.js +15 -9
- package/dist/lib/widgetStaticScan.js +26 -14
- package/dist/lib/workflow-run-view.js +5 -3
- package/dist/lib/workflow-templates.d.ts +10 -0
- package/dist/lib/workflow-templates.js +47 -0
- package/dist/lib/write-target.js +4 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/authHelper.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/commitmentExecutionContract.js +22 -12
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerUse.js +4 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelope.js +7 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.js +6 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonConsentProof.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonPair.js +16 -7
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +4 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/desktopDaemonProof.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/desktopWire.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.js +11 -7
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceKey.js +7 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/dpop.js +8 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarness.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessChannels.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessUpdater.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/githubPushRefusal.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/guidedUpdate.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/independentMachineReservation.js +8 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/kek/macos.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/liveState.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/loginWithLocalhost.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/loopbackHttp.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/machineUuid.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profileStateDir.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/recoveryCode.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.js +3 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releasePolicy.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releaseVersions.js +6 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/restartArtifact.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/spawnEnv.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/telemetryRedaction.js +7 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/authHelper.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/commitmentExecutionContract.js +27 -18
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerUse.js +6 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelope.js +11 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.js +6 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonConsentProof.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonPair.js +20 -8
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +5 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/desktopDaemonProof.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/desktopWire.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.js +11 -7
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceKey.js +11 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/dpop.js +12 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarness.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessChannels.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessUpdater.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/githubPushRefusal.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/guidedUpdate.js +5 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/independentMachineReservation.js +10 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/kek/macos.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/liveState.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/loginWithLocalhost.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/loopbackHttp.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/machineUuid.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profileStateDir.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/recoveryCode.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.js +3 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releasePolicy.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releaseVersions.js +6 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/restartArtifact.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/spawnEnv.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/telemetryRedaction.js +11 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +20519 -20130
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/loopback-server.js +4 -2
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.js +10 -6
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/loopback-server.js +4 -2
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.js +10 -6
- package/dist/node_modules/@skrr-ai/inference-broker/package.json +1 -1
- package/oclif.manifest.json +17 -2
- package/package.json +1 -1
|
@@ -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) {
|
|
@@ -29,6 +29,9 @@ __export(telemetryRedaction_exports, {
|
|
|
29
29
|
withPreviewTokenRedaction: () => withPreviewTokenRedaction
|
|
30
30
|
});
|
|
31
31
|
module.exports = __toCommonJS(telemetryRedaction_exports);
|
|
32
|
+
const ESCAPED_LITERAL_RE = /[.*+?^${}()|[\]\\]/g;
|
|
33
|
+
const IS_QR_SIGN_IN_SECRET_FIELD_RE = /[_-]/g;
|
|
34
|
+
const REDACT_QR_SIGN_IN_TEXT_RE = /(?:^|[?&])direction=(?:mobile_approves_web|web_approves_mobile)(?:&|$)/;
|
|
32
35
|
const PREVIEW_TOKEN_REDACTION = "pvw_[redacted]";
|
|
33
36
|
const TOKEN_CHAR = "(?:[A-Za-z0-9._-]|%(?:25)*(?:2[DdEe]|3[0-9]|4[1-9A-Fa-f]|5[0-9AaFf]|6[1-9A-Fa-f]|7[0-9Aa]))";
|
|
34
37
|
const PREVIEW_TOKEN = new RegExp(`pvw(?:_|%(?:25)*5[Ff])${TOKEN_CHAR}+`, "g");
|
|
@@ -38,7 +41,7 @@ const SIGNED_CREDENTIAL = new RegExp(`(wsi|pinv|iinv|usr|adm2)${UNDERSCORE}(?=[0
|
|
|
38
41
|
const LEGACY_OPERATOR_CODE = new RegExp(`(adm)${UNDERSCORE}(?=[A-Za-z0-9_-]{43}(?![A-Za-z0-9_-]))[A-Za-z0-9_-]{43}`, "g");
|
|
39
42
|
const QR_SIGN_IN_REDACTION = "[redacted]";
|
|
40
43
|
const escapedLiteral = (value) => [...value].map((char) => {
|
|
41
|
-
const literal = char.replace(
|
|
44
|
+
const literal = char.replace(ESCAPED_LITERAL_RE, "\\$&");
|
|
42
45
|
return `(?:${literal}|%(?:25)*${char.charCodeAt(0).toString(16)})`;
|
|
43
46
|
}).join("");
|
|
44
47
|
const QR_REQUEST_PATH = new RegExp(`(${escapedLiteral("/api/auth/qr/requests/")})${TOKEN_CHAR}+`, "gi");
|
|
@@ -53,7 +56,7 @@ const QR_SECRET_FIELDS = /* @__PURE__ */ new Set([
|
|
|
53
56
|
]);
|
|
54
57
|
function isQrSignInSecretField(key) {
|
|
55
58
|
const leaf = key.split(".").pop() || "";
|
|
56
|
-
return QR_SECRET_FIELDS.has(leaf.replace(
|
|
59
|
+
return QR_SECRET_FIELDS.has(leaf.replace(IS_QR_SIGN_IN_SECRET_FIELD_RE, "").toLowerCase());
|
|
57
60
|
}
|
|
58
61
|
const QR_SECRET_ASSIGNMENT = /((?:["']?)(?:statusToken|claimToken|codeVerifier|codeChallenge|comparisonCode|status_token|claim_token|code_verifier|code_challenge|comparison_code)(?:["']?)\s*[:=]\s*["']?)([A-Za-z0-9._~%+-]+)/gi;
|
|
59
62
|
const OAUTH_QUERY_SECRET = /(^|[?&]|%(?:25)*26)(code|state|error_description|handoff)(=|%(?:25)*3[dD])([^&#\s"'<>]*)/gi;
|
|
@@ -61,7 +64,7 @@ function isOAuthQuerySecretField(key) {
|
|
|
61
64
|
return ["code", "state", "error_description", "handoff"].includes(key.toLowerCase());
|
|
62
65
|
}
|
|
63
66
|
function isOAuthQueryContainerField(key) {
|
|
64
|
-
const leaf = (key.split(".").pop() || "").replace(
|
|
67
|
+
const leaf = (key.split(".").pop() || "").replace(IS_QR_SIGN_IN_SECRET_FIELD_RE, "").toLowerCase();
|
|
65
68
|
return leaf === "query" || leaf === "querystring";
|
|
66
69
|
}
|
|
67
70
|
function isGraphHandoffCookieField(key) {
|
|
@@ -69,7 +72,7 @@ function isGraphHandoffCookieField(key) {
|
|
|
69
72
|
}
|
|
70
73
|
const GRAPH_HANDOFF_COOKIE = /((?:_|%(?:25)*5[fF]){2}secure(?:-|%(?:25)*2[dD])pc(?:-|%(?:25)*2[dD])graph(?:-|%(?:25)*2[dD])handoff(?:=|%(?:25)*3[dD]))([^;,&\s"'<>]+)/gi;
|
|
71
74
|
function redactQrSignInText(value) {
|
|
72
|
-
const standaloneQuery =
|
|
75
|
+
const standaloneQuery = REDACT_QR_SIGN_IN_TEXT_RE.test(value) ? value.replace(QR_REQUEST_QUERY, `$1$2${QR_SIGN_IN_REDACTION}`) : value;
|
|
73
76
|
return standaloneQuery.replace(QR_REQUEST_PATH, `$1${QR_SIGN_IN_REDACTION}`).replace(QR_LINK_QUERY, (_match, prefix, query) => prefix + query.replace(QR_REQUEST_QUERY, `$1$2${QR_SIGN_IN_REDACTION}`)).replace(QR_SECRET_ASSIGNMENT, `$1${QR_SIGN_IN_REDACTION}`);
|
|
74
77
|
}
|
|
75
78
|
const CREDENTIAL_HINTS = ["pvw", "wsi", "pinv", "iinv", "usr", "adm"];
|
|
@@ -34,6 +34,7 @@ __export(toolApprovalSignature_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(toolApprovalSignature_exports);
|
|
35
35
|
var import_node_crypto = require("node:crypto");
|
|
36
36
|
var import_daemonToolApproval = require("./daemonToolApproval.js");
|
|
37
|
+
const IS_EXECUTOR_LEASE_TEXT_RE = /[\u0000-\u001f]/;
|
|
37
38
|
const TOOL_APPROVAL_SIGNED_CAPABILITY = "tool_approval_signed_v1";
|
|
38
39
|
const ATTESTATION_SIGNING_DOMAIN = "skrr-tool-approval-v2\n";
|
|
39
40
|
const KEYSET_SIGNING_DOMAIN = "skrr-tool-approval-keyset-v1\n";
|
|
@@ -82,7 +83,7 @@ function isExecutorLeaseId(value) {
|
|
|
82
83
|
return typeof value === "string" && EXECUTOR_LEASE_ID_PATTERN.test(value);
|
|
83
84
|
}
|
|
84
85
|
function isExecutorLeaseText(value, max = 128) {
|
|
85
|
-
return typeof value === "string" && value.length > 0 && value.length <= max &&
|
|
86
|
+
return typeof value === "string" && value.length > 0 && value.length <= max && !IS_EXECUTOR_LEASE_TEXT_RE.test(value);
|
|
86
87
|
}
|
|
87
88
|
function canonicalExecutorCapabilities(value) {
|
|
88
89
|
if (!Array.isArray(value) || value.length === 0 || value.length > MAX_EXECUTOR_LEASE_CAPABILITIES) {
|
|
@@ -35,6 +35,7 @@ import { spawn } from 'node:child_process';
|
|
|
35
35
|
import fs from 'node:fs';
|
|
36
36
|
import path from 'node:path';
|
|
37
37
|
import { getAuthLogger } from './runtime.js';
|
|
38
|
+
const PARSE_HELPER_OUTPUT_RE = /\s/;
|
|
38
39
|
const MAX_OUTPUT_BYTES = 64 * 1024;
|
|
39
40
|
const DEFAULT_TIMEOUT_MS = 10_000;
|
|
40
41
|
const DEFAULT_TTL_MS = 5 * 60_000;
|
|
@@ -286,7 +287,7 @@ function parseHelperOutput(stdout, log) {
|
|
|
286
287
|
}
|
|
287
288
|
// Bare token — single line, no JSON. Reject if it contains whitespace
|
|
288
289
|
// beyond surrounding trim (defensive — helper might have leaked logs).
|
|
289
|
-
if (
|
|
290
|
+
if (PARSE_HELPER_OUTPUT_RE.test(trimmed)) {
|
|
290
291
|
log.error('[authHelper] bare-token output contains whitespace — refusing (use JSON if helper logs to stdout)');
|
|
291
292
|
return null;
|
|
292
293
|
}
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import { isDeepStrictEqual } from 'node:util';
|
|
2
|
+
const VALID_CI_LOG_EVIDENCE_RE = /^[\w.-]+\/[\w.-]+$/;
|
|
3
|
+
const VALID_CI_LOG_EVIDENCE_RE_2 = /^\d{1,20}$/;
|
|
4
|
+
const VALID_CI_LOG_EVIDENCE_RE_3 = /^[a-z0-9_]{1,80}$/;
|
|
5
|
+
const VALID_CI_LOG_EVIDENCE_RE_4 = /^[a-f0-9]{16}$/;
|
|
6
|
+
const VALID_CAPABILITY_SOURCE_RE = /^[a-z0-9_.-]{1,80}$/i;
|
|
7
|
+
const VALID_CAPABILITY_SOURCE_RE_2 = /^[a-z0-9_:.-]{1,120}$/i;
|
|
8
|
+
const VALID_CAPABILITY_SOURCE_RE_3 = /^[a-f0-9]{64}$/i;
|
|
9
|
+
// eslint-disable-next-line no-control-regex
|
|
10
|
+
const VALID_BRANCH_RE = /[\s~^:?*[\\\x00-\x1f\x7f]/;
|
|
11
|
+
const VALID_DELIVERY_RE = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;
|
|
12
|
+
const VALID_DELIVERY_SOURCE_RE = /^[A-Za-z0-9][A-Za-z0-9_./-]{0,239}$/;
|
|
13
|
+
const VALID_DELIVERY_SOURCE_RE_2 = /^[a-f0-9]{40,64}$/i;
|
|
2
14
|
/** Mode-free responsibility context. Tool permissions belong to the Agent runtime. */
|
|
3
15
|
export const COMMITMENT_EXECUTION_CONTRACT_VERSION = 3;
|
|
4
16
|
export const COMMITMENT_EXECUTION_CONTRACT_CAPABILITY = 'commitment_execution_contract_v3';
|
|
@@ -193,11 +205,11 @@ function validCiLogEvidence(value) {
|
|
|
193
205
|
value.attestation !== 'platform' ||
|
|
194
206
|
!CI_LOG_EVIDENCE_STATUSES.has(String(value.status)) ||
|
|
195
207
|
!isoTimestamp(value.fetchedAt) ||
|
|
196
|
-
|
|
197
|
-
|
|
208
|
+
!VALID_CI_LOG_EVIDENCE_RE.test(String(value.repoFullName || '')) ||
|
|
209
|
+
!VALID_CI_LOG_EVIDENCE_RE_2.test(String(value.checkRunId || '')))
|
|
198
210
|
return false;
|
|
199
211
|
for (const key of ['workflowRunId', 'jobId']) {
|
|
200
|
-
if (value[key] !== undefined &&
|
|
212
|
+
if (value[key] !== undefined && !VALID_CI_LOG_EVIDENCE_RE_2.test(String(value[key])))
|
|
201
213
|
return false;
|
|
202
214
|
}
|
|
203
215
|
for (const key of ['byteLength', 'lineCount', 'excerptLines', 'failedStepNumber']) {
|
|
@@ -209,9 +221,9 @@ function validCiLogEvidence(value) {
|
|
|
209
221
|
if (value[key] !== undefined && !boundedString(value[key], 200))
|
|
210
222
|
return false;
|
|
211
223
|
}
|
|
212
|
-
if (value.reason !== undefined &&
|
|
224
|
+
if (value.reason !== undefined && !VALID_CI_LOG_EVIDENCE_RE_3.test(String(value.reason)))
|
|
213
225
|
return false;
|
|
214
|
-
if (value.digest !== undefined &&
|
|
226
|
+
if (value.digest !== undefined && !VALID_CI_LOG_EVIDENCE_RE_4.test(String(value.digest)))
|
|
215
227
|
return false;
|
|
216
228
|
// A read that failed carries no text: an unreadable log must not be able to
|
|
217
229
|
// arrive looking like a readable one.
|
|
@@ -257,16 +269,16 @@ function validCapabilitySource(value) {
|
|
|
257
269
|
return false;
|
|
258
270
|
if (!CAPABILITY_SOURCES.has(String(value.source)) ||
|
|
259
271
|
!boundedString(value.provider, 80) ||
|
|
260
|
-
|
|
272
|
+
!VALID_CAPABILITY_SOURCE_RE.test(value.provider) ||
|
|
261
273
|
!boundedString(value.capability, 120) ||
|
|
262
|
-
|
|
274
|
+
!VALID_CAPABILITY_SOURCE_RE_2.test(value.capability) ||
|
|
263
275
|
!CAPABILITY_STATUSES.has(String(value.status)) ||
|
|
264
276
|
!CAPABILITY_ATTESTATIONS.has(String(value.attestation)))
|
|
265
277
|
return false;
|
|
266
278
|
if (value.scope !== undefined && !optionalString(value.scope, 500))
|
|
267
279
|
return false;
|
|
268
280
|
if (value.accountFingerprint !== undefined &&
|
|
269
|
-
|
|
281
|
+
!VALID_CAPABILITY_SOURCE_RE_3.test(String(value.accountFingerprint)))
|
|
270
282
|
return false;
|
|
271
283
|
if (value.testedAt !== undefined && !isoTimestamp(value.testedAt))
|
|
272
284
|
return false;
|
|
@@ -362,8 +374,7 @@ function validBranch(value) {
|
|
|
362
374
|
!value.endsWith('.') &&
|
|
363
375
|
// Control characters are exactly what this rejects: a Git ref name may not
|
|
364
376
|
// contain them, so the class is deliberate rather than an oversight.
|
|
365
|
-
|
|
366
|
-
!/[\s~^:?*[\\\x00-\x1f\x7f]/.test(value) &&
|
|
377
|
+
!VALID_BRANCH_RE.test(value) &&
|
|
367
378
|
!value.includes('..') &&
|
|
368
379
|
!value.includes('@{') &&
|
|
369
380
|
!value.includes('//') &&
|
|
@@ -376,7 +387,7 @@ function validDelivery(value) {
|
|
|
376
387
|
if (value.version !== 1 || !DELIVERY_MODES.has(String(value.mode)))
|
|
377
388
|
return false;
|
|
378
389
|
if (value.repo !== undefined &&
|
|
379
|
-
(
|
|
390
|
+
(!VALID_DELIVERY_RE.test(String(value.repo)) ||
|
|
380
391
|
String(value.repo) !== String(value.repo).toLowerCase()))
|
|
381
392
|
return false;
|
|
382
393
|
if (value.baseBranch !== undefined && !validBranch(value.baseBranch))
|
|
@@ -435,12 +446,12 @@ function validDeliverySource(value) {
|
|
|
435
446
|
value.parentTaskId.length > 0 &&
|
|
436
447
|
value.parentTaskId.length <= 200 &&
|
|
437
448
|
typeof value.branch === 'string' &&
|
|
438
|
-
|
|
449
|
+
VALID_DELIVERY_SOURCE_RE.test(value.branch) &&
|
|
439
450
|
!value.branch.includes('..') &&
|
|
440
451
|
!value.branch.includes('@{') &&
|
|
441
|
-
|
|
452
|
+
VALID_DELIVERY_SOURCE_RE_2.test(value.headSha) &&
|
|
442
453
|
typeof value.baseCommit === 'string' &&
|
|
443
|
-
|
|
454
|
+
VALID_DELIVERY_SOURCE_RE_2.test(value.baseCommit) &&
|
|
444
455
|
hasOnlyKeys(value.runtime, new Set(['kind', 'id'])) &&
|
|
445
456
|
['local_daemon', 'hosted_machine'].includes(String(value.runtime.kind)) &&
|
|
446
457
|
boundedString(value.runtime.id, 200) &&
|
|
@@ -456,16 +467,14 @@ function eventSourceRevision(event) {
|
|
|
456
467
|
event.sha ||
|
|
457
468
|
nestedCheck?.head_sha ||
|
|
458
469
|
nestedWorkflow?.head_sha;
|
|
459
|
-
return
|
|
470
|
+
return VALID_DELIVERY_SOURCE_RE_2.test(String(value || '')) ? String(value).toLowerCase() : '';
|
|
460
471
|
}
|
|
461
472
|
export function eventRepository(event) {
|
|
462
473
|
if (!event)
|
|
463
474
|
return '';
|
|
464
475
|
const repository = event.repository;
|
|
465
476
|
const value = event.repoFullName || repository?.full_name || repository?.fullName;
|
|
466
|
-
return
|
|
467
|
-
? String(value).toLowerCase()
|
|
468
|
-
: '';
|
|
477
|
+
return VALID_DELIVERY_RE.test(String(value || '')) ? String(value).toLowerCase() : '';
|
|
469
478
|
}
|
|
470
479
|
function failedGitHubCheck(event) {
|
|
471
480
|
const eventType = String(event?.eventType || event?.type || '').toLowerCase();
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
const PROJECT_COMPUTER_USE_RESULT_FOR_MODEL_RE = /^[A-Za-z0-9_-]{1,512}$/;
|
|
2
|
+
const PROJECT_COMPUTER_USE_RESULT_FOR_MODEL_RE_2 = /^[a-f0-9]{64}$/;
|
|
3
|
+
const PROJECT_COMPUTER_USE_RESULT_FOR_MODEL_RE_3 = /^audio\/[A-Za-z0-9.+-]+(?:;[ -~]*)?$/;
|
|
1
4
|
/**
|
|
2
5
|
* Computer Use v1 is a host-to-host protocol, never a model tool schema.
|
|
3
6
|
* Models see exactly the runtime's js/js_reset surface. In particular, script
|
|
@@ -327,11 +330,11 @@ export function projectComputerUseResultForModel(result, options) {
|
|
|
327
330
|
const references = Array.isArray(candidates)
|
|
328
331
|
? candidates.filter((item) => record(item) && typeof item.mimeType === 'string' && item.mimeType.startsWith('audio/'))
|
|
329
332
|
: [];
|
|
330
|
-
if (references.length < audioCount || references.some((item) => !record(item) || typeof item.fileId !== 'string' ||
|
|
333
|
+
if (references.length < audioCount || references.some((item) => !record(item) || typeof item.fileId !== 'string' || !PROJECT_COMPUTER_USE_RESULT_FOR_MODEL_RE.test(item.fileId) ||
|
|
331
334
|
item.reference !== `file:${item.fileId}` || item.ownerUserId !== options.principalId ||
|
|
332
335
|
item.sessionId !== options.sessionId || !Number.isSafeInteger(item.bytes) || item.bytes <= 0 ||
|
|
333
|
-
typeof item.sha256 !== 'string' ||
|
|
334
|
-
typeof item.mimeType !== 'string' || item.mimeType.length > 256 ||
|
|
336
|
+
typeof item.sha256 !== 'string' || !PROJECT_COMPUTER_USE_RESULT_FOR_MODEL_RE_2.test(item.sha256) ||
|
|
337
|
+
typeof item.mimeType !== 'string' || item.mimeType.length > 256 || !PROJECT_COMPUTER_USE_RESULT_FOR_MODEL_RE_3.test(item.mimeType))) {
|
|
335
338
|
throw new ComputerUseContractError('computer_use_audio_artifact_required', 'This model cannot receive inline audio. Every audio block requires an existing owned file artifact for this exact session.');
|
|
336
339
|
}
|
|
337
340
|
const notice = [
|
|
@@ -37,6 +37,11 @@
|
|
|
37
37
|
*/
|
|
38
38
|
import crypto from 'node:crypto';
|
|
39
39
|
import { aeadSeal, aeadOpen, AEAD_KEY_LEN, AEAD_NONCE_LEN, AEAD_TAG_LEN } from './aead.js';
|
|
40
|
+
const B64U_RE = /=+$/;
|
|
41
|
+
const B64U_RE_2 = /\+/g;
|
|
42
|
+
const B64U_RE_3 = /\//g;
|
|
43
|
+
const B64U_DECODE_RE = /-/g;
|
|
44
|
+
const B64U_DECODE_RE_2 = /_/g;
|
|
40
45
|
/** Serialized magic prefix. Bumped only on a breaking format change. */
|
|
41
46
|
export const ENVELOPE_MAGIC = 'osk-env1';
|
|
42
47
|
/** Key length in bytes (256 bits). */
|
|
@@ -155,10 +160,14 @@ export function decrypt(sealed, dek, aad) {
|
|
|
155
160
|
// ---------------------------------------------------------------------------
|
|
156
161
|
/** URL-safe base64 (no padding) — keychain-friendly, no `=` to confuse parsers. */
|
|
157
162
|
function b64u(buf) {
|
|
158
|
-
return buf
|
|
163
|
+
return buf
|
|
164
|
+
.toString('base64')
|
|
165
|
+
.replace(B64U_RE, '')
|
|
166
|
+
.replace(B64U_RE_2, '-')
|
|
167
|
+
.replace(B64U_RE_3, '_');
|
|
159
168
|
}
|
|
160
169
|
function b64uDecode(s) {
|
|
161
|
-
const padded = s.replace(
|
|
170
|
+
const padded = s.replace(B64U_DECODE_RE, '+').replace(B64U_DECODE_RE_2, '/');
|
|
162
171
|
const pad = padded.length % 4;
|
|
163
172
|
return Buffer.from(pad === 0 ? padded : padded + '='.repeat(4 - pad), 'base64');
|
|
164
173
|
}
|
|
@@ -51,6 +51,9 @@ import { assertMayMutateLiveState, rethrowIfLiveStateRefusal } from './liveState
|
|
|
51
51
|
import { needsReauthState } from './refresh.js';
|
|
52
52
|
import { emitAuthTelemetry, getAuthLogger, getCredEnvelopeFailClosed } from './runtime.js';
|
|
53
53
|
import { atomicWrite0600, ensureStateDir, removeStateFile, writeStateFile } from './stateFiles.js';
|
|
54
|
+
const KEEP_UNREADABLE_WRAPPED_DEK_RE = /[:.]/g;
|
|
55
|
+
const INIT_NEW_INDEPENDENT_CRED_ENVELOPE_RE = /^desktop-bg-[a-f0-9]{32}$/;
|
|
56
|
+
const INIT_CRED_ENVELOPE_RE = /^desktop-bg-[a-f0-9]{32}$/i;
|
|
54
57
|
/**
|
|
55
58
|
* Account name the wrapped DEK lives under (file fallback). Keeping the
|
|
56
59
|
* literal here so a future rename surfaces as a single grep target.
|
|
@@ -444,7 +447,7 @@ function keepUnreadableWrappedDek(profile, wrapped) {
|
|
|
444
447
|
/* an unreadable copy is not a match */
|
|
445
448
|
}
|
|
446
449
|
}
|
|
447
|
-
const name = `${UNREADABLE_DEK_COPY_PREFIX}${new Date().toISOString().replace(
|
|
450
|
+
const name = `${UNREADABLE_DEK_COPY_PREFIX}${new Date().toISOString().replace(KEEP_UNREADABLE_WRAPPED_DEK_RE, '-')}`;
|
|
448
451
|
atomicWrite0600(path.join(dir, name), wrapped, 'keep the unreadable wrapped DEK');
|
|
449
452
|
const kept = [...existing, name].sort();
|
|
450
453
|
for (const stale of kept.slice(0, Math.max(0, kept.length - MAX_UNREADABLE_DEK_COPIES))) {
|
|
@@ -554,7 +557,7 @@ export async function initExistingCredEnvelope(profile) {
|
|
|
554
557
|
* ambiguous state is opened read-only or refused; it is never re-enrolled.
|
|
555
558
|
* The caller must validate the reservation before calling this function. */
|
|
556
559
|
export async function initNewIndependentCredEnvelope(profile) {
|
|
557
|
-
if (
|
|
560
|
+
if (!INIT_NEW_INDEPENDENT_CRED_ENVELOPE_RE.test(profile))
|
|
558
561
|
throw new Error('Background credential enrollment is unavailable');
|
|
559
562
|
if (_state.kind === 'active' && _state.profile === profile)
|
|
560
563
|
return;
|
|
@@ -664,7 +667,7 @@ export async function initCredEnvelope(profile) {
|
|
|
664
667
|
// A reserved background profile has an independent owner and device key.
|
|
665
668
|
// Generic status, startup and CLI paths may read it, but cannot replace a
|
|
666
669
|
// missing or unreadable key. Only validated first enrollment can create one.
|
|
667
|
-
if (
|
|
670
|
+
if (INIT_CRED_ENVELOPE_RE.test(profile))
|
|
668
671
|
return initExistingCredEnvelope(profile);
|
|
669
672
|
if (_state.kind !== 'uninit')
|
|
670
673
|
return;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createHmac, timingSafeEqual } from 'node:crypto';
|
|
2
|
+
const VERIFY_DAEMON_CONSENT_PROOF_RE = /^[a-f0-9]{64}$/;
|
|
2
3
|
/** A single canonical, bounded representation on both sides of the log. */
|
|
3
4
|
export function normalizeDaemonConsent(input) {
|
|
4
5
|
if (!input || typeof input !== 'object' || Array.isArray(input))
|
|
@@ -32,7 +33,7 @@ export function daemonConsentProof(secret, identity, payload) {
|
|
|
32
33
|
])).digest('hex');
|
|
33
34
|
}
|
|
34
35
|
export function verifyDaemonConsentProof(secret, identity, payload, proof) {
|
|
35
|
-
if (
|
|
36
|
+
if (!VERIFY_DAEMON_CONSENT_PROOF_RE.test(proof))
|
|
36
37
|
return false;
|
|
37
38
|
try {
|
|
38
39
|
return timingSafeEqual(Buffer.from(proof, 'hex'), Buffer.from(daemonConsentProof(secret, identity, payload), 'hex'));
|