flavor-code 1.3.23 → 1.4.0-beta.10
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 +439 -434
- package/README.zh-CN.md +436 -431
- package/dist/agent/loop.d.ts +7 -2
- package/dist/{app-NTEUPJKJ.js → app-SMIB6P23.js} +82 -161
- package/dist/{chunk-Z62P4LL7.js → chunk-BYHO2CA5.js} +10412 -8712
- package/dist/{chunk-RPFWB45Y.js → chunk-EXOSMO57.js} +13 -8
- package/dist/chunk-N5MXHJKD.js +107 -0
- package/dist/{chunk-7OICVL2M.js → chunk-RAYH6K2H.js} +2 -44
- package/dist/{chunk-VEUSROUQ.js → chunk-UO4DLWU5.js} +8 -2
- package/dist/{chunk-SUSLIHXO.js → chunk-XMRKRPNC.js} +179 -14253
- package/dist/{chunk-RQTYHUMK.js → chunk-ZJCAQXA7.js} +17 -1
- package/dist/{claude-ink-6CEG2XZZ.js → claude-ink-6EZHF64C.js} +2 -3
- package/dist/cli-main.js +75 -28
- package/dist/cli.js +54 -10
- package/dist/config/load.d.ts +2 -0
- package/dist/config/schema.d.ts +8 -0
- package/dist/context/manager.d.ts +9 -0
- package/dist/desktop/main.js +3035 -1237
- package/dist/desktop-renderer/assets/index-Bk6FYhyh.css +1 -0
- package/dist/desktop-renderer/assets/index-RNe5Gtum.js +154 -0
- package/dist/desktop-renderer/assets/{interactive-terminal-CTFo4fK9.js → interactive-terminal-DestMQ2z.js} +1 -1
- package/dist/desktop-renderer/index.html +2 -2
- package/dist/doctor.d.ts +38 -0
- package/dist/execution/docker.d.ts +5 -1
- package/dist/execution/types.d.ts +11 -0
- package/dist/git/service.d.ts +3 -3
- package/dist/git/tools.d.ts +1 -1
- package/dist/goal/classifier.d.ts +2 -0
- package/dist/goal/orchestrator.d.ts +23 -2
- package/dist/goal/planner.d.ts +2 -0
- package/dist/goal/store.d.ts +2 -0
- package/dist/goal/types.d.ts +14 -0
- package/dist/harness/journal.d.ts +2 -0
- package/dist/harness/local.d.ts +2 -0
- package/dist/init/project.d.ts +0 -6
- package/dist/jobs/registry.d.ts +8 -1
- package/dist/{load-4FWNXE6F.js → load-EW56Q2MM.js} +1 -1
- package/dist/loop/orchestrator.d.ts +20 -0
- package/dist/loop/types.d.ts +7 -0
- package/dist/loop/verifier.d.ts +2 -0
- package/dist/models/openai.d.ts +1 -1
- package/dist/models/structured.d.ts +7 -0
- package/dist/models/types.d.ts +1 -1
- package/dist/production.d.ts +17 -0
- package/dist/sdk/index.js +5 -5
- package/dist/session/tree.d.ts +2 -0
- package/dist/tools/lsp.d.ts +15 -10
- package/dist/tools/runtime.d.ts +2 -1
- package/dist/tools/search.d.ts +1 -0
- package/dist/tools/shell.d.ts +17 -12
- package/dist/tools/types.d.ts +2 -1
- package/dist/ui/commands.d.ts +1 -1
- package/dist/ui/session.d.ts +12 -0
- package/dist/ui/transcript.d.ts +9 -0
- package/dist/update/check.d.ts +20 -0
- package/dist/utils/abort.d.ts +20 -0
- package/dist/utils/execFileNoThrow.d.ts +1 -0
- package/dist/utils/heap.d.ts +58 -0
- package/dist/utils/memory-restart.d.ts +42 -3
- package/dist/utils/process-tree.d.ts +2 -0
- package/dist/utils/rotation-census.d.ts +36 -0
- package/dist/utils/semver.d.ts +3 -0
- package/dist/utils/spawn-executable.d.ts +2 -0
- package/package.json +3 -2
- package//346/212/200/346/234/257/346/226/271/346/241/210/346/212/245/345/221/212.md +5848 -5848
- package/dist/astgraph/db.mjs +0 -237
- package/dist/astgraph/extract.mjs +0 -239
- package/dist/astgraph/flavor-plugin.json +0 -25
- package/dist/astgraph/grammars.mjs +0 -68
- package/dist/astgraph/index.js +0 -301
- package/dist/astgraph/indexer.mjs +0 -175
- package/dist/astgraph/query.mjs +0 -165
- package/dist/astgraph/resolve.mjs +0 -93
- package/dist/astgraph/vendor/tree-sitter-javascript.wasm +0 -0
- package/dist/astgraph/vendor/tree-sitter-tsx.wasm +0 -0
- package/dist/astgraph/vendor/tree-sitter-typescript.wasm +0 -0
- package/dist/astgraph/vendor/tree-sitter.js +0 -3980
- package/dist/astgraph/vendor/tree-sitter.wasm +0 -0
- package/dist/astgraph/vendor/zod/LICENSE +0 -21
- package/dist/astgraph/vendor/zod/index.js +0 -4
- package/dist/astgraph/vendor/zod/locales/index.js +0 -1
- package/dist/astgraph/vendor/zod/locales/package.json +0 -7
- package/dist/astgraph/vendor/zod/package.json +0 -135
- package/dist/astgraph/vendor/zod/v4/classic/checks.js +0 -1
- package/dist/astgraph/vendor/zod/v4/classic/coerce.js +0 -17
- package/dist/astgraph/vendor/zod/v4/classic/compat.js +0 -31
- package/dist/astgraph/vendor/zod/v4/classic/errors.js +0 -48
- package/dist/astgraph/vendor/zod/v4/classic/external.js +0 -20
- package/dist/astgraph/vendor/zod/v4/classic/from-json-schema.js +0 -599
- package/dist/astgraph/vendor/zod/v4/classic/index.js +0 -4
- package/dist/astgraph/vendor/zod/v4/classic/iso.js +0 -30
- package/dist/astgraph/vendor/zod/v4/classic/package.json +0 -7
- package/dist/astgraph/vendor/zod/v4/classic/parse.js +0 -15
- package/dist/astgraph/vendor/zod/v4/classic/schemas.js +0 -1395
- package/dist/astgraph/vendor/zod/v4/core/api.js +0 -1087
- package/dist/astgraph/vendor/zod/v4/core/checks.js +0 -575
- package/dist/astgraph/vendor/zod/v4/core/core.js +0 -78
- package/dist/astgraph/vendor/zod/v4/core/doc.js +0 -35
- package/dist/astgraph/vendor/zod/v4/core/errors.js +0 -185
- package/dist/astgraph/vendor/zod/v4/core/index.js +0 -16
- package/dist/astgraph/vendor/zod/v4/core/json-schema-generator.js +0 -95
- package/dist/astgraph/vendor/zod/v4/core/json-schema-processors.js +0 -601
- package/dist/astgraph/vendor/zod/v4/core/json-schema.js +0 -1
- package/dist/astgraph/vendor/zod/v4/core/package.json +0 -7
- package/dist/astgraph/vendor/zod/v4/core/parse.js +0 -93
- package/dist/astgraph/vendor/zod/v4/core/regexes.js +0 -139
- package/dist/astgraph/vendor/zod/v4/core/registries.js +0 -51
- package/dist/astgraph/vendor/zod/v4/core/schemas.js +0 -2239
- package/dist/astgraph/vendor/zod/v4/core/standard-schema.js +0 -1
- package/dist/astgraph/vendor/zod/v4/core/to-json-schema.js +0 -448
- package/dist/astgraph/vendor/zod/v4/core/util.js +0 -674
- package/dist/astgraph/vendor/zod/v4/core/versions.js +0 -5
- package/dist/astgraph/vendor/zod/v4/index.js +0 -3
- package/dist/astgraph/vendor/zod/v4/locales/ar.js +0 -106
- package/dist/astgraph/vendor/zod/v4/locales/az.js +0 -105
- package/dist/astgraph/vendor/zod/v4/locales/be.js +0 -156
- package/dist/astgraph/vendor/zod/v4/locales/bg.js +0 -120
- package/dist/astgraph/vendor/zod/v4/locales/ca.js +0 -107
- package/dist/astgraph/vendor/zod/v4/locales/cs.js +0 -111
- package/dist/astgraph/vendor/zod/v4/locales/da.js +0 -115
- package/dist/astgraph/vendor/zod/v4/locales/de.js +0 -108
- package/dist/astgraph/vendor/zod/v4/locales/el.js +0 -109
- package/dist/astgraph/vendor/zod/v4/locales/en.js +0 -113
- package/dist/astgraph/vendor/zod/v4/locales/eo.js +0 -109
- package/dist/astgraph/vendor/zod/v4/locales/es.js +0 -132
- package/dist/astgraph/vendor/zod/v4/locales/fa.js +0 -114
- package/dist/astgraph/vendor/zod/v4/locales/fi.js +0 -112
- package/dist/astgraph/vendor/zod/v4/locales/fr-CA.js +0 -107
- package/dist/astgraph/vendor/zod/v4/locales/fr.js +0 -125
- package/dist/astgraph/vendor/zod/v4/locales/he.js +0 -214
- package/dist/astgraph/vendor/zod/v4/locales/hr.js +0 -122
- package/dist/astgraph/vendor/zod/v4/locales/hu.js +0 -108
- package/dist/astgraph/vendor/zod/v4/locales/hy.js +0 -147
- package/dist/astgraph/vendor/zod/v4/locales/id.js +0 -106
- package/dist/astgraph/vendor/zod/v4/locales/index.js +0 -52
- package/dist/astgraph/vendor/zod/v4/locales/is.js +0 -109
- package/dist/astgraph/vendor/zod/v4/locales/it.js +0 -108
- package/dist/astgraph/vendor/zod/v4/locales/ja.js +0 -107
- package/dist/astgraph/vendor/zod/v4/locales/ka.js +0 -112
- package/dist/astgraph/vendor/zod/v4/locales/kh.js +0 -5
- package/dist/astgraph/vendor/zod/v4/locales/km.js +0 -110
- package/dist/astgraph/vendor/zod/v4/locales/ko.js +0 -111
- package/dist/astgraph/vendor/zod/v4/locales/lt.js +0 -203
- package/dist/astgraph/vendor/zod/v4/locales/mk.js +0 -109
- package/dist/astgraph/vendor/zod/v4/locales/ms.js +0 -107
- package/dist/astgraph/vendor/zod/v4/locales/nl.js +0 -110
- package/dist/astgraph/vendor/zod/v4/locales/no.js +0 -108
- package/dist/astgraph/vendor/zod/v4/locales/ota.js +0 -109
- package/dist/astgraph/vendor/zod/v4/locales/package.json +0 -7
- package/dist/astgraph/vendor/zod/v4/locales/pl.js +0 -109
- package/dist/astgraph/vendor/zod/v4/locales/ps.js +0 -114
- package/dist/astgraph/vendor/zod/v4/locales/pt.js +0 -108
- package/dist/astgraph/vendor/zod/v4/locales/ro.js +0 -119
- package/dist/astgraph/vendor/zod/v4/locales/ru.js +0 -156
- package/dist/astgraph/vendor/zod/v4/locales/sl.js +0 -109
- package/dist/astgraph/vendor/zod/v4/locales/sv.js +0 -110
- package/dist/astgraph/vendor/zod/v4/locales/ta.js +0 -110
- package/dist/astgraph/vendor/zod/v4/locales/th.js +0 -110
- package/dist/astgraph/vendor/zod/v4/locales/tr.js +0 -105
- package/dist/astgraph/vendor/zod/v4/locales/ua.js +0 -5
- package/dist/astgraph/vendor/zod/v4/locales/uk.js +0 -108
- package/dist/astgraph/vendor/zod/v4/locales/ur.js +0 -110
- package/dist/astgraph/vendor/zod/v4/locales/uz.js +0 -110
- package/dist/astgraph/vendor/zod/v4/locales/vi.js +0 -108
- package/dist/astgraph/vendor/zod/v4/locales/yo.js +0 -107
- package/dist/astgraph/vendor/zod/v4/locales/zh-CN.js +0 -109
- package/dist/astgraph/vendor/zod/v4/locales/zh-TW.js +0 -107
- package/dist/astgraph/vendor/zod/v4/mini/checks.js +0 -1
- package/dist/astgraph/vendor/zod/v4/mini/coerce.js +0 -22
- package/dist/astgraph/vendor/zod/v4/mini/external.js +0 -14
- package/dist/astgraph/vendor/zod/v4/mini/index.js +0 -3
- package/dist/astgraph/vendor/zod/v4/mini/iso.js +0 -34
- package/dist/astgraph/vendor/zod/v4/mini/package.json +0 -7
- package/dist/astgraph/vendor/zod/v4/mini/parse.js +0 -1
- package/dist/astgraph/vendor/zod/v4/mini/schemas.js +0 -961
- package/dist/astgraph/vendor/zod/v4/package.json +0 -7
- package/dist/chunk-CIVPKHF4.js +0 -53
- package/dist/chunk-OTYFL4AG.js +0 -16
- package/dist/desktop-renderer/assets/index-D75ozXnZ.js +0 -154
- package/dist/desktop-renderer/assets/index-ZZsUx916.css +0 -1
- package/dist/devtools-4QTPKBKK.js +0 -2
|
@@ -37,9 +37,10 @@ var ProviderConfigSchema = z.object({
|
|
|
37
37
|
// Defaults to DEFAULT_THINKING_BUDGET; set to 0 to disable the request
|
|
38
38
|
// parameter. Provider thinking deltas are forwarded whenever they arrive.
|
|
39
39
|
thinkingBudget: z.number().int().min(0).optional(),
|
|
40
|
-
// Reasoning effort requested from the OpenAI Responses protocol
|
|
41
|
-
// default so strict compatible gateways never
|
|
42
|
-
|
|
40
|
+
// Reasoning effort requested from the OpenAI Responses protocol (sent as
|
|
41
|
+
// reasoning.effort). Omitted by default so strict compatible gateways never
|
|
42
|
+
// see an unknown parameter and the endpoint uses its server-side default.
|
|
43
|
+
thinkingEffort: z.enum(["minimal", "low", "medium", "high", "xhigh"]).optional(),
|
|
43
44
|
// Send the Claude Code client fingerprint (User-Agent/x-app) with Anthropic requests,
|
|
44
45
|
// for gateways that restrict the Anthropic protocol to Claude clients.
|
|
45
46
|
claudeClient: z.boolean().optional(),
|
|
@@ -117,16 +118,20 @@ var FlavorConfigSchema = z.object({
|
|
|
117
118
|
evaluationTimeoutMs: z.number().int().min(100).max(3e4).default(2e3)
|
|
118
119
|
}).prefault({}),
|
|
119
120
|
maxIterations: z.object({
|
|
120
|
-
main: z.number().int().min(10).max(500).default(
|
|
121
|
-
subagent: z.number().int().min(10).max(200).default(
|
|
121
|
+
main: z.number().int().min(10).max(500).default(300),
|
|
122
|
+
subagent: z.number().int().min(10).max(200).default(100),
|
|
122
123
|
softLimitFactor: z.number().min(0.5).max(1).default(0.8),
|
|
123
|
-
extendBy: z.number().int().min(5).max(100).default(
|
|
124
|
+
extendBy: z.number().int().min(5).max(100).default(50)
|
|
124
125
|
}).prefault({}),
|
|
125
126
|
loop: z.object({
|
|
126
|
-
maxCycles: z.number().int().positive().max(1e4).default(
|
|
127
|
+
maxCycles: z.number().int().positive().max(1e4).default(100),
|
|
127
128
|
maxTokens: z.number().int().positive().max(Number.MAX_SAFE_INTEGER).default(5e5),
|
|
128
129
|
isolation: z.literal("auto").default("auto")
|
|
129
130
|
}).prefault({}),
|
|
131
|
+
goal: z.object({
|
|
132
|
+
maxRounds: z.number().int().positive().max(1e4).default(100),
|
|
133
|
+
maxStallStreak: z.number().int().positive().max(100).default(3)
|
|
134
|
+
}).prefault({}),
|
|
130
135
|
context: z.object({
|
|
131
136
|
windowTokens: z.number().int().positive().default(2e5),
|
|
132
137
|
reservedOutputTokens: z.number().int().nonnegative().default(2e4),
|
|
@@ -541,7 +546,7 @@ async function loadConfig(options) {
|
|
|
541
546
|
process.env[key] = value;
|
|
542
547
|
}
|
|
543
548
|
}
|
|
544
|
-
await seedGlobalEnv(globalEnvPath);
|
|
549
|
+
if (options.seedGlobalEnv !== false) await seedGlobalEnv(globalEnvPath);
|
|
545
550
|
const projectRead = await readJsonIfPresent(projectPath);
|
|
546
551
|
const projectConfig = projectRead?.value;
|
|
547
552
|
if (projectRead) sources.push(projectRead.source);
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
|
|
3
|
+
|
|
4
|
+
// src/utils/memory-restart.ts
|
|
5
|
+
import { join } from "path";
|
|
6
|
+
var MEMORY_RESTART_EXIT_CODE = 75;
|
|
7
|
+
var MEMORY_RESTART_MARKER_FILE = "memory-restart.json";
|
|
8
|
+
var MEMORY_RESTART_MAX_ATTEMPTS = 24;
|
|
9
|
+
var MEMORY_RESTART_WINDOW_MS = 60 * 60 * 1e3;
|
|
10
|
+
var MEMORY_RESTART_MIN_GAP_MS = 5 * 60 * 1e3;
|
|
11
|
+
var MEMORY_RESTART_CONTINUATION_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
12
|
+
var SESSION_ID_PATTERN = /^session-[A-Za-z0-9_-]+$/u;
|
|
13
|
+
var rotationActive = false;
|
|
14
|
+
function markMemoryRotation() {
|
|
15
|
+
rotationActive = true;
|
|
16
|
+
}
|
|
17
|
+
function memoryRotationActive() {
|
|
18
|
+
return rotationActive;
|
|
19
|
+
}
|
|
20
|
+
function memoryRestartMarkerPath(workspace) {
|
|
21
|
+
return join(workspace, ".flavor", "tmp", MEMORY_RESTART_MARKER_FILE);
|
|
22
|
+
}
|
|
23
|
+
function nextMemoryRestartMarker(previous, sessionId, now, continuation) {
|
|
24
|
+
const previousWindowStart = previous?.windowStartedAt ?? previous?.requestedAt;
|
|
25
|
+
const reusable = previous !== void 0 && previous.sessionId === sessionId && previousWindowStart !== void 0 && now.getTime() - Date.parse(previousWindowStart) < MEMORY_RESTART_WINDOW_MS && Number.isInteger(previous.attempts) && previous.attempts > 0;
|
|
26
|
+
return {
|
|
27
|
+
sessionId,
|
|
28
|
+
windowStartedAt: reusable ? previousWindowStart : now.toISOString(),
|
|
29
|
+
requestedAt: now.toISOString(),
|
|
30
|
+
attempts: reusable ? previous.attempts + 1 : 1,
|
|
31
|
+
...continuation === void 0 ? {} : { continuation }
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function consumedMemoryRestartMarker(marker) {
|
|
35
|
+
return {
|
|
36
|
+
sessionId: marker.sessionId,
|
|
37
|
+
...marker.windowStartedAt === void 0 ? {} : { windowStartedAt: marker.windowStartedAt },
|
|
38
|
+
requestedAt: marker.requestedAt,
|
|
39
|
+
attempts: marker.attempts
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function rotationCooldownActive(marker, sessionId, now) {
|
|
43
|
+
return marker !== void 0 && marker.sessionId === sessionId && now.getTime() - Date.parse(marker.requestedAt) < MEMORY_RESTART_MIN_GAP_MS;
|
|
44
|
+
}
|
|
45
|
+
function pendingContinuation(marker, sessionId, now) {
|
|
46
|
+
if (marker === void 0 || marker.sessionId !== sessionId) return void 0;
|
|
47
|
+
if (now.getTime() - Date.parse(marker.requestedAt) > MEMORY_RESTART_CONTINUATION_TTL_MS) return void 0;
|
|
48
|
+
const continuation = marker.continuation;
|
|
49
|
+
if (continuation === void 0) return void 0;
|
|
50
|
+
if (continuation.kind !== "loop" && continuation.kind !== "goal") return void 0;
|
|
51
|
+
if (typeof continuation.id !== "string" || continuation.id.length === 0) return void 0;
|
|
52
|
+
return continuation;
|
|
53
|
+
}
|
|
54
|
+
function shouldRelaunchForMemoryRestart(marker) {
|
|
55
|
+
return marker !== void 0 && SESSION_ID_PATTERN.test(marker.sessionId) && Number.isInteger(marker.attempts) && marker.attempts >= 1 && marker.attempts <= MEMORY_RESTART_MAX_ATTEMPTS;
|
|
56
|
+
}
|
|
57
|
+
function memoryRestartArgs(argv, marker) {
|
|
58
|
+
if (!shouldRelaunchForMemoryRestart(marker)) return void 0;
|
|
59
|
+
const stripped = [];
|
|
60
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
61
|
+
const argument = argv[index];
|
|
62
|
+
if (argument === "--resume") {
|
|
63
|
+
if (index + 1 < argv.length && !argv[index + 1].startsWith("-")) index += 1;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (argument.startsWith("--resume=")) continue;
|
|
67
|
+
if (argument === "--memory-restart") continue;
|
|
68
|
+
stripped.push(argument);
|
|
69
|
+
}
|
|
70
|
+
return [...stripped, "--resume", marker.sessionId, "--memory-restart"];
|
|
71
|
+
}
|
|
72
|
+
function parseMemoryRestartMarker(json) {
|
|
73
|
+
try {
|
|
74
|
+
const value = JSON.parse(json);
|
|
75
|
+
if (typeof value.sessionId !== "string" || typeof value.requestedAt !== "string" || typeof value.attempts !== "number") {
|
|
76
|
+
return void 0;
|
|
77
|
+
}
|
|
78
|
+
const continuation = value.continuation;
|
|
79
|
+
if (continuation !== void 0 && (typeof continuation !== "object" || continuation === null || continuation.kind !== "loop" && continuation.kind !== "goal" || typeof continuation.id !== "string")) {
|
|
80
|
+
return void 0;
|
|
81
|
+
}
|
|
82
|
+
const windowStartedAt = value.windowStartedAt;
|
|
83
|
+
if (windowStartedAt !== void 0 && typeof windowStartedAt !== "string") return void 0;
|
|
84
|
+
return {
|
|
85
|
+
sessionId: value.sessionId,
|
|
86
|
+
...windowStartedAt === void 0 ? {} : { windowStartedAt },
|
|
87
|
+
requestedAt: value.requestedAt,
|
|
88
|
+
attempts: value.attempts,
|
|
89
|
+
...continuation === void 0 ? {} : { continuation }
|
|
90
|
+
};
|
|
91
|
+
} catch {
|
|
92
|
+
return void 0;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export {
|
|
97
|
+
MEMORY_RESTART_EXIT_CODE,
|
|
98
|
+
markMemoryRotation,
|
|
99
|
+
memoryRotationActive,
|
|
100
|
+
memoryRestartMarkerPath,
|
|
101
|
+
nextMemoryRestartMarker,
|
|
102
|
+
consumedMemoryRestartMarker,
|
|
103
|
+
rotationCooldownActive,
|
|
104
|
+
pendingContinuation,
|
|
105
|
+
memoryRestartArgs,
|
|
106
|
+
parseMemoryRestartMarker
|
|
107
|
+
};
|
|
@@ -1,44 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
gt,
|
|
5
|
-
isValidVersion
|
|
6
|
-
} from "./chunk-OTYFL4AG.js";
|
|
7
|
-
|
|
8
|
-
// src/update/check.ts
|
|
9
|
-
var NPM_PACKAGE_NAME = "flavor-code";
|
|
10
|
-
var REGISTRY_LATEST_URL = `https://registry.npmjs.org/${NPM_PACKAGE_NAME}/latest`;
|
|
11
|
-
var DEFAULT_TIMEOUT_MS = 3e3;
|
|
12
|
-
function findNewerVersion(current, latest) {
|
|
13
|
-
if (!isValidVersion(current) || !isValidVersion(latest)) return void 0;
|
|
14
|
-
return gt(latest, current) ? latest : void 0;
|
|
15
|
-
}
|
|
16
|
-
async function fetchLatestVersion(options = {}) {
|
|
17
|
-
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
18
|
-
const fetchImpl = options.fetchImpl ?? ((url, init) => fetch(url, init));
|
|
19
|
-
let timer;
|
|
20
|
-
const timeout = new Promise((resolve) => {
|
|
21
|
-
timer = setTimeout(() => resolve(void 0), timeoutMs);
|
|
22
|
-
timer.unref?.();
|
|
23
|
-
});
|
|
24
|
-
try {
|
|
25
|
-
const response = await Promise.race([
|
|
26
|
-
fetchImpl(REGISTRY_LATEST_URL, { signal: AbortSignal.timeout(timeoutMs) }),
|
|
27
|
-
timeout
|
|
28
|
-
]);
|
|
29
|
-
if (response === void 0 || !response.ok) return void 0;
|
|
30
|
-
const body = await Promise.race([response.json(), timeout]);
|
|
31
|
-
return typeof body?.version === "string" ? body.version : void 0;
|
|
32
|
-
} catch {
|
|
33
|
-
return void 0;
|
|
34
|
-
} finally {
|
|
35
|
-
if (timer !== void 0) clearTimeout(timer);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
async function checkForUpdate(current, options = {}) {
|
|
39
|
-
const latest = await fetchLatestVersion(options);
|
|
40
|
-
return latest === void 0 ? void 0 : findNewerVersion(current, latest);
|
|
41
|
-
}
|
|
42
3
|
|
|
43
4
|
// src/ui/task-progress-model.ts
|
|
44
5
|
var FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
@@ -67,13 +28,13 @@ function statusPresentation(block, elapsedMs, interactive) {
|
|
|
67
28
|
if (block.state === "running" && block.activity === "model") {
|
|
68
29
|
return interactive ? {
|
|
69
30
|
glyph: activityFrame(elapsedMs),
|
|
70
|
-
text:
|
|
31
|
+
text: block.text,
|
|
71
32
|
color: "#81c8f2",
|
|
72
33
|
metaLabel: formatElapsed(elapsedMs),
|
|
73
34
|
metaColor: "ansi:blackBright"
|
|
74
35
|
} : {
|
|
75
36
|
glyph: "\xB7",
|
|
76
|
-
text:
|
|
37
|
+
text: block.text,
|
|
77
38
|
color: "#81c8f2"
|
|
78
39
|
};
|
|
79
40
|
}
|
|
@@ -155,9 +116,6 @@ function stripSubagentPrefix(text, isSubagent) {
|
|
|
155
116
|
}
|
|
156
117
|
|
|
157
118
|
export {
|
|
158
|
-
NPM_PACKAGE_NAME,
|
|
159
|
-
fetchLatestVersion,
|
|
160
|
-
checkForUpdate,
|
|
161
119
|
staticTaskLines,
|
|
162
120
|
statusPresentation
|
|
163
121
|
};
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
message,
|
|
5
5
|
redactErrorText,
|
|
6
6
|
redactSecrets
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-BYHO2CA5.js";
|
|
8
8
|
|
|
9
9
|
// src/rpc/server.ts
|
|
10
10
|
import { createInterface } from "readline";
|
|
@@ -44,7 +44,13 @@ var FlavorRpcServer = class {
|
|
|
44
44
|
this.#runtime = await this.#options.createRuntime({
|
|
45
45
|
workspace: this.#options.workspace,
|
|
46
46
|
output: (event) => {
|
|
47
|
-
|
|
47
|
+
const emitted = this.#emit({ type: "event", sessionId: this.#runtime?.sessionId, event }, "output");
|
|
48
|
+
if (event.type === "exit") {
|
|
49
|
+
void emitted.finally(() => {
|
|
50
|
+
this.#closing = true;
|
|
51
|
+
this.#lines?.close();
|
|
52
|
+
});
|
|
53
|
+
}
|
|
48
54
|
}
|
|
49
55
|
});
|
|
50
56
|
await this.#runtime.session.start();
|