@kenkaiiii/ggcoder 5.74.3 → 5.75.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/assets/skills/bulletproof/SKILL.md +1 -1
- package/assets/skills/clarify/SKILL.md +1 -1
- package/assets/skills/code-review/SKILL.md +1 -1
- package/assets/skills/compliance-guard/SKILL.md +1 -1
- package/assets/skills/durable/SKILL.md +1 -1
- package/assets/skills/evidence-led-ui/SKILL.md +1 -1
- package/assets/skills/lean/SKILL.md +1 -1
- package/assets/skills/refactoring/SKILL.md +1 -1
- package/assets/skills/root-cause/SKILL.md +1 -1
- package/assets/skills/shared-language/SKILL.md +1 -1
- package/assets/skills/tdd/SKILL.md +1 -1
- package/dist/app-sidecar/app-settings.d.ts +65 -0
- package/dist/app-sidecar/app-settings.js +147 -0
- package/dist/app-sidecar/app-settings.js.map +1 -0
- package/dist/app-sidecar/attachments.d.ts +11 -0
- package/dist/app-sidecar/attachments.js +47 -0
- package/dist/app-sidecar/attachments.js.map +1 -0
- package/dist/app-sidecar/auth-routes.d.ts +3 -0
- package/dist/app-sidecar/auth-routes.js +290 -0
- package/dist/app-sidecar/auth-routes.js.map +1 -0
- package/dist/app-sidecar/autopilot-runner.d.ts +61 -0
- package/dist/app-sidecar/autopilot-runner.js +367 -0
- package/dist/app-sidecar/autopilot-runner.js.map +1 -0
- package/dist/app-sidecar/file-search.d.ts +15 -0
- package/dist/app-sidecar/file-search.js +103 -0
- package/dist/app-sidecar/file-search.js.map +1 -0
- package/dist/app-sidecar/hf-pull-manager.d.ts +20 -0
- package/dist/app-sidecar/hf-pull-manager.js +224 -0
- package/dist/app-sidecar/hf-pull-manager.js.map +1 -0
- package/dist/app-sidecar/history-routes.d.ts +3 -0
- package/dist/app-sidecar/history-routes.js +375 -0
- package/dist/app-sidecar/history-routes.js.map +1 -0
- package/dist/app-sidecar/history.d.ts +67 -0
- package/dist/app-sidecar/history.js +23 -0
- package/dist/app-sidecar/history.js.map +1 -0
- package/dist/app-sidecar/http.d.ts +5 -0
- package/dist/app-sidecar/http.js +27 -0
- package/dist/app-sidecar/http.js.map +1 -0
- package/dist/app-sidecar/integration-routes.d.ts +3 -0
- package/dist/app-sidecar/integration-routes.js +286 -0
- package/dist/app-sidecar/integration-routes.js.map +1 -0
- package/dist/app-sidecar/json-mode.d.ts +10 -0
- package/dist/app-sidecar/json-mode.js +73 -0
- package/dist/app-sidecar/json-mode.js.map +1 -0
- package/dist/app-sidecar/keep-awake.d.ts +4 -0
- package/dist/app-sidecar/keep-awake.js +5 -0
- package/dist/app-sidecar/keep-awake.js.map +1 -0
- package/dist/app-sidecar/ken-context.d.ts +20 -0
- package/dist/app-sidecar/ken-context.js +55 -0
- package/dist/app-sidecar/ken-context.js.map +1 -0
- package/dist/app-sidecar/mcp-routes.d.ts +3 -0
- package/dist/app-sidecar/mcp-routes.js +185 -0
- package/dist/app-sidecar/mcp-routes.js.map +1 -0
- package/dist/app-sidecar/mcp-rows.d.ts +31 -0
- package/dist/app-sidecar/mcp-rows.js +77 -0
- package/dist/app-sidecar/mcp-rows.js.map +1 -0
- package/dist/app-sidecar/progress-manager.d.ts +10 -0
- package/dist/app-sidecar/progress-manager.js +116 -0
- package/dist/app-sidecar/progress-manager.js.map +1 -0
- package/dist/app-sidecar/prompt-routes.d.ts +3 -0
- package/dist/app-sidecar/prompt-routes.js +354 -0
- package/dist/app-sidecar/prompt-routes.js.map +1 -0
- package/dist/app-sidecar/repo-polls.d.ts +15 -0
- package/dist/app-sidecar/repo-polls.js +25 -0
- package/dist/app-sidecar/repo-polls.js.map +1 -0
- package/dist/app-sidecar/route-context.d.ts +145 -0
- package/dist/app-sidecar/route-context.js +2 -0
- package/dist/app-sidecar/route-context.js.map +1 -0
- package/dist/app-sidecar/run-control-routes.d.ts +3 -0
- package/dist/app-sidecar/run-control-routes.js +430 -0
- package/dist/app-sidecar/run-control-routes.js.map +1 -0
- package/dist/app-sidecar/session-routes.d.ts +3 -0
- package/dist/app-sidecar/session-routes.js +115 -0
- package/dist/app-sidecar/session-routes.js.map +1 -0
- package/dist/app-sidecar/session-types.d.ts +39 -0
- package/dist/app-sidecar/session-types.js +5 -0
- package/dist/app-sidecar/session-types.js.map +1 -0
- package/dist/app-sidecar/task-routes.d.ts +3 -0
- package/dist/app-sidecar/task-routes.js +149 -0
- package/dist/app-sidecar/task-routes.js.map +1 -0
- package/dist/app-sidecar/usage.d.ts +19 -0
- package/dist/app-sidecar/usage.js +153 -0
- package/dist/app-sidecar/usage.js.map +1 -0
- package/dist/app-sidecar/workspace-routes.d.ts +3 -0
- package/dist/app-sidecar/workspace-routes.js +244 -0
- package/dist/app-sidecar/workspace-routes.js.map +1 -0
- package/dist/app-sidecar.js +467 -3775
- package/dist/app-sidecar.js.map +1 -1
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/config.js +1 -1
- package/dist/core/acceptance-checks.js +3 -9
- package/dist/core/acceptance-checks.js.map +1 -1
- package/dist/core/agent-session/helpers.d.ts +26 -0
- package/dist/core/agent-session/helpers.js +47 -0
- package/dist/core/agent-session/helpers.js.map +1 -0
- package/dist/core/agent-session/mcp-tools.d.ts +68 -0
- package/dist/core/agent-session/mcp-tools.js +195 -0
- package/dist/core/agent-session/mcp-tools.js.map +1 -0
- package/dist/core/agent-session/run-loop-monitor.d.ts +63 -0
- package/dist/core/agent-session/run-loop-monitor.js +164 -0
- package/dist/core/agent-session/run-loop-monitor.js.map +1 -0
- package/dist/core/agent-session/transcript-markers.d.ts +57 -0
- package/dist/core/agent-session/transcript-markers.js +166 -0
- package/dist/core/agent-session/transcript-markers.js.map +1 -0
- package/dist/core/agent-session/verification-tracker.d.ts +46 -0
- package/dist/core/agent-session/verification-tracker.js +246 -0
- package/dist/core/agent-session/verification-tracker.js.map +1 -0
- package/dist/core/agent-session.d.ts +21 -87
- package/dist/core/agent-session.js +141 -712
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-providers.js +3 -3
- package/dist/core/auth-providers.js.map +1 -1
- package/dist/core/bundled-agents.js +6 -6
- package/dist/core/bundled-agents.js.map +1 -1
- package/dist/core/checklist-git.d.ts +19 -0
- package/dist/core/checklist-git.js +54 -0
- package/dist/core/checklist-git.js.map +1 -0
- package/dist/core/checklist-items.d.ts +10 -1
- package/dist/core/checklist-items.js +22 -0
- package/dist/core/checklist-items.js.map +1 -1
- package/dist/core/checklist-prompt.d.ts +5 -1
- package/dist/core/checklist-prompt.js +16 -5
- package/dist/core/checklist-prompt.js.map +1 -1
- package/dist/core/checklist-snapshot.d.ts +5 -1
- package/dist/core/checklist-snapshot.js +19 -2
- package/dist/core/checklist-snapshot.js.map +1 -1
- package/dist/core/context-limits.js +1 -1
- package/dist/core/context-limits.js.map +1 -1
- package/dist/core/skills.js +6 -9
- package/dist/core/skills.js.map +1 -1
- package/dist/core/style-packs/index.js +2 -11
- package/dist/core/style-packs/index.js.map +1 -1
- package/dist/core/style-packs/packs.d.ts +3 -12
- package/dist/core/style-packs/packs.js +132 -173
- package/dist/core/style-packs/packs.js.map +1 -1
- package/dist/system-prompt.js +55 -78
- package/dist/system-prompt.js.map +1 -1
- package/dist/tools/ask-user.js +13 -74
- package/dist/tools/ask-user.js.map +1 -1
- package/dist/tools/bash.js +13 -78
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/checklist.d.ts +2 -10
- package/dist/tools/checklist.js +7 -39
- package/dist/tools/checklist.js.map +1 -1
- package/dist/tools/code-nav.js +7 -29
- package/dist/tools/code-nav.js.map +1 -1
- package/dist/tools/edit.d.ts +3 -9
- package/dist/tools/edit.js +92 -65
- package/dist/tools/edit.js.map +1 -1
- package/dist/tools/enter-plan.js +2 -7
- package/dist/tools/enter-plan.js.map +1 -1
- package/dist/tools/exit-plan.js +2 -3
- package/dist/tools/exit-plan.js.map +1 -1
- package/dist/tools/find.js +3 -4
- package/dist/tools/find.js.map +1 -1
- package/dist/tools/grep.js +6 -18
- package/dist/tools/grep.js.map +1 -1
- package/dist/tools/ls.js +3 -3
- package/dist/tools/ls.js.map +1 -1
- package/dist/tools/prompt-hints.js +34 -47
- package/dist/tools/prompt-hints.js.map +1 -1
- package/dist/tools/read.js +8 -20
- package/dist/tools/read.js.map +1 -1
- package/dist/tools/search-code.js +4 -12
- package/dist/tools/search-code.js.map +1 -1
- package/dist/tools/skill.js +13 -7
- package/dist/tools/skill.js.map +1 -1
- package/dist/tools/subagent-control.js +7 -22
- package/dist/tools/subagent-control.js.map +1 -1
- package/dist/tools/subagent.js +4 -7
- package/dist/tools/subagent.js.map +1 -1
- package/dist/tools/task-output.js +4 -15
- package/dist/tools/task-output.js.map +1 -1
- package/dist/tools/task-send.js +5 -17
- package/dist/tools/task-send.js.map +1 -1
- package/dist/tools/task-stop.js +2 -2
- package/dist/tools/task-stop.js.map +1 -1
- package/dist/tools/tool-search.js +2 -7
- package/dist/tools/tool-search.js.map +1 -1
- package/dist/tools/tool-tiers.d.ts +17 -4
- package/dist/tools/tool-tiers.js +38 -15
- package/dist/tools/tool-tiers.js.map +1 -1
- package/dist/tools/web-fetch.js +7 -33
- package/dist/tools/web-fetch.js.map +1 -1
- package/dist/tools/write.js +3 -4
- package/dist/tools/write.js.map +1 -1
- package/dist/ui/components/Footer.js +1 -2
- package/dist/ui/components/Footer.js.map +1 -1
- package/dist/utils/shared-poll.d.ts +37 -0
- package/dist/utils/shared-poll.js +104 -0
- package/dist/utils/shared-poll.js.map +1 -0
- package/package.json +7 -4
- package/dist/core/api-benchmark.d.ts +0 -63
- package/dist/core/api-benchmark.js +0 -381
- package/dist/core/api-benchmark.js.map +0 -1
- package/dist/core/bash-spawn-benchmark.d.ts +0 -1
- package/dist/core/bash-spawn-benchmark.js +0 -139
- package/dist/core/bash-spawn-benchmark.js.map +0 -1
- package/dist/core/cache-warm-benchmark.d.ts +0 -21
- package/dist/core/cache-warm-benchmark.js +0 -170
- package/dist/core/cache-warm-benchmark.js.map +0 -1
- package/dist/core/fast-apply-benchmark.d.ts +0 -25
- package/dist/core/fast-apply-benchmark.js +0 -284
- package/dist/core/fast-apply-benchmark.js.map +0 -1
- package/dist/core/hashline-edit-benchmark.d.ts +0 -88
- package/dist/core/hashline-edit-benchmark.js +0 -518
- package/dist/core/hashline-edit-benchmark.js.map +0 -1
- package/dist/core/semantic-search-benchmark.d.ts +0 -36
- package/dist/core/semantic-search-benchmark.js +0 -211
- package/dist/core/semantic-search-benchmark.js.map +0 -1
- package/dist/core/speed-benchmark.d.ts +0 -132
- package/dist/core/speed-benchmark.js +0 -410
- package/dist/core/speed-benchmark.js.map +0 -1
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import { isWorkflowCommandText, countAssistantMessages, shouldStartAutopilotCycle, extractTurnToolCalls, isMechanicalOnlyTurn, } from "../core/autopilot-gate.js";
|
|
2
|
+
import { PROMPT_COMMANDS } from "../core/prompt-commands.js";
|
|
3
|
+
import { loadCustomCommands } from "../core/custom-commands.js";
|
|
4
|
+
import { log } from "../core/logger.js";
|
|
5
|
+
import { readBody, json } from "./http.js";
|
|
6
|
+
import { prepareAttachments } from "./attachments.js";
|
|
7
|
+
import { saveAutopilot } from "./app-settings.js";
|
|
8
|
+
import { lastAssistantText, buildKenContext } from "./ken-context.js";
|
|
9
|
+
import { keepAwake } from "./keep-awake.js";
|
|
10
|
+
export function handlePromptRoutes(ctx, req, res, url, method) {
|
|
11
|
+
if (method === "GET" && url === "/commands") {
|
|
12
|
+
if (ctx.mode !== "code") {
|
|
13
|
+
json(res, 200, { commands: [] });
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
// Workflow commands with agent functionality: built-in prompt templates +
|
|
17
|
+
// the user's own `.gg/commands/*.md`.
|
|
18
|
+
void (async () => {
|
|
19
|
+
const builtins = PROMPT_COMMANDS.map((c) => ({
|
|
20
|
+
name: c.name,
|
|
21
|
+
aliases: c.aliases,
|
|
22
|
+
description: c.description,
|
|
23
|
+
source: "built-in",
|
|
24
|
+
}));
|
|
25
|
+
// Desktop-safe registry actions belong in the same picker as workflows.
|
|
26
|
+
// Most registry commands have dedicated app controls or TUI-only flows;
|
|
27
|
+
// multi-root management has no other affordance, so expose only these.
|
|
28
|
+
const workspaceActions = [
|
|
29
|
+
{
|
|
30
|
+
name: "add-dir",
|
|
31
|
+
aliases: ["adddir"],
|
|
32
|
+
description: "Add another project folder to this workspace",
|
|
33
|
+
source: "built-in",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "remove-dir",
|
|
37
|
+
aliases: ["removedir"],
|
|
38
|
+
description: "Remove an added project folder from this workspace",
|
|
39
|
+
source: "built-in",
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
const custom = (await loadCustomCommands(ctx.cwd))
|
|
43
|
+
// A custom command can't shadow a built-in name or app action.
|
|
44
|
+
.filter((c) => !PROMPT_COMMANDS.some((b) => b.name === c.name) &&
|
|
45
|
+
!workspaceActions.some((action) => action.name === c.name))
|
|
46
|
+
.map((c) => ({
|
|
47
|
+
name: c.name,
|
|
48
|
+
aliases: [],
|
|
49
|
+
description: c.description,
|
|
50
|
+
source: "custom",
|
|
51
|
+
}));
|
|
52
|
+
json(res, 200, { commands: [...workspaceActions, ...builtins, ...custom] });
|
|
53
|
+
})();
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
if (method === "POST" && url === "/prompt") {
|
|
57
|
+
// Per-request: only the prompt that actually claimed the start may release
|
|
58
|
+
// it. A bare release would let an early-returning request (bad JSON, or a
|
|
59
|
+
// prompt that queued) clear a claim another request is still holding.
|
|
60
|
+
let claimedStart = false;
|
|
61
|
+
void readBody(req, res)
|
|
62
|
+
.then(async (raw) => {
|
|
63
|
+
if (raw === null)
|
|
64
|
+
return;
|
|
65
|
+
let text;
|
|
66
|
+
let attachments;
|
|
67
|
+
let meta;
|
|
68
|
+
try {
|
|
69
|
+
const body = JSON.parse(raw);
|
|
70
|
+
text = body.text ?? "";
|
|
71
|
+
attachments = Array.isArray(body.attachments) ? body.attachments : [];
|
|
72
|
+
meta = typeof body.meta === "object" && body.meta !== null ? body.meta : undefined;
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
json(res, 400, { error: "invalid JSON body" });
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (!text.trim() && attachments.length === 0) {
|
|
79
|
+
json(res, 400, { error: "empty prompt" });
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
// A typed prompt supersedes any question parked on the user: they
|
|
83
|
+
// answered with a message of their own. Release the blocked tool call
|
|
84
|
+
// NOW — otherwise it waits out its ten-minute timeout while this very
|
|
85
|
+
// message sits behind it as steering that only drains once the tool
|
|
86
|
+
// returns, so the turn looks frozen. The webview closes the band on
|
|
87
|
+
// send; a racing /ask POST just 409s.
|
|
88
|
+
ctx.asks.cancelAll({ action: "cancel", superseded: true });
|
|
89
|
+
if (ctx.runLifecycle.running &&
|
|
90
|
+
ctx.runLifecycle.isCancellationRequested(ctx.runLifecycle.generation)) {
|
|
91
|
+
json(res, 409, {
|
|
92
|
+
error: ctx.runLifecycle.state === "cancelling" ? "run_cancelling" : "cancel_failed",
|
|
93
|
+
runState: ctx.runLifecycle.state,
|
|
94
|
+
});
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
// `runClaim` covers the gap before `runAgent` flips `running`: a
|
|
98
|
+
// prompt arriving in that window must queue, not start a second run.
|
|
99
|
+
if (ctx.running || ctx.runClaim.active || ctx.autopilotActive) {
|
|
100
|
+
// Queue prompts as mid-run steering (mirrors the CLI). Also queue while
|
|
101
|
+
// an autopilot cycle is active but between injected runs (build idle,
|
|
102
|
+
// Ken reviewing) so the message never starts a run that collides with
|
|
103
|
+
// an injected one on the same session. Attachments are persisted to
|
|
104
|
+
// .gg/uploads first so the queued media rides the same native-block
|
|
105
|
+
// path as a non-queued attachment prompt when it drains.
|
|
106
|
+
const prepared = attachments.length > 0 ? await prepareAttachments(ctx.cwd, attachments) : [];
|
|
107
|
+
const count = ctx.session.queueMessage(text, prepared);
|
|
108
|
+
ctx.broadcast("queued", { count, messages: ctx.session.listQueuedMessages() });
|
|
109
|
+
json(res, 202, { queued: true, count });
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
// Claim the run NOW, synchronously. Everything below this line may
|
|
113
|
+
// yield, and `running` does not flip until runAgent begins.
|
|
114
|
+
claimedStart = ctx.runClaim.claim();
|
|
115
|
+
// A scheduled prompt has nobody watching: short ask deadline.
|
|
116
|
+
ctx.scheduledRunActive = meta?.scheduled === true;
|
|
117
|
+
json(res, 202, { accepted: true });
|
|
118
|
+
// Gate inputs captured around the run: whether this turn is a workflow
|
|
119
|
+
// slash command (attachment prompts skip slash expansion entirely), and
|
|
120
|
+
// how many assistant messages the run actually adds. Computed even when
|
|
121
|
+
// autopilot is currently off — the toggle can flip ON mid-run, and the
|
|
122
|
+
// gate reads the post-run value.
|
|
123
|
+
const workflowCommand = attachments.length === 0 &&
|
|
124
|
+
isWorkflowCommandText(text, await ctx.loadWorkflowCommandSpecs());
|
|
125
|
+
// Does this input actually expand into a persisted user message? Asked
|
|
126
|
+
// of the session itself, because only it knows whether the command
|
|
127
|
+
// resolves here (name/alias casing, custom `.gg/commands`, non-coder
|
|
128
|
+
// agents that don't expand at all). A looser guess would anchor the
|
|
129
|
+
// hint at +1 with no message to land on — decorating an unrelated
|
|
130
|
+
// later bubble with the wrong `/name`.
|
|
131
|
+
const expandsToTemplate = attachments.length === 0 && (await ctx.session.willExpandPromptTemplate(text));
|
|
132
|
+
// Webview display hint for this prompt's user bubble (kenSent shimmer
|
|
133
|
+
// label / enhancer highlight segments / the `/name` a command was typed
|
|
134
|
+
// as). Anchored +1 so it attaches to the user message the prompt below
|
|
135
|
+
// is about to push. Queued prompts skip this (their position in the run
|
|
136
|
+
// is unpredictable).
|
|
137
|
+
//
|
|
138
|
+
// Recording the invocation matters because the agent persists the
|
|
139
|
+
// EXPANDED template as the user message. Resume used to recover
|
|
140
|
+
// `/name` by matching that body against the current templates, which
|
|
141
|
+
// silently fails the moment a template is edited or reworded — the
|
|
142
|
+
// reopened session then rendered the raw multi-KB prompt instead of
|
|
143
|
+
// the command chip.
|
|
144
|
+
if (expandsToTemplate ||
|
|
145
|
+
(meta && (meta.kenSent === true || Array.isArray(meta.enhancements)))) {
|
|
146
|
+
void ctx.session
|
|
147
|
+
.persistAppMarker("user_hint", {
|
|
148
|
+
...(expandsToTemplate ? { command: text.trim() } : {}),
|
|
149
|
+
...(meta?.kenSent === true ? { kenSent: true } : {}),
|
|
150
|
+
...(Array.isArray(meta?.enhancements) ? { enhancements: meta.enhancements } : {}),
|
|
151
|
+
}, 1)
|
|
152
|
+
.catch(() => { });
|
|
153
|
+
}
|
|
154
|
+
// Fresh user turn: clear any cancel flag left from a prior cycle so this
|
|
155
|
+
// turn's autopilot review can run.
|
|
156
|
+
ctx.autopilotCancelled = false;
|
|
157
|
+
// A typed message while a plan modal/review is pending (reject,
|
|
158
|
+
// feedback, anything) supersedes the pending plan — the bump also
|
|
159
|
+
// invalidates any in-flight Ken plan review.
|
|
160
|
+
ctx.clearPendingPlan();
|
|
161
|
+
const assistantsBefore = countAssistantMessages(ctx.session.getMessages());
|
|
162
|
+
const messagesBefore = ctx.session.getMessages().length;
|
|
163
|
+
await ctx.runAgent(text, async () => {
|
|
164
|
+
// The review box's Feedback: revise read-only, like Ken's feedback.
|
|
165
|
+
if (meta?.planRevision === true)
|
|
166
|
+
await ctx.reenterPlanModeForRevision();
|
|
167
|
+
if (attachments.length > 0) {
|
|
168
|
+
// Persist each attachment under .gg/uploads so files are inspectable
|
|
169
|
+
// by the agent's tools, then prompt with the media as native blocks.
|
|
170
|
+
const prepared = await prepareAttachments(ctx.cwd, attachments);
|
|
171
|
+
await ctx.session.promptWithAttachments(text, prepared);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
// Pass the raw text straight through. AgentSession.prompt() is the
|
|
175
|
+
// single source of truth for slash-command expansion (built-in +
|
|
176
|
+
// `.gg/commands/*.md` custom), so the agent gets the right body
|
|
177
|
+
// while the webview keeps showing the short `/name`.
|
|
178
|
+
await ctx.session.prompt(text);
|
|
179
|
+
}
|
|
180
|
+
}, () => ctx.autopilot);
|
|
181
|
+
// After the user's run settles, kick off Ken's auto-review loop — but
|
|
182
|
+
// only when the turn is actually reviewable (shouldStartAutopilotCycle):
|
|
183
|
+
// workflow commands (/compare, /expand, …) end with reports or
|
|
184
|
+
// A/B/C choices reserved for the USER; registry commands (/help) and
|
|
185
|
+
// failed runs add no assistant work to judge; a turn that ended in plan
|
|
186
|
+
// mode has a pending Accept/Reject modal Ken must not preempt. This is
|
|
187
|
+
// the ONLY entry point into the cycle besides the stranded-queue drain —
|
|
188
|
+
// it drives any follow-up GG Coder runs itself, so the shared runAgent
|
|
189
|
+
// finally never recurses.
|
|
190
|
+
const decision = shouldStartAutopilotCycle({
|
|
191
|
+
enabled: ctx.autopilot,
|
|
192
|
+
cancelled: ctx.autopilotCancelled,
|
|
193
|
+
planMode: ctx.session.getPlanMode(),
|
|
194
|
+
// A submitted plan (exit_plan fired) routes into the PLAN review
|
|
195
|
+
// branch — the cycle reviews the plan itself instead of skipping.
|
|
196
|
+
planPending: ctx.pendingPlanPath !== null,
|
|
197
|
+
workflowCommand,
|
|
198
|
+
assistantMessagesAdded: countAssistantMessages(ctx.session.getMessages()) - assistantsBefore,
|
|
199
|
+
// Skip the review API call outright for turns that only started a
|
|
200
|
+
// background process (dev server/watcher), ran a read-only lookup, or
|
|
201
|
+
// committed/pushed — Ken's autopilot contract already IGNOREs these,
|
|
202
|
+
// so there's no reason to pay for that verdict.
|
|
203
|
+
mechanicalOnly: isMechanicalOnlyTurn(extractTurnToolCalls(ctx.session.getMessages(), messagesBefore)),
|
|
204
|
+
});
|
|
205
|
+
if (decision.start) {
|
|
206
|
+
log("INFO", "app-sidecar", "autopilot cycle starting", { kind: decision.kind });
|
|
207
|
+
await ctx.runAutopilotCycle(text);
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
ctx.broadcast("autopilot_ignored", { reason: decision.reason });
|
|
211
|
+
log("INFO", "app-sidecar", "autopilot skipped", { reason: decision.reason });
|
|
212
|
+
}
|
|
213
|
+
// A prompt sent while Ken was reviewing (build idle) queued but had no
|
|
214
|
+
// run to steer into — run it now as a fresh turn so it never strands.
|
|
215
|
+
await ctx.runStrandedQueue();
|
|
216
|
+
})
|
|
217
|
+
.finally(() => {
|
|
218
|
+
if (claimedStart) {
|
|
219
|
+
ctx.scheduledRunActive = false;
|
|
220
|
+
ctx.runClaim.release();
|
|
221
|
+
// The claim held the plan back until the turn fully settled.
|
|
222
|
+
ctx.offerPendingPlan();
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
// Ken Kai (mentor): an independent read-only advisory run on the kenSession.
|
|
228
|
+
// Runs concurrently with a build run — its events are ken_-prefixed so the
|
|
229
|
+
// webview keeps the bubbles separate. The context digest is assembled fresh
|
|
230
|
+
// from the BUILD session's transcript each turn (one-way mirror).
|
|
231
|
+
if (method === "POST" && url === "/ken/prompt") {
|
|
232
|
+
if (ctx.mode !== "code") {
|
|
233
|
+
json(res, 404, {
|
|
234
|
+
error: `Ken is not available in GG ${ctx.mode === "chat" ? "Chat" : "Motion"}.`,
|
|
235
|
+
});
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
void readBody(req, res).then(async (raw) => {
|
|
239
|
+
if (raw === null)
|
|
240
|
+
return;
|
|
241
|
+
let text;
|
|
242
|
+
try {
|
|
243
|
+
text = JSON.parse(raw).text ?? "";
|
|
244
|
+
}
|
|
245
|
+
catch {
|
|
246
|
+
json(res, 400, { error: "invalid JSON body" });
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
if (!text.trim()) {
|
|
250
|
+
json(res, 400, { error: "empty prompt" });
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
if (ctx.kenRunning) {
|
|
254
|
+
json(res, 409, { error: "Ken is already thinking — wait for his reply." });
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
json(res, 202, { accepted: true });
|
|
258
|
+
ctx.kenRunning = true;
|
|
259
|
+
const releaseKenAwake = keepAwake.acquire("ken");
|
|
260
|
+
ctx.broadcast("ken_run_start", { text });
|
|
261
|
+
try {
|
|
262
|
+
const ken = await ctx.ensureKenSession();
|
|
263
|
+
const digest = await buildKenContext(ctx.session, ctx.cwd, ctx.gitBranch, text, await ctx.loadWorkflowCommandSpecs(), ctx.injectedAutopilotPrompts);
|
|
264
|
+
await ken.prompt(digest);
|
|
265
|
+
// Record the turn against the BUILD session so it persists + survives
|
|
266
|
+
// resume (advisory custom entry, never an LLM message). Reply is Ken's
|
|
267
|
+
// last assistant message; skip persistence if he produced nothing.
|
|
268
|
+
const reply = lastAssistantText(ken.getMessages());
|
|
269
|
+
if (reply.trim())
|
|
270
|
+
await ctx.session.persistKenTurn(text, reply);
|
|
271
|
+
}
|
|
272
|
+
catch (err) {
|
|
273
|
+
ctx.broadcastError("ken_error", "ken run failed", err);
|
|
274
|
+
}
|
|
275
|
+
finally {
|
|
276
|
+
releaseKenAwake();
|
|
277
|
+
ctx.kenRunning = false;
|
|
278
|
+
ctx.broadcast("ken_run_end", {});
|
|
279
|
+
const pending = ctx.pendingKenModel;
|
|
280
|
+
ctx.pendingKenModel = null;
|
|
281
|
+
if (pending)
|
|
282
|
+
await ctx.syncKenModel(pending.provider, pending.model);
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
return true;
|
|
286
|
+
}
|
|
287
|
+
if (method === "POST" && url === "/ken/cancel") {
|
|
288
|
+
ctx.kenAbort.abort();
|
|
289
|
+
ctx.kenAbort = new AbortController();
|
|
290
|
+
ctx.kenSession?.setSignal(ctx.kenAbort.signal);
|
|
291
|
+
ctx.kenRunning = false;
|
|
292
|
+
ctx.broadcast("ken_run_end", { cancelled: true });
|
|
293
|
+
json(res, 200, { cancelled: true });
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
296
|
+
if (method === "POST" && url === "/autopilot") {
|
|
297
|
+
if (ctx.mode !== "code") {
|
|
298
|
+
json(res, 404, {
|
|
299
|
+
error: `Autopilot is not available in GG ${ctx.mode === "chat" ? "Chat" : "Motion"}.`,
|
|
300
|
+
});
|
|
301
|
+
return true;
|
|
302
|
+
}
|
|
303
|
+
void readBody(req, res).then(async (raw) => {
|
|
304
|
+
if (raw === null)
|
|
305
|
+
return;
|
|
306
|
+
let enabled;
|
|
307
|
+
try {
|
|
308
|
+
enabled = Boolean(JSON.parse(raw).enabled);
|
|
309
|
+
}
|
|
310
|
+
catch {
|
|
311
|
+
json(res, 400, { error: "invalid JSON body" });
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
ctx.autopilot = enabled;
|
|
315
|
+
await saveAutopilot(ctx.cwd, enabled);
|
|
316
|
+
log("INFO", "app-sidecar", "autopilot toggled", { enabled: String(enabled) });
|
|
317
|
+
ctx.broadcast("autopilot", { autopilot: enabled });
|
|
318
|
+
json(res, 200, { autopilot: enabled });
|
|
319
|
+
});
|
|
320
|
+
return true;
|
|
321
|
+
}
|
|
322
|
+
if (method === "POST" && url === "/enhance") {
|
|
323
|
+
void readBody(req, res).then(async (raw) => {
|
|
324
|
+
if (raw === null)
|
|
325
|
+
return;
|
|
326
|
+
let text;
|
|
327
|
+
try {
|
|
328
|
+
text = JSON.parse(raw).text ?? "";
|
|
329
|
+
}
|
|
330
|
+
catch {
|
|
331
|
+
json(res, 400, { error: "invalid JSON body" });
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
if (!text.trim()) {
|
|
335
|
+
json(res, 400, { error: "empty prompt" });
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
// An independent read-only LLM call — touches no session state, so it's
|
|
339
|
+
// allowed even while a run is in flight.
|
|
340
|
+
try {
|
|
341
|
+
const result = await ctx.session.enhancePrompt(text);
|
|
342
|
+
json(res, 200, result);
|
|
343
|
+
}
|
|
344
|
+
catch (err) {
|
|
345
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
346
|
+
log("ERROR", "app-sidecar", "enhance failed", { message });
|
|
347
|
+
json(res, 500, { error: message });
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
return true;
|
|
351
|
+
}
|
|
352
|
+
return false;
|
|
353
|
+
}
|
|
354
|
+
//# sourceMappingURL=prompt-routes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-routes.js","sourceRoot":"","sources":["../../src/app-sidecar/prompt-routes.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAsB,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,MAAM,UAAU,kBAAkB,CAChC,GAAwB,EACxB,GAAyB,EACzB,GAAwB,EACxB,GAAW,EACX,MAAc;IAEd,IAAI,MAAM,KAAK,KAAK,IAAI,GAAG,KAAK,WAAW,EAAE,CAAC;QAC5C,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YACxB,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;YACjC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,0EA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
3
|
+
import { type SharedPolls } from "../utils/shared-poll.js";
|
|
4
|
+
/**
|
|
5
|
+
* Daemon-wide repo pollers, shared by every window on the same repo so
|
|
6
|
+
* opening a project twice doesn't double the git/`gh` processes.
|
|
7
|
+
* Keys: `dirtyFiles` and `gitHubCI` by resolved cwd (a worktree has its own
|
|
8
|
+
* files and HEAD); `gitHubCounts` by `owner/repo` (counts are repo-wide).
|
|
9
|
+
*/
|
|
10
|
+
export interface RepoPolls {
|
|
11
|
+
readonly dirtyFiles: SharedPolls<number>;
|
|
12
|
+
readonly gitHubCounts: SharedPolls<GitHubOpenCounts>;
|
|
13
|
+
readonly gitHubCI: SharedPolls<GitHubCI | null>;
|
|
14
|
+
}
|
|
15
|
+
export declare function createRepoPolls(): RepoPolls;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getGitDirtyFileCount } from "../utils/git.js";
|
|
2
|
+
import { getGitHubOpenCounts } from "../utils/github.js";
|
|
3
|
+
import { startGitHubCIPoll } from "../utils/github-ci.js";
|
|
4
|
+
import { createSharedPolls, startIntervalPoll } from "../utils/shared-poll.js";
|
|
5
|
+
export function createRepoPolls() {
|
|
6
|
+
return {
|
|
7
|
+
// Files change outside the agent (editor saves, terminal commits).
|
|
8
|
+
dirtyFiles: createSharedPolls((cwd, publish) => startIntervalPoll({
|
|
9
|
+
fetch: () => getGitDirtyFileCount(cwd),
|
|
10
|
+
publish,
|
|
11
|
+
firstDelayMs: 5000,
|
|
12
|
+
intervalMs: 5000,
|
|
13
|
+
})),
|
|
14
|
+
// Issues/PRs change outside the app; network-bound, so a slow cadence well
|
|
15
|
+
// under the search API's rate budget (2 calls per tick).
|
|
16
|
+
gitHubCounts: createSharedPolls((slug, publish) => startIntervalPoll({
|
|
17
|
+
fetch: () => getGitHubOpenCounts(slug),
|
|
18
|
+
publish,
|
|
19
|
+
firstDelayMs: 2000,
|
|
20
|
+
intervalMs: 60_000,
|
|
21
|
+
})),
|
|
22
|
+
gitHubCI: createSharedPolls((cwd, publish) => startGitHubCIPoll(cwd, publish)),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=repo-polls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo-polls.js","sourceRoot":"","sources":["../../src/app-sidecar/repo-polls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAyB,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAiB,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAoB,MAAM,yBAAyB,CAAC;AAcjG,MAAM,UAAU,eAAe;IAC7B,OAAO;QACL,mEAAmE;QACnE,UAAU,EAAE,iBAAiB,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAC7C,iBAAiB,CAAC;YAChB,KAAK,EAAE,GAAG,EAAE,CAAC,oBAAoB,CAAC,GAAG,CAAC;YACtC,OAAO;YACP,YAAY,EAAE,IAAI;YAClB,UAAU,EAAE,IAAI;SACjB,CAAC,CACH;QACD,2EAA2E;QAC3E,yDAAyD;QACzD,YAAY,EAAE,iBAAiB,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAChD,iBAAiB,CAAC;YAChB,KAAK,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC;YACtC,OAAO;YACP,YAAY,EAAE,IAAI;YAClB,UAAU,EAAE,MAAM;SACnB,CAAC,CACH;QACD,QAAQ,EAAE,iBAAiB,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,iBAAiB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;KAC/E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import type { JiwaStore } from "../chat-agents/jiwa.js";
|
|
2
|
+
import type { MemoryStore } from "../chat-agents/memory.js";
|
|
3
|
+
import type { AgentSession } from "../core/agent-session.js";
|
|
4
|
+
import type { AskUserBridge } from "../core/ask-user.js";
|
|
5
|
+
import type { AuthMethod, AuthMethodMeta, AuthProviderMeta } from "../core/auth-providers.js";
|
|
6
|
+
import type { WorkflowCommandSpec } from "../core/autopilot-gate.js";
|
|
7
|
+
import type { EffectiveKenModel, KenModelPref } from "../core/ken-model.js";
|
|
8
|
+
import type { ElicitationBridge } from "../core/mcp/elicitation-bridge.js";
|
|
9
|
+
import type { BackgroundProcess } from "../core/process-manager.js";
|
|
10
|
+
import type { RunClaim } from "../core/run-claim.js";
|
|
11
|
+
import type { RunLifecycle } from "../core/run-lifecycle.js";
|
|
12
|
+
import type { HfSearchRow } from "../hf-pull.js";
|
|
13
|
+
import type { ServeController } from "../modes/serve-mode.js";
|
|
14
|
+
import type { GitHubCI } from "../utils/github-ci.js";
|
|
15
|
+
import type { ProgressManager } from "./progress-manager.js";
|
|
16
|
+
import type { HfPullState, SseClient, WorkspaceMode } from "./session-types.js";
|
|
17
|
+
import type { Provider } from "@kenkaiiii/gg-ai";
|
|
18
|
+
import type { AppPaths, AuthStorage, LocalEndpointKind, LocalEndpointProbe, OAuthLoginCallbacks } from "@kenkaiiii/gg-core";
|
|
19
|
+
/** Closure state of one `createSession` context that the per-session route
|
|
20
|
+
* handlers read and write. Built in `createSession`; `let` bindings are
|
|
21
|
+
* exposed as getter/setter pairs so writes land on the closure variable. */
|
|
22
|
+
export interface SessionRouteContext {
|
|
23
|
+
session: AgentSession;
|
|
24
|
+
readonly mode: WorkspaceMode;
|
|
25
|
+
chatAgent: "general" | "therapist" | "research";
|
|
26
|
+
running: boolean;
|
|
27
|
+
readonly runLifecycle: RunLifecycle;
|
|
28
|
+
autopilot: boolean;
|
|
29
|
+
readonly kenStatePayload: () => EffectiveKenModel;
|
|
30
|
+
readonly footerExtras: () => {
|
|
31
|
+
contextWindow: number;
|
|
32
|
+
gitBranch: string | null;
|
|
33
|
+
isGitRepo: boolean;
|
|
34
|
+
gitDirtyFileCount: number;
|
|
35
|
+
gitHubIssues: number | null;
|
|
36
|
+
gitHubPRs: number | null;
|
|
37
|
+
gitHubRepoUrl: string | null;
|
|
38
|
+
gitHubCI: GitHubCI | null;
|
|
39
|
+
tasks: BackgroundProcess[];
|
|
40
|
+
additionalRoots: string[];
|
|
41
|
+
};
|
|
42
|
+
readonly progress: ProgressManager;
|
|
43
|
+
readonly memoryStore: MemoryStore;
|
|
44
|
+
readonly jiwaStore: JiwaStore;
|
|
45
|
+
clientSeq: number;
|
|
46
|
+
readonly clients: Set<SseClient>;
|
|
47
|
+
autopilotActive: boolean;
|
|
48
|
+
readonly pendingPlanForHuman: (offeredGeneration: number) => {
|
|
49
|
+
planPath: string;
|
|
50
|
+
content: string;
|
|
51
|
+
} | null;
|
|
52
|
+
readonly paths: AppPaths;
|
|
53
|
+
readonly host: string;
|
|
54
|
+
readonly cwd: string;
|
|
55
|
+
readonly asks: AskUserBridge;
|
|
56
|
+
readonly runClaim: RunClaim;
|
|
57
|
+
readonly broadcast: (type: string, data: unknown) => void;
|
|
58
|
+
scheduledRunActive: boolean;
|
|
59
|
+
readonly loadWorkflowCommandSpecs: () => Promise<WorkflowCommandSpec[]>;
|
|
60
|
+
autopilotCancelled: boolean;
|
|
61
|
+
readonly clearPendingPlan: () => void;
|
|
62
|
+
readonly runAgent: (label: string, run: () => Promise<void>, reviewPending?: () => boolean) => Promise<void>;
|
|
63
|
+
readonly reenterPlanModeForRevision: () => Promise<void>;
|
|
64
|
+
pendingPlanPath: string | null;
|
|
65
|
+
readonly runAutopilotCycle: (originalRequest: string) => Promise<void>;
|
|
66
|
+
readonly runStrandedQueue: () => Promise<void>;
|
|
67
|
+
readonly offerPendingPlan: () => void;
|
|
68
|
+
kenRunning: boolean;
|
|
69
|
+
readonly ensureKenSession: () => Promise<AgentSession>;
|
|
70
|
+
gitBranch: string | null;
|
|
71
|
+
injectedAutopilotPrompts: string[];
|
|
72
|
+
readonly broadcastError: (type: "error" | "ken_error" | "autopilot_error", logLabel: string, err: unknown) => void;
|
|
73
|
+
pendingKenModel: {
|
|
74
|
+
provider: Provider;
|
|
75
|
+
model: string;
|
|
76
|
+
} | null;
|
|
77
|
+
readonly syncKenModel: (provider: Provider, model: string) => Promise<void>;
|
|
78
|
+
kenAbort: AbortController;
|
|
79
|
+
kenSession: AgentSession | null;
|
|
80
|
+
readonly runTasks: (startId: string | null, all: boolean) => Promise<void>;
|
|
81
|
+
readonly auth: AuthStorage;
|
|
82
|
+
localProbes: LocalEndpointProbe[];
|
|
83
|
+
readonly localModelBlocker: (modelId: string) => Promise<string | undefined>;
|
|
84
|
+
kenModelOverride: KenModelPref | null;
|
|
85
|
+
readonly syncKenAutoModel: (provider: Provider, model: string) => Promise<void>;
|
|
86
|
+
autopilotReviewing: boolean;
|
|
87
|
+
taskRunAll: boolean;
|
|
88
|
+
kenAutoAbort: AbortController;
|
|
89
|
+
kenAutoSession: AgentSession | null;
|
|
90
|
+
pendingCancelDrain: {
|
|
91
|
+
generation: number;
|
|
92
|
+
text: string;
|
|
93
|
+
} | null;
|
|
94
|
+
readonly CANCEL_TIMEOUT_MS: number;
|
|
95
|
+
readonly deactivateApprovedPlan: () => void;
|
|
96
|
+
readonly activateApprovedPlan: (planPath: string | undefined) => Promise<number>;
|
|
97
|
+
readonly planProgressPayload: () => {
|
|
98
|
+
total: number;
|
|
99
|
+
completed: number[];
|
|
100
|
+
};
|
|
101
|
+
readonly authStatusPayload: () => Promise<{
|
|
102
|
+
providers: (AuthProviderMeta & {
|
|
103
|
+
connected: boolean;
|
|
104
|
+
connectedMethods: AuthMethod[];
|
|
105
|
+
activeMethod?: AuthMethod | undefined;
|
|
106
|
+
oauthExhaustedUntil?: number | undefined;
|
|
107
|
+
priorityNote?: string | undefined;
|
|
108
|
+
methodGuidance: AuthMethodMeta[];
|
|
109
|
+
})[];
|
|
110
|
+
}>;
|
|
111
|
+
readonly broadcastAll: (type: string, data: unknown) => void;
|
|
112
|
+
oauthInFlight: boolean;
|
|
113
|
+
readonly oauthInFlightProviders: Set<string>;
|
|
114
|
+
readonly authCallbacks: () => OAuthLoginCallbacks;
|
|
115
|
+
pendingCode: ((code: string) => void) | null;
|
|
116
|
+
readonly elicitations: ElicitationBridge;
|
|
117
|
+
readonly localStatePayload: () => {
|
|
118
|
+
endpoints: {
|
|
119
|
+
id: string;
|
|
120
|
+
label: string;
|
|
121
|
+
baseUrl: string;
|
|
122
|
+
kind: LocalEndpointKind;
|
|
123
|
+
custom: boolean;
|
|
124
|
+
reachable: boolean;
|
|
125
|
+
reason?: string | undefined;
|
|
126
|
+
models: {
|
|
127
|
+
id: string;
|
|
128
|
+
rawId: string;
|
|
129
|
+
contextWindow: number;
|
|
130
|
+
contextWindowKnown: boolean;
|
|
131
|
+
supportsTools: boolean;
|
|
132
|
+
supportsImages: boolean;
|
|
133
|
+
supportsThinking: boolean;
|
|
134
|
+
loaded?: boolean | undefined;
|
|
135
|
+
}[];
|
|
136
|
+
}[];
|
|
137
|
+
};
|
|
138
|
+
readonly scanLocalModels: (force: boolean) => Promise<LocalEndpointProbe[]>;
|
|
139
|
+
hfPull: HfPullState | null;
|
|
140
|
+
readonly hfPullPayload: (s: HfPullState) => Record<string, unknown>;
|
|
141
|
+
readonly hfSearch: (query: string) => Promise<HfSearchRow[]>;
|
|
142
|
+
readonly startHfPull: (repo: string) => Promise<Record<string, unknown>>;
|
|
143
|
+
readonly cancelHfPull: () => boolean;
|
|
144
|
+
serveController: ServeController | null;
|
|
145
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-context.js","sourceRoot":"","sources":["../../src/app-sidecar/route-context.ts"],"names":[],"mappings":""}
|