@octopi-agent/engine 0.90.11 → 0.98.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config-admin/agent-presets.d.ts +70 -0
- package/dist/config-admin/agent-presets.js +243 -0
- package/dist/config-admin/discover.d.ts +30 -0
- package/dist/config-admin/discover.js +48 -0
- package/dist/config-admin/env.d.ts +22 -0
- package/dist/config-admin/env.js +41 -0
- package/dist/config-admin/index.d.ts +20 -0
- package/dist/config-admin/index.js +15 -0
- package/dist/config-admin/model-presets.d.ts +75 -0
- package/dist/config-admin/model-presets.js +249 -0
- package/dist/config-admin/name-guard.d.ts +14 -0
- package/dist/config-admin/name-guard.js +24 -0
- package/dist/config-admin/patch.d.ts +56 -0
- package/dist/config-admin/patch.js +201 -0
- package/dist/config-admin/port.d.ts +68 -0
- package/dist/config-admin/port.js +21 -0
- package/dist/config-admin/redact.d.ts +39 -0
- package/dist/config-admin/redact.js +42 -0
- package/dist/config-schema/agent.d.ts +45 -1
- package/dist/config-schema/context.d.ts +6 -1
- package/dist/config-schema/context.js +8 -0
- package/dist/config-schema/engine.d.ts +110 -4
- package/dist/config-schema/governance.d.ts +45 -1
- package/dist/config-schema/governance.js +187 -0
- package/dist/config-schema/models.d.ts +5 -2
- package/dist/config-schema/models.js +4 -1
- package/dist/config-schema/observability.d.ts +9 -0
- package/dist/config-schema/observability.js +29 -0
- package/dist/config-schema/run.d.ts +3 -0
- package/dist/config-schema/run.js +14 -0
- package/dist/config.d.ts +29 -4
- package/dist/config.js +15 -4
- package/dist/harness/activation/dispatcher.d.ts +8 -2
- package/dist/harness/activation/dispatcher.js +33 -5
- package/dist/harness/activation/inbox.d.ts +87 -0
- package/dist/harness/activation/inbox.js +169 -0
- package/dist/harness/activation/runtime.d.ts +9 -8
- package/dist/harness/activation/runtime.js +100 -8
- package/dist/harness/activation/types.d.ts +19 -0
- package/dist/harness/activation/types.js +2 -0
- package/dist/harness/agent/builder.d.ts +26 -1
- package/dist/harness/agent/builder.js +85 -37
- package/dist/harness/agent/config-bridge.d.ts +5 -0
- package/dist/harness/agent/config-bridge.js +3 -0
- package/dist/harness/agent/config-integrity.d.ts +138 -0
- package/dist/harness/agent/config-integrity.js +235 -0
- package/dist/harness/agent/wire-agent-builder.js +7 -1
- package/dist/harness/collaboration/autonomous-subsystem/index.d.ts +2 -2
- package/dist/harness/collaboration/autonomous-subsystem/index.js +1 -1
- package/dist/harness/collaboration/autonomous-subsystem/loader.js +3 -0
- package/dist/harness/collaboration/autonomous-subsystem/sense/engine.js +19 -2
- package/dist/harness/collaboration/autonomous-subsystem/think/completion-guard.d.ts +40 -0
- package/dist/harness/collaboration/autonomous-subsystem/think/completion-guard.js +59 -0
- package/dist/harness/collaboration/autonomous-subsystem/think/executor.js +3 -1
- package/dist/harness/collaboration/autonomous-subsystem/think/index.d.ts +2 -0
- package/dist/harness/collaboration/autonomous-subsystem/think/index.js +1 -0
- package/dist/harness/collaboration/autonomous-subsystem/think/model-resolver.js +1 -1
- package/dist/harness/collaboration/autonomous-subsystem/types.d.ts +9 -0
- package/dist/harness/collaboration/delegation/child-run.js +21 -5
- package/dist/harness/collaboration/delegation/notifier.js +4 -3
- package/dist/harness/collaboration/delegation/service.js +2 -3
- package/dist/harness/collaboration/delegation/wiring.js +6 -5
- package/dist/harness/collaboration/orchestration/reflector/llm-reflector.d.ts +1 -1
- package/dist/harness/collaboration/orchestration/reflector/llm-reflector.js +1 -1
- package/dist/harness/context/capabilities/compact/engine.d.ts +30 -0
- package/dist/harness/context/capabilities/compact/engine.js +198 -46
- package/dist/harness/context/capabilities/compact/handover.d.ts +78 -0
- package/dist/harness/context/capabilities/compact/handover.js +107 -0
- package/dist/harness/context/capabilities/compact/index.d.ts +3 -1
- package/dist/harness/context/capabilities/compact/index.js +2 -1
- package/dist/harness/context/capabilities/compact/types.d.ts +30 -1
- package/dist/harness/context/capabilities/summary/executor.js +2 -1
- package/dist/harness/context/capabilities/summary/policies.js +8 -5
- package/dist/harness/context/capabilities/summary/resolver.d.ts +1 -1
- package/dist/harness/context/capabilities/summary/resolver.js +4 -4
- package/dist/harness/context/capabilities/summary/types.d.ts +2 -2
- package/dist/harness/context/constitution/default-agents.md +11 -10
- package/dist/harness/context/default-context-engine.d.ts +34 -4
- package/dist/harness/context/default-context-engine.js +194 -49
- package/dist/harness/context/hybrid-compressor.js +6 -0
- package/dist/harness/context/layers.d.ts +2 -4
- package/dist/harness/context/layers.js +9 -11
- package/dist/harness/context/llm-summarizer.d.ts +2 -8
- package/dist/harness/context/llm-summarizer.js +69 -91
- package/dist/harness/context/message-selector.js +4 -3
- package/dist/harness/context/summarize.d.ts +3 -1
- package/dist/harness/context/summarize.js +9 -4
- package/dist/harness/context/system-prompt-assembler.d.ts +2 -0
- package/dist/harness/context/system-prompt-assembler.js +1 -0
- package/dist/harness/context/truncate-compressor.js +7 -0
- package/dist/harness/context/turn-envelope.d.ts +3 -2
- package/dist/harness/context/turn-envelope.js +3 -2
- package/dist/harness/context/types.d.ts +33 -1
- package/dist/harness/extension/execution-environment/dangerous-commands.d.ts +28 -0
- package/dist/harness/extension/execution-environment/dangerous-commands.js +129 -0
- package/dist/harness/extension/execution-environment/effect-policy.d.ts +149 -8
- package/dist/harness/extension/execution-environment/effect-policy.js +274 -19
- package/dist/harness/extension/execution-environment/index.d.ts +4 -2
- package/dist/harness/extension/execution-environment/index.js +2 -1
- package/dist/harness/extension/execution-environment/kill-switch.d.ts +34 -0
- package/dist/harness/extension/execution-environment/kill-switch.js +46 -0
- package/dist/harness/extension/execution-environment/ops-audit.d.ts +204 -0
- package/dist/harness/extension/execution-environment/ops-audit.js +337 -0
- package/dist/harness/extension/execution-environment/privileged-exec.d.ts +158 -0
- package/dist/harness/extension/execution-environment/privileged-exec.js +418 -0
- package/dist/harness/extension/execution-environment/process-info.d.ts +180 -0
- package/dist/harness/extension/execution-environment/process-info.js +466 -0
- package/dist/harness/extension/execution-environment/process-isolation.d.ts +7 -0
- package/dist/harness/extension/execution-environment/process-isolation.js +9 -0
- package/dist/harness/extension/execution-environment/sandbox.d.ts +109 -0
- package/dist/harness/extension/execution-environment/sandbox.js +228 -21
- package/dist/harness/extension/execution-environment/tool-capabilities.d.ts +1 -1
- package/dist/harness/extension/execution-environment/tool-capabilities.js +6 -0
- package/dist/harness/extension/execution-environment/types.d.ts +19 -0
- package/dist/harness/extension/execution-environment/undo-log.d.ts +6 -2
- package/dist/harness/extension/execution-environment/undo-log.js +31 -10
- package/dist/harness/extension/plugin-ecosystem/channel-types.d.ts +5 -0
- package/dist/harness/extension/plugin-ecosystem/tools/allowlisted-run.js +33 -0
- package/dist/harness/extension/plugin-ecosystem/tools/ask-user.d.ts +4 -5
- package/dist/harness/extension/plugin-ecosystem/tools/ask-user.js +5 -15
- package/dist/harness/extension/plugin-ecosystem/tools/builtin.d.ts +3 -0
- package/dist/harness/extension/plugin-ecosystem/tools/builtin.js +70 -26
- package/dist/harness/extension/plugin-ecosystem/tools/document-tools.js +3 -9
- package/dist/harness/extension/plugin-ecosystem/tools/file-edit.js +3 -6
- package/dist/harness/extension/plugin-ecosystem/tools/file-ops.js +9 -5
- package/dist/harness/extension/plugin-ecosystem/tools/file-search.js +9 -130
- package/dist/harness/extension/plugin-ecosystem/tools/git-tools.js +122 -14
- package/dist/harness/extension/plugin-ecosystem/tools/index.d.ts +2 -0
- package/dist/harness/extension/plugin-ecosystem/tools/index.js +2 -0
- package/dist/harness/extension/plugin-ecosystem/tools/package-tools.js +4 -13
- package/dist/harness/extension/plugin-ecosystem/tools/platform.d.ts +25 -11
- package/dist/harness/extension/plugin-ecosystem/tools/platform.js +168 -62
- package/dist/harness/extension/plugin-ecosystem/tools/privileged-tool.d.ts +43 -0
- package/dist/harness/extension/plugin-ecosystem/tools/privileged-tool.js +350 -0
- package/dist/harness/extension/plugin-ecosystem/tools/process-tools.d.ts +30 -0
- package/dist/harness/extension/plugin-ecosystem/tools/process-tools.js +137 -0
- package/dist/harness/governance/human-in-the-loop/decision-cache.d.ts +54 -4
- package/dist/harness/governance/human-in-the-loop/decision-cache.js +42 -16
- package/dist/harness/governance/security/default-risk-policy.d.ts +1 -0
- package/dist/harness/governance/security/default-risk-policy.js +1 -0
- package/dist/harness/governance/security/default-security-guard.js +9 -0
- package/dist/harness/governance/security/index.d.ts +1 -0
- package/dist/harness/governance/security/index.js +2 -0
- package/dist/harness/governance/security/risk-evaluator.js +13 -0
- package/dist/harness/governance/security/risk-types.d.ts +12 -0
- package/dist/harness/governance/security/shell-parser-fallback.d.ts +29 -0
- package/dist/harness/governance/security/shell-parser-fallback.js +410 -0
- package/dist/harness/governance/security/shell-parser-shared.d.ts +83 -0
- package/dist/harness/governance/security/shell-parser-shared.js +188 -0
- package/dist/harness/governance/security/shell-parser-treesitter.d.ts +52 -0
- package/dist/harness/governance/security/shell-parser-treesitter.js +370 -0
- package/dist/harness/governance/security/shell-parser.d.ts +23 -10
- package/dist/harness/governance/security/shell-parser.js +37 -496
- package/dist/harness/governance/security/temp-path.d.ts +9 -0
- package/dist/harness/governance/security/temp-path.js +13 -2
- package/dist/harness/governance/security/vendor/README.md +24 -0
- package/dist/harness/governance/security/vendor/tree-sitter-bash.LICENSE.txt +21 -0
- package/dist/harness/governance/security/vendor/tree-sitter-bash.wasm +0 -0
- package/dist/harness/governance/session-acl/seed-roles.js +14 -0
- package/dist/harness/index.d.ts +2 -0
- package/dist/harness/index.js +2 -0
- package/dist/harness/knowledge/fts.js +1 -2
- package/dist/harness/knowledge/index-store.js +59 -9
- package/dist/harness/memory/index.d.ts +6 -2
- package/dist/harness/memory/index.js +4 -1
- package/dist/harness/memory/memory-events.d.ts +25 -0
- package/dist/harness/memory/memory-events.js +38 -0
- package/dist/harness/memory/sqlite/agent-db.js +15 -0
- package/dist/harness/memory/sqlite/keyword-search.d.ts +1 -0
- package/dist/harness/memory/sqlite/keyword-search.js +4 -3
- package/dist/harness/memory/sqlite/wisdom-store.d.ts +7 -2
- package/dist/harness/memory/sqlite/wisdom-store.js +51 -2
- package/dist/harness/memory/steward-policy.d.ts +3 -0
- package/dist/harness/memory/steward-policy.js +1 -1
- package/dist/harness/memory/types.d.ts +41 -3
- package/dist/harness/memory/wisdom-attribution.d.ts +136 -0
- package/dist/harness/memory/wisdom-attribution.js +287 -0
- package/dist/harness/memory/wisdom-events.d.ts +37 -0
- package/dist/harness/memory/wisdom-events.js +61 -0
- package/dist/harness/memory/wisdom-formation.d.ts +20 -1
- package/dist/harness/memory/wisdom-formation.js +55 -21
- package/dist/harness/memory/wisdom.d.ts +7 -2
- package/dist/harness/memory/wisdom.js +40 -2
- package/dist/harness/observability/observer/hub.js +8 -0
- package/dist/harness/observability/observer/run-snapshot.js +1 -0
- package/dist/harness/observability/observer/types.d.ts +4 -0
- package/dist/harness/run/agent/agent.d.ts +7 -0
- package/dist/harness/run/agent/agent.js +23 -1
- package/dist/harness/run/reliability/fallback-provider.d.ts +117 -5
- package/dist/harness/run/reliability/fallback-provider.js +262 -22
- package/dist/harness/run/reliability/harness-events.d.ts +24 -1
- package/dist/harness/run/reliability/model-error-policy.d.ts +32 -0
- package/dist/harness/run/reliability/model-error-policy.js +42 -0
- package/dist/harness/run/reliability/provider-wrapper.js +29 -2
- package/dist/harness/run/reliability/refusal-guard.d.ts +20 -0
- package/dist/harness/run/reliability/refusal-guard.js +102 -0
- package/dist/harness/run/reliability/run-agent.js +231 -33
- package/dist/harness/run/run-guard/default-run-guard.js +1 -1
- package/dist/harness/run/run-scope.d.ts +35 -0
- package/dist/harness/run/runner.d.ts +141 -2
- package/dist/harness/run/runner.js +592 -42
- package/dist/harness/session/attachments/llm-intent.js +2 -1
- package/dist/harness/session/tasks/render.d.ts +4 -1
- package/dist/harness/session/tasks/render.js +10 -7
- package/dist/harness/shared/events/agent-event-map.d.ts +66 -0
- package/dist/harness/shared/events/agent-event-map.js +5 -0
- package/dist/harness/shared/paths/glob.d.ts +52 -0
- package/dist/harness/shared/paths/glob.js +218 -0
- package/dist/harness/shared/paths/index.d.ts +84 -0
- package/dist/harness/shared/paths/index.js +179 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/integration/agent-runtime/channel-message-source.js +19 -1
- package/dist/integration/index.d.ts +2 -0
- package/dist/integration/index.js +1 -0
- package/dist/integration/observability/loop-watchdog.d.ts +56 -0
- package/dist/integration/observability/loop-watchdog.js +177 -0
- package/dist/integration/observability/metrics.d.ts +3 -0
- package/dist/integration/observability/metrics.js +18 -7
- package/dist/integration/providers/anthropic.d.ts +23 -0
- package/dist/integration/providers/anthropic.js +97 -12
- package/dist/integration/providers/fetch-timeout.d.ts +42 -0
- package/dist/integration/providers/fetch-timeout.js +51 -0
- package/dist/integration/providers/openai.d.ts +10 -0
- package/dist/integration/providers/openai.js +58 -11
- package/dist/integration/providers/provider-diagnostics.d.ts +80 -0
- package/dist/integration/providers/provider-diagnostics.js +89 -0
- package/dist/integration/providers/timeout-coherence.d.ts +52 -0
- package/dist/integration/providers/timeout-coherence.js +68 -0
- package/dist/integration/providers/wire-dump.d.ts +62 -0
- package/dist/integration/providers/wire-dump.js +111 -2
- package/dist/integration/storage/jsonl.js +4 -1
- package/dist/subsystems/cognition-steward/conceptualize/config.yaml +4 -2
- package/dist/subsystems/cognition-steward/conceptualize/handler.js +12 -20
- package/dist/subsystems/memory-steward/backfill/config.yaml +4 -2
- package/dist/subsystems/memory-steward/backfill/handler.js +44 -52
- package/dist/subsystems/wisdom-steward/attribute/SUBSYSTEM.md +24 -0
- package/dist/subsystems/wisdom-steward/attribute/config.yaml +60 -0
- package/dist/subsystems/wisdom-steward/attribute/handler.d.ts +23 -0
- package/dist/subsystems/wisdom-steward/attribute/handler.js +167 -0
- package/dist/subsystems/wisdom-steward/evaluate/handler.js +3 -1
- package/dist/subsystems/wisdom-steward/formation/config.yaml +12 -5
- package/dist/subsystems/wisdom-steward/formation/handler.js +12 -18
- package/dist/subsystems/wisdom-steward/govern/config.yaml +1 -1
- package/dist/subsystems/wisdom-steward/govern/handler.js +4 -0
- package/package.json +8 -2
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 配置脱敏 — WebUI 回显形态(arch/config-hot-reload.md §0)
|
|
3
|
+
*
|
|
4
|
+
* apiKey 只回显「是否已配置 + 引用形态」,绝不回显明文值。
|
|
5
|
+
* `${VAR}` 形态给变量名;明文形态只标记 `literal`。
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
const ENV_REF_PATTERN = /^\$\{(\w+)(?::-.*?)?\}$/;
|
|
10
|
+
/**
|
|
11
|
+
* 把 apiKey 字符串脱敏为 `RedactedSecret`
|
|
12
|
+
*
|
|
13
|
+
* @param value - 原始 apiKey(可能为 `${VAR}` 形态、明文或空)
|
|
14
|
+
* @returns 脱敏视图(不含明文)
|
|
15
|
+
*/
|
|
16
|
+
export function redactSecret(value) {
|
|
17
|
+
if (!value)
|
|
18
|
+
return { configured: false, ref: null };
|
|
19
|
+
const m = ENV_REF_PATTERN.exec(value);
|
|
20
|
+
if (m)
|
|
21
|
+
return { configured: true, ref: m[1] };
|
|
22
|
+
return { configured: true, ref: 'literal' };
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 脱敏单个 provider 配置
|
|
26
|
+
*
|
|
27
|
+
* @param name - provider 名
|
|
28
|
+
* @param pc - provider 配置(已展开 `${ENV}` 的运行时形态或 raw 形态均可)
|
|
29
|
+
* @returns 脱敏视图
|
|
30
|
+
*/
|
|
31
|
+
export function redactProvider(name, pc) {
|
|
32
|
+
const out = {
|
|
33
|
+
name,
|
|
34
|
+
baseUrl: typeof pc.baseUrl === 'string' ? pc.baseUrl : '',
|
|
35
|
+
api: typeof pc.api === 'string' ? pc.api : '',
|
|
36
|
+
models: Array.isArray(pc.models) ? pc.models : [],
|
|
37
|
+
apiKey: redactSecret(typeof pc.apiKey === 'string' ? pc.apiKey : undefined),
|
|
38
|
+
};
|
|
39
|
+
if (typeof pc.timeoutSeconds === 'number')
|
|
40
|
+
out.timeoutSeconds = pc.timeoutSeconds;
|
|
41
|
+
return out;
|
|
42
|
+
}
|
|
@@ -25,6 +25,8 @@ export declare const AgentConfigSchema: z.ZodObject<{
|
|
|
25
25
|
strict: "strict";
|
|
26
26
|
soft: "soft";
|
|
27
27
|
}>>;
|
|
28
|
+
refuseFinalSymlink: z.ZodOptional<z.ZodBoolean>;
|
|
29
|
+
pathDenylist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
28
30
|
shellEscape: z.ZodOptional<z.ZodEnum<{
|
|
29
31
|
deny: "deny";
|
|
30
32
|
confirm: "confirm";
|
|
@@ -53,14 +55,56 @@ export declare const AgentConfigSchema: z.ZodObject<{
|
|
|
53
55
|
maxBlobBytes: z.ZodOptional<z.ZodNumber>;
|
|
54
56
|
}, z.core.$strip>>;
|
|
55
57
|
shellJournal: z.ZodOptional<z.ZodEnum<{
|
|
56
|
-
snapshot: "snapshot";
|
|
57
58
|
off: "off";
|
|
59
|
+
snapshot: "snapshot";
|
|
58
60
|
}>>;
|
|
59
61
|
shellJournalLimit: z.ZodOptional<z.ZodObject<{
|
|
60
62
|
maxFiles: z.ZodOptional<z.ZodNumber>;
|
|
61
63
|
maxBytes: z.ZodOptional<z.ZodNumber>;
|
|
62
64
|
maxFileSize: z.ZodOptional<z.ZodNumber>;
|
|
63
65
|
}, z.core.$strip>>;
|
|
66
|
+
jail: z.ZodOptional<z.ZodEnum<{
|
|
67
|
+
none: "none";
|
|
68
|
+
auto: "auto";
|
|
69
|
+
require: "require";
|
|
70
|
+
}>>;
|
|
71
|
+
onJailUnavailable: z.ZodOptional<z.ZodEnum<{
|
|
72
|
+
refuse: "refuse";
|
|
73
|
+
degrade: "degrade";
|
|
74
|
+
}>>;
|
|
75
|
+
privilegedAck: z.ZodOptional<z.ZodString>;
|
|
76
|
+
escalation: z.ZodOptional<z.ZodObject<{
|
|
77
|
+
policy: z.ZodOptional<z.ZodEnum<{
|
|
78
|
+
full: "full";
|
|
79
|
+
none: "none";
|
|
80
|
+
allowlist: "allowlist";
|
|
81
|
+
}>>;
|
|
82
|
+
via: z.ZodOptional<z.ZodEnum<{
|
|
83
|
+
sudo: "sudo";
|
|
84
|
+
direct: "direct";
|
|
85
|
+
}>>;
|
|
86
|
+
allow: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
87
|
+
id: z.ZodOptional<z.ZodString>;
|
|
88
|
+
cmd: z.ZodString;
|
|
89
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
90
|
+
confirm: z.ZodOptional<z.ZodBoolean>;
|
|
91
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
92
|
+
}, z.core.$strict>>>;
|
|
93
|
+
}, z.core.$strict>>;
|
|
94
|
+
dangerousCommands: z.ZodOptional<z.ZodObject<{
|
|
95
|
+
policy: z.ZodOptional<z.ZodEnum<{
|
|
96
|
+
deny: "deny";
|
|
97
|
+
confirm: "confirm";
|
|
98
|
+
off: "off";
|
|
99
|
+
}>>;
|
|
100
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
101
|
+
}, z.core.$strict>>;
|
|
102
|
+
opsAudit: z.ZodOptional<z.ZodEnum<{
|
|
103
|
+
off: "off";
|
|
104
|
+
on: "on";
|
|
105
|
+
}>>;
|
|
106
|
+
opsAuditPath: z.ZodOptional<z.ZodString>;
|
|
107
|
+
opsAuditExportPath: z.ZodOptional<z.ZodString>;
|
|
64
108
|
}, z.core.$strip>>;
|
|
65
109
|
persona: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
66
110
|
name: z.ZodOptional<z.ZodString>;
|
|
@@ -20,6 +20,11 @@ export declare const ContextEngineConfigSchema: z.ZodObject<{
|
|
|
20
20
|
}>>;
|
|
21
21
|
protectFirstN: z.ZodOptional<z.ZodNumber>;
|
|
22
22
|
protectLastN: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
summaryBudget: z.ZodOptional<z.ZodObject<{
|
|
24
|
+
ratioPct: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
minTokens: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
}, z.core.$strip>>;
|
|
23
28
|
proactiveCompactRatio: z.ZodOptional<z.ZodNumber>;
|
|
24
29
|
proactiveCooldownMs: z.ZodOptional<z.ZodNumber>;
|
|
25
30
|
historyAging: z.ZodOptional<z.ZodObject<{
|
|
@@ -88,6 +93,7 @@ export declare const SummaryConfigSchema: z.ZodObject<{
|
|
|
88
93
|
kindFromSource: z.ZodOptional<z.ZodBoolean>;
|
|
89
94
|
informationalKinds: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
90
95
|
auto: "auto";
|
|
96
|
+
opaque: "opaque";
|
|
91
97
|
web_page: "web_page";
|
|
92
98
|
file_text: "file_text";
|
|
93
99
|
document: "document";
|
|
@@ -95,7 +101,6 @@ export declare const SummaryConfigSchema: z.ZodObject<{
|
|
|
95
101
|
api_json: "api_json";
|
|
96
102
|
log: "log";
|
|
97
103
|
conversation: "conversation";
|
|
98
|
-
opaque: "opaque";
|
|
99
104
|
}>>>;
|
|
100
105
|
onFail: z.ZodOptional<z.ZodEnum<{
|
|
101
106
|
error: "error";
|
|
@@ -29,6 +29,14 @@ export const ContextEngineConfigSchema = z.object({
|
|
|
29
29
|
type: z.enum(['default', 'custom']).optional(),
|
|
30
30
|
protectFirstN: z.number().min(0).optional(),
|
|
31
31
|
protectLastN: z.number().min(0).optional(),
|
|
32
|
+
/** 摘要软目标预算(P1c 缺省 clamp(2%, 2k, 8k)) */
|
|
33
|
+
summaryBudget: z
|
|
34
|
+
.object({
|
|
35
|
+
ratioPct: z.number().positive().optional(),
|
|
36
|
+
minTokens: z.number().positive().optional(),
|
|
37
|
+
maxTokens: z.number().positive().optional(),
|
|
38
|
+
})
|
|
39
|
+
.optional(),
|
|
32
40
|
/** 0 = 禁新的路径 A 压缩(不只禁 LLM;不丢粘滞视图);见 ContextEngineConfig JSDoc */
|
|
33
41
|
proactiveCompactRatio: z.number().min(0).max(1).optional(),
|
|
34
42
|
proactiveCooldownMs: z.number().min(0).optional(),
|
|
@@ -32,6 +32,8 @@ export declare const engineConfigSchema: z.ZodObject<{
|
|
|
32
32
|
strict: "strict";
|
|
33
33
|
soft: "soft";
|
|
34
34
|
}>>;
|
|
35
|
+
refuseFinalSymlink: z.ZodOptional<z.ZodBoolean>;
|
|
36
|
+
pathDenylist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
35
37
|
shellEscape: z.ZodOptional<z.ZodEnum<{
|
|
36
38
|
deny: "deny";
|
|
37
39
|
confirm: "confirm";
|
|
@@ -60,14 +62,56 @@ export declare const engineConfigSchema: z.ZodObject<{
|
|
|
60
62
|
maxBlobBytes: z.ZodOptional<z.ZodNumber>;
|
|
61
63
|
}, z.core.$strip>>;
|
|
62
64
|
shellJournal: z.ZodOptional<z.ZodEnum<{
|
|
63
|
-
snapshot: "snapshot";
|
|
64
65
|
off: "off";
|
|
66
|
+
snapshot: "snapshot";
|
|
65
67
|
}>>;
|
|
66
68
|
shellJournalLimit: z.ZodOptional<z.ZodObject<{
|
|
67
69
|
maxFiles: z.ZodOptional<z.ZodNumber>;
|
|
68
70
|
maxBytes: z.ZodOptional<z.ZodNumber>;
|
|
69
71
|
maxFileSize: z.ZodOptional<z.ZodNumber>;
|
|
70
72
|
}, z.core.$strip>>;
|
|
73
|
+
jail: z.ZodOptional<z.ZodEnum<{
|
|
74
|
+
none: "none";
|
|
75
|
+
auto: "auto";
|
|
76
|
+
require: "require";
|
|
77
|
+
}>>;
|
|
78
|
+
onJailUnavailable: z.ZodOptional<z.ZodEnum<{
|
|
79
|
+
refuse: "refuse";
|
|
80
|
+
degrade: "degrade";
|
|
81
|
+
}>>;
|
|
82
|
+
privilegedAck: z.ZodOptional<z.ZodString>;
|
|
83
|
+
escalation: z.ZodOptional<z.ZodObject<{
|
|
84
|
+
policy: z.ZodOptional<z.ZodEnum<{
|
|
85
|
+
full: "full";
|
|
86
|
+
none: "none";
|
|
87
|
+
allowlist: "allowlist";
|
|
88
|
+
}>>;
|
|
89
|
+
via: z.ZodOptional<z.ZodEnum<{
|
|
90
|
+
sudo: "sudo";
|
|
91
|
+
direct: "direct";
|
|
92
|
+
}>>;
|
|
93
|
+
allow: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
94
|
+
id: z.ZodOptional<z.ZodString>;
|
|
95
|
+
cmd: z.ZodString;
|
|
96
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
97
|
+
confirm: z.ZodOptional<z.ZodBoolean>;
|
|
98
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
99
|
+
}, z.core.$strict>>>;
|
|
100
|
+
}, z.core.$strict>>;
|
|
101
|
+
dangerousCommands: z.ZodOptional<z.ZodObject<{
|
|
102
|
+
policy: z.ZodOptional<z.ZodEnum<{
|
|
103
|
+
deny: "deny";
|
|
104
|
+
confirm: "confirm";
|
|
105
|
+
off: "off";
|
|
106
|
+
}>>;
|
|
107
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
108
|
+
}, z.core.$strict>>;
|
|
109
|
+
opsAudit: z.ZodOptional<z.ZodEnum<{
|
|
110
|
+
off: "off";
|
|
111
|
+
on: "on";
|
|
112
|
+
}>>;
|
|
113
|
+
opsAuditPath: z.ZodOptional<z.ZodString>;
|
|
114
|
+
opsAuditExportPath: z.ZodOptional<z.ZodString>;
|
|
71
115
|
}, z.core.$strip>>;
|
|
72
116
|
persona: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
73
117
|
name: z.ZodOptional<z.ZodString>;
|
|
@@ -157,7 +201,7 @@ export declare const engineConfigSchema: z.ZodObject<{
|
|
|
157
201
|
}>>;
|
|
158
202
|
providers: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
159
203
|
baseUrl: z.ZodString;
|
|
160
|
-
apiKey: z.ZodString
|
|
204
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
161
205
|
api: z.ZodEnum<{
|
|
162
206
|
"openai-completions": "openai-completions";
|
|
163
207
|
"anthropic-messages": "anthropic-messages";
|
|
@@ -174,6 +218,7 @@ export declare const engineConfigSchema: z.ZodObject<{
|
|
|
174
218
|
}>>>;
|
|
175
219
|
contextWindow: z.ZodOptional<z.ZodNumber>;
|
|
176
220
|
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
221
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
177
222
|
}, z.core.$strip>>;
|
|
178
223
|
timeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
179
224
|
}, z.core.$strip>>;
|
|
@@ -269,6 +314,9 @@ export declare const engineConfigSchema: z.ZodObject<{
|
|
|
269
314
|
modelCall: z.ZodOptional<z.ZodObject<{
|
|
270
315
|
idleTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
271
316
|
absoluteTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
317
|
+
fallbackAttemptTtftMs: z.ZodOptional<z.ZodNumber>;
|
|
318
|
+
fallbackDegradeTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
319
|
+
fallbackChatAttemptMs: z.ZodOptional<z.ZodNumber>;
|
|
272
320
|
}, z.core.$strip>>;
|
|
273
321
|
agentRuntime: z.ZodOptional<z.ZodObject<{
|
|
274
322
|
coalesceWindowMs: z.ZodOptional<z.ZodNumber>;
|
|
@@ -301,6 +349,11 @@ export declare const engineConfigSchema: z.ZodObject<{
|
|
|
301
349
|
}>>;
|
|
302
350
|
protectFirstN: z.ZodOptional<z.ZodNumber>;
|
|
303
351
|
protectLastN: z.ZodOptional<z.ZodNumber>;
|
|
352
|
+
summaryBudget: z.ZodOptional<z.ZodObject<{
|
|
353
|
+
ratioPct: z.ZodOptional<z.ZodNumber>;
|
|
354
|
+
minTokens: z.ZodOptional<z.ZodNumber>;
|
|
355
|
+
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
356
|
+
}, z.core.$strip>>;
|
|
304
357
|
proactiveCompactRatio: z.ZodOptional<z.ZodNumber>;
|
|
305
358
|
proactiveCooldownMs: z.ZodOptional<z.ZodNumber>;
|
|
306
359
|
historyAging: z.ZodOptional<z.ZodObject<{
|
|
@@ -369,6 +422,7 @@ export declare const engineConfigSchema: z.ZodObject<{
|
|
|
369
422
|
kindFromSource: z.ZodOptional<z.ZodBoolean>;
|
|
370
423
|
informationalKinds: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
371
424
|
auto: "auto";
|
|
425
|
+
opaque: "opaque";
|
|
372
426
|
web_page: "web_page";
|
|
373
427
|
file_text: "file_text";
|
|
374
428
|
document: "document";
|
|
@@ -376,7 +430,6 @@ export declare const engineConfigSchema: z.ZodObject<{
|
|
|
376
430
|
api_json: "api_json";
|
|
377
431
|
log: "log";
|
|
378
432
|
conversation: "conversation";
|
|
379
|
-
opaque: "opaque";
|
|
380
433
|
}>>>;
|
|
381
434
|
onFail: z.ZodOptional<z.ZodEnum<{
|
|
382
435
|
error: "error";
|
|
@@ -817,6 +870,8 @@ export declare const engineConfigSchema: z.ZodObject<{
|
|
|
817
870
|
strict: "strict";
|
|
818
871
|
soft: "soft";
|
|
819
872
|
}>>;
|
|
873
|
+
refuseFinalSymlink: z.ZodOptional<z.ZodBoolean>;
|
|
874
|
+
pathDenylist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
820
875
|
shellEscape: z.ZodOptional<z.ZodEnum<{
|
|
821
876
|
deny: "deny";
|
|
822
877
|
confirm: "confirm";
|
|
@@ -845,14 +900,56 @@ export declare const engineConfigSchema: z.ZodObject<{
|
|
|
845
900
|
maxBlobBytes: z.ZodOptional<z.ZodNumber>;
|
|
846
901
|
}, z.core.$strip>>;
|
|
847
902
|
shellJournal: z.ZodOptional<z.ZodEnum<{
|
|
848
|
-
snapshot: "snapshot";
|
|
849
903
|
off: "off";
|
|
904
|
+
snapshot: "snapshot";
|
|
850
905
|
}>>;
|
|
851
906
|
shellJournalLimit: z.ZodOptional<z.ZodObject<{
|
|
852
907
|
maxFiles: z.ZodOptional<z.ZodNumber>;
|
|
853
908
|
maxBytes: z.ZodOptional<z.ZodNumber>;
|
|
854
909
|
maxFileSize: z.ZodOptional<z.ZodNumber>;
|
|
855
910
|
}, z.core.$strip>>;
|
|
911
|
+
jail: z.ZodOptional<z.ZodEnum<{
|
|
912
|
+
none: "none";
|
|
913
|
+
auto: "auto";
|
|
914
|
+
require: "require";
|
|
915
|
+
}>>;
|
|
916
|
+
onJailUnavailable: z.ZodOptional<z.ZodEnum<{
|
|
917
|
+
refuse: "refuse";
|
|
918
|
+
degrade: "degrade";
|
|
919
|
+
}>>;
|
|
920
|
+
privilegedAck: z.ZodOptional<z.ZodString>;
|
|
921
|
+
escalation: z.ZodOptional<z.ZodObject<{
|
|
922
|
+
policy: z.ZodOptional<z.ZodEnum<{
|
|
923
|
+
full: "full";
|
|
924
|
+
none: "none";
|
|
925
|
+
allowlist: "allowlist";
|
|
926
|
+
}>>;
|
|
927
|
+
via: z.ZodOptional<z.ZodEnum<{
|
|
928
|
+
sudo: "sudo";
|
|
929
|
+
direct: "direct";
|
|
930
|
+
}>>;
|
|
931
|
+
allow: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
932
|
+
id: z.ZodOptional<z.ZodString>;
|
|
933
|
+
cmd: z.ZodString;
|
|
934
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
935
|
+
confirm: z.ZodOptional<z.ZodBoolean>;
|
|
936
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
937
|
+
}, z.core.$strict>>>;
|
|
938
|
+
}, z.core.$strict>>;
|
|
939
|
+
dangerousCommands: z.ZodOptional<z.ZodObject<{
|
|
940
|
+
policy: z.ZodOptional<z.ZodEnum<{
|
|
941
|
+
deny: "deny";
|
|
942
|
+
confirm: "confirm";
|
|
943
|
+
off: "off";
|
|
944
|
+
}>>;
|
|
945
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
946
|
+
}, z.core.$strict>>;
|
|
947
|
+
opsAudit: z.ZodOptional<z.ZodEnum<{
|
|
948
|
+
off: "off";
|
|
949
|
+
on: "on";
|
|
950
|
+
}>>;
|
|
951
|
+
opsAuditPath: z.ZodOptional<z.ZodString>;
|
|
952
|
+
opsAuditExportPath: z.ZodOptional<z.ZodString>;
|
|
856
953
|
}, z.core.$strip>>;
|
|
857
954
|
sessionAcl: z.ZodOptional<z.ZodObject<{
|
|
858
955
|
roles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -915,6 +1012,15 @@ export declare const engineConfigSchema: z.ZodObject<{
|
|
|
915
1012
|
dir: z.ZodOptional<z.ZodString>;
|
|
916
1013
|
maxCallsPerSession: z.ZodOptional<z.ZodNumber>;
|
|
917
1014
|
maxBodyBytes: z.ZodOptional<z.ZodNumber>;
|
|
1015
|
+
maxResponseChars: z.ZodOptional<z.ZodNumber>;
|
|
1016
|
+
}, z.core.$strip>>;
|
|
1017
|
+
loopWatchdog: z.ZodOptional<z.ZodObject<{
|
|
1018
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
1019
|
+
intervalMs: z.ZodOptional<z.ZodNumber>;
|
|
1020
|
+
stallThresholdMs: z.ZodOptional<z.ZodNumber>;
|
|
1021
|
+
reportFile: z.ZodOptional<z.ZodString>;
|
|
1022
|
+
captureSample: z.ZodOptional<z.ZodBoolean>;
|
|
1023
|
+
footprintThresholdMb: z.ZodOptional<z.ZodNumber>;
|
|
918
1024
|
}, z.core.$strip>>;
|
|
919
1025
|
}, z.core.$strip>>;
|
|
920
1026
|
observer: z.ZodOptional<z.ZodObject<{
|
|
@@ -69,6 +69,8 @@ export declare const EffectPolicyConfigSchema: z.ZodObject<{
|
|
|
69
69
|
strict: "strict";
|
|
70
70
|
soft: "soft";
|
|
71
71
|
}>>;
|
|
72
|
+
refuseFinalSymlink: z.ZodOptional<z.ZodBoolean>;
|
|
73
|
+
pathDenylist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
72
74
|
shellEscape: z.ZodOptional<z.ZodEnum<{
|
|
73
75
|
deny: "deny";
|
|
74
76
|
confirm: "confirm";
|
|
@@ -97,14 +99,56 @@ export declare const EffectPolicyConfigSchema: z.ZodObject<{
|
|
|
97
99
|
maxBlobBytes: z.ZodOptional<z.ZodNumber>;
|
|
98
100
|
}, z.core.$strip>>;
|
|
99
101
|
shellJournal: z.ZodOptional<z.ZodEnum<{
|
|
100
|
-
snapshot: "snapshot";
|
|
101
102
|
off: "off";
|
|
103
|
+
snapshot: "snapshot";
|
|
102
104
|
}>>;
|
|
103
105
|
shellJournalLimit: z.ZodOptional<z.ZodObject<{
|
|
104
106
|
maxFiles: z.ZodOptional<z.ZodNumber>;
|
|
105
107
|
maxBytes: z.ZodOptional<z.ZodNumber>;
|
|
106
108
|
maxFileSize: z.ZodOptional<z.ZodNumber>;
|
|
107
109
|
}, z.core.$strip>>;
|
|
110
|
+
jail: z.ZodOptional<z.ZodEnum<{
|
|
111
|
+
none: "none";
|
|
112
|
+
auto: "auto";
|
|
113
|
+
require: "require";
|
|
114
|
+
}>>;
|
|
115
|
+
onJailUnavailable: z.ZodOptional<z.ZodEnum<{
|
|
116
|
+
refuse: "refuse";
|
|
117
|
+
degrade: "degrade";
|
|
118
|
+
}>>;
|
|
119
|
+
privilegedAck: z.ZodOptional<z.ZodString>;
|
|
120
|
+
escalation: z.ZodOptional<z.ZodObject<{
|
|
121
|
+
policy: z.ZodOptional<z.ZodEnum<{
|
|
122
|
+
full: "full";
|
|
123
|
+
none: "none";
|
|
124
|
+
allowlist: "allowlist";
|
|
125
|
+
}>>;
|
|
126
|
+
via: z.ZodOptional<z.ZodEnum<{
|
|
127
|
+
sudo: "sudo";
|
|
128
|
+
direct: "direct";
|
|
129
|
+
}>>;
|
|
130
|
+
allow: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
131
|
+
id: z.ZodOptional<z.ZodString>;
|
|
132
|
+
cmd: z.ZodString;
|
|
133
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
134
|
+
confirm: z.ZodOptional<z.ZodBoolean>;
|
|
135
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
136
|
+
}, z.core.$strict>>>;
|
|
137
|
+
}, z.core.$strict>>;
|
|
138
|
+
dangerousCommands: z.ZodOptional<z.ZodObject<{
|
|
139
|
+
policy: z.ZodOptional<z.ZodEnum<{
|
|
140
|
+
deny: "deny";
|
|
141
|
+
confirm: "confirm";
|
|
142
|
+
off: "off";
|
|
143
|
+
}>>;
|
|
144
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
145
|
+
}, z.core.$strict>>;
|
|
146
|
+
opsAudit: z.ZodOptional<z.ZodEnum<{
|
|
147
|
+
off: "off";
|
|
148
|
+
on: "on";
|
|
149
|
+
}>>;
|
|
150
|
+
opsAuditPath: z.ZodOptional<z.ZodString>;
|
|
151
|
+
opsAuditExportPath: z.ZodOptional<z.ZodString>;
|
|
108
152
|
}, z.core.$strip>;
|
|
109
153
|
export declare const ToolIsolationConfigSchema: z.ZodEnum<{
|
|
110
154
|
none: "none";
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
import { ConfigPathSchema, SessionRightsSchema } from './shared.js';
|
|
8
|
+
import { validateDenyPattern } from '../harness/shared/paths/glob.js';
|
|
8
9
|
export const SecurityConfigSchema = z.object({
|
|
9
10
|
enforce: z.enum(['block', 'audit']).optional(),
|
|
10
11
|
injectionSensitivity: z.enum(['low', 'medium', 'high']).optional(),
|
|
@@ -59,6 +60,35 @@ export const EffectPolicyConfigSchema = z.object({
|
|
|
59
60
|
/** 额外事务 root(绝对路径或 ~ 形态);并入 allowRoots */
|
|
60
61
|
transactionRoots: z.array(ConfigPathSchema).optional(),
|
|
61
62
|
pathContainment: z.enum(['strict', 'soft', 'none']).optional(),
|
|
63
|
+
/**
|
|
64
|
+
* 拒绝最终组件为符号链接的文件读写(读写都拒,非跟随)。
|
|
65
|
+
* 缺省 false;`mode: 'untrusted'` 强制 true 且不可关闭。
|
|
66
|
+
*/
|
|
67
|
+
refuseFinalSymlink: z.boolean().optional(),
|
|
68
|
+
/**
|
|
69
|
+
* 拒绝匹配这些 glob 的路径(相对允许根匹配,同时匹配文件名)。
|
|
70
|
+
* 默认空 = 不拒绝任何路径;声明即拒绝,任何 pathContainment 级别都生效。
|
|
71
|
+
*
|
|
72
|
+
* 只收「能真正匹配」的形状:以 `/` 开头/结尾、含 `.`/`..` 段、空串一律在配置
|
|
73
|
+
* 加载期报错——一条永不命中的安全配置比没有配置更危险。
|
|
74
|
+
*/
|
|
75
|
+
pathDenylist: z
|
|
76
|
+
.array(z.string())
|
|
77
|
+
.optional()
|
|
78
|
+
.superRefine((patterns, ctx) => {
|
|
79
|
+
patterns?.forEach((pattern, index) => {
|
|
80
|
+
try {
|
|
81
|
+
validateDenyPattern(pattern);
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
ctx.addIssue({
|
|
85
|
+
code: z.ZodIssueCode.custom,
|
|
86
|
+
path: [index],
|
|
87
|
+
message: error instanceof Error ? error.message : String(error),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}),
|
|
62
92
|
shellEscape: z.enum(['deny', 'confirm', 'allow']).optional(),
|
|
63
93
|
processLimits: z.boolean().optional(),
|
|
64
94
|
commit: z.enum(['auto', 'manual']).optional(),
|
|
@@ -87,6 +117,163 @@ export const EffectPolicyConfigSchema = z.object({
|
|
|
87
117
|
maxFileSize: z.number().int().nonnegative().optional(),
|
|
88
118
|
})
|
|
89
119
|
.optional(),
|
|
120
|
+
/**
|
|
121
|
+
* 进程牢笼意图(ops P0):auto(缺省,按模式派生,缺笼如实降级 + 告警)|
|
|
122
|
+
* require(拿不到即拒)| none(显式无笼,需 privilegedAck)。
|
|
123
|
+
*/
|
|
124
|
+
jail: z.enum(['auto', 'require', 'none']).optional(),
|
|
125
|
+
/** jail 意图落空时:refuse 拒绝执行 | degrade(缺省)记 securityDegraded + 告警 */
|
|
126
|
+
onJailUnavailable: z.enum(['refuse', 'degrade']).optional(),
|
|
127
|
+
/** `jail: "none"` 时必填的显式表态(授权 ≠ 降级;§8.1) */
|
|
128
|
+
privilegedAck: z.string().min(1).optional(),
|
|
129
|
+
/** 提权策略(ops P3/P4):`allowlist` 按 cmd+args 全等放行;`full` 全量档(§4.1 严格前提) */
|
|
130
|
+
escalation: z
|
|
131
|
+
.object({
|
|
132
|
+
policy: z.enum(['none', 'allowlist', 'full']).optional(),
|
|
133
|
+
via: z.enum(['sudo', 'direct']).optional(),
|
|
134
|
+
allow: z
|
|
135
|
+
.array(
|
|
136
|
+
// strict:未知子键拒绝启动(`confrim` 拼错 = 确认闸静默消失,§6.1 教训)
|
|
137
|
+
z
|
|
138
|
+
.object({
|
|
139
|
+
id: z.string().min(1).optional(),
|
|
140
|
+
cmd: z.string().min(1),
|
|
141
|
+
args: z.array(z.string()).optional(),
|
|
142
|
+
confirm: z.boolean().optional(),
|
|
143
|
+
cwd: z.string().min(1).optional(),
|
|
144
|
+
})
|
|
145
|
+
.strict())
|
|
146
|
+
.optional(),
|
|
147
|
+
})
|
|
148
|
+
.strict()
|
|
149
|
+
.optional(),
|
|
150
|
+
/**
|
|
151
|
+
* 危险命令减速带(§6:只拦事故不拦攻击)。命中保守分类表的 argv:
|
|
152
|
+
* `confirm`(缺省)走 HitlDecision 确认 | `deny` 直接拒绝 | `off` 关闭分类。
|
|
153
|
+
* `timeoutMs` 确认超时(超时一律 deny,outcome 不可配);缺省 120000。
|
|
154
|
+
*/
|
|
155
|
+
dangerousCommands: z
|
|
156
|
+
.object({
|
|
157
|
+
policy: z.enum(['confirm', 'deny', 'off']).optional(),
|
|
158
|
+
timeoutMs: z.number().int().positive().optional(),
|
|
159
|
+
})
|
|
160
|
+
.strict()
|
|
161
|
+
.optional(),
|
|
162
|
+
/** ops 审计账本开关(安全字段:重启生效 + 宿主署名);缺省 `on` */
|
|
163
|
+
opsAudit: z.enum(['on', 'off']).optional(),
|
|
164
|
+
/** ops 审计账本路径(缺省 `<OCTOPI_HOME>/audit/ops.<agentId>.jsonl`) */
|
|
165
|
+
opsAuditPath: z.string().min(1).optional(),
|
|
166
|
+
/**
|
|
167
|
+
* 审计外送收口路径(P5 原则 8 唯一不可抵赖档);缺省不外送。
|
|
168
|
+
* 必须放在 agent 可写面之外(放 `~/.octopi` 内等于没外送)。
|
|
169
|
+
*/
|
|
170
|
+
opsAuditExportPath: z.string().min(1).optional(),
|
|
171
|
+
}).superRefine((v, ctx) => {
|
|
172
|
+
// 配置矛盾 fail-closed(§4.1):拒绝启动,不做静默取舍
|
|
173
|
+
if (v.jail === 'none') {
|
|
174
|
+
if (!v.privilegedAck?.trim()) {
|
|
175
|
+
ctx.addIssue({
|
|
176
|
+
code: z.ZodIssueCode.custom,
|
|
177
|
+
path: ['privilegedAck'],
|
|
178
|
+
message: 'jail=none requires privilegedAck (explicit unjailed choice)',
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
if (v.mode === 'untrusted') {
|
|
182
|
+
ctx.addIssue({
|
|
183
|
+
code: z.ZodIssueCode.custom,
|
|
184
|
+
path: ['jail'],
|
|
185
|
+
message: 'jail=none cannot combine with mode=untrusted (untrusted promises a jail)',
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (v.jail === 'none' && v.onJailUnavailable === 'refuse') {
|
|
190
|
+
ctx.addIssue({
|
|
191
|
+
code: z.ZodIssueCode.custom,
|
|
192
|
+
path: ['onJailUnavailable'],
|
|
193
|
+
message: 'onJailUnavailable=refuse has no meaning under jail=none (remove it, or use jail=auto/require)',
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
// 注:effectPolicy.network 目前不在配置 schema(library-only);jail=none 下
|
|
197
|
+
// network=deny/allowlist 的拒绝在 resolveEffectiveEffectPolicy 守卫
|
|
198
|
+
if ((v.jail === 'require' || v.onJailUnavailable === 'refuse') &&
|
|
199
|
+
v.untrustedAdmission === 'degrade') {
|
|
200
|
+
ctx.addIssue({
|
|
201
|
+
code: z.ZodIssueCode.custom,
|
|
202
|
+
path: ['jail'],
|
|
203
|
+
message: 'jail=require/onJailUnavailable=refuse contradicts untrustedAdmission=degrade (same condition, opposite outcomes)',
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
// ops P3:提权规则纯形状矛盾(TOCTOU/启动探测在 resolve 与 daemon 层)
|
|
207
|
+
if (v.escalation && v.escalation.policy !== undefined && v.escalation.policy !== 'none' && v.mode === 'untrusted') {
|
|
208
|
+
ctx.addIssue({
|
|
209
|
+
code: z.ZodIssueCode.custom,
|
|
210
|
+
path: ['escalation', 'policy'],
|
|
211
|
+
message: 'escalation cannot combine with mode=untrusted (untrusted promises a jail)',
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
if (v.escalation?.policy === 'full') {
|
|
215
|
+
// §4.1 全量档:矛盾 fail-closed(v1 矛盾规则收缩到 full 档;allowlist 档不矛盾)
|
|
216
|
+
if (v.mode !== 'host') {
|
|
217
|
+
ctx.addIssue({
|
|
218
|
+
code: z.ZodIssueCode.custom,
|
|
219
|
+
path: ['escalation', 'policy'],
|
|
220
|
+
message: 'escalation.policy=full requires mode=host (explicitly designated machine)',
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
if (v.jail !== 'none') {
|
|
224
|
+
ctx.addIssue({
|
|
225
|
+
code: z.ZodIssueCode.custom,
|
|
226
|
+
path: ['escalation', 'policy'],
|
|
227
|
+
message: 'escalation.policy=full requires jail=none (whole-shell freedom contradicts a jailed shell)',
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
if (!v.privilegedAck?.trim()) {
|
|
231
|
+
ctx.addIssue({
|
|
232
|
+
code: z.ZodIssueCode.custom,
|
|
233
|
+
path: ['privilegedAck'],
|
|
234
|
+
message: 'escalation.policy=full requires privilegedAck (explicit privileged declaration)',
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
if ((v.escalation.allow ?? []).length > 0) {
|
|
238
|
+
// 死键 fail-loud:full 档没有 allowlist 面(§6.1 教训:静默忽略 = 误导配置读者)
|
|
239
|
+
ctx.addIssue({
|
|
240
|
+
code: z.ZodIssueCode.custom,
|
|
241
|
+
path: ['escalation', 'allow'],
|
|
242
|
+
message: 'escalation.policy=full takes no escalation.allow rules (remove them, or use policy=allowlist)',
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (v.escalation?.policy === 'allowlist') {
|
|
247
|
+
const rules = v.escalation.allow ?? [];
|
|
248
|
+
if (rules.length === 0) {
|
|
249
|
+
ctx.addIssue({
|
|
250
|
+
code: z.ZodIssueCode.custom,
|
|
251
|
+
path: ['escalation', 'allow'],
|
|
252
|
+
message: 'escalation.policy=allowlist requires non-empty escalation.allow rules',
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
const seen = new Set();
|
|
256
|
+
for (const [i, rule] of rules.entries()) {
|
|
257
|
+
const absolute = rule.cmd.startsWith('/') || /^[a-zA-Z]:[\\/]/.test(rule.cmd);
|
|
258
|
+
if (!absolute) {
|
|
259
|
+
ctx.addIssue({
|
|
260
|
+
code: z.ZodIssueCode.custom,
|
|
261
|
+
path: ['escalation', 'allow', i, 'cmd'],
|
|
262
|
+
message: 'escalation rule cmd must be an absolute path (PATH resolution = replaceable binary)',
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
// 重复 (cmd,args):后写的 confirm:true 会被先命中者静默忽略 → 查重拒绝
|
|
266
|
+
const dupKey = JSON.stringify([rule.cmd, rule.args ?? []]);
|
|
267
|
+
if (seen.has(dupKey)) {
|
|
268
|
+
ctx.addIssue({
|
|
269
|
+
code: z.ZodIssueCode.custom,
|
|
270
|
+
path: ['escalation', 'allow', i],
|
|
271
|
+
message: 'duplicate escalation rule (cmd,args) — the first match wins silently',
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
seen.add(dupKey);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
90
277
|
});
|
|
91
278
|
export const ToolIsolationConfigSchema = z.enum(['none', 'session-subdir', 'session-lock']);
|
|
92
279
|
/**
|
|
@@ -11,7 +11,7 @@ export declare const ModelsConfigSchema: z.ZodObject<{
|
|
|
11
11
|
}>>;
|
|
12
12
|
providers: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
13
13
|
baseUrl: z.ZodString;
|
|
14
|
-
apiKey: z.ZodString
|
|
14
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
15
15
|
api: z.ZodEnum<{
|
|
16
16
|
"openai-completions": "openai-completions";
|
|
17
17
|
"anthropic-messages": "anthropic-messages";
|
|
@@ -28,6 +28,7 @@ export declare const ModelsConfigSchema: z.ZodObject<{
|
|
|
28
28
|
}>>>;
|
|
29
29
|
contextWindow: z.ZodOptional<z.ZodNumber>;
|
|
30
30
|
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
31
32
|
}, z.core.$strip>>;
|
|
32
33
|
timeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
33
34
|
}, z.core.$strip>>;
|
|
@@ -124,7 +125,7 @@ export declare const EmbeddingModelConfigSchemaExport: z.ZodObject<{
|
|
|
124
125
|
}, z.core.$strip>;
|
|
125
126
|
export declare const ModelProviderConfigSchemaExport: z.ZodObject<{
|
|
126
127
|
baseUrl: z.ZodString;
|
|
127
|
-
apiKey: z.ZodString
|
|
128
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
128
129
|
api: z.ZodEnum<{
|
|
129
130
|
"openai-completions": "openai-completions";
|
|
130
131
|
"anthropic-messages": "anthropic-messages";
|
|
@@ -141,6 +142,7 @@ export declare const ModelProviderConfigSchemaExport: z.ZodObject<{
|
|
|
141
142
|
}>>>;
|
|
142
143
|
contextWindow: z.ZodOptional<z.ZodNumber>;
|
|
143
144
|
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
145
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
144
146
|
}, z.core.$strip>>;
|
|
145
147
|
timeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
146
148
|
}, z.core.$strip>;
|
|
@@ -156,4 +158,5 @@ export declare const ModelCapabilitySchemaExport: z.ZodObject<{
|
|
|
156
158
|
}>>>;
|
|
157
159
|
contextWindow: z.ZodOptional<z.ZodNumber>;
|
|
158
160
|
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
161
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
159
162
|
}, z.core.$strip>;
|