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