karajan-code 2.4.1 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -4
- package/package.json +5 -2
- package/src/agents/aider-agent.js +1 -2
- package/src/agents/base-agent.js +63 -1
- package/src/agents/claude-agent.js +3 -4
- package/src/agents/codex-agent.js +1 -2
- package/src/agents/gemini-agent.js +1 -2
- package/src/agents/index.js +11 -2
- package/src/agents/opencode-agent.js +1 -2
- package/src/brain/decision-tracker.js +123 -0
- package/src/brain/decisor.js +243 -0
- package/src/brain/solomon-consult.js +163 -0
- package/src/budget/comparison.js +96 -0
- package/src/checks/binaries.js +123 -0
- package/src/checks/ci.js +105 -0
- package/src/checks/config-files.js +217 -0
- package/src/checks/dir-setup.js +63 -0
- package/src/checks/mcp-health.js +157 -0
- package/src/checks/node.js +61 -0
- package/src/checks/ports.js +110 -0
- package/src/checks/rtk.js +36 -0
- package/src/checks/runner.js +267 -0
- package/src/checks/skills.js +49 -0
- package/src/checks/sonar.js +67 -0
- package/src/checks/system.js +53 -0
- package/src/checks/tokens.js +96 -0
- package/src/checks/types.js +105 -0
- package/src/cli.js +90 -7
- package/src/commands/board.js +23 -0
- package/src/commands/doctor.js +130 -362
- package/src/commands/plan.js +221 -37
- package/src/commands/resume.js +1 -1
- package/src/commands/run.js +2 -1
- package/src/commands/skills.js +49 -0
- package/src/config/schema.js +222 -0
- package/src/config.js +32 -3
- package/src/guards/policy-resolver.js +8 -0
- package/src/hu/store.js +9 -0
- package/src/infrastructure/command-runner.js +44 -0
- package/src/infrastructure/environment.js +38 -0
- package/src/infrastructure/file-system-service.js +63 -0
- package/src/infrastructure/mocks.js +182 -0
- package/src/mcp/handlers/management-handlers.js +7 -2
- package/src/mcp/tools.js +10 -3
- package/src/orchestrator/config-init.js +16 -1
- package/src/orchestrator/flow-runner.js +2085 -0
- package/src/orchestrator/pipeline-context.js +17 -0
- package/src/orchestrator/preflight-checks.js +78 -4
- package/src/orchestrator/solomon-escalation.js +21 -0
- package/src/orchestrator/stages/stage-executor.js +155 -0
- package/src/orchestrator.js +19 -1884
- package/src/plan/plan-executor.js +69 -0
- package/src/plan/plan-hu-ops.js +134 -0
- package/src/plan/plan-id.js +25 -0
- package/src/plan/plan-schema.js +139 -0
- package/src/plan/plan-store.js +58 -25
- package/src/prompts/architect.js +2 -2
- package/src/prompts/coder.js +2 -2
- package/src/prompts/prompt-resolver.js +127 -0
- package/src/prompts/reviewer.js +2 -2
- package/src/roles/architect-role.js +3 -1
- package/src/roles/base-role.js +23 -2
- package/src/roles/coder-role.js +3 -1
- package/src/roles/security-role.js +12 -0
- package/src/roles/tester-role.js +11 -0
- package/src/session/journal/decisions-writer.js +200 -0
- package/src/session/journal/iteration-logger.js +194 -0
- package/src/session/journal/summary-writer.js +176 -0
- package/src/session/journal/tree-writer.js +164 -0
- package/src/skills/semantic-detector.js +147 -0
- package/src/skills/skill-detector.js +186 -8
- package/src/skills/skill-loader.js +131 -1
- package/src/skills/skills-cache.js +128 -0
- package/src/types/agent.js +55 -0
- package/src/types/config.js +114 -0
- package/src/types/hu.js +47 -0
- package/src/types/index.js +34 -0
- package/src/types/policy.js +43 -0
- package/src/types/session.js +74 -0
- package/src/types/stage.js +68 -0
- package/src/utils/display/event-handlers.js +389 -0
- package/src/utils/display/formatters.js +132 -0
- package/src/utils/display/header.js +48 -0
- package/src/utils/display/session-summary.js +108 -0
- package/src/utils/display/solomon.js +42 -0
- package/src/utils/port-check.js +45 -0
- package/src/utils/port-occupant.js +95 -0
- package/src/utils/provider-env.js +116 -0
- package/src/utils/with-timeout.js +42 -0
- package/templates/roles/architect/anthropic.md +65 -0
- package/templates/roles/architect/default.md +63 -0
- package/templates/roles/architect/google.md +52 -0
- package/templates/roles/architect/openai.md +51 -0
- package/templates/roles/architect/opencode.md +50 -0
- package/templates/roles/coder/anthropic.md +72 -0
- package/templates/roles/coder/default.md +69 -0
- package/templates/roles/coder/google.md +78 -0
- package/templates/roles/coder/openai.md +59 -0
- package/templates/roles/coder/opencode.md +49 -0
- package/templates/roles/planner/anthropic.md +50 -0
- package/templates/roles/planner/default.md +48 -0
- package/templates/roles/planner/google.md +66 -0
- package/templates/roles/planner/openai.md +46 -0
- package/templates/roles/planner/opencode.md +53 -0
- package/templates/roles/reviewer/anthropic.md +61 -0
- package/templates/roles/reviewer/default.md +62 -0
- package/templates/roles/reviewer/google.md +63 -0
- package/templates/roles/reviewer/openai.md +57 -0
- package/templates/roles/reviewer/opencode.md +42 -0
- package/templates/roles/solomon/anthropic.md +71 -0
- package/templates/roles/solomon/default.md +83 -0
- package/templates/roles/solomon/google.md +61 -0
- package/templates/roles/solomon/openai.md +53 -0
- package/templates/roles/solomon/opencode.md +55 -0
- package/src/utils/display.js +0 -669
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Karajan configuration typedefs. Mirrors the shape produced by loadConfig()
|
|
3
|
+
* and consumed throughout the orchestrator. Optional fields are intentional
|
|
4
|
+
* — users may set them in kj.config.yml without every field being required.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {Object} RoleConfig
|
|
9
|
+
* @property {string} [provider] - claude | codex | gemini | opencode | aider | anthropic | openai | google
|
|
10
|
+
* @property {string} [model] - provider-specific model identifier
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {Object} PipelineToggle
|
|
15
|
+
* @property {boolean} [enabled]
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {Object} PipelineFlags
|
|
20
|
+
* @property {boolean} [coderEnabled]
|
|
21
|
+
* @property {boolean} [reviewerEnabled]
|
|
22
|
+
* @property {boolean} [plannerEnabled]
|
|
23
|
+
* @property {boolean} [researcherEnabled]
|
|
24
|
+
* @property {boolean} [architectEnabled]
|
|
25
|
+
* @property {boolean} [refactorerEnabled]
|
|
26
|
+
* @property {boolean} [testerEnabled]
|
|
27
|
+
* @property {boolean} [securityEnabled]
|
|
28
|
+
* @property {boolean} [impeccableEnabled]
|
|
29
|
+
* @property {boolean} [triageEnabled]
|
|
30
|
+
* @property {boolean} [discoverEnabled]
|
|
31
|
+
* @property {boolean} [huReviewerEnabled]
|
|
32
|
+
* @property {boolean} [coderRequired]
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @typedef {Object} GitConfig
|
|
37
|
+
* @property {boolean} [auto_commit]
|
|
38
|
+
* @property {boolean} [auto_push]
|
|
39
|
+
* @property {boolean} [auto_pr]
|
|
40
|
+
* @property {boolean} [auto_rebase]
|
|
41
|
+
* @property {string} [branch_prefix]
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @typedef {Object} SonarConfig
|
|
46
|
+
* @property {boolean} [enabled]
|
|
47
|
+
* @property {string} [host]
|
|
48
|
+
* @property {string} [token]
|
|
49
|
+
* @property {boolean} [external]
|
|
50
|
+
* @property {string} [enforcement_profile]
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @typedef {Object} BudgetConfig
|
|
55
|
+
* @property {Object} [pricing]
|
|
56
|
+
* @property {number} [warn_threshold_pct]
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @typedef {Object} BrainDecisorConfig
|
|
61
|
+
* @property {boolean} [enabled]
|
|
62
|
+
* @property {number} [maxDecisions]
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @typedef {Object} BrainConfig
|
|
67
|
+
* @property {boolean} [enabled]
|
|
68
|
+
* @property {string} [provider]
|
|
69
|
+
* @property {boolean} [bypass_solomon_on_correctness]
|
|
70
|
+
* @property {number} [max_consecutive_verification_failures]
|
|
71
|
+
* @property {BrainDecisorConfig} [decisor]
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @typedef {Object} SkillsConfig
|
|
76
|
+
* @property {boolean} [enabled]
|
|
77
|
+
* @property {"auto"|"regex"|"semantic"|"none"} [mode]
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @typedef {Object} PreflightConfig
|
|
82
|
+
* @property {boolean} [extended]
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Full Karajan configuration shape as resolved by loadConfig() +
|
|
87
|
+
* applyRunOverrides(). Not every field is always present; consumers should
|
|
88
|
+
* defensively read via `config.x?.y`.
|
|
89
|
+
*
|
|
90
|
+
* @typedef {Object} KarajanConfig
|
|
91
|
+
* @property {string} [coder] - legacy agent name (claude, codex, ...)
|
|
92
|
+
* @property {string} [reviewer] - legacy agent name
|
|
93
|
+
* @property {Object.<string, RoleConfig>} [roles]
|
|
94
|
+
* @property {Object.<string, PipelineToggle>} [pipeline]
|
|
95
|
+
* @property {string} [review_mode] - standard | strict | paranoid | relaxed
|
|
96
|
+
* @property {string} [review_rules] - path to review rules .md
|
|
97
|
+
* @property {number} [max_iterations]
|
|
98
|
+
* @property {number} [max_budget_usd]
|
|
99
|
+
* @property {BudgetConfig} [budget]
|
|
100
|
+
* @property {SonarConfig} [sonarqube]
|
|
101
|
+
* @property {GitConfig} [git]
|
|
102
|
+
* @property {string} [base_branch]
|
|
103
|
+
* @property {Object} [session] - timeouts etc
|
|
104
|
+
* @property {Object} [output] - log level, report dir
|
|
105
|
+
* @property {Object} [development] - methodology, require_test_changes
|
|
106
|
+
* @property {BrainConfig} [brain]
|
|
107
|
+
* @property {SkillsConfig} [skills]
|
|
108
|
+
* @property {PreflightConfig} [preflight]
|
|
109
|
+
* @property {string} [projectDir] - absolute path, set at runtime
|
|
110
|
+
* @property {string} [productContext] - runtime-loaded
|
|
111
|
+
* @property {string} [domainContext] - runtime-loaded
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
export {};
|
package/src/types/hu.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HU (Historia de Usuario) typedefs. An HU is a user story that the
|
|
3
|
+
* pipeline can decompose into, certify via hu-reviewer, then run as a
|
|
4
|
+
* sub-pipeline.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {"pending"|"planned"|"in_progress"|"done"|"rejected"|"blocked"|"failed"} HUStatus
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {Object} HUAcceptanceCriterion
|
|
13
|
+
* @property {string} [given]
|
|
14
|
+
* @property {string} [when]
|
|
15
|
+
* @property {string} [then]
|
|
16
|
+
* @property {string} [raw] - plain-text AC if not Gherkin
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @typedef {Object} HUStory
|
|
21
|
+
* @property {string} id - stable slug per batch
|
|
22
|
+
* @property {string} title
|
|
23
|
+
* @property {string} [role] - "Como ..."
|
|
24
|
+
* @property {string} [goal] - "Quiero ..."
|
|
25
|
+
* @property {string} [benefit] - "Para ..."
|
|
26
|
+
* @property {HUAcceptanceCriterion[]} [acceptanceCriteria]
|
|
27
|
+
* @property {HUStatus} [status]
|
|
28
|
+
* @property {string} [assignee]
|
|
29
|
+
* @property {string[]} [dependencies] - ids of HUs that must be done first
|
|
30
|
+
* @property {Object} [certification] - hu-reviewer verdict
|
|
31
|
+
* @property {Object} [session] - sub-pipeline session metadata when it runs
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A batch is the ordered collection of HUs produced by the auto-generator
|
|
36
|
+
* or loaded from a YAML file.
|
|
37
|
+
*
|
|
38
|
+
* @typedef {Object} HUBatch
|
|
39
|
+
* @property {string} id - typically the parent sessionId
|
|
40
|
+
* @property {string} [task] - original task text
|
|
41
|
+
* @property {HUStory[]} stories
|
|
42
|
+
* @property {string} [created_at]
|
|
43
|
+
* @property {string} [updated_at]
|
|
44
|
+
* @property {Object} [board] - HU Board metadata (port, URL)
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Central JSDoc typedef registry. Import typedefs via:
|
|
3
|
+
*
|
|
4
|
+
* /** @typedef {import("../types/index.js").KarajanConfig} KarajanConfig *\/
|
|
5
|
+
*
|
|
6
|
+
* This module re-exports every type so consumers have a single import path.
|
|
7
|
+
* The actual typedef bodies live in the focused files under src/types/.
|
|
8
|
+
*
|
|
9
|
+
* Intentionally a runtime-empty module: it only carries JSDoc annotations,
|
|
10
|
+
* nothing to execute.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {import("./config.js").KarajanConfig} KarajanConfig
|
|
15
|
+
* @typedef {import("./config.js").RoleConfig} RoleConfig
|
|
16
|
+
* @typedef {import("./config.js").PipelineFlags} PipelineFlags
|
|
17
|
+
*
|
|
18
|
+
* @typedef {import("./session.js").Session} Session
|
|
19
|
+
* @typedef {import("./session.js").Checkpoint} Checkpoint
|
|
20
|
+
*
|
|
21
|
+
* @typedef {import("./stage.js").StageContext} StageContext
|
|
22
|
+
* @typedef {import("./stage.js").StageResult} StageResult
|
|
23
|
+
*
|
|
24
|
+
* @typedef {import("./agent.js").AgentResult} AgentResult
|
|
25
|
+
* @typedef {import("./agent.js").AgentResponse} AgentResponse
|
|
26
|
+
*
|
|
27
|
+
* @typedef {import("./hu.js").HUStory} HUStory
|
|
28
|
+
* @typedef {import("./hu.js").HUBatch} HUBatch
|
|
29
|
+
*
|
|
30
|
+
* @typedef {import("./policy.js").ResolvedPolicies} ResolvedPolicies
|
|
31
|
+
* @typedef {import("./policy.js").QualityGateResult} QualityGateResult
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Policy + quality-gate typedefs. Policies are resolved once per session
|
|
3
|
+
* from config + task type; quality gates are the outputs of each gate
|
|
4
|
+
* (sonar, perf, tests, review).
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {Object} ResolvedPolicies
|
|
9
|
+
* @property {boolean} [tdd] - whether TDD is enforced
|
|
10
|
+
* @property {boolean} [sonar] - Sonar gate enabled
|
|
11
|
+
* @property {boolean} [tests] - tester gate enabled
|
|
12
|
+
* @property {boolean} [security] - security audit enabled
|
|
13
|
+
* @property {boolean} [reviewer] - reviewer gate enabled
|
|
14
|
+
* @property {boolean} [planner] - planner enabled
|
|
15
|
+
* @property {boolean} [researcher] - researcher enabled
|
|
16
|
+
* @property {boolean} [architect] - architect enabled
|
|
17
|
+
* @property {boolean} [refactorer] - refactorer enabled
|
|
18
|
+
* @property {boolean} [impeccable] - impeccable audit enabled
|
|
19
|
+
* @property {boolean} [triage] - triage enabled
|
|
20
|
+
* @property {boolean} [discover] - discover phase enabled
|
|
21
|
+
* @property {boolean} [hu_reviewer] - HU certification enabled
|
|
22
|
+
* @property {number} [reviewer_retries]
|
|
23
|
+
* @property {number} [tester_retries]
|
|
24
|
+
* @property {string} [reason] - why these policies (task type + config chain)
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Result of a quality gate evaluation — Sonar, perf, tester, reviewer, etc.
|
|
29
|
+
*
|
|
30
|
+
* @typedef {Object} QualityGateResult
|
|
31
|
+
* @property {boolean} ok - did the gate pass
|
|
32
|
+
* @property {"OK"|"FAIL"|"WARN"|"ERROR"} gateStatus
|
|
33
|
+
* @property {string} [summary]
|
|
34
|
+
* @property {Object[]} [blocking_issues] - for reviewer/security gates
|
|
35
|
+
* @property {number} [openIssues] - sonar
|
|
36
|
+
* @property {number} [issuesInitial]
|
|
37
|
+
* @property {number} [issuesFinal]
|
|
38
|
+
* @property {number} [issuesResolved]
|
|
39
|
+
* @property {string} [provider] - which agent produced the verdict (when relevant)
|
|
40
|
+
* @property {Object} [details] - gate-specific payload
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session state typedefs. The session is a mutable object that accumulates
|
|
3
|
+
* state throughout a kj run and is persisted to ~/.karajan/sessions/<id>/.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {Object} Checkpoint
|
|
8
|
+
* @property {string} [at] - ISO timestamp
|
|
9
|
+
* @property {string} [stage]
|
|
10
|
+
* @property {number} [iteration]
|
|
11
|
+
* @property {string} [conflictStage]
|
|
12
|
+
* @property {string} [ruling]
|
|
13
|
+
* @property {string} [alternativeAgent]
|
|
14
|
+
* @property {string} [waitUntil]
|
|
15
|
+
* @property {string[]} [conditions]
|
|
16
|
+
* @property {boolean} [escalate]
|
|
17
|
+
* @property {string} [error]
|
|
18
|
+
* @property {string|null} [subtask]
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @typedef {Object} SolomonRulingRecord
|
|
23
|
+
* @property {string} at - ISO timestamp
|
|
24
|
+
* @property {string} stage
|
|
25
|
+
* @property {string} trigger
|
|
26
|
+
* @property {Object} conflict
|
|
27
|
+
* @property {string} ruling - approve | approve_with_conditions | escalate_human | create_subtask | ...
|
|
28
|
+
* @property {string} [reasoning]
|
|
29
|
+
* @property {string[]} [conditions]
|
|
30
|
+
* @property {string|null} [alternativeAgent]
|
|
31
|
+
* @property {string} [result]
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @typedef {Object} BrainDecisionRecord
|
|
36
|
+
* @property {number} seq
|
|
37
|
+
* @property {string} at
|
|
38
|
+
* @property {string} intent - "<taskType>:<level>"
|
|
39
|
+
* @property {string[]} rolesOn
|
|
40
|
+
* @property {string} confidence - low | medium | high
|
|
41
|
+
* @property {string} rationale
|
|
42
|
+
* @property {string[]} appliedOverrides
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @typedef {Object} RtkSavings
|
|
47
|
+
* @property {number} [callCount]
|
|
48
|
+
* @property {number} [estimatedTokensSaved]
|
|
49
|
+
* @property {number} [savedPct]
|
|
50
|
+
* @property {number} [originalBytes]
|
|
51
|
+
* @property {number} [rtkBytes]
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @typedef {Object} Session
|
|
56
|
+
* @property {string} id - session id
|
|
57
|
+
* @property {string} task - user's task text
|
|
58
|
+
* @property {"running"|"paused"|"approved"|"rejected"|"failed"} status
|
|
59
|
+
* @property {string} created_at - ISO timestamp
|
|
60
|
+
* @property {string} updated_at
|
|
61
|
+
* @property {Checkpoint[]} [checkpoints]
|
|
62
|
+
* @property {SolomonRulingRecord[]} [solomonRulings] - KJC-TSK-0287
|
|
63
|
+
* @property {BrainDecisionRecord[]} [brainDecisions] - KJC-TSK-0322
|
|
64
|
+
* @property {string[]} [skillsRecommended] - wouldHaveUsed when openskills missing
|
|
65
|
+
* @property {string[]} [autoInstalledSkills]
|
|
66
|
+
* @property {RtkSavings} [rtk_savings]
|
|
67
|
+
* @property {string} [session_start_sha]
|
|
68
|
+
* @property {string} [_journalDir] - runtime journal path
|
|
69
|
+
* @property {string[]} [_journalIterations] - rendered iteration markdown
|
|
70
|
+
* @property {string[]} [_journalFiles]
|
|
71
|
+
* @property {Object} [budget] - final budget summary snapshot
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stage context + stage result typedefs. A StageContext is the bundle of
|
|
3
|
+
* orchestration state every stage function receives; a StageResult is what
|
|
4
|
+
* they return for downstream stages to consume.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {Object} Logger
|
|
9
|
+
* @property {(msg: string, ...rest: any[]) => void} info
|
|
10
|
+
* @property {(msg: string, ...rest: any[]) => void} warn
|
|
11
|
+
* @property {(msg: string, ...rest: any[]) => void} error
|
|
12
|
+
* @property {(msg: string, ...rest: any[]) => void} [debug]
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {Object} Emitter
|
|
17
|
+
* @property {(event: string, data?: any) => void} emit
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Shape of `eventBase` propagated to every emitted event for correlation.
|
|
22
|
+
*
|
|
23
|
+
* @typedef {Object} EventBase
|
|
24
|
+
* @property {string} sessionId
|
|
25
|
+
* @property {number} iteration
|
|
26
|
+
* @property {string|null} stage
|
|
27
|
+
* @property {number} startedAt - epoch ms
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The context every pipeline stage consumes. Most stages pick a subset with
|
|
32
|
+
* destructuring. Listed here so consumers can import a single type instead
|
|
33
|
+
* of re-declaring ad-hoc objects.
|
|
34
|
+
*
|
|
35
|
+
* @typedef {Object} StageContext
|
|
36
|
+
* @property {import("./config.js").KarajanConfig} config
|
|
37
|
+
* @property {import("./session.js").Session} session
|
|
38
|
+
* @property {Logger} logger
|
|
39
|
+
* @property {Emitter|null} emitter
|
|
40
|
+
* @property {EventBase} eventBase
|
|
41
|
+
* @property {Function} [trackBudget]
|
|
42
|
+
* @property {Function} [budgetSummary]
|
|
43
|
+
* @property {import("./config.js").PipelineFlags} [pipelineFlags]
|
|
44
|
+
* @property {Object} [coderRole] - CoderRole instance
|
|
45
|
+
* @property {Object} [reviewerRole]
|
|
46
|
+
* @property {Object} [brainCtx]
|
|
47
|
+
* @property {Function} [askQuestion]
|
|
48
|
+
* @property {Object} [stageResults] - accumulated results from prior stages
|
|
49
|
+
* @property {string} [task]
|
|
50
|
+
* @property {string|null} [pgTaskId]
|
|
51
|
+
* @property {string|null} [pgProject]
|
|
52
|
+
* @property {Object} [flags] - CLI/call-time flags
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The structured return of most stage helpers. Stages are allowed to return
|
|
57
|
+
* shape-specific additions on top of these common fields.
|
|
58
|
+
*
|
|
59
|
+
* @typedef {Object} StageResult
|
|
60
|
+
* @property {boolean} ok
|
|
61
|
+
* @property {string} [summary]
|
|
62
|
+
* @property {Object} [result] - stage-specific payload
|
|
63
|
+
* @property {string} [action] - "return" | "retry" | "continue" | "skip" | ...
|
|
64
|
+
* @property {Object} [stageResult] - alternate nested result shape used by some stages
|
|
65
|
+
* @property {string} [provider]
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
export {};
|