opencastle 1.6.3 → 1.6.4
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 +9 -9
- package/bin/cli.mjs +6 -4
- package/dist/cli/adapters/adapter-contract.test.js +1 -1
- package/dist/cli/adapters/single-file-base.d.ts.map +1 -1
- package/dist/cli/adapters/single-file-base.js +2 -12
- package/dist/cli/adapters/single-file-base.js.map +1 -1
- package/dist/cli/bootstrap.js +1 -1
- package/dist/cli/bootstrap.js.map +1 -1
- package/dist/cli/command-namespace.test.js +4 -21
- package/dist/cli/command-namespace.test.js.map +1 -1
- package/dist/cli/convoy/engine.js +2 -2
- package/dist/cli/convoy/engine.js.map +1 -1
- package/dist/cli/convoy/read-model.d.ts +8 -15
- package/dist/cli/convoy/read-model.d.ts.map +1 -1
- package/dist/cli/convoy/read-model.js +9 -68
- package/dist/cli/convoy/read-model.js.map +1 -1
- package/dist/cli/convoy/read-model.test.js +6 -25
- package/dist/cli/convoy/read-model.test.js.map +1 -1
- package/dist/cli/convoy/spec-builder.d.ts +2 -2
- package/dist/cli/convoy/spec-builder.d.ts.map +1 -1
- package/dist/cli/convoy/spec-builder.js +1 -1
- package/dist/cli/dashboard.js +1 -1
- package/dist/cli/dashboard.test.js +10 -2
- package/dist/cli/dashboard.test.js.map +1 -1
- package/dist/cli/dispatcher.test.js +5 -2
- package/dist/cli/dispatcher.test.js.map +1 -1
- package/dist/cli/docs-accuracy.test.js +5 -1
- package/dist/cli/docs-accuracy.test.js.map +1 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +0 -25
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/pipeline.d.ts +1 -1
- package/dist/cli/pipeline.flow.test.js +77 -77
- package/dist/cli/pipeline.flow.test.js.map +1 -1
- package/dist/cli/pipeline.js +24 -24
- package/dist/cli/pipeline.js.map +1 -1
- package/dist/cli/plan.d.ts +8 -2
- package/dist/cli/plan.d.ts.map +1 -1
- package/dist/cli/plan.js +18 -12
- package/dist/cli/plan.js.map +1 -1
- package/dist/cli/plan.test.js +17 -19
- package/dist/cli/plan.test.js.map +1 -1
- package/dist/cli/update.d.ts.map +1 -1
- package/dist/cli/update.js +1 -58
- package/dist/cli/update.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/adapters/adapter-contract.test.ts +1 -1
- package/src/cli/adapters/single-file-base.ts +2 -11
- package/src/cli/bootstrap.ts +1 -1
- package/src/cli/command-namespace.test.ts +5 -22
- package/src/cli/convoy/engine.ts +2 -2
- package/src/{orchestrator/prompts/assess-complexity.prompt.md → cli/convoy/prompts/convoy-assess.prompt.md} +0 -3
- package/src/{orchestrator/prompts/fix-convoy.prompt.md → cli/convoy/prompts/convoy-plan-fix.prompt.md} +0 -3
- package/src/{orchestrator/prompts/validate-convoy.prompt.md → cli/convoy/prompts/convoy-plan-review.prompt.md} +0 -3
- package/src/{orchestrator/prompts/generate-convoy.prompt.md → cli/convoy/prompts/convoy-plan.prompt.md} +0 -2
- package/src/{orchestrator/prompts/fix-prd.prompt.md → cli/convoy/prompts/convoy-prd-fix.prompt.md} +0 -3
- package/src/{orchestrator/prompts/validate-prd.prompt.md → cli/convoy/prompts/convoy-prd-review.prompt.md} +0 -3
- package/src/{orchestrator/prompts/generate-prd.prompt.md → cli/convoy/prompts/convoy-prd.prompt.md} +0 -3
- package/src/cli/convoy/read-model.test.ts +5 -29
- package/src/cli/convoy/read-model.ts +11 -71
- package/src/cli/convoy/spec-builder.ts +2 -2
- package/src/cli/dashboard/dashboard.js +2 -4
- package/src/cli/dashboard.test.ts +10 -2
- package/src/cli/dashboard.ts +1 -1
- package/src/cli/dispatcher.test.ts +6 -2
- package/src/cli/docs-accuracy.test.ts +5 -1
- package/src/cli/doctor.ts +0 -26
- package/src/cli/pipeline.flow.test.ts +78 -78
- package/src/cli/pipeline.ts +25 -25
- package/src/cli/plan.test.ts +18 -20
- package/src/cli/plan.ts +18 -12
- package/src/cli/update.ts +1 -66
- package/src/orchestrator/agent-workflows/README.md +10 -18
- package/src/orchestrator/agent-workflows/data-pipeline.md +7 -140
- package/src/orchestrator/agent-workflows/database-migration.md +7 -153
- package/src/orchestrator/agent-workflows/performance-optimization.md +6 -119
- package/src/orchestrator/agent-workflows/refactoring.md +8 -137
- package/src/orchestrator/agent-workflows/schema-changes.md +8 -159
- package/src/orchestrator/agent-workflows/security-audit.md +7 -142
- package/src/orchestrator/agent-workflows/shared-delivery-phase.md +8 -25
- package/src/orchestrator/agents/architect.agent.md +2 -14
- package/src/orchestrator/agents/content-engineer.agent.md +8 -10
- package/src/orchestrator/agents/data-engineer.agent.md +8 -8
- package/src/orchestrator/agents/developer.agent.md +3 -10
- package/src/orchestrator/agents/devops-expert.agent.md +0 -3
- package/src/orchestrator/agents/performance-expert.agent.md +2 -3
- package/src/orchestrator/agents/security-expert.agent.md +10 -12
- package/src/orchestrator/agents/team-lead.agent.md +31 -75
- package/src/orchestrator/agents/testing-expert.agent.md +3 -6
- package/src/orchestrator/agents/ui-ux-expert.agent.md +1 -4
- package/src/orchestrator/agents/writer.agent.md +0 -3
- package/src/orchestrator/customizations/README.md +3 -4
- package/src/orchestrator/customizations/agents/agent-registry.md +3 -3
- package/src/orchestrator/customizations/agents/skill-matrix.json +6 -42
- package/src/orchestrator/instructions/general.instructions.md +10 -37
- package/src/orchestrator/prompts/bootstrap-customizations.prompt.md +4 -6
- package/src/orchestrator/prompts/brainstorm.prompt.md +7 -12
- package/src/orchestrator/prompts/bug-fix.prompt.md +19 -100
- package/src/orchestrator/prompts/convoy.prompt.md +20 -0
- package/src/orchestrator/prompts/create-skill.prompt.md +1 -5
- package/src/orchestrator/prompts/implement-feature.prompt.md +22 -93
- package/src/orchestrator/prompts/resolve-pr-comments.prompt.md +1 -5
- package/src/orchestrator/skills/api-patterns/SKILL.md +21 -18
- package/src/orchestrator/skills/deployment-infrastructure/SKILL.md +1 -1
- package/src/orchestrator/skills/fast-review/SKILL.md +28 -65
- package/src/orchestrator/skills/frontend-design/REFERENCE.md +0 -1
- package/src/orchestrator/skills/frontend-design/SKILL.md +3 -1
- package/src/orchestrator/skills/git-workflow/SKILL.md +18 -34
- package/src/orchestrator/skills/panel-majority-vote/SKILL.md +16 -46
- package/src/orchestrator/skills/security-hardening/SKILL.md +20 -19
- package/src/orchestrator/skills/self-improvement/LESSON-CATEGORIES.md +2 -2
- package/src/orchestrator/skills/self-improvement/SKILL.md +21 -46
- package/src/orchestrator/skills/technical-writing/SKILL.md +3 -1
- package/src/orchestrator/skills/technical-writing/TEMPLATES.md +23 -0
- package/src/orchestrator/skills/testing-workflow/SKILL.md +21 -23
- package/src/orchestrator/skills/validation-gates/REFERENCE.md +2 -14
- package/src/orchestrator/skills/validation-gates/SKILL.md +10 -88
- package/dist/cli/log.d.ts +0 -44
- package/dist/cli/log.d.ts.map +0 -1
- package/dist/cli/log.js +0 -336
- package/dist/cli/log.js.map +0 -1
- package/dist/cli/log.test.d.ts +0 -2
- package/dist/cli/log.test.d.ts.map +0 -1
- package/dist/cli/log.test.js +0 -208
- package/dist/cli/log.test.js.map +0 -1
- package/src/cli/log.test.ts +0 -228
- package/src/cli/log.ts +0 -374
- package/src/orchestrator/agent-workflows/bug-fix.md +0 -130
- package/src/orchestrator/agent-workflows/feature-implementation.md +0 -232
- package/src/orchestrator/instructions/ai-optimization.instructions.md +0 -17
- package/src/orchestrator/prompts/quick-refinement.prompt.md +0 -110
- package/src/orchestrator/skills/agent-hooks/HOOKS-REFERENCE.md +0 -44
- package/src/orchestrator/skills/agent-hooks/SKILL.md +0 -80
- package/src/orchestrator/skills/agent-memory/KNOWLEDGE-GRAPH.md +0 -49
- package/src/orchestrator/skills/agent-memory/SKILL.md +0 -50
- package/src/orchestrator/skills/code-commenting/SKILL.md +0 -18
- package/src/orchestrator/skills/context-map/REFERENCE.md +0 -67
- package/src/orchestrator/skills/context-map/SKILL.md +0 -71
- package/src/orchestrator/skills/decomposition/SKILL.md +0 -103
- package/src/orchestrator/skills/documentation-standards/SKILL.md +0 -33
- package/src/orchestrator/skills/fast-review/REFERENCE.md +0 -28
- package/src/orchestrator/skills/memory-merger/SKILL.md +0 -77
- package/src/orchestrator/skills/observability-logging/LOG-SCHEMA.md +0 -238
- package/src/orchestrator/skills/observability-logging/SKILL.md +0 -73
- package/src/orchestrator/skills/orchestration-protocols/REFERENCE.md +0 -38
- package/src/orchestrator/skills/orchestration-protocols/SKILL.md +0 -120
- package/src/orchestrator/skills/panel-majority-vote/REFERENCE.md +0 -49
- package/src/orchestrator/skills/panel-majority-vote/panel-report.template.md +0 -38
- package/src/orchestrator/skills/performance-optimization/SKILL.md +0 -23
- package/src/orchestrator/skills/project-consistency/SKILL.md +0 -80
- package/src/orchestrator/skills/project-consistency/TEMPLATES.md +0 -35
- package/src/orchestrator/skills/react-development/SKILL.md +0 -24
- package/src/orchestrator/skills/session-checkpoints/CHECKPOINT-TEMPLATE.md +0 -56
- package/src/orchestrator/skills/session-checkpoints/SKILL.md +0 -40
- package/src/orchestrator/skills/team-lead-reference/SKILL.md +0 -126
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
description: 'Review a convoy spec for what code cannot check: missing dependencies, missing or redundant tasks. Answers with a JSON verdict.'
|
|
3
3
|
agent: 'Reviewer'
|
|
4
4
|
output: validation
|
|
5
|
-
pipeline: true
|
|
6
5
|
---
|
|
7
6
|
|
|
8
|
-
<!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->
|
|
9
|
-
|
|
10
7
|
# Validate Task Plan
|
|
11
8
|
|
|
12
9
|
You are a senior technical reviewer. Review the convoy spec at the end of this prompt before agents run it.
|
|
@@ -4,8 +4,6 @@ agent: 'Team Lead (OpenCastle)'
|
|
|
4
4
|
output: json
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
<!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->
|
|
8
|
-
|
|
9
7
|
# Generate Task Plan
|
|
10
8
|
|
|
11
9
|
You are the Team Lead. Break the work described at the end of this prompt into tasks that agents carry out on their own, several at a time, under OpenCastle's convoy engine (experimental). Answer with a JSON task plan.
|
package/src/{orchestrator/prompts/fix-prd.prompt.md → cli/convoy/prompts/convoy-prd-fix.prompt.md}
RENAMED
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
description: 'Fix the issues a PRD review found. Goal is the PRD, context is the list of issues; answers with the whole corrected PRD.'
|
|
3
3
|
agent: 'Team Lead (OpenCastle)'
|
|
4
4
|
output: prd
|
|
5
|
-
pipeline: true
|
|
6
5
|
---
|
|
7
6
|
|
|
8
|
-
<!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->
|
|
9
|
-
|
|
10
7
|
# Fix PRD
|
|
11
8
|
|
|
12
9
|
You are the Team Lead. The PRD at the end of this prompt failed review. Fix **every reported issue** and return the complete, corrected PRD.
|
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
description: 'Check a PRD for the structure the convoy planner needs. Answers with a JSON verdict: valid, or the issues to fix.'
|
|
3
3
|
agent: 'Reviewer'
|
|
4
4
|
output: validation
|
|
5
|
-
pipeline: true
|
|
6
5
|
---
|
|
7
6
|
|
|
8
|
-
<!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->
|
|
9
|
-
|
|
10
7
|
# Validate PRD
|
|
11
8
|
|
|
12
9
|
You are a senior technical reviewer. Check the PRD at the end of this prompt before it is broken into automated agent tasks. A PRD that passes produces clean tasks; one that fails produces bad ones.
|
package/src/{orchestrator/prompts/generate-prd.prompt.md → cli/convoy/prompts/convoy-prd.prompt.md}
RENAMED
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
description: 'Write a Product Requirements Document (PRD) from a feature request. The convoy planner breaks the PRD into agent tasks.'
|
|
3
3
|
agent: 'Team Lead (OpenCastle)'
|
|
4
4
|
output: prd
|
|
5
|
-
pipeline: true
|
|
6
5
|
---
|
|
7
6
|
|
|
8
|
-
<!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->
|
|
9
|
-
|
|
10
7
|
# Generate PRD
|
|
11
8
|
|
|
12
9
|
You are the Team Lead. Turn the feature request at the end of this prompt into a Product Requirements Document (PRD) that an automated planner can break into agent tasks. Every section must be **concrete**, **specific** and **implementation-ready**.
|
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
readRunInsights,
|
|
25
25
|
readRunSpec,
|
|
26
26
|
readRuns,
|
|
27
|
-
readSessions,
|
|
28
27
|
} from './read-model.js'
|
|
29
28
|
|
|
30
29
|
let root: string
|
|
@@ -108,7 +107,7 @@ describe('with no database', () => {
|
|
|
108
107
|
expect(readRun(root, 'x')).toBeNull()
|
|
109
108
|
expect(readEventsSince(root, 'x', 0)).toEqual([])
|
|
110
109
|
expect(isRunAlive(root, 'x')).toBe(false)
|
|
111
|
-
expect(
|
|
110
|
+
expect(readAllSessions(root)).toEqual([])
|
|
112
111
|
expect(readdirSync(join(root, '.opencastle'))).toEqual([])
|
|
113
112
|
})
|
|
114
113
|
})
|
|
@@ -388,28 +387,6 @@ describe('isRunAlive', () => {
|
|
|
388
387
|
})
|
|
389
388
|
})
|
|
390
389
|
|
|
391
|
-
describe('sessions', () => {
|
|
392
|
-
it('reads session records newest first and skips everything else', () => {
|
|
393
|
-
const logs = join(root, '.opencastle', 'logs')
|
|
394
|
-
mkdirSync(logs, { recursive: true })
|
|
395
|
-
writeFileSync(
|
|
396
|
-
join(logs, 'events.ndjson'),
|
|
397
|
-
[
|
|
398
|
-
JSON.stringify({ type: 'session', timestamp: T0, agent: 'Developer', task: 'first', outcome: 'success', duration_min: 3 }),
|
|
399
|
-
'not json',
|
|
400
|
-
JSON.stringify({ type: 'review', timestamp: T1, agent: 'Developer', verdict: 'pass' }),
|
|
401
|
-
JSON.stringify({ type: 'session', timestamp: T2, agent: 'Writer', task: 'second', outcome: 'partial', model: 'm' }),
|
|
402
|
-
'',
|
|
403
|
-
].join('\n'),
|
|
404
|
-
)
|
|
405
|
-
const sessions = readSessions(root)
|
|
406
|
-
expect(sessions.map((s) => s.task)).toEqual(['second', 'first'])
|
|
407
|
-
expect(sessions[0]).toMatchObject({ agent: 'Writer', outcome: 'partial', model: 'm', duration_min: null })
|
|
408
|
-
expect(sessions[1]).toMatchObject({ duration_min: 3, model: null })
|
|
409
|
-
expect(readSessions(root, 1)).toHaveLength(1)
|
|
410
|
-
})
|
|
411
|
-
})
|
|
412
|
-
|
|
413
390
|
describe('findProjectRoot', () => {
|
|
414
391
|
it('walks up to the nearest .opencastle directory', () => {
|
|
415
392
|
const deep = join(root, 'src', 'a', 'b')
|
|
@@ -670,16 +647,15 @@ describe('run insights', () => {
|
|
|
670
647
|
})
|
|
671
648
|
})
|
|
672
649
|
|
|
673
|
-
describe('sessions
|
|
674
|
-
it('
|
|
650
|
+
describe('sessions', () => {
|
|
651
|
+
it('are the engine’s session events, newest first — a log written by hand is not read', () => {
|
|
675
652
|
seedHistory()
|
|
676
653
|
const logs = join(root, '.opencastle', 'logs')
|
|
677
654
|
mkdirSync(logs, { recursive: true })
|
|
678
655
|
writeFileSync(join(logs, 'events.ndjson'), JSON.stringify({ type: 'session', timestamp: at(D1, 45), agent: 'Developer', task: 'by hand', outcome: 'success' }) + '\n')
|
|
679
656
|
const all = readAllSessions(root)
|
|
680
|
-
expect(all.map((s) => [s.source, s.task])).toEqual([['convoy', 'b'], ['
|
|
681
|
-
expect(all[1]).toMatchObject({ convoy_id: null, agent: 'Developer' })
|
|
657
|
+
expect(all.map((s) => [s.source, s.task])).toEqual([['convoy', 'b'], ['convoy', 'a']])
|
|
682
658
|
expect(readEngineSessions(root, 'r2')).toEqual([])
|
|
683
|
-
expect(readAllSessions(root,
|
|
659
|
+
expect(readAllSessions(root, 1)).toHaveLength(1)
|
|
684
660
|
})
|
|
685
661
|
})
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* flag, cache token counts, an adapter column) reads without this file knowing
|
|
17
17
|
* about every addition first.
|
|
18
18
|
*/
|
|
19
|
-
import {
|
|
19
|
+
import { existsSync, statSync } from 'node:fs'
|
|
20
20
|
import { hostname } from 'node:os'
|
|
21
21
|
import { dirname, join, resolve } from 'node:path'
|
|
22
22
|
import { DatabaseSync } from 'node:sqlite'
|
|
@@ -133,13 +133,9 @@ export interface EventRow {
|
|
|
133
133
|
problem: boolean
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
/**
|
|
137
|
-
* A session: a `type: "session"` record appended with `opencastle log`
|
|
138
|
-
* (`source: 'log'`), or the `session` event the engine writes for each task it
|
|
139
|
-
* finishes (`source: 'convoy'`, with the run's id).
|
|
140
|
-
*/
|
|
136
|
+
/** A session: the `session` event the engine writes for each task a convoy finishes. */
|
|
141
137
|
export interface SessionRow {
|
|
142
|
-
source: '
|
|
138
|
+
source: 'convoy'
|
|
143
139
|
convoy_id: string | null
|
|
144
140
|
timestamp: string | null
|
|
145
141
|
agent: string | null
|
|
@@ -159,9 +155,9 @@ type Row = Record<string, unknown>
|
|
|
159
155
|
/**
|
|
160
156
|
* The nearest directory at or above `start` holding `.opencastle/`.
|
|
161
157
|
*
|
|
162
|
-
* The
|
|
163
|
-
*
|
|
164
|
-
*
|
|
158
|
+
* The dashboard used to read the current directory only, so started from
|
|
159
|
+
* `proj/src` it showed nothing while a run from the same place was writing to
|
|
160
|
+
* `proj/.opencastle`.
|
|
165
161
|
*/
|
|
166
162
|
export function findProjectRoot(start: string): string | null {
|
|
167
163
|
let dir = resolve(start)
|
|
@@ -663,71 +659,15 @@ export function isRunAlive(projectRoot: string, convoyId: string): boolean {
|
|
|
663
659
|
})
|
|
664
660
|
}
|
|
665
661
|
|
|
666
|
-
// ── Agent sessions
|
|
667
|
-
|
|
668
|
-
/** Read at most this much of the end of the log; sessions are shown newest first. */
|
|
669
|
-
const SESSION_LOG_TAIL_BYTES = 2 * 1024 * 1024
|
|
670
|
-
|
|
671
|
-
function readTail(path: string, bytes: number): string {
|
|
672
|
-
const fd = openSync(path, 'r')
|
|
673
|
-
try {
|
|
674
|
-
const size = fstatSync(fd).size
|
|
675
|
-
const start = Math.max(0, size - bytes)
|
|
676
|
-
const buf = Buffer.alloc(size - start)
|
|
677
|
-
readSync(fd, buf, 0, buf.length, start)
|
|
678
|
-
const text = buf.toString('utf8')
|
|
679
|
-
// Starting mid-file means the first line is a fragment.
|
|
680
|
-
return start > 0 ? text.slice(text.indexOf('\n') + 1) : text
|
|
681
|
-
} finally {
|
|
682
|
-
closeSync(fd)
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
/** Session records from `.opencastle/logs/events.ndjson`, newest first. */
|
|
687
|
-
export function readSessions(projectRoot: string, limit = 50): SessionRow[] {
|
|
688
|
-
const path = join(projectRoot, '.opencastle', 'logs', 'events.ndjson')
|
|
689
|
-
if (!existsSync(path)) return []
|
|
690
|
-
const out: SessionRow[] = []
|
|
691
|
-
const lines = readTail(path, SESSION_LOG_TAIL_BYTES).split('\n')
|
|
692
|
-
for (let i = lines.length - 1; i >= 0 && out.length < limit; i--) {
|
|
693
|
-
const line = lines[i].trim()
|
|
694
|
-
if (!line) continue
|
|
695
|
-
let rec: unknown
|
|
696
|
-
try {
|
|
697
|
-
rec = JSON.parse(line)
|
|
698
|
-
} catch {
|
|
699
|
-
continue
|
|
700
|
-
}
|
|
701
|
-
if (typeof rec !== 'object' || rec === null) continue
|
|
702
|
-
const r = rec as Row
|
|
703
|
-
if (r.type !== 'session') continue
|
|
704
|
-
out.push({
|
|
705
|
-
source: 'log',
|
|
706
|
-
convoy_id: null,
|
|
707
|
-
timestamp: str(r.timestamp),
|
|
708
|
-
agent: str(r.agent),
|
|
709
|
-
task: str(r.task),
|
|
710
|
-
tracker_issue: str(r.tracker_issue),
|
|
711
|
-
outcome: str(r.outcome),
|
|
712
|
-
model: str(r.model),
|
|
713
|
-
duration_min: num(r.duration_min),
|
|
714
|
-
files_changed: num(r.files_changed),
|
|
715
|
-
retries: num(r.retries),
|
|
716
|
-
})
|
|
717
|
-
}
|
|
718
|
-
return out
|
|
719
|
-
}
|
|
662
|
+
// ── Agent sessions ────────────────────────────────────────────────────────────
|
|
720
663
|
|
|
721
664
|
/**
|
|
722
|
-
* Agent sessions
|
|
723
|
-
*
|
|
724
|
-
*
|
|
725
|
-
* page can say which is which.
|
|
665
|
+
* Agent sessions, newest first: the engine's `session` event for each task a
|
|
666
|
+
* convoy finished. Agents outside a convoy no longer log their sessions by
|
|
667
|
+
* hand — it never happened consistently — so this is the only record.
|
|
726
668
|
*/
|
|
727
669
|
export function readAllSessions(projectRoot: string, limit = 50): SessionRow[] {
|
|
728
|
-
|
|
729
|
-
merged.sort((a, b) => String(b.timestamp ?? '').localeCompare(String(a.timestamp ?? '')))
|
|
730
|
-
return merged.slice(0, limit)
|
|
670
|
+
return readEngineSessions(projectRoot, null, limit)
|
|
731
671
|
}
|
|
732
672
|
|
|
733
673
|
/** The engine's `session` events, newest first: of one run, or of every run when `convoyId` is null. */
|
|
@@ -35,7 +35,7 @@ export interface TaskPlan {
|
|
|
35
35
|
tasks: TaskPlanTask[]
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
/** A patch to apply to a task plan — output of the fix
|
|
38
|
+
/** A patch to apply to a task plan — output of the convoy-plan-fix prompt */
|
|
39
39
|
export interface TaskPatch {
|
|
40
40
|
task_id: string // task ID to patch, or "_plan" for top-level fields
|
|
41
41
|
field: string // field name (e.g., "prompt", "files", "depends_on")
|
|
@@ -431,7 +431,7 @@ export function checkPlan(plan: TaskPlan, settings: SpecSettings): string[] {
|
|
|
431
431
|
/**
|
|
432
432
|
* Make the later of each conflicting pair wait for the earlier.
|
|
433
433
|
*
|
|
434
|
-
* The last resort, after fix
|
|
434
|
+
* The last resort, after convoy-plan-fix has had its rounds: it costs parallelism,
|
|
435
435
|
* never correctness, and it cannot create a cycle — an edge is only added
|
|
436
436
|
* between two tasks that do not yet wait for each other in either direction.
|
|
437
437
|
*/
|
|
@@ -842,9 +842,7 @@
|
|
|
842
842
|
return `<div class="table-wrap"><table class="sessions-table cards">
|
|
843
843
|
<thead><tr>${withSource ? '<th scope="col">Source</th>' : ''}<th scope="col">When</th><th scope="col">Task</th><th scope="col">Agent</th><th scope="col">Outcome</th><th scope="col" class="td-num">Minutes</th><th scope="col" class="td-num">Files</th><th scope="col" class="td-num">Retries</th><th scope="col">Model</th></tr></thead>
|
|
844
844
|
<tbody>${rows.map((s) => {
|
|
845
|
-
const src = s.
|
|
846
|
-
? `<span class="kind-badge" title="The engine's session event for a finished task">convoy run</span>${s.convoy_id ? `<span class="td-sub"><a href="#run=${encodeURIComponent(s.convoy_id)}" title="${esc(s.convoy_id)}">${esc(runName(s.convoy_id))}</a></span>` : ''}`
|
|
847
|
-
: '<span class="kind-badge" title="Appended with opencastle log">opencastle log</span>'
|
|
845
|
+
const src = `<span class="kind-badge" title="The engine's session event for a finished task">convoy run</span>${s.convoy_id ? `<span class="td-sub"><a href="#run=${encodeURIComponent(s.convoy_id)}" title="${esc(s.convoy_id)}">${esc(runName(s.convoy_id))}</a></span>` : ''}`
|
|
848
846
|
const num = (v) => (v == null ? nr() : esc(v))
|
|
849
847
|
return `<tr>
|
|
850
848
|
${withSource ? `<td data-label="Source">${src}</td>` : ''}
|
|
@@ -872,7 +870,7 @@
|
|
|
872
870
|
return
|
|
873
871
|
}
|
|
874
872
|
if (!state.sessions.length) {
|
|
875
|
-
el.innerHTML = `<div style="padding:16px 24px">${empty('table', 'No sessions recorded yet', '
|
|
873
|
+
el.innerHTML = `<div style="padding:16px 24px">${empty('table', 'No sessions recorded yet', 'A convoy run records one per task it finishes.')}</div>`
|
|
876
874
|
return
|
|
877
875
|
}
|
|
878
876
|
el.innerHTML = sessionsTable(state.sessions.slice(0, 20), true)
|
|
@@ -123,10 +123,11 @@ describe('startDashboard', () => {
|
|
|
123
123
|
|
|
124
124
|
it('serves runs with the overview, one run with its insights, events after a cursor, and sessions', async () => {
|
|
125
125
|
seed()
|
|
126
|
+
// A log an earlier release had agents write by hand: no longer read.
|
|
126
127
|
mkdirSync(join(root, '.opencastle', 'logs'), { recursive: true })
|
|
127
128
|
writeFileSync(
|
|
128
129
|
join(root, '.opencastle', 'logs', 'events.ndjson'),
|
|
129
|
-
JSON.stringify({ type: 'session', timestamp: '2026-10-
|
|
130
|
+
JSON.stringify({ type: 'session', timestamp: '2026-10-01T11:00:00.000Z', agent: 'Writer', task: 'by hand', outcome: 'success' }) + '\n',
|
|
130
131
|
)
|
|
131
132
|
const v = await dashboard()
|
|
132
133
|
|
|
@@ -155,8 +156,15 @@ describe('startDashboard', () => {
|
|
|
155
156
|
expect((rest.body.events as Array<{ type: string }>).map((e) => e.type)).toEqual(['convoy_finished'])
|
|
156
157
|
expect(rest.body.more).toBe(false)
|
|
157
158
|
|
|
159
|
+
// Recorded last, so the event pages above stay the run's own four.
|
|
160
|
+
const store = createConvoyStore(join(root, '.opencastle', 'convoy.db'))
|
|
161
|
+
store.insertEvent({
|
|
162
|
+
convoy_id: 'convoy-1', task_id: 'a', worker_id: null, type: 'session',
|
|
163
|
+
data: JSON.stringify({ agent: 'Developer', task: 'a', outcome: 'success' }), created_at: '2026-10-01T10:00:00.000Z',
|
|
164
|
+
})
|
|
165
|
+
store.close()
|
|
158
166
|
const sessions = await json(`${v.url}/api/sessions`)
|
|
159
|
-
expect(sessions.body.sessions).toMatchObject([{ source: '
|
|
167
|
+
expect(sessions.body.sessions).toMatchObject([{ source: 'convoy', convoy_id: 'convoy-1', agent: 'Developer', outcome: 'success' }])
|
|
160
168
|
})
|
|
161
169
|
|
|
162
170
|
it('answers unknown runs and paths with 404, and a bad cursor with 400', async () => {
|
package/src/cli/dashboard.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* GET /api/runs runs, newest first, the event categories, and the overview of every run
|
|
13
13
|
* GET /api/runs/:id one run with its tasks, and what its events and side tables add
|
|
14
14
|
* GET /api/runs/:id/events?since=<n> that run's events after cursor n (&limit, at most 2000)
|
|
15
|
-
* GET /api/sessions agent sessions:
|
|
15
|
+
* GET /api/sessions agent sessions: the engine's, one per task a convoy finished
|
|
16
16
|
*/
|
|
17
17
|
import { createServer } from 'node:http'
|
|
18
18
|
import type { IncomingMessage, Server, ServerResponse } from 'node:http'
|
|
@@ -66,11 +66,15 @@ describe('visible command surface', () => {
|
|
|
66
66
|
|
|
67
67
|
describe('hidden commands', () => {
|
|
68
68
|
it('keeps the agent-invoked commands reachable', () => {
|
|
69
|
-
// Generated instructions call
|
|
70
|
-
expect(HIDDEN).toContain('log')
|
|
69
|
+
// Generated instructions call it; removing it would break installs.
|
|
71
70
|
expect(HIDDEN).toContain('lesson')
|
|
72
71
|
})
|
|
73
72
|
|
|
73
|
+
it('answers log, which agents no longer call, as removed', () => {
|
|
74
|
+
expect(HIDDEN).not.toContain('log')
|
|
75
|
+
expect(source).toMatch(/\n log: null,\n/)
|
|
76
|
+
})
|
|
77
|
+
|
|
74
78
|
it('keeps update working as the previous name for sync', () => {
|
|
75
79
|
expect(HIDDEN).toContain('update')
|
|
76
80
|
expect(source).toMatch(/update: \(\) => import\('\.\.\/dist\/cli\/sync\.js'\)/)
|
|
@@ -165,7 +165,11 @@ describe('shipped content instructs only commands that exist', () => {
|
|
|
165
165
|
// "every opencastle command" is English, not a command called `command`. Keeping
|
|
166
166
|
// the fuzzy check on the fuzzy-safe corpus is the honest split; widening it would
|
|
167
167
|
// have meant a whitelist of English words, which is a worse test.
|
|
168
|
-
const instructionFiles = load(
|
|
168
|
+
const instructionFiles = load([
|
|
169
|
+
...contentFilesFor(orchestratorRoot, ['.md']),
|
|
170
|
+
// The planner's templates: not compiled, but agents read them all the same.
|
|
171
|
+
...contentFilesFor(join(repoRoot, 'src', 'cli', 'convoy', 'prompts'), ['.md']),
|
|
172
|
+
])
|
|
169
173
|
|
|
170
174
|
it('has content to check', () => {
|
|
171
175
|
expect(files.length).toBeGreaterThan(0)
|
package/src/cli/doctor.ts
CHANGED
|
@@ -287,31 +287,6 @@ export async function checkSkillMatrix(projectRoot: string): Promise<CheckResult
|
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
async function checkLogs(projectRoot: string): Promise<CheckResult> {
|
|
291
|
-
const dir = resolve(projectRoot, '.opencastle', 'logs');
|
|
292
|
-
if (!existsSync(dir)) {
|
|
293
|
-
// A local run artefact, not part of the project, so a fresh clone has none —
|
|
294
|
-
// and calling that a failure made `doctor` exit 1 on every clone. The first
|
|
295
|
-
// `opencastle log` creates it; until then "none yet" is the honest reading,
|
|
296
|
-
// and not something to warn about on every new install.
|
|
297
|
-
return {
|
|
298
|
-
ok: true,
|
|
299
|
-
label: 'Observability logs',
|
|
300
|
-
detail: 'none yet — created when an agent first logs a session',
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
// A diagnostic does not write. This used to create five empty `.ndjson` files
|
|
304
|
-
// as a side effect — files nothing on this branch reads, and exactly the ones
|
|
305
|
-
// `migrateLegacyLogs` exists to move aside.
|
|
306
|
-
const entries = existsSync(dir) ? await readdir(dir) : [];
|
|
307
|
-
const events = entries.filter((f) => f.endsWith('.ndjson'));
|
|
308
|
-
return {
|
|
309
|
-
ok: true,
|
|
310
|
-
label: 'Observability logs',
|
|
311
|
-
detail: events.length > 0 ? `${events.length} log file(s)` : 'no runs recorded yet',
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
|
|
315
290
|
async function checkMcpEnvVars(
|
|
316
291
|
projectRoot: string,
|
|
317
292
|
manifest: Manifest | null,
|
|
@@ -1013,7 +988,6 @@ export async function runSharedChecks(
|
|
|
1013
988
|
await checkCustomizations(projectRoot),
|
|
1014
989
|
await checkProjectContext(projectRoot),
|
|
1015
990
|
await checkSkillMatrix(projectRoot),
|
|
1016
|
-
await checkLogs(projectRoot),
|
|
1017
991
|
await checkMcpEnvVars(projectRoot, manifest, state),
|
|
1018
992
|
await checkDotEnv(projectRoot, manifest),
|
|
1019
993
|
await checkGitignoredOutput(projectRoot, manifest),
|