@cortex-agent/server 2026.8.3-2 → 2026.8.6
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/defaults/config/thread-templates/agents/benchmark-coder.json +2 -2
- package/defaults/config/thread-templates/agents/benchmark-fixer.json +17 -0
- package/defaults/config/thread-templates/agents/benchmark-reviewer.json +5 -5
- package/defaults/config/thread-templates/templates/benchmark-coder-review-fix.json +21 -0
- package/defaults/plugins/cortex-system/skills/thread/SKILL.md +1 -0
- package/defaults/prompts/directives/benchmark-coder.md +1 -0
- package/defaults/prompts/directives/benchmark-fixer.md +1 -0
- package/defaults/prompts/directives/benchmark-reviewer.md +1 -0
- package/defaults/prompts/systemPrompts/benchmark-coder.md +1 -0
- package/defaults/prompts/systemPrompts/benchmark-fixer.md +1 -0
- package/defaults/prompts/systemPrompts/benchmark-reviewer.md +1 -0
- package/dist/agent-adapter/capabilities.d.ts +32 -1
- package/dist/agent-adapter/capabilities.js +39 -1
- package/dist/agent-adapter/claude/adapter.d.ts +15 -0
- package/dist/agent-adapter/claude/adapter.js +29 -7
- package/dist/agent-adapter/claude/spawn-args.d.ts +5 -2
- package/dist/agent-adapter/claude/spawn-args.js +29 -6
- package/dist/agent-adapter/index.js +11 -1
- package/dist/agent-adapter/normalize/tool-names.d.ts +4 -0
- package/dist/agent-adapter/normalize/tool-names.js +10 -0
- package/dist/agent-adapter/pi/adapter.d.ts +20 -8
- package/dist/agent-adapter/pi/adapter.js +130 -35
- package/dist/agent-adapter/pi/agent-dir.d.ts +20 -53
- package/dist/agent-adapter/pi/agent-dir.js +48 -89
- package/dist/agent-adapter/pi/custom-catalog.d.ts +10 -0
- package/dist/agent-adapter/pi/custom-catalog.js +42 -0
- package/dist/agent-adapter/pi/defaults.d.ts +9 -0
- package/dist/agent-adapter/pi/defaults.js +14 -4
- package/dist/agent-adapter/pi/discovery.d.ts +1 -3
- package/dist/agent-adapter/pi/discovery.js +3 -15
- package/dist/agent-adapter/pi/event-parser.js +8 -0
- package/dist/agent-adapter/pi/mcp-bridge.d.ts +13 -0
- package/dist/agent-adapter/pi/mcp-bridge.js +31 -6
- package/dist/agent-adapter/pi/mcp-duration.d.ts +28 -0
- package/dist/agent-adapter/pi/mcp-duration.js +48 -0
- package/dist/agent-adapter/pi/policy-guard.d.ts +40 -0
- package/dist/agent-adapter/pi/policy-guard.js +111 -0
- package/dist/agent-adapter/pi/providers-config.d.ts +62 -0
- package/dist/agent-adapter/pi/providers-config.js +101 -0
- package/dist/agent-adapter/pi/quota-probe.d.ts +11 -0
- package/dist/agent-adapter/pi/quota-probe.js +36 -0
- package/dist/agent-adapter/pi/quota-sink.d.ts +25 -0
- package/dist/agent-adapter/pi/quota-sink.js +31 -0
- package/dist/agent-adapter/pi/session-files.d.ts +2 -0
- package/dist/agent-adapter/pi/session-files.js +19 -0
- package/dist/agent-adapter/pi/session-support.d.ts +14 -3
- package/dist/agent-adapter/pi/session-support.js +8 -0
- package/dist/agent-adapter/pi/spawn-args.d.ts +11 -1
- package/dist/agent-adapter/pi/spawn-args.js +13 -0
- package/dist/agent-adapter/pi/tool-shims.d.ts +2 -2
- package/dist/agent-adapter/pi/tool-shims.js +32 -21
- package/dist/agent-adapter/pi/web-search.js +36 -8
- package/dist/agent-adapter/types.d.ts +14 -0
- package/dist/core/locales/en.d.ts +54 -1
- package/dist/core/locales/en.js +2 -0
- package/dist/core/locales/slices/commands.d.ts +12 -1
- package/dist/core/locales/slices/commands.js +24 -2
- package/dist/core/locales/slices/providers.d.ts +45 -0
- package/dist/core/locales/slices/providers.js +95 -0
- package/dist/core/locales/zh.js +2 -0
- package/dist/core/resilient-watch.d.ts +28 -0
- package/dist/core/resilient-watch.js +110 -0
- package/dist/core/settings.js +15 -20
- package/dist/core/types/agent-types.d.ts +6 -0
- package/dist/core/types/thread-types.d.ts +21 -3
- package/dist/domain/agent-run/agent-run-cli.js +3 -1
- package/dist/domain/agent-run/benchmark-local-thread-orchestrator.d.ts +31 -0
- package/dist/domain/agent-run/benchmark-local-thread-orchestrator.js +231 -24
- package/dist/domain/agent-run/benchmark-thread-identity.d.ts +15 -2
- package/dist/domain/agent-run/benchmark-thread-identity.js +123 -34
- package/dist/domain/agent-run/identity.d.ts +5 -0
- package/dist/domain/agent-run/identity.js +4 -1
- package/dist/domain/agent-run/journal.d.ts +3 -2
- package/dist/domain/agent-run/manifest.js +11 -4
- package/dist/domain/agent-run/pinned-node-process.d.ts +4 -0
- package/dist/domain/agent-run/pinned-node-process.js +9 -0
- package/dist/domain/agent-run/role-surface.d.ts +2 -2
- package/dist/domain/agent-run/role-surface.js +7 -3
- package/dist/domain/agent-run/run-config.d.ts +10 -1
- package/dist/domain/agent-run/run-config.js +57 -6
- package/dist/domain/agent-run/runner.js +149 -31
- package/dist/domain/agents/facade.d.ts +37 -122
- package/dist/domain/agents/facade.js +47 -115
- package/dist/domain/agents/spawn-config.d.ts +135 -0
- package/dist/domain/agents/spawn-config.js +121 -0
- package/dist/domain/benchmark/accounting-reconciliation.d.ts +98 -0
- package/dist/domain/benchmark/accounting-reconciliation.js +218 -0
- package/dist/domain/benchmark/arm-schema.d.ts +43 -0
- package/dist/domain/benchmark/arm-schema.js +243 -0
- package/dist/domain/benchmark/capabilities.d.ts +4 -0
- package/dist/domain/benchmark/capabilities.js +54 -0
- package/dist/domain/benchmark/decimal-text.d.ts +27 -0
- package/dist/domain/benchmark/decimal-text.js +67 -0
- package/dist/domain/benchmark/lease-echo.d.ts +43 -0
- package/dist/domain/benchmark/lease-echo.js +56 -0
- package/dist/domain/benchmark/policy-backed-runtime-deps.d.ts +14 -0
- package/dist/domain/benchmark/policy-backed-runtime-deps.js +47 -0
- package/dist/domain/benchmark/policy-compiler.d.ts +68 -0
- package/dist/domain/benchmark/policy-compiler.js +680 -0
- package/dist/domain/benchmark/resolved-policy.d.ts +110 -0
- package/dist/domain/benchmark/resolved-policy.js +195 -0
- package/dist/domain/benchmark/trial-adapter-factory.d.ts +38 -0
- package/dist/domain/benchmark/trial-adapter-factory.js +165 -0
- package/dist/domain/benchmark/trial-thread-adapter.d.ts +25 -0
- package/dist/domain/benchmark/trial-thread-adapter.js +106 -0
- package/dist/domain/benchmark/variant-proposal.d.ts +45 -0
- package/dist/domain/benchmark/variant-proposal.js +42 -0
- package/dist/domain/benchmark/workspace-lease.d.ts +99 -0
- package/dist/domain/benchmark/workspace-lease.js +272 -0
- package/dist/domain/costs/codex-quota.d.ts +29 -0
- package/dist/domain/costs/codex-quota.js +102 -0
- package/dist/domain/costs/cost-tracker.d.ts +48 -9
- package/dist/domain/costs/cost-tracker.js +74 -18
- package/dist/domain/costs/rate-limit-throttle.d.ts +23 -1
- package/dist/domain/costs/rate-limit-throttle.js +61 -6
- package/dist/domain/costs/resume-registry.d.ts +3 -1
- package/dist/domain/costs/resume-registry.js +10 -1
- package/dist/domain/mcp/tools/benchmark-thread-run.d.ts +26 -2
- package/dist/domain/mcp/tools/benchmark-thread-run.js +63 -20
- package/dist/domain/mcp/tools/cost.js +15 -6
- package/dist/domain/pi-providers/custom-provider-model.d.ts +53 -0
- package/dist/domain/pi-providers/custom-provider-model.js +122 -0
- package/dist/domain/pi-providers/custom-provider-service.d.ts +59 -0
- package/dist/domain/pi-providers/custom-provider-service.js +143 -0
- package/dist/domain/pi-providers/gateway-route-store.d.ts +23 -0
- package/dist/domain/pi-providers/gateway-route-store.js +78 -0
- package/dist/domain/pi-providers/index.d.ts +4 -0
- package/dist/domain/pi-providers/index.js +8 -0
- package/dist/domain/pi-providers/models-json-store.d.ts +6 -0
- package/dist/domain/pi-providers/models-json-store.js +77 -0
- package/dist/domain/scheduling/jobs/_shared.d.ts +4 -1
- package/dist/domain/scheduling/jobs/_shared.js +11 -2
- package/dist/domain/scheduling/jobs/scheduled-task.js +1 -0
- package/dist/domain/scheduling/jobs/task-dispatch.js +49 -54
- package/dist/domain/sessions/session-lifecycle.d.ts +22 -0
- package/dist/domain/sessions/session-lifecycle.js +20 -1
- package/dist/domain/system/system-notice.d.ts +4 -1
- package/dist/domain/system/system-notice.js +6 -2
- package/dist/domain/tasks/dispatch-utils.d.ts +0 -4
- package/dist/domain/tasks/dispatch-utils.js +24 -37
- package/dist/domain/threads/runner.d.ts +16 -1
- package/dist/domain/threads/runner.js +62 -8
- package/dist/domain/threads/template-loader.d.ts +5 -0
- package/dist/domain/threads/template-loader.js +120 -36
- package/dist/domain/threads/template-validate.d.ts +244 -0
- package/dist/domain/threads/template-validate.js +574 -0
- package/dist/domain/threads/template-validate.parity.d.ts +1 -0
- package/dist/domain/threads/template-validate.parity.js +47 -0
- package/dist/domain/threads/template-writer.d.ts +55 -0
- package/dist/domain/threads/template-writer.js +131 -0
- package/dist/domain/ui-service/app-router.d.ts +143 -1
- package/dist/domain/ui-service/app-router.js +29 -3
- package/dist/domain/ui-service/input-schemas.d.ts +228 -4
- package/dist/domain/ui-service/input-schemas.js +132 -1
- package/dist/domain/ui-service/mutate/config.d.ts +10 -1
- package/dist/domain/ui-service/mutate/config.js +45 -5
- package/dist/domain/ui-service/mutate/custom-providers.d.ts +8 -0
- package/dist/domain/ui-service/mutate/custom-providers.js +37 -0
- package/dist/domain/ui-service/mutate/profiles.d.ts +21 -0
- package/dist/domain/ui-service/mutate/profiles.js +156 -0
- package/dist/domain/ui-service/mutate/schedules.d.ts +2 -1
- package/dist/domain/ui-service/mutate/schedules.js +53 -3
- package/dist/domain/ui-service/mutate/sessions.d.ts +2 -1
- package/dist/domain/ui-service/mutate/sessions.js +25 -1
- package/dist/domain/ui-service/mutate/system.d.ts +2 -1
- package/dist/domain/ui-service/mutate/system.js +17 -3
- package/dist/domain/ui-service/mutate/thread-templates.d.ts +4 -0
- package/dist/domain/ui-service/mutate/thread-templates.js +71 -0
- package/dist/domain/ui-service/query/config.js +30 -0
- package/dist/domain/ui-service/query/custom-providers.d.ts +8 -0
- package/dist/domain/ui-service/query/custom-providers.js +13 -0
- package/dist/domain/ui-service/query/machine-detail.d.ts +2 -0
- package/dist/domain/ui-service/query/machine-detail.js +56 -0
- package/dist/domain/ui-service/query/machine-probe.d.ts +18 -0
- package/dist/domain/ui-service/query/machine-probe.js +136 -0
- package/dist/domain/ui-service/query/schedules.js +5 -0
- package/dist/domain/ui-service/query/sessions.js +8 -2
- package/dist/domain/ui-service/query/thread-template-detail.d.ts +8 -0
- package/dist/domain/ui-service/query/thread-template-detail.js +94 -0
- package/dist/domain/ui-service/query/thread-templates.d.ts +5 -3
- package/dist/domain/ui-service/query/thread-templates.js +44 -7
- package/dist/domain/ui-service/types.d.ts +298 -7
- package/dist/domain/ui-service/ui-service.js +27 -3
- package/dist/entry/app.js +24 -3
- package/dist/entry/auth-cli.d.ts +4 -1
- package/dist/entry/auth-cli.js +10 -2
- package/dist/entry/cli-help.js +6 -2
- package/dist/entry/cli.js +2 -1
- package/dist/entry/daemon.d.ts +0 -11
- package/dist/entry/daemon.js +5 -49
- package/dist/entry/provider-cli.d.ts +16 -0
- package/dist/entry/provider-cli.js +203 -0
- package/dist/events/event-types.d.ts +2 -1
- package/dist/orchestration/agent-runner.js +3 -2
- package/dist/orchestration/routing/commands/cost.d.ts +8 -0
- package/dist/orchestration/routing/commands/cost.js +93 -21
- package/dist/orchestration/routing/commands/login-custom.d.ts +26 -0
- package/dist/orchestration/routing/commands/login-custom.js +89 -0
- package/dist/orchestration/routing/commands/login.d.ts +3 -0
- package/dist/orchestration/routing/commands/login.js +7 -0
- package/dist/orchestration/routing/message-router.js +48 -33
- package/dist/orchestration/routing/webhook.js +1 -1
- package/dist/orchestration/session-events.d.ts +2 -1
- package/dist/orchestration/session-events.js +1 -0
- package/dist/orchestration/thread-callback.js +1 -1
- package/dist/store/conversation-history-repo.d.ts +5 -1
- package/dist/store/conversation-history-repo.js +2 -1
- package/dist/store/cost-repo.d.ts +17 -0
- package/dist/store/cost-repo.js +47 -5
- package/dist/store/profile-repo.d.ts +0 -10
- package/dist/store/profile-repo.js +34 -56
- package/dist/store/session-registry-repo.d.ts +12 -0
- package/dist/store/session-registry-repo.js +16 -0
- package/package.json +1 -1
- package/web/dist/assets/index-DYMfaAi4.css +1 -0
- package/web/dist/assets/index-uOoZjGKa.js +141 -0
- package/web/dist/index.html +2 -2
- package/web/dist/assets/index-XqBCYtkw.js +0 -139
- package/web/dist/assets/index-zpf3OSKC.css +0 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// input: spawn config, codex quota readings, the rate-limit throttle
|
|
2
|
+
// output: resolveQuotaSource and reportCodexQuota
|
|
3
|
+
// pos: Feeds PI provider quota readings into the throttle
|
|
4
|
+
// >>> If I am updated, update my header comment and the parent folder's CORTEX.md <<<
|
|
5
|
+
import { handleRateLimitEvent } from '../../domain/costs/rate-limit-throttle.js';
|
|
6
|
+
const DISPLAY_NAMES = {
|
|
7
|
+
'openai-codex': 'OpenAI Codex',
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Resolve the two keys the dispatch gate looks a throttle up by. `configIsRateLimited` asks
|
|
11
|
+
* `isProviderModeRateLimited(resolveRateLimitProvider(config), config.mode || 'api')`, so a reading
|
|
12
|
+
* filed under any other pair would be recorded and then never consulted. The provider mirrors
|
|
13
|
+
* `resolveRateLimitProvider` (profile provider, else the backend name); the mode is recovered from
|
|
14
|
+
* the gateway sub-path `/m/<mode>/<provider>` that spawn-config derives from the profile's mode,
|
|
15
|
+
* and its absence means the profile had no mode — which the gate reads as 'api'.
|
|
16
|
+
*/
|
|
17
|
+
export function resolveQuotaSource(config) {
|
|
18
|
+
const provider = config.piProvider || 'pi';
|
|
19
|
+
const mode = config.piGatewayPath?.match(/\/m\/([^/]+)\//)?.[1] ?? 'api';
|
|
20
|
+
return { provider, displayName: DISPLAY_NAMES[provider] ?? provider, mode };
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* File each advertised window as its own throttle event. The throttle owns the thresholds and
|
|
24
|
+
* decides whether a window is worth pausing for, so every window is submitted as observed —
|
|
25
|
+
* including the ones far below the line, which keep the recorded reset time fresh.
|
|
26
|
+
*/
|
|
27
|
+
export async function reportCodexQuota(reading, source, submit = handleRateLimitEvent) {
|
|
28
|
+
for (const window of reading.windows) {
|
|
29
|
+
await submit({ rateLimitType: window.type, utilization: window.utilization, resetsAt: window.resetsAt }, source);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// input: a session directory listing and a PI session id
|
|
2
|
+
// output: the exact transcript path for that id, or null
|
|
3
|
+
// pos: Ambient-free PI transcript filename lookup
|
|
4
|
+
// >>> If I am updated, update my header comment and the parent folder's CORTEX.md <<<
|
|
5
|
+
import { readdirSync } from 'fs';
|
|
6
|
+
import * as path from 'path';
|
|
7
|
+
import { selectPISessionFilename } from '../../core/pi-session-filename.js';
|
|
8
|
+
/** Resolve PI's exact id-bearing filename without opening transcript bodies. */
|
|
9
|
+
export function findPISessionFilePath(sessionDir, sessionId) {
|
|
10
|
+
if (!sessionId)
|
|
11
|
+
return null;
|
|
12
|
+
try {
|
|
13
|
+
const filename = selectPISessionFilename(readdirSync(sessionDir), sessionId);
|
|
14
|
+
return filename ? path.join(sessionDir, filename) : null;
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ChildProcess, SpawnOptions } from 'child_process';
|
|
2
1
|
import type { AgentResult, AskUserQuestionInfo } from '../../core/types/agent-types.js';
|
|
3
|
-
import type {
|
|
2
|
+
import type { CodexQuotaReading } from '../../domain/costs/codex-quota.js';
|
|
3
|
+
import type { AgentProcess, AgentProcessSpawner, InjectionAckSink, UserMessage } from '../types.js';
|
|
4
4
|
import type { NormalizedEvent } from '../normalize/event-types.js';
|
|
5
5
|
export declare const DEFAULT_PI_BINARY = "pi";
|
|
6
6
|
export declare const CLOSE_EXIT_WAIT_MS = 5000;
|
|
@@ -14,20 +14,31 @@ export type SwitchResult = {
|
|
|
14
14
|
ok: boolean;
|
|
15
15
|
cancelled: boolean;
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
/** P1 (ii): PI's spawner is the same `AgentProcessSpawner` Claude takes, so the containment
|
|
18
|
+
* supervision handle survives the call instead of being discarded with the `ChildProcess`. */
|
|
19
|
+
export type SpawnFn = AgentProcessSpawner;
|
|
20
|
+
/** Test seam default. A benchmark spawn never reaches it — `assertBenchmarkSpawn` requires
|
|
21
|
+
* `spawnConfig.processSpawner`, so an unsupervised trial refuses rather than falling back here. */
|
|
22
|
+
export declare const defaultPiSpawn: SpawnFn;
|
|
18
23
|
export interface PIAgentProcess extends AgentProcess {
|
|
19
24
|
sendExtensionUiResponse(id: string, payload: Record<string, unknown>): void;
|
|
20
25
|
}
|
|
21
26
|
export interface PISessionOptions {
|
|
22
27
|
sessionKey: string;
|
|
23
28
|
sessionDir: string;
|
|
29
|
+
/** Absolute CLI path frozen by a trial policy, or the bare `pi` name for daemon sessions. */
|
|
30
|
+
command: string;
|
|
24
31
|
cliArgs: string[];
|
|
25
32
|
cwd: string;
|
|
26
33
|
env: NodeJS.ProcessEnv;
|
|
27
34
|
spawner: SpawnFn;
|
|
35
|
+
/** Explicit delta policy; a trial passes the frozen value rather than reading watched settings. */
|
|
36
|
+
streamDeltas: boolean;
|
|
28
37
|
registry: Map<string, string>;
|
|
29
38
|
registrySessionDir: string;
|
|
30
39
|
onClose?: (sessionKey: string) => void;
|
|
40
|
+
/** Called with each provider quota reading the child reports; set only for gateway-routed runs. */
|
|
41
|
+
onProviderQuota?: (reading: CodexQuotaReading) => void;
|
|
31
42
|
}
|
|
32
43
|
export interface PendingPiTurn {
|
|
33
44
|
resolve: (result: AgentResult) => void;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// output: PI timers, context probe, EventQueue, steering, RPC parsing
|
|
3
3
|
// pos: Small state primitives shared by PI session lifecycle code
|
|
4
4
|
// >>> If I am updated, update my header comment and the parent folder's CORTEX.md <<<
|
|
5
|
+
import { spawn } from 'child_process';
|
|
5
6
|
import { createLogger } from '../../core/log.js';
|
|
6
7
|
import { buildPrompt } from '../normalize/prompt-builder.js';
|
|
7
8
|
export const DEFAULT_PI_BINARY = 'pi';
|
|
@@ -13,6 +14,13 @@ export const PI_MAX_TIMEOUT = 30_000_000;
|
|
|
13
14
|
export const PI_CONTEXT_USAGE_TIMEOUT_MS = 1000;
|
|
14
15
|
export const PI_CONTEXT_USAGE_SAMPLE_MS = 2000;
|
|
15
16
|
const log = createLogger('pi-adapter');
|
|
17
|
+
/** Test seam default. A benchmark spawn never reaches it — `assertBenchmarkSpawn` requires
|
|
18
|
+
* `spawnConfig.processSpawner`, so an unsupervised trial refuses rather than falling back here. */
|
|
19
|
+
export const defaultPiSpawn = (command, args, options) => ({
|
|
20
|
+
process: spawn(command, args, {
|
|
21
|
+
...options, stdio: ['pipe', 'pipe', 'pipe'],
|
|
22
|
+
}),
|
|
23
|
+
});
|
|
16
24
|
export function buildPromptText(message) {
|
|
17
25
|
return buildPrompt(message.text, message.attachments ?? []);
|
|
18
26
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IdentityJsonValue } from '../../domain/agent-run/identity.js';
|
|
2
|
+
import type { AgentSpawnConfig, McpComposition } from '../types.js';
|
|
2
3
|
export interface PISpawnOptions {
|
|
3
4
|
sessionDir: string;
|
|
4
5
|
/** Session UUID for legacy callers that intentionally delegate lookup to PI. */
|
|
@@ -32,6 +33,15 @@ export interface PIEnvOptions {
|
|
|
32
33
|
context?: AgentSpawnConfig['cortexContext'];
|
|
33
34
|
piAgentDir: string;
|
|
34
35
|
allowedTools?: string | null;
|
|
36
|
+
/** Compiled benchmark policy guard. Present puts the child in guarded mode (§13 GT6). */
|
|
37
|
+
policyGuard?: IdentityJsonValue;
|
|
38
|
+
/** Which key of that guard this spawn selects. Absent keeps the one-shot parent's default
|
|
39
|
+
* (design section 16 (16.1) LS7). */
|
|
40
|
+
leaseState?: string;
|
|
41
|
+
/** Resolved MCP composition; the bridge derives its server set from it (§5.6 P1). */
|
|
42
|
+
mcpComposition?: McpComposition;
|
|
43
|
+
/** Absolute trial deadline the MCP bridge bounds its calls against (§5.6 P2/P5). */
|
|
44
|
+
deadlineEpochMs?: number;
|
|
35
45
|
}
|
|
36
46
|
export declare function buildPiEnv(options: PIEnvOptions, inheritedEnv?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
37
47
|
export declare function buildSpawnArgs(opts: PISpawnOptions): string[];
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// output: PI argv and isolated CORTEX_* subprocess environment
|
|
3
3
|
// pos: Pure PI argument and environment construction
|
|
4
4
|
// >>> If I am updated, update my header comment and the parent folder's CORTEX.md <<<
|
|
5
|
+
import { PI_LEASE_STATE_ENV, PI_MCP_COMPOSITION_ENV, PI_POLICY_GUARD_ENV, GATE2_LEASE_STATE, } from './policy-guard.js';
|
|
6
|
+
import { PI_BENCHMARK_DEADLINE_ENV } from './mcp-duration.js';
|
|
5
7
|
/** Strip context-window suffix like "[1m]" from model strings (e.g. "deepseek-v4-flash[1m]" → "deepseek-v4-flash"). */
|
|
6
8
|
function stripModelSuffix(model) {
|
|
7
9
|
return model.replace(/\[.*?\]$/, '');
|
|
@@ -13,6 +15,7 @@ const RESET_CONTEXT_KEYS = [
|
|
|
13
15
|
'CORTEX_TASK_GENERATION',
|
|
14
16
|
'CORTEX_CALLBACK_SOURCE', 'CORTEX_SCHEDULE_TASK_ID',
|
|
15
17
|
'CORTEX_PI_ALLOWED_TOOLS',
|
|
18
|
+
PI_POLICY_GUARD_ENV, PI_LEASE_STATE_ENV, PI_MCP_COMPOSITION_ENV, PI_BENCHMARK_DEADLINE_ENV,
|
|
16
19
|
];
|
|
17
20
|
function setOptional(env, key, value) {
|
|
18
21
|
if (value !== undefined && value !== null && value !== '')
|
|
@@ -44,6 +47,16 @@ export function buildPiEnv(options, inheritedEnv = process.env) {
|
|
|
44
47
|
env.FEISHU_CHANNEL = options.channel;
|
|
45
48
|
}
|
|
46
49
|
setOptional(env, 'CORTEX_PI_ALLOWED_TOOLS', options.allowedTools);
|
|
50
|
+
// GT6: the guard travels as its own variable and carries its lease-state input with it. Presence
|
|
51
|
+
// alone puts the child in guarded mode, so an empty or malformed value denies rather than allows.
|
|
52
|
+
if (options.policyGuard !== undefined) {
|
|
53
|
+
env[PI_POLICY_GUARD_ENV] = JSON.stringify(options.policyGuard);
|
|
54
|
+
// The selected state, not a constant: an in-trial step names the state it was armed under, and
|
|
55
|
+
// the one-shot parent path — which supplies none — keeps Gate 2's default.
|
|
56
|
+
env[PI_LEASE_STATE_ENV] = options.leaseState ?? GATE2_LEASE_STATE;
|
|
57
|
+
}
|
|
58
|
+
setOptional(env, PI_MCP_COMPOSITION_ENV, options.mcpComposition);
|
|
59
|
+
setOptional(env, PI_BENCHMARK_DEADLINE_ENV, options.deadlineEpochMs);
|
|
47
60
|
applyContext(env, options);
|
|
48
61
|
return env;
|
|
49
62
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ExtensionAPI } from './pi-ext-types.js';
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
2
|
+
import { type PiToolGate } from './policy-guard.js';
|
|
3
|
+
export declare function installToolShims(pi: ExtensionAPI, env: NodeJS.ProcessEnv, gate?: PiToolGate): void;
|
|
4
4
|
export default function toolShims(pi: ExtensionAPI): void;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { mkdirSync } from 'fs';
|
|
6
6
|
import * as path from 'path';
|
|
7
7
|
import { Type } from '@sinclair/typebox';
|
|
8
|
+
import { resolvePiToolGate } from './policy-guard.js';
|
|
8
9
|
import { createSubagentTool } from './subagent.js';
|
|
9
10
|
import { webFetchTool } from './web-fetch.js';
|
|
10
11
|
import { webSearchTool } from './web-search.js';
|
|
@@ -76,13 +77,6 @@ const TodoWriteParameters = Type.Object({
|
|
|
76
77
|
}),
|
|
77
78
|
})),
|
|
78
79
|
});
|
|
79
|
-
/** Match Claude-native labels against the active agent's comma-separated allowlist. */
|
|
80
|
-
export function makeToolGate(allowedToolsEnv) {
|
|
81
|
-
if (!allowedToolsEnv || allowedToolsEnv.trim() === '')
|
|
82
|
-
return () => true;
|
|
83
|
-
const allowed = new Set(allowedToolsEnv.split(',').map((tool) => tool.trim()).filter(Boolean));
|
|
84
|
-
return (label) => allowed.has(label);
|
|
85
|
-
}
|
|
86
80
|
function registerAskUserQuestion(pi) {
|
|
87
81
|
pi.registerTool({
|
|
88
82
|
name: 'ask_user_question',
|
|
@@ -173,20 +167,37 @@ function registerRuntimeAgent(pi) {
|
|
|
173
167
|
pi.registerTool(createSubagentTool(undefined, runtimeModelOptions(ctx)));
|
|
174
168
|
});
|
|
175
169
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
170
|
+
/** Every shim this extension can register, by PI-native name and its Claude-native label.
|
|
171
|
+
* The guard reads the native name (§6.6); the legacy allowlist reads the label. */
|
|
172
|
+
const SHIM_REGISTRATIONS = [
|
|
173
|
+
['web_fetch', 'WebFetch', pi => pi.registerTool(webFetchTool)],
|
|
174
|
+
['web_search', 'WebSearch', pi => pi.registerTool(webSearchTool)],
|
|
175
|
+
['ask_user_question', 'AskUserQuestion', registerAskUserQuestion],
|
|
176
|
+
['enter_plan_mode', 'EnterPlanMode', registerEnterPlanMode],
|
|
177
|
+
['exit_plan_mode', 'ExitPlanMode', registerExitPlanMode],
|
|
178
|
+
['todo_write', 'TodoWrite', registerTodoWrite],
|
|
179
|
+
];
|
|
180
|
+
/**
|
|
181
|
+
* GT6 — the benchmark policy guard's PI application point. PI fires `tool_call` before a built-in
|
|
182
|
+
* *or* a registered tool runs, so this is the one boundary that also covers `bash`/`write`/`edit`,
|
|
183
|
+
* which §6.6 defect 3 records as ungated today. Registration gating alone cannot reach them.
|
|
184
|
+
*/
|
|
185
|
+
function installDispatchGuard(pi, gate) {
|
|
186
|
+
pi.on('tool_call', (event) => {
|
|
187
|
+
const decision = gate.decide(event.toolName);
|
|
188
|
+
return decision.allow ? undefined : { block: true, reason: decision.reason };
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
export function installToolShims(pi, env, gate = resolvePiToolGate(env)) {
|
|
192
|
+
if (gate.guarded)
|
|
193
|
+
installDispatchGuard(pi, gate);
|
|
194
|
+
if (gate.decide('agent', 'Agent').allow && env.CORTEX_PI_SUBAGENT !== '1')
|
|
179
195
|
registerRuntimeAgent(pi);
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
['AskUserQuestion', () => registerAskUserQuestion(pi)],
|
|
184
|
-
['EnterPlanMode', () => registerEnterPlanMode(pi)],
|
|
185
|
-
['ExitPlanMode', () => registerExitPlanMode(pi)],
|
|
186
|
-
['TodoWrite', () => registerTodoWrite(pi)],
|
|
187
|
-
];
|
|
188
|
-
for (const [label, register] of registrations) {
|
|
189
|
-
if (allowed(label))
|
|
190
|
-
register();
|
|
196
|
+
for (const [native, label, register] of SHIM_REGISTRATIONS) {
|
|
197
|
+
if (gate.decide(native, label).allow)
|
|
198
|
+
register(pi);
|
|
191
199
|
}
|
|
192
200
|
}
|
|
201
|
+
export default function toolShims(pi) {
|
|
202
|
+
installToolShims(pi, process.env);
|
|
203
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// input: TypeBox, PI model context, provider HTTP APIs
|
|
2
|
-
// output: Validated API-dispatched PI WebSearch tool
|
|
2
|
+
// output: Validated provider/API-dispatched PI WebSearch tool
|
|
3
3
|
// pos: PI search request and resilient response decoder
|
|
4
4
|
// >>> If I am updated, update my header comment and the parent folder's CORTEX.md <<<
|
|
5
5
|
import { randomUUID } from 'node:crypto';
|
|
@@ -90,20 +90,41 @@ function anthropicTool(params, sendDomainFields) {
|
|
|
90
90
|
: {}),
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
|
|
95
|
-
setAnthropicAuth(headers, auth.apiKey);
|
|
96
|
-
if (!headers.has('anthropic-version'))
|
|
97
|
-
headers.set('anthropic-version', '2023-06-01');
|
|
98
|
-
const body = {
|
|
93
|
+
function anthropicBody(model, params, sendDomainFields) {
|
|
94
|
+
return {
|
|
99
95
|
model: model.id,
|
|
100
96
|
max_tokens: model.maxTokens,
|
|
101
97
|
messages: [{ role: 'user', content: searchPrompt(params) }],
|
|
102
98
|
tools: [anthropicTool(params, sendDomainFields)],
|
|
103
99
|
};
|
|
100
|
+
}
|
|
101
|
+
function buildAnthropicRequest(model, auth, params, sendDomainFields) {
|
|
102
|
+
const headers = mergedHeaders(model, auth, 'application/json');
|
|
103
|
+
setAnthropicAuth(headers, auth.apiKey);
|
|
104
|
+
if (!headers.has('anthropic-version'))
|
|
105
|
+
headers.set('anthropic-version', '2023-06-01');
|
|
104
106
|
return {
|
|
105
107
|
url: joinEndpoint(model.baseUrl, '/v1/messages'),
|
|
106
|
-
init: {
|
|
108
|
+
init: {
|
|
109
|
+
method: 'POST',
|
|
110
|
+
headers,
|
|
111
|
+
body: JSON.stringify(anthropicBody(model, params, sendDomainFields)),
|
|
112
|
+
},
|
|
113
|
+
responseType: 'anthropic',
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function buildDeepSeekRequest(model, auth, params, sendDomainFields) {
|
|
117
|
+
const headers = mergedHeaders(model, auth, 'application/json');
|
|
118
|
+
setBearerAuth(headers, auth.apiKey);
|
|
119
|
+
if (!headers.has('anthropic-version'))
|
|
120
|
+
headers.set('anthropic-version', '2023-06-01');
|
|
121
|
+
return {
|
|
122
|
+
url: joinEndpoint(model.baseUrl, '/anthropic/v1/messages'),
|
|
123
|
+
init: {
|
|
124
|
+
method: 'POST',
|
|
125
|
+
headers,
|
|
126
|
+
body: JSON.stringify(anthropicBody(model, params, sendDomainFields)),
|
|
127
|
+
},
|
|
107
128
|
responseType: 'anthropic',
|
|
108
129
|
};
|
|
109
130
|
}
|
|
@@ -216,7 +237,14 @@ const searchBackends = {
|
|
|
216
237
|
},
|
|
217
238
|
'openai-codex-responses': { buildRequest: buildCodexRequest, sendsDomainFields: false },
|
|
218
239
|
};
|
|
240
|
+
const deepSeekSearchBackend = {
|
|
241
|
+
buildRequest: buildDeepSeekRequest,
|
|
242
|
+
sendsDomainFields: true,
|
|
243
|
+
};
|
|
219
244
|
function resolveSearchBackend(model) {
|
|
245
|
+
if (model.provider === 'deepseek' && model.api === 'openai-completions') {
|
|
246
|
+
return deepSeekSearchBackend;
|
|
247
|
+
}
|
|
220
248
|
return searchBackends[model.api] ?? null;
|
|
221
249
|
}
|
|
222
250
|
function collectUrls(value) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ChildProcessWithoutNullStreams, SpawnOptionsWithoutStdio } from 'node:child_process';
|
|
2
|
+
import type { IdentityJsonValue } from '../domain/agent-run/identity.js';
|
|
2
3
|
import type { Capability } from './capabilities.js';
|
|
3
4
|
import type { NormalizedEvent } from './normalize/event-types.js';
|
|
4
5
|
import type { NormalizedHookSpec } from './normalize/hooks.js';
|
|
@@ -76,6 +77,19 @@ export interface AgentSpawnConfig {
|
|
|
76
77
|
preserveUnreportedAccounting?: boolean;
|
|
77
78
|
/** Optional process boundary used by daemon-free runs. Ordinary callers spawn directly. */
|
|
78
79
|
processSpawner?: AgentProcessSpawner;
|
|
80
|
+
/** Absolute backend CLI path frozen by a trial policy. Absent resolves the CLI from PATH. */
|
|
81
|
+
cliPath?: string;
|
|
82
|
+
/** Compiled benchmark policy guard for this role. Present replaces the ambient hook surface. */
|
|
83
|
+
benchmarkPolicyGuard?: IdentityJsonValue;
|
|
84
|
+
/** Which key of the compiled guard this spawn selects — the live lease state at the moment the
|
|
85
|
+
* step's config was built. A spawn-time parameter like `sessionId`, deliberately outside the
|
|
86
|
+
* role surface: the table is identity, the selection is not (design section 16 (16.1) LS4/LS6). */
|
|
87
|
+
benchmarkLeaseState?: string;
|
|
88
|
+
/** Exact allowlisted child environment for an isolated trial; replaces host inheritance. */
|
|
89
|
+
pinnedEnv?: NodeJS.ProcessEnv;
|
|
90
|
+
/** Absolute trial deadline. A backend that bounds an in-process call derives its remaining budget
|
|
91
|
+
* from this at the moment of use — the value itself is never a stored duration (§5.6 P5). */
|
|
92
|
+
benchmarkDeadlineEpochMs?: number;
|
|
79
93
|
/** Channel identifier used for Claude session-pool key fallback. */
|
|
80
94
|
channel?: string;
|
|
81
95
|
/** DR-0008 Phase 3 cleanup target. Claude `--agent` CLI flag. */
|
|
@@ -5,6 +5,48 @@
|
|
|
5
5
|
* A new key goes into BOTH the En and Zh object of the same slice — the Record<MessageKey,string>
|
|
6
6
|
* type on zh plus tests/core/i18n.test.ts both fail otherwise. */
|
|
7
7
|
export declare const en: {
|
|
8
|
+
'provider.cli.description': string;
|
|
9
|
+
'provider.cli.listDescription': string;
|
|
10
|
+
'provider.cli.addDescription': string;
|
|
11
|
+
'provider.cli.removeDescription': string;
|
|
12
|
+
'provider.cli.nameDescription': string;
|
|
13
|
+
'provider.cli.apiDescription': string;
|
|
14
|
+
'provider.cli.urlDescription': string;
|
|
15
|
+
'provider.cli.keyDescription': string;
|
|
16
|
+
'provider.cli.modelDescription': string;
|
|
17
|
+
'provider.cli.jsonDescription': string;
|
|
18
|
+
'provider.cli.dryRunDescription': string;
|
|
19
|
+
'provider.cli.helpDescription': string;
|
|
20
|
+
'provider.cli.exampleAdd': string;
|
|
21
|
+
'provider.cli.exampleAddPiped': string;
|
|
22
|
+
'provider.cli.exampleList': string;
|
|
23
|
+
'provider.cli.exampleRemove': string;
|
|
24
|
+
'provider.cli.unknownSubcommand': string;
|
|
25
|
+
'provider.cli.unknownFlag': string;
|
|
26
|
+
'provider.cli.missingFlag': string;
|
|
27
|
+
'provider.cli.flagNeedsValue': string;
|
|
28
|
+
'provider.cli.notFound': string;
|
|
29
|
+
'provider.cli.writeFailed': string;
|
|
30
|
+
'provider.cli.validValues': string;
|
|
31
|
+
'provider.cli.hint': string;
|
|
32
|
+
'provider.cli.listEmpty': string;
|
|
33
|
+
'provider.cli.listItem': string;
|
|
34
|
+
'provider.cli.listItemUnrouted': string;
|
|
35
|
+
'provider.cli.added': string;
|
|
36
|
+
'provider.cli.removed': string;
|
|
37
|
+
'provider.chat.usage': string;
|
|
38
|
+
'provider.chat.keyNotice': string;
|
|
39
|
+
'provider.issue.name-required': string;
|
|
40
|
+
'provider.issue.name-charset': string;
|
|
41
|
+
'provider.issue.name-reserved': string;
|
|
42
|
+
'provider.issue.api-invalid': string;
|
|
43
|
+
'provider.issue.upstream-required': string;
|
|
44
|
+
'provider.issue.upstream-scheme': string;
|
|
45
|
+
'provider.issue.models-required': string;
|
|
46
|
+
'provider.issue.model-id-required': string;
|
|
47
|
+
'provider.issue.model-id-duplicate': string;
|
|
48
|
+
'provider.issue.not-found': string;
|
|
49
|
+
'provider.issue.write-failed': string;
|
|
8
50
|
'init.clipboard.prompt': "\nPress \"c\" to copy manifest to clipboard (any other key to skip)...";
|
|
9
51
|
'init.clipboard.copied': "Manifest copied to clipboard!";
|
|
10
52
|
'init.clipboard.failed': "Could not copy. If running in a terminal, ensure OSC 52 is enabled.";
|
|
@@ -433,7 +475,7 @@ export declare const en: {
|
|
|
433
475
|
'cmd.help.monitoring.cost': "`!cost [project]` — show cost summary (global or per-project)";
|
|
434
476
|
'cmd.help.monitoring.status': "`!status` — show running execution summary";
|
|
435
477
|
'cmd.help.monitoring.login': "`!login [status|cc|pi [provider]]` — inspect status or start backend login";
|
|
436
|
-
'cmd.help.monitoring.budget': "`!budget $X/d $Y/m` — set
|
|
478
|
+
'cmd.help.monitoring.budget': "`!budget [list|<project>] [$X/d $Y/m|clear]` — show or set global and per-project budgets";
|
|
437
479
|
'cmd.help.monitoring.schedule': "`!schedule` — list, add, pause, resume, or remove scheduled tasks";
|
|
438
480
|
'cmd.help.tasks.tasks': "`!tasks <project>` — list all tasks with details for a project";
|
|
439
481
|
'cmd.help.tasks.projects': "`!projects` — list projects and their registered channels";
|
|
@@ -502,7 +544,18 @@ export declare const en: {
|
|
|
502
544
|
'cmd.thread.usageList': "`!thread list` — list recent threads";
|
|
503
545
|
'cmd.thread.usageListRunning': "`!thread list --running` — list running threads across channels";
|
|
504
546
|
'cmd.cost.budgetHeader': "*Budget*\n• Daily: $${dailyBudget} (spent: $${dailySpent}, remaining: $${dailyRemaining})\n• Monthly: $${monthlyBudget} (spent: $${monthlySpent}, remaining: $${monthlyRemaining})";
|
|
547
|
+
'cmd.cost.budgetHeaderProject': "*Budget — ${project}* (${scope})\n• Daily: $${dailyBudget} (spent: $${dailySpent}, remaining: $${dailyRemaining})\n• Monthly: $${monthlyBudget} (spent: $${monthlySpent}, remaining: $${monthlyRemaining})";
|
|
548
|
+
'cmd.cost.budgetScopeProject': "per-project override";
|
|
549
|
+
'cmd.cost.budgetScopeGlobal': "inherited from global";
|
|
505
550
|
'cmd.cost.budgetUpdated': "Budget updated: $${daily}/day, $${monthly}/month";
|
|
551
|
+
'cmd.cost.budgetUpdatedProject': "Budget for `${project}` updated: $${daily}/day, $${monthly}/month";
|
|
552
|
+
'cmd.cost.budgetCleared': "Per-project budget for `${project}` removed — it now inherits the global limits.";
|
|
553
|
+
'cmd.cost.budgetNoOverride': "`${project}` has no per-project budget — nothing to clear.";
|
|
554
|
+
'cmd.cost.budgetListHeader': "*Budgets*\n• global: $${daily}/day, $${monthly}/month";
|
|
555
|
+
'cmd.cost.budgetListEmpty': "No per-project overrides. Every project inherits the global limits.";
|
|
556
|
+
'cmd.cost.budgetListItem': "• ${project}: $${daily}/day, $${monthly}/month";
|
|
557
|
+
'cmd.cost.budgetPairRequired': "A per-project budget needs both limits. Usage: `!budget ${project} $50/d $1000/m`";
|
|
558
|
+
'cmd.cost.budgetUnknownProject': "Unknown project: `${project}`. Known projects: ${known}";
|
|
506
559
|
'cmd.unknown': "Unknown command: `${cmd}`. Run `!help` for available commands.";
|
|
507
560
|
'cmd.error': "Command error: ${error}";
|
|
508
561
|
'cmd.errorUnknown': "unknown error";
|
package/dist/core/locales/en.js
CHANGED
|
@@ -10,6 +10,7 @@ import { schedulingEn } from './slices/scheduling.js';
|
|
|
10
10
|
import { interactionsEn } from './slices/interactions.js';
|
|
11
11
|
import { startupEn } from './slices/startup.js';
|
|
12
12
|
import { initEn } from './slices/init.js';
|
|
13
|
+
import { providersEn } from './slices/providers.js';
|
|
13
14
|
/** Canonical English message table, aggregated from per-cluster slices. Keys are dot-namespaced
|
|
14
15
|
* by area (lang/cmd/status/...). Values may contain ${param} placeholders resolved by i18n.t().
|
|
15
16
|
* Icons (core/icons.ts) are kept in code, NOT in these strings — only human-readable text here.
|
|
@@ -24,4 +25,5 @@ export const en = {
|
|
|
24
25
|
...interactionsEn,
|
|
25
26
|
...startupEn,
|
|
26
27
|
...initEn,
|
|
28
|
+
...providersEn,
|
|
27
29
|
};
|
|
@@ -223,7 +223,7 @@ export declare const commandsEn: {
|
|
|
223
223
|
readonly 'cmd.help.monitoring.cost': "`!cost [project]` — show cost summary (global or per-project)";
|
|
224
224
|
readonly 'cmd.help.monitoring.status': "`!status` — show running execution summary";
|
|
225
225
|
readonly 'cmd.help.monitoring.login': "`!login [status|cc|pi [provider]]` — inspect status or start backend login";
|
|
226
|
-
readonly 'cmd.help.monitoring.budget': "`!budget $X/d $Y/m` — set
|
|
226
|
+
readonly 'cmd.help.monitoring.budget': "`!budget [list|<project>] [$X/d $Y/m|clear]` — show or set global and per-project budgets";
|
|
227
227
|
readonly 'cmd.help.monitoring.schedule': "`!schedule` — list, add, pause, resume, or remove scheduled tasks";
|
|
228
228
|
readonly 'cmd.help.tasks.tasks': "`!tasks <project>` — list all tasks with details for a project";
|
|
229
229
|
readonly 'cmd.help.tasks.projects': "`!projects` — list projects and their registered channels";
|
|
@@ -292,7 +292,18 @@ export declare const commandsEn: {
|
|
|
292
292
|
readonly 'cmd.thread.usageList': "`!thread list` — list recent threads";
|
|
293
293
|
readonly 'cmd.thread.usageListRunning': "`!thread list --running` — list running threads across channels";
|
|
294
294
|
readonly 'cmd.cost.budgetHeader': "*Budget*\n• Daily: $${dailyBudget} (spent: $${dailySpent}, remaining: $${dailyRemaining})\n• Monthly: $${monthlyBudget} (spent: $${monthlySpent}, remaining: $${monthlyRemaining})";
|
|
295
|
+
readonly 'cmd.cost.budgetHeaderProject': "*Budget — ${project}* (${scope})\n• Daily: $${dailyBudget} (spent: $${dailySpent}, remaining: $${dailyRemaining})\n• Monthly: $${monthlyBudget} (spent: $${monthlySpent}, remaining: $${monthlyRemaining})";
|
|
296
|
+
readonly 'cmd.cost.budgetScopeProject': "per-project override";
|
|
297
|
+
readonly 'cmd.cost.budgetScopeGlobal': "inherited from global";
|
|
295
298
|
readonly 'cmd.cost.budgetUpdated': "Budget updated: $${daily}/day, $${monthly}/month";
|
|
299
|
+
readonly 'cmd.cost.budgetUpdatedProject': "Budget for `${project}` updated: $${daily}/day, $${monthly}/month";
|
|
300
|
+
readonly 'cmd.cost.budgetCleared': "Per-project budget for `${project}` removed — it now inherits the global limits.";
|
|
301
|
+
readonly 'cmd.cost.budgetNoOverride': "`${project}` has no per-project budget — nothing to clear.";
|
|
302
|
+
readonly 'cmd.cost.budgetListHeader': "*Budgets*\n• global: $${daily}/day, $${monthly}/month";
|
|
303
|
+
readonly 'cmd.cost.budgetListEmpty': "No per-project overrides. Every project inherits the global limits.";
|
|
304
|
+
readonly 'cmd.cost.budgetListItem': "• ${project}: $${daily}/day, $${monthly}/month";
|
|
305
|
+
readonly 'cmd.cost.budgetPairRequired': "A per-project budget needs both limits. Usage: `!budget ${project} $50/d $1000/m`";
|
|
306
|
+
readonly 'cmd.cost.budgetUnknownProject': "Unknown project: `${project}`. Known projects: ${known}";
|
|
296
307
|
readonly 'cmd.unknown': "Unknown command: `${cmd}`. Run `!help` for available commands.";
|
|
297
308
|
readonly 'cmd.error': "Command error: ${error}";
|
|
298
309
|
readonly 'cmd.errorUnknown': "unknown error";
|
|
@@ -239,7 +239,7 @@ export const commandsEn = {
|
|
|
239
239
|
'cmd.help.monitoring.cost': '`!cost [project]` — show cost summary (global or per-project)',
|
|
240
240
|
'cmd.help.monitoring.status': '`!status` — show running execution summary',
|
|
241
241
|
'cmd.help.monitoring.login': '`!login [status|cc|pi [provider]]` — inspect status or start backend login',
|
|
242
|
-
'cmd.help.monitoring.budget': '`!budget $X/d $Y/m` — set
|
|
242
|
+
'cmd.help.monitoring.budget': '`!budget [list|<project>] [$X/d $Y/m|clear]` — show or set global and per-project budgets',
|
|
243
243
|
'cmd.help.monitoring.schedule': '`!schedule` — list, add, pause, resume, or remove scheduled tasks',
|
|
244
244
|
'cmd.help.tasks.tasks': '`!tasks <project>` — list all tasks with details for a project',
|
|
245
245
|
'cmd.help.tasks.projects': '`!projects` — list projects and their registered channels',
|
|
@@ -314,7 +314,18 @@ export const commandsEn = {
|
|
|
314
314
|
'cmd.thread.usageListRunning': '`!thread list --running` — list running threads across channels',
|
|
315
315
|
// --- cost / budget ---
|
|
316
316
|
'cmd.cost.budgetHeader': '*Budget*\n• Daily: $${dailyBudget} (spent: $${dailySpent}, remaining: $${dailyRemaining})\n• Monthly: $${monthlyBudget} (spent: $${monthlySpent}, remaining: $${monthlyRemaining})',
|
|
317
|
+
'cmd.cost.budgetHeaderProject': '*Budget — ${project}* (${scope})\n• Daily: $${dailyBudget} (spent: $${dailySpent}, remaining: $${dailyRemaining})\n• Monthly: $${monthlyBudget} (spent: $${monthlySpent}, remaining: $${monthlyRemaining})',
|
|
318
|
+
'cmd.cost.budgetScopeProject': 'per-project override',
|
|
319
|
+
'cmd.cost.budgetScopeGlobal': 'inherited from global',
|
|
317
320
|
'cmd.cost.budgetUpdated': 'Budget updated: $${daily}/day, $${monthly}/month',
|
|
321
|
+
'cmd.cost.budgetUpdatedProject': 'Budget for `${project}` updated: $${daily}/day, $${monthly}/month',
|
|
322
|
+
'cmd.cost.budgetCleared': 'Per-project budget for `${project}` removed — it now inherits the global limits.',
|
|
323
|
+
'cmd.cost.budgetNoOverride': '`${project}` has no per-project budget — nothing to clear.',
|
|
324
|
+
'cmd.cost.budgetListHeader': '*Budgets*\n• global: $${daily}/day, $${monthly}/month',
|
|
325
|
+
'cmd.cost.budgetListEmpty': 'No per-project overrides. Every project inherits the global limits.',
|
|
326
|
+
'cmd.cost.budgetListItem': '• ${project}: $${daily}/day, $${monthly}/month',
|
|
327
|
+
'cmd.cost.budgetPairRequired': 'A per-project budget needs both limits. Usage: `!budget ${project} $50/d $1000/m`',
|
|
328
|
+
'cmd.cost.budgetUnknownProject': 'Unknown project: `${project}`. Known projects: ${known}',
|
|
318
329
|
// --- index (dispatcher) ---
|
|
319
330
|
'cmd.unknown': 'Unknown command: `${cmd}`. Run `!help` for available commands.',
|
|
320
331
|
'cmd.error': 'Command error: ${error}',
|
|
@@ -557,7 +568,7 @@ export const commandsZh = {
|
|
|
557
568
|
'cmd.help.monitoring.cost': '`!cost [project]` — 显示成本汇总(全局或按项目)',
|
|
558
569
|
'cmd.help.monitoring.status': '`!status` — 显示运行中的执行汇总',
|
|
559
570
|
'cmd.help.monitoring.login': '`!login [status|cc|pi [provider]]` — 查看状态或启动 backend 登录',
|
|
560
|
-
'cmd.help.monitoring.budget': '`!budget $X/d $Y/m` —
|
|
571
|
+
'cmd.help.monitoring.budget': '`!budget [list|<项目>] [$X/d $Y/m|clear]` — 查看或设置全局与项目预算',
|
|
561
572
|
'cmd.help.monitoring.schedule': '`!schedule` — 列出、添加、暂停、恢复或移除定时任务',
|
|
562
573
|
'cmd.help.tasks.tasks': '`!tasks <project>` — 列出项目的所有任务及详情',
|
|
563
574
|
'cmd.help.tasks.projects': '`!projects` — 列出项目及其注册的频道',
|
|
@@ -632,7 +643,18 @@ export const commandsZh = {
|
|
|
632
643
|
'cmd.thread.usageListRunning': '`!thread list --running` — 列出跨频道的运行中线程',
|
|
633
644
|
// --- cost / budget ---
|
|
634
645
|
'cmd.cost.budgetHeader': '*预算*\n• 每日:$${dailyBudget}(已用:$${dailySpent},剩余:$${dailyRemaining})\n• 每月:$${monthlyBudget}(已用:$${monthlySpent},剩余:$${monthlyRemaining})',
|
|
646
|
+
'cmd.cost.budgetHeaderProject': '*预算 — ${project}*(${scope})\n• 每日:$${dailyBudget}(已用:$${dailySpent},剩余:$${dailyRemaining})\n• 每月:$${monthlyBudget}(已用:$${monthlySpent},剩余:$${monthlyRemaining})',
|
|
647
|
+
'cmd.cost.budgetScopeProject': '项目独立预算',
|
|
648
|
+
'cmd.cost.budgetScopeGlobal': '继承全局预算',
|
|
635
649
|
'cmd.cost.budgetUpdated': '预算已更新:$${daily}/天,$${monthly}/月',
|
|
650
|
+
'cmd.cost.budgetUpdatedProject': '`${project}` 的预算已更新:$${daily}/天,$${monthly}/月',
|
|
651
|
+
'cmd.cost.budgetCleared': '已移除 `${project}` 的项目预算 — 现在继承全局限额。',
|
|
652
|
+
'cmd.cost.budgetNoOverride': '`${project}` 没有设置项目预算 — 无需清除。',
|
|
653
|
+
'cmd.cost.budgetListHeader': '*预算*\n• 全局:$${daily}/天,$${monthly}/月',
|
|
654
|
+
'cmd.cost.budgetListEmpty': '没有项目级覆盖,所有项目都继承全局限额。',
|
|
655
|
+
'cmd.cost.budgetListItem': '• ${project}:$${daily}/天,$${monthly}/月',
|
|
656
|
+
'cmd.cost.budgetPairRequired': '项目预算必须同时设置日额和月额。用法:`!budget ${project} $50/d $1000/m`',
|
|
657
|
+
'cmd.cost.budgetUnknownProject': '未知项目:`${project}`。已知项目:${known}',
|
|
636
658
|
// --- index ---
|
|
637
659
|
'cmd.unknown': '未知命令:`${cmd}`。运行 `!help` 查看可用命令。',
|
|
638
660
|
'cmd.error': '命令错误:${error}',
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export declare const providersEn: {
|
|
2
|
+
'provider.cli.description': string;
|
|
3
|
+
'provider.cli.listDescription': string;
|
|
4
|
+
'provider.cli.addDescription': string;
|
|
5
|
+
'provider.cli.removeDescription': string;
|
|
6
|
+
'provider.cli.nameDescription': string;
|
|
7
|
+
'provider.cli.apiDescription': string;
|
|
8
|
+
'provider.cli.urlDescription': string;
|
|
9
|
+
'provider.cli.keyDescription': string;
|
|
10
|
+
'provider.cli.modelDescription': string;
|
|
11
|
+
'provider.cli.jsonDescription': string;
|
|
12
|
+
'provider.cli.dryRunDescription': string;
|
|
13
|
+
'provider.cli.helpDescription': string;
|
|
14
|
+
'provider.cli.exampleAdd': string;
|
|
15
|
+
'provider.cli.exampleAddPiped': string;
|
|
16
|
+
'provider.cli.exampleList': string;
|
|
17
|
+
'provider.cli.exampleRemove': string;
|
|
18
|
+
'provider.cli.unknownSubcommand': string;
|
|
19
|
+
'provider.cli.unknownFlag': string;
|
|
20
|
+
'provider.cli.missingFlag': string;
|
|
21
|
+
'provider.cli.flagNeedsValue': string;
|
|
22
|
+
'provider.cli.notFound': string;
|
|
23
|
+
'provider.cli.writeFailed': string;
|
|
24
|
+
'provider.cli.validValues': string;
|
|
25
|
+
'provider.cli.hint': string;
|
|
26
|
+
'provider.cli.listEmpty': string;
|
|
27
|
+
'provider.cli.listItem': string;
|
|
28
|
+
'provider.cli.listItemUnrouted': string;
|
|
29
|
+
'provider.cli.added': string;
|
|
30
|
+
'provider.cli.removed': string;
|
|
31
|
+
'provider.chat.usage': string;
|
|
32
|
+
'provider.chat.keyNotice': string;
|
|
33
|
+
'provider.issue.name-required': string;
|
|
34
|
+
'provider.issue.name-charset': string;
|
|
35
|
+
'provider.issue.name-reserved': string;
|
|
36
|
+
'provider.issue.api-invalid': string;
|
|
37
|
+
'provider.issue.upstream-required': string;
|
|
38
|
+
'provider.issue.upstream-scheme': string;
|
|
39
|
+
'provider.issue.models-required': string;
|
|
40
|
+
'provider.issue.model-id-required': string;
|
|
41
|
+
'provider.issue.model-id-duplicate': string;
|
|
42
|
+
'provider.issue.not-found': string;
|
|
43
|
+
'provider.issue.write-failed': string;
|
|
44
|
+
};
|
|
45
|
+
export declare const providersZh: Record<keyof typeof providersEn, string>;
|