@skrr-ai/cli 0.1.146 → 0.1.148
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base-command.js +38 -21
- package/dist/commands/agent/message/send.d.ts +11 -0
- package/dist/commands/agent/message/send.js +34 -8
- package/dist/commands/agent-worker.js +2 -1
- package/dist/commands/agents/activity.js +2 -1
- package/dist/commands/agents/badge.js +10 -5
- package/dist/commands/agents/categories/index.js +2 -1
- package/dist/commands/agents/chat.d.ts +1 -0
- package/dist/commands/agents/chat.js +29 -1
- package/dist/commands/agents/create.js +4 -1
- package/dist/commands/agents/overview.js +2 -1
- package/dist/commands/agents/releases/create.js +2 -1
- package/dist/commands/agents/schedule-overview.js +3 -1
- package/dist/commands/agents/schedule.js +2 -1
- package/dist/commands/agents/spawn.js +9 -6
- package/dist/commands/agents/tools/auth.js +2 -1
- package/dist/commands/agents/tools/calls.js +2 -1
- package/dist/commands/agents/triggers/policy.js +11 -1
- package/dist/commands/agents/visibility.js +2 -1
- package/dist/commands/balance/show.js +28 -5
- package/dist/commands/balance/statement.js +2 -1
- package/dist/commands/commands.js +2 -1
- package/dist/commands/commitments/create.js +2 -1
- package/dist/commands/commitments/delivery.js +2 -1
- package/dist/commands/commitments/doctor.js +2 -1
- package/dist/commands/commitments/observations.js +2 -2
- package/dist/commands/commitments/operating-review.js +2 -1
- package/dist/commands/commitments/pack/preflight.js +2 -1
- package/dist/commands/commitments/preflight.js +5 -1
- package/dist/commands/commitments/trigger-status.js +2 -1
- package/dist/commands/commitments/wake-capabilities.d.ts +2 -0
- package/dist/commands/commitments/wake-capabilities.js +16 -0
- package/dist/commands/convos/messages.js +2 -1
- package/dist/commands/daemon/logs.js +18 -9
- package/dist/commands/daemon/usage.js +2 -1
- package/dist/commands/dm/messages.js +2 -1
- package/dist/commands/dm/thread/messages.js +2 -1
- package/dist/commands/dm/threads.js +2 -1
- package/dist/commands/doctor.js +2 -1
- package/dist/commands/goals/key-results/assess.js +2 -1
- package/dist/commands/goals/key-results/history.js +2 -1
- package/dist/commands/harnesses/forget.js +2 -1
- package/dist/commands/harnesses/show.js +12 -6
- package/dist/commands/inbox/index.js +4 -3
- package/dist/commands/initiatives/decide.js +2 -1
- package/dist/commands/instructions/diff.js +2 -1
- package/dist/commands/instructions/show.js +2 -1
- package/dist/commands/login.js +4 -2
- package/dist/commands/machines/dedicated/cp.js +2 -1
- package/dist/commands/machines/dedicated/power/set.js +2 -1
- package/dist/commands/machines/show.js +2 -1
- package/dist/commands/memory/maintain.js +2 -1
- package/dist/commands/memory/read.js +2 -1
- package/dist/commands/memory/rebuild-index.js +2 -1
- package/dist/commands/memory/rebuild.js +2 -1
- package/dist/commands/memory/search.js +2 -1
- package/dist/commands/messages/list.js +2 -1
- package/dist/commands/revoke-daemon.js +2 -1
- package/dist/commands/revoke-token.js +2 -1
- package/dist/commands/search/all.js +14 -7
- package/dist/commands/search/workspace.js +2 -1
- package/dist/commands/set-capabilities.js +2 -1
- package/dist/commands/skills/browse.js +8 -2
- package/dist/commands/spaces/auto-executor/preview.js +3 -2
- package/dist/commands/spaces/auto-executor/runs.js +4 -1
- package/dist/commands/spaces/workflow-templates/extract.d.ts +1 -0
- package/dist/commands/spaces/workflow-templates/extract.js +9 -1
- package/dist/commands/spaces/workflows/events.js +6 -3
- package/dist/commands/spaces/workflows/run.js +5 -3
- package/dist/commands/spaces/workflows/update.js +2 -1
- package/dist/commands/store/gallery-admissions/preview.js +2 -1
- package/dist/commands/store/publishers/profile/handle.js +2 -1
- package/dist/commands/tasks/comments/anchor.js +23 -9
- package/dist/commands/tasks/complete.js +4 -2
- package/dist/commands/tasks/create-tree.js +7 -3
- package/dist/commands/tasks/create.js +2 -1
- package/dist/commands/tasks/deliverable/add.js +2 -1
- package/dist/commands/tasks/deliverable/archive.js +2 -1
- package/dist/commands/tasks/deliverable/list.js +2 -1
- package/dist/commands/tasks/expectations/assess.js +2 -1
- package/dist/commands/tasks/labels/create.js +2 -1
- package/dist/commands/tasks/preflight.js +4 -2
- package/dist/commands/tasks/ready.js +2 -1
- package/dist/commands/tasks/result/submit.js +2 -1
- package/dist/commands/tasks/updates/add.js +2 -1
- package/dist/commands/tasks/wait.js +2 -1
- package/dist/commands/token/list.js +2 -1
- package/dist/commands/token/mint.js +2 -1
- package/dist/commands/wiki/write.js +14 -7
- package/dist/hooks/command-not-found.js +2 -1
- package/dist/lib/agent-chat-start.d.ts +77 -0
- package/dist/lib/agent-chat-start.js +169 -0
- package/dist/lib/agent-config.js +2 -1
- package/dist/lib/agent-endpoints.js +4 -2
- package/dist/lib/agent-evals.js +2 -1
- package/dist/lib/agent-guide-reference-gate.js +22 -11
- package/dist/lib/agent-guides.js +4 -1
- package/dist/lib/agent-instructions.js +5 -1
- package/dist/lib/agent-ref.js +8 -4
- package/dist/lib/agent-trigger-listing.js +2 -1
- package/dist/lib/agentic-stream.js +8 -5
- package/dist/lib/api-error-reason.js +2 -1
- package/dist/lib/api-fetch.js +5 -3
- package/dist/lib/appData.js +6 -6
- package/dist/lib/appInstallations.js +10 -5
- package/dist/lib/appsCheck.js +2 -1
- package/dist/lib/auth-failure.js +2 -1
- package/dist/lib/auth-storage.js +2 -1
- package/dist/lib/balance.d.ts +33 -3
- package/dist/lib/balance.js +39 -7
- package/dist/lib/capability-matrix.js +4 -2
- package/dist/lib/cli-runtime.js +2 -1
- package/dist/lib/code-handover.js +8 -3
- package/dist/lib/command-hygiene.js +28 -12
- package/dist/lib/command-manifest.js +6 -3
- package/dist/lib/commitment-attention-copy.js +2 -1
- package/dist/lib/commitment-event-wakes.js +9 -0
- package/dist/lib/commitment-product.js +5 -3
- package/dist/lib/commitment-terms.js +2 -1
- package/dist/lib/commitments.d.ts +13 -0
- package/dist/lib/commitments.js +24 -9
- package/dist/lib/compasses.js +2 -1
- package/dist/lib/completion-index.js +2 -1
- package/dist/lib/computer-files.js +8 -6
- package/dist/lib/config.js +11 -5
- package/dist/lib/conversation-search.js +4 -2
- package/dist/lib/daemon-installer.js +6 -2
- package/dist/lib/daemon-maintenance.js +2 -1
- package/dist/lib/daemon-ref.js +2 -1
- package/dist/lib/daemonBroker.js +6 -3
- package/dist/lib/daemonBrokerRefusal.js +4 -2
- package/dist/lib/daemonHandoff.js +14 -7
- package/dist/lib/daemonIslandProfile.js +2 -1
- package/dist/lib/dedicated-copy.js +9 -3
- package/dist/lib/dedicated-exec.js +2 -1
- package/dist/lib/dedicated-keep-awake.js +2 -1
- package/dist/lib/dedicated-machines.js +9 -5
- package/dist/lib/dedicated-service.js +2 -1
- package/dist/lib/dedicated-ssh.js +5 -3
- package/dist/lib/deployed-build.js +2 -1
- package/dist/lib/device-code.js +4 -3
- package/dist/lib/dpop-auth.js +2 -1
- package/dist/lib/earnings.js +2 -1
- package/dist/lib/exec-runtime-binary.js +5 -3
- package/dist/lib/first-party-harness-broker.js +4 -3
- package/dist/lib/first-party-harness-managed.js +2 -1
- package/dist/lib/first-party-harness-startup-update.js +8 -4
- package/dist/lib/first-party-harness-update.js +2 -1
- package/dist/lib/first-party-harness.js +2 -1
- package/dist/lib/format.js +8 -4
- package/dist/lib/git-task.js +10 -5
- package/dist/lib/github-tools.js +6 -3
- package/dist/lib/harnesses.js +4 -2
- package/dist/lib/hosted-machines.js +2 -1
- package/dist/lib/html-text.js +33 -16
- package/dist/lib/ingress.js +2 -1
- package/dist/lib/instruction-blocks.js +2 -1
- package/dist/lib/iso-instant.js +5 -3
- package/dist/lib/keychain.js +15 -5
- package/dist/lib/label-scope.js +2 -1
- package/dist/lib/live-runtime-binary.js +10 -7
- package/dist/lib/local-skills.js +10 -6
- package/dist/lib/login.js +3 -2
- package/dist/lib/machine-audit.js +2 -1
- package/dist/lib/machine-daemon-log.js +2 -1
- package/dist/lib/machine-services.js +2 -1
- package/dist/lib/memory-history-session.js +2 -1
- package/dist/lib/memory-sync.js +6 -2
- package/dist/lib/message-intent.d.ts +10 -0
- package/dist/lib/node-adapter.js +4 -2
- package/dist/lib/northstars.js +4 -2
- package/dist/lib/oauthLogin.js +16 -7
- package/dist/lib/open-target.js +8 -4
- package/dist/lib/option-hint.js +2 -4
- package/dist/lib/outbox.js +2 -1
- package/dist/lib/planOutcome.d.ts +5 -3
- package/dist/lib/planOutcome.js +7 -4
- package/dist/lib/platform-update-local.js +2 -3
- package/dist/lib/preflight-copy.js +31 -0
- package/dist/lib/rate-limit-retry.js +2 -1
- package/dist/lib/reflection.js +2 -1
- package/dist/lib/request-field-flags.js +2 -1
- package/dist/lib/runtime-start-verification.js +2 -1
- package/dist/lib/schedule.js +2 -1
- package/dist/lib/scoped-memory-command.js +7 -3
- package/dist/lib/search-display.js +11 -4
- package/dist/lib/skill-store-pagination.js +2 -1
- package/dist/lib/space-notebook.js +5 -3
- package/dist/lib/store-listing.js +2 -1
- package/dist/lib/task-agent-context-capabilities.js +2 -1
- package/dist/lib/task-asset-upload.js +7 -3
- package/dist/lib/task-closure.js +2 -1
- package/dist/lib/task-economics.js +2 -1
- package/dist/lib/task-execution.js +16 -8
- package/dist/lib/task-extras.js +4 -2
- package/dist/lib/task-operation-watch.js +2 -1
- package/dist/lib/task-preflight.js +3 -2
- package/dist/lib/task-recurrence-summary.js +4 -2
- package/dist/lib/task-runtime-headers.js +10 -5
- package/dist/lib/task-transcript.js +3 -2
- package/dist/lib/task-transfer.js +9 -5
- package/dist/lib/tasks.js +2 -1
- package/dist/lib/triggers.d.ts +21 -0
- package/dist/lib/triggers.js +41 -3
- package/dist/lib/update-check.js +12 -7
- package/dist/lib/usage-discovery.js +2 -1
- package/dist/lib/usd-micros.js +2 -1
- package/dist/lib/web-url.js +2 -1
- package/dist/lib/widgetCheck.js +15 -9
- package/dist/lib/widgetStaticScan.js +26 -14
- package/dist/lib/workflow-run-view.js +5 -3
- package/dist/lib/workflow-templates.d.ts +10 -0
- package/dist/lib/workflow-templates.js +47 -0
- package/dist/lib/write-target.js +4 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/authHelper.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/commitmentExecutionContract.js +22 -12
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/computerUse.js +4 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelope.js +7 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/credentialEnvelopeBridge.js +6 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonConsentProof.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonPair.js +16 -7
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/daemonWire.js +4 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/desktopDaemonProof.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/desktopWire.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceIdentityBridge.js +11 -7
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/deviceKey.js +7 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/dpop.js +8 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarness.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessChannels.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/firstPartyHarnessUpdater.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/githubPushRefusal.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/guidedUpdate.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/independentMachineReservation.js +8 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/kek/macos.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/liveState.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/loginWithLocalhost.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/loopbackHttp.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/machineUuid.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/profileStateDir.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/recoveryCode.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/refresh.js +3 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releasePolicy.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/releaseVersions.js +6 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/restartArtifact.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/spawnEnv.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/telemetryRedaction.js +7 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/toolApprovalSignature.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/authHelper.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/commitmentExecutionContract.js +27 -18
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/computerUse.js +6 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelope.js +11 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/credentialEnvelopeBridge.js +6 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonConsentProof.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonPair.js +20 -8
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/daemonWire.js +5 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/desktopDaemonProof.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/desktopWire.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceIdentityBridge.js +11 -7
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/deviceKey.js +11 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/dpop.js +12 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarness.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessChannels.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/firstPartyHarnessUpdater.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/githubPushRefusal.js +4 -3
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/guidedUpdate.js +5 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/independentMachineReservation.js +10 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/kek/macos.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/liveState.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/loginWithLocalhost.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/loopbackHttp.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/machineUuid.js +4 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/profileStateDir.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/recoveryCode.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/refresh.js +3 -2
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releasePolicy.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/releaseVersions.js +6 -4
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/restartArtifact.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/spawnEnv.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/telemetryRedaction.js +11 -5
- package/dist/node_modules/@skrr-ai/auth-core/dist/esm/toolApprovalSignature.js +2 -1
- package/dist/node_modules/@skrr-ai/auth-core/package.json +1 -1
- package/dist/node_modules/@skrr-ai/data-provider/index.js +20519 -20130
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/loopback-server.js +4 -2
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.js +10 -6
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/loopback-server.js +4 -2
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.js +10 -6
- package/dist/node_modules/@skrr-ai/inference-broker/package.json +1 -1
- package/oclif.manifest.json +17 -2
- package/package.json +1 -1
package/dist/lib/web-url.js
CHANGED
|
@@ -46,6 +46,7 @@ exports.withDataUrls = withDataUrls;
|
|
|
46
46
|
exports.workflowUrlFrom = workflowUrlFrom;
|
|
47
47
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
48
48
|
const publicEndpoints_generated_1 = require("./publicEndpoints.generated");
|
|
49
|
+
const TRIM_TRAILING_SLASH_RE = /\/+$/;
|
|
49
50
|
/**
|
|
50
51
|
* Site-relative canonical path for an entity, or `null` when the required id is
|
|
51
52
|
* missing. When a task/goal knows its hosting space we emit the canonical
|
|
@@ -430,5 +431,5 @@ function encodeId(value) {
|
|
|
430
431
|
return raw ? encodeURIComponent(raw) : '';
|
|
431
432
|
}
|
|
432
433
|
function trimTrailingSlash(value) {
|
|
433
|
-
return value.replace(
|
|
434
|
+
return value.replace(TRIM_TRAILING_SLASH_RE, '');
|
|
434
435
|
}
|
package/dist/lib/widgetCheck.js
CHANGED
|
@@ -68,6 +68,12 @@ exports.formatWidgetCheckReport = formatWidgetCheckReport;
|
|
|
68
68
|
const vm = __importStar(require("node:vm"));
|
|
69
69
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
70
70
|
const widgetStaticScan_1 = require("./widgetStaticScan");
|
|
71
|
+
const SYNTAX_ISSUE_RE = /^widget\.js:(\d+)/;
|
|
72
|
+
const GRAMMAR_FIX_RE = /more than once/;
|
|
73
|
+
const GRAMMAR_FIX_RE_2 = /no html or js/;
|
|
74
|
+
const GRAMMAR_FIX_RE_3 = /before the first section marker/;
|
|
75
|
+
const CHECK_FENCE_TEXT_RE = /\r\n?/g;
|
|
76
|
+
const SCHEMA_ISSUES_RE = /exceeds .* characters/;
|
|
71
77
|
// ── report types (the `--json` shape; stable) ───────────────────────────────
|
|
72
78
|
exports.WIDGET_CHECK_REPORT_VERSION = 1;
|
|
73
79
|
exports.WIDGET_CHECK_HEURISTIC_NOTE = 'Grammar, schema, size and JavaScript syntax findings are exact. Static findings are a heuristic ' +
|
|
@@ -202,7 +208,7 @@ function syntaxIssue(script, section, firstLine) {
|
|
|
202
208
|
const message = errorMessage(err);
|
|
203
209
|
const stack = err?.stack;
|
|
204
210
|
const head = typeof stack === 'string' ? stack.split('\n')[0] : '';
|
|
205
|
-
const at =
|
|
211
|
+
const at = SYNTAX_ISSUE_RE.exec(head);
|
|
206
212
|
const fix = SYNTAX_FIXES.find(([pattern]) => pattern.test(message))?.[1];
|
|
207
213
|
return {
|
|
208
214
|
severity: 'error',
|
|
@@ -291,13 +297,13 @@ function grammarFix(reason, message) {
|
|
|
291
297
|
case 'invalid-header':
|
|
292
298
|
return `Write the opening line like ${exampleOpener()}: the title in quotes, height an integer, nothing after the closing brace.`;
|
|
293
299
|
case 'invalid-payload':
|
|
294
|
-
if (
|
|
300
|
+
if (GRAMMAR_FIX_RE.test(message)) {
|
|
295
301
|
return `Use each section at most once (${order}; the platform reads them in any order). Any of them may be left out.`;
|
|
296
302
|
}
|
|
297
|
-
if (
|
|
303
|
+
if (GRAMMAR_FIX_RE_2.test(message)) {
|
|
298
304
|
return 'Add an html section or a js section; a stylesheet alone is refused.';
|
|
299
305
|
}
|
|
300
|
-
if (
|
|
306
|
+
if (GRAMMAR_FIX_RE_3.test(message)) {
|
|
301
307
|
return `Start the first line after the opening line with a section marker (${order}).`;
|
|
302
308
|
}
|
|
303
309
|
return undefined;
|
|
@@ -331,7 +337,7 @@ function fenceReportFromPartial(partial) {
|
|
|
331
337
|
function checkFenceText(text, strict) {
|
|
332
338
|
// CR and CRLF each count as one line break in the grammar, and inside a block
|
|
333
339
|
// they are normalised to LF anyway, so normalising first changes no verdict.
|
|
334
|
-
const normalised = text.replace(
|
|
340
|
+
const normalised = text.replace(CHECK_FENCE_TEXT_RE, '\n');
|
|
335
341
|
const trailingBreak = normalised.endsWith('\n');
|
|
336
342
|
const lines = normalised.split('\n');
|
|
337
343
|
if (trailingBreak) {
|
|
@@ -470,7 +476,7 @@ function schemaIssues(issues, schema, handled) {
|
|
|
470
476
|
if (issue.code === 'too_big' && field && handled.has(field)) {
|
|
471
477
|
continue;
|
|
472
478
|
}
|
|
473
|
-
if (issue.code === 'custom' &&
|
|
479
|
+
if (issue.code === 'custom' && SCHEMA_ISSUES_RE.test(issue.message)) {
|
|
474
480
|
continue;
|
|
475
481
|
}
|
|
476
482
|
let message;
|
|
@@ -898,9 +904,9 @@ function renderWidgetFences(result) {
|
|
|
898
904
|
}
|
|
899
905
|
const back = (0, data_provider_1.parseUiWidgetFences)(block);
|
|
900
906
|
const widget = back.widgets[0];
|
|
901
|
-
const css = (input.css ?? '').replace(
|
|
902
|
-
const html = (input.html ?? '').replace(
|
|
903
|
-
const js = (input.js ?? '').replace(
|
|
907
|
+
const css = (input.css ?? '').replace(CHECK_FENCE_TEXT_RE, '\n');
|
|
908
|
+
const html = (input.html ?? '').replace(CHECK_FENCE_TEXT_RE, '\n');
|
|
909
|
+
const js = (input.js ?? '').replace(CHECK_FENCE_TEXT_RE, '\n');
|
|
904
910
|
const matches = back.errors.length === 0 &&
|
|
905
911
|
back.widgets.length === 1 &&
|
|
906
912
|
widget.title === input.title &&
|
|
@@ -6,6 +6,19 @@ exports.maskCssComments = maskCssComments;
|
|
|
6
6
|
exports.maskHtmlComments = maskHtmlComments;
|
|
7
7
|
exports.classifyUrl = classifyUrl;
|
|
8
8
|
exports.scanWidgetSource = scanWidgetSource;
|
|
9
|
+
const IS_IDENT_CHAR_RE = /[A-Za-z0-9_$]/;
|
|
10
|
+
const LEX_JS_RE = /[a-z]/i;
|
|
11
|
+
const LEX_JS_RE_2 = /[A-Za-z_$]/;
|
|
12
|
+
const LEX_JS_RE_3 = /[0-9A-Za-z_.]/;
|
|
13
|
+
const CLASSIFY_URL_RE = /^[a-z][a-z0-9+.-]*:/;
|
|
14
|
+
const IS_NAMESPACE_URL_RE = /^https?:\/\/www\.w3\.org\//i;
|
|
15
|
+
const SCAN_CSS_INTO_RE = /@import\s+(?:url\(\s*)?['"]?([^'")\s;]+)/i;
|
|
16
|
+
const SCAN_CSS_INTO_RE_2 = /^['"]|['"]$/g;
|
|
17
|
+
const CALLS_RE = /\b(?:window\s*\.\s*)?skrr\s*\.\s*app\s*\.\s*(?:http|service)\s*\.\s*fetch\s*\(/g;
|
|
18
|
+
const BROKER_FETCH_OFFSETS_RE = /\s/;
|
|
19
|
+
const SCAN_JS_INTO_RE = /\bopenLink\b/;
|
|
20
|
+
const SCAN_JS_INTO_RE_2 = /<\/script/i;
|
|
21
|
+
const SRCSET_URLS_RE = /\s+/;
|
|
9
22
|
const OPEN_LINK = 'window.skrr.openLink(url)';
|
|
10
23
|
// ── small text helpers ──────────────────────────────────────────────────────
|
|
11
24
|
/** ASCII-only lowercase: the same length as the input, so offsets stay valid. */
|
|
@@ -75,7 +88,7 @@ const REGEX_PRECEDING_WORDS = new Set([
|
|
|
75
88
|
'yield',
|
|
76
89
|
'await',
|
|
77
90
|
]);
|
|
78
|
-
const isIdentChar = (c) =>
|
|
91
|
+
const isIdentChar = (c) => IS_IDENT_CHAR_RE.test(c) || c > '\u007f';
|
|
79
92
|
/**
|
|
80
93
|
* Read a script once. Total and linear: it never throws, every loop advances, and
|
|
81
94
|
* a misread costs a missed or an extra finding, never a hang. It is a heuristic
|
|
@@ -191,7 +204,7 @@ function lexJs(src) {
|
|
|
191
204
|
if (closed !== -1) {
|
|
192
205
|
keep('regex', i, i + 1, closed);
|
|
193
206
|
i = closed + 1;
|
|
194
|
-
while (i < n &&
|
|
207
|
+
while (i < n && LEX_JS_RE.test(src.charAt(i))) {
|
|
195
208
|
i += 1;
|
|
196
209
|
}
|
|
197
210
|
regexAllowed = false;
|
|
@@ -201,7 +214,7 @@ function lexJs(src) {
|
|
|
201
214
|
regexAllowed = true;
|
|
202
215
|
}
|
|
203
216
|
}
|
|
204
|
-
else if (
|
|
217
|
+
else if (LEX_JS_RE_2.test(c) || c > '\u007f') {
|
|
205
218
|
let j = i + 1;
|
|
206
219
|
while (j < n && isIdentChar(src.charAt(j))) {
|
|
207
220
|
j += 1;
|
|
@@ -211,7 +224,7 @@ function lexJs(src) {
|
|
|
211
224
|
}
|
|
212
225
|
else if (c >= '0' && c <= '9') {
|
|
213
226
|
let j = i + 1;
|
|
214
|
-
while (j < n &&
|
|
227
|
+
while (j < n && LEX_JS_RE_3.test(src.charAt(j))) {
|
|
215
228
|
j += 1;
|
|
216
229
|
}
|
|
217
230
|
regexAllowed = false;
|
|
@@ -296,14 +309,14 @@ function classifyUrl(raw) {
|
|
|
296
309
|
lower.startsWith('tel:')) {
|
|
297
310
|
return 'inline';
|
|
298
311
|
}
|
|
299
|
-
if (lower.startsWith('//') ||
|
|
312
|
+
if (lower.startsWith('//') || CLASSIFY_URL_RE.test(lower)) {
|
|
300
313
|
return 'external';
|
|
301
314
|
}
|
|
302
315
|
return 'relative';
|
|
303
316
|
}
|
|
304
317
|
/** XML namespace identifiers look like URLs and load nothing. */
|
|
305
318
|
function isNamespaceUrl(url) {
|
|
306
|
-
return
|
|
319
|
+
return IS_NAMESPACE_URL_RE.test(url);
|
|
307
320
|
}
|
|
308
321
|
// ── collector ───────────────────────────────────────────────────────────────
|
|
309
322
|
class Collector {
|
|
@@ -333,7 +346,7 @@ function scanCssInto(source, baseLine, out) {
|
|
|
333
346
|
while (i !== -1) {
|
|
334
347
|
const end = lower.indexOf(';', i);
|
|
335
348
|
const statement = masked.slice(i, end === -1 ? undefined : end);
|
|
336
|
-
const target =
|
|
349
|
+
const target = SCAN_CSS_INTO_RE.exec(statement);
|
|
337
350
|
const kind = target ? classifyUrl(target[1]) : 'relative';
|
|
338
351
|
if (kind === 'external') {
|
|
339
352
|
out.add('error', 'external-resource', lineOf(i), '@import of a URL: the frame allows no stylesheet from a URL, so the rules never load.', 'Write the rules inline in this section; there are no web fonts or remote stylesheets.');
|
|
@@ -347,7 +360,7 @@ function scanCssInto(source, baseLine, out) {
|
|
|
347
360
|
while (u !== -1) {
|
|
348
361
|
const close = masked.indexOf(')', u + 4);
|
|
349
362
|
const inner = masked.slice(u + 4, close === -1 ? undefined : close).trim();
|
|
350
|
-
const value = inner.replace(
|
|
363
|
+
const value = inner.replace(SCAN_CSS_INTO_RE_2, '');
|
|
351
364
|
const kind = classifyUrl(value);
|
|
352
365
|
if (kind === 'external') {
|
|
353
366
|
out.add('error', 'external-resource', lineOf(u), 'url() of an external address: img-src and font-src allow only data: and blob: URLs here, so it is blocked.', 'Use inline SVG, a gradient, or a data: URI.');
|
|
@@ -508,14 +521,13 @@ const STRING_ARGUMENT_RULES = [
|
|
|
508
521
|
/** Broker calls send a capability message; they never use the frame's network API. */
|
|
509
522
|
function brokerFetchOffsets(code) {
|
|
510
523
|
const offsets = new Set();
|
|
511
|
-
const
|
|
512
|
-
for (const match of code.matchAll(calls)) {
|
|
524
|
+
for (const match of code.matchAll(CALLS_RE)) {
|
|
513
525
|
const start = match.index ?? 0;
|
|
514
526
|
if (start > 0 && isIdentChar(code[start - 1]))
|
|
515
527
|
continue;
|
|
516
528
|
// `other . skrr.app.http.fetch` is another object's property, not the host SDK.
|
|
517
529
|
let before = start - 1;
|
|
518
|
-
while (before >= 0 &&
|
|
530
|
+
while (before >= 0 && BROKER_FETCH_OFFSETS_RE.test(code[before]))
|
|
519
531
|
before -= 1;
|
|
520
532
|
if (before >= 0 && code[before] === '.')
|
|
521
533
|
continue;
|
|
@@ -561,14 +573,14 @@ function scanJsInto(source, baseLine, out) {
|
|
|
561
573
|
const url = match[1];
|
|
562
574
|
const index = literal.start + (match.index ?? 0);
|
|
563
575
|
const text = codeLines[lineAt(starts, index) - 1] ?? '';
|
|
564
|
-
if (isNamespaceUrl(url) ||
|
|
576
|
+
if (isNamespaceUrl(url) || SCAN_JS_INTO_RE.test(text)) {
|
|
565
577
|
continue;
|
|
566
578
|
}
|
|
567
579
|
out.add('warn', 'external-url', lineOf(index), `A URL string (${url.length > 60 ? `${url.slice(0, 57)}...` : url}): the frame can load nothing from a URL.`, `If it is a link, pass it to ${OPEN_LINK}; if it is data or an image, inline it.`);
|
|
568
580
|
}
|
|
569
581
|
}
|
|
570
582
|
// The one rule that reads the text as the HTML parser would, and so reads strings too.
|
|
571
|
-
if (
|
|
583
|
+
if (SCAN_JS_INTO_RE_2.test(commentless)) {
|
|
572
584
|
const at = asciiLower(commentless).indexOf('</script');
|
|
573
585
|
out.add('warn', 'element-close', lineOf(at), 'The text contains a closing script tag, which can end the script early depending on how the frame embeds it.', 'Write it as <\\/script> inside a string.');
|
|
574
586
|
}
|
|
@@ -676,7 +688,7 @@ const RESOURCE_ATTRIBUTES = ['src', 'srcset', 'poster', 'data', 'background', 'x
|
|
|
676
688
|
function srcsetUrls(value) {
|
|
677
689
|
return value
|
|
678
690
|
.split(',')
|
|
679
|
-
.map((candidate) => candidate.trim().split(
|
|
691
|
+
.map((candidate) => candidate.trim().split(SRCSET_URLS_RE)[0])
|
|
680
692
|
.filter(Boolean);
|
|
681
693
|
}
|
|
682
694
|
const STYLESHEET_LIKE_REL = /\b(?:stylesheet|preload|modulepreload|prefetch|icon|manifest)\b/i;
|
|
@@ -8,10 +8,12 @@ exports.describeSignalHints = describeSignalHints;
|
|
|
8
8
|
exports.describePartialOutcomes = describePartialOutcomes;
|
|
9
9
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
10
10
|
const format_1 = require("./format");
|
|
11
|
+
// eslint-disable-next-line no-control-regex
|
|
12
|
+
const PRINTABLE_RE = /[\u0000-\u001f\u007f-\u009f]/g;
|
|
13
|
+
const DESCRIBE_NODE_DETAIL_RE = /_/g;
|
|
11
14
|
/** One printable line: control characters (an ESC sequence included) become spaces. */
|
|
12
15
|
function printable(value) {
|
|
13
|
-
|
|
14
|
-
return (0, format_1.collapseWhitespace)(value.replace(/[\u0000-\u001f\u007f-\u009f]/g, ' '));
|
|
16
|
+
return (0, format_1.collapseWhitespace)(value.replace(PRINTABLE_RE, ' '));
|
|
15
17
|
}
|
|
16
18
|
/**
|
|
17
19
|
* Nodes in graph order: the server's topological `depth` first, then the order the server
|
|
@@ -65,7 +67,7 @@ function describeNodeDetail(node, attention = '') {
|
|
|
65
67
|
// `succeeded` with half its graph unrun looked unexplained; only --json said why (OSK-22461).
|
|
66
68
|
const extra = node;
|
|
67
69
|
if (node.status === 'skipped' && typeof extra.output?.reason === 'string') {
|
|
68
|
-
parts.push(`skipped: ${extra.output.reason.replace(
|
|
70
|
+
parts.push(`skipped: ${extra.output.reason.replace(DESCRIBE_NODE_DETAIL_RE, ' ')}`);
|
|
69
71
|
}
|
|
70
72
|
if (extra.nodeType === 'condition' && node.status === 'succeeded' && typeof extra.outcome === 'string') {
|
|
71
73
|
parts.push(`took "${extra.outcome}"`);
|
|
@@ -114,6 +114,15 @@ export declare function buildTemplateInsertPayload(input: {
|
|
|
114
114
|
semanticRevision: number;
|
|
115
115
|
presentationRevision: number;
|
|
116
116
|
}): WorkflowTemplateInsertParams;
|
|
117
|
+
/**
|
|
118
|
+
* One `--keep-concrete nodeKey.configPath` value, as the server's override list wants it.
|
|
119
|
+
*
|
|
120
|
+
* The extraction scrubs space-locked values (a `workflow_call`'s workflow id, an assignee) into
|
|
121
|
+
* slots so the fragment is portable. Keeping one concrete is a deliberate act the API supports
|
|
122
|
+
* (`slotOverrides[].keepConcrete`) and the canvas offers; without this flag the CLI could not
|
|
123
|
+
* reach it, so the template that results from the same selection differed by surface.
|
|
124
|
+
*/
|
|
125
|
+
export declare function parseKeepConcrete(values: readonly string[] | undefined, nodeKeys: readonly string[]): TemplatePlan<NonNullable<WorkflowTemplateExtractParams['slotOverrides']>>;
|
|
117
126
|
/** Shape the save-from-selection request. The client names node keys only. */
|
|
118
127
|
export declare function buildTemplateExtractPayload(flags: {
|
|
119
128
|
nodes?: string;
|
|
@@ -122,6 +131,7 @@ export declare function buildTemplateExtractPayload(flags: {
|
|
|
122
131
|
tags?: string;
|
|
123
132
|
scope?: string;
|
|
124
133
|
publish?: boolean;
|
|
134
|
+
keepConcrete?: readonly string[];
|
|
125
135
|
}): TemplatePlan<WorkflowTemplateExtractParams>;
|
|
126
136
|
/**
|
|
127
137
|
* Whether a failed insert lost the draft compare-and-swap.
|
|
@@ -12,6 +12,7 @@ exports.buildInsertConnect = buildInsertConnect;
|
|
|
12
12
|
exports.parseSlotBindings = parseSlotBindings;
|
|
13
13
|
exports.resolveTemplateVersionId = resolveTemplateVersionId;
|
|
14
14
|
exports.buildTemplateInsertPayload = buildTemplateInsertPayload;
|
|
15
|
+
exports.parseKeepConcrete = parseKeepConcrete;
|
|
15
16
|
exports.buildTemplateExtractPayload = buildTemplateExtractPayload;
|
|
16
17
|
exports.isWorkflowDraftConflict = isWorkflowDraftConflict;
|
|
17
18
|
exports.toTemplateListRow = toTemplateListRow;
|
|
@@ -491,6 +492,48 @@ function buildTemplateInsertPayload(input) {
|
|
|
491
492
|
expectedPresentationRevision: input.presentationRevision,
|
|
492
493
|
};
|
|
493
494
|
}
|
|
495
|
+
/**
|
|
496
|
+
* One `--keep-concrete nodeKey.configPath` value, as the server's override list wants it.
|
|
497
|
+
*
|
|
498
|
+
* The extraction scrubs space-locked values (a `workflow_call`'s workflow id, an assignee) into
|
|
499
|
+
* slots so the fragment is portable. Keeping one concrete is a deliberate act the API supports
|
|
500
|
+
* (`slotOverrides[].keepConcrete`) and the canvas offers; without this flag the CLI could not
|
|
501
|
+
* reach it, so the template that results from the same selection differed by surface.
|
|
502
|
+
*/
|
|
503
|
+
function parseKeepConcrete(values, nodeKeys) {
|
|
504
|
+
const overrides = [];
|
|
505
|
+
const seen = new Set();
|
|
506
|
+
for (const raw of values ?? []) {
|
|
507
|
+
const value = raw.trim();
|
|
508
|
+
const dot = value.indexOf('.');
|
|
509
|
+
const nodeKey = dot > 0 ? value.slice(0, dot) : '';
|
|
510
|
+
const configPath = dot > 0 ? value.slice(dot + 1) : '';
|
|
511
|
+
if (!nodeKey || !configPath) {
|
|
512
|
+
return {
|
|
513
|
+
ok: false,
|
|
514
|
+
error: {
|
|
515
|
+
code: 'WORKFLOW_TEMPLATE_KEEP_CONCRETE_INVALID',
|
|
516
|
+
message: `--keep-concrete takes nodeKey.configPath, for example call_1.definitionId (got "${raw}").`,
|
|
517
|
+
},
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
// An override for a node that is not being extracted would change nothing and say nothing.
|
|
521
|
+
if (!nodeKeys.includes(nodeKey)) {
|
|
522
|
+
return {
|
|
523
|
+
ok: false,
|
|
524
|
+
error: {
|
|
525
|
+
code: 'WORKFLOW_TEMPLATE_KEEP_CONCRETE_NOT_SELECTED',
|
|
526
|
+
message: `--keep-concrete ${value}: node "${nodeKey}" is not in --nodes (${nodeKeys.join(', ')}).`,
|
|
527
|
+
},
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
if (seen.has(value))
|
|
531
|
+
continue;
|
|
532
|
+
seen.add(value);
|
|
533
|
+
overrides.push({ nodeKey, configPath, keepConcrete: true });
|
|
534
|
+
}
|
|
535
|
+
return { ok: true, payload: overrides };
|
|
536
|
+
}
|
|
494
537
|
/** Shape the save-from-selection request. The client names node keys only. */
|
|
495
538
|
function buildTemplateExtractPayload(flags) {
|
|
496
539
|
const nodeKeys = flags.nodes ? csv(flags.nodes) : [];
|
|
@@ -524,6 +567,9 @@ function buildTemplateExtractPayload(flags) {
|
|
|
524
567
|
const scope = parseTemplateScope(flags.scope);
|
|
525
568
|
if (!scope.ok)
|
|
526
569
|
return scope;
|
|
570
|
+
const keepConcrete = parseKeepConcrete(flags.keepConcrete, nodeKeys);
|
|
571
|
+
if (!keepConcrete.ok)
|
|
572
|
+
return keepConcrete;
|
|
527
573
|
return {
|
|
528
574
|
ok: true,
|
|
529
575
|
payload: defined({
|
|
@@ -532,6 +578,7 @@ function buildTemplateExtractPayload(flags) {
|
|
|
532
578
|
description: flags.description,
|
|
533
579
|
tags: tags.payload,
|
|
534
580
|
scope: scope.payload,
|
|
581
|
+
slotOverrides: keepConcrete.payload.length ? keepConcrete.payload : undefined,
|
|
535
582
|
// The server default is `true`; an explicit `false` has to survive so
|
|
536
583
|
// `--no-publish` actually leaves the row unpublished.
|
|
537
584
|
publish: flags.publish,
|
package/dist/lib/write-target.js
CHANGED
|
@@ -19,6 +19,7 @@ exports.firstUnmetExpectation = firstUnmetExpectation;
|
|
|
19
19
|
* them and whether an expectation holds.
|
|
20
20
|
*/
|
|
21
21
|
const core_1 = require("@oclif/core");
|
|
22
|
+
const HOST_OF_RE = /^[a-z][a-z0-9+.-]*:\/\//i;
|
|
22
23
|
/** `stevedu518@gmail.com on https://skrr.ai (no workspace)` */
|
|
23
24
|
function formatWriteTarget(target) {
|
|
24
25
|
const who = target.account ?? target.accountId ?? 'an account that could not be read';
|
|
@@ -27,7 +28,7 @@ function formatWriteTarget(target) {
|
|
|
27
28
|
}
|
|
28
29
|
function hostOf(value) {
|
|
29
30
|
try {
|
|
30
|
-
return new URL(
|
|
31
|
+
return new URL(HOST_OF_RE.test(value) ? value : `https://${value}`).host.toLowerCase();
|
|
31
32
|
}
|
|
32
33
|
catch {
|
|
33
34
|
return null;
|
|
@@ -48,12 +49,10 @@ function matchesExpectedTarget(target, expected) {
|
|
|
48
49
|
const value = expected.trim();
|
|
49
50
|
if (!value)
|
|
50
51
|
return false;
|
|
51
|
-
if (value.includes('@') &&
|
|
52
|
+
if (value.includes('@') && !HOST_OF_RE.test(value)) {
|
|
52
53
|
return target.account !== null && target.account.toLowerCase() === value.toLowerCase();
|
|
53
54
|
}
|
|
54
|
-
if (
|
|
55
|
-
value.includes('.') ||
|
|
56
|
-
value.startsWith('localhost')) {
|
|
55
|
+
if (HOST_OF_RE.test(value) || value.includes('.') || value.startsWith('localhost')) {
|
|
57
56
|
const expectedHost = hostOf(value);
|
|
58
57
|
return expectedHost !== null && expectedHost === hostOf(target.server);
|
|
59
58
|
}
|
|
@@ -39,6 +39,7 @@ var import_node_child_process = require("node:child_process");
|
|
|
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_runtime = require("./runtime.js");
|
|
42
|
+
const PARSE_HELPER_OUTPUT_RE = /\s/;
|
|
42
43
|
const MAX_OUTPUT_BYTES = 64 * 1024;
|
|
43
44
|
const DEFAULT_TIMEOUT_MS = 1e4;
|
|
44
45
|
const DEFAULT_TTL_MS = 5 * 6e4;
|
|
@@ -234,7 +235,7 @@ function parseHelperOutput(stdout, log) {
|
|
|
234
235
|
return null;
|
|
235
236
|
}
|
|
236
237
|
}
|
|
237
|
-
if (
|
|
238
|
+
if (PARSE_HELPER_OUTPUT_RE.test(trimmed)) {
|
|
238
239
|
log.error("[authHelper] bare-token output contains whitespace \u2014 refusing (use JSON if helper logs to stdout)");
|
|
239
240
|
return null;
|
|
240
241
|
}
|
|
@@ -25,6 +25,17 @@ __export(commitmentExecutionContract_exports, {
|
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(commitmentExecutionContract_exports);
|
|
27
27
|
var import_node_util = require("node:util");
|
|
28
|
+
const VALID_CI_LOG_EVIDENCE_RE = /^[\w.-]+\/[\w.-]+$/;
|
|
29
|
+
const VALID_CI_LOG_EVIDENCE_RE_2 = /^\d{1,20}$/;
|
|
30
|
+
const VALID_CI_LOG_EVIDENCE_RE_3 = /^[a-z0-9_]{1,80}$/;
|
|
31
|
+
const VALID_CI_LOG_EVIDENCE_RE_4 = /^[a-f0-9]{16}$/;
|
|
32
|
+
const VALID_CAPABILITY_SOURCE_RE = /^[a-z0-9_.-]{1,80}$/i;
|
|
33
|
+
const VALID_CAPABILITY_SOURCE_RE_2 = /^[a-z0-9_:.-]{1,120}$/i;
|
|
34
|
+
const VALID_CAPABILITY_SOURCE_RE_3 = /^[a-f0-9]{64}$/i;
|
|
35
|
+
const VALID_BRANCH_RE = /[\s~^:?*[\\\x00-\x1f\x7f]/;
|
|
36
|
+
const VALID_DELIVERY_RE = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;
|
|
37
|
+
const VALID_DELIVERY_SOURCE_RE = /^[A-Za-z0-9][A-Za-z0-9_./-]{0,239}$/;
|
|
38
|
+
const VALID_DELIVERY_SOURCE_RE_2 = /^[a-f0-9]{40,64}$/i;
|
|
28
39
|
const COMMITMENT_EXECUTION_CONTRACT_VERSION = 3;
|
|
29
40
|
const COMMITMENT_EXECUTION_CONTRACT_CAPABILITY = "commitment_execution_contract_v3";
|
|
30
41
|
const DELIVERY_MODES = /* @__PURE__ */ new Set([
|
|
@@ -201,10 +212,10 @@ const CI_LOG_EXCERPT_MAX_CHARS = 12e3;
|
|
|
201
212
|
function validCiLogEvidence(value) {
|
|
202
213
|
if (!hasOnlyKeys(value, CI_LOG_EVIDENCE_KEYS))
|
|
203
214
|
return false;
|
|
204
|
-
if (value.version !== 1 || value.provider !== "github" || value.kind !== "actions_job_log" || value.capability !== "github:actions:read" || value.attestation !== "platform" || !CI_LOG_EVIDENCE_STATUSES.has(String(value.status)) || !isoTimestamp(value.fetchedAt) ||
|
|
215
|
+
if (value.version !== 1 || value.provider !== "github" || value.kind !== "actions_job_log" || value.capability !== "github:actions:read" || value.attestation !== "platform" || !CI_LOG_EVIDENCE_STATUSES.has(String(value.status)) || !isoTimestamp(value.fetchedAt) || !VALID_CI_LOG_EVIDENCE_RE.test(String(value.repoFullName || "")) || !VALID_CI_LOG_EVIDENCE_RE_2.test(String(value.checkRunId || "")))
|
|
205
216
|
return false;
|
|
206
217
|
for (const key of ["workflowRunId", "jobId"]) {
|
|
207
|
-
if (value[key] !== void 0 &&
|
|
218
|
+
if (value[key] !== void 0 && !VALID_CI_LOG_EVIDENCE_RE_2.test(String(value[key])))
|
|
208
219
|
return false;
|
|
209
220
|
}
|
|
210
221
|
for (const key of ["byteLength", "lineCount", "excerptLines", "failedStepNumber"]) {
|
|
@@ -216,9 +227,9 @@ function validCiLogEvidence(value) {
|
|
|
216
227
|
if (value[key] !== void 0 && !boundedString(value[key], 200))
|
|
217
228
|
return false;
|
|
218
229
|
}
|
|
219
|
-
if (value.reason !== void 0 &&
|
|
230
|
+
if (value.reason !== void 0 && !VALID_CI_LOG_EVIDENCE_RE_3.test(String(value.reason)))
|
|
220
231
|
return false;
|
|
221
|
-
if (value.digest !== void 0 &&
|
|
232
|
+
if (value.digest !== void 0 && !VALID_CI_LOG_EVIDENCE_RE_4.test(String(value.digest)))
|
|
222
233
|
return false;
|
|
223
234
|
if (!CI_LOG_EVIDENCE_READABLE.has(String(value.status))) {
|
|
224
235
|
return value.excerpt === void 0 && value.digest === void 0 && Boolean(value.reason);
|
|
@@ -249,11 +260,11 @@ function evidenceMatchesEvent(row, event) {
|
|
|
249
260
|
function validCapabilitySource(value) {
|
|
250
261
|
if (!hasOnlyKeys(value, CAPABILITY_SOURCE_KEYS))
|
|
251
262
|
return false;
|
|
252
|
-
if (!CAPABILITY_SOURCES.has(String(value.source)) || !boundedString(value.provider, 80) ||
|
|
263
|
+
if (!CAPABILITY_SOURCES.has(String(value.source)) || !boundedString(value.provider, 80) || !VALID_CAPABILITY_SOURCE_RE.test(value.provider) || !boundedString(value.capability, 120) || !VALID_CAPABILITY_SOURCE_RE_2.test(value.capability) || !CAPABILITY_STATUSES.has(String(value.status)) || !CAPABILITY_ATTESTATIONS.has(String(value.attestation)))
|
|
253
264
|
return false;
|
|
254
265
|
if (value.scope !== void 0 && !optionalString(value.scope, 500))
|
|
255
266
|
return false;
|
|
256
|
-
if (value.accountFingerprint !== void 0 &&
|
|
267
|
+
if (value.accountFingerprint !== void 0 && !VALID_CAPABILITY_SOURCE_RE_3.test(String(value.accountFingerprint)))
|
|
257
268
|
return false;
|
|
258
269
|
if (value.testedAt !== void 0 && !isoTimestamp(value.testedAt))
|
|
259
270
|
return false;
|
|
@@ -318,15 +329,14 @@ function validWorkspacePolicy(value) {
|
|
|
318
329
|
function validBranch(value) {
|
|
319
330
|
return boundedString(value, 255) && value !== "HEAD" && !value.startsWith("refs/") && !value.startsWith("origin/") && !value.startsWith("-") && !value.startsWith("/") && !value.endsWith("/") && !value.endsWith(".") && // Control characters are exactly what this rejects: a Git ref name may not
|
|
320
331
|
// contain them, so the class is deliberate rather than an oversight.
|
|
321
|
-
//
|
|
322
|
-
!/[\s~^:?*[\\\x00-\x1f\x7f]/.test(value) && !value.includes("..") && !value.includes("@{") && !value.includes("//") && value !== "@" && !value.split("/").some((part) => part.startsWith(".") || part.endsWith(".lock"));
|
|
332
|
+
!VALID_BRANCH_RE.test(value) && !value.includes("..") && !value.includes("@{") && !value.includes("//") && value !== "@" && !value.split("/").some((part) => part.startsWith(".") || part.endsWith(".lock"));
|
|
323
333
|
}
|
|
324
334
|
function validDelivery(value) {
|
|
325
335
|
if (!hasOnlyKeys(value, /* @__PURE__ */ new Set(["version", "mode", "repo", "baseBranch", "expectations"])))
|
|
326
336
|
return false;
|
|
327
337
|
if (value.version !== 1 || !DELIVERY_MODES.has(String(value.mode)))
|
|
328
338
|
return false;
|
|
329
|
-
if (value.repo !== void 0 && (
|
|
339
|
+
if (value.repo !== void 0 && (!VALID_DELIVERY_RE.test(String(value.repo)) || String(value.repo) !== String(value.repo).toLowerCase()))
|
|
330
340
|
return false;
|
|
331
341
|
if (value.baseBranch !== void 0 && !validBranch(value.baseBranch))
|
|
332
342
|
return false;
|
|
@@ -374,7 +384,7 @@ function validDelivery(value) {
|
|
|
374
384
|
function validDeliverySource(value) {
|
|
375
385
|
if (!hasOnlyKeys(value, /* @__PURE__ */ new Set(["parentTaskId", "branch", "headSha", "baseCommit", "runtime"])))
|
|
376
386
|
return false;
|
|
377
|
-
return typeof value.parentTaskId === "string" && value.parentTaskId.length > 0 && value.parentTaskId.length <= 200 && typeof value.branch === "string" &&
|
|
387
|
+
return typeof value.parentTaskId === "string" && value.parentTaskId.length > 0 && value.parentTaskId.length <= 200 && typeof value.branch === "string" && VALID_DELIVERY_SOURCE_RE.test(value.branch) && !value.branch.includes("..") && !value.branch.includes("@{") && VALID_DELIVERY_SOURCE_RE_2.test(value.headSha) && typeof value.baseCommit === "string" && VALID_DELIVERY_SOURCE_RE_2.test(value.baseCommit) && hasOnlyKeys(value.runtime, /* @__PURE__ */ new Set(["kind", "id"])) && ["local_daemon", "hosted_machine"].includes(String(value.runtime.kind)) && boundedString(value.runtime.id, 200) && (value.runtime.kind !== "hosted_machine" || value.runtime.id.startsWith("sbs_"));
|
|
378
388
|
}
|
|
379
389
|
function eventSourceRevision(event) {
|
|
380
390
|
if (!event)
|
|
@@ -382,14 +392,14 @@ function eventSourceRevision(event) {
|
|
|
382
392
|
const nestedCheck = event.check_run;
|
|
383
393
|
const nestedWorkflow = event.workflow_run;
|
|
384
394
|
const value = event.headSha || event.head_sha || event.sha || nestedCheck?.head_sha || nestedWorkflow?.head_sha;
|
|
385
|
-
return
|
|
395
|
+
return VALID_DELIVERY_SOURCE_RE_2.test(String(value || "")) ? String(value).toLowerCase() : "";
|
|
386
396
|
}
|
|
387
397
|
function eventRepository(event) {
|
|
388
398
|
if (!event)
|
|
389
399
|
return "";
|
|
390
400
|
const repository = event.repository;
|
|
391
401
|
const value = event.repoFullName || repository?.full_name || repository?.fullName;
|
|
392
|
-
return
|
|
402
|
+
return VALID_DELIVERY_RE.test(String(value || "")) ? String(value).toLowerCase() : "";
|
|
393
403
|
}
|
|
394
404
|
function failedGitHubCheck(event) {
|
|
395
405
|
const eventType = String(event?.eventType || event?.type || "").toLowerCase();
|
|
@@ -46,6 +46,9 @@ __export(computerUse_exports, {
|
|
|
46
46
|
sameComputerUseContext: () => sameComputerUseContext
|
|
47
47
|
});
|
|
48
48
|
module.exports = __toCommonJS(computerUse_exports);
|
|
49
|
+
const PROJECT_COMPUTER_USE_RESULT_FOR_MODEL_RE = /^[A-Za-z0-9_-]{1,512}$/;
|
|
50
|
+
const PROJECT_COMPUTER_USE_RESULT_FOR_MODEL_RE_2 = /^[a-f0-9]{64}$/;
|
|
51
|
+
const PROJECT_COMPUTER_USE_RESULT_FOR_MODEL_RE_3 = /^audio\/[A-Za-z0-9.+-]+(?:;[ -~]*)?$/;
|
|
49
52
|
const COMPUTER_USE_TOOL = "ComputerUse";
|
|
50
53
|
const COMPUTER_USE_PROVIDER = "lcu";
|
|
51
54
|
const COMPUTER_USE_PROTOCOL = "computer_use_mcp_v1";
|
|
@@ -349,7 +352,7 @@ function projectComputerUseResultForModel(result, options) {
|
|
|
349
352
|
const metadata = record(result._meta) ? result._meta : {};
|
|
350
353
|
const candidates = metadata["skrr.ai/computer-use-artifacts"];
|
|
351
354
|
const references = Array.isArray(candidates) ? candidates.filter((item) => record(item) && typeof item.mimeType === "string" && item.mimeType.startsWith("audio/")) : [];
|
|
352
|
-
if (references.length < audioCount || references.some((item) => !record(item) || typeof item.fileId !== "string" ||
|
|
355
|
+
if (references.length < audioCount || references.some((item) => !record(item) || typeof item.fileId !== "string" || !PROJECT_COMPUTER_USE_RESULT_FOR_MODEL_RE.test(item.fileId) || item.reference !== `file:${item.fileId}` || item.ownerUserId !== options.principalId || item.sessionId !== options.sessionId || !Number.isSafeInteger(item.bytes) || item.bytes <= 0 || typeof item.sha256 !== "string" || !PROJECT_COMPUTER_USE_RESULT_FOR_MODEL_RE_2.test(item.sha256) || typeof item.mimeType !== "string" || item.mimeType.length > 256 || !PROJECT_COMPUTER_USE_RESULT_FOR_MODEL_RE_3.test(item.mimeType))) {
|
|
353
356
|
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.");
|
|
354
357
|
}
|
|
355
358
|
const notice = [
|
|
@@ -45,6 +45,11 @@ __export(credentialEnvelope_exports, {
|
|
|
45
45
|
module.exports = __toCommonJS(credentialEnvelope_exports);
|
|
46
46
|
var import_node_crypto = __toESM(require("node:crypto"), 1);
|
|
47
47
|
var import_aead = require("./aead.js");
|
|
48
|
+
const B64U_RE = /=+$/;
|
|
49
|
+
const B64U_RE_2 = /\+/g;
|
|
50
|
+
const B64U_RE_3 = /\//g;
|
|
51
|
+
const B64U_DECODE_RE = /-/g;
|
|
52
|
+
const B64U_DECODE_RE_2 = /_/g;
|
|
48
53
|
const ENVELOPE_MAGIC = "osk-env1";
|
|
49
54
|
const KEY_LEN = import_aead.AEAD_KEY_LEN;
|
|
50
55
|
const NONCE_LEN = import_aead.AEAD_NONCE_LEN;
|
|
@@ -110,10 +115,10 @@ function decrypt(sealed, dek, aad) {
|
|
|
110
115
|
return openBuffer(sealed, dek, aad);
|
|
111
116
|
}
|
|
112
117
|
function b64u(buf) {
|
|
113
|
-
return buf.toString("base64").replace(
|
|
118
|
+
return buf.toString("base64").replace(B64U_RE, "").replace(B64U_RE_2, "-").replace(B64U_RE_3, "_");
|
|
114
119
|
}
|
|
115
120
|
function b64uDecode(s) {
|
|
116
|
-
const padded = s.replace(
|
|
121
|
+
const padded = s.replace(B64U_DECODE_RE, "+").replace(B64U_DECODE_RE_2, "/");
|
|
117
122
|
const pad = padded.length % 4;
|
|
118
123
|
return Buffer.from(pad === 0 ? padded : padded + "=".repeat(4 - pad), "base64");
|
|
119
124
|
}
|
|
@@ -59,6 +59,9 @@ var import_liveState = require("./liveState.js");
|
|
|
59
59
|
var import_refresh = require("./refresh.js");
|
|
60
60
|
var import_runtime = require("./runtime.js");
|
|
61
61
|
var import_stateFiles = require("./stateFiles.js");
|
|
62
|
+
const KEEP_UNREADABLE_WRAPPED_DEK_RE = /[:.]/g;
|
|
63
|
+
const INIT_NEW_INDEPENDENT_CRED_ENVELOPE_RE = /^desktop-bg-[a-f0-9]{32}$/;
|
|
64
|
+
const INIT_CRED_ENVELOPE_RE = /^desktop-bg-[a-f0-9]{32}$/i;
|
|
62
65
|
const ACCOUNT_CRED_DEK_WRAPPED = "cred-dek-wrapped";
|
|
63
66
|
let _state = { kind: "uninit" };
|
|
64
67
|
let _kekRotationDetected = false;
|
|
@@ -248,7 +251,7 @@ function keepUnreadableWrappedDek(profile, wrapped) {
|
|
|
248
251
|
} catch {
|
|
249
252
|
}
|
|
250
253
|
}
|
|
251
|
-
const name = `${UNREADABLE_DEK_COPY_PREFIX}${(/* @__PURE__ */ new Date()).toISOString().replace(
|
|
254
|
+
const name = `${UNREADABLE_DEK_COPY_PREFIX}${(/* @__PURE__ */ new Date()).toISOString().replace(KEEP_UNREADABLE_WRAPPED_DEK_RE, "-")}`;
|
|
252
255
|
(0, import_stateFiles.atomicWrite0600)(import_node_path.default.join(dir, name), wrapped, "keep the unreadable wrapped DEK");
|
|
253
256
|
const kept = [...existing, name].sort();
|
|
254
257
|
for (const stale of kept.slice(0, Math.max(0, kept.length - MAX_UNREADABLE_DEK_COPIES))) {
|
|
@@ -337,7 +340,7 @@ async function initExistingCredEnvelope(profile) {
|
|
|
337
340
|
}
|
|
338
341
|
}
|
|
339
342
|
async function initNewIndependentCredEnvelope(profile) {
|
|
340
|
-
if (
|
|
343
|
+
if (!INIT_NEW_INDEPENDENT_CRED_ENVELOPE_RE.test(profile))
|
|
341
344
|
throw new Error("Background credential enrollment is unavailable");
|
|
342
345
|
if (_state.kind === "active" && _state.profile === profile)
|
|
343
346
|
return;
|
|
@@ -419,7 +422,7 @@ async function initNewIndependentCredEnvelope(profile) {
|
|
|
419
422
|
await initExistingCredEnvelope(profile);
|
|
420
423
|
}
|
|
421
424
|
async function initCredEnvelope(profile) {
|
|
422
|
-
if (
|
|
425
|
+
if (INIT_CRED_ENVELOPE_RE.test(profile))
|
|
423
426
|
return initExistingCredEnvelope(profile);
|
|
424
427
|
if (_state.kind !== "uninit")
|
|
425
428
|
return;
|
|
@@ -24,6 +24,7 @@ __export(daemonConsentProof_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(daemonConsentProof_exports);
|
|
26
26
|
var import_node_crypto = require("node:crypto");
|
|
27
|
+
const VERIFY_DAEMON_CONSENT_PROOF_RE = /^[a-f0-9]{64}$/;
|
|
27
28
|
function normalizeDaemonConsent(input) {
|
|
28
29
|
if (!input || typeof input !== "object" || Array.isArray(input))
|
|
29
30
|
return null;
|
|
@@ -56,7 +57,7 @@ function daemonConsentProof(secret, identity, payload) {
|
|
|
56
57
|
])).digest("hex");
|
|
57
58
|
}
|
|
58
59
|
function verifyDaemonConsentProof(secret, identity, payload, proof) {
|
|
59
|
-
if (
|
|
60
|
+
if (!VERIFY_DAEMON_CONSENT_PROOF_RE.test(proof))
|
|
60
61
|
return false;
|
|
61
62
|
try {
|
|
62
63
|
return (0, import_node_crypto.timingSafeEqual)(Buffer.from(proof, "hex"), Buffer.from(daemonConsentProof(secret, identity, payload), "hex"));
|