@guuey/config 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Loqu, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # @guuey/config
2
+
3
+ Types, schema, and loader for `guuey.json` — the single config file that
4
+ describes a [guuey](https://guuey.com) agent app: the agent (framework,
5
+ prompt, model, runtime), its MCP servers (hosted / co-located / external),
6
+ and its ggui generative-UI assets.
7
+
8
+ ```ts
9
+ import { loadGuueyJson, safeParseGuueyJson } from "@guuey/config";
10
+
11
+ const { doc } = loadGuueyJson(projectRoot);
12
+ doc.agent.framework; // "claude-agent-sdk" | "openai-agents-sdk" | ...
13
+ doc.agent.mcpServers; // { todo: { kind: "hosted", server: "mcp-..." }, ... }
14
+ ```
15
+
16
+ The schema is the contract shared by `guuey dev`, `guuey deploy`, and the
17
+ hosted runtime — one file, validated the same way everywhere. Scaffold a
18
+ project that uses it with `npx @guuey/create-agentic-app`.
@@ -0,0 +1,65 @@
1
+ import { AgentJsonV1 } from './agent.js';
2
+ /**
3
+ * Walk up from `startDir` (default: `process.cwd()`) looking for an
4
+ * `agent.json`. Returns the absolute path to the first match, or
5
+ * `null` if no file is found within `maxDepth` levels.
6
+ *
7
+ * Stops at the filesystem root regardless of `maxDepth`. Never throws —
8
+ * a missing file is a valid result ("this repo is code-mode only"),
9
+ * not an error.
10
+ */
11
+ export declare function findAgentJson(startDir?: string, maxDepth?: number): string | null;
12
+ /**
13
+ * Error thrown when an `agent.json` fails to load — missing file,
14
+ * malformed JSON, schema validation failure, or an unresolvable
15
+ * `systemPrompt.file` reference. Wraps the underlying cause
16
+ * (`SyntaxError` / `ZodError` / filesystem error) on `.cause`.
17
+ */
18
+ export declare class AgentJsonLoadError extends Error {
19
+ readonly path: string;
20
+ constructor(message: string, path: string, options?: {
21
+ cause?: unknown;
22
+ });
23
+ }
24
+ /**
25
+ * The inlined, ready-to-snapshot form of `agent.json`. Identical
26
+ * shape to {@link AgentJsonV1} EXCEPT `systemPrompt` is always
27
+ * `string | undefined` — file references are resolved and inlined
28
+ * during load. The pod runtime never reads the filesystem; it sees
29
+ * only this resolved shape.
30
+ *
31
+ * `undefined` system prompt means "fall through to the platform
32
+ * default" (see `GUUEY_DEFAULT_SYSTEM_PROMPT` in `./system-prompt`).
33
+ */
34
+ export type ResolvedAgentJson = Omit<AgentJsonV1, 'systemPrompt'> & {
35
+ systemPrompt?: string;
36
+ };
37
+ /**
38
+ * Read `agent.json` at `path`, parse JSON, validate against v1, and
39
+ * inline any `systemPrompt.file` reference (resolved relative to the
40
+ * `agent.json` directory). Returns the fully-resolved snapshot.
41
+ *
42
+ * Throws {@link AgentJsonLoadError} if:
43
+ * - the file does not exist,
44
+ * - the file is not valid JSON,
45
+ * - the document fails schema validation (cause = `ZodError`),
46
+ * - `systemPrompt.file` points outside the project directory or
47
+ * does not exist on disk.
48
+ */
49
+ export declare function loadAgentJson(path: string): ResolvedAgentJson;
50
+ /**
51
+ * Non-throwing variant of {@link loadAgentJson}. Returns a
52
+ * discriminated result mirroring `z.safeParse` for ergonomics in CLI
53
+ * surfaces that render the error inline.
54
+ */
55
+ export type SafeLoadAgentResult = {
56
+ success: true;
57
+ data: ResolvedAgentJson;
58
+ } | {
59
+ success: false;
60
+ error: AgentJsonLoadError;
61
+ };
62
+ export declare function safeLoadAgentJson(path: string): SafeLoadAgentResult;
63
+ export { AGENT_JSON_FILENAME, AgentJsonV1, parseAgentJson, safeParseAgentJson, DEFAULT_AGENT_MCP_SERVERS, } from './agent.js';
64
+ export type { AgentJsonMcpServer, AgentJsonRuntime, AgentJsonSystemPrompt, AgentJsonToolGates, } from './agent.js';
65
+ //# sourceMappingURL=agent-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-loader.d.ts","sourceRoot":"","sources":["../src/agent-loader.ts"],"names":[],"mappings":"AAoBA,OAAO,EAEL,WAAW,EAEZ,MAAM,YAAY,CAAC;AAUpB;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,GAAE,MAAsB,EAChC,QAAQ,GAAE,MAA+B,GACxC,MAAM,GAAG,IAAI,CAUf;AAED;;;;;GAKG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAKzE;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG;IAClE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CA8C7D;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAC3B;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,iBAAiB,CAAA;CAAE,GAC1C;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,kBAAkB,CAAA;CAAE,CAAC;AAElD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,CASnE;AAoDD,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
@@ -0,0 +1,155 @@
1
+ /**
2
+ * Node-only filesystem helpers for `agent.json`.
3
+ *
4
+ * Pure-parse helpers (`parseAgentJson` / `safeParseAgentJson`) live in
5
+ * `./agent.ts` and are safe to import from non-Node contexts. This
6
+ * module adds the file-resolution layer: reading `agent.json` off
7
+ * disk, inlining `systemPrompt.file` references, and producing the
8
+ * snapshot the deploy upload + pod boot both read.
9
+ *
10
+ * Intended callers:
11
+ *
12
+ * - `guuey` CLI: `guuey deploy --config agent.json` reads the file,
13
+ * inlines the system prompt, and POSTs the resulting snapshot to
14
+ * the control plane as the no-tarball declarative deploy body.
15
+ * - Guuey control-plane services that re-validate the submitted
16
+ * snapshot server-side before persisting to AgentDeployment.
17
+ * - Stock nocode-runtime pod: reads the snapshot back at boot.
18
+ */
19
+ import { existsSync, readFileSync } from 'node:fs';
20
+ import { dirname, isAbsolute, join, resolve } from 'node:path';
21
+ import { AGENT_JSON_FILENAME, parseAgentJson, } from './agent.js';
22
+ /**
23
+ * How many parent directories `findAgentJson` will walk by default.
24
+ * Internal — the public-facing constant of the same name on
25
+ * `./loader.ts` is the one re-exported on the package barrel; the
26
+ * two values are kept in sync intentionally.
27
+ */
28
+ const DEFAULT_FIND_MAX_DEPTH = 8;
29
+ /**
30
+ * Walk up from `startDir` (default: `process.cwd()`) looking for an
31
+ * `agent.json`. Returns the absolute path to the first match, or
32
+ * `null` if no file is found within `maxDepth` levels.
33
+ *
34
+ * Stops at the filesystem root regardless of `maxDepth`. Never throws —
35
+ * a missing file is a valid result ("this repo is code-mode only"),
36
+ * not an error.
37
+ */
38
+ export function findAgentJson(startDir = process.cwd(), maxDepth = DEFAULT_FIND_MAX_DEPTH) {
39
+ let dir = resolve(startDir);
40
+ for (let i = 0; i <= maxDepth; i++) {
41
+ const candidate = join(dir, AGENT_JSON_FILENAME);
42
+ if (existsSync(candidate))
43
+ return candidate;
44
+ const parent = dirname(dir);
45
+ if (parent === dir)
46
+ return null;
47
+ dir = parent;
48
+ }
49
+ return null;
50
+ }
51
+ /**
52
+ * Error thrown when an `agent.json` fails to load — missing file,
53
+ * malformed JSON, schema validation failure, or an unresolvable
54
+ * `systemPrompt.file` reference. Wraps the underlying cause
55
+ * (`SyntaxError` / `ZodError` / filesystem error) on `.cause`.
56
+ */
57
+ export class AgentJsonLoadError extends Error {
58
+ path;
59
+ constructor(message, path, options) {
60
+ super(message, options);
61
+ this.name = 'AgentJsonLoadError';
62
+ this.path = path;
63
+ }
64
+ }
65
+ /**
66
+ * Read `agent.json` at `path`, parse JSON, validate against v1, and
67
+ * inline any `systemPrompt.file` reference (resolved relative to the
68
+ * `agent.json` directory). Returns the fully-resolved snapshot.
69
+ *
70
+ * Throws {@link AgentJsonLoadError} if:
71
+ * - the file does not exist,
72
+ * - the file is not valid JSON,
73
+ * - the document fails schema validation (cause = `ZodError`),
74
+ * - `systemPrompt.file` points outside the project directory or
75
+ * does not exist on disk.
76
+ */
77
+ export function loadAgentJson(path) {
78
+ if (!existsSync(path)) {
79
+ throw new AgentJsonLoadError(`agent.json not found at ${path}`, path);
80
+ }
81
+ let raw;
82
+ try {
83
+ raw = readFileSync(path, 'utf-8');
84
+ }
85
+ catch (cause) {
86
+ throw new AgentJsonLoadError(`Failed to read agent.json at ${path}`, path, { cause });
87
+ }
88
+ let decoded;
89
+ try {
90
+ decoded = JSON.parse(raw);
91
+ }
92
+ catch (cause) {
93
+ throw new AgentJsonLoadError(`agent.json at ${path} is not valid JSON`, path, { cause });
94
+ }
95
+ let parsed;
96
+ try {
97
+ parsed = parseAgentJson(decoded);
98
+ }
99
+ catch (cause) {
100
+ throw new AgentJsonLoadError(`agent.json at ${path} failed schema validation`, path, { cause });
101
+ }
102
+ const baseDir = dirname(path);
103
+ const resolvedPrompt = resolveSystemPrompt(parsed, baseDir, path);
104
+ const out = { ...parsed, systemPrompt: resolvedPrompt };
105
+ if (resolvedPrompt === undefined) {
106
+ delete out.systemPrompt;
107
+ }
108
+ return out;
109
+ }
110
+ export function safeLoadAgentJson(path) {
111
+ try {
112
+ return { success: true, data: loadAgentJson(path) };
113
+ }
114
+ catch (error) {
115
+ if (error instanceof AgentJsonLoadError) {
116
+ return { success: false, error };
117
+ }
118
+ throw error;
119
+ }
120
+ }
121
+ /**
122
+ * Resolve the `systemPrompt` field on a parsed `agent.json`. Returns
123
+ * `undefined` when the field is absent (caller falls through to the
124
+ * platform default). Inlines `{ file }` references relative to
125
+ * `baseDir`; rejects absolute paths and parent-directory escapes so
126
+ * the snapshot can't pull arbitrary host files into the deploy.
127
+ */
128
+ function resolveSystemPrompt(doc, baseDir, agentJsonPath) {
129
+ const sp = doc.systemPrompt;
130
+ if (sp === undefined)
131
+ return undefined;
132
+ if (typeof sp === 'string')
133
+ return sp;
134
+ const relPath = sp.file;
135
+ if (isAbsolute(relPath)) {
136
+ throw new AgentJsonLoadError(`systemPrompt.file "${relPath}" must be a relative path, not absolute`, agentJsonPath);
137
+ }
138
+ const resolved = resolve(baseDir, relPath);
139
+ const baseResolved = resolve(baseDir);
140
+ if (!resolved.startsWith(baseResolved + '/') && resolved !== baseResolved) {
141
+ throw new AgentJsonLoadError(`systemPrompt.file "${relPath}" resolves outside the project directory`, agentJsonPath);
142
+ }
143
+ if (!existsSync(resolved)) {
144
+ throw new AgentJsonLoadError(`systemPrompt.file "${relPath}" does not exist (looked at ${resolved})`, agentJsonPath);
145
+ }
146
+ try {
147
+ return readFileSync(resolved, 'utf-8').trim();
148
+ }
149
+ catch (cause) {
150
+ throw new AgentJsonLoadError(`Failed to read systemPrompt.file "${relPath}"`, agentJsonPath, { cause });
151
+ }
152
+ }
153
+ // Re-export pure schema + types from the same subpath so Node callers
154
+ // can do one import.
155
+ export { AGENT_JSON_FILENAME, AgentJsonV1, parseAgentJson, safeParseAgentJson, DEFAULT_AGENT_MCP_SERVERS, } from './agent.js';
@@ -0,0 +1,284 @@
1
+ /**
2
+ * `guuey.json#agent` — the agent section.
3
+ *
4
+ * The agent section describes the deployable agent: framework + model
5
+ * + system prompt + MCP host config + platform-feature opt-ins + deploy
6
+ * config. Read by `@guuey/host` at pod boot to construct the framework
7
+ * adapter; read by `@guuey/cli` to validate before submitting a deploy.
8
+ *
9
+ * Lives inside `guuey.json` post-2026-05-25 platform-architecture merge
10
+ * (slice 7.2). Previously a separate `agent.json` file. See
11
+ * `docs/plans/2026-05-25-platform-architecture.md` §14.2 for the
12
+ * field-by-field migration.
13
+ *
14
+ * **Minimal valid section** (all other fields default):
15
+ *
16
+ * ```jsonc
17
+ * {
18
+ * "framework": "claude-agent-sdk",
19
+ * "model": "claude-sonnet-5",
20
+ * "systemPrompt": { "file": "prompts/system.md" }
21
+ * }
22
+ * ```
23
+ *
24
+ * Defaults applied by the pod runtime when fields are absent:
25
+ * - `framework` → `'claude-agent-sdk'`
26
+ * - `mcpServers` → `{ ggui: { url: 'https://mcp.ggui.ai' } }` (platform default; declaring `mcpServers` REPLACES this — not merged)
27
+ * - `model` → framework-chosen default (Claude SDK → `claude-sonnet-5`)
28
+ * - `systemPrompt`→ `GUUEY_DEFAULT_SYSTEM_PROMPT` from `./system-prompt`
29
+ * - `auth` → `'anonymous'`
30
+ * - `memory` → `'thread'`
31
+ * - `storage` → `['user', 'app']`
32
+ * - `endpoint` → `{ kind: 'invoke', streaming: true }`
33
+ * - `deploy` → `{ size: 'xs', region: 'us-east-1' }`
34
+ *
35
+ * **Rules for extending:**
36
+ *
37
+ * 1. **Additive only within `schema: '1'` (top-level).** New optional fields on existing
38
+ * objects are safe. Breaking changes bump the file-level `schema` to `'2'`.
39
+ * 2. **Framework-neutral by default.** Fields meaningful to only one adapter (e.g. Claude's
40
+ * `permissions`, OpenAI's `tools.functions`) belong on a `framework`-scoped sub-block.
41
+ */
42
+ import { z } from 'zod';
43
+ /**
44
+ * Supported framework adapters. The pod runtime selects the matching
45
+ * `@guuey/framework-*` adapter at boot. `vanilla` skips the framework
46
+ * layer entirely — the agent loop is the bare Anthropic Messages API
47
+ * call with manual MCP tool wiring. Useful for benchmarking and for
48
+ * adapters not yet built.
49
+ */
50
+ export declare const AGENT_FRAMEWORKS: readonly ["claude-agent-sdk", "openai-agents-sdk", "google-adk", "vanilla"];
51
+ export type AgentFramework = (typeof AGENT_FRAMEWORKS)[number];
52
+ /**
53
+ * A single MCP server entry inside `agent.mcpServers`.
54
+ *
55
+ * Discriminated union on `kind` — one slot per hosting mode:
56
+ * - `colocated` — stdio child inside the agent pod
57
+ * - `hosted` — guuey-hosted registry MCP (Starter+)
58
+ * - `proxied` — 3rd-party SaaS via mcp-proxy credential broker (v2)
59
+ * - `external` — builder-hosted, reached by URL (plain or federated)
60
+ */
61
+ declare const McpServerSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
62
+ kind: z.ZodLiteral<"colocated">;
63
+ command: z.ZodString;
64
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
65
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
66
+ }, z.core.$strict>, z.ZodObject<{
67
+ kind: z.ZodLiteral<"hosted">;
68
+ server: z.ZodOptional<z.ZodString>;
69
+ source: z.ZodOptional<z.ZodString>;
70
+ devPort: z.ZodOptional<z.ZodNumber>;
71
+ }, z.core.$strict>, z.ZodObject<{
72
+ kind: z.ZodLiteral<"proxied">;
73
+ connection: z.ZodString;
74
+ }, z.core.$strict>, z.ZodObject<{
75
+ kind: z.ZodLiteral<"external">;
76
+ url: z.ZodURL;
77
+ transport: z.ZodOptional<z.ZodEnum<{
78
+ http: "http";
79
+ sse: "sse";
80
+ }>>;
81
+ federate: z.ZodOptional<z.ZodBoolean>;
82
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
83
+ devPort: z.ZodOptional<z.ZodNumber>;
84
+ }, z.core.$strict>], "kind">;
85
+ /**
86
+ * Tool-gate block — allowlist applied first (intersect with what the MCP
87
+ * server advertises), then denylist subtracts. Tool names are MCP-namespaced
88
+ * (`"<server>.<tool>"`). Bare names match across all connected servers.
89
+ */
90
+ declare const ToolGatesSchema: z.ZodObject<{
91
+ allowlist: z.ZodOptional<z.ZodArray<z.ZodString>>;
92
+ denylist: z.ZodOptional<z.ZodArray<z.ZodString>>;
93
+ }, z.core.$strict>;
94
+ /**
95
+ * Runtime knobs the pod applies when constructing the framework adapter.
96
+ * All optional with framework-chosen defaults.
97
+ *
98
+ * - `maxTurns` — cap on agent loop turns per user message. Stops runaway
99
+ * loops on misbehaving prompts. Default: framework default
100
+ * (Claude SDK = 25).
101
+ * - `temperature` — model sampling temperature passthrough.
102
+ */
103
+ declare const RuntimeConfigSchema: z.ZodObject<{
104
+ maxTurns: z.ZodOptional<z.ZodNumber>;
105
+ temperature: z.ZodOptional<z.ZodNumber>;
106
+ }, z.core.$strict>;
107
+ /**
108
+ * System prompt — string inline OR `{ file: 'prompts/system.md' }`.
109
+ * File references are resolved relative to `guuey.json` by the loader,
110
+ * which inlines the file contents into the snapshot before deploy upload.
111
+ */
112
+ declare const SystemPromptSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
113
+ file: z.ZodString;
114
+ }, z.core.$strict>]>;
115
+ /**
116
+ * Bedrock-style invocation endpoint config.
117
+ *
118
+ * `kind: 'invoke'` exposes `POST /agent/invoke` with multi-modal input and
119
+ * SSE response per `docs/plans/2026-05-25-platform-architecture.md` §6.
120
+ * Reserved for future endpoint kinds (`'connect'` for WebSocket bidirectional).
121
+ */
122
+ declare const EndpointConfigSchema: z.ZodObject<{
123
+ kind: z.ZodOptional<z.ZodLiteral<"invoke">>;
124
+ streaming: z.ZodOptional<z.ZodBoolean>;
125
+ }, z.core.$strict>;
126
+ /**
127
+ * Deploy config — pod size + region.
128
+ *
129
+ * Lives inside the `agent` section (was top-level on the pre-merge `guuey.json`).
130
+ * Mirror shape on `guuey.mcp.json#mcpServer.deploy` (future) — same field set,
131
+ * same semantics, just attached to a different artifact.
132
+ *
133
+ * Latent fields like `tier`, `maxPods`, `idleTimeoutMinutes` exist on the
134
+ * AgentDeployment DDB model but are platform-managed (Reserved per design
135
+ * doc §14.3) — not exposed in user-facing config.
136
+ */
137
+ declare const DeploySchema: z.ZodObject<{
138
+ size: z.ZodOptional<z.ZodEnum<{
139
+ xs: "xs";
140
+ sm: "sm";
141
+ md: "md";
142
+ lg: "lg";
143
+ xl: "xl";
144
+ }>>;
145
+ region: z.ZodOptional<z.ZodString>;
146
+ }, z.core.$strict>;
147
+ /**
148
+ * The agent section — composes runtime + platform features + deploy.
149
+ *
150
+ * Exported as a zod object so the top-level `GuueyJsonV1` schema (in
151
+ * `./schema.ts`) can nest it. Static type via {@link GuueyAgent}.
152
+ */
153
+ export declare const AgentSectionV1: z.ZodObject<{
154
+ mode: z.ZodOptional<z.ZodEnum<{
155
+ code: "code";
156
+ declarative: "declarative";
157
+ }>>;
158
+ framework: z.ZodOptional<z.ZodEnum<{
159
+ "claude-agent-sdk": "claude-agent-sdk";
160
+ "openai-agents-sdk": "openai-agents-sdk";
161
+ "google-adk": "google-adk";
162
+ vanilla: "vanilla";
163
+ }>>;
164
+ model: z.ZodOptional<z.ZodString>;
165
+ modelProvider: z.ZodOptional<z.ZodEnum<{
166
+ openai: "openai";
167
+ openrouter: "openrouter";
168
+ }>>;
169
+ systemPrompt: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
170
+ file: z.ZodString;
171
+ }, z.core.$strict>]>>;
172
+ mcpServers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
173
+ kind: z.ZodLiteral<"colocated">;
174
+ command: z.ZodString;
175
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
176
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
177
+ }, z.core.$strict>, z.ZodObject<{
178
+ kind: z.ZodLiteral<"hosted">;
179
+ server: z.ZodOptional<z.ZodString>;
180
+ source: z.ZodOptional<z.ZodString>;
181
+ devPort: z.ZodOptional<z.ZodNumber>;
182
+ }, z.core.$strict>, z.ZodObject<{
183
+ kind: z.ZodLiteral<"proxied">;
184
+ connection: z.ZodString;
185
+ }, z.core.$strict>, z.ZodObject<{
186
+ kind: z.ZodLiteral<"external">;
187
+ url: z.ZodURL;
188
+ transport: z.ZodOptional<z.ZodEnum<{
189
+ http: "http";
190
+ sse: "sse";
191
+ }>>;
192
+ federate: z.ZodOptional<z.ZodBoolean>;
193
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
194
+ devPort: z.ZodOptional<z.ZodNumber>;
195
+ }, z.core.$strict>], "kind">>>;
196
+ tools: z.ZodOptional<z.ZodObject<{
197
+ allowlist: z.ZodOptional<z.ZodArray<z.ZodString>>;
198
+ denylist: z.ZodOptional<z.ZodArray<z.ZodString>>;
199
+ }, z.core.$strict>>;
200
+ runtime: z.ZodOptional<z.ZodObject<{
201
+ maxTurns: z.ZodOptional<z.ZodNumber>;
202
+ temperature: z.ZodOptional<z.ZodNumber>;
203
+ }, z.core.$strict>>;
204
+ claude: z.ZodOptional<z.ZodObject<{
205
+ permissions: z.ZodOptional<z.ZodObject<{
206
+ mode: z.ZodOptional<z.ZodEnum<{
207
+ default: "default";
208
+ acceptEdits: "acceptEdits";
209
+ bypassPermissions: "bypassPermissions";
210
+ }>>;
211
+ }, z.core.$strict>>;
212
+ }, z.core.$strict>>;
213
+ auth: z.ZodOptional<z.ZodEnum<{
214
+ optional: "optional";
215
+ anonymous: "anonymous";
216
+ required: "required";
217
+ }>>;
218
+ memory: z.ZodOptional<z.ZodEnum<{
219
+ thread: "thread";
220
+ none: "none";
221
+ }>>;
222
+ storage: z.ZodOptional<z.ZodArray<z.ZodEnum<{
223
+ user: "user";
224
+ app: "app";
225
+ }>>>;
226
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
227
+ secrets: z.ZodOptional<z.ZodArray<z.ZodString>>;
228
+ endpoint: z.ZodOptional<z.ZodObject<{
229
+ kind: z.ZodOptional<z.ZodLiteral<"invoke">>;
230
+ streaming: z.ZodOptional<z.ZodBoolean>;
231
+ }, z.core.$strict>>;
232
+ deploy: z.ZodOptional<z.ZodObject<{
233
+ size: z.ZodOptional<z.ZodEnum<{
234
+ xs: "xs";
235
+ sm: "sm";
236
+ md: "md";
237
+ lg: "lg";
238
+ xl: "xl";
239
+ }>>;
240
+ region: z.ZodOptional<z.ZodString>;
241
+ }, z.core.$strict>>;
242
+ }, z.core.$strict>;
243
+ /** Static TypeScript type derived from {@link AgentSectionV1}. */
244
+ export type GuueyAgent = z.infer<typeof AgentSectionV1>;
245
+ /** Single mcpServers entry type. */
246
+ export type GuueyAgentMcpServer = z.infer<typeof McpServerSchema>;
247
+ /** Tool-gate block type. */
248
+ export type GuueyAgentToolGates = z.infer<typeof ToolGatesSchema>;
249
+ /** Runtime-config block type. */
250
+ export type GuueyAgentRuntime = z.infer<typeof RuntimeConfigSchema>;
251
+ /** System-prompt shape (string or `{ file }`). */
252
+ export type GuueyAgentSystemPrompt = z.infer<typeof SystemPromptSchema>;
253
+ /** Endpoint config type. */
254
+ export type GuueyAgentEndpoint = z.infer<typeof EndpointConfigSchema>;
255
+ /** Deploy config type. */
256
+ export type GuueyAgentDeploy = z.infer<typeof DeploySchema>;
257
+ /**
258
+ * Validate that no `mcpServers[*].headers` value carries a LITERAL secret.
259
+ * Returns a list of human-readable violation messages (empty = clean).
260
+ *
261
+ * Two layers:
262
+ * 1. Strip `${env.NAME}` refs from each value, then match the literal
263
+ * remainder against {@link SECRET_SHAPE_PATTERNS} → a baked secret in ANY
264
+ * header (e.g. `Authorization: Bearer sk-ant-...`).
265
+ * 2. For {@link SENSITIVE_HEADER_NAMES}, a value with NO `${env.NAME}` ref and
266
+ * a non-trivial literal (after removing scheme words) → a baked credential
267
+ * (e.g. `X-API-Key: abc123`, `Authorization: Basic <base64>`).
268
+ *
269
+ * Legit ref-based values (`Authorization: Bearer ${env.TOKEN}`,
270
+ * `X-API-Key: ${env.KEY}`) and non-secret literals (`Content-Type`) pass.
271
+ */
272
+ export declare function validateNoLiteralSecrets(agent: GuueyAgent | undefined): string[];
273
+ /**
274
+ * Platform default MCP server map. Applied by the pod when `agent.mcpServers`
275
+ * is absent. Exposed here so non-pod consumers (CLI dry-run, lints) can show
276
+ * the effective shape without duplicating the literal.
277
+ *
278
+ * The ggui server is `kind: 'external'` — it is builder-declared when present
279
+ * or injected by the platform at runtime. Federation still detects it by host
280
+ * (via `isGguiUrl`) regardless of which key it's declared under.
281
+ */
282
+ export declare const DEFAULT_AGENT_MCP_SERVERS: Record<string, GuueyAgentMcpServer>;
283
+ export {};
284
+ //# sourceMappingURL=agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,6EAKnB,CAAC;AACX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAoF/D;;;;;;;;GAQG;AACH,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;4BAKnB,CAAC;AAEH;;;;GAIG;AACH,QAAA,MAAM,eAAe;;;kBAGnB,CAAC;AAEH;;;;;;;;GAQG;AACH,QAAA,MAAM,mBAAmB;;;kBAGvB,CAAC;AAcH;;;;GAIG;AACH,QAAA,MAAM,kBAAkB;;oBAGtB,CAAC;AAEH;;;;;;GAMG;AACH,QAAA,MAAM,oBAAoB;;;kBAGxB,CAAC;AAEH;;;;;;;;;;GAUG;AACH,QAAA,MAAM,YAAY;;;;;;;;;kBAKhB,CAAC;AAsBH;;;;;GAKG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAoEzB,CAAC;AAEH,kEAAkE;AAClE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAExD,oCAAoC;AACpC,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAElE,4BAA4B;AAC5B,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAElE,iCAAiC;AACjC,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEpE,kDAAkD;AAClD,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAExE,4BAA4B;AAC5B,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEtE,0BAA0B;AAC1B,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAuE5D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,UAAU,GAAG,SAAS,GAC5B,MAAM,EAAE,CAiCV;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAEzE,CAAC"}