@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/dist/schema.js ADDED
@@ -0,0 +1,125 @@
1
+ /**
2
+ * `guuey.json` v1 — the merged platform config.
3
+ *
4
+ * Single source of truth for a guuey-deployed project. Composed of:
5
+ *
6
+ * - `agent` (required for agent deploys) — declarative runtime + deploy config
7
+ * - `app` (optional) — App Store / Portal listing metadata
8
+ * - `ggui` (optional) — cross-protocol integration if the agent uses ggui rendering
9
+ *
10
+ * Plus top-level platform identity (`appId`, `workspaceId`) populated by
11
+ * the CLI after `guuey create` / `guuey link`.
12
+ *
13
+ * **Filename convention** (filename = artifact kind, see design doc §3):
14
+ * ```
15
+ * guuey.json ← agent deploy (this file's schema)
16
+ * guuey.mcp.json ← MCP server deploy (separate schema — see guuey-mcp.ts when added)
17
+ * ```
18
+ *
19
+ * **History.** Pre-2026-05-25 the repo carried two separate files:
20
+ * - `agent.json` — runtime contract (slice 2.0)
21
+ * - `guuey.json` — hosted overlay (project, deploy, deployments, mcpProxies, mcpServers)
22
+ *
23
+ * Slice 7.2 (2026-05-25) merged them per platform-architecture design doc §3.1
24
+ * + §14.2 field-by-field migration table. Pre-launch no-backcompat rule —
25
+ * the old shape is GONE, not deprecated.
26
+ *
27
+ * **Minimum valid `guuey.json`** (every other field defaults):
28
+ *
29
+ * ```jsonc
30
+ * {
31
+ * "schema": "1",
32
+ * "agent": {
33
+ * "framework": "claude-agent-sdk",
34
+ * "model": "claude-sonnet-4-6",
35
+ * "systemPrompt": { "file": "prompts/system.md" }
36
+ * }
37
+ * }
38
+ * ```
39
+ */
40
+ import { z } from 'zod';
41
+ import { AgentSectionV1 } from './agent.js';
42
+ import { AppSectionV1 } from './app.js';
43
+ import { GguiSectionV1 } from './ggui.js';
44
+ /**
45
+ * Top-level guuey.json v1 schema.
46
+ *
47
+ * `agent` is required — there's no "empty" guuey.json. A repo that hosts
48
+ * only an MCP server uses `guuey.mcp.json` instead (separate schema).
49
+ *
50
+ * `appId` and `workspaceId` are platform-resolved identifiers stamped by
51
+ * the CLI after `guuey create` / `guuey link`. A fresh project has neither.
52
+ * After first `guuey create`, both may be present.
53
+ *
54
+ * Re-exports the sub-section types for consumer convenience.
55
+ */
56
+ export const GuueyJsonV1 = z.strictObject({
57
+ schema: z.literal('1'),
58
+ /** Stable agent identifier minted by the control plane on first `guuey create`. */
59
+ appId: z.string().min(1).max(128).optional(),
60
+ /** Workspace the project lives under. Optional — personal apps + freshly-linked apps. */
61
+ workspaceId: z.string().min(1).max(128).optional(),
62
+ /** The deployable agent definition + deploy config. */
63
+ agent: AgentSectionV1,
64
+ /** App Store / Portal listing metadata. Optional. */
65
+ app: AppSectionV1.optional(),
66
+ /** Cross-protocol integration (ggui.ai rendering). Optional. */
67
+ ggui: GguiSectionV1.optional(),
68
+ /**
69
+ * Worker entry override — path to the built worker bundle, relative to the
70
+ * project root. Absence means the default build output, `guuey.worker.js`.
71
+ *
72
+ * This is the template-authored escape hatch `guuey dev` (`commands/
73
+ * dev.ts`) and `guuey deploy` (`commands/deploy.ts`) resolve for a
74
+ * non-default build output path; without this field in the schema the
75
+ * strict parse rejected any document that used it, contradicting both
76
+ * consumers' documented contract.
77
+ */
78
+ worker: z.string().min(1).optional(),
79
+ /**
80
+ * Transport selector — which AgJSON protocol leg the pod uses when
81
+ * streaming responses to the client.
82
+ *
83
+ * - `'silver'` (default) — SilverProtocol / AgJSON streaming (native guuey).
84
+ * - `'bypass'` — raw pass-through; the agent pod writes directly to the SSE
85
+ * stream without AgJSON framing. Useful for agents that produce their own
86
+ * structured output or during protocol migration.
87
+ *
88
+ * No `'ag-ui'` value — AgJSON has no AG-UI output leg.
89
+ */
90
+ protocol: z.enum(['silver', 'bypass']).default('silver'),
91
+ /**
92
+ * Platform runtime pin — lets a code-mode agent declare which Guuey Router
93
+ * version its worker is built against. Absence means v1 (the default and
94
+ * currently only supported version).
95
+ */
96
+ runtime: z.strictObject({
97
+ /** Guuey Router version this agent's worker is built against. */
98
+ router: z.enum(['v1']).default('v1'),
99
+ }).optional(),
100
+ });
101
+ /**
102
+ * Canonical filename — always at the project root, always this name.
103
+ * Exported so tooling uses the same constant instead of hard-coding.
104
+ */
105
+ export const GUUEY_JSON_FILENAME = 'guuey.json';
106
+ /**
107
+ * Parse a raw JSON value into a validated {@link GuueyJsonV1}.
108
+ * Throws a `ZodError` with human-readable issues on invalid input.
109
+ *
110
+ * Callers must have already JSON-decoded the source. Does NOT resolve
111
+ * `agent.systemPrompt.file` references — that's the loader's job (see
112
+ * `./loader.ts#loadGuueyJson`). Pure parse is safe to run anywhere;
113
+ * file resolution requires a base directory and is Node-only.
114
+ */
115
+ export function parseGuueyJson(raw) {
116
+ return GuueyJsonV1.parse(raw);
117
+ }
118
+ /**
119
+ * Safe-parse variant — returns a discriminated `z.safeParse` result.
120
+ * Prefer this inside CLI tooling where you want to render the issue
121
+ * list without try/catch.
122
+ */
123
+ export function safeParseGuueyJson(raw) {
124
+ return GuueyJsonV1.safeParse(raw);
125
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Default system prompt baked into every guuey-hosted agent that doesn't
3
+ * supply its own in `agent.json#systemPrompt`. Generic agent posture only —
4
+ * ggui-specific behavior is taught by the MCP server's `InitializeResult.instructions`
5
+ * field on handshake (lives at `mcp.ggui.ai`, not in guuey).
6
+ *
7
+ * When a customer's `agent.json` overrides this, the override wins. When the
8
+ * default MCP server (`mcp.ggui.ai`) is swapped for a different one, this
9
+ * prompt still applies and the new server teaches its own conventions on
10
+ * handshake.
11
+ */
12
+ export declare const GUUEY_DEFAULT_SYSTEM_PROMPT: string;
13
+ //# sourceMappingURL=system-prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../src/system-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,2BAA2B,QAOhC,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Default system prompt baked into every guuey-hosted agent that doesn't
3
+ * supply its own in `agent.json#systemPrompt`. Generic agent posture only —
4
+ * ggui-specific behavior is taught by the MCP server's `InitializeResult.instructions`
5
+ * field on handshake (lives at `mcp.ggui.ai`, not in guuey).
6
+ *
7
+ * When a customer's `agent.json` overrides this, the override wins. When the
8
+ * default MCP server (`mcp.ggui.ai`) is swapped for a different one, this
9
+ * prompt still applies and the new server teaches its own conventions on
10
+ * handshake.
11
+ */
12
+ export const GUUEY_DEFAULT_SYSTEM_PROMPT = `
13
+ You are a helpful agent hosted on guuey.com. Conversation is shown to the
14
+ user as a chat. When you have MCP tools available, prefer calling them over
15
+ describing what you would do — tools are how you take action in the user's
16
+ environment. Follow each tool's own description for guidance on when and how
17
+ to use it. Maintain the thread of conversation across turns and ask
18
+ clarifying questions when intent is ambiguous.
19
+ `.trim();
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@guuey/config",
3
+ "version": "0.1.0",
4
+ "description": "Open-source schemas + loaders for the three guuey config files: agent.json (declarative agent definition), guuey.json (hosted-deploy overlay), and the helper types around them. Consumed by @guuey/cli, the guuey backend, and devs writing their own agent or MCP server.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist",
11
+ "README.md",
12
+ "LICENSE"
13
+ ],
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js",
18
+ "default": "./dist/index.js"
19
+ }
20
+ },
21
+ "dependencies": {
22
+ "zod": "^4.3.6"
23
+ },
24
+ "devDependencies": {
25
+ "@types/node": "^24.0.0",
26
+ "typescript": "^5.0.0",
27
+ "vitest": "^3.0.0"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "keywords": [
33
+ "guuey",
34
+ "agent",
35
+ "mcp",
36
+ "config",
37
+ "schema",
38
+ "zod"
39
+ ],
40
+ "homepage": "https://guuey.com",
41
+ "bugs": {
42
+ "url": "https://github.com/loqu-co/guuey/issues"
43
+ },
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "git+https://github.com/withguuey/guuey-sdks.git",
47
+ "directory": "packages/config"
48
+ },
49
+ "scripts": {
50
+ "build": "tsc -p tsconfig.build.json",
51
+ "dev": "tsc --watch",
52
+ "typecheck": "tsc --noEmit",
53
+ "test": "vitest run",
54
+ "test:watch": "vitest"
55
+ }
56
+ }