@guuey/config 0.1.0 → 0.1.2
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/agent.d.ts +108 -7
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +163 -13
- package/dist/browser.d.ts +21 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +20 -0
- package/dist/colocated.d.ts +44 -0
- package/dist/colocated.d.ts.map +1 -0
- package/dist/colocated.js +55 -0
- package/dist/guuey-context.d.ts +90 -0
- package/dist/guuey-context.d.ts.map +1 -0
- package/dist/guuey-context.js +26 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/registry.d.ts +7 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +24 -6
- package/dist/schema.d.ts +15 -6
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +3 -3
- package/package.json +11 -1
- package/dist/agent-loader.d.ts +0 -65
- package/dist/agent-loader.d.ts.map +0 -1
- package/dist/agent-loader.js +0 -155
- package/dist/mcp-proxy.d.ts +0 -123
- package/dist/mcp-proxy.d.ts.map +0 -1
- package/dist/mcp-proxy.js +0 -133
- package/dist/mcp-servers.d.ts +0 -173
- package/dist/mcp-servers.d.ts.map +0 -1
- package/dist/mcp-servers.js +0 -147
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `GuueyContext` — everything the platform resolved for one turn, handed to a
|
|
3
|
+
* graceful-mode agent factory. THE import channel for graceful devs:
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* import type { GuueyContext } from "@guuey/config";
|
|
7
|
+
* export default (guuey: GuueyContext) => new LlmAgent({
|
|
8
|
+
* model: guuey.model,
|
|
9
|
+
* // Function form — safe for every framework; required for ADK, which
|
|
10
|
+
* // applies `{var}` substitution to a plain-string instruction.
|
|
11
|
+
* instruction: () => guuey.instruction,
|
|
12
|
+
* tools: [myTool, ...guuey.mcpToolsets],
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Types-only and dependency-free by design (`@guuey/config` is already a
|
|
17
|
+
* template dependency; the host — which ASSEMBLES the context — is not). The
|
|
18
|
+
* tiny shapes below are structurally identical to `@guuey/worker`'s protocol
|
|
19
|
+
* types; duplicating them here keeps config free of a runtime package
|
|
20
|
+
* dependency for what is purely a type channel.
|
|
21
|
+
*
|
|
22
|
+
* The factory runs PER INVOKE (matching the per-invoke agent construction the
|
|
23
|
+
* platform host has always done), so per-turn surfaces — the user, this
|
|
24
|
+
* turn's state — are first-class, not bolted on.
|
|
25
|
+
*/
|
|
26
|
+
/** Router-vouched end-user identity for this turn (multi-tenant). */
|
|
27
|
+
export interface GuueyContextUser {
|
|
28
|
+
id: string;
|
|
29
|
+
authMode: "anonymous" | "authenticated";
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The three GuueyFS layer mounts (absolute paths):
|
|
33
|
+
* - `app` — read-only app assets,
|
|
34
|
+
* - `home` — per-USER durable storage,
|
|
35
|
+
* - `session` — per-session scratch.
|
|
36
|
+
*/
|
|
37
|
+
export interface GuueyContextFiles {
|
|
38
|
+
app: string;
|
|
39
|
+
home: string;
|
|
40
|
+
session: string;
|
|
41
|
+
}
|
|
42
|
+
/** One prior message from the recent history window. */
|
|
43
|
+
export interface GuueyContextMessage {
|
|
44
|
+
role: "user" | "agent";
|
|
45
|
+
text: string;
|
|
46
|
+
}
|
|
47
|
+
/** One thread-memory record folded from prior turns. */
|
|
48
|
+
export interface GuueyContextMemoryRecord {
|
|
49
|
+
key?: string;
|
|
50
|
+
value: unknown;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The full per-turn platform context. `TToolset` is the framework's MCP
|
|
54
|
+
* toolset type (e.g. `MCPToolset` from `@google/adk`) — defaults to `unknown`
|
|
55
|
+
* so the type stays framework-neutral.
|
|
56
|
+
*
|
|
57
|
+
* History, memory, and working state are ALSO auto-injected into
|
|
58
|
+
* `instruction` as the standard context preamble — a factory that ignores
|
|
59
|
+
* them still yields a conversational agent. They appear here read-only so an
|
|
60
|
+
* advanced factory can do better than the default preamble.
|
|
61
|
+
*/
|
|
62
|
+
export interface GuueyContext<TToolset = unknown> {
|
|
63
|
+
/** Resolved model id (from guuey.json / registry default). */
|
|
64
|
+
model: string;
|
|
65
|
+
/**
|
|
66
|
+
* The system prompt WITH the standard context preamble (history, thread
|
|
67
|
+
* memory, working state) already prepended. Feed this to the agent unless
|
|
68
|
+
* you are rendering context yourself from the raw fields below.
|
|
69
|
+
*/
|
|
70
|
+
instruction: string;
|
|
71
|
+
/** Ready-to-use MCP toolsets for every server declared in guuey.json. */
|
|
72
|
+
mcpToolsets: TToolset[];
|
|
73
|
+
/** The end user this turn serves. */
|
|
74
|
+
user: GuueyContextUser;
|
|
75
|
+
/** The three-tier file storage paths. */
|
|
76
|
+
files: GuueyContextFiles;
|
|
77
|
+
/** Recent conversation window (read side; auto-preambled). */
|
|
78
|
+
history: GuueyContextMessage[];
|
|
79
|
+
/** Thread memory records (read side; auto-preambled). */
|
|
80
|
+
memory: GuueyContextMemoryRecord[];
|
|
81
|
+
/** Prior working state carried from the previous turn (read side). */
|
|
82
|
+
workingState: unknown | undefined;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* What a graceful agent module's default export may be: the framework-native
|
|
86
|
+
* agent object itself, or a factory receiving the {@link GuueyContext}.
|
|
87
|
+
* Factories may be async.
|
|
88
|
+
*/
|
|
89
|
+
export type GuueyAgentExport<TAgent = object, TToolset = unknown> = TAgent | ((guuey: GuueyContext<TToolset>) => TAgent | Promise<TAgent>);
|
|
90
|
+
//# sourceMappingURL=guuey-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guuey-context.d.ts","sourceRoot":"","sources":["../src/guuey-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;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|
+
* `GuueyContext` — everything the platform resolved for one turn, handed to a
|
|
3
|
+
* graceful-mode agent factory. THE import channel for graceful devs:
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* import type { GuueyContext } from "@guuey/config";
|
|
7
|
+
* export default (guuey: GuueyContext) => new LlmAgent({
|
|
8
|
+
* model: guuey.model,
|
|
9
|
+
* // Function form — safe for every framework; required for ADK, which
|
|
10
|
+
* // applies `{var}` substitution to a plain-string instruction.
|
|
11
|
+
* instruction: () => guuey.instruction,
|
|
12
|
+
* tools: [myTool, ...guuey.mcpToolsets],
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Types-only and dependency-free by design (`@guuey/config` is already a
|
|
17
|
+
* template dependency; the host — which ASSEMBLES the context — is not). The
|
|
18
|
+
* tiny shapes below are structurally identical to `@guuey/worker`'s protocol
|
|
19
|
+
* types; duplicating them here keeps config free of a runtime package
|
|
20
|
+
* dependency for what is purely a type channel.
|
|
21
|
+
*
|
|
22
|
+
* The factory runs PER INVOKE (matching the per-invoke agent construction the
|
|
23
|
+
* platform host has always done), so per-turn surfaces — the user, this
|
|
24
|
+
* turn's state — are first-class, not bolted on.
|
|
25
|
+
*/
|
|
26
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -12,10 +12,12 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export * from './schema.js';
|
|
14
14
|
export * from './agent.js';
|
|
15
|
+
export * from './colocated.js';
|
|
15
16
|
export * from './app.js';
|
|
16
17
|
export * from './ggui.js';
|
|
17
18
|
export * from './loader.js';
|
|
18
19
|
export * from './hosting.js';
|
|
19
20
|
export * from './system-prompt.js';
|
|
20
21
|
export * from './registry.js';
|
|
22
|
+
export * from './guuey-context.js';
|
|
21
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -12,9 +12,11 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export * from './schema.js';
|
|
14
14
|
export * from './agent.js';
|
|
15
|
+
export * from './colocated.js';
|
|
15
16
|
export * from './app.js';
|
|
16
17
|
export * from './ggui.js';
|
|
17
18
|
export * from './loader.js';
|
|
18
19
|
export * from './hosting.js';
|
|
19
20
|
export * from './system-prompt.js';
|
|
20
21
|
export * from './registry.js';
|
|
22
|
+
export * from './guuey-context.js';
|
package/dist/registry.d.ts
CHANGED
|
@@ -18,6 +18,13 @@ export interface FrameworkEntry {
|
|
|
18
18
|
readonly facetSupportedRange: string | null;
|
|
19
19
|
readonly defaultProvider: "anthropic" | "openai" | "google";
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Array order is picker order AFTER `modelsForProvider` floats the default to
|
|
23
|
+
* the front — the platform's app-behavior picker shows only `.slice(0, 2)` for
|
|
24
|
+
* google + openai, so the second array entry per provider is a product-visible
|
|
25
|
+
* choice, not incidental. Pinned by
|
|
26
|
+
* `apps/platform/.../ModelSection/ModelSection.test.ts`.
|
|
27
|
+
*/
|
|
21
28
|
export declare const MODEL_REGISTRY: readonly ModelEntry[];
|
|
22
29
|
export declare const FRAMEWORK_REGISTRY: readonly FrameworkEntry[];
|
|
23
30
|
/**
|
package/dist/registry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,WAAW,GAAG,YAAY,CAAC;AAExE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,YAAY,CAAC;IACpE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,SAAS,EAAE,kBAAkB,GAAG,mBAAmB,GAAG,YAAY,GAAG,SAAS,CAAC;IACxF,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9C,QAAQ,CAAC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,QAAQ,CAAC,eAAe,EAAE,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAC;CAC7D;AAED,eAAO,MAAM,cAAc,EAAE,SAAS,UAAU,
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;GA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@ -2,18 +2,36 @@
|
|
|
2
2
|
* Model + framework registry — single source of truth per the model-release
|
|
3
3
|
* playbook §8 item A; a release = one entry change here + rate-card row.
|
|
4
4
|
*/
|
|
5
|
+
/**
|
|
6
|
+
* Array order is picker order AFTER `modelsForProvider` floats the default to
|
|
7
|
+
* the front — the platform's app-behavior picker shows only `.slice(0, 2)` for
|
|
8
|
+
* google + openai, so the second array entry per provider is a product-visible
|
|
9
|
+
* choice, not incidental. Pinned by
|
|
10
|
+
* `apps/platform/.../ModelSection/ModelSection.test.ts`.
|
|
11
|
+
*/
|
|
5
12
|
export const MODEL_REGISTRY = [
|
|
6
13
|
{ id: "claude-sonnet-5", provider: "anthropic", label: "Claude Sonnet 5", status: "ga", isDefault: true },
|
|
7
14
|
{ id: "claude-fable-5", provider: "anthropic", label: "Claude Fable 5", status: "ga" },
|
|
15
|
+
{ id: "claude-opus-5", provider: "anthropic", label: "Claude Opus 5", status: "ga" },
|
|
8
16
|
{ id: "claude-sonnet-4-6", provider: "anthropic", label: "Claude Sonnet 4.6", status: "ga" },
|
|
9
17
|
{ id: "claude-haiku-4-5", provider: "anthropic", label: "Claude Haiku 4.5", status: "ga" },
|
|
10
18
|
{ id: "claude-opus-4-8", provider: "anthropic", label: "Claude Opus 4.8", status: "ga" },
|
|
11
|
-
|
|
19
|
+
// Terra — guuey's OpenAI default (founder call 2026-07-25). This DELIBERATELY
|
|
20
|
+
// diverges from OpenAI's own `gpt-5.6` alias, which routes to Sol: Terra is
|
|
21
|
+
// half Sol's price and the better cost/balance pick for hosted agent
|
|
22
|
+
// workloads. The bare `gpt-5.6` alias is intentionally NOT a registry id
|
|
23
|
+
// (never offered in a picker) — the rate card still rows it at Sol's price so
|
|
24
|
+
// an alias call from BYO config can't under-meter.
|
|
25
|
+
{ id: "gpt-5.6-terra", provider: "openai", label: "GPT-5.6 Terra", status: "ga", isDefault: true },
|
|
26
|
+
{ id: "gpt-5.6-sol", provider: "openai", label: "GPT-5.6 Sol", status: "ga" },
|
|
27
|
+
{ id: "gpt-5.6-luna", provider: "openai", label: "GPT-5.6 Luna", status: "ga" },
|
|
28
|
+
{ id: "gpt-5.5", provider: "openai", label: "GPT-5.5", status: "ga" },
|
|
12
29
|
{ id: "gpt-5.4", provider: "openai", label: "GPT-5.4", status: "ga" },
|
|
13
30
|
{ id: "gpt-4o", provider: "openai", label: "GPT-4o", status: "ga" },
|
|
14
31
|
{ id: "gpt-4o-mini", provider: "openai", label: "GPT-4o Mini", status: "ga" },
|
|
15
|
-
{ id: "
|
|
16
|
-
{ id: "gemini-3.5-flash", provider: "google", label: "Gemini 3.5 Flash", status: "ga"
|
|
32
|
+
{ id: "gemini-3.6-flash", provider: "google", label: "Gemini 3.6 Flash", status: "ga", isDefault: true },
|
|
33
|
+
{ id: "gemini-3.5-flash-lite", provider: "google", label: "Gemini 3.5 Flash Lite", status: "ga" },
|
|
34
|
+
{ id: "gemini-3.5-flash", provider: "google", label: "Gemini 3.5 Flash", status: "ga" },
|
|
17
35
|
{ id: "gemini-3.1-pro", provider: "google", label: "Gemini 3.1 Pro", status: "ga" },
|
|
18
36
|
{ id: "gemini-2.5-flash", provider: "google", label: "Gemini 2.5 Flash", status: "ga" },
|
|
19
37
|
{ id: "gemini-2.5-pro", provider: "google", label: "Gemini 2.5 Pro", status: "ga" },
|
|
@@ -35,9 +53,9 @@ export const FRAMEWORK_REGISTRY = [
|
|
|
35
53
|
},
|
|
36
54
|
{
|
|
37
55
|
framework: "google-adk",
|
|
38
|
-
sdkPackage: "google
|
|
39
|
-
platformPinnedVersion: "
|
|
40
|
-
facetSupportedRange:
|
|
56
|
+
sdkPackage: "@google/adk", // the OFFICIAL JS ADK (the Python lane retired with guuey_adk_host)
|
|
57
|
+
platformPinnedVersion: "1.3.0", // pinned in @guuey-private/host-shared
|
|
58
|
+
facetSupportedRange: ">=1.0.0 <2", // @silverprotocol/google-adk peer range
|
|
41
59
|
defaultProvider: "google",
|
|
42
60
|
},
|
|
43
61
|
{
|
package/dist/schema.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - `ggui` (optional) — cross-protocol integration if the agent uses ggui rendering
|
|
9
9
|
*
|
|
10
10
|
* Plus top-level platform identity (`appId`, `workspaceId`) populated by
|
|
11
|
-
* the CLI after `guuey create` / `guuey
|
|
11
|
+
* the CLI after `guuey create` / `guuey pull --app-id`.
|
|
12
12
|
*
|
|
13
13
|
* **Filename convention** (filename = artifact kind, see design doc §3):
|
|
14
14
|
* ```
|
|
@@ -48,8 +48,8 @@ import { type GuueyGguiSection } from './ggui.js';
|
|
|
48
48
|
* only an MCP server uses `guuey.mcp.json` instead (separate schema).
|
|
49
49
|
*
|
|
50
50
|
* `appId` and `workspaceId` are platform-resolved identifiers stamped by
|
|
51
|
-
* the CLI after `guuey create` / `guuey
|
|
52
|
-
* After first `guuey create`, both may be present.
|
|
51
|
+
* the CLI after `guuey create` / `guuey pull --app-id`. A fresh project has
|
|
52
|
+
* neither. After first `guuey create`, both may be present.
|
|
53
53
|
*
|
|
54
54
|
* Re-exports the sub-section types for consumer convenience.
|
|
55
55
|
*/
|
|
@@ -68,6 +68,7 @@ export declare const GuueyJsonV1: z.ZodObject<{
|
|
|
68
68
|
"google-adk": "google-adk";
|
|
69
69
|
vanilla: "vanilla";
|
|
70
70
|
}>>;
|
|
71
|
+
entry: z.ZodOptional<z.ZodString>;
|
|
71
72
|
model: z.ZodOptional<z.ZodString>;
|
|
72
73
|
modelProvider: z.ZodOptional<z.ZodEnum<{
|
|
73
74
|
openai: "openai";
|
|
@@ -78,9 +79,8 @@ export declare const GuueyJsonV1: z.ZodObject<{
|
|
|
78
79
|
}, z.core.$strict>]>>;
|
|
79
80
|
mcpServers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
80
81
|
kind: z.ZodLiteral<"colocated">;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
82
|
+
source: z.ZodString;
|
|
83
|
+
devPort: z.ZodOptional<z.ZodNumber>;
|
|
84
84
|
}, z.core.$strict>, z.ZodObject<{
|
|
85
85
|
kind: z.ZodLiteral<"hosted">;
|
|
86
86
|
server: z.ZodOptional<z.ZodString>;
|
|
@@ -99,6 +99,11 @@ export declare const GuueyJsonV1: z.ZodObject<{
|
|
|
99
99
|
federate: z.ZodOptional<z.ZodBoolean>;
|
|
100
100
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
101
101
|
devPort: z.ZodOptional<z.ZodNumber>;
|
|
102
|
+
mcpResourceUrl: z.ZodOptional<z.ZodURL>;
|
|
103
|
+
profileAccess: z.ZodOptional<z.ZodEnum<{
|
|
104
|
+
read: "read";
|
|
105
|
+
"read-write": "read-write";
|
|
106
|
+
}>>;
|
|
102
107
|
}, z.core.$strict>], "kind">>>;
|
|
103
108
|
tools: z.ZodOptional<z.ZodObject<{
|
|
104
109
|
allowlist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -130,6 +135,10 @@ export declare const GuueyJsonV1: z.ZodObject<{
|
|
|
130
135
|
user: "user";
|
|
131
136
|
app: "app";
|
|
132
137
|
}>>>;
|
|
138
|
+
profileAccess: z.ZodOptional<z.ZodEnum<{
|
|
139
|
+
read: "read";
|
|
140
|
+
"read-write": "read-write";
|
|
141
|
+
}>>;
|
|
133
142
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
134
143
|
secrets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
135
144
|
endpoint: z.ZodOptional<z.ZodObject<{
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAA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AE,OAAO,GACX,UAAU,CAAC,OAAO,WAAW,CAAC,SAAS,CAAC,CAE1C"}
|
package/dist/schema.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - `ggui` (optional) — cross-protocol integration if the agent uses ggui rendering
|
|
9
9
|
*
|
|
10
10
|
* Plus top-level platform identity (`appId`, `workspaceId`) populated by
|
|
11
|
-
* the CLI after `guuey create` / `guuey
|
|
11
|
+
* the CLI after `guuey create` / `guuey pull --app-id`.
|
|
12
12
|
*
|
|
13
13
|
* **Filename convention** (filename = artifact kind, see design doc §3):
|
|
14
14
|
* ```
|
|
@@ -48,8 +48,8 @@ import { GguiSectionV1 } from './ggui.js';
|
|
|
48
48
|
* only an MCP server uses `guuey.mcp.json` instead (separate schema).
|
|
49
49
|
*
|
|
50
50
|
* `appId` and `workspaceId` are platform-resolved identifiers stamped by
|
|
51
|
-
* the CLI after `guuey create` / `guuey
|
|
52
|
-
* After first `guuey create`, both may be present.
|
|
51
|
+
* the CLI after `guuey create` / `guuey pull --app-id`. A fresh project has
|
|
52
|
+
* neither. After first `guuey create`, both may be present.
|
|
53
53
|
*
|
|
54
54
|
* Re-exports the sub-section types for consumer convenience.
|
|
55
55
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guuey/config",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
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
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -16,6 +16,16 @@
|
|
|
16
16
|
"types": "./dist/index.d.ts",
|
|
17
17
|
"import": "./dist/index.js",
|
|
18
18
|
"default": "./dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./registry": {
|
|
21
|
+
"types": "./dist/registry.d.ts",
|
|
22
|
+
"import": "./dist/registry.js",
|
|
23
|
+
"default": "./dist/registry.js"
|
|
24
|
+
},
|
|
25
|
+
"./browser": {
|
|
26
|
+
"types": "./dist/browser.d.ts",
|
|
27
|
+
"import": "./dist/browser.js",
|
|
28
|
+
"default": "./dist/browser.js"
|
|
19
29
|
}
|
|
20
30
|
},
|
|
21
31
|
"dependencies": {
|
package/dist/agent-loader.d.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|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|
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';
|