@desplega.ai/agent-swarm 1.104.0 → 1.106.0
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/README.md +2 -0
- package/dist/{actions-2expzt47.js → actions-pk6xqa2y.js} +6 -6
- package/dist/{anthropic-messages-8q7p5vyq.js → anthropic-messages-8nc6r2dw.js} +10 -4
- package/dist/{app-dr8hwx7z.js → app-pmfvefkh.js} +3 -3
- package/dist/{assistant-9rhgsw7v.js → assistant-wcjpqxk6.js} +9 -9
- package/dist/{azure-openai-responses-0dmr2hzc.js → azure-openai-responses-6yfzw3qw.js} +10 -18
- package/dist/{boot-reembed-9kt97g1z.js → boot-reembed-atv4kcrh.js} +3 -3
- package/dist/{boot-reembed-3q1aywnz.js → boot-reembed-zanbm36c.js} +4 -4
- package/dist/{boot-scrub-logs-vskq108e.js → boot-scrub-logs-asq051ff.js} +2 -2
- package/dist/{claude-adapter-e3dhkq85.js → claude-adapter-w96mzan4.js} +2 -2
- package/dist/{claude-managed-adapter-z29hjgzz.js → claude-managed-adapter-vj9kzegz.js} +4 -4
- package/dist/{claude-managed-setup-ftbmvmvx.js → claude-managed-setup-t0wkvzgz.js} +1 -1
- package/dist/{cli-92fqyjcv.js → cli-07er7wrs.js} +1 -1
- package/dist/{cli-y9p3e94h.js → cli-08fnz4jm.js} +3 -3
- package/dist/{cli-yjt8a36k.js → cli-39jaysbv.js} +8 -6
- package/dist/{cli-5pf0b84v.js → cli-4fwzc50f.js} +2 -2
- package/dist/{cli-p03mawph.js → cli-50nss8e8.js} +928 -335
- package/dist/{cli-e7bwjntj.js → cli-6hqvenfv.js} +1 -1
- package/dist/{cli-0jw6j755.js → cli-6xn2xv4r.js} +24 -8
- package/dist/{cli-2g9jf9ek.js → cli-842gfjn1.js} +1 -1
- package/dist/{cli-v1syqkcb.js → cli-84gyjn6h.js} +146 -3
- package/dist/{cli-7b9ctyfq.js → cli-8da61htc.js} +1 -1
- package/dist/{cli-nzc0h54v.js → cli-8fhhmzbh.js} +1 -1
- package/dist/{cli-khe4x17a.js → cli-anrn8brw.js} +3 -3
- package/dist/{cli-2q1ct4en.js → cli-bsyka9ta.js} +104 -3
- package/dist/{cli-p04j6hjv.js → cli-dqhz8451.js} +1 -1
- package/dist/{cli-s42f54ja.js → cli-f7ypwjgh.js} +1 -1
- package/dist/{cli-p4cj4vhc.js → cli-hmqkes02.js} +1 -1
- package/dist/{cli-23zk7xqy.js → cli-j1172z85.js} +26 -18
- package/dist/{cli-yp2krx5r.js → cli-jk4tj5m6.js} +9 -3
- package/dist/{cli-q5tshxd6.js → cli-k7gt5r0p.js} +1 -1
- package/dist/{cli-54h5daha.js → cli-n38fcvhe.js} +6 -6
- package/dist/{cli-2hap19dv.js → cli-p7hff99g.js} +3 -3
- package/dist/cli-pscrc6tw.js +73 -0
- package/dist/{cli-yvektv79.js → cli-pxddwmyc.js} +1 -1
- package/dist/{cli-ncg70f07.js → cli-q44nxhwq.js} +1 -1
- package/dist/{cli-d4z1csms.js → cli-qtr61agf.js} +3 -3
- package/dist/{cli-zaxksbgj.js → cli-rp5kaak8.js} +5 -5
- package/dist/{cli-0fxvpa2q.js → cli-sdpnhajn.js} +150 -163
- package/dist/{cli-w1nfskkg.js → cli-sp3c9fwf.js} +2 -2
- package/dist/{cli-gj2n2ec1.js → cli-tfcrm7ds.js} +1 -1
- package/dist/{cli-0k9dc6ks.js → cli-tghre7g6.js} +1 -0
- package/dist/{cli-qvzgncd8.js → cli-v90vvqt8.js} +401 -125
- package/dist/{cli-zghef0em.js → cli-v9853xza.js} +1 -1
- package/dist/{cli-t9v14cnd.js → cli-wfhe4tgs.js} +1 -1
- package/dist/{cli-7v4y3hyd.js → cli-xgssgdqn.js} +2 -2
- package/dist/{cli-etvgz5x8.js → cli-xvs40j7w.js} +4 -4
- package/dist/{cli-jntqphs0.js → cli-ygcrdkqt.js} +15 -9
- package/dist/{cli-2957pqpj.js → cli-yv9dttkh.js} +32 -9
- package/dist/cli.js +20 -17
- package/dist/{codex-adapter-w0xharsg.js → codex-adapter-h9rj59tj.js} +5 -5
- package/dist/{codex-session-runner-kzbjcm2k.js → codex-session-runner-2ybavr0w.js} +5 -5
- package/dist/{commands-wfrkef57.js → commands-075ak6vf.js} +2 -2
- package/dist/{db-c42pxt7h.js → db-60fj8j7t.js} +2 -2
- package/dist/{google-generative-ai-mdn340ga.js → google-generative-ai-rf42vj2h.js} +9 -4
- package/dist/{google-vertex-mkdewpwe.js → google-vertex-m92pj5fb.js} +9 -4
- package/dist/{handlers-n36zkfvx.js → handlers-96j9z4gk.js} +9 -9
- package/dist/{hook-gw3vhv6s.js → hook-f58wyvmy.js} +3 -3
- package/dist/{http-59ygpn2h.js → http-naqhj1n0.js} +579 -52
- package/dist/{index-xf6fp4y1.js → index-45bqm6xc.js} +5 -5
- package/dist/{index-xz8vaa5c.js → index-f5e873a5.js} +10 -10
- package/dist/{index-jca7jdpt.js → index-jscerv2x.js} +10 -6
- package/dist/{index-881c1baf.js → index-v3r40ak0.js} +8 -8
- package/dist/{keepalive-mj4302vw.js → keepalive-8gbgeg21.js} +4 -4
- package/dist/{lead-qm0xjvkv.js → lead-hj6stakm.js} +26 -26
- package/dist/{maintenance-xppxbe4t.js → maintenance-1nvd0jva.js} +4 -4
- package/dist/{mistral-conversations-j380wd2q.js → mistral-conversations-26yrnbf1.js} +2 -2
- package/dist/{onboard-ejx6yxh8.js → onboard-8myqe0jh.js} +2 -2
- package/dist/{openai-codex-responses-v80z7kgx.js → openai-codex-responses-8h6kvfv8.js} +16 -25
- package/dist/{openai-completions-39vefwrq.js → openai-completions-x6kjnqjd.js} +11 -5
- package/dist/{openai-responses-dp5bkm3q.js → openai-responses-7jwyz3ds.js} +8 -16
- package/dist/{opencode-adapter-s8vsmzpy.js → opencode-adapter-p2w6efwc.js} +2 -2
- package/dist/{openrouter-images-54cva05t.js → openrouter-images-537nmn1r.js} +5 -1
- package/dist/{otel-impl-zs5exkpk.js → otel-impl-tddx9x81.js} +4510 -4465
- package/dist/{pi-mono-adapter-zf7dt1wg.js → pi-mono-adapter-y037wnp4.js} +596 -297
- package/dist/{pricing-refresh-nqyf8bkb.js → pricing-refresh-f6cgj5br.js} +4 -4
- package/dist/{seed-pricing-w3x550cj.js → seed-pricing-3tqmbe0p.js} +3 -3
- package/dist/{setup-7729ktfj.js → setup-tq3ept9k.js} +2 -2
- package/dist/{worker-4ttemwhw.js → worker-526psbtb.js} +26 -26
- package/openapi.json +315 -1
- package/package.json +8 -6
- package/src/be/db.ts +6 -2
- package/src/be/memory/access.ts +5 -0
- package/src/be/migrations/102_script_apis.sql +31 -0
- package/src/be/modelsdev-cache.json +22170 -7247
- package/src/be/scripts/db.ts +214 -1
- package/src/be/seed-pricing.ts +1 -1
- package/src/commands/claude-managed-setup.ts +1 -1
- package/src/hooks/tool-loop-detection.test.ts +81 -1
- package/src/hooks/tool-loop-detection.ts +53 -10
- package/src/http/index.ts +11 -1
- package/src/http/mcp.ts +49 -0
- package/src/http/memory.ts +21 -11
- package/src/http/pages-public.ts +123 -2
- package/src/http/scripts.ts +213 -0
- package/src/http/session-data.ts +16 -0
- package/src/http/x.ts +244 -0
- package/src/otel-impl.ts +73 -0
- package/src/otel.ts +12 -0
- package/src/prompts/session-templates.ts +5 -1
- package/src/providers/claude-managed-models.ts +9 -0
- package/src/server.ts +2 -0
- package/src/tests/agents-list-model-display.test.ts +5 -0
- package/src/tests/bedrock-model-groups.test.ts +3 -0
- package/src/tests/claude-managed-adapter.test.ts +14 -0
- package/src/tests/claude-managed-setup.test.ts +3 -3
- package/src/tests/context-window.test.ts +1 -0
- package/src/tests/harness-provider-resolution.test.ts +39 -0
- package/src/tests/http-api-integration.test.ts +1 -1
- package/src/tests/mcp-user-route.test.ts +70 -5
- package/src/tests/memory-get-tool.test.ts +132 -0
- package/src/tests/memory-http-recall-gating.test.ts +17 -1
- package/src/tests/migration-046-budgets.test.ts +32 -0
- package/src/tests/otel-impl-secret-scrubbing.test.ts +101 -3
- package/src/tests/otel-session-cost-metrics.test.ts +281 -0
- package/src/tests/pages-authed-mode.test.ts +50 -0
- package/src/tests/preload.ts +26 -0
- package/src/tests/register-service-security.test.ts +194 -0
- package/src/tests/script-apis-mcp.test.ts +308 -0
- package/src/tests/scripts-external-api.test.ts +449 -0
- package/src/tests/session-costs-model-key-normalize.test.ts +1 -0
- package/src/tests/update-profile-auth.test.ts +35 -1
- package/src/tools/memory-get.ts +17 -2
- package/src/tools/register-service.ts +68 -4
- package/src/tools/script-apis.ts +158 -0
- package/src/tools/script-common.ts +1 -1
- package/src/tools/tool-config.ts +2 -1
- package/src/tools/update-profile.ts +84 -1
- package/src/types.ts +27 -1
- package/src/utils/context-window.ts +1 -0
- package/src/utils/harness-provider.ts +35 -6
- package/src/utils/short-id.ts +44 -0
- package/templates/community/code-health-reports/run.sh +12 -6
- package/templates/community/dora-metrics/run.sh +10 -2
- package/templates/official/coder/start-up.sh +2 -2
- package/templates/official/content-reviewer/start-up.sh +2 -2
- package/templates/official/content-strategist/start-up.sh +2 -2
- package/templates/official/content-writer/start-up.sh +2 -2
- package/templates/official/discoverability-optimizer/start-up.sh +2 -2
- package/templates/official/ux-principles/start-up.sh +5 -5
- package/templates/skills/swarm-scripts/SKILL.md +4 -0
- package/templates/skills/swarm-scripts/content.md +4 -0
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
import {
|
|
26
26
|
init_package,
|
|
27
27
|
package_default
|
|
28
|
-
} from "./cli-
|
|
28
|
+
} from "./cli-39jaysbv.js";
|
|
29
29
|
import {
|
|
30
30
|
init_secret_scrubber,
|
|
31
31
|
scrubSecrets
|
|
@@ -469,7 +469,7 @@ function resolveTaskModelSelection(opts) {
|
|
|
469
469
|
function isTerminalTaskStatus(status) {
|
|
470
470
|
return TERMINAL_TASK_STATUSES.includes(status);
|
|
471
471
|
}
|
|
472
|
-
var ModelTierSchema, MODEL_TIERS, LEGACY_MODEL_TO_TIER, DEFAULT_MODEL_TIER_MAP, AgentTaskStatusSchema, TERMINAL_TASK_STATUSES, InboxMessageStatusSchema, InboxMessageSchema, AgentTaskSourceSchema, ProviderNameSchema, FollowUpConfigSchema, AgentTaskSchema, TaskAttachmentKindSchema, attachmentCommonFields, AttachmentInputSchema, TaskAttachmentSchema, UserSchema, IdentityEventTypeSchema, InboxItemTypeSchema, InboxItemStatusSchema, InboxItemStateSchema, TaskTemplateKindSchema, TaskTemplateSchema, AgentStatusSchema, AgentSchema, AgentCredStatusLiveTestSchema, AgentLatestModelSchema, AgentBedrockStatusSchema, AgentCredStatusSchema, AgentWithTasksSchema, ChangeSourceSchema, VersionableFieldSchema, ContextVersionSchema, ChannelTypeSchema, ChannelSchema, ChannelMessageSchema, ServiceStatusSchema, ServiceSchema, AgentLogEventTypeSchema, ResumeReasonSchema, AgentLogSchema, SessionLogSchema, SessionCostSourceSchema, SessionCostSchema, EventCategorySchema, EventStatusSchema, EventSourceSchema, EventNameSchema, SwarmEventSchema, ScheduledTaskSchema, SwarmConfigScopeSchema, SwarmConfigSchema, RepoGuidelinesSchema, RepoHooksSchema, SwarmRepoSchema, AgentMemoryScopeSchema, AgentMemorySourceSchema, AgentMemorySchema, ActiveSessionSchema, RetryPolicySchema, ExecutorMetaSchema, ValidationResultSchema, StepValidationConfigSchema, SwarmScriptNodeConfigSchema, WorkflowNodeSchema, WorkflowEdgeSchema, WorkflowDefinitionSchema, WorkflowNodePatchSchema, WorkflowPatchSchema, TriggerConfigSchema, CooldownConfigSchema, InputValueSchema, WorkflowTemplateSchema, WorkflowSnapshotSchema, WorkflowSchema, WorkflowVersionSchema, PageContentTypeSchema, PageAuthModeSchema, PageSnapshotSchema, PageSchema, PageVersionSchema, MetricParamSchema, MetricVariableTypeSchema, MetricFormatSchema, MetricVisualizationSchema, MetricQuerySchema, MetricVariableSchema, MetricVizConfigSchema, MetricWidgetSchema, MetricDefinitionSchema, MetricSnapshotSchema, MetricSchema, MetricVersionSchema, WorkflowRunStatusSchema, WorkflowRunSchema, ScriptRunStatusSchema, TERMINAL_SCRIPT_RUN_STATUSES, ScriptRunKindSchema, ScriptRunSchema, ScriptRunListItemSchema, ScriptRunJournalEntrySchema, WorkflowRunStepStatusSchema, WorkflowRunStepSchema, WaitModeSchema, WaitStateStatusSchema, WaitStateRowSchema, PromptTemplateScopeSchema, PromptTemplateStateSchema, PromptTemplateSchema, PromptTemplateHistorySchema, ScriptScopeSchema, ScriptFsModeSchema, ScriptRecordSchema, ScriptVersionRecordSchema, SkillTypeSchema, SkillScopeSchema, SkillSchema, AgentSkillSchema, SkillWithInstallInfoSchema, SkillFileSchema, McpServerTransportSchema, McpServerScopeSchema, McpAuthMethodSchema, McpServerSchema, AgentMcpServerSchema, McpServerWithInstallInfoSchema, ContextSnapshotEventTypeSchema, ContextFormulaSchema, ContextSnapshotSchema, BudgetScopeSchema, BudgetSchema, PricingProviderSchema, PricingTokenClassSchema, PricingRowSchema, BudgetRefusalCauseSchema, BudgetRefusalNotificationSchema, BudgetRefusedTriggerSchema, KvValueTypeSchema, KV_NAME_REGEX, KvNamespaceSchema, KvKeySchema, KvEntrySchema;
|
|
472
|
+
var ModelTierSchema, MODEL_TIERS, LEGACY_MODEL_TO_TIER, DEFAULT_MODEL_TIER_MAP, AgentTaskStatusSchema, TERMINAL_TASK_STATUSES, InboxMessageStatusSchema, InboxMessageSchema, AgentTaskSourceSchema, ProviderNameSchema, FollowUpConfigSchema, AgentTaskSchema, TaskAttachmentKindSchema, attachmentCommonFields, AttachmentInputSchema, TaskAttachmentSchema, UserSchema, IdentityEventTypeSchema, InboxItemTypeSchema, InboxItemStatusSchema, InboxItemStateSchema, TaskTemplateKindSchema, TaskTemplateSchema, AgentStatusSchema, AgentSchema, AgentCredStatusLiveTestSchema, AgentLatestModelSchema, AgentBedrockStatusSchema, AgentCredStatusSchema, AgentWithTasksSchema, ChangeSourceSchema, VersionableFieldSchema, ContextVersionSchema, ChannelTypeSchema, ChannelSchema, ChannelMessageSchema, ServiceStatusSchema, ServiceSchema, AgentLogEventTypeSchema, ResumeReasonSchema, AgentLogSchema, SessionLogSchema, SessionCostSourceSchema, SessionCostSchema, EventCategorySchema, EventStatusSchema, EventSourceSchema, EventNameSchema, SwarmEventSchema, ScheduledTaskSchema, SwarmConfigScopeSchema, SwarmConfigSchema, RepoGuidelinesSchema, RepoHooksSchema, SwarmRepoSchema, AgentMemoryScopeSchema, AgentMemorySourceSchema, AgentMemorySchema, ActiveSessionSchema, RetryPolicySchema, ExecutorMetaSchema, ValidationResultSchema, StepValidationConfigSchema, SwarmScriptNodeConfigSchema, WorkflowNodeSchema, WorkflowEdgeSchema, WorkflowDefinitionSchema, WorkflowNodePatchSchema, WorkflowPatchSchema, TriggerConfigSchema, CooldownConfigSchema, InputValueSchema, WorkflowTemplateSchema, WorkflowSnapshotSchema, WorkflowSchema, WorkflowVersionSchema, PageContentTypeSchema, PageAuthModeSchema, PageSnapshotSchema, PageSchema, PageVersionSchema, MetricParamSchema, MetricVariableTypeSchema, MetricFormatSchema, MetricVisualizationSchema, MetricQuerySchema, MetricVariableSchema, MetricVizConfigSchema, MetricWidgetSchema, MetricDefinitionSchema, MetricSnapshotSchema, MetricSchema, MetricVersionSchema, WorkflowRunStatusSchema, WorkflowRunSchema, ScriptRunStatusSchema, TERMINAL_SCRIPT_RUN_STATUSES, ScriptRunKindSchema, ScriptRunSchema, ScriptRunListItemSchema, ScriptRunJournalEntrySchema, WorkflowRunStepStatusSchema, WorkflowRunStepSchema, WaitModeSchema, WaitStateStatusSchema, WaitStateRowSchema, PromptTemplateScopeSchema, PromptTemplateStateSchema, PromptTemplateSchema, PromptTemplateHistorySchema, ScriptScopeSchema, ScriptFsModeSchema, ScriptRecordSchema, ScriptVersionRecordSchema, ScriptApiAuthModeSchema, ScriptApiRecordSchema, SkillTypeSchema, SkillScopeSchema, SkillSchema, AgentSkillSchema, SkillWithInstallInfoSchema, SkillFileSchema, McpServerTransportSchema, McpServerScopeSchema, McpAuthMethodSchema, McpServerSchema, AgentMcpServerSchema, McpServerWithInstallInfoSchema, ContextSnapshotEventTypeSchema, ContextFormulaSchema, ContextSnapshotSchema, BudgetScopeSchema, BudgetSchema, PricingProviderSchema, PricingTokenClassSchema, PricingRowSchema, BudgetRefusalCauseSchema, BudgetRefusalNotificationSchema, BudgetRefusedTriggerSchema, KvValueTypeSchema, KV_NAME_REGEX, KvNamespaceSchema, KvKeySchema, KvEntrySchema;
|
|
473
473
|
var init_types = __esm(() => {
|
|
474
474
|
init_zod();
|
|
475
475
|
ModelTierSchema = _enum(["smol", "regular", "smart", "ultra"]);
|
|
@@ -489,7 +489,7 @@ var init_types = __esm(() => {
|
|
|
489
489
|
},
|
|
490
490
|
"claude-managed": {
|
|
491
491
|
smol: "claude-haiku-4-5",
|
|
492
|
-
regular: "claude-sonnet-
|
|
492
|
+
regular: "claude-sonnet-5",
|
|
493
493
|
smart: "claude-opus-4-8",
|
|
494
494
|
ultra: "claude-fable-5"
|
|
495
495
|
},
|
|
@@ -1555,6 +1555,18 @@ var init_types = __esm(() => {
|
|
|
1555
1555
|
changedAt: string(),
|
|
1556
1556
|
changeReason: string().nullable()
|
|
1557
1557
|
});
|
|
1558
|
+
ScriptApiAuthModeSchema = _enum(["none", "bearer"]);
|
|
1559
|
+
ScriptApiRecordSchema = object({
|
|
1560
|
+
id: string(),
|
|
1561
|
+
scriptId: string(),
|
|
1562
|
+
agentId: string(),
|
|
1563
|
+
authMode: ScriptApiAuthModeSchema,
|
|
1564
|
+
enabled: boolean(),
|
|
1565
|
+
label: string().nullable(),
|
|
1566
|
+
callCount: number(),
|
|
1567
|
+
lastUsedAt: string().nullable(),
|
|
1568
|
+
createdAt: string()
|
|
1569
|
+
});
|
|
1558
1570
|
SkillTypeSchema = _enum(["remote", "personal"]);
|
|
1559
1571
|
SkillScopeSchema = _enum(["global", "swarm", "agent"]);
|
|
1560
1572
|
SkillSchema = object({
|
|
@@ -2497,6 +2509,10 @@ See the \`swarm-scripts\` skill for the full catalog, signatures, and usage patt
|
|
|
2497
2509
|
**For any other repetitive multi-tool pattern:** Call \`script-search\` with a natural-language description. If a script exists, use it.
|
|
2498
2510
|
|
|
2499
2511
|
Script tools are deferred — load via \`ToolSearch("select:script-search,script-run")\` before first use.
|
|
2512
|
+
|
|
2513
|
+
### Exposing scripts as APIs
|
|
2514
|
+
|
|
2515
|
+
A named script can be exposed as a public HTTP endpoint — \`POST /api/x/script/<id>\` — callable from outside the swarm. Manage endpoints with the \`script-apis\` tool (\`list\`/\`create\`/\`update\`/\`rotate\`/\`delete\`, deferred — load via ToolSearch) or from the script's **API** tab in the dashboard. \`list\` masks bearer tokens by default; pass \`includeSecrets: true\` to reveal them.
|
|
2500
2516
|
`,
|
|
2501
2517
|
variables: [],
|
|
2502
2518
|
category: "system"
|
|
@@ -2509,7 +2525,7 @@ Script tools are deferred — load via \`ToolSearch("select:script-search,script
|
|
|
2509
2525
|
|
|
2510
2526
|
You have a full Ubuntu environment with some packages pre-installed: node, bun, python3, curl, wget, git, gh, glab, jq, etc.
|
|
2511
2527
|
|
|
2512
|
-
|
|
2528
|
+
The runtime agent process runs as the non-root \`worker\` user without passwordless sudo. Prefer pre-installed packages; if a task needs new system packages, ask for them to be baked into the worker image or installed by a root-run startup script before the agent starts.
|
|
2513
2529
|
|
|
2514
2530
|
### VCS CLI Tools (GitHub & GitLab)
|
|
2515
2531
|
|
|
@@ -9477,9 +9493,9 @@ function createScriptRun(data) {
|
|
|
9477
9493
|
function recordInlineScriptRun(data) {
|
|
9478
9494
|
const row = getDb().prepare(`INSERT INTO script_runs
|
|
9479
9495
|
(id, agentId, scriptName, source, args, kind, status, output, error,
|
|
9480
|
-
startedAt, finishedAt, requestedByUserId, created_by, updated_by)
|
|
9481
|
-
VALUES (?, ?, ?, ?, ?, 'inline', ?, ?, ?, ?, ?, ?, ?, ?)
|
|
9482
|
-
RETURNING *`).get(data.id, data.agentId, data.scriptName ?? null, data.source, JSON.stringify(data.args ?? null), data.status, data.output === undefined ? null : JSON.stringify(data.output), data.error ?? null, data.startedAt, data.finishedAt, data.requestedByUserId ?? null, data.createdBy ?? null, data.createdBy ?? null);
|
|
9496
|
+
startedAt, finishedAt, requestedByUserId, created_by, updated_by, apiEndpointId)
|
|
9497
|
+
VALUES (?, ?, ?, ?, ?, 'inline', ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
9498
|
+
RETURNING *`).get(data.id, data.agentId, data.scriptName ?? null, data.source, JSON.stringify(data.args ?? null), data.status, data.output === undefined ? null : JSON.stringify(data.output), data.error ?? null, data.startedAt, data.finishedAt, data.requestedByUserId ?? null, data.createdBy ?? null, data.createdBy ?? null, data.apiEndpointId ?? null);
|
|
9483
9499
|
if (!row)
|
|
9484
9500
|
throw new Error("Failed to record inline script run");
|
|
9485
9501
|
return rowToScriptRun(row);
|
|
@@ -9746,4 +9762,4 @@ var init_db = __esm(() => {
|
|
|
9746
9762
|
};
|
|
9747
9763
|
});
|
|
9748
9764
|
|
|
9749
|
-
export { interpolate, deepInterpolate, init_template, registerTemplate, getTemplateDefinition, getAllTemplateDefinitions, init_registry, configureHttpResolver, resolveTemplate, resolveTemplateAsync, init_resolver, initTelemetry, telemetry, init_telemetry, ModelTierSchema, splitLegacyModelAlias, resolveTaskModelSelection, AgentTaskStatusSchema, isTerminalTaskStatus, AgentTaskSourceSchema, ProviderNameSchema, FollowUpConfigSchema, AgentTaskSchema, AttachmentInputSchema, TaskAttachmentSchema, InboxItemTypeSchema, InboxItemStatusSchema, TaskTemplateKindSchema, AgentSchema, AgentLatestModelSchema, AgentCredStatusSchema, ChannelTypeSchema, ChannelSchema, ChannelMessageSchema, ServiceStatusSchema, ServiceSchema, ResumeReasonSchema, AgentLogSchema, EventCategorySchema, EventStatusSchema, EventSourceSchema, EventNameSchema, SwarmConfigScopeSchema, SwarmConfigSchema, RepoGuidelinesSchema, RepoHooksSchema, SwarmRepoSchema, AgentMemoryScopeSchema, AgentMemorySourceSchema, AgentMemorySchema, WorkflowDefinitionSchema, WorkflowNodePatchSchema, WorkflowPatchSchema, TriggerConfigSchema, CooldownConfigSchema, InputValueSchema, PageContentTypeSchema, PageAuthModeSchema, MetricDefinitionSchema, MetricVersionSchema, WorkflowRunStatusSchema, ScriptRunStatusSchema, TERMINAL_SCRIPT_RUN_STATUSES, PromptTemplateScopeSchema, PromptTemplateStateSchema, PromptTemplateSchema, PromptTemplateHistorySchema, ScriptScopeSchema, ScriptFsModeSchema, ContextSnapshotEventTypeSchema, ContextFormulaSchema, BudgetScopeSchema, BudgetSchema, PricingProviderSchema, PricingTokenClassSchema, PricingRowSchema, BudgetRefusalCauseSchema, BudgetRefusalNotificationSchema, KvValueTypeSchema, KvNamespaceSchema, KvKeySchema, KvEntrySchema, init_types, setRequestAuth, getRequestAuth, init_request_auth_context, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, normalizeDateRequired, init_date_utils, init_session_templates, init_templates, init_templates2 as init_templates1, isReservedConfigKey, reservedKeyError, validateConfigValue, init_swarm_config_guard, onTaskStarted, init_task_lifecycle_events, generateDefaultClaudeMd, generateDefaultSoulMd, generateDefaultIdentityMd, generateDefaultToolsMd, init_defaults, isSqliteVecAvailable, initDb, getDb, closeDb, computeContentHash, createContextVersion, getLatestContextVersion, getContextVersion, getContextVersionHistory, agentQueries, updateAgentCredentialState, createAgent, getAgentById, getAllAgents, getLeadAgent, updateAgentStatus, updateAgentMaxTasks, updateAgentProvider, setAgentHarnessProvider, updateAgentCredStatus, listAgentsWithCredStatusByProvider, getAgentHarnessProviders, updateAgentActivity, MAX_EMPTY_POLLS, incrementEmptyPollCount, resetEmptyPollCount, shouldBlockPolling, deleteAgent, getActiveTaskCount, hasCapacity, getRemainingCapacity, updateAgentStatusFromCapacity, taskQueries, createTask, getPendingTaskForAgent, assignUnassignedTaskPending, startTask, getTaskById, markTaskSlackReplySent, setSlackMessageTracking, getChildTasks, hasNonTerminalResumeChild, hasNonTerminalRerouteDecisionChild, updateTaskClaudeSessionId, updateTaskVcs, getTasksByAgentId, getAgentCurrentTask, getTasksByStatus, findTaskByVcs, findTaskByGitHub, getAllTasks, getTasksCount, getTaskStats, getCompletedSlackTasks, getRecentlyFinishedWorkerTasks, markTasksNotified, resetTasksNotified, getInProgressSlackTasks, getInProgressTasksByContextKey, getLatestTaskByContextKey, getAgentWorkingOnThread, getLatestActiveTaskInThread, getMostRecentTaskInThread, findCompletedTaskInThread, findRecentCancelledTaskInThread, completeTask, failTask, cancelTask, supersedeTask, backfillSupersedeTaskResumeTaskId, pauseTask, resumeTask, getPausedTasksForAgent, getOrphanedInProgressTasksForAgent, resetOrphanedInProgressTasksForAgent, getRecentlyCancelledTasksForAgent, deleteTask, updateTaskProgress, insertTaskAttachment, getTaskAttachments, getAgentWithTasks, getAllAgentsWithTasks, logQueries, createLogEntry, getLogsByAgentId, getLogsByTaskId, getLogsByTaskIdChronological, getLogsByEventType, getAllLogs, findRecentSimilarTasks, createTaskExtended, claimTask, releaseTask, acceptTask, rejectTask, moveTaskToBacklog, moveTaskFromBacklog, releaseStaleReviewingTasks, getOfferedTasksForAgent, claimOfferedTask, getUnassignedTasksCount, getUnassignedTaskIds, checkDependencies, getDependentTasks, cascadeFailDependents, updateAgentProfile, updateAgentName, createChannel, getMessageById, getChannelById, getChannelByName, getAllChannels, deleteChannel, postMessage, getChannelMessages, updateReadState, getLastReadAt, getUnreadMessages, getMentionsForAgent, getInboxSummary, claimMentions, releaseMentionProcessing, releaseStaleMentionProcessing, createService, getServiceById, getServiceByAgentAndName, getServicesByAgentId, getAllServices, updateServiceStatus, deleteService, upsertService, deleteServicesByAgentId, sessionLogQueries, createSessionLogs, getSessionLogsByTaskId, getSessionLogsBySession, createSessionCost, getSessionCostsByTaskId, getSessionCostsByAgentId, getAllSessionCosts, getSessionCostsFiltered, getSessionCostSummary, getDashboardCostSummary, createInboxMessage, getInboxMessageById, getUnreadInboxMessages, claimInboxMessages, markInboxMessageRead, markInboxMessageResponded, markInboxMessageDelegated, releaseStaleProcessingInbox, getConcurrentContext, getScheduledTasks, getScheduledTaskById, getScheduledTaskByName, createScheduledTask, updateScheduledTask, deleteScheduledTask, getDueScheduledTasks, autoEncryptLegacyPlaintextSecrets, maskSecrets, getSwarmConfigs, getInjectableGlobalConfigs, getSwarmConfigById, getSwarmConfigLookupById, upsertSwarmConfig, deleteSwarmConfig, getResolvedConfig, getSwarmRepos, getSwarmRepoById, getSwarmRepoByName, getSwarmRepoByUrl, createSwarmRepo, updateSwarmRepo, deleteSwarmRepo, getAgentMailInboxMapping, getAgentMailInboxMappingsByAgent, getAllAgentMailInboxMappings, createAgentMailInboxMapping, deleteAgentMailInboxMapping, findTaskByAgentMailThread, insertActiveSession, deleteActiveSession, deleteActiveSessionById, getActiveSessions, heartbeatActiveSession, cleanupStaleSessions, cleanupAgentSessions, updateActiveSessionProviderSessionId, getActiveSessionForTask, reassociateSessionLogs, getStalledInProgressTasks, getStalePinnedResumes, failPendingResumeIfUnclaimed, getIdleWorkersWithCapacity, getUnassignedPoolTasks, getRecentFailedTasks, getRecentCompletedCount, getRecentFailedCount, createWorkflow, getWorkflow, listWorkflows, updateWorkflow, deleteWorkflow, getWorkflowsByScheduleId, createWorkflowRun, getWorkflowRun, updateWorkflowRun, listWorkflowRuns, createWorkflowRunStep, getWorkflowRunStep, updateWorkflowRunStep, getWorkflowRunStepsByRunId, getStuckWorkflowRuns, getLastSuccessfulRun, getLastRunStart, getRetryableSteps, getCompletedStepNodeIds, getTaskByWorkflowRunStepId, getStepByIdempotencyKey, getStepCountForNode, getLatestStepForNode, createWorkflowVersion, getWorkflowVersions, getWorkflowVersion, createPage, getPage, getPageBySlug, listPagesByAgent, listAllPages, countAllPages, countPagesByAgent, updatePage, deletePage, incrementPageViewCount, createPageVersion, getPageVersions, getPageVersion, createMetric, getMetric, getMetricBySlug, listMetricsByAgent, listAllMetrics, countAllMetrics, countMetricsByAgent, updateMetric, deleteMetric, createMetricVersion, getMetricVersions, getMetricVersion, getPromptTemplates, getPromptTemplateById, upsertPromptTemplate, deletePromptTemplate, resetPromptTemplateToDefault, getPromptTemplateHistory, resolvePromptTemplate, checkoutPromptTemplate, getAllChannelActivityCursors, getChannelActivityCursor, upsertChannelActivityCursor, createApprovalRequest, getApprovalRequestById, resolveApprovalRequest, updateApprovalRequestNotifications, listApprovalRequests, getStuckApprovalRuns, getApprovalRequestByStepId, getExpiredPendingApprovals, createWaitState, getWaitStateById, getWaitStateByStepId, getDueWaitStates, getPendingEventWaitNames, getPendingWaitsByEvent, resolveWaitState, getStuckWaitRuns, SKILL_FILE_LIMITS, normalizeSkillFilePath, createSkill, updateSkill, listSkillFileManifest, getSkillFiles, getSkillFile, upsertSkillFile, upsertSkillFiles, deleteSkillFile, deleteSkill, getSkillById, getSkillByName, listSkills, searchSkills, installSkill, getSystemDefaultSkills, installSystemDefaultSkillsForAgent, uninstallSkill, getAgentSkills, toggleAgentSkill, createMcpServer, updateMcpServer, deleteMcpServer, getMcpServerById, getMcpServerByName, listMcpServers, installMcpServer, uninstallMcpServer, getAgentMcpServers, createContextSnapshot, getContextSnapshotsByTaskId, getContextSnapshotsBySessionId, getContextSummaryByTaskId, getAvailableKeyIndices, recordKeyUsage, markKeyRateLimited, recordKeyRateLimitWindows, setApiKeyName, clearKeyRateLimit, getKeyStatuses, getKeyCostSummary, getUserById, getAllUsers, createUser, updateUser, deleteUser, listInboxState, upsertInboxState, listTaskTemplates, getRootTaskChain, listRecentSessions, countSessions, getBudget, getBudgets, upsertBudget, deleteBudget, getAllPricingRows, getPricingRows, getActivePricingRow, insertPricingRow, deletePricingRow, getDailySpendForAgent, getDailySpendGlobal, getDailySpendForUser, recordBudgetRefusalNotification, getBudgetRefusalNotification, getRecentBudgetRefusalNotifications, hasBudgetRefusalNotificationToday, setBudgetRefusalFollowUpTaskId, getLiveAgentCounts, getInstanceActivity, getSwarmMetrics, hasFirstCompletedTask, getKv, upsertKv, deleteKv, KvTypeCollisionError, incrKv, listKv, countKv, createScriptRun, recordInlineScriptRun, getScriptRun, getScriptRunByIdempotencyKey, listScriptRuns, countScriptRuns, countActiveScriptRuns, updateScriptRun, getRunningScriptRuns, getScriptRunJournalStep, upsertScriptRunJournalStep, listScriptRunJournalSteps, countScriptRunJournalSteps, countScriptRunJournalAgentTaskSteps, exports_db, init_db };
|
|
9765
|
+
export { interpolate, deepInterpolate, init_template, registerTemplate, getTemplateDefinition, getAllTemplateDefinitions, init_registry, configureHttpResolver, resolveTemplate, resolveTemplateAsync, init_resolver, initTelemetry, telemetry, init_telemetry, ModelTierSchema, splitLegacyModelAlias, resolveTaskModelSelection, AgentTaskStatusSchema, isTerminalTaskStatus, AgentTaskSourceSchema, ProviderNameSchema, FollowUpConfigSchema, AgentTaskSchema, AttachmentInputSchema, TaskAttachmentSchema, InboxItemTypeSchema, InboxItemStatusSchema, TaskTemplateKindSchema, AgentSchema, AgentLatestModelSchema, AgentCredStatusSchema, ChannelTypeSchema, ChannelSchema, ChannelMessageSchema, ServiceStatusSchema, ServiceSchema, ResumeReasonSchema, AgentLogSchema, EventCategorySchema, EventStatusSchema, EventSourceSchema, EventNameSchema, SwarmConfigScopeSchema, SwarmConfigSchema, RepoGuidelinesSchema, RepoHooksSchema, SwarmRepoSchema, AgentMemoryScopeSchema, AgentMemorySourceSchema, AgentMemorySchema, WorkflowDefinitionSchema, WorkflowNodePatchSchema, WorkflowPatchSchema, TriggerConfigSchema, CooldownConfigSchema, InputValueSchema, PageContentTypeSchema, PageAuthModeSchema, MetricDefinitionSchema, MetricVersionSchema, WorkflowRunStatusSchema, ScriptRunStatusSchema, TERMINAL_SCRIPT_RUN_STATUSES, PromptTemplateScopeSchema, PromptTemplateStateSchema, PromptTemplateSchema, PromptTemplateHistorySchema, ScriptScopeSchema, ScriptFsModeSchema, ScriptApiAuthModeSchema, ContextSnapshotEventTypeSchema, ContextFormulaSchema, BudgetScopeSchema, BudgetSchema, PricingProviderSchema, PricingTokenClassSchema, PricingRowSchema, BudgetRefusalCauseSchema, BudgetRefusalNotificationSchema, KvValueTypeSchema, KvNamespaceSchema, KvKeySchema, KvEntrySchema, init_types, setRequestAuth, getRequestAuth, init_request_auth_context, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, normalizeDateRequired, init_date_utils, init_session_templates, init_templates, init_templates2 as init_templates1, isReservedConfigKey, reservedKeyError, validateConfigValue, init_swarm_config_guard, onTaskStarted, init_task_lifecycle_events, generateDefaultClaudeMd, generateDefaultSoulMd, generateDefaultIdentityMd, generateDefaultToolsMd, init_defaults, isSqliteVecAvailable, initDb, getDb, closeDb, computeContentHash, createContextVersion, getLatestContextVersion, getContextVersion, getContextVersionHistory, agentQueries, updateAgentCredentialState, createAgent, getAgentById, getAllAgents, getLeadAgent, updateAgentStatus, updateAgentMaxTasks, updateAgentProvider, setAgentHarnessProvider, updateAgentCredStatus, listAgentsWithCredStatusByProvider, getAgentHarnessProviders, updateAgentActivity, MAX_EMPTY_POLLS, incrementEmptyPollCount, resetEmptyPollCount, shouldBlockPolling, deleteAgent, getActiveTaskCount, hasCapacity, getRemainingCapacity, updateAgentStatusFromCapacity, taskQueries, createTask, getPendingTaskForAgent, assignUnassignedTaskPending, startTask, getTaskById, markTaskSlackReplySent, setSlackMessageTracking, getChildTasks, hasNonTerminalResumeChild, hasNonTerminalRerouteDecisionChild, updateTaskClaudeSessionId, updateTaskVcs, getTasksByAgentId, getAgentCurrentTask, getTasksByStatus, findTaskByVcs, findTaskByGitHub, getAllTasks, getTasksCount, getTaskStats, getCompletedSlackTasks, getRecentlyFinishedWorkerTasks, markTasksNotified, resetTasksNotified, getInProgressSlackTasks, getInProgressTasksByContextKey, getLatestTaskByContextKey, getAgentWorkingOnThread, getLatestActiveTaskInThread, getMostRecentTaskInThread, findCompletedTaskInThread, findRecentCancelledTaskInThread, completeTask, failTask, cancelTask, supersedeTask, backfillSupersedeTaskResumeTaskId, pauseTask, resumeTask, getPausedTasksForAgent, getOrphanedInProgressTasksForAgent, resetOrphanedInProgressTasksForAgent, getRecentlyCancelledTasksForAgent, deleteTask, updateTaskProgress, insertTaskAttachment, getTaskAttachments, getAgentWithTasks, getAllAgentsWithTasks, logQueries, createLogEntry, getLogsByAgentId, getLogsByTaskId, getLogsByTaskIdChronological, getLogsByEventType, getAllLogs, findRecentSimilarTasks, createTaskExtended, claimTask, releaseTask, acceptTask, rejectTask, moveTaskToBacklog, moveTaskFromBacklog, releaseStaleReviewingTasks, getOfferedTasksForAgent, claimOfferedTask, getUnassignedTasksCount, getUnassignedTaskIds, checkDependencies, getDependentTasks, cascadeFailDependents, updateAgentProfile, updateAgentName, createChannel, getMessageById, getChannelById, getChannelByName, getAllChannels, deleteChannel, postMessage, getChannelMessages, updateReadState, getLastReadAt, getUnreadMessages, getMentionsForAgent, getInboxSummary, claimMentions, releaseMentionProcessing, releaseStaleMentionProcessing, createService, getServiceById, getServiceByAgentAndName, getServicesByAgentId, getAllServices, updateServiceStatus, deleteService, upsertService, deleteServicesByAgentId, sessionLogQueries, createSessionLogs, getSessionLogsByTaskId, getSessionLogsBySession, createSessionCost, getSessionCostsByTaskId, getSessionCostsByAgentId, getAllSessionCosts, getSessionCostsFiltered, getSessionCostSummary, getDashboardCostSummary, createInboxMessage, getInboxMessageById, getUnreadInboxMessages, claimInboxMessages, markInboxMessageRead, markInboxMessageResponded, markInboxMessageDelegated, releaseStaleProcessingInbox, getConcurrentContext, getScheduledTasks, getScheduledTaskById, getScheduledTaskByName, createScheduledTask, updateScheduledTask, deleteScheduledTask, getDueScheduledTasks, autoEncryptLegacyPlaintextSecrets, maskSecrets, getSwarmConfigs, getInjectableGlobalConfigs, getSwarmConfigById, getSwarmConfigLookupById, upsertSwarmConfig, deleteSwarmConfig, getResolvedConfig, getSwarmRepos, getSwarmRepoById, getSwarmRepoByName, getSwarmRepoByUrl, createSwarmRepo, updateSwarmRepo, deleteSwarmRepo, getAgentMailInboxMapping, getAgentMailInboxMappingsByAgent, getAllAgentMailInboxMappings, createAgentMailInboxMapping, deleteAgentMailInboxMapping, findTaskByAgentMailThread, insertActiveSession, deleteActiveSession, deleteActiveSessionById, getActiveSessions, heartbeatActiveSession, cleanupStaleSessions, cleanupAgentSessions, updateActiveSessionProviderSessionId, getActiveSessionForTask, reassociateSessionLogs, getStalledInProgressTasks, getStalePinnedResumes, failPendingResumeIfUnclaimed, getIdleWorkersWithCapacity, getUnassignedPoolTasks, getRecentFailedTasks, getRecentCompletedCount, getRecentFailedCount, createWorkflow, getWorkflow, listWorkflows, updateWorkflow, deleteWorkflow, getWorkflowsByScheduleId, createWorkflowRun, getWorkflowRun, updateWorkflowRun, listWorkflowRuns, createWorkflowRunStep, getWorkflowRunStep, updateWorkflowRunStep, getWorkflowRunStepsByRunId, getStuckWorkflowRuns, getLastSuccessfulRun, getLastRunStart, getRetryableSteps, getCompletedStepNodeIds, getTaskByWorkflowRunStepId, getStepByIdempotencyKey, getStepCountForNode, getLatestStepForNode, createWorkflowVersion, getWorkflowVersions, getWorkflowVersion, createPage, getPage, getPageBySlug, listPagesByAgent, listAllPages, countAllPages, countPagesByAgent, updatePage, deletePage, incrementPageViewCount, createPageVersion, getPageVersions, getPageVersion, createMetric, getMetric, getMetricBySlug, listMetricsByAgent, listAllMetrics, countAllMetrics, countMetricsByAgent, updateMetric, deleteMetric, createMetricVersion, getMetricVersions, getMetricVersion, getPromptTemplates, getPromptTemplateById, upsertPromptTemplate, deletePromptTemplate, resetPromptTemplateToDefault, getPromptTemplateHistory, resolvePromptTemplate, checkoutPromptTemplate, getAllChannelActivityCursors, getChannelActivityCursor, upsertChannelActivityCursor, createApprovalRequest, getApprovalRequestById, resolveApprovalRequest, updateApprovalRequestNotifications, listApprovalRequests, getStuckApprovalRuns, getApprovalRequestByStepId, getExpiredPendingApprovals, createWaitState, getWaitStateById, getWaitStateByStepId, getDueWaitStates, getPendingEventWaitNames, getPendingWaitsByEvent, resolveWaitState, getStuckWaitRuns, SKILL_FILE_LIMITS, normalizeSkillFilePath, createSkill, updateSkill, listSkillFileManifest, getSkillFiles, getSkillFile, upsertSkillFile, upsertSkillFiles, deleteSkillFile, deleteSkill, getSkillById, getSkillByName, listSkills, searchSkills, installSkill, getSystemDefaultSkills, installSystemDefaultSkillsForAgent, uninstallSkill, getAgentSkills, toggleAgentSkill, createMcpServer, updateMcpServer, deleteMcpServer, getMcpServerById, getMcpServerByName, listMcpServers, installMcpServer, uninstallMcpServer, getAgentMcpServers, createContextSnapshot, getContextSnapshotsByTaskId, getContextSnapshotsBySessionId, getContextSummaryByTaskId, getAvailableKeyIndices, recordKeyUsage, markKeyRateLimited, recordKeyRateLimitWindows, setApiKeyName, clearKeyRateLimit, getKeyStatuses, getKeyCostSummary, getUserById, getAllUsers, createUser, updateUser, deleteUser, listInboxState, upsertInboxState, listTaskTemplates, getRootTaskChain, listRecentSessions, countSessions, getBudget, getBudgets, upsertBudget, deleteBudget, getAllPricingRows, getPricingRows, getActivePricingRow, insertPricingRow, deletePricingRow, getDailySpendForAgent, getDailySpendGlobal, getDailySpendForUser, recordBudgetRefusalNotification, getBudgetRefusalNotification, getRecentBudgetRefusalNotifications, hasBudgetRefusalNotificationToday, setBudgetRefusalFollowUpTaskId, getLiveAgentCounts, getInstanceActivity, getSwarmMetrics, hasFirstCompletedTask, getKv, upsertKv, deleteKv, KvTypeCollisionError, incrKv, listKv, countKv, createScriptRun, recordInlineScriptRun, getScriptRun, getScriptRunByIdempotencyKey, listScriptRuns, countScriptRuns, countActiveScriptRuns, updateScriptRun, getRunningScriptRuns, getScriptRunJournalStep, upsertScriptRunJournalStep, listScriptRunJournalSteps, countScriptRunJournalSteps, countScriptRunJournalAgentTaskSteps, exports_db, init_db };
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
embedScript
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-4fwzc50f.js";
|
|
4
4
|
import {
|
|
5
5
|
computeContentHash,
|
|
6
|
+
decryptSecret,
|
|
7
|
+
encryptSecret,
|
|
6
8
|
getDb,
|
|
9
|
+
getEncryptionKey,
|
|
7
10
|
getSwarmConfigs,
|
|
11
|
+
init_crypto,
|
|
8
12
|
init_db
|
|
9
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-6xn2xv4r.js";
|
|
10
14
|
import {
|
|
11
15
|
init_zod
|
|
12
16
|
} from "./cli-q21d49ac.js";
|
|
@@ -18,6 +22,10 @@ import {
|
|
|
18
22
|
string,
|
|
19
23
|
union
|
|
20
24
|
} from "./cli-anrj584m.js";
|
|
25
|
+
import {
|
|
26
|
+
init_secret_scrubber,
|
|
27
|
+
registerVolatileSecret
|
|
28
|
+
} from "./cli-3pp1362w.js";
|
|
21
29
|
import {
|
|
22
30
|
__commonJS,
|
|
23
31
|
__require,
|
|
@@ -169282,6 +169290,37 @@ ${members.join(`
|
|
|
169282
169290
|
}
|
|
169283
169291
|
|
|
169284
169292
|
// src/be/scripts/db.ts
|
|
169293
|
+
init_secret_scrubber();
|
|
169294
|
+
|
|
169295
|
+
// src/utils/short-id.ts
|
|
169296
|
+
import { randomBytes } from "node:crypto";
|
|
169297
|
+
var LETTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
169298
|
+
var BASE62 = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
169299
|
+
function generateShortId(len = 12) {
|
|
169300
|
+
let out = "";
|
|
169301
|
+
while (out.length < len) {
|
|
169302
|
+
for (const byte of randomBytes((len - out.length) * 2)) {
|
|
169303
|
+
if (byte < 208) {
|
|
169304
|
+
out += LETTERS[byte % 52];
|
|
169305
|
+
if (out.length === len)
|
|
169306
|
+
break;
|
|
169307
|
+
}
|
|
169308
|
+
}
|
|
169309
|
+
}
|
|
169310
|
+
return out;
|
|
169311
|
+
}
|
|
169312
|
+
function base62(bytes) {
|
|
169313
|
+
let out = "";
|
|
169314
|
+
for (const byte of bytes)
|
|
169315
|
+
out += BASE62[byte % 62];
|
|
169316
|
+
return out;
|
|
169317
|
+
}
|
|
169318
|
+
function generateBearerToken() {
|
|
169319
|
+
return `xsk_${base62(randomBytes(24))}`;
|
|
169320
|
+
}
|
|
169321
|
+
|
|
169322
|
+
// src/be/scripts/db.ts
|
|
169323
|
+
init_crypto();
|
|
169285
169324
|
init_db();
|
|
169286
169325
|
function normalizeScopeId(scope, scopeId) {
|
|
169287
169326
|
if (scope === "global")
|
|
@@ -169478,6 +169517,110 @@ function deleteScript(args) {
|
|
|
169478
169517
|
const result = getDb().run("DELETE FROM scripts WHERE id = ?", [existing.id]);
|
|
169479
169518
|
return result.changes > 0;
|
|
169480
169519
|
}
|
|
169520
|
+
var SCRIPT_API_ID_LEN = 12;
|
|
169521
|
+
function rowToScriptApi(row) {
|
|
169522
|
+
return {
|
|
169523
|
+
id: row.id,
|
|
169524
|
+
scriptId: row.scriptId,
|
|
169525
|
+
agentId: row.agentId,
|
|
169526
|
+
authMode: row.authMode,
|
|
169527
|
+
enabled: row.enabled === 1,
|
|
169528
|
+
label: row.label ?? null,
|
|
169529
|
+
callCount: row.callCount,
|
|
169530
|
+
lastUsedAt: row.lastUsedAt ?? null,
|
|
169531
|
+
createdAt: row.createdAt
|
|
169532
|
+
};
|
|
169533
|
+
}
|
|
169534
|
+
function isUniqueConstraintError(err) {
|
|
169535
|
+
return err instanceof Error && /UNIQUE constraint failed/i.test(err.message);
|
|
169536
|
+
}
|
|
169537
|
+
function createScriptApi(args) {
|
|
169538
|
+
const now = new Date().toISOString();
|
|
169539
|
+
const token = args.authMode === "bearer" ? generateBearerToken() : null;
|
|
169540
|
+
const encrypted = token ? encryptSecret(token, getEncryptionKey()) : null;
|
|
169541
|
+
const createdBy = args.createdBy ?? null;
|
|
169542
|
+
for (let attempt = 0;attempt < 5; attempt++) {
|
|
169543
|
+
const id = generateShortId(SCRIPT_API_ID_LEN);
|
|
169544
|
+
try {
|
|
169545
|
+
const row = getDb().prepare(`INSERT INTO script_apis
|
|
169546
|
+
(id, scriptId, agentId, authMode, bearerTokenEncrypted, enabled, label,
|
|
169547
|
+
callCount, lastUsedAt, createdAt, created_by, updated_by)
|
|
169548
|
+
VALUES (?, ?, ?, ?, ?, 1, ?, 0, NULL, ?, ?, ?)
|
|
169549
|
+
RETURNING *`).get(id, args.scriptId, args.agentId, args.authMode, encrypted, args.label ?? null, now, createdBy, createdBy);
|
|
169550
|
+
if (!row)
|
|
169551
|
+
throw new Error("Failed to create script API endpoint");
|
|
169552
|
+
if (token)
|
|
169553
|
+
registerVolatileSecret(token, `script-api:${id}`);
|
|
169554
|
+
return { ...rowToScriptApi(row), token };
|
|
169555
|
+
} catch (err) {
|
|
169556
|
+
if (isUniqueConstraintError(err) && attempt < 4)
|
|
169557
|
+
continue;
|
|
169558
|
+
throw err;
|
|
169559
|
+
}
|
|
169560
|
+
}
|
|
169561
|
+
throw new Error("Failed to allocate a unique script API endpoint id");
|
|
169562
|
+
}
|
|
169563
|
+
function listScriptApisForScript(scriptId) {
|
|
169564
|
+
return getDb().prepare("SELECT * FROM script_apis WHERE scriptId = ? ORDER BY createdAt DESC").all(scriptId).map(rowToScriptApi);
|
|
169565
|
+
}
|
|
169566
|
+
function getScriptApiById(id) {
|
|
169567
|
+
const row = getDb().prepare("SELECT * FROM script_apis WHERE id = ?").get(id);
|
|
169568
|
+
if (!row)
|
|
169569
|
+
return null;
|
|
169570
|
+
return { ...rowToScriptApi(row), bearerTokenEncrypted: row.bearerTokenEncrypted ?? null };
|
|
169571
|
+
}
|
|
169572
|
+
function getScriptApiSecret(id) {
|
|
169573
|
+
const row = getDb().prepare("SELECT bearerTokenEncrypted FROM script_apis WHERE id = ?").get(id);
|
|
169574
|
+
if (!row?.bearerTokenEncrypted)
|
|
169575
|
+
return null;
|
|
169576
|
+
const token = decryptSecret(row.bearerTokenEncrypted, getEncryptionKey());
|
|
169577
|
+
registerVolatileSecret(token, `script-api:${id}`);
|
|
169578
|
+
return token;
|
|
169579
|
+
}
|
|
169580
|
+
function updateScriptApi(id, args) {
|
|
169581
|
+
const sets = [];
|
|
169582
|
+
const vals = [];
|
|
169583
|
+
if (args.enabled !== undefined) {
|
|
169584
|
+
sets.push("enabled = ?");
|
|
169585
|
+
vals.push(args.enabled ? 1 : 0);
|
|
169586
|
+
}
|
|
169587
|
+
if (args.label !== undefined) {
|
|
169588
|
+
sets.push("label = ?");
|
|
169589
|
+
vals.push(args.label);
|
|
169590
|
+
}
|
|
169591
|
+
if (args.updatedBy !== undefined) {
|
|
169592
|
+
sets.push("updated_by = ?");
|
|
169593
|
+
vals.push(args.updatedBy);
|
|
169594
|
+
}
|
|
169595
|
+
if (sets.length === 0) {
|
|
169596
|
+
const row2 = getDb().prepare("SELECT * FROM script_apis WHERE id = ?").get(id);
|
|
169597
|
+
return row2 ? rowToScriptApi(row2) : null;
|
|
169598
|
+
}
|
|
169599
|
+
vals.push(id);
|
|
169600
|
+
const row = getDb().prepare(`UPDATE script_apis SET ${sets.join(", ")} WHERE id = ? RETURNING *`).get(...vals);
|
|
169601
|
+
return row ? rowToScriptApi(row) : null;
|
|
169602
|
+
}
|
|
169603
|
+
function rotateScriptApiSecret(id, updatedBy) {
|
|
169604
|
+
const existing = getScriptApiById(id);
|
|
169605
|
+
if (!existing || existing.authMode !== "bearer")
|
|
169606
|
+
return null;
|
|
169607
|
+
const token = generateBearerToken();
|
|
169608
|
+
const encrypted = encryptSecret(token, getEncryptionKey());
|
|
169609
|
+
const row = getDb().prepare("UPDATE script_apis SET bearerTokenEncrypted = ?, updated_by = ? WHERE id = ? RETURNING *").get(encrypted, updatedBy ?? null, id);
|
|
169610
|
+
if (!row)
|
|
169611
|
+
return null;
|
|
169612
|
+
registerVolatileSecret(token, `script-api:${id}`);
|
|
169613
|
+
return { ...rowToScriptApi(row), token };
|
|
169614
|
+
}
|
|
169615
|
+
function deleteScriptApi(id) {
|
|
169616
|
+
return getDb().run("DELETE FROM script_apis WHERE id = ?", [id]).changes > 0;
|
|
169617
|
+
}
|
|
169618
|
+
function recordScriptApiUsage(id) {
|
|
169619
|
+
getDb().run("UPDATE script_apis SET callCount = callCount + 1, lastUsedAt = ? WHERE id = ?", [
|
|
169620
|
+
new Date().toISOString(),
|
|
169621
|
+
id
|
|
169622
|
+
]);
|
|
169623
|
+
}
|
|
169481
169624
|
|
|
169482
169625
|
// src/scripts-runtime/import-allowlist.ts
|
|
169483
169626
|
var import_typescript = __toESM(require_typescript(), 1);
|
|
@@ -169544,4 +169687,4 @@ function validateScriptImports(source) {
|
|
|
169544
169687
|
return { ok: false, diagnostic: reason, imports: rejected };
|
|
169545
169688
|
}
|
|
169546
169689
|
|
|
169547
|
-
export { CREDENTIAL_BINDINGS_CONFIG_KEY, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, DEFAULT_CREDENTIAL_BINDINGS, SwarmConfigCredentialBindingStore, listRelationalCredentialBindings, upsertCredentialBinding, disableCredentialBinding, importLegacyCredentialBindings, listScriptConnections, upsertScriptConnection, setScriptConnectionEnabled, getScriptApiConnectionDescriptors, getScriptApiTypes, upsertScriptByName, getScript, getScriptById, getScriptVersion, listScripts, listScriptVersions, deleteScript, require_typescript, validateScriptImports };
|
|
169690
|
+
export { CREDENTIAL_BINDINGS_CONFIG_KEY, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, DEFAULT_CREDENTIAL_BINDINGS, SwarmConfigCredentialBindingStore, listRelationalCredentialBindings, upsertCredentialBinding, disableCredentialBinding, importLegacyCredentialBindings, listScriptConnections, upsertScriptConnection, setScriptConnectionEnabled, getScriptApiConnectionDescriptors, getScriptApiTypes, upsertScriptByName, getScript, getScriptById, getScriptVersion, listScripts, listScriptVersions, deleteScript, createScriptApi, listScriptApisForScript, getScriptApiById, getScriptApiSecret, updateScriptApi, rotateScriptApiSecret, deleteScriptApi, recordScriptApiUsage, require_typescript, validateScriptImports };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
summarizeSession
|
|
3
|
-
} from "./cli-
|
|
3
|
+
} from "./cli-50nss8e8.js";
|
|
4
4
|
import {
|
|
5
5
|
extractChatgptUserId,
|
|
6
6
|
getValidCodexOAuth
|
|
7
7
|
} from "./cli-4wmnp8q3.js";
|
|
8
8
|
import {
|
|
9
9
|
createSwarmEventHandler
|
|
10
|
-
} from "./cli-
|
|
10
|
+
} from "./cli-07er7wrs.js";
|
|
11
11
|
import {
|
|
12
12
|
resolveCodexPrompt
|
|
13
13
|
} from "./cli-r94z9p1z.js";
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
CONTEXT_FORMULA,
|
|
31
31
|
clampContextPercent,
|
|
32
32
|
computeContextUsedUnified
|
|
33
|
-
} from "./cli-
|
|
33
|
+
} from "./cli-tghre7g6.js";
|
|
34
34
|
import {
|
|
35
35
|
getApiKey
|
|
36
36
|
} from "./cli-f14fvzag.js";
|
|
@@ -1,8 +1,109 @@
|
|
|
1
|
+
// node_modules/@earendil-works/pi-ai/dist/utils/estimate.js
|
|
2
|
+
var CHARS_PER_TOKEN = 4;
|
|
3
|
+
var ESTIMATED_IMAGE_CHARS = 4800;
|
|
4
|
+
function calculateContextTokens(usage) {
|
|
5
|
+
return usage.totalTokens || usage.input + usage.output + usage.cacheRead + usage.cacheWrite;
|
|
6
|
+
}
|
|
7
|
+
function safeJsonStringify(value) {
|
|
8
|
+
try {
|
|
9
|
+
return JSON.stringify(value) ?? "undefined";
|
|
10
|
+
} catch {
|
|
11
|
+
return "[unserializable]";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function estimateTextAndImageContentChars(content) {
|
|
15
|
+
if (typeof content === "string")
|
|
16
|
+
return content.length;
|
|
17
|
+
let chars = 0;
|
|
18
|
+
for (const block of content)
|
|
19
|
+
chars += block.type === "text" ? block.text.length : ESTIMATED_IMAGE_CHARS;
|
|
20
|
+
return chars;
|
|
21
|
+
}
|
|
22
|
+
function estimateTextTokens(text) {
|
|
23
|
+
return Math.ceil(text.length / CHARS_PER_TOKEN);
|
|
24
|
+
}
|
|
25
|
+
function estimateTextAndImageContentTokens(content) {
|
|
26
|
+
return Math.ceil(estimateTextAndImageContentChars(content) / CHARS_PER_TOKEN);
|
|
27
|
+
}
|
|
28
|
+
function estimateMessageTokens(message) {
|
|
29
|
+
let chars = 0;
|
|
30
|
+
if (message.role === "user")
|
|
31
|
+
return estimateTextAndImageContentTokens(message.content);
|
|
32
|
+
if (message.role === "toolResult")
|
|
33
|
+
return estimateTextAndImageContentTokens(message.content);
|
|
34
|
+
for (const block of message.content) {
|
|
35
|
+
if (block.type === "text") {
|
|
36
|
+
chars += block.text.length;
|
|
37
|
+
} else if (block.type === "thinking") {
|
|
38
|
+
chars += block.thinking.length;
|
|
39
|
+
} else {
|
|
40
|
+
chars += block.name.length + safeJsonStringify(block.arguments).length;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return Math.ceil(chars / CHARS_PER_TOKEN);
|
|
44
|
+
}
|
|
45
|
+
function getLastAssistantUsageInfo(messages) {
|
|
46
|
+
for (let i = messages.length - 1;i >= 0; i--) {
|
|
47
|
+
const message = messages[i];
|
|
48
|
+
if (message.role !== "assistant")
|
|
49
|
+
continue;
|
|
50
|
+
const assistant = message;
|
|
51
|
+
if (assistant.stopReason === "aborted" || assistant.stopReason === "error")
|
|
52
|
+
continue;
|
|
53
|
+
if (calculateContextTokens(assistant.usage) > 0)
|
|
54
|
+
return { usage: assistant.usage, index: i };
|
|
55
|
+
}
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
function estimateMessages(messages) {
|
|
59
|
+
const usageInfo = getLastAssistantUsageInfo(messages);
|
|
60
|
+
if (usageInfo) {
|
|
61
|
+
const usageTokens = calculateContextTokens(usageInfo.usage);
|
|
62
|
+
let trailingTokens = 0;
|
|
63
|
+
for (let i = usageInfo.index + 1;i < messages.length; i++) {
|
|
64
|
+
trailingTokens += estimateMessageTokens(messages[i]);
|
|
65
|
+
}
|
|
66
|
+
return { tokens: usageTokens + trailingTokens, usageTokens, trailingTokens, lastUsageIndex: usageInfo.index };
|
|
67
|
+
}
|
|
68
|
+
let tokens = 0;
|
|
69
|
+
for (const message of messages)
|
|
70
|
+
tokens += estimateMessageTokens(message);
|
|
71
|
+
return { tokens, usageTokens: 0, trailingTokens: tokens, lastUsageIndex: null };
|
|
72
|
+
}
|
|
73
|
+
function isMessageArray(value) {
|
|
74
|
+
return Array.isArray(value);
|
|
75
|
+
}
|
|
76
|
+
function estimateContextTokens(context) {
|
|
77
|
+
if (isMessageArray(context))
|
|
78
|
+
return estimateMessages(context);
|
|
79
|
+
const estimate = estimateMessages(context.messages);
|
|
80
|
+
if (estimate.lastUsageIndex !== null)
|
|
81
|
+
return estimate;
|
|
82
|
+
let prefixTokens = context.systemPrompt ? estimateTextTokens(context.systemPrompt) : 0;
|
|
83
|
+
if (context.tools && context.tools.length > 0) {
|
|
84
|
+
prefixTokens += estimateTextTokens(safeJsonStringify(context.tools));
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
tokens: estimate.tokens + prefixTokens,
|
|
88
|
+
usageTokens: estimate.usageTokens,
|
|
89
|
+
trailingTokens: estimate.trailingTokens + prefixTokens,
|
|
90
|
+
lastUsageIndex: estimate.lastUsageIndex
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
1
94
|
// node_modules/@earendil-works/pi-ai/dist/api/simple-options.js
|
|
2
|
-
|
|
95
|
+
var CONTEXT_SAFETY_TOKENS = 4096;
|
|
96
|
+
var MIN_MAX_TOKENS = 1;
|
|
97
|
+
function clampMaxTokensToContext(model, context, maxTokens) {
|
|
98
|
+
if (model.contextWindow <= 0)
|
|
99
|
+
return Math.max(MIN_MAX_TOKENS, maxTokens);
|
|
100
|
+
const available = model.contextWindow - estimateContextTokens(context).tokens - CONTEXT_SAFETY_TOKENS;
|
|
101
|
+
return Math.min(maxTokens, Math.max(MIN_MAX_TOKENS, available));
|
|
102
|
+
}
|
|
103
|
+
function buildBaseOptions(model, context, options, apiKey) {
|
|
3
104
|
return {
|
|
4
105
|
temperature: options?.temperature,
|
|
5
|
-
maxTokens: options?.maxTokens,
|
|
106
|
+
maxTokens: clampMaxTokensToContext(model, context, options?.maxTokens ?? model.maxTokens),
|
|
6
107
|
signal: options?.signal,
|
|
7
108
|
apiKey: apiKey || options?.apiKey,
|
|
8
109
|
transport: options?.transport,
|
|
@@ -194,4 +295,4 @@ function transformMessages(messages, model, normalizeToolCallId) {
|
|
|
194
295
|
return result;
|
|
195
296
|
}
|
|
196
297
|
|
|
197
|
-
export { buildBaseOptions, clampReasoning, adjustMaxTokensForThinking, transformMessages };
|
|
298
|
+
export { clampMaxTokensToContext, buildBaseOptions, clampReasoning, adjustMaxTokensForThinking, transformMessages };
|
|
@@ -2,19 +2,19 @@ import {
|
|
|
2
2
|
authJsonToCredentialSelection,
|
|
3
3
|
checkCodexCredentials,
|
|
4
4
|
credentialsToAuthJson
|
|
5
|
-
} from "./cli-
|
|
5
|
+
} from "./cli-anrn8brw.js";
|
|
6
6
|
import {
|
|
7
7
|
loadAllCodexOAuthSlots
|
|
8
8
|
} from "./cli-4wmnp8q3.js";
|
|
9
9
|
import {
|
|
10
10
|
checkClaudeManagedCredentials
|
|
11
|
-
} from "./cli-
|
|
11
|
+
} from "./cli-jk4tj5m6.js";
|
|
12
12
|
import {
|
|
13
13
|
checkDevinCredentials
|
|
14
14
|
} from "./cli-tyfxrrdd.js";
|
|
15
15
|
import {
|
|
16
16
|
checkOpencodeCredentials
|
|
17
|
-
} from "./cli-
|
|
17
|
+
} from "./cli-q44nxhwq.js";
|
|
18
18
|
import {
|
|
19
19
|
initOtel,
|
|
20
20
|
injectTraceContext,
|
|
@@ -23,10 +23,10 @@ import {
|
|
|
23
23
|
withSpan,
|
|
24
24
|
withSpanContext,
|
|
25
25
|
writeSkillsToFilesystem
|
|
26
|
-
} from "./cli-
|
|
26
|
+
} from "./cli-v90vvqt8.js";
|
|
27
27
|
import {
|
|
28
28
|
checkClaudeCredentials
|
|
29
|
-
} from "./cli-
|
|
29
|
+
} from "./cli-dqhz8451.js";
|
|
30
30
|
import {
|
|
31
31
|
MAX_RATE_LIMIT_RESET_MS,
|
|
32
32
|
isCodexCreditsExhaustedMessage,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
} from "./cli-psrqtw2m.js";
|
|
37
37
|
import {
|
|
38
38
|
getContextWindowSize
|
|
39
|
-
} from "./cli-
|
|
39
|
+
} from "./cli-tghre7g6.js";
|
|
40
40
|
import {
|
|
41
41
|
getApiKey
|
|
42
42
|
} from "./cli-f14fvzag.js";
|
|
@@ -50,10 +50,10 @@ import {
|
|
|
50
50
|
import {
|
|
51
51
|
ensure,
|
|
52
52
|
initialize
|
|
53
|
-
} from "./cli-
|
|
53
|
+
} from "./cli-08fnz4jm.js";
|
|
54
54
|
import {
|
|
55
55
|
validateJsonSchema
|
|
56
|
-
} from "./cli-
|
|
56
|
+
} from "./cli-v9853xza.js";
|
|
57
57
|
import {
|
|
58
58
|
getMcpBaseUrl
|
|
59
59
|
} from "./cli-dh55d5fg.js";
|
|
@@ -76,7 +76,7 @@ import {
|
|
|
76
76
|
resolveTaskModelSelection,
|
|
77
77
|
resolveTemplateAsync,
|
|
78
78
|
telemetry
|
|
79
|
-
} from "./cli-
|
|
79
|
+
} from "./cli-6xn2xv4r.js";
|
|
80
80
|
import {
|
|
81
81
|
init_credentials,
|
|
82
82
|
resolveCredentialPools
|
|
@@ -436,19 +436,19 @@ async function materializeCodexAuthJson(_slot, creds, deps = {}) {
|
|
|
436
436
|
async function createProviderAdapter(provider) {
|
|
437
437
|
switch (provider) {
|
|
438
438
|
case "claude": {
|
|
439
|
-
const { ClaudeAdapter } = await import("./claude-adapter-
|
|
439
|
+
const { ClaudeAdapter } = await import("./claude-adapter-w96mzan4.js");
|
|
440
440
|
return new ClaudeAdapter;
|
|
441
441
|
}
|
|
442
442
|
case "pi": {
|
|
443
|
-
const { PiMonoAdapter } = await import("./pi-mono-adapter-
|
|
443
|
+
const { PiMonoAdapter } = await import("./pi-mono-adapter-y037wnp4.js");
|
|
444
444
|
return new PiMonoAdapter;
|
|
445
445
|
}
|
|
446
446
|
case "codex": {
|
|
447
|
-
const { CodexAdapter } = await import("./codex-adapter-
|
|
447
|
+
const { CodexAdapter } = await import("./codex-adapter-h9rj59tj.js");
|
|
448
448
|
return new CodexAdapter;
|
|
449
449
|
}
|
|
450
450
|
case "claude-managed": {
|
|
451
|
-
const { ClaudeManagedAdapter } = await import("./claude-managed-adapter-
|
|
451
|
+
const { ClaudeManagedAdapter } = await import("./claude-managed-adapter-vj9kzegz.js");
|
|
452
452
|
return new ClaudeManagedAdapter;
|
|
453
453
|
}
|
|
454
454
|
case "devin": {
|
|
@@ -456,7 +456,7 @@ async function createProviderAdapter(provider) {
|
|
|
456
456
|
return new DevinAdapter;
|
|
457
457
|
}
|
|
458
458
|
case "opencode": {
|
|
459
|
-
const { OpencodeAdapter } = await import("./opencode-adapter-
|
|
459
|
+
const { OpencodeAdapter } = await import("./opencode-adapter-p2w6efwc.js");
|
|
460
460
|
return new OpencodeAdapter;
|
|
461
461
|
}
|
|
462
462
|
default:
|
|
@@ -483,14 +483,22 @@ init_credentials();
|
|
|
483
483
|
// src/utils/harness-provider.ts
|
|
484
484
|
init_types();
|
|
485
485
|
var SUPPORTED_PROVIDERS = ProviderNameSchema.options;
|
|
486
|
+
function hasEnvValue(key, resolvedEnv, fallbackEnv) {
|
|
487
|
+
return !!(resolvedEnv[key]?.trim() || fallbackEnv[key]?.trim());
|
|
488
|
+
}
|
|
489
|
+
function credentialAwareDefault(resolvedEnv, fallbackEnv) {
|
|
490
|
+
const hasOpenRouterKey = hasEnvValue("OPENROUTER_API_KEY", resolvedEnv, fallbackEnv);
|
|
491
|
+
const hasClaudeCredential = hasEnvValue("ANTHROPIC_API_KEY", resolvedEnv, fallbackEnv) || hasEnvValue("CLAUDE_CODE_OAUTH_TOKEN", resolvedEnv, fallbackEnv);
|
|
492
|
+
return hasOpenRouterKey && !hasClaudeCredential ? "pi" : "claude";
|
|
493
|
+
}
|
|
486
494
|
function resolveHarnessProvider(resolvedEnv, fallbackEnv = process.env) {
|
|
487
495
|
const candidate = resolvedEnv.HARNESS_PROVIDER?.trim() || fallbackEnv.HARNESS_PROVIDER?.trim();
|
|
488
496
|
if (!candidate)
|
|
489
|
-
return
|
|
497
|
+
return credentialAwareDefault(resolvedEnv, fallbackEnv);
|
|
490
498
|
const parsed = ProviderNameSchema.safeParse(candidate);
|
|
491
499
|
if (!parsed.success) {
|
|
492
|
-
console.warn(`[harness-provider] Invalid HARNESS_PROVIDER="${candidate}" (must be one of: ${SUPPORTED_PROVIDERS.join(", ")}); falling back to
|
|
493
|
-
return
|
|
500
|
+
console.warn(`[harness-provider] Invalid HARNESS_PROVIDER="${candidate}" (must be one of: ${SUPPORTED_PROVIDERS.join(", ")}); falling back to credential-aware default`);
|
|
501
|
+
return credentialAwareDefault(resolvedEnv, fallbackEnv);
|
|
494
502
|
}
|
|
495
503
|
return parsed.data;
|
|
496
504
|
}
|
|
@@ -1108,7 +1116,7 @@ async function checkProviderCredentials(provider, env, opts) {
|
|
|
1108
1116
|
case "opencode":
|
|
1109
1117
|
return checkOpencodeCredentials(env, opts);
|
|
1110
1118
|
case "pi": {
|
|
1111
|
-
const { checkPiMonoCredentials } = await import("./pi-mono-adapter-
|
|
1119
|
+
const { checkPiMonoCredentials } = await import("./pi-mono-adapter-y037wnp4.js");
|
|
1112
1120
|
return checkPiMonoCredentials(env, opts);
|
|
1113
1121
|
}
|
|
1114
1122
|
default:
|