flavor-code 1.2.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.
Files changed (145) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1081 -0
  3. package/dist/agent/loop.d.ts +31 -0
  4. package/dist/agent/message-queue.d.ts +19 -0
  5. package/dist/agent/planner.d.ts +28 -0
  6. package/dist/agent/subagents.d.ts +50 -0
  7. package/dist/agent/task-plan.d.ts +60 -0
  8. package/dist/agent/task-tools.d.ts +11 -0
  9. package/dist/agent/types.d.ts +117 -0
  10. package/dist/app-WC2XXGLM.js +3185 -0
  11. package/dist/app-WC2XXGLM.js.map +1 -0
  12. package/dist/auth/oauth-config.d.ts +4 -0
  13. package/dist/auth/oauth.d.ts +21 -0
  14. package/dist/auth/store.d.ts +15 -0
  15. package/dist/auth/types.d.ts +33 -0
  16. package/dist/chunk-BU64GNXE.js +15771 -0
  17. package/dist/chunk-BU64GNXE.js.map +1 -0
  18. package/dist/chunk-DM64TM4Z.js +124 -0
  19. package/dist/chunk-DM64TM4Z.js.map +1 -0
  20. package/dist/chunk-JZ322RCJ.js +40 -0
  21. package/dist/chunk-JZ322RCJ.js.map +1 -0
  22. package/dist/chunk-M744K7MK.js +246 -0
  23. package/dist/chunk-M744K7MK.js.map +1 -0
  24. package/dist/chunk-MVIMQEQT.js +692 -0
  25. package/dist/chunk-MVIMQEQT.js.map +1 -0
  26. package/dist/chunk-VOCZVFP7.js +153 -0
  27. package/dist/chunk-VOCZVFP7.js.map +1 -0
  28. package/dist/chunk-XS2JU6S3.js +35557 -0
  29. package/dist/chunk-XS2JU6S3.js.map +1 -0
  30. package/dist/claude-ink-ZL4UZMFY.js +27 -0
  31. package/dist/claude-ink-ZL4UZMFY.js.map +1 -0
  32. package/dist/cli.js +915 -0
  33. package/dist/cli.js.map +1 -0
  34. package/dist/codeisland/activate.mjs +74 -0
  35. package/dist/codeisland/bridge.mjs +97 -0
  36. package/dist/codeisland/flavor-plugin.json +27 -0
  37. package/dist/config/load.d.ts +19 -0
  38. package/dist/config/protected-file.d.ts +15 -0
  39. package/dist/config/schema.d.ts +176 -0
  40. package/dist/config/secret-envelope.d.ts +8 -0
  41. package/dist/context/compaction.d.ts +44 -0
  42. package/dist/context/manager.d.ts +65 -0
  43. package/dist/context/summarizer.d.ts +15 -0
  44. package/dist/desktop/main.js +17778 -0
  45. package/dist/desktop/main.js.map +1 -0
  46. package/dist/desktop/preload.cjs +90 -0
  47. package/dist/desktop/preload.cjs.map +1 -0
  48. package/dist/desktop-renderer/assets/index-C66pDvHs.js +144 -0
  49. package/dist/desktop-renderer/assets/index-C66pDvHs.js.map +1 -0
  50. package/dist/desktop-renderer/assets/index-Cm_ktmXm.css +1 -0
  51. package/dist/desktop-renderer/index.html +16 -0
  52. package/dist/devtools-SXJBSV2N.js +3 -0
  53. package/dist/devtools-SXJBSV2N.js.map +1 -0
  54. package/dist/execution/docker.d.ts +29 -0
  55. package/dist/execution/factory.d.ts +3 -0
  56. package/dist/execution/types.d.ts +18 -0
  57. package/dist/goal/classifier.d.ts +12 -0
  58. package/dist/goal/orchestrator.d.ts +34 -0
  59. package/dist/goal/planner.d.ts +9 -0
  60. package/dist/goal/store.d.ts +9 -0
  61. package/dist/goal/types.d.ts +190 -0
  62. package/dist/hallucination/confidence.d.ts +12 -0
  63. package/dist/hallucination/evidence-ledger.d.ts +29 -0
  64. package/dist/hallucination/guard.d.ts +27 -0
  65. package/dist/hallucination/messages.d.ts +10 -0
  66. package/dist/hallucination/retry-monitor.d.ts +19 -0
  67. package/dist/hallucination/sliding-window.d.ts +13 -0
  68. package/dist/hallucination/types.d.ts +49 -0
  69. package/dist/harness/local.d.ts +54 -0
  70. package/dist/hooks/bus.d.ts +9 -0
  71. package/dist/hooks/types.d.ts +105 -0
  72. package/dist/ide/client.d.ts +35 -0
  73. package/dist/incidents/reporter.d.ts +38 -0
  74. package/dist/init/project.d.ts +25 -0
  75. package/dist/load-WQGNTCHC.js +20 -0
  76. package/dist/load-WQGNTCHC.js.map +1 -0
  77. package/dist/loop/budget.d.ts +11 -0
  78. package/dist/loop/isolation.d.ts +21 -0
  79. package/dist/loop/orchestrator.d.ts +82 -0
  80. package/dist/loop/store.d.ts +13 -0
  81. package/dist/loop/types.d.ts +142 -0
  82. package/dist/loop/verifier.d.ts +13 -0
  83. package/dist/mcp/client.d.ts +66 -0
  84. package/dist/mcp/sdk.d.ts +27 -0
  85. package/dist/memory/coordinator.d.ts +32 -0
  86. package/dist/memory/extractor.d.ts +15 -0
  87. package/dist/memory/intent.d.ts +2 -0
  88. package/dist/memory/retrieval.d.ts +13 -0
  89. package/dist/memory/review.d.ts +36 -0
  90. package/dist/memory/similarity.d.ts +5 -0
  91. package/dist/memory/store.d.ts +58 -0
  92. package/dist/memory/types.d.ts +37 -0
  93. package/dist/models/anthropic.d.ts +24 -0
  94. package/dist/models/cache-profile.d.ts +23 -0
  95. package/dist/models/openai.d.ts +24 -0
  96. package/dist/models/registry.d.ts +16 -0
  97. package/dist/models/structured.d.ts +75 -0
  98. package/dist/models/types.d.ts +93 -0
  99. package/dist/permissions/classifier.d.ts +9 -0
  100. package/dist/permissions/engine.d.ts +28 -0
  101. package/dist/plugins/host.d.ts +15 -0
  102. package/dist/plugins/types.d.ts +136 -0
  103. package/dist/production.d.ts +59 -0
  104. package/dist/prompts/system.d.ts +28 -0
  105. package/dist/rpc/schema.d.ts +61 -0
  106. package/dist/rpc/server.d.ts +54 -0
  107. package/dist/sdk/index.d.ts +19 -0
  108. package/dist/sdk/index.js +53 -0
  109. package/dist/sdk/index.js.map +1 -0
  110. package/dist/session/checkpoint.d.ts +25 -0
  111. package/dist/session/store.d.ts +154 -0
  112. package/dist/session/tree.d.ts +31 -0
  113. package/dist/skills/builtin-loop.d.ts +12 -0
  114. package/dist/skills/registry.d.ts +47 -0
  115. package/dist/skills/tool.d.ts +9 -0
  116. package/dist/sleep/organizer.d.ts +37 -0
  117. package/dist/tools/ask-user-question.d.ts +49 -0
  118. package/dist/tools/file-diff.d.ts +9 -0
  119. package/dist/tools/files.d.ts +49 -0
  120. package/dist/tools/lsp.d.ts +77 -0
  121. package/dist/tools/managed.d.ts +59 -0
  122. package/dist/tools/runtime.d.ts +58 -0
  123. package/dist/tools/search.d.ts +76 -0
  124. package/dist/tools/shell.d.ts +37 -0
  125. package/dist/tools/task-output.d.ts +53 -0
  126. package/dist/tools/todo-write.d.ts +35 -0
  127. package/dist/tools/types.d.ts +56 -0
  128. package/dist/trace/recorder.d.ts +14 -0
  129. package/dist/trace/replay.d.ts +3 -0
  130. package/dist/trace/schema.d.ts +26 -0
  131. package/dist/ui/commands.d.ts +67 -0
  132. package/dist/ui/session.d.ts +126 -0
  133. package/dist/ui/transcript.d.ts +89 -0
  134. package/dist/utils/async.d.ts +5 -0
  135. package/dist/utils/envUtils.d.ts +1 -0
  136. package/dist/utils/error.d.ts +2 -0
  137. package/dist/utils/execFileNoThrow.d.ts +13 -0
  138. package/dist/utils/intl.d.ts +18 -0
  139. package/dist/utils/json.d.ts +44 -0
  140. package/dist/utils/log.d.ts +28 -0
  141. package/dist/utils/redact.d.ts +10 -0
  142. package/dist/utils/usage-summary.d.ts +34 -0
  143. package/dist/utils/version.d.ts +6 -0
  144. package/package.json +124 -0
  145. package//346/212/200/346/234/257/346/226/271/346/241/210/346/212/245/345/221/212.md +4797 -0
@@ -0,0 +1,49 @@
1
+ export interface ConfidenceScores {
2
+ taskAlignment: number;
3
+ evidenceGrounding: number;
4
+ processReliability: number;
5
+ }
6
+ export type HallucinationEvaluationStatus = "completed" | "timeout" | "unavailable" | "skipped";
7
+ export interface ConfidenceResult {
8
+ confidence: number;
9
+ reason: string;
10
+ scores?: ConfidenceScores;
11
+ unsupportedClaims?: string[];
12
+ }
13
+ export interface SlidingWindowConfig {
14
+ windowSize: number;
15
+ threshold: number;
16
+ }
17
+ export declare const DEFAULT_SLIDING_WINDOW_SIZE = 20;
18
+ export declare const DEFAULT_SLIDING_WINDOW_THRESHOLD = 15;
19
+ export declare const DEFAULT_MAX_TOOL_RETRIES = 3;
20
+ export declare const DEFAULT_CONFIDENCE_THRESHOLD = 0.7;
21
+ export declare const DEFAULT_EVALUATION_TIMEOUT_MS = 2000;
22
+ export interface ToolCallRecord {
23
+ toolName: string;
24
+ params: unknown;
25
+ paramHash: string;
26
+ iteration: number;
27
+ errorCode?: string;
28
+ }
29
+ export interface RetryThresholds {
30
+ maxToolRetries: number;
31
+ }
32
+ export interface HallucinationReport {
33
+ confidence: ConfidenceResult | null;
34
+ evaluationStatus: HallucinationEvaluationStatus;
35
+ retryViolations: RetryViolation[];
36
+ circuitBreakerTripped: boolean;
37
+ circuitBreakerDetail: string | null;
38
+ passed: boolean;
39
+ /** Deterministic reasons that may block engineering-loop completion. */
40
+ blockingReasons: string[];
41
+ /** Human-readable warning messages already localized to the configured language. */
42
+ warnings: string[];
43
+ }
44
+ export interface RetryViolation {
45
+ toolName: string;
46
+ retryCount: number;
47
+ maxRetries: number;
48
+ lastErrorCode: string | null;
49
+ }
@@ -0,0 +1,54 @@
1
+ import { AgentLoop } from "../agent/loop.js";
2
+ import type { TaskNode } from "../agent/planner.js";
3
+ import type { HallucinationGuard } from "../hallucination/guard.js";
4
+ import type { PermissionMode } from "../permissions/engine.js";
5
+ import type { ContextManager } from "../context/manager.js";
6
+ import type { HookBus } from "../hooks/bus.js";
7
+ import type { ModelRegistry } from "../models/registry.js";
8
+ import type { ModelTool } from "../models/types.js";
9
+ import { ToolRuntime, type ApprovalCallback } from "../tools/runtime.js";
10
+ import type { ToolDefinition } from "../tools/types.js";
11
+ export interface LocalHarnessOptions {
12
+ registry: ModelRegistry;
13
+ hooks: HookBus;
14
+ workspace: string;
15
+ mainModelId: string;
16
+ subagentModelId: string;
17
+ tools: readonly ToolDefinition<unknown>[];
18
+ createContext(agent: "main" | "subagent", tools: readonly ToolDefinition<unknown>[], modelId: string, parentContext?: ContextManager): ContextManager;
19
+ permissionMode?: PermissionMode;
20
+ approve?: ApprovalCallback;
21
+ maxIterationsMain?: number;
22
+ maxIterationsSubagent?: number;
23
+ hasActiveProgress?(): boolean;
24
+ hallucinationGuard?: HallucinationGuard;
25
+ /** When true, non-destructive tools skip the approval callback. Destructive tools still require confirmation. */
26
+ loopMode?: boolean;
27
+ }
28
+ export interface HarnessProfile {
29
+ modelId: string;
30
+ context: ContextManager;
31
+ runtime: ToolRuntime;
32
+ tools: readonly ModelTool[];
33
+ loop: AgentLoop;
34
+ }
35
+ export interface SubagentHarness extends HarnessProfile {
36
+ task: TaskNode;
37
+ dispose(): void;
38
+ [Symbol.asyncDispose](): Promise<void>;
39
+ }
40
+ export declare class LocalHarness {
41
+ #private;
42
+ readonly main: HarnessProfile;
43
+ constructor(options: LocalHarnessOptions);
44
+ get mainModelId(): string;
45
+ get subagentModelId(): string;
46
+ get permissionMode(): PermissionMode;
47
+ setModel(role: "main" | "subagent", modelId: string): void;
48
+ setPermissionMode(mode: PermissionMode): void;
49
+ replaceMainTools(definitions: readonly ToolDefinition<unknown>[]): void;
50
+ createSubagent(task: TaskNode, parentContext?: ContextManager): SubagentHarness;
51
+ runSubagent<T>(task: TaskNode, execute: (harness: SubagentHarness, signal: AbortSignal) => Promise<T>, signal?: AbortSignal, parentContext?: ContextManager): Promise<T>;
52
+ dispose(): void;
53
+ [Symbol.asyncDispose](): Promise<void>;
54
+ }
@@ -0,0 +1,9 @@
1
+ import type { z } from "zod";
2
+ import { type HookDecision, type HookEvent, type HookEventName, type HookHandler, type HookHandlerOptions, type ShellHookHandler } from "./types.js";
3
+ export declare class HookBus {
4
+ #private;
5
+ registerPayloadSchema(type: HookEventName, schema: z.ZodType<Record<string, unknown>>): () => void;
6
+ on(type: HookEventName, handler: HookHandler | ShellHookHandler, options?: HookHandlerOptions): () => void;
7
+ hasListeners(type: HookEventName): boolean;
8
+ emit(rawEvent: HookEvent, externalSignal?: AbortSignal): Promise<HookDecision>;
9
+ }
@@ -0,0 +1,105 @@
1
+ import { z } from "zod";
2
+ export declare const HOOK_EVENT_NAMES: readonly ["SessionStart", "UserPromptSubmit", "Stop", "SessionEnd", "BeforePlan", "AfterPlan", "SubagentStart", "SubagentStop", "BeforeModelCall", "AfterModelCall", "PreToolUse", "PermissionRequest", "PostToolUse", "PostToolUseFailure", "PreCompact", "PostCompact", "PluginLoad", "PluginUnload", "Notification"];
3
+ export declare const HookEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
4
+ version: z.ZodLiteral<1>;
5
+ type: z.ZodLiteral<"SessionStart">;
6
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
7
+ }, z.core.$strip>, z.ZodObject<{
8
+ version: z.ZodLiteral<1>;
9
+ type: z.ZodLiteral<"UserPromptSubmit">;
10
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
11
+ }, z.core.$strip>, z.ZodObject<{
12
+ version: z.ZodLiteral<1>;
13
+ type: z.ZodLiteral<"Stop">;
14
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
15
+ }, z.core.$strip>, z.ZodObject<{
16
+ version: z.ZodLiteral<1>;
17
+ type: z.ZodLiteral<"SessionEnd">;
18
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
19
+ }, z.core.$strip>, z.ZodObject<{
20
+ version: z.ZodLiteral<1>;
21
+ type: z.ZodLiteral<"BeforePlan">;
22
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
23
+ }, z.core.$strip>, z.ZodObject<{
24
+ version: z.ZodLiteral<1>;
25
+ type: z.ZodLiteral<"AfterPlan">;
26
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
27
+ }, z.core.$strip>, z.ZodObject<{
28
+ version: z.ZodLiteral<1>;
29
+ type: z.ZodLiteral<"SubagentStart">;
30
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
31
+ }, z.core.$strip>, z.ZodObject<{
32
+ version: z.ZodLiteral<1>;
33
+ type: z.ZodLiteral<"SubagentStop">;
34
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
35
+ }, z.core.$strip>, z.ZodObject<{
36
+ version: z.ZodLiteral<1>;
37
+ type: z.ZodLiteral<"BeforeModelCall">;
38
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
39
+ }, z.core.$strip>, z.ZodObject<{
40
+ version: z.ZodLiteral<1>;
41
+ type: z.ZodLiteral<"AfterModelCall">;
42
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
43
+ }, z.core.$strip>, z.ZodObject<{
44
+ version: z.ZodLiteral<1>;
45
+ type: z.ZodLiteral<"PreToolUse">;
46
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
47
+ }, z.core.$strip>, z.ZodObject<{
48
+ version: z.ZodLiteral<1>;
49
+ type: z.ZodLiteral<"PermissionRequest">;
50
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
51
+ }, z.core.$strip>, z.ZodObject<{
52
+ version: z.ZodLiteral<1>;
53
+ type: z.ZodLiteral<"PostToolUse">;
54
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
55
+ }, z.core.$strip>, z.ZodObject<{
56
+ version: z.ZodLiteral<1>;
57
+ type: z.ZodLiteral<"PostToolUseFailure">;
58
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
59
+ }, z.core.$strip>, z.ZodObject<{
60
+ version: z.ZodLiteral<1>;
61
+ type: z.ZodLiteral<"PreCompact">;
62
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
63
+ }, z.core.$strip>, z.ZodObject<{
64
+ version: z.ZodLiteral<1>;
65
+ type: z.ZodLiteral<"PostCompact">;
66
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
67
+ }, z.core.$strip>, z.ZodObject<{
68
+ version: z.ZodLiteral<1>;
69
+ type: z.ZodLiteral<"PluginLoad">;
70
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
71
+ }, z.core.$strip>, z.ZodObject<{
72
+ version: z.ZodLiteral<1>;
73
+ type: z.ZodLiteral<"PluginUnload">;
74
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
75
+ }, z.core.$strip>, z.ZodObject<{
76
+ version: z.ZodLiteral<1>;
77
+ type: z.ZodLiteral<"Notification">;
78
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
79
+ }, z.core.$strip>], "type">;
80
+ export declare const HookDecisionSchema: z.ZodObject<{
81
+ decision: z.ZodEnum<{
82
+ allow: "allow";
83
+ ask: "ask";
84
+ deny: "deny";
85
+ }>;
86
+ reason: z.ZodOptional<z.ZodString>;
87
+ updatedInput: z.ZodOptional<z.ZodUnknown>;
88
+ additionalContext: z.ZodOptional<z.ZodString>;
89
+ }, z.core.$strip>;
90
+ export type HookEvent = z.infer<typeof HookEventSchema>;
91
+ export type HookEventName = (typeof HOOK_EVENT_NAMES)[number];
92
+ export type HookDecision = z.infer<typeof HookDecisionSchema>;
93
+ export type HookHandler = (event: HookEvent, signal: AbortSignal) => HookDecision | Promise<HookDecision>;
94
+ export interface ShellHookHandler {
95
+ command: string;
96
+ args?: readonly string[];
97
+ timeoutMs?: number;
98
+ failurePolicy?: "error" | "allow" | "deny" | "ask";
99
+ env?: Readonly<Record<string, string>>;
100
+ maxOutputBytes?: number;
101
+ }
102
+ export interface HookHandlerOptions {
103
+ timeoutMs?: number;
104
+ failurePolicy?: "error" | "allow" | "deny" | "ask";
105
+ }
@@ -0,0 +1,35 @@
1
+ export interface IdePosition {
2
+ line: number;
3
+ character: number;
4
+ }
5
+ export interface IdeEditorContext {
6
+ ideName: string;
7
+ workspaceFolders: string[];
8
+ filePath?: string;
9
+ languageId?: string;
10
+ dirty?: boolean;
11
+ selection: {
12
+ start: IdePosition;
13
+ end: IdePosition;
14
+ active: IdePosition;
15
+ isEmpty: boolean;
16
+ };
17
+ selectedText?: string;
18
+ }
19
+ export interface FlavorIdeClientOptions {
20
+ workspace: string;
21
+ home: string;
22
+ environment?: NodeJS.ProcessEnv;
23
+ fetch?: typeof fetch;
24
+ }
25
+ export declare class FlavorIdeClient {
26
+ #private;
27
+ constructor(options: FlavorIdeClientOptions);
28
+ initialize(): Promise<void>;
29
+ status(): Promise<string>;
30
+ editorContext(): Promise<IdeEditorContext | undefined>;
31
+ promptContext(): Promise<string | undefined>;
32
+ startSession(sessionId: string): Promise<void>;
33
+ publishEvent(sessionId: string, event: unknown): void;
34
+ endSession(sessionId?: string | undefined): Promise<void>;
35
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * IncidentReporter — bridges flavor-code tool failures to the langgraph-claw
3
+ * RCA alert pipeline via the AlertManager webhook endpoint.
4
+ *
5
+ * Architecture:
6
+ * flavor-code tool failure
7
+ * │
8
+ * ▼
9
+ * PostToolUseFailure hook (ToolRuntime)
10
+ * │
11
+ * ▼
12
+ * IncidentReporter.collect() → POST /api/otel/alerts → langgraph-claw
13
+ * │
14
+ * ▼
15
+ * P0: auto-RCA via agent harness → code-rca skill
16
+ * P1: stored + SSE broadcast → manual analysis
17
+ *
18
+ * Env vars:
19
+ * FLAVOR_INCIDENT_WEBHOOK_URL — langgraph-claw base URL (default: http://localhost:8000)
20
+ * FLAVOR_INCIDENT_ENABLED — "true" to enable reporting (default: false)
21
+ */
22
+ import type { HookHandler } from "../hooks/types.js";
23
+ export interface IncidentReporterOptions {
24
+ /** Base URL of the langgraph-claw server. */
25
+ webhookUrl?: string;
26
+ /** When false the reporter is a no-op. */
27
+ enabled?: boolean;
28
+ /** Absolute workspace path for git context and alert metadata. */
29
+ workspace: string;
30
+ }
31
+ /**
32
+ * Create a ``PostToolUseFailure`` hook handler that reports tool failures to
33
+ * langgraph-claw as AlertManager-compatible webhook alerts.
34
+ *
35
+ * The handler always returns ``{ decision: "allow" }`` — it is a pure observer
36
+ * and does not alter the tool execution pipeline.
37
+ */
38
+ export declare function createIncidentReporter(options: IncidentReporterOptions): HookHandler;
@@ -0,0 +1,25 @@
1
+ export interface ProjectFacts {
2
+ cwd: string;
3
+ projectName: string;
4
+ languages: string[];
5
+ packageManager?: string;
6
+ packageManagers: string[];
7
+ scripts: Record<string, string>;
8
+ buildCommands: string[];
9
+ testCommands: string[];
10
+ lintCommands: string[];
11
+ formatCommands: string[];
12
+ sourceDirectories: string[];
13
+ instructionFiles: string[];
14
+ configFiles: string[];
15
+ gitignorePath?: string;
16
+ cautions: string[];
17
+ }
18
+ export interface InitResult {
19
+ path: string;
20
+ created: boolean;
21
+ content: string;
22
+ facts: ProjectFacts;
23
+ }
24
+ export declare function inspectProject(cwd: string): Promise<ProjectFacts>;
25
+ export declare function initializeFlavor(cwd: string): Promise<InitResult>;
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
3
+ import {
4
+ loadConfig,
5
+ redactConfig,
6
+ setGlobalProviderConfig,
7
+ setProjectMcpServerDisabled,
8
+ setProjectProviderConfig,
9
+ setProjectSkillDisabled
10
+ } from "./chunk-MVIMQEQT.js";
11
+ import "./chunk-JZ322RCJ.js";
12
+ export {
13
+ loadConfig,
14
+ redactConfig,
15
+ setGlobalProviderConfig,
16
+ setProjectMcpServerDisabled,
17
+ setProjectProviderConfig,
18
+ setProjectSkillDisabled
19
+ };
20
+ //# sourceMappingURL=load-WQGNTCHC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,11 @@
1
+ import { type LoopState } from "./types.js";
2
+ export type BudgetDimension = "cycles" | "tokens";
3
+ export type BudgetDecision = {
4
+ kind: "allow";
5
+ } | {
6
+ kind: "confirm";
7
+ dimensions: BudgetDimension[];
8
+ };
9
+ export declare function budgetDecision(input: LoopState): BudgetDecision;
10
+ export declare function extendBudget(input: LoopState, dimensions: readonly BudgetDimension[], approvedAt: string): LoopState;
11
+ export declare function rejectBudget(input: LoopState, terminalReason: string): LoopState;
@@ -0,0 +1,21 @@
1
+ export type GoalIntent = "read_only" | "code_change" | "ambiguous";
2
+ export interface LoopWorkspace {
3
+ root: string;
4
+ mode: "current" | "worktree";
5
+ branch?: string;
6
+ }
7
+ export type LoopWorkspaceResolution = {
8
+ kind: "ready";
9
+ workspace: LoopWorkspace;
10
+ } | {
11
+ kind: "needs_human";
12
+ reason: string;
13
+ };
14
+ export interface PrepareLoopWorkspaceOptions {
15
+ root: string;
16
+ loopId: string;
17
+ goal: string;
18
+ signal?: AbortSignal;
19
+ }
20
+ export declare function inferGoalIntent(goal: string): GoalIntent;
21
+ export declare function prepareLoopWorkspace(options: PrepareLoopWorkspaceOptions): Promise<LoopWorkspaceResolution>;
@@ -0,0 +1,82 @@
1
+ import type { AgentEvent } from "../agent/types.js";
2
+ import { type BudgetDimension } from "./budget.js";
3
+ import type { HallucinationGuard } from "../hallucination/guard.js";
4
+ import type { LoopWorkspaceResolution } from "./isolation.js";
5
+ import { type LoopEvent, type LoopState, type LoopStatus, type LoopVerificationEvidence } from "./types.js";
6
+ import type { VerificationPlan } from "./verifier.js";
7
+ export interface LoopPersistence {
8
+ create(state: LoopState): Promise<void>;
9
+ save(state: LoopState): Promise<void>;
10
+ append(event: LoopEvent): Promise<void>;
11
+ }
12
+ export type LoopConfirmation = "approved" | "rejected" | "unavailable";
13
+ export type LoopRuntimeEvent = {
14
+ type: "loop-resolved";
15
+ loopId: string;
16
+ workspace: string;
17
+ isolation: "current" | "worktree";
18
+ verifierCommands: string[];
19
+ cycleCheckpoint: number;
20
+ tokenCheckpoint: number;
21
+ } | {
22
+ type: "loop-cycle-start";
23
+ loopId: string;
24
+ cycle: number;
25
+ } | {
26
+ type: "worker-event";
27
+ event: AgentEvent;
28
+ } | {
29
+ type: "loop-verification";
30
+ loopId: string;
31
+ cycle: number;
32
+ evidence: LoopVerificationEvidence;
33
+ } | {
34
+ type: "loop-budget";
35
+ loopId: string;
36
+ dimensions: BudgetDimension[];
37
+ cycleCheckpoint: number;
38
+ tokenCheckpoint: number;
39
+ } | {
40
+ type: "loop-terminal";
41
+ loopId: string;
42
+ status: Exclude<LoopStatus, "running">;
43
+ reason: string;
44
+ };
45
+ export interface LoopOrchestratorOptions {
46
+ workspace: string;
47
+ config: {
48
+ maxCycles: number;
49
+ maxTokens: number;
50
+ isolation: "auto";
51
+ };
52
+ persistence: LoopPersistence;
53
+ prepareWorkspace(input: {
54
+ root: string;
55
+ loopId: string;
56
+ goal: string;
57
+ signal: AbortSignal;
58
+ }): Promise<LoopWorkspaceResolution>;
59
+ inferVerification(workspace: string): Promise<VerificationPlan>;
60
+ runWorker(input: {
61
+ goal: string;
62
+ cycle: number;
63
+ workspace: string;
64
+ prompt: string;
65
+ signal: AbortSignal;
66
+ }): AsyncIterable<AgentEvent>;
67
+ runVerifier(plan: VerificationPlan, workspace: string, signal: AbortSignal): Promise<LoopVerificationEvidence>;
68
+ confirmBudget(state: LoopState, dimensions: readonly BudgetDimension[], signal: AbortSignal): Promise<LoopConfirmation>;
69
+ fingerprint(workspace: string): Promise<string>;
70
+ /** Optional hallucination guard for confidence checks and retry monitoring. */
71
+ hallucinationGuard?: HallucinationGuard;
72
+ now?(): string;
73
+ idFactory?(): string;
74
+ }
75
+ export declare class LoopOrchestrator {
76
+ #private;
77
+ constructor(options: LoopOrchestratorOptions);
78
+ run(request: {
79
+ goal: string;
80
+ signal: AbortSignal;
81
+ }): AsyncIterable<LoopRuntimeEvent>;
82
+ }
@@ -0,0 +1,13 @@
1
+ import { type LoopEvent, type LoopState } from "./types.js";
2
+ export interface LoopStoreOptions {
3
+ workspace: string;
4
+ maxBytes?: number;
5
+ }
6
+ export declare class LoopStore {
7
+ #private;
8
+ constructor(options: LoopStoreOptions);
9
+ create(state: LoopState): Promise<void>;
10
+ save(input: LoopState): Promise<void>;
11
+ load(loopId: string): Promise<LoopState>;
12
+ append(input: LoopEvent): Promise<void>;
13
+ }
@@ -0,0 +1,142 @@
1
+ import { z } from "zod";
2
+ export declare const LoopStatusSchema: z.ZodEnum<{
3
+ blocked: "blocked";
4
+ budget_exhausted: "budget_exhausted";
5
+ cancelled: "cancelled";
6
+ failed: "failed";
7
+ needs_human: "needs_human";
8
+ no_progress: "no_progress";
9
+ running: "running";
10
+ succeeded: "succeeded";
11
+ }>;
12
+ export declare const LoopApprovalSchema: z.ZodObject<{
13
+ dimension: z.ZodEnum<{
14
+ cycles: "cycles";
15
+ tokens: "tokens";
16
+ }>;
17
+ previousCheckpoint: z.ZodNumber;
18
+ newCheckpoint: z.ZodNumber;
19
+ usage: z.ZodNumber;
20
+ approvedAt: z.ZodString;
21
+ }, z.core.$strict>;
22
+ export declare const LoopVerificationCommandSchema: z.ZodObject<{
23
+ command: z.ZodString;
24
+ args: z.ZodArray<z.ZodString>;
25
+ exitCode: z.ZodNullable<z.ZodNumber>;
26
+ stdout: z.ZodString;
27
+ stderr: z.ZodString;
28
+ truncated: z.ZodBoolean;
29
+ }, z.core.$strict>;
30
+ export declare const LoopVerificationEvidenceSchema: z.ZodObject<{
31
+ passed: z.ZodBoolean;
32
+ commands: z.ZodArray<z.ZodObject<{
33
+ command: z.ZodString;
34
+ args: z.ZodArray<z.ZodString>;
35
+ exitCode: z.ZodNullable<z.ZodNumber>;
36
+ stdout: z.ZodString;
37
+ stderr: z.ZodString;
38
+ truncated: z.ZodBoolean;
39
+ }, z.core.$strict>>;
40
+ summary: z.ZodString;
41
+ }, z.core.$strict>;
42
+ export declare const LoopCycleEvidenceSchema: z.ZodObject<{
43
+ cycle: z.ZodNumber;
44
+ startedAt: z.ZodString;
45
+ completedAt: z.ZodString;
46
+ inputTokens: z.ZodNumber;
47
+ outputTokens: z.ZodNumber;
48
+ workspaceFingerprint: z.ZodString;
49
+ verification: z.ZodObject<{
50
+ passed: z.ZodBoolean;
51
+ commands: z.ZodArray<z.ZodObject<{
52
+ command: z.ZodString;
53
+ args: z.ZodArray<z.ZodString>;
54
+ exitCode: z.ZodNullable<z.ZodNumber>;
55
+ stdout: z.ZodString;
56
+ stderr: z.ZodString;
57
+ truncated: z.ZodBoolean;
58
+ }, z.core.$strict>>;
59
+ summary: z.ZodString;
60
+ }, z.core.$strict>;
61
+ }, z.core.$strict>;
62
+ export declare const LoopStateSchema: z.ZodObject<{
63
+ version: z.ZodLiteral<1>;
64
+ loopId: z.ZodString;
65
+ goal: z.ZodString;
66
+ workspace: z.ZodString;
67
+ createdAt: z.ZodString;
68
+ updatedAt: z.ZodString;
69
+ status: z.ZodEnum<{
70
+ blocked: "blocked";
71
+ budget_exhausted: "budget_exhausted";
72
+ cancelled: "cancelled";
73
+ failed: "failed";
74
+ needs_human: "needs_human";
75
+ no_progress: "no_progress";
76
+ running: "running";
77
+ succeeded: "succeeded";
78
+ }>;
79
+ config: z.ZodObject<{
80
+ cycleStep: z.ZodNumber;
81
+ tokenStep: z.ZodNumber;
82
+ isolation: z.ZodLiteral<"auto">;
83
+ }, z.core.$strict>;
84
+ budget: z.ZodObject<{
85
+ cyclesUsed: z.ZodNumber;
86
+ inputTokens: z.ZodNumber;
87
+ outputTokens: z.ZodNumber;
88
+ cycleCheckpoint: z.ZodNumber;
89
+ tokenCheckpoint: z.ZodNumber;
90
+ approvals: z.ZodArray<z.ZodObject<{
91
+ dimension: z.ZodEnum<{
92
+ cycles: "cycles";
93
+ tokens: "tokens";
94
+ }>;
95
+ previousCheckpoint: z.ZodNumber;
96
+ newCheckpoint: z.ZodNumber;
97
+ usage: z.ZodNumber;
98
+ approvedAt: z.ZodString;
99
+ }, z.core.$strict>>;
100
+ }, z.core.$strict>;
101
+ cycles: z.ZodArray<z.ZodObject<{
102
+ cycle: z.ZodNumber;
103
+ startedAt: z.ZodString;
104
+ completedAt: z.ZodString;
105
+ inputTokens: z.ZodNumber;
106
+ outputTokens: z.ZodNumber;
107
+ workspaceFingerprint: z.ZodString;
108
+ verification: z.ZodObject<{
109
+ passed: z.ZodBoolean;
110
+ commands: z.ZodArray<z.ZodObject<{
111
+ command: z.ZodString;
112
+ args: z.ZodArray<z.ZodString>;
113
+ exitCode: z.ZodNullable<z.ZodNumber>;
114
+ stdout: z.ZodString;
115
+ stderr: z.ZodString;
116
+ truncated: z.ZodBoolean;
117
+ }, z.core.$strict>>;
118
+ summary: z.ZodString;
119
+ }, z.core.$strict>;
120
+ }, z.core.$strict>>;
121
+ terminalReason: z.ZodOptional<z.ZodString>;
122
+ }, z.core.$strict>;
123
+ export declare const LoopEventSchema: z.ZodObject<{
124
+ version: z.ZodLiteral<1>;
125
+ type: z.ZodEnum<{
126
+ budget_approved: "budget_approved";
127
+ created: "created";
128
+ cycle_completed: "cycle_completed";
129
+ cycle_started: "cycle_started";
130
+ terminal: "terminal";
131
+ verification: "verification";
132
+ }>;
133
+ timestamp: z.ZodString;
134
+ loopId: z.ZodString;
135
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
136
+ }, z.core.$strict>;
137
+ export type LoopStatus = z.infer<typeof LoopStatusSchema>;
138
+ export type LoopApproval = z.infer<typeof LoopApprovalSchema>;
139
+ export type LoopVerificationEvidence = z.infer<typeof LoopVerificationEvidenceSchema>;
140
+ export type LoopCycleEvidence = z.infer<typeof LoopCycleEvidenceSchema>;
141
+ export type LoopState = z.infer<typeof LoopStateSchema>;
142
+ export type LoopEvent = z.infer<typeof LoopEventSchema>;
@@ -0,0 +1,13 @@
1
+ import type { ExecutionEnvironment } from "../execution/types.js";
2
+ import type { LoopVerificationEvidence } from "./types.js";
3
+ export interface VerificationCommand {
4
+ label: string;
5
+ command: string;
6
+ args: string[];
7
+ }
8
+ export interface VerificationPlan {
9
+ commands: VerificationCommand[];
10
+ needsHumanReason?: string;
11
+ }
12
+ export declare function inferVerificationPlan(workspace: string): Promise<VerificationPlan>;
13
+ export declare function runVerificationPlan(plan: VerificationPlan, workspace: string, signal: AbortSignal, executionEnvironment?: ExecutionEnvironment): Promise<LoopVerificationEvidence>;