@bendyline/gezel 0.1.0 → 1.0.1
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/{index-D_dch9Qh.d.ts → index-CWMNVAhp.d.ts} +973 -47
- package/dist/index.d.ts +324 -17
- package/dist/index.js +7877 -5318
- package/dist/markdown/index.d.ts +1 -1
- package/dist/markdown/index.js +798 -669
- package/dist/native/index.d.ts +34 -40
- package/dist/native/index.js +62 -57
- package/dist/paths.d.ts +26 -3
- package/dist/paths.js +62 -0
- package/dist/{report-action-DzdQHzGG.d.ts → report-action-DIz_2QOu.d.ts} +46 -28
- package/dist/schemas/index.d.ts +2 -2
- package/dist/schemas/index.js +5664 -5141
- package/dist/svg/index.d.ts +11 -0
- package/dist/svg/index.js +202 -0
- package/package.json +6 -1
package/dist/markdown/index.js
CHANGED
|
@@ -283,6 +283,33 @@ var InvokePageToolResponseSchema = RunScriptResponseSchema.extend({
|
|
|
283
283
|
reason: z2.string().optional()
|
|
284
284
|
}).optional()
|
|
285
285
|
});
|
|
286
|
+
var PageReadRequestSchema = z2.object({
|
|
287
|
+
op: z2.enum(["read", "list", "stat"]),
|
|
288
|
+
source: z2.enum(["workspace", "artifacts"]),
|
|
289
|
+
path: z2.string().min(1),
|
|
290
|
+
/** read op only; default derived from extension ('json' for .json else 'text'). */
|
|
291
|
+
as: z2.enum(["text", "json", "bytes"]).optional(),
|
|
292
|
+
/** read op only; capped server-side at PAGE_READ_MAX_BYTES regardless. */
|
|
293
|
+
maxBytes: z2.number().int().positive().optional()
|
|
294
|
+
});
|
|
295
|
+
var PageReadEntrySchema = z2.object({
|
|
296
|
+
name: z2.string(),
|
|
297
|
+
kind: z2.enum(["file", "dir"]),
|
|
298
|
+
size: z2.number().nonnegative(),
|
|
299
|
+
mtime: z2.number().nonnegative()
|
|
300
|
+
});
|
|
301
|
+
var PageReadResponseSchema = z2.object({
|
|
302
|
+
op: z2.enum(["read", "list", "stat"]),
|
|
303
|
+
/** read: file body (utf8 text or base64 when `encoding: 'base64'`). */
|
|
304
|
+
content: z2.string().optional(),
|
|
305
|
+
encoding: z2.enum(["utf8", "base64"]).optional(),
|
|
306
|
+
/** list: directory entries (files and dirs, one level). */
|
|
307
|
+
entries: z2.array(PageReadEntrySchema).optional(),
|
|
308
|
+
/** read/stat: change token — size:mtime hash; directories hash their listing. */
|
|
309
|
+
etag: z2.string(),
|
|
310
|
+
size: z2.number().nonnegative().optional(),
|
|
311
|
+
mtime: z2.number().nonnegative().optional()
|
|
312
|
+
});
|
|
286
313
|
var ListScriptsResponseSchema = z2.object({
|
|
287
314
|
scripts: z2.array(
|
|
288
315
|
z2.object({
|
|
@@ -1723,7 +1750,7 @@ function defaultStepIdForName(name) {
|
|
|
1723
1750
|
}
|
|
1724
1751
|
|
|
1725
1752
|
// src/schemas/gezel.ts
|
|
1726
|
-
import { z as
|
|
1753
|
+
import { z as z17 } from "zod";
|
|
1727
1754
|
|
|
1728
1755
|
// src/poppetje/schema.ts
|
|
1729
1756
|
import { z as z6 } from "zod";
|
|
@@ -1908,178 +1935,227 @@ var PoppetjeSchema = z6.preprocess(
|
|
|
1908
1935
|
})
|
|
1909
1936
|
);
|
|
1910
1937
|
|
|
1911
|
-
// src/schemas/
|
|
1938
|
+
// src/schemas/claude.ts
|
|
1912
1939
|
import { z as z7 } from "zod";
|
|
1913
|
-
var
|
|
1914
|
-
|
|
1940
|
+
var ClaudePermissionModeSchema = z7.enum([
|
|
1941
|
+
"default",
|
|
1942
|
+
"acceptEdits",
|
|
1943
|
+
"plan",
|
|
1944
|
+
"bypassPermissions"
|
|
1945
|
+
]);
|
|
1946
|
+
|
|
1947
|
+
// src/schemas/codex.ts
|
|
1948
|
+
import { z as z8 } from "zod";
|
|
1949
|
+
var CodexPermissionModeSchema = z8.enum(["plan", "edit", "reviewed", "full"]);
|
|
1950
|
+
var LegacyCodexPermissionModeSchema = z8.enum([
|
|
1915
1951
|
"default",
|
|
1916
1952
|
"acceptEdits",
|
|
1917
1953
|
"bypassPermissions"
|
|
1918
1954
|
]);
|
|
1919
|
-
var CodexPermissionModeCompatSchema =
|
|
1955
|
+
var CodexPermissionModeCompatSchema = z8.union([
|
|
1920
1956
|
CodexPermissionModeSchema,
|
|
1921
1957
|
LegacyCodexPermissionModeSchema
|
|
1922
1958
|
]);
|
|
1923
1959
|
|
|
1924
|
-
// src/schemas/
|
|
1960
|
+
// src/schemas/entity-id.ts
|
|
1925
1961
|
import { z as z9 } from "zod";
|
|
1926
1962
|
|
|
1963
|
+
// src/entity-id.ts
|
|
1964
|
+
var SAFE_ENTITY_ID = /^[A-Za-z0-9@][A-Za-z0-9@._-]{0,199}$/;
|
|
1965
|
+
var RESERVED_WINDOWS_IDS = /* @__PURE__ */ new Set([
|
|
1966
|
+
"CON",
|
|
1967
|
+
"PRN",
|
|
1968
|
+
"AUX",
|
|
1969
|
+
"NUL",
|
|
1970
|
+
"COM1",
|
|
1971
|
+
"COM2",
|
|
1972
|
+
"COM3",
|
|
1973
|
+
"COM4",
|
|
1974
|
+
"COM5",
|
|
1975
|
+
"COM6",
|
|
1976
|
+
"COM7",
|
|
1977
|
+
"COM8",
|
|
1978
|
+
"COM9",
|
|
1979
|
+
"LPT1",
|
|
1980
|
+
"LPT2",
|
|
1981
|
+
"LPT3",
|
|
1982
|
+
"LPT4",
|
|
1983
|
+
"LPT5",
|
|
1984
|
+
"LPT6",
|
|
1985
|
+
"LPT7",
|
|
1986
|
+
"LPT8",
|
|
1987
|
+
"LPT9"
|
|
1988
|
+
]);
|
|
1989
|
+
function isSafeEntityId(value) {
|
|
1990
|
+
if (typeof value !== "string" || !SAFE_ENTITY_ID.test(value)) return false;
|
|
1991
|
+
const windowsStem = (value.split(".")[0] ?? "").toUpperCase();
|
|
1992
|
+
return !RESERVED_WINDOWS_IDS.has(windowsStem);
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
// src/schemas/entity-id.ts
|
|
1996
|
+
var EntityIdSchema = z9.string().refine(isSafeEntityId, {
|
|
1997
|
+
message: "must be a portable single-segment entity id"
|
|
1998
|
+
});
|
|
1999
|
+
|
|
2000
|
+
// src/schemas/growth.ts
|
|
2001
|
+
import { z as z11 } from "zod";
|
|
2002
|
+
|
|
1927
2003
|
// src/schemas/tuning-profile-registry.ts
|
|
1928
|
-
import { z as
|
|
1929
|
-
var TuningProfileIdSchema =
|
|
2004
|
+
import { z as z10 } from "zod";
|
|
2005
|
+
var TuningProfileIdSchema = z10.string().min(1).describe("Canonical tuning profile id.");
|
|
1930
2006
|
|
|
1931
2007
|
// src/schemas/growth.ts
|
|
1932
|
-
var GrowthEvidenceSchema =
|
|
2008
|
+
var GrowthEvidenceSchema = z11.object({
|
|
1933
2009
|
/** Memory-file day (YYYY-MM-DD) — rewritten server-side from the matched entry. */
|
|
1934
|
-
day:
|
|
1935
|
-
kind:
|
|
1936
|
-
excerpt:
|
|
1937
|
-
});
|
|
1938
|
-
var TraitProposalSchema =
|
|
1939
|
-
id:
|
|
1940
|
-
kind:
|
|
1941
|
-
title:
|
|
2010
|
+
day: z11.string().regex(/^\d{4}-\d{2}-\d{2}$/),
|
|
2011
|
+
kind: z11.enum(["fact", "decision", "pref", "status"]),
|
|
2012
|
+
excerpt: z11.string().min(1).max(400)
|
|
2013
|
+
});
|
|
2014
|
+
var TraitProposalSchema = z11.object({
|
|
2015
|
+
id: z11.string(),
|
|
2016
|
+
kind: z11.literal("trait"),
|
|
2017
|
+
title: z11.string().min(1).max(80),
|
|
1942
2018
|
/** One imperative second-person sentence destined for the prompt. */
|
|
1943
|
-
traitText:
|
|
1944
|
-
evidence:
|
|
2019
|
+
traitText: z11.string().min(1).max(200),
|
|
2020
|
+
evidence: z11.array(GrowthEvidenceSchema).min(1).max(3)
|
|
1945
2021
|
});
|
|
1946
|
-
var TuningActionSchema =
|
|
1947
|
-
|
|
2022
|
+
var TuningActionSchema = z11.discriminatedUnion("type", [
|
|
2023
|
+
z11.object({ type: z11.literal("profile"), profile: TuningProfileIdSchema }),
|
|
1948
2024
|
/** Resolved + clamped at accept time against the then-current frontmatter. */
|
|
1949
|
-
|
|
2025
|
+
z11.object({ type: z11.literal("temperature"), delta: z11.union([z11.literal(0.1), z11.literal(-0.1)]) })
|
|
1950
2026
|
]);
|
|
1951
|
-
var TuningProposalSchema =
|
|
1952
|
-
id:
|
|
1953
|
-
kind:
|
|
1954
|
-
title:
|
|
1955
|
-
description:
|
|
2027
|
+
var TuningProposalSchema = z11.object({
|
|
2028
|
+
id: z11.string(),
|
|
2029
|
+
kind: z11.literal("tuning"),
|
|
2030
|
+
title: z11.string().max(80),
|
|
2031
|
+
description: z11.string().max(300),
|
|
1956
2032
|
action: TuningActionSchema
|
|
1957
2033
|
});
|
|
1958
|
-
var CosmeticProposalSchema =
|
|
1959
|
-
id:
|
|
1960
|
-
kind:
|
|
1961
|
-
title:
|
|
2034
|
+
var CosmeticProposalSchema = z11.object({
|
|
2035
|
+
id: z11.string(),
|
|
2036
|
+
kind: z11.literal("cosmetic"),
|
|
2037
|
+
title: z11.string().max(80),
|
|
1962
2038
|
/** Key into GROWTH_COSMETICS, or a generic `level-N` milestone marker. */
|
|
1963
|
-
cosmeticId:
|
|
2039
|
+
cosmeticId: z11.string()
|
|
1964
2040
|
});
|
|
1965
|
-
var GrowthProposalSchema =
|
|
2041
|
+
var GrowthProposalSchema = z11.discriminatedUnion("kind", [
|
|
1966
2042
|
TraitProposalSchema,
|
|
1967
2043
|
TuningProposalSchema,
|
|
1968
2044
|
CosmeticProposalSchema
|
|
1969
2045
|
]);
|
|
1970
|
-
var PendingLevelUpSchema =
|
|
1971
|
-
toLevel:
|
|
1972
|
-
proposals:
|
|
1973
|
-
createdAt:
|
|
1974
|
-
});
|
|
1975
|
-
var GrowthSignalsSchema =
|
|
1976
|
-
memoryXp:
|
|
1977
|
-
lessonsXp:
|
|
1978
|
-
taskXp:
|
|
1979
|
-
consultXp:
|
|
1980
|
-
});
|
|
1981
|
-
var AdoptedTraitRecordSchema =
|
|
1982
|
-
traitId:
|
|
1983
|
-
text:
|
|
1984
|
-
level:
|
|
1985
|
-
adoptedAt:
|
|
1986
|
-
evidence:
|
|
2046
|
+
var PendingLevelUpSchema = z11.object({
|
|
2047
|
+
toLevel: z11.number().int().min(2),
|
|
2048
|
+
proposals: z11.array(GrowthProposalSchema).min(1).max(5),
|
|
2049
|
+
createdAt: z11.string()
|
|
2050
|
+
});
|
|
2051
|
+
var GrowthSignalsSchema = z11.object({
|
|
2052
|
+
memoryXp: z11.number().int().nonnegative().default(0),
|
|
2053
|
+
lessonsXp: z11.number().int().nonnegative().default(0),
|
|
2054
|
+
taskXp: z11.number().int().nonnegative().default(0),
|
|
2055
|
+
consultXp: z11.number().int().nonnegative().default(0)
|
|
2056
|
+
});
|
|
2057
|
+
var AdoptedTraitRecordSchema = z11.object({
|
|
2058
|
+
traitId: z11.string(),
|
|
2059
|
+
text: z11.string(),
|
|
2060
|
+
level: z11.number().int(),
|
|
2061
|
+
adoptedAt: z11.string(),
|
|
2062
|
+
evidence: z11.array(GrowthEvidenceSchema),
|
|
1987
2063
|
/** Set when the user later retires the trait — kept for the character sheet. */
|
|
1988
|
-
removedAt:
|
|
2064
|
+
removedAt: z11.string().optional()
|
|
1989
2065
|
});
|
|
1990
|
-
var DeclinedProposalRecordSchema =
|
|
1991
|
-
kind:
|
|
1992
|
-
title:
|
|
2066
|
+
var DeclinedProposalRecordSchema = z11.object({
|
|
2067
|
+
kind: z11.enum(["trait", "tuning", "cosmetic"]),
|
|
2068
|
+
title: z11.string(),
|
|
1993
2069
|
/** Used for never-re-offer matching on trait proposals. */
|
|
1994
|
-
traitText:
|
|
1995
|
-
level:
|
|
1996
|
-
declinedAt:
|
|
1997
|
-
});
|
|
1998
|
-
var GezelGrowthStateSchema =
|
|
1999
|
-
version:
|
|
2000
|
-
level:
|
|
2001
|
-
xp:
|
|
2070
|
+
traitText: z11.string().optional(),
|
|
2071
|
+
level: z11.number().int(),
|
|
2072
|
+
declinedAt: z11.string()
|
|
2073
|
+
});
|
|
2074
|
+
var GezelGrowthStateSchema = z11.object({
|
|
2075
|
+
version: z11.literal(1).default(1),
|
|
2076
|
+
level: z11.number().int().min(1).default(1),
|
|
2077
|
+
xp: z11.number().int().nonnegative().default(0),
|
|
2002
2078
|
signals: GrowthSignalsSchema.prefault({}),
|
|
2003
|
-
lastComputedAt:
|
|
2079
|
+
lastComputedAt: z11.string().optional(),
|
|
2004
2080
|
pendingLevelUp: PendingLevelUpSchema.optional(),
|
|
2005
|
-
adoptedTraits:
|
|
2006
|
-
declinedProposals:
|
|
2007
|
-
unlockedCosmetics:
|
|
2081
|
+
adoptedTraits: z11.array(AdoptedTraitRecordSchema).default([]),
|
|
2082
|
+
declinedProposals: z11.array(DeclinedProposalRecordSchema).default([]),
|
|
2083
|
+
unlockedCosmetics: z11.array(z11.object({ id: z11.string(), at: z11.string() })).default([])
|
|
2008
2084
|
});
|
|
2009
|
-
var GezelGrowthSummarySchema =
|
|
2010
|
-
level:
|
|
2085
|
+
var GezelGrowthSummarySchema = z11.object({
|
|
2086
|
+
level: z11.number().int().min(1),
|
|
2011
2087
|
/** True when a level-up is waiting for the user's choice. */
|
|
2012
|
-
pending:
|
|
2088
|
+
pending: z11.boolean().optional()
|
|
2013
2089
|
});
|
|
2014
2090
|
|
|
2015
2091
|
// src/schemas/model-tuning.ts
|
|
2016
|
-
import { z as
|
|
2017
|
-
var DrySamplerSchema =
|
|
2018
|
-
multiplier:
|
|
2019
|
-
base:
|
|
2020
|
-
allowedLength:
|
|
2092
|
+
import { z as z12 } from "zod";
|
|
2093
|
+
var DrySamplerSchema = z12.object({
|
|
2094
|
+
multiplier: z12.number().min(0).max(5).describe("DRY penalty strength. 0 disables. 0.8 is a reasonable default."),
|
|
2095
|
+
base: z12.number().min(0).max(5).optional().describe("Base of the exponential penalty for repeated tokens. Default 1.75."),
|
|
2096
|
+
allowedLength: z12.number().int().min(0).max(64).optional().describe("Minimum n-gram length before DRY kicks in. Default 2.")
|
|
2021
2097
|
}).describe("DRY anti-repetition sampler (llama.cpp only).");
|
|
2022
|
-
var XtcSamplerSchema =
|
|
2023
|
-
probability:
|
|
2024
|
-
threshold:
|
|
2098
|
+
var XtcSamplerSchema = z12.object({
|
|
2099
|
+
probability: z12.number().min(0).max(1).describe("Probability of triggering XTC on any given step."),
|
|
2100
|
+
threshold: z12.number().min(0).max(1).describe("Minimum top-token probability for XTC to fire.")
|
|
2025
2101
|
}).describe("XTC sampler (llama.cpp only).");
|
|
2026
|
-
var SamplingBlockSchema =
|
|
2027
|
-
temperature:
|
|
2028
|
-
topP:
|
|
2029
|
-
topK:
|
|
2030
|
-
minP:
|
|
2031
|
-
maxTokens:
|
|
2032
|
-
seed:
|
|
2033
|
-
repetitionPenalty:
|
|
2034
|
-
repetitionContext:
|
|
2035
|
-
frequencyPenalty:
|
|
2036
|
-
presencePenalty:
|
|
2102
|
+
var SamplingBlockSchema = z12.object({
|
|
2103
|
+
temperature: z12.number().min(0).max(2).optional().describe("Sampling temperature. 0 = greedy. Most reasoning models want 0.6\u20131.0."),
|
|
2104
|
+
topP: z12.number().min(0).max(1).optional().describe("Nucleus sampling. 0.95 is the common default for Qwen, Gemma, Nemotron."),
|
|
2105
|
+
topK: z12.number().int().min(0).max(1e3).optional().describe("Top-k cutoff. 20 for Qwen think, 64 for Gemma, 1 for greedy-on-instruct."),
|
|
2106
|
+
minP: z12.number().min(0).max(1).optional().describe("Min-p cutoff (llama.cpp / MLX / Ollama). Qwen recommends 0."),
|
|
2107
|
+
maxTokens: z12.number().int().positive().optional().describe("Per-turn output token cap. Maps to num_predict / max_tokens / n_predict."),
|
|
2108
|
+
seed: z12.number().int().optional().describe("RNG seed. Unset / negative = random. Best-effort determinism on cloud."),
|
|
2109
|
+
repetitionPenalty: z12.number().min(0).max(3).optional().describe("Local engines (Ollama / llama.cpp / MLX): repeat_penalty. 1.0 = off, 1.1 = mild."),
|
|
2110
|
+
repetitionContext: z12.number().int().positive().optional().describe("Local engines: window size for repetition penalty (`repeat_last_n`)."),
|
|
2111
|
+
frequencyPenalty: z12.number().min(-2).max(2).optional().describe("Cloud (OpenAI) and Ollama / llama.cpp: penalize repeated tokens by frequency."),
|
|
2112
|
+
presencePenalty: z12.number().min(-2).max(2).optional().describe("Cloud (OpenAI) and Ollama / llama.cpp: penalize any reused token."),
|
|
2037
2113
|
dry: DrySamplerSchema.optional(),
|
|
2038
2114
|
xtc: XtcSamplerSchema.optional()
|
|
2039
2115
|
}).describe("Sampling parameters applied per-request.");
|
|
2040
|
-
var ReasoningBlockSchema =
|
|
2041
|
-
effort:
|
|
2116
|
+
var ReasoningBlockSchema = z12.object({
|
|
2117
|
+
effort: z12.enum(["low", "medium", "high"]).optional().describe(
|
|
2042
2118
|
"Cloud reasoning effort. Maps to OpenAI `reasoning.effort` and Anthropic `thinking.budget_tokens` tiers."
|
|
2043
2119
|
),
|
|
2044
|
-
thinkingBudget:
|
|
2120
|
+
thinkingBudget: z12.number().int().positive().optional().describe(
|
|
2045
2121
|
"Explicit thinking-token budget (Anthropic `thinking.budget_tokens`, Nemotron `reasoning_budget`). Wins over `effort` when both set."
|
|
2046
2122
|
),
|
|
2047
|
-
enableThinking:
|
|
2123
|
+
enableThinking: z12.boolean().optional().describe(
|
|
2048
2124
|
"Chat-template toggle for dual-mode models (Qwen3+, Nemotron Nano/Super). Implicit on cloud thinking models."
|
|
2049
2125
|
),
|
|
2050
|
-
templateKwargs:
|
|
2126
|
+
templateKwargs: z12.record(z12.string(), z12.union([z12.string(), z12.number(), z12.boolean()])).optional().describe(
|
|
2051
2127
|
"Chat-template variables that drive this model's reasoning depth, forwarded verbatim as `chat_template_kwargs` on local engines. The names are the model's own \u2014 GPT-OSS reads `reasoning_effort`, Muse Glimmer reads `reasoning_strength` (low|medium|high|xhigh) \u2014 so the manifest declares them rather than the runtime guessing. Lives under `reasoning` (not `engine`) because depth is a per-request choice a tuning profile overrides: `thinking-coding` can ask for xhigh while `instruct` asks for low. Cloud providers ignore it; use `reasoning.effort` there."
|
|
2052
2128
|
)
|
|
2053
2129
|
}).describe("Reasoning controls.");
|
|
2054
|
-
var StructuredOutputSchema =
|
|
2055
|
-
responseFormat:
|
|
2056
|
-
jsonSchema:
|
|
2057
|
-
grammar:
|
|
2130
|
+
var StructuredOutputSchema = z12.object({
|
|
2131
|
+
responseFormat: z12.enum(["text", "json_object"]).optional().describe("Output mode. `text` = freeform (default). `json_object` = enforce JSON."),
|
|
2132
|
+
jsonSchema: z12.unknown().optional().describe("Pin output to a JSON Schema (OpenAI strict mode, llama.cpp --json-schema)."),
|
|
2133
|
+
grammar: z12.string().optional().describe("llama.cpp GBNF grammar. Last-resort structured-output knob.")
|
|
2058
2134
|
}).describe("Structured-output controls.");
|
|
2059
|
-
var PromptTagsSchema =
|
|
2060
|
-
enableThinkingTag:
|
|
2061
|
-
disableThinkingTag:
|
|
2135
|
+
var PromptTagsSchema = z12.object({
|
|
2136
|
+
enableThinkingTag: z12.string().optional().describe("User-prompt tag that enables thinking for this turn (e.g. `/think`)."),
|
|
2137
|
+
disableThinkingTag: z12.string().optional().describe("User-prompt tag that disables thinking for this turn (e.g. `/no_think`).")
|
|
2062
2138
|
}).describe("Per-turn reasoning toggle tags.");
|
|
2063
|
-
var LlamaCppEngineConfigSchema =
|
|
2064
|
-
nGpuLayers:
|
|
2065
|
-
cpuMoe:
|
|
2066
|
-
nCpuMoe:
|
|
2067
|
-
cacheReuse:
|
|
2139
|
+
var LlamaCppEngineConfigSchema = z12.object({
|
|
2140
|
+
nGpuLayers: z12.number().int().min(-1).optional().describe("`--n-gpu-layers` override. -1 = all. Unset = b9843 `auto`/`--fit`."),
|
|
2141
|
+
cpuMoe: z12.boolean().optional().describe("`--cpu-moe`: keep ALL MoE experts in system RAM (attention/dense on GPU)."),
|
|
2142
|
+
nCpuMoe: z12.number().int().min(0).optional().describe("`--n-cpu-moe N`: keep the first N layers\u2019 MoE experts in RAM. Partial split."),
|
|
2143
|
+
cacheReuse: z12.number().int().min(0).optional().describe(
|
|
2068
2144
|
"`--cache-reuse N` prefix-KV reuse chunk. 0 = disable. Unset inherits the global default."
|
|
2069
2145
|
),
|
|
2070
|
-
swaFull:
|
|
2071
|
-
flashAttn:
|
|
2072
|
-
ubatchSize:
|
|
2073
|
-
contextSize:
|
|
2146
|
+
swaFull: z12.boolean().optional().describe("`--swa-full`: full-size SWA cache (Gemma family)."),
|
|
2147
|
+
flashAttn: z12.enum(["on", "off", "auto"]).optional().describe("`--flash-attn` mode override for this model."),
|
|
2148
|
+
ubatchSize: z12.number().int().positive().optional().describe("`--ubatch-size` (inner microbatch) override for this model."),
|
|
2149
|
+
contextSize: z12.number().int().positive().optional().describe(
|
|
2074
2150
|
"Per-turn context ceiling (tokens) this model launches with. Capped by GGUF train ctx."
|
|
2075
2151
|
),
|
|
2076
|
-
chatTemplate:
|
|
2152
|
+
chatTemplate: z12.string().min(1).optional().describe(
|
|
2077
2153
|
"`--chat-template` override for GGUFs whose embedded Jinja template is incompatible with llama.cpp tool parsing."
|
|
2078
2154
|
),
|
|
2079
|
-
threads:
|
|
2080
|
-
batchSize:
|
|
2081
|
-
spec:
|
|
2082
|
-
type:
|
|
2155
|
+
threads: z12.number().int().positive().optional().describe("`--threads` override."),
|
|
2156
|
+
batchSize: z12.number().int().positive().optional().describe("`--batch-size` override."),
|
|
2157
|
+
spec: z12.object({
|
|
2158
|
+
type: z12.enum([
|
|
2083
2159
|
"none",
|
|
2084
2160
|
"draft-mtp",
|
|
2085
2161
|
"draft-eagle3",
|
|
@@ -2091,24 +2167,24 @@ var LlamaCppEngineConfigSchema = z10.object({
|
|
|
2091
2167
|
"ngram-map-k4v",
|
|
2092
2168
|
"ngram-cache"
|
|
2093
2169
|
]).optional().describe("`--spec-type` speculative-decoding mode for this model."),
|
|
2094
|
-
mtp:
|
|
2170
|
+
mtp: z12.boolean().optional().describe(
|
|
2095
2171
|
"VERIFIED capability metadata: this model\u2019s target or companion GGUF carries MTP tensors. Does not enable `draft-mtp` by itself."
|
|
2096
2172
|
),
|
|
2097
|
-
draftModelId:
|
|
2098
|
-
nMax:
|
|
2173
|
+
draftModelId: z12.string().optional().describe("Catalog id / path of the draft model for `draft-simple`."),
|
|
2174
|
+
nMax: z12.number().int().positive().optional().describe("`--spec-draft-n-max`: tokens drafted per step.")
|
|
2099
2175
|
}).optional().describe("Speculative-decoding config for this model.")
|
|
2100
2176
|
}).describe("Per-model llama.cpp launch-flag defaults (engine-level, applied at model load).");
|
|
2101
|
-
var EngineConfigSchema =
|
|
2177
|
+
var EngineConfigSchema = z12.object({
|
|
2102
2178
|
llamaCpp: LlamaCppEngineConfigSchema.optional()
|
|
2103
2179
|
}).describe("Per-model engine launch-flag defaults, keyed by engine.");
|
|
2104
|
-
var ChatModelTuningBaseSchema =
|
|
2180
|
+
var ChatModelTuningBaseSchema = z12.object({
|
|
2105
2181
|
sampling: SamplingBlockSchema.optional(),
|
|
2106
2182
|
samplingWhenThinking: SamplingBlockSchema.optional().describe(
|
|
2107
2183
|
"Sparse override of `sampling` applied when the runtime determines reasoning is engaged. Used by Qwen3+ (different sampling for /think mode) and Nemotron Nano (different sampling for thinking vs instruct)."
|
|
2108
2184
|
),
|
|
2109
2185
|
reasoning: ReasoningBlockSchema.optional(),
|
|
2110
2186
|
output: StructuredOutputSchema.optional(),
|
|
2111
|
-
toolChoice:
|
|
2187
|
+
toolChoice: z12.enum(["auto", "required", "none"]).optional().describe(
|
|
2112
2188
|
"Tool selection mode (cloud + llama.cpp + MLX). `auto` lets the model decide; `required` forces a tool call this turn; `none` disables tools."
|
|
2113
2189
|
),
|
|
2114
2190
|
promptTags: PromptTagsSchema.optional()
|
|
@@ -2117,23 +2193,69 @@ var ChatModelTuningSchema = ChatModelTuningBaseSchema.extend({
|
|
|
2117
2193
|
engine: EngineConfigSchema.optional().describe(
|
|
2118
2194
|
"Per-model ENGINE launch-flag defaults (llama.cpp `--n-gpu-layers`, `--cpu-moe`, `--spec-type`, \u2026). Applied once at model load, not per request \u2014 so it lives on the top-level tuning object, not inside per-request `profiles`."
|
|
2119
2195
|
),
|
|
2120
|
-
profiles:
|
|
2196
|
+
profiles: z12.record(TuningProfileIdSchema, ChatModelTuningBaseSchema.partial()).optional().describe(
|
|
2121
2197
|
"Named tuning presets this model implements. Gezel frontmatter `tuningProfile` selects one; the resolver applies the profile as a layer between installDefault and catalog base. Missing requested profiles walk the canonical fallback chain."
|
|
2122
2198
|
)
|
|
2123
2199
|
}).describe("Per-model sampling, reasoning, and output defaults.");
|
|
2124
2200
|
|
|
2125
2201
|
// src/schemas/question.ts
|
|
2126
|
-
import { z as
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2202
|
+
import { z as z14 } from "zod";
|
|
2203
|
+
|
|
2204
|
+
// src/schemas/npm-package.ts
|
|
2205
|
+
import { z as z13 } from "zod";
|
|
2206
|
+
var NPM_NAME_SEGMENT = /^[a-z0-9](?:[a-z0-9._~-]*[a-z0-9])?$/;
|
|
2207
|
+
var SEMVER_NUMBER = String.raw`(?:0|[1-9]\d*)`;
|
|
2208
|
+
var SEMVER_PART = String.raw`(?:${SEMVER_NUMBER}|[xX*])`;
|
|
2209
|
+
var SEMVER_CORE = String.raw`${SEMVER_PART}(?:\.${SEMVER_PART}){0,2}`;
|
|
2210
|
+
var SEMVER_IDENTIFIER = String.raw`[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*`;
|
|
2211
|
+
var SEMVER_SUFFIX = String.raw`(?:-${SEMVER_IDENTIFIER})?(?:\+${SEMVER_IDENTIFIER})?`;
|
|
2212
|
+
var SEMVER_ATOM = new RegExp(String.raw`^(?:\^|~|>=|<=|>|<|=)?v?${SEMVER_CORE}${SEMVER_SUFFIX}$`);
|
|
2213
|
+
var SEMVER_HYPHEN_RANGE = new RegExp(
|
|
2214
|
+
String.raw`^v?${SEMVER_CORE}${SEMVER_SUFFIX}\s+-\s+v?${SEMVER_CORE}${SEMVER_SUFFIX}$`
|
|
2215
|
+
);
|
|
2216
|
+
var DIST_TAG = /^[a-z][a-z0-9._-]{0,127}$/;
|
|
2217
|
+
function isValidNpmPackageName(value) {
|
|
2218
|
+
if (typeof value !== "string" || value.length === 0 || value.length > 214) return false;
|
|
2219
|
+
if (value !== value.trim() || value !== value.toLowerCase()) return false;
|
|
2220
|
+
if (value.startsWith("@")) {
|
|
2221
|
+
const parts = value.slice(1).split("/");
|
|
2222
|
+
return parts.length === 2 && parts[0] !== void 0 && parts[1] !== void 0 && NPM_NAME_SEGMENT.test(parts[0]) && NPM_NAME_SEGMENT.test(parts[1]);
|
|
2223
|
+
}
|
|
2224
|
+
return !value.includes("/") && NPM_NAME_SEGMENT.test(value);
|
|
2225
|
+
}
|
|
2226
|
+
function isValidNpmRegistryVersion(value) {
|
|
2227
|
+
if (typeof value !== "string" || value.length === 0 || value.length > 128) return false;
|
|
2228
|
+
if (value !== value.trim()) return false;
|
|
2229
|
+
if (DIST_TAG.test(value) || SEMVER_HYPHEN_RANGE.test(value)) return true;
|
|
2230
|
+
const alternatives = value.split("||");
|
|
2231
|
+
if (alternatives.some((part) => part.trim().length === 0)) return false;
|
|
2232
|
+
return alternatives.every((alternative) => {
|
|
2233
|
+
const atoms = alternative.trim().split(/\s+/);
|
|
2234
|
+
return atoms.length > 0 && atoms.every((atom) => SEMVER_ATOM.test(atom));
|
|
2235
|
+
});
|
|
2236
|
+
}
|
|
2237
|
+
var NpmPackageNameSchema = z13.string().refine(isValidNpmPackageName, {
|
|
2238
|
+
message: "must be a lowercase npm registry package name (for example zod or @types/node)"
|
|
2239
|
+
});
|
|
2240
|
+
var NpmRegistryVersionSchema = z13.string().refine(isValidNpmRegistryVersion, {
|
|
2241
|
+
message: "must be a registry dist-tag or semver range"
|
|
2242
|
+
});
|
|
2243
|
+
var NpmRegistryPackageRequestSchema = z13.object({
|
|
2244
|
+
package: NpmPackageNameSchema,
|
|
2245
|
+
version: NpmRegistryVersionSchema.optional()
|
|
2246
|
+
}).strict();
|
|
2247
|
+
|
|
2248
|
+
// src/schemas/question.ts
|
|
2249
|
+
var NpmInstallApprovalDecisionSchema = z14.object({
|
|
2250
|
+
package: NpmPackageNameSchema,
|
|
2251
|
+
version: NpmRegistryVersionSchema,
|
|
2252
|
+
decision: z14.enum(["install", "always", "decline"])
|
|
2131
2253
|
});
|
|
2132
|
-
var QuestionAnswerSchema =
|
|
2254
|
+
var QuestionAnswerSchema = z14.object({
|
|
2133
2255
|
/** Indices into `choices` the user picked. Empty when only write-in. */
|
|
2134
|
-
selectedChoices:
|
|
2256
|
+
selectedChoices: z14.array(z14.number().int().min(0)).optional(),
|
|
2135
2257
|
/** Free-text the user typed. Empty when they only clicked choices. */
|
|
2136
|
-
writeIn:
|
|
2258
|
+
writeIn: z14.string().optional(),
|
|
2137
2259
|
/**
|
|
2138
2260
|
* Set when the user explicitly dismissed BUT wants the gezel to
|
|
2139
2261
|
* proceed anyway with sensible defaults. Triggers a synthetic
|
|
@@ -2141,7 +2263,7 @@ var QuestionAnswerSchema = z11.object({
|
|
|
2141
2263
|
* so the gezel knows to make decisions on the user's behalf.
|
|
2142
2264
|
* UI label: "Just do whatever".
|
|
2143
2265
|
*/
|
|
2144
|
-
declined:
|
|
2266
|
+
declined: z14.boolean().optional(),
|
|
2145
2267
|
/**
|
|
2146
2268
|
* Set when the user just wants the question to go away — no
|
|
2147
2269
|
* follow-up turn, no work done, nothing for the gezel to act on.
|
|
@@ -2150,91 +2272,97 @@ var QuestionAnswerSchema = z11.object({
|
|
|
2150
2272
|
* from `declined` so the model never sees a "user wants defaults"
|
|
2151
2273
|
* signal that the user didn't intend. UI label: "Skip".
|
|
2152
2274
|
*/
|
|
2153
|
-
silentSkip:
|
|
2275
|
+
silentSkip: z14.boolean().optional(),
|
|
2154
2276
|
/**
|
|
2155
2277
|
* Per-package decisions for `npm-install-approval` questions. When
|
|
2156
2278
|
* set, the answer handler installs / always-allows / declines each
|
|
2157
2279
|
* package and emits a single follow-up summary into the session.
|
|
2158
2280
|
*/
|
|
2159
|
-
npmInstallDecisions:
|
|
2160
|
-
at:
|
|
2281
|
+
npmInstallDecisions: z14.array(NpmInstallApprovalDecisionSchema).optional(),
|
|
2282
|
+
at: z14.string()
|
|
2161
2283
|
});
|
|
2162
|
-
var NpmInstallApprovalPackageSchema =
|
|
2163
|
-
package:
|
|
2164
|
-
version:
|
|
2284
|
+
var NpmInstallApprovalPackageSchema = z14.object({
|
|
2285
|
+
package: NpmPackageNameSchema,
|
|
2286
|
+
version: NpmRegistryVersionSchema
|
|
2165
2287
|
});
|
|
2166
|
-
var CommandApprovalScopeSchema =
|
|
2167
|
-
var
|
|
2168
|
-
|
|
2288
|
+
var CommandApprovalScopeSchema = z14.enum(["script", "npx"]);
|
|
2289
|
+
var CommandApprovalInputFileSchema = z14.object({
|
|
2290
|
+
/** Workspace-relative, slash-normalized path shown in the approval prompt. */
|
|
2291
|
+
path: z14.string().min(1),
|
|
2292
|
+
sha256: z14.string().regex(/^[a-f0-9]{64}$/)
|
|
2293
|
+
});
|
|
2294
|
+
var CommandApprovalIntentSchema = z14.object({
|
|
2295
|
+
kind: z14.literal("command-approval"),
|
|
2169
2296
|
scope: CommandApprovalScopeSchema,
|
|
2170
|
-
name:
|
|
2171
|
-
body:
|
|
2172
|
-
args:
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2297
|
+
name: z14.string().min(1),
|
|
2298
|
+
body: z14.string().optional(),
|
|
2299
|
+
args: z14.array(z14.string()).optional(),
|
|
2300
|
+
inputFiles: z14.array(CommandApprovalInputFileSchema).max(128).optional()
|
|
2301
|
+
});
|
|
2302
|
+
var ToolPermissionIntentSchema = z14.object({
|
|
2303
|
+
kind: z14.literal("tool-permission"),
|
|
2304
|
+
toolName: z14.string(),
|
|
2305
|
+
toolInput: z14.record(z14.string(), z14.unknown())
|
|
2306
|
+
});
|
|
2307
|
+
var ToolsetInstallApprovalIntentSchema = z14.object({
|
|
2308
|
+
kind: z14.literal("toolset-install-approval"),
|
|
2309
|
+
toolsetId: z14.string(),
|
|
2310
|
+
sourceId: z14.string(),
|
|
2311
|
+
version: z14.string(),
|
|
2312
|
+
targetProjectId: z14.string(),
|
|
2313
|
+
craftbookId: z14.string()
|
|
2314
|
+
});
|
|
2315
|
+
var ImageGenerationApprovalIntentSchema = z14.object({
|
|
2316
|
+
kind: z14.literal("image-generation-approval"),
|
|
2317
|
+
provider: z14.string(),
|
|
2318
|
+
model: z14.string(),
|
|
2191
2319
|
/** Truncated prompt the model is about to send. Surfaced verbatim. */
|
|
2192
|
-
promptPreview:
|
|
2320
|
+
promptPreview: z14.string(),
|
|
2193
2321
|
/** Resolved generation size, e.g. '2K 16:9' or '1024x1024'. Optional. */
|
|
2194
|
-
estimatedSize:
|
|
2322
|
+
estimatedSize: z14.string().optional()
|
|
2195
2323
|
});
|
|
2196
|
-
var VideoGenerationApprovalIntentSchema =
|
|
2197
|
-
kind:
|
|
2198
|
-
provider:
|
|
2199
|
-
model:
|
|
2200
|
-
promptPreview:
|
|
2324
|
+
var VideoGenerationApprovalIntentSchema = z14.object({
|
|
2325
|
+
kind: z14.literal("video-generation-approval"),
|
|
2326
|
+
provider: z14.string(),
|
|
2327
|
+
model: z14.string(),
|
|
2328
|
+
promptPreview: z14.string(),
|
|
2201
2329
|
/** Resolved clip shape, e.g. '704×480 · 97f · 24fps'. Optional. */
|
|
2202
|
-
estimatedSize:
|
|
2330
|
+
estimatedSize: z14.string().optional()
|
|
2203
2331
|
});
|
|
2204
|
-
var ScheduleApprovalIntentSchema =
|
|
2205
|
-
kind:
|
|
2206
|
-
typeId:
|
|
2207
|
-
craftbookId:
|
|
2332
|
+
var ScheduleApprovalIntentSchema = z14.object({
|
|
2333
|
+
kind: z14.literal("schedule-approval"),
|
|
2334
|
+
typeId: z14.string(),
|
|
2335
|
+
craftbookId: z14.string(),
|
|
2208
2336
|
/**
|
|
2209
2337
|
* Recurrence flavor. Absent → 'scheduled' (every question written
|
|
2210
2338
|
* before this field existed is a cron schedule). 'night-shift' hosts
|
|
2211
2339
|
* run inside the Night Shift window instead of on a user-visible cron;
|
|
2212
2340
|
* the card copy switches accordingly.
|
|
2213
2341
|
*/
|
|
2214
|
-
runMode:
|
|
2342
|
+
runMode: z14.enum(["scheduled", "night-shift"]).optional(),
|
|
2215
2343
|
/**
|
|
2216
2344
|
* 5-field cron expression (UTC). Surfaced verbatim on the card for
|
|
2217
2345
|
* 'scheduled' hosts; for 'night-shift' hosts it is the internal
|
|
2218
2346
|
* heartbeat and the card shows the window instead.
|
|
2219
2347
|
*/
|
|
2220
|
-
cron:
|
|
2221
|
-
overlap:
|
|
2348
|
+
cron: z14.string(),
|
|
2349
|
+
overlap: z14.enum(["skip", "queue", "concurrent"]).optional()
|
|
2222
2350
|
});
|
|
2223
|
-
var NightShiftReviewIntentSchema =
|
|
2224
|
-
kind:
|
|
2351
|
+
var NightShiftReviewIntentSchema = z14.object({
|
|
2352
|
+
kind: z14.literal("night-shift-review"),
|
|
2225
2353
|
/** The window's day key (see `nightShiftWindowKey`). */
|
|
2226
|
-
windowKey:
|
|
2227
|
-
tasksCompleted:
|
|
2228
|
-
reports:
|
|
2229
|
-
|
|
2230
|
-
projectId:
|
|
2231
|
-
path:
|
|
2232
|
-
title:
|
|
2233
|
-
actionCount:
|
|
2354
|
+
windowKey: z14.string(),
|
|
2355
|
+
tasksCompleted: z14.number(),
|
|
2356
|
+
reports: z14.array(
|
|
2357
|
+
z14.object({
|
|
2358
|
+
projectId: z14.string(),
|
|
2359
|
+
path: z14.string(),
|
|
2360
|
+
title: z14.string().optional(),
|
|
2361
|
+
actionCount: z14.number()
|
|
2234
2362
|
})
|
|
2235
2363
|
)
|
|
2236
2364
|
});
|
|
2237
|
-
var TaskPausedReasonSchema =
|
|
2365
|
+
var TaskPausedReasonSchema = z14.enum([
|
|
2238
2366
|
"gate_exhausted",
|
|
2239
2367
|
"gate_plateau",
|
|
2240
2368
|
"gate_unsatisfiable",
|
|
@@ -2242,22 +2370,22 @@ var TaskPausedReasonSchema = z11.enum([
|
|
|
2242
2370
|
"step_stalled",
|
|
2243
2371
|
"budget_exhausted"
|
|
2244
2372
|
]);
|
|
2245
|
-
var TaskPausedIntentSchema =
|
|
2246
|
-
kind:
|
|
2373
|
+
var TaskPausedIntentSchema = z14.object({
|
|
2374
|
+
kind: z14.literal("task-paused"),
|
|
2247
2375
|
/** `projectId/num` of the paused task — the dedup key. */
|
|
2248
|
-
taskRef:
|
|
2249
|
-
stepId:
|
|
2376
|
+
taskRef: z14.string(),
|
|
2377
|
+
stepId: z14.string().optional(),
|
|
2250
2378
|
reason: TaskPausedReasonSchema
|
|
2251
2379
|
});
|
|
2252
|
-
var QuestionIntentSchema =
|
|
2253
|
-
|
|
2254
|
-
kind:
|
|
2380
|
+
var QuestionIntentSchema = z14.discriminatedUnion("kind", [
|
|
2381
|
+
z14.object({
|
|
2382
|
+
kind: z14.literal("npm-install-approval"),
|
|
2255
2383
|
/**
|
|
2256
2384
|
* Packages that need approval. Always at least one; multiple when
|
|
2257
2385
|
* the gezel batched an install call (encouraged) or when we merged
|
|
2258
2386
|
* a later request into the same pending question for dedup.
|
|
2259
2387
|
*/
|
|
2260
|
-
packages:
|
|
2388
|
+
packages: z14.array(NpmInstallApprovalPackageSchema).min(1)
|
|
2261
2389
|
}),
|
|
2262
2390
|
CommandApprovalIntentSchema,
|
|
2263
2391
|
ToolPermissionIntentSchema,
|
|
@@ -2268,61 +2396,61 @@ var QuestionIntentSchema = z11.discriminatedUnion("kind", [
|
|
|
2268
2396
|
NightShiftReviewIntentSchema,
|
|
2269
2397
|
TaskPausedIntentSchema
|
|
2270
2398
|
]);
|
|
2271
|
-
var QuestionSchema =
|
|
2272
|
-
id:
|
|
2273
|
-
projectId:
|
|
2274
|
-
gezelId:
|
|
2275
|
-
sessionId:
|
|
2399
|
+
var QuestionSchema = z14.object({
|
|
2400
|
+
id: z14.string(),
|
|
2401
|
+
projectId: z14.string(),
|
|
2402
|
+
gezelId: z14.string(),
|
|
2403
|
+
sessionId: z14.string(),
|
|
2276
2404
|
/** Body of the question — supports markdown. */
|
|
2277
|
-
prompt:
|
|
2405
|
+
prompt: z14.string().min(1),
|
|
2278
2406
|
/** Optional preset choices. Empty / omitted => write-in only. */
|
|
2279
|
-
choices:
|
|
2407
|
+
choices: z14.array(z14.string()).max(20).optional(),
|
|
2280
2408
|
/** Whether the user can also type a write-in alongside choices. Default true. */
|
|
2281
|
-
allowWriteIn:
|
|
2409
|
+
allowWriteIn: z14.boolean().optional(),
|
|
2282
2410
|
/** Whether multiple choices may be selected. Default false. */
|
|
2283
|
-
multiSelect:
|
|
2411
|
+
multiSelect: z14.boolean().optional(),
|
|
2284
2412
|
/**
|
|
2285
2413
|
* Approval-flow attachment: a task this question is *about*. Stored in
|
|
2286
2414
|
* `projectId/num` form so existing parsing helpers work. The UI shows
|
|
2287
2415
|
* the task title + status above the prompt and offers an "Open task"
|
|
2288
2416
|
* link.
|
|
2289
2417
|
*/
|
|
2290
|
-
taskRef:
|
|
2418
|
+
taskRef: z14.string().optional(),
|
|
2291
2419
|
/**
|
|
2292
2420
|
* Approval-flow attachment: a document this question is *about*.
|
|
2293
2421
|
* Project-relative path when `projectId` is set, otherwise into the
|
|
2294
2422
|
* global `~/.gezel/documents/` library. The UI renders a collapsed
|
|
2295
2423
|
* preview + "Open document" link.
|
|
2296
2424
|
*/
|
|
2297
|
-
documentPath:
|
|
2425
|
+
documentPath: z14.string().optional(),
|
|
2298
2426
|
/**
|
|
2299
2427
|
* Service-created specialized-question marker (see `QuestionIntent`
|
|
2300
2428
|
* for context). Absent for plain user-facing questions asked via
|
|
2301
2429
|
* the `ask_user_question` MCP tool.
|
|
2302
2430
|
*/
|
|
2303
2431
|
intent: QuestionIntentSchema.optional(),
|
|
2304
|
-
createdAt:
|
|
2432
|
+
createdAt: z14.string(),
|
|
2305
2433
|
/** Set once the user has answered (or declined). */
|
|
2306
2434
|
answer: QuestionAnswerSchema.optional()
|
|
2307
2435
|
});
|
|
2308
2436
|
|
|
2309
2437
|
// src/schemas/recognition.ts
|
|
2310
|
-
import { z as
|
|
2311
|
-
var ImageExifSchema =
|
|
2312
|
-
make:
|
|
2313
|
-
model:
|
|
2314
|
-
lensModel:
|
|
2315
|
-
dateTimeOriginal:
|
|
2316
|
-
orientation:
|
|
2317
|
-
software:
|
|
2318
|
-
imageDescription:
|
|
2319
|
-
});
|
|
2320
|
-
var ImageStaticMetaSchema =
|
|
2321
|
-
format:
|
|
2322
|
-
width:
|
|
2323
|
-
height:
|
|
2324
|
-
byteLength:
|
|
2325
|
-
sha256:
|
|
2438
|
+
import { z as z15 } from "zod";
|
|
2439
|
+
var ImageExifSchema = z15.object({
|
|
2440
|
+
make: z15.string().optional(),
|
|
2441
|
+
model: z15.string().optional(),
|
|
2442
|
+
lensModel: z15.string().optional(),
|
|
2443
|
+
dateTimeOriginal: z15.string().optional(),
|
|
2444
|
+
orientation: z15.number().int().min(1).max(8).optional(),
|
|
2445
|
+
software: z15.string().optional(),
|
|
2446
|
+
imageDescription: z15.string().optional()
|
|
2447
|
+
});
|
|
2448
|
+
var ImageStaticMetaSchema = z15.object({
|
|
2449
|
+
format: z15.enum(["png", "jpeg", "gif", "webp", "svg", "unknown"]),
|
|
2450
|
+
width: z15.number().int().positive().optional(),
|
|
2451
|
+
height: z15.number().int().positive().optional(),
|
|
2452
|
+
byteLength: z15.number().int().nonnegative(),
|
|
2453
|
+
sha256: z15.string().regex(/^[a-f0-9]{64}$/),
|
|
2326
2454
|
/**
|
|
2327
2455
|
* PNG `tEXt`/`iTXt`/`zTXt` keyword→value pairs. Generation provenance lives
|
|
2328
2456
|
* here (A1111 writes `parameters`, ComfyUI writes `prompt`/`workflow`) and
|
|
@@ -2331,153 +2459,153 @@ var ImageStaticMetaSchema = z12.object({
|
|
|
2331
2459
|
* Attacker-controlled: anyone can author a PNG whose `Description` chunk
|
|
2332
2460
|
* reads "Ignore previous instructions". Renderers MUST fence and cap this.
|
|
2333
2461
|
*/
|
|
2334
|
-
pngText:
|
|
2462
|
+
pngText: z15.record(z15.string(), z15.string()).optional(),
|
|
2335
2463
|
exif: ImageExifSchema.optional(),
|
|
2336
2464
|
/** Withheld from every prompt. See the schema doc above. */
|
|
2337
|
-
gps:
|
|
2465
|
+
gps: z15.object({ lat: z15.number(), lon: z15.number() }).optional(),
|
|
2338
2466
|
/** True when the file carried location data we deliberately dropped. */
|
|
2339
|
-
gpsRedacted:
|
|
2467
|
+
gpsRedacted: z15.boolean().optional(),
|
|
2340
2468
|
/**
|
|
2341
2469
|
* Heuristic from dimensions, format, and metadata — drives `auto` mode
|
|
2342
2470
|
* selection without paying a classifier call.
|
|
2343
2471
|
*/
|
|
2344
|
-
likelyScreenshot:
|
|
2472
|
+
likelyScreenshot: z15.boolean().optional()
|
|
2345
2473
|
});
|
|
2346
|
-
var RecognitionModeSchema =
|
|
2347
|
-
var RecognitionModeRequestSchema =
|
|
2348
|
-
var ImageRecognitionSchema =
|
|
2349
|
-
schemaVersion:
|
|
2350
|
-
sha256:
|
|
2474
|
+
var RecognitionModeSchema = z15.enum(["describe", "ocr", "ui", "extract"]);
|
|
2475
|
+
var RecognitionModeRequestSchema = z15.enum(["auto", "describe", "ocr", "ui", "extract"]);
|
|
2476
|
+
var ImageRecognitionSchema = z15.object({
|
|
2477
|
+
schemaVersion: z15.literal(1),
|
|
2478
|
+
sha256: z15.string().regex(/^[a-f0-9]{64}$/),
|
|
2351
2479
|
meta: ImageStaticMetaSchema,
|
|
2352
|
-
modes:
|
|
2353
|
-
description:
|
|
2354
|
-
ocrText:
|
|
2355
|
-
structured:
|
|
2356
|
-
templateId:
|
|
2357
|
-
data:
|
|
2480
|
+
modes: z15.array(RecognitionModeSchema).min(1),
|
|
2481
|
+
description: z15.string().optional(),
|
|
2482
|
+
ocrText: z15.string().optional(),
|
|
2483
|
+
structured: z15.object({
|
|
2484
|
+
templateId: z15.string().optional(),
|
|
2485
|
+
data: z15.unknown()
|
|
2358
2486
|
}).optional(),
|
|
2359
|
-
engine:
|
|
2360
|
-
modelId:
|
|
2361
|
-
status:
|
|
2362
|
-
failureReason:
|
|
2363
|
-
durationMs:
|
|
2364
|
-
at:
|
|
2365
|
-
});
|
|
2366
|
-
var MessageImageDigestSchema =
|
|
2487
|
+
engine: z15.enum(["llama-cpp", "mlx", "mock", "none"]),
|
|
2488
|
+
modelId: z15.string(),
|
|
2489
|
+
status: z15.enum(["ok", "partial", "failed", "static-only"]),
|
|
2490
|
+
failureReason: z15.string().optional(),
|
|
2491
|
+
durationMs: z15.number().int().nonnegative(),
|
|
2492
|
+
at: z15.string()
|
|
2493
|
+
});
|
|
2494
|
+
var MessageImageDigestSchema = z15.object({
|
|
2367
2495
|
/** The markdown ref exactly as it appears in the message body. */
|
|
2368
|
-
ref:
|
|
2369
|
-
sha256:
|
|
2496
|
+
ref: z15.string(),
|
|
2497
|
+
sha256: z15.string().regex(/^[a-f0-9]{64}$/),
|
|
2370
2498
|
/** Pre-rendered, already capped and fenced-safe. */
|
|
2371
|
-
digest:
|
|
2372
|
-
modelId:
|
|
2373
|
-
modes:
|
|
2374
|
-
status:
|
|
2375
|
-
at:
|
|
2499
|
+
digest: z15.string(),
|
|
2500
|
+
modelId: z15.string(),
|
|
2501
|
+
modes: z15.array(RecognitionModeSchema),
|
|
2502
|
+
status: z15.enum(["ok", "partial", "failed", "static-only"]),
|
|
2503
|
+
at: z15.string()
|
|
2376
2504
|
});
|
|
2377
|
-
var RecognitionRequestSchema =
|
|
2505
|
+
var RecognitionRequestSchema = z15.object({
|
|
2378
2506
|
/** Project-relative artifact path, e.g. `attachments/<uuid>.png`. */
|
|
2379
|
-
artifactPath:
|
|
2380
|
-
data:
|
|
2381
|
-
mimeType:
|
|
2507
|
+
artifactPath: z15.string().min(1).optional(),
|
|
2508
|
+
data: z15.string().min(1).optional(),
|
|
2509
|
+
mimeType: z15.string().optional(),
|
|
2382
2510
|
mode: RecognitionModeRequestSchema.default("auto"),
|
|
2383
2511
|
/** JSON Schema for `extract` mode — fed to llama-server `response_format`. */
|
|
2384
|
-
schema:
|
|
2512
|
+
schema: z15.unknown().optional(),
|
|
2385
2513
|
/** Overrides the configured recognition model for this call. */
|
|
2386
|
-
model:
|
|
2387
|
-
});
|
|
2388
|
-
var RecognitionHealthSchema =
|
|
2389
|
-
state:
|
|
2390
|
-
modelId:
|
|
2391
|
-
detail:
|
|
2392
|
-
});
|
|
2393
|
-
var RecognitionPullEventSchema =
|
|
2394
|
-
|
|
2395
|
-
type:
|
|
2396
|
-
bytesWritten:
|
|
2397
|
-
totalBytes:
|
|
2514
|
+
model: z15.string().optional()
|
|
2515
|
+
});
|
|
2516
|
+
var RecognitionHealthSchema = z15.object({
|
|
2517
|
+
state: z15.enum(["ok", "no-model", "not-configured", "error"]),
|
|
2518
|
+
modelId: z15.string().optional(),
|
|
2519
|
+
detail: z15.string().optional()
|
|
2520
|
+
});
|
|
2521
|
+
var RecognitionPullEventSchema = z15.union([
|
|
2522
|
+
z15.object({
|
|
2523
|
+
type: z15.literal("progress"),
|
|
2524
|
+
bytesWritten: z15.number().int().nonnegative(),
|
|
2525
|
+
totalBytes: z15.number().int().nonnegative().optional()
|
|
2398
2526
|
}),
|
|
2399
|
-
|
|
2400
|
-
|
|
2527
|
+
z15.object({ type: z15.literal("error"), error: z15.string() }),
|
|
2528
|
+
z15.object({ type: z15.literal("done"), id: z15.string() })
|
|
2401
2529
|
]);
|
|
2402
|
-
var RecognitionCatalogEntrySchema =
|
|
2403
|
-
id:
|
|
2404
|
-
name:
|
|
2405
|
-
description:
|
|
2406
|
-
license:
|
|
2407
|
-
approxSizeBytes:
|
|
2408
|
-
recoScore:
|
|
2409
|
-
});
|
|
2410
|
-
var ListRecognitionCatalogResponseSchema =
|
|
2411
|
-
models:
|
|
2412
|
-
});
|
|
2413
|
-
var InstalledRecognitionModelSchema =
|
|
2414
|
-
id:
|
|
2415
|
-
name:
|
|
2416
|
-
approxSizeBytes:
|
|
2417
|
-
installedAt:
|
|
2418
|
-
weightsPath:
|
|
2419
|
-
mmprojPath:
|
|
2420
|
-
});
|
|
2421
|
-
var ListInstalledRecognitionModelsResponseSchema =
|
|
2422
|
-
models:
|
|
2530
|
+
var RecognitionCatalogEntrySchema = z15.object({
|
|
2531
|
+
id: z15.string(),
|
|
2532
|
+
name: z15.string(),
|
|
2533
|
+
description: z15.string(),
|
|
2534
|
+
license: z15.string(),
|
|
2535
|
+
approxSizeBytes: z15.number().int().nonnegative(),
|
|
2536
|
+
recoScore: z15.number()
|
|
2537
|
+
});
|
|
2538
|
+
var ListRecognitionCatalogResponseSchema = z15.object({
|
|
2539
|
+
models: z15.array(RecognitionCatalogEntrySchema)
|
|
2540
|
+
});
|
|
2541
|
+
var InstalledRecognitionModelSchema = z15.object({
|
|
2542
|
+
id: z15.string(),
|
|
2543
|
+
name: z15.string(),
|
|
2544
|
+
approxSizeBytes: z15.number().int().nonnegative(),
|
|
2545
|
+
installedAt: z15.string(),
|
|
2546
|
+
weightsPath: z15.string().optional(),
|
|
2547
|
+
mmprojPath: z15.string().optional()
|
|
2548
|
+
});
|
|
2549
|
+
var ListInstalledRecognitionModelsResponseSchema = z15.object({
|
|
2550
|
+
models: z15.array(InstalledRecognitionModelSchema)
|
|
2423
2551
|
});
|
|
2424
2552
|
|
|
2425
2553
|
// src/schemas/session-telemetry.ts
|
|
2426
|
-
import { z as
|
|
2427
|
-
var SessionGpuTaskSchema =
|
|
2554
|
+
import { z as z16 } from "zod";
|
|
2555
|
+
var SessionGpuTaskSchema = z16.enum([
|
|
2428
2556
|
"image_generation",
|
|
2429
2557
|
"video_generation",
|
|
2430
2558
|
"image_recognition"
|
|
2431
2559
|
]);
|
|
2432
|
-
var SessionTurnTelemetrySchema =
|
|
2560
|
+
var SessionTurnTelemetrySchema = z16.object({
|
|
2433
2561
|
/** Epoch ms when the in-flight turn started. */
|
|
2434
|
-
startedAt:
|
|
2435
|
-
streamedContentChars:
|
|
2436
|
-
toolCalls:
|
|
2437
|
-
fileMutations:
|
|
2438
|
-
});
|
|
2439
|
-
var SessionTelemetrySchema =
|
|
2440
|
-
sessionId:
|
|
2441
|
-
gezelId:
|
|
2442
|
-
projectId:
|
|
2562
|
+
startedAt: z16.number(),
|
|
2563
|
+
streamedContentChars: z16.number().int().nonnegative(),
|
|
2564
|
+
toolCalls: z16.number().int().nonnegative(),
|
|
2565
|
+
fileMutations: z16.number().int().nonnegative()
|
|
2566
|
+
});
|
|
2567
|
+
var SessionTelemetrySchema = z16.object({
|
|
2568
|
+
sessionId: z16.string(),
|
|
2569
|
+
gezelId: z16.string(),
|
|
2570
|
+
projectId: z16.string(),
|
|
2443
2571
|
/** True while a send is currently running for this session. */
|
|
2444
|
-
inflight:
|
|
2445
|
-
turnsStarted:
|
|
2446
|
-
deltaChunks:
|
|
2447
|
-
streamedContentChars:
|
|
2448
|
-
wirePulses:
|
|
2449
|
-
heartbeats:
|
|
2450
|
-
enginePhaseEvents:
|
|
2572
|
+
inflight: z16.boolean(),
|
|
2573
|
+
turnsStarted: z16.number().int().nonnegative(),
|
|
2574
|
+
deltaChunks: z16.number().int().nonnegative(),
|
|
2575
|
+
streamedContentChars: z16.number().int().nonnegative(),
|
|
2576
|
+
wirePulses: z16.number().int().nonnegative(),
|
|
2577
|
+
heartbeats: z16.number().int().nonnegative(),
|
|
2578
|
+
enginePhaseEvents: z16.number().int().nonnegative(),
|
|
2451
2579
|
/**
|
|
2452
2580
|
* `engine_phase === 'generating'` transitions — roughly one per completion
|
|
2453
2581
|
* request the engine served (the slot-launch granularity stall logic and
|
|
2454
2582
|
* the eval chatter threshold were calibrated against).
|
|
2455
2583
|
*/
|
|
2456
|
-
generationSpurts:
|
|
2457
|
-
toolCalls:
|
|
2458
|
-
toolArgChars:
|
|
2459
|
-
fileMutations:
|
|
2460
|
-
gpuEvents:
|
|
2584
|
+
generationSpurts: z16.number().int().nonnegative(),
|
|
2585
|
+
toolCalls: z16.number().int().nonnegative(),
|
|
2586
|
+
toolArgChars: z16.number().int().nonnegative(),
|
|
2587
|
+
fileMutations: z16.number().int().nonnegative(),
|
|
2588
|
+
gpuEvents: z16.number().int().nonnegative(),
|
|
2461
2589
|
gpuTaskActive: SessionGpuTaskSchema.nullable(),
|
|
2462
2590
|
/** Epoch ms of the last streamed signal (delta / pulse / heartbeat / phase). */
|
|
2463
|
-
lastStreamActivityAt:
|
|
2464
|
-
lastToolActivityAt:
|
|
2465
|
-
lastMutationAt:
|
|
2466
|
-
lastGpuActivityAt:
|
|
2591
|
+
lastStreamActivityAt: z16.number().nullable(),
|
|
2592
|
+
lastToolActivityAt: z16.number().nullable(),
|
|
2593
|
+
lastMutationAt: z16.number().nullable(),
|
|
2594
|
+
lastGpuActivityAt: z16.number().nullable(),
|
|
2467
2595
|
/** Max of all activity timestamps — "when did ANY progress signal last fire". */
|
|
2468
|
-
lastProgressAt:
|
|
2596
|
+
lastProgressAt: z16.number().nullable(),
|
|
2469
2597
|
/** Counters scoped to the currently-running turn; null between turns. */
|
|
2470
2598
|
currentTurn: SessionTurnTelemetrySchema.nullable()
|
|
2471
2599
|
});
|
|
2472
|
-
var SessionTelemetryListResponseSchema =
|
|
2600
|
+
var SessionTelemetryListResponseSchema = z16.object({
|
|
2473
2601
|
/** Bumped when counter semantics change; consumers gate on it. */
|
|
2474
|
-
version:
|
|
2475
|
-
capturedAt:
|
|
2476
|
-
sessions:
|
|
2602
|
+
version: z16.literal(1),
|
|
2603
|
+
capturedAt: z16.number(),
|
|
2604
|
+
sessions: z16.array(SessionTelemetrySchema)
|
|
2477
2605
|
});
|
|
2478
2606
|
|
|
2479
2607
|
// src/schemas/gezel.ts
|
|
2480
|
-
var ProviderNameSchema =
|
|
2608
|
+
var ProviderNameSchema = z17.enum([
|
|
2481
2609
|
"copilot",
|
|
2482
2610
|
"openai",
|
|
2483
2611
|
"anthropic",
|
|
@@ -2499,27 +2627,27 @@ var ProviderNameSchema = z14.enum([
|
|
|
2499
2627
|
// forward-pass is remoted — so `remote` is NOT a local provider.
|
|
2500
2628
|
"remote"
|
|
2501
2629
|
]);
|
|
2502
|
-
var GezelGenderSchema =
|
|
2503
|
-
var FixedFunctionConfigSchema =
|
|
2630
|
+
var GezelGenderSchema = z17.enum(["male", "female", "non-binary"]);
|
|
2631
|
+
var FixedFunctionConfigSchema = z17.object({
|
|
2504
2632
|
/** MCP tool name to forward to (e.g. `'generate_image'`). */
|
|
2505
|
-
tool:
|
|
2633
|
+
tool: z17.string().min(1),
|
|
2506
2634
|
/** Argument key on the tool that receives the user's message text. */
|
|
2507
|
-
promptKey:
|
|
2635
|
+
promptKey: z17.string().min(1).default("prompt"),
|
|
2508
2636
|
/** Defaults merged into every call; user text on `promptKey` always wins. */
|
|
2509
|
-
defaults:
|
|
2637
|
+
defaults: z17.record(z17.string(), z17.unknown()).optional()
|
|
2510
2638
|
});
|
|
2511
|
-
var GezelTraitSchema =
|
|
2512
|
-
id:
|
|
2639
|
+
var GezelTraitSchema = z17.object({
|
|
2640
|
+
id: z17.string(),
|
|
2513
2641
|
/** One imperative second-person sentence, rendered as a prompt bullet. */
|
|
2514
|
-
text:
|
|
2515
|
-
adoptedAt:
|
|
2516
|
-
source:
|
|
2642
|
+
text: z17.string().min(1).max(200),
|
|
2643
|
+
adoptedAt: z17.string(),
|
|
2644
|
+
source: z17.enum(["levelup", "manual"]).optional()
|
|
2517
2645
|
});
|
|
2518
|
-
var GezelFrontmatterSchema =
|
|
2519
|
-
id:
|
|
2520
|
-
name:
|
|
2521
|
-
description:
|
|
2522
|
-
role:
|
|
2646
|
+
var GezelFrontmatterSchema = z17.object({
|
|
2647
|
+
id: EntityIdSchema.optional(),
|
|
2648
|
+
name: z17.string(),
|
|
2649
|
+
description: z17.string().optional(),
|
|
2650
|
+
role: z17.string().optional(),
|
|
2523
2651
|
/**
|
|
2524
2652
|
* Kebab-case slug derived from `role` (or `gezel-N` when role is absent),
|
|
2525
2653
|
* globally unique across the install. Collisions get `-2`, `-3`, …
|
|
@@ -2527,7 +2655,7 @@ var GezelFrontmatterSchema = z14.object({
|
|
|
2527
2655
|
* identifier for @-mentions and as the sole rendered identifier when
|
|
2528
2656
|
* `config.roleBasedNameOnlyMode` is enabled.
|
|
2529
2657
|
*/
|
|
2530
|
-
roleBasedName:
|
|
2658
|
+
roleBasedName: z17.string().optional(),
|
|
2531
2659
|
/**
|
|
2532
2660
|
* One of `male` / `female` / `non-binary`. Assigned at creation time
|
|
2533
2661
|
* from the matching gendered first-name pool (with a small chance of
|
|
@@ -2536,9 +2664,9 @@ var GezelFrontmatterSchema = z14.object({
|
|
|
2536
2664
|
* own prompt. Absent on legacy gezels, where references omit pronouns.
|
|
2537
2665
|
*/
|
|
2538
2666
|
gender: GezelGenderSchema.optional(),
|
|
2539
|
-
model:
|
|
2667
|
+
model: z17.string().optional(),
|
|
2540
2668
|
provider: ProviderNameSchema.optional(),
|
|
2541
|
-
reasoningEffort:
|
|
2669
|
+
reasoningEffort: z17.string().optional(),
|
|
2542
2670
|
/**
|
|
2543
2671
|
* Per-gezel sampling / reasoning / structured-output / tool-call overrides.
|
|
2544
2672
|
* Sparse — only set fields override the catalog's recommended defaults.
|
|
@@ -2571,8 +2699,8 @@ var GezelFrontmatterSchema = z14.object({
|
|
|
2571
2699
|
* low-temperature `thinking-precise` without locking the user out.
|
|
2572
2700
|
*/
|
|
2573
2701
|
suggestedTuningProfile: TuningProfileIdSchema.optional(),
|
|
2574
|
-
tools:
|
|
2575
|
-
tags:
|
|
2702
|
+
tools: z17.array(z17.string()).optional(),
|
|
2703
|
+
tags: z17.array(z17.string()).optional(),
|
|
2576
2704
|
/**
|
|
2577
2705
|
* When set, switches this gezel into "fixed-function" mode: chat
|
|
2578
2706
|
* messages bypass the LLM and forward to the named MCP tool. See
|
|
@@ -2582,14 +2710,14 @@ var GezelFrontmatterSchema = z14.object({
|
|
|
2582
2710
|
*/
|
|
2583
2711
|
fixedFunction: FixedFunctionConfigSchema.optional(),
|
|
2584
2712
|
/** Ollama-only: override the context window (tokens) for this gezel. */
|
|
2585
|
-
numCtx:
|
|
2713
|
+
numCtx: z17.number().int().positive().optional(),
|
|
2586
2714
|
/** When false, suppresses auto-recall on session start for this gezel. */
|
|
2587
|
-
autoRecall:
|
|
2715
|
+
autoRecall: z17.boolean().optional(),
|
|
2588
2716
|
/**
|
|
2589
2717
|
* Chat bubble font id (one of `GEZEL_CHAT_FONTS[*].id`). When unset or
|
|
2590
2718
|
* unrecognized, chat bubbles inherit the app default (Hanken Grotesk).
|
|
2591
2719
|
*/
|
|
2592
|
-
font:
|
|
2720
|
+
font: z17.string().optional(),
|
|
2593
2721
|
/**
|
|
2594
2722
|
* Kokoro TTS voice id (one of `KOKORO_VOICES[*].id`, e.g. `af_heart`,
|
|
2595
2723
|
* `bm_george`). Drives spoken audio rendering — `synthesize_speech`
|
|
@@ -2598,7 +2726,7 @@ var GezelFrontmatterSchema = z14.object({
|
|
|
2598
2726
|
* dialog. Absent on legacy gezels — synthesize falls back to the
|
|
2599
2727
|
* default voice (`af_heart`) when missing.
|
|
2600
2728
|
*/
|
|
2601
|
-
voice:
|
|
2729
|
+
voice: z17.string().optional(),
|
|
2602
2730
|
/**
|
|
2603
2731
|
* Provenance: the id of the gilde catalog template this gezel was
|
|
2604
2732
|
* created from, if any. Written by exact-template or about-omitted
|
|
@@ -2606,7 +2734,7 @@ var GezelFrontmatterSchema = z14.object({
|
|
|
2606
2734
|
* Absent on bespoke-generated or hand-authored gezels. The UI uses
|
|
2607
2735
|
* this to offer "reset to original template" on the about editor.
|
|
2608
2736
|
*/
|
|
2609
|
-
templateId:
|
|
2737
|
+
templateId: z17.string().optional(),
|
|
2610
2738
|
/**
|
|
2611
2739
|
* Provenance: the semver of the template version installed at create
|
|
2612
2740
|
* time. Paired with `templateId`. Absent on gezels created before this
|
|
@@ -2614,7 +2742,7 @@ var GezelFrontmatterSchema = z14.object({
|
|
|
2614
2742
|
* source version" and offers a refresh to current latest without
|
|
2615
2743
|
* comparing.
|
|
2616
2744
|
*/
|
|
2617
|
-
templateVersion:
|
|
2745
|
+
templateVersion: z17.string().optional(),
|
|
2618
2746
|
/**
|
|
2619
2747
|
* Copilot-only: when true, deny the Copilot CLI's built-in tools
|
|
2620
2748
|
* (bash, web_fetch, view, str_replace_editor, read_file, write_file,
|
|
@@ -2623,7 +2751,7 @@ var GezelFrontmatterSchema = z14.object({
|
|
|
2623
2751
|
* itself defaults to the sandboxed MCP surface.
|
|
2624
2752
|
* Provider other than copilot: ignored.
|
|
2625
2753
|
*/
|
|
2626
|
-
sandboxCopilot:
|
|
2754
|
+
sandboxCopilot: z17.boolean().optional(),
|
|
2627
2755
|
/**
|
|
2628
2756
|
* `anthropic-cli`-only: per-gezel override for the Claude CLI permission
|
|
2629
2757
|
* mode. Forwarded as `--permission-mode <value>` to each `claude` invocation.
|
|
@@ -2633,10 +2761,11 @@ var GezelFrontmatterSchema = z14.object({
|
|
|
2633
2761
|
* - `plan`: read-only — useful for review-style gezels.
|
|
2634
2762
|
* - `bypassPermissions`: yolo — every tool call auto-approved including
|
|
2635
2763
|
* Bash. Reserve for builder gezels you trust to run shell commands.
|
|
2636
|
-
* When unset, inherits
|
|
2637
|
-
* itself defaults to
|
|
2764
|
+
* When unset, inherits the project override and then
|
|
2765
|
+
* `config.anthropicCli.defaultPermissionMode` (which itself defaults to
|
|
2766
|
+
* `acceptEdits`). Other providers: ignored.
|
|
2638
2767
|
*/
|
|
2639
|
-
claudePermissionMode:
|
|
2768
|
+
claudePermissionMode: ClaudePermissionModeSchema.optional(),
|
|
2640
2769
|
/**
|
|
2641
2770
|
* `codex-cli`-only execution posture. New writes use Plan / Edit /
|
|
2642
2771
|
* Reviewed / Full; legacy Codex values remain readable for compatibility.
|
|
@@ -2648,7 +2777,7 @@ var GezelFrontmatterSchema = z14.object({
|
|
|
2648
2777
|
* abstract sigil instead of the parametric poppetje. Default (absent /
|
|
2649
2778
|
* false) renders the poppetje everywhere. Toggled from Gezel Detail.
|
|
2650
2779
|
*/
|
|
2651
|
-
iconOverride:
|
|
2780
|
+
iconOverride: z17.boolean().optional(),
|
|
2652
2781
|
/**
|
|
2653
2782
|
* Standing behavior traits, adopted through the growth system (or
|
|
2654
2783
|
* hand-authored). Rendered as their own `### Traits` block in the
|
|
@@ -2657,7 +2786,7 @@ var GezelFrontmatterSchema = z14.object({
|
|
|
2657
2786
|
* The frontmatter list is AUTHORITATIVE for what's active — growth.json
|
|
2658
2787
|
* keeps the evidence-bearing adoption log.
|
|
2659
2788
|
*/
|
|
2660
|
-
traits:
|
|
2789
|
+
traits: z17.array(GezelTraitSchema).max(8).optional(),
|
|
2661
2790
|
/**
|
|
2662
2791
|
* Overrides `config.recognition.mode` for this gezel. A gezel whose job is
|
|
2663
2792
|
* reading screenshots sets `always`; everyone else inherits.
|
|
@@ -2667,48 +2796,48 @@ var GezelFrontmatterSchema = z14.object({
|
|
|
2667
2796
|
* support burden. Native vision is a property of the model *install*, not of
|
|
2668
2797
|
* the gezel, so it has no frontmatter counterpart.
|
|
2669
2798
|
*/
|
|
2670
|
-
recognition:
|
|
2799
|
+
recognition: z17.enum(["auto", "always", "off"]).optional()
|
|
2671
2800
|
});
|
|
2672
|
-
var GezelSectionSchema =
|
|
2673
|
-
heading:
|
|
2674
|
-
template:
|
|
2675
|
-
params:
|
|
2676
|
-
body:
|
|
2801
|
+
var GezelSectionSchema = z17.object({
|
|
2802
|
+
heading: z17.string(),
|
|
2803
|
+
template: z17.string().optional(),
|
|
2804
|
+
params: z17.record(z17.string(), z17.string()).optional(),
|
|
2805
|
+
body: z17.string()
|
|
2677
2806
|
});
|
|
2678
|
-
var ParsedGezelSchema =
|
|
2807
|
+
var ParsedGezelSchema = z17.object({
|
|
2679
2808
|
frontmatter: GezelFrontmatterSchema,
|
|
2680
|
-
sections:
|
|
2681
|
-
source:
|
|
2809
|
+
sections: z17.array(GezelSectionSchema),
|
|
2810
|
+
source: z17.string()
|
|
2682
2811
|
});
|
|
2683
|
-
var GezelSummarySchema =
|
|
2684
|
-
id:
|
|
2685
|
-
name:
|
|
2686
|
-
description:
|
|
2687
|
-
role:
|
|
2812
|
+
var GezelSummarySchema = z17.object({
|
|
2813
|
+
id: EntityIdSchema,
|
|
2814
|
+
name: z17.string(),
|
|
2815
|
+
description: z17.string().optional(),
|
|
2816
|
+
role: z17.string().optional(),
|
|
2688
2817
|
/** Mirrors `GezelFrontmatter.roleBasedName`. */
|
|
2689
|
-
roleBasedName:
|
|
2818
|
+
roleBasedName: z17.string().optional(),
|
|
2690
2819
|
/** Mirrors `GezelFrontmatter.gender`. */
|
|
2691
2820
|
gender: GezelGenderSchema.optional(),
|
|
2692
|
-
model:
|
|
2821
|
+
model: z17.string().optional(),
|
|
2693
2822
|
provider: ProviderNameSchema.optional(),
|
|
2694
|
-
reasoningEffort:
|
|
2823
|
+
reasoningEffort: z17.string().optional(),
|
|
2695
2824
|
/** Mirrors `GezelFrontmatter.tuningProfile`. */
|
|
2696
2825
|
tuningProfile: TuningProfileIdSchema.optional(),
|
|
2697
2826
|
/** Mirrors `GezelFrontmatter.suggestedTuningProfile`. */
|
|
2698
2827
|
suggestedTuningProfile: TuningProfileIdSchema.optional(),
|
|
2699
|
-
numCtx:
|
|
2700
|
-
autoRecall:
|
|
2701
|
-
font:
|
|
2828
|
+
numCtx: z17.number().int().positive().optional(),
|
|
2829
|
+
autoRecall: z17.boolean().optional(),
|
|
2830
|
+
font: z17.string().optional(),
|
|
2702
2831
|
/** Mirrors `GezelFrontmatter.voice` — Kokoro TTS voice id. */
|
|
2703
|
-
voice:
|
|
2832
|
+
voice: z17.string().optional(),
|
|
2704
2833
|
/** Mirrors `GezelFrontmatter.templateId` when the gezel came from a gilde template. */
|
|
2705
|
-
templateId:
|
|
2834
|
+
templateId: z17.string().optional(),
|
|
2706
2835
|
/** Mirrors `GezelFrontmatter.templateVersion`. */
|
|
2707
|
-
templateVersion:
|
|
2836
|
+
templateVersion: z17.string().optional(),
|
|
2708
2837
|
/** Mirrors `GezelFrontmatter.sandboxCopilot`. */
|
|
2709
|
-
sandboxCopilot:
|
|
2838
|
+
sandboxCopilot: z17.boolean().optional(),
|
|
2710
2839
|
/** Mirrors `GezelFrontmatter.claudePermissionMode`. */
|
|
2711
|
-
claudePermissionMode:
|
|
2840
|
+
claudePermissionMode: ClaudePermissionModeSchema.optional(),
|
|
2712
2841
|
/** Mirrors `GezelFrontmatter.codexPermissionMode`. */
|
|
2713
2842
|
codexPermissionMode: CodexPermissionModeCompatSchema.optional(),
|
|
2714
2843
|
/**
|
|
@@ -2719,7 +2848,7 @@ var GezelSummarySchema = z14.object({
|
|
|
2719
2848
|
* affordance.
|
|
2720
2849
|
*/
|
|
2721
2850
|
fixedFunction: FixedFunctionConfigSchema.optional(),
|
|
2722
|
-
icon:
|
|
2851
|
+
icon: z17.string().optional(),
|
|
2723
2852
|
/**
|
|
2724
2853
|
* The resolved poppetje character data for this gezel. Inlined on
|
|
2725
2854
|
* every list/detail response so the UI can render the parametric SVG
|
|
@@ -2729,9 +2858,9 @@ var GezelSummarySchema = z14.object({
|
|
|
2729
2858
|
*/
|
|
2730
2859
|
poppetje: PoppetjeSchema.optional(),
|
|
2731
2860
|
/** Mirrors `GezelFrontmatter.iconOverride`. */
|
|
2732
|
-
iconOverride:
|
|
2861
|
+
iconOverride: z17.boolean().optional(),
|
|
2733
2862
|
/** Mirrors `GezelFrontmatter.recognition`. */
|
|
2734
|
-
recognition:
|
|
2863
|
+
recognition: z17.enum(["auto", "always", "off"]).optional(),
|
|
2735
2864
|
/**
|
|
2736
2865
|
* Where this gezel lives. `global` (the default when absent — back-compat
|
|
2737
2866
|
* with every gezel on disk before this field existed) is the install-wide
|
|
@@ -2741,15 +2870,15 @@ var GezelSummarySchema = z14.object({
|
|
|
2741
2870
|
* badges project-scoped gezels and the roster only surfaces them inside
|
|
2742
2871
|
* their own project.
|
|
2743
2872
|
*/
|
|
2744
|
-
scope:
|
|
2873
|
+
scope: z17.enum(["global", "project"]).optional(),
|
|
2745
2874
|
/**
|
|
2746
2875
|
* Filesystem ownership boundary, distinct from `scope` above. Shared gezel
|
|
2747
2876
|
* identity lives in the installer-managed machine root; chats, memories,
|
|
2748
2877
|
* growth, credentials, and installed toolsets remain in the user home.
|
|
2749
2878
|
*/
|
|
2750
|
-
storageScope:
|
|
2879
|
+
storageScope: z17.enum(["user", "machine-shared"]).optional(),
|
|
2751
2880
|
/** Mirrors `GezelFrontmatter.traits`. */
|
|
2752
|
-
traits:
|
|
2881
|
+
traits: z17.array(GezelTraitSchema).optional(),
|
|
2753
2882
|
/**
|
|
2754
2883
|
* Lightweight growth summary (level + pending level-up flag),
|
|
2755
2884
|
* hydrated from growth.json and inlined on list/detail responses —
|
|
@@ -2757,11 +2886,11 @@ var GezelSummarySchema = z14.object({
|
|
|
2757
2886
|
* without N+1 follow-up requests.
|
|
2758
2887
|
*/
|
|
2759
2888
|
growth: GezelGrowthSummarySchema.optional(),
|
|
2760
|
-
updatedAt:
|
|
2889
|
+
updatedAt: z17.string()
|
|
2761
2890
|
});
|
|
2762
2891
|
var GezelDetailSchema = GezelSummarySchema.extend({
|
|
2763
2892
|
parsed: ParsedGezelSchema,
|
|
2764
|
-
about:
|
|
2893
|
+
about: z17.string(),
|
|
2765
2894
|
/**
|
|
2766
2895
|
* Optional contents of the per-gezel `tools.md` file. When present
|
|
2767
2896
|
* (non-null), fully replaces the auto-injected `## Tools available
|
|
@@ -2771,43 +2900,43 @@ var GezelDetailSchema = GezelSummarySchema.extend({
|
|
|
2771
2900
|
* default) means no override file exists and the runtime renders
|
|
2772
2901
|
* the auto-block from the live MCP bridge.
|
|
2773
2902
|
*/
|
|
2774
|
-
toolsMd:
|
|
2903
|
+
toolsMd: z17.string().nullable().default(null)
|
|
2775
2904
|
});
|
|
2776
|
-
var ToolCallImageSchema =
|
|
2905
|
+
var ToolCallImageSchema = z17.object({
|
|
2777
2906
|
/** Path relative to the project's artifacts/ root (e.g. `sessions/2026-04-19_143015_snake-test/tool-3-img-0.png`). */
|
|
2778
|
-
path:
|
|
2907
|
+
path: z17.string(),
|
|
2779
2908
|
/** MIME type of the image, used by the UI to set the right `<img>` src URL. */
|
|
2780
|
-
mimeType:
|
|
2909
|
+
mimeType: z17.string()
|
|
2781
2910
|
});
|
|
2782
|
-
var ToolCallAudioSchema =
|
|
2911
|
+
var ToolCallAudioSchema = z17.object({
|
|
2783
2912
|
/** Path relative to the project's artifacts/ root. */
|
|
2784
|
-
path:
|
|
2913
|
+
path: z17.string(),
|
|
2785
2914
|
/** MIME type, e.g. `audio/wav`. */
|
|
2786
|
-
mimeType:
|
|
2915
|
+
mimeType: z17.string(),
|
|
2787
2916
|
/** Duration in seconds when known — used by the UI to show length without preloading the blob. */
|
|
2788
|
-
durationSeconds:
|
|
2917
|
+
durationSeconds: z17.number().optional(),
|
|
2789
2918
|
/** Voice id used to produce this audio (TTS only). */
|
|
2790
|
-
voice:
|
|
2919
|
+
voice: z17.string().optional()
|
|
2791
2920
|
});
|
|
2792
|
-
var ToolCallVideoSchema =
|
|
2921
|
+
var ToolCallVideoSchema = z17.object({
|
|
2793
2922
|
/** Path relative to the project's artifacts/ root (e.g. `generated/video-123.mp4`). */
|
|
2794
|
-
path:
|
|
2923
|
+
path: z17.string(),
|
|
2795
2924
|
/** MIME type, e.g. `video/mp4`. */
|
|
2796
|
-
mimeType:
|
|
2925
|
+
mimeType: z17.string(),
|
|
2797
2926
|
/** Optional poster-frame artifact path for the `<video poster>` attribute. */
|
|
2798
|
-
posterPath:
|
|
2927
|
+
posterPath: z17.string().optional()
|
|
2799
2928
|
});
|
|
2800
|
-
var ChatMessageToolCallSchema =
|
|
2801
|
-
name:
|
|
2802
|
-
durationMs:
|
|
2803
|
-
success:
|
|
2804
|
-
errorMessage:
|
|
2929
|
+
var ChatMessageToolCallSchema = z17.object({
|
|
2930
|
+
name: z17.string(),
|
|
2931
|
+
durationMs: z17.number(),
|
|
2932
|
+
success: z17.boolean(),
|
|
2933
|
+
errorMessage: z17.string().optional(),
|
|
2805
2934
|
/** File path the tool touched, for the References pane. */
|
|
2806
|
-
path:
|
|
2935
|
+
path: z17.string().optional(),
|
|
2807
2936
|
/** Ordered file paths touched by a batched filesystem tool. */
|
|
2808
|
-
paths:
|
|
2937
|
+
paths: z17.array(z17.string()).optional(),
|
|
2809
2938
|
/** Compact, human-readable one-liner ("→ Freja: update the game loop · file: workspace/index.html"). */
|
|
2810
|
-
argsSummary:
|
|
2939
|
+
argsSummary: z17.string().optional(),
|
|
2811
2940
|
/**
|
|
2812
2941
|
* The tool call's FULL arguments, rendered as readable text (field by
|
|
2813
2942
|
* field, bulky values shown in full — not truncated like
|
|
@@ -2818,34 +2947,34 @@ var ChatMessageToolCallSchema = z14.object({
|
|
|
2818
2947
|
* arguments are not a secret vector in this codebase (secrets live in
|
|
2819
2948
|
* the toolset-config path), so this is not separately redacted.
|
|
2820
2949
|
*/
|
|
2821
|
-
argsFull:
|
|
2950
|
+
argsFull: z17.string().optional(),
|
|
2822
2951
|
/** Short full response, or a bounded beginning/end summary for a long response. */
|
|
2823
|
-
resultText:
|
|
2952
|
+
resultText: z17.string().optional(),
|
|
2824
2953
|
/** True when `resultText` is a bounded summary rather than the complete response. */
|
|
2825
|
-
resultTruncated:
|
|
2954
|
+
resultTruncated: z17.boolean().optional(),
|
|
2826
2955
|
/** Image artifacts the tool returned (e.g. browser_snapshot screenshots). */
|
|
2827
|
-
images:
|
|
2956
|
+
images: z17.array(ToolCallImageSchema).optional(),
|
|
2828
2957
|
/** Audio artifacts the tool returned (e.g. synthesize_speech WAV). */
|
|
2829
|
-
audios:
|
|
2958
|
+
audios: z17.array(ToolCallAudioSchema).optional(),
|
|
2830
2959
|
/** Video artifacts the tool returned (e.g. generate_video mp4). */
|
|
2831
|
-
videos:
|
|
2960
|
+
videos: z17.array(ToolCallVideoSchema).optional(),
|
|
2832
2961
|
/**
|
|
2833
2962
|
* Unified diff describing the change a surgical-edit tool made
|
|
2834
2963
|
* (`replace_in_file`, `apply_patch`, `insert_at_marker`). Used by the UI
|
|
2835
2964
|
* to render an inline diff under the tool-call row. Capped at ~100KB
|
|
2836
2965
|
* server-side; larger diffs are truncated with a marker line.
|
|
2837
2966
|
*/
|
|
2838
|
-
diff:
|
|
2839
|
-
addedLines:
|
|
2840
|
-
removedLines:
|
|
2841
|
-
});
|
|
2842
|
-
var ChatMessageSchema =
|
|
2843
|
-
role:
|
|
2844
|
-
content:
|
|
2845
|
-
at:
|
|
2846
|
-
from:
|
|
2847
|
-
gezelId:
|
|
2848
|
-
gezelName:
|
|
2967
|
+
diff: z17.string().optional(),
|
|
2968
|
+
addedLines: z17.number().int().nonnegative().optional(),
|
|
2969
|
+
removedLines: z17.number().int().nonnegative().optional()
|
|
2970
|
+
});
|
|
2971
|
+
var ChatMessageSchema = z17.object({
|
|
2972
|
+
role: z17.enum(["user", "assistant"]),
|
|
2973
|
+
content: z17.string(),
|
|
2974
|
+
at: z17.string(),
|
|
2975
|
+
from: z17.object({
|
|
2976
|
+
gezelId: z17.string(),
|
|
2977
|
+
gezelName: z17.string()
|
|
2849
2978
|
}).optional(),
|
|
2850
2979
|
/**
|
|
2851
2980
|
* Artifact paths (relative to the project's `artifacts/` directory)
|
|
@@ -2855,7 +2984,7 @@ var ChatMessageSchema = z14.object({
|
|
|
2855
2984
|
* that match a real artifact. Back-stops Copilot's tool-call
|
|
2856
2985
|
* blindspot and any "AI wrote a file outside the MCP tools" paths.
|
|
2857
2986
|
*/
|
|
2858
|
-
referencedArtifacts:
|
|
2987
|
+
referencedArtifacts: z17.array(z17.string()).optional(),
|
|
2859
2988
|
/**
|
|
2860
2989
|
* Task refs (`<projectId>/<num>`) the assistant reply mentioned. Same
|
|
2861
2990
|
* shape as `referencedArtifacts` — populated on save, gated on the
|
|
@@ -2864,14 +2993,14 @@ var ChatMessageSchema = z14.object({
|
|
|
2864
2993
|
* gezel-ux-roadmap/2" mention so the user can jump to it without
|
|
2865
2994
|
* scrolling the body for the ref.
|
|
2866
2995
|
*/
|
|
2867
|
-
referencedTasks:
|
|
2996
|
+
referencedTasks: z17.array(z17.string()).optional(),
|
|
2868
2997
|
/**
|
|
2869
2998
|
* Tool calls the assistant fired during this turn. Populated on the
|
|
2870
2999
|
* final assistant message; the UI renders them as a collapsible
|
|
2871
3000
|
* "thinking" expando above the reply body so the user can still see
|
|
2872
3001
|
* what ran even after the live stream has closed.
|
|
2873
3002
|
*/
|
|
2874
|
-
toolCalls:
|
|
3003
|
+
toolCalls: z17.array(ChatMessageToolCallSchema).optional(),
|
|
2875
3004
|
/**
|
|
2876
3005
|
* Phase announcements the model emitted via Copilot's `report_intent`
|
|
2877
3006
|
* tool during this turn. Each entry carries the intent label and an
|
|
@@ -2882,10 +3011,10 @@ var ChatMessageSchema = z14.object({
|
|
|
2882
3011
|
* replay and history export are unaffected. Copilot-only; other
|
|
2883
3012
|
* providers don't emit these.
|
|
2884
3013
|
*/
|
|
2885
|
-
intents:
|
|
2886
|
-
|
|
2887
|
-
label:
|
|
2888
|
-
afterChars:
|
|
3014
|
+
intents: z17.array(
|
|
3015
|
+
z17.object({
|
|
3016
|
+
label: z17.string(),
|
|
3017
|
+
afterChars: z17.number().int().min(0)
|
|
2889
3018
|
})
|
|
2890
3019
|
).optional(),
|
|
2891
3020
|
/**
|
|
@@ -2895,7 +3024,7 @@ var ChatMessageSchema = z14.object({
|
|
|
2895
3024
|
* itself lives in the per-project questions file; this id is just
|
|
2896
3025
|
* the foreign key.
|
|
2897
3026
|
*/
|
|
2898
|
-
pendingQuestionId:
|
|
3027
|
+
pendingQuestionId: z17.string().optional(),
|
|
2899
3028
|
/**
|
|
2900
3029
|
* Marks the message as a system-generated synthesis rather than a real
|
|
2901
3030
|
* model turn.
|
|
@@ -2924,7 +3053,7 @@ var ChatMessageSchema = z14.object({
|
|
|
2924
3053
|
* UI renders these as muted bubbles; the model sees them as normal
|
|
2925
3054
|
* assistant turns (the role label is what matters to the API).
|
|
2926
3055
|
*/
|
|
2927
|
-
synthetic:
|
|
3056
|
+
synthetic: z17.enum([
|
|
2928
3057
|
"compaction-summary",
|
|
2929
3058
|
"context-loop-halt",
|
|
2930
3059
|
"turn-aborted",
|
|
@@ -2942,7 +3071,7 @@ var ChatMessageSchema = z14.object({
|
|
|
2942
3071
|
* from loaded transcripts and the live-timeline handler skips its bubble
|
|
2943
3072
|
* while still opening the assistant's streaming slot.
|
|
2944
3073
|
*/
|
|
2945
|
-
hidden:
|
|
3074
|
+
hidden: z17.boolean().optional(),
|
|
2946
3075
|
/**
|
|
2947
3076
|
* This user message was delivered from the session's mid-turn queue
|
|
2948
3077
|
* as a nudge — typed while the previous turn was still streaming and
|
|
@@ -2950,7 +3079,7 @@ var ChatMessageSchema = z14.object({
|
|
|
2950
3079
|
* Display-only marker: the model sees a normal user turn; the UI
|
|
2951
3080
|
* renders a small "nudged" chip on the bubble.
|
|
2952
3081
|
*/
|
|
2953
|
-
nudge:
|
|
3082
|
+
nudge: z17.boolean().optional(),
|
|
2954
3083
|
/**
|
|
2955
3084
|
* Persistent warnings attached to this assistant turn — fabricated
|
|
2956
3085
|
* tool-use detection, degraded provider state, etc. The streaming
|
|
@@ -2960,7 +3089,7 @@ var ChatMessageSchema = z14.object({
|
|
|
2960
3089
|
* reload. Populated by the chat manager just before `events.publish`
|
|
2961
3090
|
* fires the `complete` event.
|
|
2962
3091
|
*/
|
|
2963
|
-
warnings:
|
|
3092
|
+
warnings: z17.array(z17.string()).optional(),
|
|
2964
3093
|
/**
|
|
2965
3094
|
* Chain-of-thought captured during this turn. Local providers
|
|
2966
3095
|
* (ollama, llama-cpp, mlx, ds4) extract `<think>…</think>` /
|
|
@@ -2973,14 +3102,14 @@ var ChatMessageSchema = z14.object({
|
|
|
2973
3102
|
* Responses hides reasoning server-side and leaves this unset.
|
|
2974
3103
|
* Empty / whitespace-only captures are dropped.
|
|
2975
3104
|
*/
|
|
2976
|
-
reasoning:
|
|
3105
|
+
reasoning: z17.string().optional(),
|
|
2977
3106
|
/**
|
|
2978
3107
|
* Observed wall-clock span of the streamed private-reasoning trace,
|
|
2979
3108
|
* measured from the first `reasoning_delta` to the last. Optional
|
|
2980
3109
|
* because older messages and providers that only expose reasoning at
|
|
2981
3110
|
* commit time have no trustworthy phase timing.
|
|
2982
3111
|
*/
|
|
2983
|
-
reasoningDurationMs:
|
|
3112
|
+
reasoningDurationMs: z17.number().int().nonnegative().optional(),
|
|
2984
3113
|
/**
|
|
2985
3114
|
* Tool-call bodies the model emitted that the salvage layer
|
|
2986
3115
|
* couldn't parse — the literal text from `<|tool_call|>` markers
|
|
@@ -2995,10 +3124,10 @@ var ChatMessageSchema = z14.object({
|
|
|
2995
3124
|
* hundred chars per body in the populator so a long fabricated body
|
|
2996
3125
|
* doesn't blow up the session file.
|
|
2997
3126
|
*/
|
|
2998
|
-
attemptedToolCalls:
|
|
2999
|
-
|
|
3000
|
-
body:
|
|
3001
|
-
reason:
|
|
3127
|
+
attemptedToolCalls: z17.array(
|
|
3128
|
+
z17.object({
|
|
3129
|
+
body: z17.string(),
|
|
3130
|
+
reason: z17.string().optional()
|
|
3002
3131
|
})
|
|
3003
3132
|
).optional(),
|
|
3004
3133
|
/**
|
|
@@ -3014,28 +3143,28 @@ var ChatMessageSchema = z14.object({
|
|
|
3014
3143
|
* daemon restart, a provider reset, or a context-pressure rebuild — leaving
|
|
3015
3144
|
* the model replaying a bare ``.
|
|
3016
3145
|
*/
|
|
3017
|
-
recognizedImages:
|
|
3146
|
+
recognizedImages: z17.array(MessageImageDigestSchema).optional()
|
|
3018
3147
|
});
|
|
3019
|
-
var ChatTurnErrorDetailSchema =
|
|
3020
|
-
code:
|
|
3148
|
+
var ChatTurnErrorDetailSchema = z17.object({
|
|
3149
|
+
code: z17.string().max(64).optional(),
|
|
3021
3150
|
/** Component that failed — a provider name (`llama-cpp`) or a subsystem. */
|
|
3022
|
-
engine:
|
|
3151
|
+
engine: z17.string().max(64).optional(),
|
|
3023
3152
|
/** Correlation key, also written into the engine's own incident log. */
|
|
3024
|
-
incidentId:
|
|
3153
|
+
incidentId: z17.string().max(64).optional(),
|
|
3025
3154
|
/** Native crash class from the exit snapshot, e.g. `cuda-out-of-memory`. */
|
|
3026
|
-
panicKind:
|
|
3027
|
-
exitCode:
|
|
3028
|
-
signal:
|
|
3155
|
+
panicKind: z17.string().max(64).optional(),
|
|
3156
|
+
exitCode: z17.number().int().nullable().optional(),
|
|
3157
|
+
signal: z17.string().max(32).nullable().optional(),
|
|
3029
3158
|
/**
|
|
3030
3159
|
* Request-independent launch facts copied from the crash snapshot, which
|
|
3031
3160
|
* is contractually free of prompts, tool arguments, and secrets. Bounded
|
|
3032
3161
|
* by the extractor. A machine profile cannot reconstruct which model at
|
|
3033
3162
|
* which context size with which KV type crashed; this can.
|
|
3034
3163
|
*/
|
|
3035
|
-
diagnostics:
|
|
3164
|
+
diagnostics: z17.record(z17.string(), z17.union([z17.string(), z17.number(), z17.boolean()])).optional()
|
|
3036
3165
|
});
|
|
3037
|
-
var ChatEventSchema =
|
|
3038
|
-
|
|
3166
|
+
var ChatEventSchema = z17.discriminatedUnion("type", [
|
|
3167
|
+
z17.object({ type: z17.literal("delta"), content: z17.string() }),
|
|
3039
3168
|
/**
|
|
3040
3169
|
* Live private-reasoning tokens (ds4's think phase), streamed on their
|
|
3041
3170
|
* own channel so they never mix into the visible `delta` stream, the
|
|
@@ -3043,8 +3172,8 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3043
3172
|
* renders them as a distinct "thinking" block that collapses into the
|
|
3044
3173
|
* committed message's reasoning expander once `complete` lands.
|
|
3045
3174
|
*/
|
|
3046
|
-
|
|
3047
|
-
|
|
3175
|
+
z17.object({ type: z17.literal("reasoning_delta"), content: z17.string() }),
|
|
3176
|
+
z17.object({ type: z17.literal("complete"), message: ChatMessageSchema }),
|
|
3048
3177
|
/**
|
|
3049
3178
|
* Emitted right after the user's message is appended to the session
|
|
3050
3179
|
* record. The legacy session-scoped UI inserted user messages locally
|
|
@@ -3052,27 +3181,27 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3052
3181
|
* envelope streams need it so the interleaved timeline can render the
|
|
3053
3182
|
* user's bubble immediately, before any assistant deltas.
|
|
3054
3183
|
*/
|
|
3055
|
-
|
|
3184
|
+
z17.object({ type: z17.literal("user_message"), message: ChatMessageSchema }),
|
|
3056
3185
|
/**
|
|
3057
3186
|
* Emitted when the assistant invokes an MCP tool (OpenAI + Mock paths
|
|
3058
3187
|
* only — Copilot runs tools inside its subprocess, invisible to us).
|
|
3059
3188
|
* The UI surfaces these as "thinking" breadcrumbs.
|
|
3060
3189
|
*/
|
|
3061
|
-
|
|
3062
|
-
type:
|
|
3063
|
-
name:
|
|
3064
|
-
durationMs:
|
|
3065
|
-
success:
|
|
3066
|
-
errorMessage:
|
|
3190
|
+
z17.object({
|
|
3191
|
+
type: z17.literal("tool"),
|
|
3192
|
+
name: z17.string(),
|
|
3193
|
+
durationMs: z17.number(),
|
|
3194
|
+
success: z17.boolean(),
|
|
3195
|
+
errorMessage: z17.string().optional(),
|
|
3067
3196
|
/**
|
|
3068
3197
|
* File path the tool touched (if any). Set for tools that take a `path`
|
|
3069
3198
|
* argument: readFile, writeFile, read_artifact, write_artifact,
|
|
3070
3199
|
* read_document, write_document. Lets the UI build a References panel
|
|
3071
3200
|
* without guessing.
|
|
3072
3201
|
*/
|
|
3073
|
-
path:
|
|
3202
|
+
path: z17.string().optional(),
|
|
3074
3203
|
/** Ordered file paths touched by a batched filesystem tool. */
|
|
3075
|
-
paths:
|
|
3204
|
+
paths: z17.array(z17.string()).optional(),
|
|
3076
3205
|
/**
|
|
3077
3206
|
* Compact human-readable preview of the non-bulky arguments. Example:
|
|
3078
3207
|
* `gezel: "Maya", message: "what's the status of..."`. Values are
|
|
@@ -3080,44 +3209,44 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3080
3209
|
* UI to render a useful in-progress tool line instead of just the
|
|
3081
3210
|
* tool name.
|
|
3082
3211
|
*/
|
|
3083
|
-
argsSummary:
|
|
3212
|
+
argsSummary: z17.string().optional(),
|
|
3084
3213
|
/** Full, readable args for the expand + copy affordance. See the persisted `ChatMessageToolCall.argsFull`. */
|
|
3085
|
-
argsFull:
|
|
3214
|
+
argsFull: z17.string().optional(),
|
|
3086
3215
|
/** Short full response, or a bounded beginning/end summary. */
|
|
3087
|
-
resultText:
|
|
3216
|
+
resultText: z17.string().optional(),
|
|
3088
3217
|
/** True when `resultText` is a bounded summary rather than the complete response. */
|
|
3089
|
-
resultTruncated:
|
|
3218
|
+
resultTruncated: z17.boolean().optional(),
|
|
3090
3219
|
/**
|
|
3091
3220
|
* Image artifacts the tool returned (most commonly browser screenshots).
|
|
3092
3221
|
* Paths are relative to the project's artifacts/ root and resolved
|
|
3093
3222
|
* to URLs by the UI via the artifact-read endpoint.
|
|
3094
3223
|
*/
|
|
3095
|
-
images:
|
|
3224
|
+
images: z17.array(ToolCallImageSchema).optional(),
|
|
3096
3225
|
/**
|
|
3097
3226
|
* Audio artifacts the tool returned (synthesize_speech narrations,
|
|
3098
3227
|
* voice memos transcribed via transcribe_audio). Same artifact-path
|
|
3099
3228
|
* resolution as `images`.
|
|
3100
3229
|
*/
|
|
3101
|
-
audios:
|
|
3230
|
+
audios: z17.array(ToolCallAudioSchema).optional(),
|
|
3102
3231
|
/**
|
|
3103
3232
|
* Video artifacts the tool returned (`generate_video`). Same
|
|
3104
3233
|
* artifact-path resolution as `images`; rendered as a `<video>`
|
|
3105
3234
|
* player in the chat row.
|
|
3106
3235
|
*/
|
|
3107
|
-
videos:
|
|
3236
|
+
videos: z17.array(ToolCallVideoSchema).optional(),
|
|
3108
3237
|
/**
|
|
3109
3238
|
* Unified diff describing the change a surgical-edit tool made
|
|
3110
3239
|
* (`replace_in_file`, `apply_patch`, `insert_at_marker`). Streams to the
|
|
3111
3240
|
* UI mid-turn so the chat bubble can render an inline diff under
|
|
3112
3241
|
* the tool-call row even before the assistant message is finalized.
|
|
3113
3242
|
*/
|
|
3114
|
-
diff:
|
|
3115
|
-
addedLines:
|
|
3116
|
-
removedLines:
|
|
3243
|
+
diff: z17.string().optional(),
|
|
3244
|
+
addedLines: z17.number().int().nonnegative().optional(),
|
|
3245
|
+
removedLines: z17.number().int().nonnegative().optional()
|
|
3117
3246
|
}),
|
|
3118
|
-
|
|
3119
|
-
type:
|
|
3120
|
-
error:
|
|
3247
|
+
z17.object({
|
|
3248
|
+
type: z17.literal("error"),
|
|
3249
|
+
error: z17.string(),
|
|
3121
3250
|
// Not `detail` — three sibling variants in this union already use that
|
|
3122
3251
|
// name for free-form progress prose, and one union with two meanings for
|
|
3123
3252
|
// one key is a trap.
|
|
@@ -3128,8 +3257,8 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3128
3257
|
* surface. This is terminal for the live UI, but is deliberately not an
|
|
3129
3258
|
* error: it must not poison the session or render failure recovery UI.
|
|
3130
3259
|
*/
|
|
3131
|
-
|
|
3132
|
-
|
|
3260
|
+
z17.object({ type: z17.literal("cancelled") }),
|
|
3261
|
+
z17.object({ type: z17.literal("done") }),
|
|
3133
3262
|
/**
|
|
3134
3263
|
* Emitted when a turn ends up waiting in the provider queue for more
|
|
3135
3264
|
* than a brief grace period (~200ms). `aheadOf` is an approximate
|
|
@@ -3139,7 +3268,7 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3139
3268
|
* emit this event — avoids flashing the indicator on the happy path
|
|
3140
3269
|
* where the queue is empty.
|
|
3141
3270
|
*/
|
|
3142
|
-
|
|
3271
|
+
z17.object({ type: z17.literal("queued"), aheadOf: z17.number().int().min(0) }),
|
|
3143
3272
|
/**
|
|
3144
3273
|
* Ollama-only: emitted for each bare framing chunk that arrives
|
|
3145
3274
|
* on the wire without visible content / tool_calls — the
|
|
@@ -3149,7 +3278,7 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3149
3278
|
* when the model isn't producing visible output. Reset on the
|
|
3150
3279
|
* next real `delta`, `tool`, or `complete`.
|
|
3151
3280
|
*/
|
|
3152
|
-
|
|
3281
|
+
z17.object({ type: z17.literal("wire_pulse") }),
|
|
3153
3282
|
/**
|
|
3154
3283
|
* Live tool-argument stream. Fired while the model is generating a
|
|
3155
3284
|
* structured tool call — most visibly a multi-minute `write_file`
|
|
@@ -3161,7 +3290,7 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3161
3290
|
* "working" block (same pattern as `reasoning_delta`) and drops the
|
|
3162
3291
|
* block when the corresponding `tool` event lands.
|
|
3163
3292
|
*/
|
|
3164
|
-
|
|
3293
|
+
z17.object({ type: z17.literal("tool_args_delta"), name: z17.string(), content: z17.string() }),
|
|
3165
3294
|
/**
|
|
3166
3295
|
* Emitted when a provider tells us it's still doing work — even though
|
|
3167
3296
|
* no visible text/tool event has arrived. Today this is wired from
|
|
@@ -3172,24 +3301,24 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3172
3301
|
* Optional `label` carries a short phase hint ('thinking', 'tool',
|
|
3173
3302
|
* etc.) that the streaming bubble can surface as a status line.
|
|
3174
3303
|
*/
|
|
3175
|
-
|
|
3304
|
+
z17.object({ type: z17.literal("heartbeat"), label: z17.string().optional() }),
|
|
3176
3305
|
/**
|
|
3177
3306
|
* Provider-side warning surfaced mid-turn (e.g. Copilot rate-limit,
|
|
3178
3307
|
* context pressure, degraded mode). The UI renders these inline on
|
|
3179
3308
|
* the streaming bubble so the user sees them immediately instead of
|
|
3180
3309
|
* only finding out when the turn completes or times out.
|
|
3181
3310
|
*/
|
|
3182
|
-
|
|
3183
|
-
type:
|
|
3184
|
-
message:
|
|
3311
|
+
z17.object({
|
|
3312
|
+
type: z17.literal("warning"),
|
|
3313
|
+
message: z17.string(),
|
|
3185
3314
|
/**
|
|
3186
3315
|
* Optional in-app destination for a warning's inline action. Kept
|
|
3187
3316
|
* deliberately narrow: warnings are still readable prose when an older
|
|
3188
3317
|
* client ignores this additive field.
|
|
3189
3318
|
*/
|
|
3190
|
-
action:
|
|
3191
|
-
kind:
|
|
3192
|
-
section:
|
|
3319
|
+
action: z17.object({
|
|
3320
|
+
kind: z17.literal("settings"),
|
|
3321
|
+
section: z17.enum(["llamaCpp", "mlx", "ds4"])
|
|
3193
3322
|
}).optional()
|
|
3194
3323
|
}),
|
|
3195
3324
|
/**
|
|
@@ -3200,18 +3329,18 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3200
3329
|
* offset on the final assistant message so completed bubbles render
|
|
3201
3330
|
* the same segmentation on reload.
|
|
3202
3331
|
*/
|
|
3203
|
-
|
|
3332
|
+
z17.object({ type: z17.literal("intent"), label: z17.string() }),
|
|
3204
3333
|
/**
|
|
3205
3334
|
* Emitted when a new message is enqueued on the per-session queue
|
|
3206
3335
|
* because the session already has a turn in flight. The timeline
|
|
3207
3336
|
* renders a "ghost bubble" under the session's streaming bubble
|
|
3208
3337
|
* showing the queued text preview. Cleared via `queue_removed`.
|
|
3209
3338
|
*/
|
|
3210
|
-
|
|
3211
|
-
type:
|
|
3212
|
-
queueId:
|
|
3213
|
-
preview:
|
|
3214
|
-
enqueuedAt:
|
|
3339
|
+
z17.object({
|
|
3340
|
+
type: z17.literal("queue_enqueued"),
|
|
3341
|
+
queueId: z17.string(),
|
|
3342
|
+
preview: z17.string(),
|
|
3343
|
+
enqueuedAt: z17.string(),
|
|
3215
3344
|
/**
|
|
3216
3345
|
* The entry was queued as a mid-turn nudge — the ghost bubble labels
|
|
3217
3346
|
* it "nudge" and contiguous nudges merge into one turn on drain.
|
|
@@ -3219,7 +3348,7 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3219
3348
|
* every coalesce/edit); the edit affordance fetches it lazily via
|
|
3220
3349
|
* `GET /api/sessions/:id/queue`.
|
|
3221
3350
|
*/
|
|
3222
|
-
nudge:
|
|
3351
|
+
nudge: z17.boolean().optional()
|
|
3223
3352
|
}),
|
|
3224
3353
|
/**
|
|
3225
3354
|
* Emitted when a queued entry leaves the queue — either because
|
|
@@ -3228,10 +3357,10 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3228
3357
|
* dropped without running (`reason: 'canceled'` via user action,
|
|
3229
3358
|
* `reason: 'rejected'` via session archive / delete / shutdown).
|
|
3230
3359
|
*/
|
|
3231
|
-
|
|
3232
|
-
type:
|
|
3233
|
-
queueId:
|
|
3234
|
-
reason:
|
|
3360
|
+
z17.object({
|
|
3361
|
+
type: z17.literal("queue_removed"),
|
|
3362
|
+
queueId: z17.string(),
|
|
3363
|
+
reason: z17.enum(["started", "canceled", "rejected"])
|
|
3235
3364
|
}),
|
|
3236
3365
|
/**
|
|
3237
3366
|
* Local-provider context policy: emitted when accumulated conversation
|
|
@@ -3239,11 +3368,11 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3239
3368
|
* The UI may suggest starting fresh because this event is never emitted
|
|
3240
3369
|
* for a first-turn standing system/tool prefix.
|
|
3241
3370
|
*/
|
|
3242
|
-
|
|
3243
|
-
type:
|
|
3244
|
-
estimatedTokens:
|
|
3245
|
-
numCtx:
|
|
3246
|
-
model:
|
|
3371
|
+
z17.object({
|
|
3372
|
+
type: z17.literal("context_warning"),
|
|
3373
|
+
estimatedTokens: z17.number(),
|
|
3374
|
+
numCtx: z17.number(),
|
|
3375
|
+
model: z17.string()
|
|
3247
3376
|
}),
|
|
3248
3377
|
/**
|
|
3249
3378
|
* Local-provider context policy: emitted right after in-flight compaction collapses
|
|
@@ -3252,10 +3381,10 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3252
3381
|
* for a "compacted" variant and refreshes the visible timeline (older
|
|
3253
3382
|
* bubbles are now gone from disk).
|
|
3254
3383
|
*/
|
|
3255
|
-
|
|
3256
|
-
type:
|
|
3257
|
-
removedCount:
|
|
3258
|
-
model:
|
|
3384
|
+
z17.object({
|
|
3385
|
+
type: z17.literal("context_compacted"),
|
|
3386
|
+
removedCount: z17.number().int().nonnegative(),
|
|
3387
|
+
model: z17.string()
|
|
3259
3388
|
}),
|
|
3260
3389
|
/**
|
|
3261
3390
|
* Emitted when the chat manager detects a self-chat / compaction loop —
|
|
@@ -3264,10 +3393,10 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3264
3393
|
* compaction cycle without making progress. The pipeline halts the turn
|
|
3265
3394
|
* so the user can intervene; the UI surfaces a "looks stuck" banner.
|
|
3266
3395
|
*/
|
|
3267
|
-
|
|
3268
|
-
type:
|
|
3269
|
-
compactionsThisSend:
|
|
3270
|
-
reason:
|
|
3396
|
+
z17.object({
|
|
3397
|
+
type: z17.literal("context_loop"),
|
|
3398
|
+
compactionsThisSend: z17.number().int().positive(),
|
|
3399
|
+
reason: z17.string()
|
|
3271
3400
|
}),
|
|
3272
3401
|
/**
|
|
3273
3402
|
* Emitted when the Keurmeester (frontier quality inspector) steps in
|
|
@@ -3275,23 +3404,23 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3275
3404
|
* UI renders a "stepped in" notice on the thread; the full case
|
|
3276
3405
|
* record lives under `~/.gezel/keurmeester/cases/` keyed by caseId.
|
|
3277
3406
|
*/
|
|
3278
|
-
|
|
3279
|
-
type:
|
|
3280
|
-
caseId:
|
|
3281
|
-
gezelId:
|
|
3282
|
-
gezelName:
|
|
3283
|
-
action:
|
|
3284
|
-
summary:
|
|
3407
|
+
z17.object({
|
|
3408
|
+
type: z17.literal("keurmeester_intervention"),
|
|
3409
|
+
caseId: z17.string(),
|
|
3410
|
+
gezelId: z17.string(),
|
|
3411
|
+
gezelName: z17.string(),
|
|
3412
|
+
action: z17.string(),
|
|
3413
|
+
summary: z17.string()
|
|
3285
3414
|
}),
|
|
3286
3415
|
/**
|
|
3287
3416
|
* Emitted once per session the first time auto-recall runs, so the UI
|
|
3288
3417
|
* can render a "pulled N memories from prior work" chip above the first
|
|
3289
3418
|
* assistant reply.
|
|
3290
3419
|
*/
|
|
3291
|
-
|
|
3292
|
-
type:
|
|
3293
|
-
hitCount:
|
|
3294
|
-
query:
|
|
3420
|
+
z17.object({
|
|
3421
|
+
type: z17.literal("recall_applied"),
|
|
3422
|
+
hitCount: z17.number(),
|
|
3423
|
+
query: z17.string()
|
|
3295
3424
|
}),
|
|
3296
3425
|
/**
|
|
3297
3426
|
* Emitted when a gezel posts a structured question via the
|
|
@@ -3299,14 +3428,14 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3299
3428
|
* questions on this event so the in-chat card, Home pane, and Home
|
|
3300
3429
|
* tab badge all light up together.
|
|
3301
3430
|
*/
|
|
3302
|
-
|
|
3431
|
+
z17.object({ type: z17.literal("question_asked"), question: QuestionSchema }),
|
|
3303
3432
|
/**
|
|
3304
3433
|
* Emitted when the user submits (or declines) an answer. The UI
|
|
3305
3434
|
* uses the same fan-out as `question_asked` to refresh every
|
|
3306
3435
|
* surface; the chat bubble's pending card collapses to its
|
|
3307
3436
|
* answered state.
|
|
3308
3437
|
*/
|
|
3309
|
-
|
|
3438
|
+
z17.object({ type: z17.literal("question_answered"), question: QuestionSchema }),
|
|
3310
3439
|
/**
|
|
3311
3440
|
* A durable task audit event, fanned onto the project's live stream after
|
|
3312
3441
|
* it has been appended to History. This keeps lightweight clients (most
|
|
@@ -3314,24 +3443,24 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3314
3443
|
* second task lifecycle bus. `task.tick` heartbeats are intentionally not
|
|
3315
3444
|
* published; this channel is for user-meaningful changes.
|
|
3316
3445
|
*/
|
|
3317
|
-
|
|
3318
|
-
type:
|
|
3319
|
-
eventId:
|
|
3320
|
-
kind:
|
|
3321
|
-
summary:
|
|
3322
|
-
at:
|
|
3323
|
-
taskRef:
|
|
3446
|
+
z17.object({
|
|
3447
|
+
type: z17.literal("task_event"),
|
|
3448
|
+
eventId: z17.string(),
|
|
3449
|
+
kind: z17.string(),
|
|
3450
|
+
summary: z17.string(),
|
|
3451
|
+
at: z17.string(),
|
|
3452
|
+
taskRef: z17.string().optional()
|
|
3324
3453
|
}),
|
|
3325
3454
|
/**
|
|
3326
3455
|
* Emitted when a gezel crosses a growth level threshold and a pending
|
|
3327
3456
|
* level-up is created. The UI refreshes growth badges/dots and raises
|
|
3328
3457
|
* a single calm OS notification when the window is hidden.
|
|
3329
3458
|
*/
|
|
3330
|
-
|
|
3331
|
-
type:
|
|
3332
|
-
gezelId:
|
|
3333
|
-
gezelName:
|
|
3334
|
-
toLevel:
|
|
3459
|
+
z17.object({
|
|
3460
|
+
type: z17.literal("growth_level_up"),
|
|
3461
|
+
gezelId: z17.string(),
|
|
3462
|
+
gezelName: z17.string(),
|
|
3463
|
+
toLevel: z17.number().int()
|
|
3335
3464
|
}),
|
|
3336
3465
|
/**
|
|
3337
3466
|
* llama-cpp-only: lifecycle phase of the supervised on-device engine
|
|
@@ -3354,13 +3483,13 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3354
3483
|
* the phase label so users who want to know what's happening can
|
|
3355
3484
|
* see, without cluttering the happy-path status line.
|
|
3356
3485
|
*/
|
|
3357
|
-
|
|
3358
|
-
type:
|
|
3359
|
-
provider:
|
|
3360
|
-
phase:
|
|
3361
|
-
detail:
|
|
3362
|
-
progress:
|
|
3363
|
-
ttftMs:
|
|
3486
|
+
z17.object({
|
|
3487
|
+
type: z17.literal("engine_phase"),
|
|
3488
|
+
provider: z17.enum(["llama-cpp", "mlx", "ds4"]),
|
|
3489
|
+
phase: z17.enum(["starting", "loading_model", "prefill", "generating", "ready"]),
|
|
3490
|
+
detail: z17.string().optional(),
|
|
3491
|
+
progress: z17.number().min(0).max(1).optional(),
|
|
3492
|
+
ttftMs: z17.number().int().nonnegative().optional()
|
|
3364
3493
|
}),
|
|
3365
3494
|
/**
|
|
3366
3495
|
* Per-turn telemetry for locally-hosted providers (llama-cpp +
|
|
@@ -3375,14 +3504,14 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3375
3504
|
* local speed metric isn't meaningful when the latency is
|
|
3376
3505
|
* dominated by network round-trips.
|
|
3377
3506
|
*/
|
|
3378
|
-
|
|
3379
|
-
type:
|
|
3380
|
-
provider:
|
|
3381
|
-
promptTokens:
|
|
3382
|
-
completionTokens:
|
|
3383
|
-
durationMs:
|
|
3507
|
+
z17.object({
|
|
3508
|
+
type: z17.literal("turn_stats"),
|
|
3509
|
+
provider: z17.enum(["llama-cpp", "ollama", "mlx", "ds4"]),
|
|
3510
|
+
promptTokens: z17.number().int().nonnegative(),
|
|
3511
|
+
completionTokens: z17.number().int().nonnegative(),
|
|
3512
|
+
durationMs: z17.number().int().nonnegative(),
|
|
3384
3513
|
/** Generation speed in tokens/sec — completionTokens / generationSeconds. */
|
|
3385
|
-
tokensPerSec:
|
|
3514
|
+
tokensPerSec: z17.number().nonnegative().optional()
|
|
3386
3515
|
}),
|
|
3387
3516
|
/**
|
|
3388
3517
|
* Static engine-level metrics that don't change during a session —
|
|
@@ -3394,11 +3523,11 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3394
3523
|
* `engine_phase` (every session waiting on the same supervisor
|
|
3395
3524
|
* startup gets a copy).
|
|
3396
3525
|
*/
|
|
3397
|
-
|
|
3398
|
-
type:
|
|
3399
|
-
provider:
|
|
3526
|
+
z17.object({
|
|
3527
|
+
type: z17.literal("engine_stats"),
|
|
3528
|
+
provider: z17.enum(["llama-cpp", "mlx", "ds4"]),
|
|
3400
3529
|
/** Total bytes allocated across all GGUF buffers + KV cache. */
|
|
3401
|
-
ramAllocBytes:
|
|
3530
|
+
ramAllocBytes: z17.number().nonnegative()
|
|
3402
3531
|
}),
|
|
3403
3532
|
/**
|
|
3404
3533
|
* VRAM tenancy change — a non-LLM workload has taken (or released)
|
|
@@ -3428,9 +3557,9 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3428
3557
|
* `step`/`totalSteps` drive a real progress bar; `secondsPerStep`
|
|
3429
3558
|
* lets the UI show an ETA.
|
|
3430
3559
|
*/
|
|
3431
|
-
|
|
3432
|
-
type:
|
|
3433
|
-
state:
|
|
3560
|
+
z17.object({
|
|
3561
|
+
type: z17.literal("gpu_swap"),
|
|
3562
|
+
state: z17.enum(["started", "progress", "ended"]),
|
|
3434
3563
|
/**
|
|
3435
3564
|
* Shared with session telemetry so a new workload can't light up the
|
|
3436
3565
|
* bubble while staying invisible to stall detection.
|
|
@@ -3443,12 +3572,12 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3443
3572
|
* seconds", which reads as a bug.
|
|
3444
3573
|
*/
|
|
3445
3574
|
task: SessionGpuTaskSchema,
|
|
3446
|
-
detail:
|
|
3447
|
-
prompt:
|
|
3448
|
-
progress:
|
|
3449
|
-
step:
|
|
3450
|
-
totalSteps:
|
|
3451
|
-
secondsPerStep:
|
|
3575
|
+
detail: z17.string().optional(),
|
|
3576
|
+
prompt: z17.string().optional(),
|
|
3577
|
+
progress: z17.number().min(0).max(1).optional(),
|
|
3578
|
+
step: z17.number().int().nonnegative().optional(),
|
|
3579
|
+
totalSteps: z17.number().int().positive().optional(),
|
|
3580
|
+
secondsPerStep: z17.number().nonnegative().optional()
|
|
3452
3581
|
}),
|
|
3453
3582
|
/**
|
|
3454
3583
|
* The turn is parked inside a synchronous `ask_gezel` /
|
|
@@ -3471,10 +3600,10 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3471
3600
|
* side, same as the `ask_gezel` tool result), so the UI can render
|
|
3472
3601
|
* it verbatim.
|
|
3473
3602
|
*/
|
|
3474
|
-
|
|
3475
|
-
type:
|
|
3476
|
-
state:
|
|
3477
|
-
targetGezelName:
|
|
3603
|
+
z17.object({
|
|
3604
|
+
type: z17.literal("awaiting_gezel"),
|
|
3605
|
+
state: z17.enum(["started", "ended"]),
|
|
3606
|
+
targetGezelName: z17.string()
|
|
3478
3607
|
}),
|
|
3479
3608
|
/**
|
|
3480
3609
|
* A new project was created (via the New Project dialog, the
|
|
@@ -3485,10 +3614,10 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3485
3614
|
* for the next manual refresh / tab-focus poll. Not a renderable
|
|
3486
3615
|
* timeline event (like `growth_level_up`); the chat surfaces ignore it.
|
|
3487
3616
|
*/
|
|
3488
|
-
|
|
3489
|
-
type:
|
|
3490
|
-
projectId:
|
|
3491
|
-
name:
|
|
3617
|
+
z17.object({
|
|
3618
|
+
type: z17.literal("project_created"),
|
|
3619
|
+
projectId: z17.string(),
|
|
3620
|
+
name: z17.string()
|
|
3492
3621
|
}),
|
|
3493
3622
|
/**
|
|
3494
3623
|
* A project was deleted (via the Project Actions menu, or an equivalent
|
|
@@ -3498,10 +3627,10 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3498
3627
|
* waiting for the next manual refresh / tab-focus poll. Not a renderable
|
|
3499
3628
|
* timeline event; the chat surfaces ignore it.
|
|
3500
3629
|
*/
|
|
3501
|
-
|
|
3502
|
-
type:
|
|
3503
|
-
projectId:
|
|
3504
|
-
name:
|
|
3630
|
+
z17.object({
|
|
3631
|
+
type: z17.literal("project_deleted"),
|
|
3632
|
+
projectId: z17.string(),
|
|
3633
|
+
name: z17.string()
|
|
3505
3634
|
}),
|
|
3506
3635
|
/**
|
|
3507
3636
|
* A new shared gezel joined the global roster. Emitted on the global
|
|
@@ -3510,10 +3639,10 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3510
3639
|
* gezels deliberately do not emit this event because they do not belong in
|
|
3511
3640
|
* the global Gezellen list.
|
|
3512
3641
|
*/
|
|
3513
|
-
|
|
3514
|
-
type:
|
|
3515
|
-
gezelId:
|
|
3516
|
-
name:
|
|
3642
|
+
z17.object({
|
|
3643
|
+
type: z17.literal("gezel_created"),
|
|
3644
|
+
gezelId: z17.string(),
|
|
3645
|
+
name: z17.string()
|
|
3517
3646
|
}),
|
|
3518
3647
|
/**
|
|
3519
3648
|
* Global (project-less) signal that Night Shift mode flipped ON/OFF.
|
|
@@ -3521,10 +3650,10 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3521
3650
|
* menu pill reflects the live state. `source` is the active driver
|
|
3522
3651
|
* (scheduled window vs. a manual shift), null when inactive.
|
|
3523
3652
|
*/
|
|
3524
|
-
|
|
3525
|
-
type:
|
|
3526
|
-
active:
|
|
3527
|
-
source:
|
|
3653
|
+
z17.object({
|
|
3654
|
+
type: z17.literal("night_shift"),
|
|
3655
|
+
active: z17.boolean(),
|
|
3656
|
+
source: z17.enum(["scheduled", "manual"]).nullable()
|
|
3528
3657
|
}),
|
|
3529
3658
|
/**
|
|
3530
3659
|
* Global signal from the meester status generator. `started` fires
|
|
@@ -3533,10 +3662,10 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3533
3662
|
* produced nothing usable — the Home greeting refetches on the
|
|
3534
3663
|
* terminal states instead of polling.
|
|
3535
3664
|
*/
|
|
3536
|
-
|
|
3537
|
-
type:
|
|
3538
|
-
state:
|
|
3539
|
-
generatedAt:
|
|
3665
|
+
z17.object({
|
|
3666
|
+
type: z17.literal("meester_status"),
|
|
3667
|
+
state: z17.enum(["started", "ended", "failed"]),
|
|
3668
|
+
generatedAt: z17.string().optional()
|
|
3540
3669
|
}),
|
|
3541
3670
|
/**
|
|
3542
3671
|
* Global (history-free) heartbeat from the boekwachter indexing loops —
|
|
@@ -3544,23 +3673,23 @@ var ChatEventSchema = z14.discriminatedUnion("type", [
|
|
|
3544
3673
|
* indicator pill; complements (doesn't replace) the polled per-project
|
|
3545
3674
|
* index status. `pending` = files still awaiting AI enrichment when known.
|
|
3546
3675
|
*/
|
|
3547
|
-
|
|
3548
|
-
type:
|
|
3549
|
-
phase:
|
|
3550
|
-
state:
|
|
3551
|
-
projectId:
|
|
3552
|
-
detail:
|
|
3553
|
-
pending:
|
|
3676
|
+
z17.object({
|
|
3677
|
+
type: z17.literal("index_progress"),
|
|
3678
|
+
phase: z17.enum(["scan", "shadow", "enrich", "review", "digest"]),
|
|
3679
|
+
state: z17.enum(["started", "progress", "ended"]),
|
|
3680
|
+
projectId: z17.string().optional(),
|
|
3681
|
+
detail: z17.string().optional(),
|
|
3682
|
+
pending: z17.number().int().nonnegative().optional(),
|
|
3554
3683
|
/** The concrete autonomous gezel doing this work, when the project has one. */
|
|
3555
|
-
gezelId:
|
|
3684
|
+
gezelId: z17.string().optional(),
|
|
3556
3685
|
/** Snapshot of their display name so transient progress remains human-readable. */
|
|
3557
|
-
gezelName:
|
|
3686
|
+
gezelName: z17.string().optional()
|
|
3558
3687
|
})
|
|
3559
3688
|
]);
|
|
3560
|
-
var ChatEventEnvelopeSchema =
|
|
3561
|
-
sessionId:
|
|
3562
|
-
gezelId:
|
|
3563
|
-
projectId:
|
|
3689
|
+
var ChatEventEnvelopeSchema = z17.object({
|
|
3690
|
+
sessionId: z17.string(),
|
|
3691
|
+
gezelId: z17.string(),
|
|
3692
|
+
projectId: z17.string(),
|
|
3564
3693
|
event: ChatEventSchema
|
|
3565
3694
|
});
|
|
3566
3695
|
|
|
@@ -3691,8 +3820,8 @@ function promoteBareChannelNames(text) {
|
|
|
3691
3820
|
}
|
|
3692
3821
|
|
|
3693
3822
|
// src/schemas/report-action.ts
|
|
3694
|
-
import { z as
|
|
3695
|
-
var ReportActionKindSchema =
|
|
3823
|
+
import { z as z18 } from "zod";
|
|
3824
|
+
var ReportActionKindSchema = z18.enum(["fire-craftbook", "create-task", "apply-edits"]);
|
|
3696
3825
|
var commonFields = {
|
|
3697
3826
|
/**
|
|
3698
3827
|
* Author-supplied stable slug — keeps lifecycle state attached across
|
|
@@ -3700,121 +3829,121 @@ var commonFields = {
|
|
|
3700
3829
|
* content hash (`a-<hash>`), which is stable only while the block's
|
|
3701
3830
|
* body is byte-identical.
|
|
3702
3831
|
*/
|
|
3703
|
-
id:
|
|
3832
|
+
id: z18.string().regex(/^[a-z0-9][a-z0-9_-]*$/i).optional(),
|
|
3704
3833
|
/** Short human label for the card ("Fix the unchecked null in parser.ts"). */
|
|
3705
|
-
title:
|
|
3834
|
+
title: z18.string().min(1),
|
|
3706
3835
|
/** One-or-two-sentence rationale shown under the title. */
|
|
3707
|
-
reason:
|
|
3836
|
+
reason: z18.string().optional(),
|
|
3708
3837
|
/**
|
|
3709
3838
|
* Target project. Defaults to the report's own project. Cross-project
|
|
3710
3839
|
* targets are a primary case — the bundled oversight report lives in
|
|
3711
3840
|
* `default` but recommends work in specific projects.
|
|
3712
3841
|
*/
|
|
3713
|
-
projectId:
|
|
3842
|
+
projectId: z18.string().optional()
|
|
3714
3843
|
};
|
|
3715
|
-
var FireCraftbookActionSchema =
|
|
3716
|
-
kind:
|
|
3844
|
+
var FireCraftbookActionSchema = z18.object({
|
|
3845
|
+
kind: z18.literal("fire-craftbook"),
|
|
3717
3846
|
...commonFields,
|
|
3718
|
-
craftbookId:
|
|
3847
|
+
craftbookId: z18.string().min(1),
|
|
3719
3848
|
/** Invocation params for the craftbook's paramSchema (stringified values). */
|
|
3720
|
-
params:
|
|
3849
|
+
params: z18.record(z18.string(), z18.string()).optional()
|
|
3721
3850
|
});
|
|
3722
|
-
var CreateTaskActionSchema =
|
|
3723
|
-
kind:
|
|
3851
|
+
var CreateTaskActionSchema = z18.object({
|
|
3852
|
+
kind: z18.literal("create-task"),
|
|
3724
3853
|
...commonFields,
|
|
3725
3854
|
/** Full work instruction for the bespoke task's single step. */
|
|
3726
|
-
prompt:
|
|
3855
|
+
prompt: z18.string().min(1),
|
|
3727
3856
|
/** Role to recruit for the work (ensure_gezel jobTitle). Default: software developer. */
|
|
3728
|
-
role:
|
|
3857
|
+
role: z18.string().optional()
|
|
3729
3858
|
});
|
|
3730
|
-
var ApplyEditsActionSchema =
|
|
3731
|
-
kind:
|
|
3859
|
+
var ApplyEditsActionSchema = z18.object({
|
|
3860
|
+
kind: z18.literal("apply-edits"),
|
|
3732
3861
|
...commonFields,
|
|
3733
|
-
edits:
|
|
3734
|
-
|
|
3862
|
+
edits: z18.array(
|
|
3863
|
+
z18.object({
|
|
3735
3864
|
/** Workspace-relative target file in the TARGET project. */
|
|
3736
|
-
path:
|
|
3865
|
+
path: z18.string().min(1),
|
|
3737
3866
|
/** Artifacts-relative sidecar `.diff` path in the REPORT's project. */
|
|
3738
|
-
diffArtifact:
|
|
3867
|
+
diffArtifact: z18.string().min(1)
|
|
3739
3868
|
})
|
|
3740
3869
|
).min(1)
|
|
3741
3870
|
});
|
|
3742
|
-
var ReportActionSchema =
|
|
3871
|
+
var ReportActionSchema = z18.discriminatedUnion("kind", [
|
|
3743
3872
|
FireCraftbookActionSchema,
|
|
3744
3873
|
CreateTaskActionSchema,
|
|
3745
3874
|
ApplyEditsActionSchema
|
|
3746
3875
|
]);
|
|
3747
|
-
var ReportActionStateSchema =
|
|
3876
|
+
var ReportActionStateSchema = z18.enum([
|
|
3748
3877
|
"suggested",
|
|
3749
3878
|
"fired",
|
|
3750
3879
|
"applied",
|
|
3751
3880
|
"failed",
|
|
3752
3881
|
"dismissed"
|
|
3753
3882
|
]);
|
|
3754
|
-
var ReportActionRecordSchema =
|
|
3755
|
-
actionId:
|
|
3883
|
+
var ReportActionRecordSchema = z18.object({
|
|
3884
|
+
actionId: z18.string(),
|
|
3756
3885
|
/** Artifacts-relative path of the report the action came from. */
|
|
3757
|
-
reportPath:
|
|
3886
|
+
reportPath: z18.string(),
|
|
3758
3887
|
kind: ReportActionKindSchema,
|
|
3759
|
-
contentHash:
|
|
3760
|
-
firstSeenAt:
|
|
3888
|
+
contentHash: z18.string(),
|
|
3889
|
+
firstSeenAt: z18.string(),
|
|
3761
3890
|
state: ReportActionStateSchema,
|
|
3762
3891
|
/** Task materialized by fire-craftbook / create-task. */
|
|
3763
|
-
taskRef:
|
|
3764
|
-
firedAt:
|
|
3892
|
+
taskRef: z18.string().optional(),
|
|
3893
|
+
firedAt: z18.string().optional(),
|
|
3765
3894
|
/** Stamped when the fired task settles. */
|
|
3766
|
-
settledAt:
|
|
3767
|
-
outcome:
|
|
3895
|
+
settledAt: z18.string().optional(),
|
|
3896
|
+
outcome: z18.enum(["complete", "canceled"]).optional(),
|
|
3768
3897
|
/** apply-edits per-file results. */
|
|
3769
|
-
results:
|
|
3770
|
-
|
|
3771
|
-
path:
|
|
3772
|
-
ok:
|
|
3773
|
-
error:
|
|
3898
|
+
results: z18.array(
|
|
3899
|
+
z18.object({
|
|
3900
|
+
path: z18.string(),
|
|
3901
|
+
ok: z18.boolean(),
|
|
3902
|
+
error: z18.string().optional()
|
|
3774
3903
|
})
|
|
3775
3904
|
).optional()
|
|
3776
3905
|
});
|
|
3777
|
-
var ReportActionParseIssueSchema =
|
|
3906
|
+
var ReportActionParseIssueSchema = z18.object({
|
|
3778
3907
|
/** Zero-based index among the report's gezel-action fences. */
|
|
3779
|
-
index:
|
|
3780
|
-
message:
|
|
3908
|
+
index: z18.number().int(),
|
|
3909
|
+
message: z18.string(),
|
|
3781
3910
|
/** Raw fence body, for the "unreadable action block" card. */
|
|
3782
|
-
raw:
|
|
3911
|
+
raw: z18.string()
|
|
3783
3912
|
});
|
|
3784
|
-
var ReportActionViewSchema =
|
|
3913
|
+
var ReportActionViewSchema = z18.object({
|
|
3785
3914
|
action: ReportActionSchema,
|
|
3786
|
-
id:
|
|
3787
|
-
contentHash:
|
|
3915
|
+
id: z18.string(),
|
|
3916
|
+
contentHash: z18.string(),
|
|
3788
3917
|
state: ReportActionStateSchema,
|
|
3789
|
-
taskRef:
|
|
3790
|
-
firedAt:
|
|
3791
|
-
settledAt:
|
|
3792
|
-
outcome:
|
|
3793
|
-
results:
|
|
3918
|
+
taskRef: z18.string().optional(),
|
|
3919
|
+
firedAt: z18.string().optional(),
|
|
3920
|
+
settledAt: z18.string().optional(),
|
|
3921
|
+
outcome: z18.enum(["complete", "canceled"]).optional(),
|
|
3922
|
+
results: z18.array(z18.object({ path: z18.string(), ok: z18.boolean(), error: z18.string().optional() })).optional(),
|
|
3794
3923
|
/** The stored record predates a changed block body (report regenerated). */
|
|
3795
|
-
contentChanged:
|
|
3924
|
+
contentChanged: z18.boolean().optional()
|
|
3796
3925
|
});
|
|
3797
|
-
var ReportActionsResponseSchema =
|
|
3798
|
-
actions:
|
|
3799
|
-
issues:
|
|
3926
|
+
var ReportActionsResponseSchema = z18.object({
|
|
3927
|
+
actions: z18.array(ReportActionViewSchema),
|
|
3928
|
+
issues: z18.array(ReportActionParseIssueSchema),
|
|
3800
3929
|
/** Records whose action vanished from the regenerated report. */
|
|
3801
|
-
stale:
|
|
3930
|
+
stale: z18.array(ReportActionRecordSchema)
|
|
3802
3931
|
});
|
|
3803
|
-
var FireReportActionRequestSchema =
|
|
3932
|
+
var FireReportActionRequestSchema = z18.object({
|
|
3804
3933
|
/** Artifacts-relative report path. */
|
|
3805
|
-
path:
|
|
3806
|
-
actionId:
|
|
3934
|
+
path: z18.string().min(1),
|
|
3935
|
+
actionId: z18.string().min(1),
|
|
3807
3936
|
/** apply-edits: none. fire-craftbook: overrides the block's params. */
|
|
3808
|
-
params:
|
|
3937
|
+
params: z18.record(z18.string(), z18.string()).optional()
|
|
3809
3938
|
});
|
|
3810
|
-
var FireReportActionResponseSchema =
|
|
3939
|
+
var FireReportActionResponseSchema = z18.object({
|
|
3811
3940
|
record: ReportActionRecordSchema,
|
|
3812
3941
|
/** Set for fire-craftbook / create-task. */
|
|
3813
|
-
taskRef:
|
|
3942
|
+
taskRef: z18.string().optional()
|
|
3814
3943
|
});
|
|
3815
|
-
var DismissReportActionRequestSchema =
|
|
3816
|
-
path:
|
|
3817
|
-
actionId:
|
|
3944
|
+
var DismissReportActionRequestSchema = z18.object({
|
|
3945
|
+
path: z18.string().min(1),
|
|
3946
|
+
actionId: z18.string().min(1)
|
|
3818
3947
|
});
|
|
3819
3948
|
|
|
3820
3949
|
// src/markdown/report-actions.ts
|