@quantiya/codevibe-core 2.0.3 → 2.0.5
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.js +198 -196
- package/dist/local-model/manager.d.ts +18 -6
- package/dist/local-model/ollama.d.ts +38 -1
- package/dist/orchestration/setup-types.d.ts +9 -4
- package/dist/orchestration-shell/__tests__/companion-turn-mirror.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/mobile-user-prompt-return.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/runOrchestrationShell-session-retire.test.d.ts +1 -0
- package/dist/orchestration-shell/audit-runner.d.ts +3 -3
- package/dist/orchestration-shell/cli.d.ts +10 -0
- package/dist/orchestration-shell/cli.js +1167 -842
- package/dist/orchestration-shell/components/InputBar.d.ts +67 -0
- package/dist/orchestration-shell/emit-shell-event.d.ts +1 -1
- package/dist/orchestration-shell/index.d.ts +119 -2
- package/dist/orchestration-shell/ink-runtime.d.ts +11 -1
- package/dist/orchestration-shell/mode-selection.d.ts +5 -9
- package/dist/types/session.d.ts +2 -1
- package/package.json +5 -4
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { spawn } from 'child_process';
|
|
2
2
|
import type { Tier } from '../orchestration-shell/types';
|
|
3
3
|
import { type LocalModelState, type LocalModelStateStore } from './state';
|
|
4
|
+
import { type OllamaPullProgressListener } from './ollama';
|
|
4
5
|
import type { LocalGemmaPlannerRunner } from '../planner/local-gemma';
|
|
5
6
|
export type LocalModelCommand = 'install' | 'status' | 'remove' | 'enable' | 'warm' | 'health-check';
|
|
6
7
|
export type LocalModelEntitlementSource = 'backend' | 'unauthenticated' | 'unavailable';
|
|
@@ -21,7 +22,7 @@ export interface LocalModelStore {
|
|
|
21
22
|
removeArtifact(config: LocalModelArtifactConfig): Promise<boolean>;
|
|
22
23
|
}
|
|
23
24
|
export interface LocalModelInstaller {
|
|
24
|
-
install(config: LocalModelArtifactConfig): Promise<void>;
|
|
25
|
+
install(config: LocalModelArtifactConfig, onProgress?: OllamaPullProgressListener): Promise<void>;
|
|
25
26
|
}
|
|
26
27
|
export interface LocalModelDownloadTransport {
|
|
27
28
|
downloadToFile(url: URL, destinationPath: string, expectedBytes: number): Promise<void>;
|
|
@@ -70,14 +71,14 @@ export declare function localModelArtifactPath(config: LocalModelArtifactConfig)
|
|
|
70
71
|
export declare const defaultLocalModelStore: LocalModelStore;
|
|
71
72
|
export declare const defaultLocalModelDownloadTransport: LocalModelDownloadTransport;
|
|
72
73
|
export interface LocalModelProcessPuller {
|
|
73
|
-
pull(model: string, localOllamaHost?: string): Promise<void>;
|
|
74
|
+
pull(model: string, localOllamaHost?: string, onProgress?: OllamaPullProgressListener): Promise<void>;
|
|
74
75
|
}
|
|
75
76
|
type SpawnOllamaPull = typeof spawn;
|
|
76
77
|
export declare class OllamaProcessPuller implements LocalModelProcessPuller {
|
|
77
78
|
private readonly command;
|
|
78
79
|
private readonly spawnPull;
|
|
79
80
|
constructor(command?: string, spawnPull?: SpawnOllamaPull);
|
|
80
|
-
pull(model: string, localOllamaHost?: string): Promise<void>;
|
|
81
|
+
pull(model: string, localOllamaHost?: string, _onProgress?: OllamaPullProgressListener): Promise<void>;
|
|
81
82
|
}
|
|
82
83
|
/**
|
|
83
84
|
* Build the Ollama runtime config for a pull that HONORS the caller's `model` argument
|
|
@@ -100,20 +101,31 @@ export declare class DefaultOllamaPuller implements LocalModelProcessPuller {
|
|
|
100
101
|
private readonly httpPuller;
|
|
101
102
|
private readonly processPuller;
|
|
102
103
|
constructor(httpPuller?: LocalModelProcessPuller, processPuller?: LocalModelProcessPuller);
|
|
103
|
-
pull(model: string): Promise<void>;
|
|
104
|
+
pull(model: string, localOllamaHost?: string, onProgress?: OllamaPullProgressListener): Promise<void>;
|
|
104
105
|
}
|
|
105
106
|
export declare class OllamaLocalModelInstaller implements LocalModelInstaller {
|
|
106
107
|
private readonly puller;
|
|
107
108
|
constructor(puller?: LocalModelProcessPuller);
|
|
108
|
-
install(config: LocalModelArtifactConfig): Promise<void>;
|
|
109
|
+
install(config: LocalModelArtifactConfig, onProgress?: OllamaPullProgressListener): Promise<void>;
|
|
109
110
|
}
|
|
110
111
|
export declare class HttpsLocalModelInstaller implements LocalModelInstaller {
|
|
111
112
|
private readonly transport;
|
|
112
113
|
constructor(transport?: LocalModelDownloadTransport);
|
|
113
|
-
install(config: LocalModelArtifactConfig): Promise<void>;
|
|
114
|
+
install(config: LocalModelArtifactConfig, _onProgress?: OllamaPullProgressListener): Promise<void>;
|
|
114
115
|
private tryDigestExistingArtifact;
|
|
115
116
|
}
|
|
116
117
|
export declare const defaultLocalModelInstaller: LocalModelInstaller;
|
|
117
118
|
export declare const defaultLocalModelRuntimeFactory: LocalModelRuntimeFactory;
|
|
119
|
+
/**
|
|
120
|
+
* Build the human-facing install progress reporter that streams a single, carriage-return
|
|
121
|
+
* in-place line to `out` as an Ollama pull downloads (e.g.
|
|
122
|
+
* `\rPulling gemma4:12b-it-qat: 42% (3100/7200 MB)`), plus a `finish()` that terminates the
|
|
123
|
+
* line with a newline once — but ONLY if progress was actually shown, so the pinned-HTTPS
|
|
124
|
+
* path and mocked installers (which never emit progress) print no spurious blank line.
|
|
125
|
+
*/
|
|
126
|
+
export declare function createInstallProgressReporter(config: LocalModelArtifactConfig, out: (s: string) => void): {
|
|
127
|
+
onProgress: OllamaPullProgressListener;
|
|
128
|
+
finish: () => void;
|
|
129
|
+
};
|
|
118
130
|
export declare function runLocalModelCommand(options: RunLocalModelCommandOptions): Promise<number>;
|
|
119
131
|
export {};
|
|
@@ -13,10 +13,47 @@ export type OllamaRuntimeConfigResult = {
|
|
|
13
13
|
ok: false;
|
|
14
14
|
reason: string;
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* The `/api/pull` STALL window. A real multi-GB model pull runs for many minutes, so the
|
|
18
|
+
* pull must NOT use the single-shot inference timeout ({@link requestOllamaJson}). Instead we
|
|
19
|
+
* stream the download and reset a timer on EVERY received chunk, aborting only when NO
|
|
20
|
+
* progress arrives for this long — a download that keeps making progress, however large or
|
|
21
|
+
* slow, never times out.
|
|
22
|
+
*/
|
|
23
|
+
export declare const PULL_STALL_TIMEOUT_MS: number;
|
|
16
24
|
export declare function isSafeOllamaModelName(model: string | null | undefined): model is string;
|
|
17
25
|
export declare function parseLocalOllamaHost(raw: string | undefined): string | null;
|
|
18
26
|
export declare function loadOllamaRuntimeConfigFromEnv(env?: NodeJS.ProcessEnv): OllamaRuntimeConfigResult;
|
|
19
|
-
|
|
27
|
+
/** A single streamed `/api/pull` progress record surfaced to callers. */
|
|
28
|
+
export interface OllamaPullProgress {
|
|
29
|
+
/** e.g. `pulling <digest>`, `downloading`, `verifying sha256 digest`, `writing manifest`, `success`. */
|
|
30
|
+
status: string;
|
|
31
|
+
/** Bytes downloaded so far for the current layer (present on `downloading`/`pulling` chunks). */
|
|
32
|
+
completed?: number;
|
|
33
|
+
/** Total bytes for the current layer (present on `downloading`/`pulling` chunks). */
|
|
34
|
+
total?: number;
|
|
35
|
+
}
|
|
36
|
+
/** Progress sink for {@link requestOllamaPull}. Defaults to a no-op so existing callers/tests are unaffected. */
|
|
37
|
+
export type OllamaPullProgressListener = (progress: OllamaPullProgress) => void;
|
|
38
|
+
/**
|
|
39
|
+
* STREAM a model pull from Ollama `/api/pull`, surfacing per-chunk download progress and
|
|
40
|
+
* aborting only on a STALL (no bytes for {@link PULL_STALL_TIMEOUT_MS}) — never on a total
|
|
41
|
+
* elapsed cap. Ollama returns newline-delimited JSON: interspersed
|
|
42
|
+
* `{"status":"pulling <digest>","completed":M,"total":N}` / `{"status":"downloading"}` /
|
|
43
|
+
* `{"status":"verifying sha256 digest"}` / `{"status":"writing manifest"}` chunks, terminating
|
|
44
|
+
* with `{"status":"success"}`; an error yields `{"error":"..."}`. Each line is parsed as it
|
|
45
|
+
* arrives (the body is never buffered whole).
|
|
46
|
+
*
|
|
47
|
+
* `onProgress` fires on every progress chunk (default no-op). `options.stallTimeoutMs` is a
|
|
48
|
+
* TEST SEAM to shorten the stall window deterministically; production uses the default.
|
|
49
|
+
*
|
|
50
|
+
* NOTE: this deliberately does NOT go through {@link requestOllamaJson} — that function's
|
|
51
|
+
* single-shot inference timeout (60s, capped 5m) is correct for classify/generate but would
|
|
52
|
+
* kill a legitimate multi-minute download.
|
|
53
|
+
*/
|
|
54
|
+
export declare function requestOllamaPull(config: OllamaRuntimeConfig, onProgress?: OllamaPullProgressListener, options?: {
|
|
55
|
+
stallTimeoutMs?: number;
|
|
56
|
+
}): Promise<void>;
|
|
20
57
|
export declare class OllamaGemmaPlannerRunner implements LocalGemmaPlannerRunner {
|
|
21
58
|
private readonly config;
|
|
22
59
|
readonly runtimeLabel: string;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ReviewerRole as PolicyReviewerRole } from '../reviewer/types.js';
|
|
2
2
|
import type { AgentKind } from '../reviewer/types.js';
|
|
3
|
-
import { AgentType } from '../types/session.js';
|
|
4
3
|
import { ReviewerRole as SchemaReviewerRole } from '../types/reviewer.js';
|
|
5
4
|
/**
|
|
6
5
|
* Tier returned by `getSubscriptionStatus`. Drives seat budget +
|
|
@@ -134,8 +133,14 @@ export declare function roleToReviewerSpec(role: WizardRole): PolicyReviewerRole
|
|
|
134
133
|
*/
|
|
135
134
|
export declare function roleToAppSync(role: WizardRole): SchemaReviewerRole;
|
|
136
135
|
/**
|
|
137
|
-
* Map AgentKind (lowercase reviewer-module wire) to the AppSync
|
|
138
|
-
*
|
|
136
|
+
* Map AgentKind (lowercase reviewer-module wire) to the UPPERCASE AppSync
|
|
137
|
+
* reviewer-agent enum. Used at save time when building the
|
|
139
138
|
* `ReviewerAgentSpecInput[]` for `updateReviewerPolicy`.
|
|
139
|
+
*
|
|
140
|
+
* The codomain is the REVIEWER-agent union
|
|
141
|
+
* (`CLAUDE | GEMINI | CODEX | ANTIGRAVITY`, per `ReviewerAgentSpecInput.agent`),
|
|
142
|
+
* NOT the session `AgentType` enum — a reviewer seat can be ANTIGRAVITY
|
|
143
|
+
* (never in `AgentType`) and can never be the CODEVIBE orchestrator, so the
|
|
144
|
+
* two enums are deliberately distinct.
|
|
140
145
|
*/
|
|
141
|
-
export declare function agentToAppSync(agent: AgentKind):
|
|
146
|
+
export declare function agentToAppSync(agent: AgentKind): 'CLAUDE' | 'GEMINI' | 'CODEX' | 'ANTIGRAVITY';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -17,9 +17,9 @@ export interface RunAuditBrowserDeps {
|
|
|
17
17
|
/** The session the task belongs to (the `queryAudit` 2-arg shape needs it). */
|
|
18
18
|
sessionId: string;
|
|
19
19
|
/**
|
|
20
|
-
* The effective tier. When provided (the CLI passes `
|
|
21
|
-
* it is authoritative (honors `CODEVIBE_TIER`). When omitted,
|
|
22
|
-
* `getSubscriptionStatus().tier` from the backend.
|
|
20
|
+
* The effective tier. When provided (the CLI passes the `CODEVIBE_TIER` env
|
|
21
|
+
* value inline), it is authoritative (honors `CODEVIBE_TIER`). When omitted,
|
|
22
|
+
* the runner reads `getSubscriptionStatus().tier` from the backend.
|
|
23
23
|
*/
|
|
24
24
|
tier?: Tier;
|
|
25
25
|
/** Test seam — defaults to `cryptoService.decryptContent`. */
|
|
@@ -141,6 +141,16 @@ export declare function runModelCli(parsed: ParsedModelArgs, deps?: {
|
|
|
141
141
|
export interface LocalModelBootDecision {
|
|
142
142
|
mode: Mode;
|
|
143
143
|
notice: string | null;
|
|
144
|
+
/**
|
|
145
|
+
* Interactive-install signal. Set to `true` ONLY on the no-installed-model
|
|
146
|
+
* path when Orchestration Mode is requested by a Pro/Max user. The caller
|
|
147
|
+
* (`main()`) uses it to decide whether to offer an interactive install prompt
|
|
148
|
+
* (TTY only) instead of silently downgrading to Companion Mode. On every other
|
|
149
|
+
* path (companion request, tier < Pro, model present) it is left unset, so the
|
|
150
|
+
* caller keeps the existing silent behavior. `notice` still carries the decline
|
|
151
|
+
* copy for both the "user said No" and the non-interactive fallback paths.
|
|
152
|
+
*/
|
|
153
|
+
promptInstall?: boolean;
|
|
144
154
|
}
|
|
145
155
|
export declare function resolveLocalModelBoot(args: {
|
|
146
156
|
requestedMode: Mode;
|