@agentproto/runtime 3.6.1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,134 @@
1
+ import { z } from 'zod';
2
+ import { DaemonConfig, TunnelConfig, FeaturesConfig, PairingConfig, WorktreesConfig, SpawnConfig, SessionsConfig, ProvenanceConfig, AgentsMdConfig, TitlerConfig, ProfileConfig, AcpAgentConfigEntry, TerminalPreset } from './config.js';
3
+ import { S as SpawnDefaultsConfig } from './spawn-defaults-CZj39Znq.js';
4
+ import './context-continuity-Bn99UtVC.js';
5
+ import '@agentproto/acp';
6
+ import '@agentproto/command-sandbox';
7
+ import '@agentproto/model-catalog';
8
+
9
+ /**
10
+ * Zod mirror of `AgentprotoConfig` (`config.ts`) plus a declared registry of
11
+ * every writable key path (`CONFIG_KEYS`) — apply timing, env override,
12
+ * secret/lockout status, and section. `AgentprotoConfig` stays the source of
13
+ * truth (loader/CLI code keeps using the plain interface); this schema exists
14
+ * to VALIDATE what's on disk and to give a future `config_get`/`config_set`
15
+ * (PR-2, see `.plans/agentproto-config/PLAN.md`) one declared surface instead
16
+ * of N bespoke tools.
17
+ *
18
+ * Every object schema is `.passthrough()` so an unknown key survives a
19
+ * validate-then-resave round trip exactly like `loadConfig`/`saveConfig`
20
+ * already preserve unknown keys today (`config.ts:525-526`) — this schema
21
+ * narrows, it never drops.
22
+ */
23
+
24
+ /**
25
+ * Top-level mirror of `AgentprotoConfig`. `.passthrough()` at every level
26
+ * (including here) means an unknown top-level key round-trips unchanged,
27
+ * matching `AgentprotoConfig`'s own `[unknown: string]: unknown` index
28
+ * signature.
29
+ */
30
+ declare const agentprotoConfigSchema: z.ZodObject<{
31
+ version: z.ZodOptional<z.ZodNumber>;
32
+ daemon: z.ZodOptional<z.ZodType<DaemonConfig, unknown, z.core.$ZodTypeInternals<DaemonConfig, unknown>>>;
33
+ tunnel: z.ZodOptional<z.ZodType<TunnelConfig, unknown, z.core.$ZodTypeInternals<TunnelConfig, unknown>>>;
34
+ features: z.ZodOptional<z.ZodType<FeaturesConfig, unknown, z.core.$ZodTypeInternals<FeaturesConfig, unknown>>>;
35
+ pairing: z.ZodOptional<z.ZodType<PairingConfig, unknown, z.core.$ZodTypeInternals<PairingConfig, unknown>>>;
36
+ worktrees: z.ZodOptional<z.ZodType<WorktreesConfig, unknown, z.core.$ZodTypeInternals<WorktreesConfig, unknown>>>;
37
+ spawn: z.ZodOptional<z.ZodType<SpawnConfig, unknown, z.core.$ZodTypeInternals<SpawnConfig, unknown>>>;
38
+ sessions: z.ZodOptional<z.ZodType<SessionsConfig, unknown, z.core.$ZodTypeInternals<SessionsConfig, unknown>>>;
39
+ provenance: z.ZodOptional<z.ZodType<ProvenanceConfig, unknown, z.core.$ZodTypeInternals<ProvenanceConfig, unknown>>>;
40
+ agentsMd: z.ZodOptional<z.ZodType<AgentsMdConfig, unknown, z.core.$ZodTypeInternals<AgentsMdConfig, unknown>>>;
41
+ titler: z.ZodOptional<z.ZodType<TitlerConfig, unknown, z.core.$ZodTypeInternals<TitlerConfig, unknown>>>;
42
+ profiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<ProfileConfig, unknown, z.core.$ZodTypeInternals<ProfileConfig, unknown>>>>;
43
+ activeProfile: z.ZodOptional<z.ZodString>;
44
+ defaults: z.ZodOptional<z.ZodType<SpawnDefaultsConfig, unknown, z.core.$ZodTypeInternals<SpawnDefaultsConfig, unknown>>>;
45
+ acpAgents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<AcpAgentConfigEntry, unknown, z.core.$ZodTypeInternals<AcpAgentConfigEntry, unknown>>>>;
46
+ terminalPresets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<TerminalPreset, unknown, z.core.$ZodTypeInternals<TerminalPreset, unknown>>>>;
47
+ }, z.core.$loose>;
48
+ type ConfigKeyApply = "hot" | "restart";
49
+ type ConfigKeySection = "wallets" | "harnesses" | "models" | "defaults" | "remote" | "daemon" | "advanced";
50
+ interface ConfigKeyEntry {
51
+ /** Dot-notation path; `*` stands in for a record's dynamic key. */
52
+ path: string;
53
+ /** Validates a single value written at this path. */
54
+ schema: z.ZodTypeAny;
55
+ /** `"hot"`: re-read from disk at next use (next spawn / next call).
56
+ * `"restart"`: read once at daemon boot; a write needs a restart to
57
+ * take effect. */
58
+ apply: ConfigKeyApply;
59
+ /** Env var that silently shadows this key's file value, if any. */
60
+ env?: string;
61
+ /** The value is credential material — never echoed back in full, only
62
+ * `{ set }` (see `redactConfigValue`). */
63
+ secret?: true;
64
+ /** False for a key that a future config_set must refuse (secret
65
+ * credential fields and daemon-lockout fields) — hand-edit only. */
66
+ writable: boolean;
67
+ section: ConfigKeySection;
68
+ label: string;
69
+ help: string;
70
+ /** Effective default when the key is absent. Omitted when there is no
71
+ * single default (e.g. the default is conditional, or the daemon
72
+ * requires the operator to set it explicitly). */
73
+ default?: unknown;
74
+ }
75
+ declare const CONFIG_KEYS: readonly ConfigKeyEntry[];
76
+ /** Keys the schema declares that are deliberately NOT in {@link CONFIG_KEYS}
77
+ * — every leaf the drift test finds must land in one list or the other. */
78
+ interface ConfigKeyNotExposedEntry {
79
+ path: string;
80
+ reason: string;
81
+ }
82
+ declare const CONFIG_KEYS_NOT_EXPOSED: readonly ConfigKeyNotExposedEntry[];
83
+ /** Look up a `CONFIG_KEYS` entry for a concrete dotted path (e.g.
84
+ * `defaults.adapters.claude-code.skills`), matching any `*` wildcard
85
+ * segment. Returns `undefined` for a path with no registered entry. */
86
+ declare function findConfigKey(path: string): ConfigKeyEntry | undefined;
87
+ /**
88
+ * Walk the schema and return every leaf path that has NEITHER a
89
+ * {@link CONFIG_KEYS} entry NOR a {@link CONFIG_KEYS_NOT_EXPOSED} entry.
90
+ * A record (`z.record`) contributes one `*` path segment and the walk
91
+ * continues into its value schema; any path already classified (exact
92
+ * match, including a classified record-of-object like `profiles` or
93
+ * `defaults.contextContinuity`) is treated as an intentionally opaque unit
94
+ * and is NOT descended into further. Exported so the drift test (and any
95
+ * future tooling) can call it directly against {@link agentprotoConfigSchema}.
96
+ */
97
+ declare function findUnclassifiedConfigPaths(schema?: z.ZodTypeAny): string[];
98
+ interface ConfigValidationResult {
99
+ ok: boolean;
100
+ issues: string[];
101
+ }
102
+ /** Validate a whole config object against {@link agentprotoConfigSchema}.
103
+ * Never throws — returns the list of human-readable issues on failure. */
104
+ declare function validateConfig(raw: unknown): ConfigValidationResult;
105
+ interface ConfigKeyValueValidationResult {
106
+ ok: boolean;
107
+ error?: string;
108
+ }
109
+ /**
110
+ * Validate a single value's TYPE against the registry entry's schema for
111
+ * `path` — no writability check. An unregistered path is accepted
112
+ * (`ok: true`); the CLI (`agentproto config set`, the owner's own
113
+ * escape hatch) uses this, not {@link validateConfigKeyValue}, because
114
+ * `writable` is a policy for the future MCP/app surface, not for the local
115
+ * CLI.
116
+ */
117
+ declare function validateConfigKeyType(path: string, value: unknown): ConfigKeyValueValidationResult;
118
+ /**
119
+ * Validate a single value against the registry entry for `path`: type AND
120
+ * writability. For the future MCP/app `config_set` surface, which must
121
+ * refuse secret and lockout keys outright (`writable: false`) — the local
122
+ * CLI is exempt from this and uses {@link validateConfigKeyType} instead.
123
+ * An unregistered path is accepted (`ok: true`).
124
+ */
125
+ declare function validateConfigKeyValue(path: string, value: unknown): ConfigKeyValueValidationResult;
126
+ /**
127
+ * Redact a value read from a secret key path. Fingerprinting is deferred to
128
+ * a later PR (see `@agentproto/auth`'s `credentialIdentity`) — for now this
129
+ * only ever reveals whether a value is SET, never any part of it. A
130
+ * non-secret path (or a path with no registry entry) is returned unchanged.
131
+ */
132
+ declare function redactConfigValue(path: string, value: unknown): unknown;
133
+
134
+ export { CONFIG_KEYS, CONFIG_KEYS_NOT_EXPOSED, type ConfigKeyApply, type ConfigKeyEntry, type ConfigKeyNotExposedEntry, type ConfigKeySection, type ConfigKeyValueValidationResult, type ConfigValidationResult, agentprotoConfigSchema, findConfigKey, findUnclassifiedConfigPaths, redactConfigValue, validateConfig, validateConfigKeyType, validateConfigKeyValue };