@telora/daemon 0.18.49 → 0.18.55
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/build-info.json +11 -3
- package/dist/completion/team-completion.d.ts.map +1 -1
- package/dist/completion/team-completion.js +32 -2
- package/dist/completion/team-completion.js.map +1 -1
- package/dist/focus-executor.d.ts +7 -2
- package/dist/focus-executor.d.ts.map +1 -1
- package/dist/focus-executor.js +20 -9
- package/dist/focus-executor.js.map +1 -1
- package/dist/focus-lifecycle.d.ts.map +1 -1
- package/dist/focus-lifecycle.js +20 -0
- package/dist/focus-lifecycle.js.map +1 -1
- package/dist/git-genesis.d.ts +100 -0
- package/dist/git-genesis.d.ts.map +1 -0
- package/dist/git-genesis.js +231 -0
- package/dist/git-genesis.js.map +1 -0
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js +28 -5
- package/dist/git.js.map +1 -1
- package/dist/output-monitor.js +5 -8
- package/dist/output-monitor.js.map +1 -1
- package/dist/prd-controller.d.ts +0 -2
- package/dist/prd-controller.d.ts.map +1 -1
- package/dist/prd-controller.js +14 -35
- package/dist/prd-controller.js.map +1 -1
- package/dist/prd-divergence.d.ts +19 -8
- package/dist/prd-divergence.d.ts.map +1 -1
- package/dist/prd-divergence.js +7 -26
- package/dist/prd-divergence.js.map +1 -1
- package/dist/prd-viability.d.ts +14 -15
- package/dist/prd-viability.d.ts.map +1 -1
- package/dist/prd-viability.js +21 -34
- package/dist/prd-viability.js.map +1 -1
- package/dist/queries/prd.d.ts +24 -2
- package/dist/queries/prd.d.ts.map +1 -1
- package/dist/queries/prd.js +17 -0
- package/dist/queries/prd.js.map +1 -1
- package/dist/queries/schemas.d.ts +28 -0
- package/dist/queries/schemas.d.ts.map +1 -1
- package/dist/queries/schemas.js +26 -0
- package/dist/queries/schemas.js.map +1 -1
- package/dist/queries/sessions.d.ts +14 -0
- package/dist/queries/sessions.d.ts.map +1 -1
- package/dist/queries/sessions.js +19 -0
- package/dist/queries/sessions.js.map +1 -1
- package/dist/queries/starter-repo.d.ts +27 -0
- package/dist/queries/starter-repo.d.ts.map +1 -0
- package/dist/queries/starter-repo.js +32 -0
- package/dist/queries/starter-repo.js.map +1 -0
- package/dist/session-lineage.d.ts +25 -0
- package/dist/session-lineage.d.ts.map +1 -1
- package/dist/session-lineage.js +23 -0
- package/dist/session-lineage.js.map +1 -1
- package/dist/session-stamp.d.ts +63 -0
- package/dist/session-stamp.d.ts.map +1 -0
- package/dist/session-stamp.js +65 -0
- package/dist/session-stamp.js.map +1 -0
- package/dist/spawner/helpers.d.ts.map +1 -1
- package/dist/spawner/helpers.js +5 -8
- package/dist/spawner/helpers.js.map +1 -1
- package/dist/supabase.d.ts +2 -2
- package/dist/supabase.d.ts.map +1 -1
- package/dist/supabase.js +1 -1
- package/dist/supabase.js.map +1 -1
- package/dist/templates/claude-md.d.ts +1 -1
- package/dist/templates/claude-md.d.ts.map +1 -1
- package/dist/templates/claude-md.js +6 -3
- package/dist/templates/claude-md.js.map +1 -1
- package/dist/types/session.d.ts +24 -0
- package/dist/types/session.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/prd-clearance-engine.d.ts +0 -121
- package/dist/prd-clearance-engine.d.ts.map +0 -1
- package/dist/prd-clearance-engine.js +0 -164
- package/dist/prd-clearance-engine.js.map +0 -1
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Starter-repo genesis: seed an EMPTY product repo from a registered, polished
|
|
3
|
+
* starter the active PRD selected, instead of scaffolding a frontend from zero
|
|
4
|
+
* (focus 80ecc233).
|
|
5
|
+
*
|
|
6
|
+
* When a product's git repo has no commits AND its active PRD carries a
|
|
7
|
+
* `starterRepoId`, the daemon clones the starter's pinned ref, squashes its
|
|
8
|
+
* working tree into a fresh INITIAL commit (starter history is NOT inherited),
|
|
9
|
+
* and records provenance (git URL + resolved sha) both as a `.telora`
|
|
10
|
+
* metadata file and in the genesis commit trailers. The PRD then runs normally
|
|
11
|
+
* against that base -- the agent starts ABOVE the UX floor.
|
|
12
|
+
*
|
|
13
|
+
* It is a strict NO-OP (returns seeded:false with a reason) when the repo
|
|
14
|
+
* already has history (greenfield guard), no active PRD selects a starter, or
|
|
15
|
+
* the selected starter cannot be resolved/cloned -- in every such case the
|
|
16
|
+
* caller falls back to the empty-initial-commit path.
|
|
17
|
+
*
|
|
18
|
+
* Private starters clone via the daemon process's inherited git credentials
|
|
19
|
+
* (ssh-agent / credential helper) -- no special handling here; `git clone`
|
|
20
|
+
* runs in the daemon's environment.
|
|
21
|
+
*
|
|
22
|
+
* All filesystem + git effects are injectable (GenesisDeps) so the path is
|
|
23
|
+
* unit-tested against a local fixture starter repo without a live backend.
|
|
24
|
+
*/
|
|
25
|
+
import { type GitResult } from './git-types.js';
|
|
26
|
+
import { type StarterRepoCoordinates } from './queries/starter-repo.js';
|
|
27
|
+
/** Why the genesis path did (or did not) seed the repo from a starter. */
|
|
28
|
+
export type GenesisReason = 'seeded' | 'repo-has-history' | 'no-starter-selected' | 'starter-not-found' | 'clone-failed' | 'commit-failed';
|
|
29
|
+
export interface GenesisResult {
|
|
30
|
+
seeded: boolean;
|
|
31
|
+
reason: GenesisReason;
|
|
32
|
+
starterRepoId?: string;
|
|
33
|
+
gitUrl?: string;
|
|
34
|
+
ref?: string;
|
|
35
|
+
resolvedSha?: string;
|
|
36
|
+
}
|
|
37
|
+
/** The narrow product-scoped config the genesis path consumes. */
|
|
38
|
+
export interface GenesisConfig {
|
|
39
|
+
repoPath: string;
|
|
40
|
+
productId: string;
|
|
41
|
+
}
|
|
42
|
+
/** A PRD shape carrying just the starter selection the genesis path reads. */
|
|
43
|
+
interface PrdStarterSelection {
|
|
44
|
+
starterRepoId: string | null;
|
|
45
|
+
}
|
|
46
|
+
/** Injectable seams so the path is testable without a live backend or network. */
|
|
47
|
+
export interface GenesisDeps {
|
|
48
|
+
hasCommits: (repoPath: string) => boolean;
|
|
49
|
+
loadActivePrds: (productId: string) => Promise<PrdStarterSelection[]>;
|
|
50
|
+
loadStarterRepo: (starterRepoId: string) => Promise<StarterRepoCoordinates | null>;
|
|
51
|
+
/** True when a starter-selecting PRD exists but is not active yet (draft). */
|
|
52
|
+
hasPendingStarterSelection: (productId: string) => Promise<boolean>;
|
|
53
|
+
runGit: (args: string[], cwd: string, options?: {
|
|
54
|
+
timeoutMs?: number;
|
|
55
|
+
}) => GitResult;
|
|
56
|
+
log: (msg: string) => void;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The placeholder initial-commit message written when an empty repo has no
|
|
60
|
+
* starter to seed from. Shared so callers can recognise the placeholder.
|
|
61
|
+
*/
|
|
62
|
+
export declare const PLACEHOLDER_COMMIT_MESSAGE = "chore: initialize repository for Telora";
|
|
63
|
+
/**
|
|
64
|
+
* Seed an empty product repo's genesis commit from the starter its active PRD
|
|
65
|
+
* selected. Returns a typed result; the caller decides the fallback.
|
|
66
|
+
*/
|
|
67
|
+
export declare function seedGenesisFromStarter(config: GenesisConfig, deps?: Partial<GenesisDeps>): Promise<GenesisResult>;
|
|
68
|
+
/** Outcome of ensuring an empty repo has its first commit. */
|
|
69
|
+
export interface InitialCommitResult {
|
|
70
|
+
/** The repo now has at least one commit (a seeded genesis or a placeholder). */
|
|
71
|
+
committed: boolean;
|
|
72
|
+
/** The commit was seeded from a starter (vs an empty placeholder). */
|
|
73
|
+
seeded: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* No commit was written ON PURPOSE: a starter-selecting PRD is pending (draft),
|
|
76
|
+
* so writing an empty placeholder would foreclose genesis. The repo is left
|
|
77
|
+
* empty so a later tick can seed it once the PRD activates.
|
|
78
|
+
*/
|
|
79
|
+
deferred: boolean;
|
|
80
|
+
/** The underlying genesis attempt result (present unless the repo already had commits). */
|
|
81
|
+
genesis?: GenesisResult;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Ensure an empty product repo has its initial commit, preferring a starter
|
|
85
|
+
* genesis. This is the single decision point both daemon startup (initGit) and
|
|
86
|
+
* the per-poll worktree-provisioning safety net share, so the
|
|
87
|
+
* defer-rather-than-foreclose rule is applied consistently (focus 80ecc233).
|
|
88
|
+
*
|
|
89
|
+
* Order:
|
|
90
|
+
* 1. Repo already has commits -> nothing to do.
|
|
91
|
+
* 2. Try to seed from the active PRD's starter.
|
|
92
|
+
* 3. No active starter, BUT a starter-selecting PRD is still draft -> DEFER:
|
|
93
|
+
* leave the repo empty (no foreclosing placeholder). The worktree-provisioning
|
|
94
|
+
* safety net re-runs this once the PRD activates and seeds the genesis then.
|
|
95
|
+
* 4. Otherwise (no starter anywhere, or the clone genuinely failed) -> write an
|
|
96
|
+
* empty placeholder commit so git operations are never wedged.
|
|
97
|
+
*/
|
|
98
|
+
export declare function ensureInitialCommit(config: GenesisConfig, deps?: Partial<GenesisDeps>): Promise<InitialCommitResult>;
|
|
99
|
+
export {};
|
|
100
|
+
//# sourceMappingURL=git-genesis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-genesis.d.ts","sourceRoot":"","sources":["../src/git-genesis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAaH,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG5D,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,2BAA2B,CAAC;AAEnC,0EAA0E;AAC1E,MAAM,MAAM,aAAa,GACrB,QAAQ,GACR,kBAAkB,GAClB,qBAAqB,GACrB,mBAAmB,GACnB,cAAc,GACd,eAAe,CAAC;AAEpB,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,aAAa,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,kEAAkE;AAClE,MAAM,WAAW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,mBAAmB,CACvC,MAAM,EAAE,aAAa,EACrB,IAAI,GAAE,OAAO,CAAC,WAAW,CAAM,GAC9B,OAAO,CAAC,mBAAmB,CAAC,CA6C9B"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Starter-repo genesis: seed an EMPTY product repo from a registered, polished
|
|
3
|
+
* starter the active PRD selected, instead of scaffolding a frontend from zero
|
|
4
|
+
* (focus 80ecc233).
|
|
5
|
+
*
|
|
6
|
+
* When a product's git repo has no commits AND its active PRD carries a
|
|
7
|
+
* `starterRepoId`, the daemon clones the starter's pinned ref, squashes its
|
|
8
|
+
* working tree into a fresh INITIAL commit (starter history is NOT inherited),
|
|
9
|
+
* and records provenance (git URL + resolved sha) both as a `.telora`
|
|
10
|
+
* metadata file and in the genesis commit trailers. The PRD then runs normally
|
|
11
|
+
* against that base -- the agent starts ABOVE the UX floor.
|
|
12
|
+
*
|
|
13
|
+
* It is a strict NO-OP (returns seeded:false with a reason) when the repo
|
|
14
|
+
* already has history (greenfield guard), no active PRD selects a starter, or
|
|
15
|
+
* the selected starter cannot be resolved/cloned -- in every such case the
|
|
16
|
+
* caller falls back to the empty-initial-commit path.
|
|
17
|
+
*
|
|
18
|
+
* Private starters clone via the daemon process's inherited git credentials
|
|
19
|
+
* (ssh-agent / credential helper) -- no special handling here; `git clone`
|
|
20
|
+
* runs in the daemon's environment.
|
|
21
|
+
*
|
|
22
|
+
* All filesystem + git effects are injectable (GenesisDeps) so the path is
|
|
23
|
+
* unit-tested against a local fixture starter repo without a live backend.
|
|
24
|
+
*/
|
|
25
|
+
import { mkdtempSync, rmSync, cpSync, writeFileSync, mkdirSync, existsSync, } from 'node:fs';
|
|
26
|
+
import { tmpdir } from 'node:os';
|
|
27
|
+
import { join, sep } from 'node:path';
|
|
28
|
+
import { runGitSync } from './git-types.js';
|
|
29
|
+
import { repoHasCommits } from './git-branch.js';
|
|
30
|
+
import { loadActivePrds, hasPendingStarterSelection } from './queries/prd.js';
|
|
31
|
+
import { loadStarterRepo, } from './queries/starter-repo.js';
|
|
32
|
+
const defaultDeps = {
|
|
33
|
+
hasCommits: repoHasCommits,
|
|
34
|
+
loadActivePrds,
|
|
35
|
+
loadStarterRepo,
|
|
36
|
+
hasPendingStarterSelection,
|
|
37
|
+
runGit: runGitSync,
|
|
38
|
+
log: (msg) => console.log(msg),
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* The placeholder initial-commit message written when an empty repo has no
|
|
42
|
+
* starter to seed from. Shared so callers can recognise the placeholder.
|
|
43
|
+
*/
|
|
44
|
+
export const PLACEHOLDER_COMMIT_MESSAGE = 'chore: initialize repository for Telora';
|
|
45
|
+
// Cloning a polished app (full clone so an arbitrary sha is reachable) can take
|
|
46
|
+
// a while; give it a generous ceiling distinct from the 60s default.
|
|
47
|
+
const CLONE_TIMEOUT_MS = 300_000;
|
|
48
|
+
/**
|
|
49
|
+
* Seed an empty product repo's genesis commit from the starter its active PRD
|
|
50
|
+
* selected. Returns a typed result; the caller decides the fallback.
|
|
51
|
+
*/
|
|
52
|
+
export async function seedGenesisFromStarter(config, deps = {}) {
|
|
53
|
+
const d = { ...defaultDeps, ...deps };
|
|
54
|
+
// Greenfield guard: only an empty repo is seeded. A repo with history is left
|
|
55
|
+
// untouched -- a starter is the INITIAL commit, never grafted onto a history.
|
|
56
|
+
if (d.hasCommits(config.repoPath)) {
|
|
57
|
+
return { seeded: false, reason: 'repo-has-history' };
|
|
58
|
+
}
|
|
59
|
+
// Resolve the starter the active PRD selected (first active PRD that carries
|
|
60
|
+
// a selection wins).
|
|
61
|
+
let starterRepoId = null;
|
|
62
|
+
try {
|
|
63
|
+
const prds = await d.loadActivePrds(config.productId);
|
|
64
|
+
starterRepoId = prds.find((p) => p.starterRepoId)?.starterRepoId ?? null;
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
d.log(`[genesis] could not load active PRDs for product ${config.productId}: ${err.message} -- skipping starter genesis`);
|
|
68
|
+
return { seeded: false, reason: 'no-starter-selected' };
|
|
69
|
+
}
|
|
70
|
+
if (!starterRepoId) {
|
|
71
|
+
d.log('[genesis] no active PRD selects a starter -- using empty genesis');
|
|
72
|
+
return { seeded: false, reason: 'no-starter-selected' };
|
|
73
|
+
}
|
|
74
|
+
// Resolve the starter's clone coordinates.
|
|
75
|
+
let coords = null;
|
|
76
|
+
try {
|
|
77
|
+
coords = await d.loadStarterRepo(starterRepoId);
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
d.log(`[genesis] could not load starter ${starterRepoId}: ${err.message}`);
|
|
81
|
+
}
|
|
82
|
+
if (!coords) {
|
|
83
|
+
d.log(`[genesis] starter ${starterRepoId} not found/unclonable -- using empty genesis`);
|
|
84
|
+
return { seeded: false, reason: 'starter-not-found', starterRepoId };
|
|
85
|
+
}
|
|
86
|
+
const tmpRoot = mkdtempSync(join(tmpdir(), 'telora-starter-'));
|
|
87
|
+
const cloneDir = join(tmpRoot, 'starter');
|
|
88
|
+
try {
|
|
89
|
+
// Full clone (so a pinned sha is reachable), then check out the exact ref.
|
|
90
|
+
const clone = d.runGit(['clone', coords.gitUrl, cloneDir], tmpRoot, {
|
|
91
|
+
timeoutMs: CLONE_TIMEOUT_MS,
|
|
92
|
+
});
|
|
93
|
+
if (!clone.success) {
|
|
94
|
+
d.log(`[genesis] clone of ${coords.gitUrl} failed: ${clone.error} -- using empty genesis`);
|
|
95
|
+
return { seeded: false, reason: 'clone-failed', starterRepoId, gitUrl: coords.gitUrl, ref: coords.ref };
|
|
96
|
+
}
|
|
97
|
+
const checkout = d.runGit(['checkout', coords.ref], cloneDir, { timeoutMs: CLONE_TIMEOUT_MS });
|
|
98
|
+
if (!checkout.success) {
|
|
99
|
+
d.log(`[genesis] checkout of ref ${coords.ref} failed: ${checkout.error} -- using empty genesis`);
|
|
100
|
+
return { seeded: false, reason: 'clone-failed', starterRepoId, gitUrl: coords.gitUrl, ref: coords.ref };
|
|
101
|
+
}
|
|
102
|
+
const resolved = d.runGit(['rev-parse', 'HEAD'], cloneDir);
|
|
103
|
+
const resolvedSha = resolved.success ? resolved.output.trim() : coords.ref;
|
|
104
|
+
// Copy the starter working tree (MINUS its .git) over the empty product
|
|
105
|
+
// repo. Excluding .git is what squashes the result to a single fresh
|
|
106
|
+
// initial commit -- starter history is not inherited.
|
|
107
|
+
const starterGitDir = join(cloneDir, '.git');
|
|
108
|
+
cpSync(cloneDir, config.repoPath, {
|
|
109
|
+
recursive: true,
|
|
110
|
+
filter: (src) => src !== starterGitDir && !src.startsWith(starterGitDir + sep),
|
|
111
|
+
});
|
|
112
|
+
// Record provenance as repo metadata (force-added past any .telora gitignore)
|
|
113
|
+
// so a product traces back to exactly what it started from.
|
|
114
|
+
const provenance = {
|
|
115
|
+
starterRepoId,
|
|
116
|
+
name: coords.name,
|
|
117
|
+
gitUrl: coords.gitUrl,
|
|
118
|
+
ref: coords.ref,
|
|
119
|
+
resolvedSha,
|
|
120
|
+
seededAt: new Date().toISOString(),
|
|
121
|
+
};
|
|
122
|
+
const teloraDir = join(config.repoPath, '.telora');
|
|
123
|
+
if (!existsSync(teloraDir))
|
|
124
|
+
mkdirSync(teloraDir, { recursive: true });
|
|
125
|
+
writeFileSync(join(teloraDir, 'starter-provenance.json'), `${JSON.stringify(provenance, null, 2)}\n`);
|
|
126
|
+
d.runGit(['add', '-A'], config.repoPath);
|
|
127
|
+
// Force-add the provenance file in case the product's .gitignore drops
|
|
128
|
+
// .telora -- the provenance must land in the genesis commit.
|
|
129
|
+
d.runGit(['add', '-f', '.telora/starter-provenance.json'], config.repoPath);
|
|
130
|
+
const message = `chore: initialize from starter ${coords.name || coords.ref}\n\n` +
|
|
131
|
+
'Seeded the product genesis commit from a registered starter repo ' +
|
|
132
|
+
'(squashed -- starter history not inherited).\n\n' +
|
|
133
|
+
`Starter-Repo-Id: ${starterRepoId}\n` +
|
|
134
|
+
`Starter-Name: ${coords.name}\n` +
|
|
135
|
+
`Starter-Git-Url: ${coords.gitUrl}\n` +
|
|
136
|
+
`Starter-Ref: ${coords.ref}\n` +
|
|
137
|
+
`Starter-Resolved-Sha: ${resolvedSha}\n`;
|
|
138
|
+
let commit = d.runGit(['commit', '-m', message], config.repoPath);
|
|
139
|
+
if (!commit.success) {
|
|
140
|
+
// The daemon host may have no committer identity configured. Retry with an
|
|
141
|
+
// explicit one scoped to this command only.
|
|
142
|
+
commit = d.runGit([
|
|
143
|
+
'-c',
|
|
144
|
+
'user.name=Telora Factory',
|
|
145
|
+
'-c',
|
|
146
|
+
'user.email=factory@telora.local',
|
|
147
|
+
'commit',
|
|
148
|
+
'-m',
|
|
149
|
+
message,
|
|
150
|
+
], config.repoPath);
|
|
151
|
+
}
|
|
152
|
+
if (!commit.success) {
|
|
153
|
+
d.log(`[genesis] genesis commit failed: ${commit.error} -- using empty genesis`);
|
|
154
|
+
return {
|
|
155
|
+
seeded: false,
|
|
156
|
+
reason: 'commit-failed',
|
|
157
|
+
starterRepoId,
|
|
158
|
+
gitUrl: coords.gitUrl,
|
|
159
|
+
ref: coords.ref,
|
|
160
|
+
resolvedSha,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
d.log(`[genesis] seeded product genesis from starter "${coords.name}" ` +
|
|
164
|
+
`(${coords.gitUrl} @ ${coords.ref} -> ${resolvedSha.slice(0, 12)})`);
|
|
165
|
+
return {
|
|
166
|
+
seeded: true,
|
|
167
|
+
reason: 'seeded',
|
|
168
|
+
starterRepoId,
|
|
169
|
+
gitUrl: coords.gitUrl,
|
|
170
|
+
ref: coords.ref,
|
|
171
|
+
resolvedSha,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
finally {
|
|
175
|
+
rmSync(tmpRoot, { recursive: true, force: true });
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Ensure an empty product repo has its initial commit, preferring a starter
|
|
180
|
+
* genesis. This is the single decision point both daemon startup (initGit) and
|
|
181
|
+
* the per-poll worktree-provisioning safety net share, so the
|
|
182
|
+
* defer-rather-than-foreclose rule is applied consistently (focus 80ecc233).
|
|
183
|
+
*
|
|
184
|
+
* Order:
|
|
185
|
+
* 1. Repo already has commits -> nothing to do.
|
|
186
|
+
* 2. Try to seed from the active PRD's starter.
|
|
187
|
+
* 3. No active starter, BUT a starter-selecting PRD is still draft -> DEFER:
|
|
188
|
+
* leave the repo empty (no foreclosing placeholder). The worktree-provisioning
|
|
189
|
+
* safety net re-runs this once the PRD activates and seeds the genesis then.
|
|
190
|
+
* 4. Otherwise (no starter anywhere, or the clone genuinely failed) -> write an
|
|
191
|
+
* empty placeholder commit so git operations are never wedged.
|
|
192
|
+
*/
|
|
193
|
+
export async function ensureInitialCommit(config, deps = {}) {
|
|
194
|
+
const d = { ...defaultDeps, ...deps };
|
|
195
|
+
if (d.hasCommits(config.repoPath)) {
|
|
196
|
+
return { committed: true, seeded: false, deferred: false };
|
|
197
|
+
}
|
|
198
|
+
const genesis = await seedGenesisFromStarter(config, d);
|
|
199
|
+
if (genesis.seeded) {
|
|
200
|
+
return { committed: true, seeded: true, deferred: false, genesis };
|
|
201
|
+
}
|
|
202
|
+
// Defer ONLY for the genuinely-pending case. A clone/commit failure on an
|
|
203
|
+
// active selection (reason !== 'no-starter-selected') must still fall through
|
|
204
|
+
// to a placeholder -- never leave the product permanently without a commit.
|
|
205
|
+
if (genesis.reason === 'no-starter-selected') {
|
|
206
|
+
let pending = false;
|
|
207
|
+
try {
|
|
208
|
+
pending = await d.hasPendingStarterSelection(config.productId);
|
|
209
|
+
}
|
|
210
|
+
catch (err) {
|
|
211
|
+
d.log(`[genesis] could not check pending starter PRDs: ${err.message}`);
|
|
212
|
+
}
|
|
213
|
+
if (pending) {
|
|
214
|
+
d.log('[genesis] a starter-selecting PRD exists but is not active yet -- ' +
|
|
215
|
+
'deferring the initial commit so genesis can seed once it activates');
|
|
216
|
+
return { committed: false, seeded: false, deferred: true, genesis };
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
// Fall back to an empty placeholder initial commit.
|
|
220
|
+
let commit = d.runGit(['commit', '--allow-empty', '-m', PLACEHOLDER_COMMIT_MESSAGE], config.repoPath);
|
|
221
|
+
if (!commit.success) {
|
|
222
|
+
// Retry with an explicit committer identity scoped to this command only.
|
|
223
|
+
commit = d.runGit([
|
|
224
|
+
'-c', 'user.name=Telora Factory',
|
|
225
|
+
'-c', 'user.email=factory@telora.local',
|
|
226
|
+
'commit', '--allow-empty', '-m', PLACEHOLDER_COMMIT_MESSAGE,
|
|
227
|
+
], config.repoPath);
|
|
228
|
+
}
|
|
229
|
+
return { committed: commit.success, seeded: false, deferred: false, genesis };
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=git-genesis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-genesis.js","sourceRoot":"","sources":["../src/git-genesis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EACL,WAAW,EACX,MAAM,EACN,MAAM,EACN,aAAa,EACb,SAAS,EACT,UAAU,GACX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAkB,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EACL,eAAe,GAEhB,MAAM,2BAA2B,CAAC;AA0CnC,MAAM,WAAW,GAAgB;IAC/B,UAAU,EAAE,cAAc;IAC1B,cAAc;IACd,eAAe;IACf,0BAA0B;IAC1B,MAAM,EAAE,UAAU;IAClB,GAAG,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;CACvC,CAA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K,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAChF,CAAC"}
|
package/dist/git.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAe/C,OAAO,EAAE,UAAU,EAAE,sBAAsB,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGlJ,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,KAAK,iBAAiB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,cAAc,GACf,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACd,YAAY,GACb,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,kBAAkB,EAClB,KAAK,wBAAwB,EAC7B,kBAAkB,EAClB,cAAc,EACd,6BAA6B,GAC9B,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,uBAAuB,EACvB,cAAc,EACd,2BAA2B,EAC3B,kCAAkC,EAClC,6BAA6B,EAC7B,6BAA6B,EAC7B,6BAA6B,EAC7B,wBAAwB,EACxB,cAAc,EACd,gBAAgB,EAChB,uBAAuB,EACvB,2BAA2B,EAC3B,KAAK,6BAA6B,EAClC,KAAK,gBAAgB,GACtB,MAAM,eAAe,CAAC;AAIvB;;GAEG;AACH,wBAAsB,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAqFjE"}
|
package/dist/git.js
CHANGED
|
@@ -17,6 +17,7 @@ import { configureMergeLock } from './git-merge-lock.js';
|
|
|
17
17
|
import { ensureIntegrationBranch, repoHasCommits } from './git-branch.js';
|
|
18
18
|
import { syncIntegrationWithMain } from './git-integration.js';
|
|
19
19
|
import { runGitSync } from './git-types.js';
|
|
20
|
+
import { ensureInitialCommit } from './git-genesis.js';
|
|
20
21
|
// ── Re-exports from sub-modules ─────────────────────────────────
|
|
21
22
|
// git-types.ts: shared types and utilities
|
|
22
23
|
export { runGitSync, DEFAULT_GIT_TIMEOUT_MS } from './git-types.js';
|
|
@@ -59,15 +60,37 @@ export async function initGit(config) {
|
|
|
59
60
|
pruneWorktrees(config.repoPath);
|
|
60
61
|
// Empty repos need an initial commit before branches or worktrees can be created.
|
|
61
62
|
// Create one automatically so the full git subsystem initializes immediately.
|
|
63
|
+
// When the product's active PRD selects a starter repo, seed the genesis
|
|
64
|
+
// commit from that polished starter instead of an empty commit (focus
|
|
65
|
+
// 80ecc233) -- the agent then starts ABOVE the UX floor. Falls back to the
|
|
66
|
+
// empty commit when there is no starter / it cannot be cloned.
|
|
62
67
|
if (!repoHasCommits(config.repoPath)) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
const init = await ensureInitialCommit({
|
|
69
|
+
repoPath: config.repoPath,
|
|
70
|
+
productId: config.productId,
|
|
71
|
+
});
|
|
72
|
+
if (init.seeded) {
|
|
73
|
+
const g = init.genesis;
|
|
74
|
+
console.log(`Genesis commit seeded from starter ${g?.starterRepoId} ` +
|
|
75
|
+
`(${g?.gitUrl} @ ${g?.ref} -> ${g?.resolvedSha?.slice(0, 12)})`);
|
|
76
|
+
}
|
|
77
|
+
else if (init.deferred) {
|
|
78
|
+
// A starter-selecting PRD is still draft -- leave the repo empty rather
|
|
79
|
+
// than foreclose genesis with a placeholder. The worktree-provisioning
|
|
80
|
+
// safety net seeds it once the PRD activates.
|
|
81
|
+
console.log('Repository has no commits -- deferring initial commit until a ' +
|
|
82
|
+
'starter-selecting PRD activates (genesis will seed it then)');
|
|
83
|
+
console.log('Git subsystem initialized (limited -- waiting for starter PRD / first commit)');
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
else if (!init.committed) {
|
|
87
|
+
console.error('Failed to create initial commit');
|
|
67
88
|
console.log('Git subsystem initialized (limited -- waiting for first commit)');
|
|
68
89
|
return;
|
|
69
90
|
}
|
|
70
|
-
|
|
91
|
+
else {
|
|
92
|
+
console.log(`Repository has no commits (${init.genesis?.reason}) -- created empty initial commit for Telora`);
|
|
93
|
+
}
|
|
71
94
|
}
|
|
72
95
|
// Ensure integration branch exists
|
|
73
96
|
await ensureIntegrationBranch(config);
|
package/dist/git.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.js","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,oDAAoD;AACpD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEvF,8CAA8C;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,oDAAoD;AACpD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,mBAA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BAA2B,CAAC,CAAC;AAC3C,CAAC"}
|
package/dist/output-monitor.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { setNarration } from './heartbeat.js';
|
|
10
10
|
import { CompletionDetector } from './completion/index.js';
|
|
11
11
|
import { ActivityTracker } from './activity-tracker.js';
|
|
12
|
-
import {
|
|
12
|
+
import { stampSessionStarted } from './session-stamp.js';
|
|
13
13
|
/**
|
|
14
14
|
* Set up stream parsing, activity tracking, and event logging for a team lead process.
|
|
15
15
|
*
|
|
@@ -49,13 +49,10 @@ function handleNeutralEvent(event, ctx) {
|
|
|
49
49
|
switch (event.kind) {
|
|
50
50
|
case 'session_started': {
|
|
51
51
|
console.log(` [focus-team] Session initialized (model: ${event.model ?? 'unknown'})`);
|
|
52
|
-
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
|
|
56
|
-
updateFocusClaudeSessionId(focusId, teamState.lineage, event.sessionId).catch((err) => {
|
|
57
|
-
console.warn(`[focus-executor] Failed to persist session ID for "${focusName}":`, err.message);
|
|
58
|
-
});
|
|
52
|
+
// Single stamp site (session-stamp.ts): writes the focus per-lineage resume
|
|
53
|
+
// slot AND forward-stamps the Claude session id onto this lead segment so
|
|
54
|
+
// pass grouping is exact (INJ-A/INJ-B).
|
|
55
|
+
stampSessionStarted({ teamState, focusId, focusName, eventSessionId: event.sessionId });
|
|
59
56
|
break;
|
|
60
57
|
}
|
|
61
58
|
case 'subagent_activity': {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-monitor.js","sourceRoot":"","sources":["../src/output-monitor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"output-monitor.js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E,CAAC,CAAC;YACrG,CAAC;YACD,MAAM;QACR,CAAC;QACD,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC;YACnD,OAAO,CAAC,GAAG,CAAC,0BAA0B,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,KAAK,KAAK,CAAC,QAAQ,YAAY,IAAI,EAAE,CAAC,CAAC;YAChH,MAAM;QACR,CAAC;QACD;YACE,MAAM;IACV,CAAC;AACH,CAAC"}
|
package/dist/prd-controller.d.ts
CHANGED
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
* Foci -> Delivery -> Issue executor.
|
|
16
16
|
*/
|
|
17
17
|
import type { DaemonConfig } from './types.js';
|
|
18
|
-
import { type ClearancePredicate, type ClearanceContext, type ClearanceVerdict } from './prd-clearance-engine.js';
|
|
19
18
|
import { type Prd, type PrtNode, type PrtEdge, type Pathway } from './queries/prd.js';
|
|
20
19
|
import { computePrtFrontier } from './prd-frontier.js';
|
|
21
20
|
import { isPathwayViable } from './prd-viability.js';
|
|
@@ -86,7 +85,6 @@ export interface PrdControllerDeps {
|
|
|
86
85
|
focusId: string;
|
|
87
86
|
executionStatus: string;
|
|
88
87
|
}>>;
|
|
89
|
-
evaluateClearance: (predicate: ClearancePredicate, ctx: ClearanceContext) => Promise<ClearanceVerdict>;
|
|
90
88
|
markNodeCleared: (nodeId: string) => Promise<void>;
|
|
91
89
|
/**
|
|
92
90
|
* Finalize a completed frontier focus to status=complete via the sanctioned
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prd-controller.d.ts","sourceRoot":"","sources":["../src/prd-controller.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,
|
|
1
|
+
{"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
|
16
16
|
*/
|
|
17
17
|
import { DELIVERY_STATUS } from '@telora/daemon-core';
|
|
18
18
|
import { configForProduct } from './config.js';
|
|
19
|
-
import { evaluateClearance, } from './prd-clearance-engine.js';
|
|
20
19
|
import { loadActivePrds, loadDonePrds, loadPrtGraph, materializeOvercome, armFocus, markNodeCleared, finalizeFrontierFocus, markPrdDone, loadPathways, commitPathway, } from './queries/prd.js';
|
|
21
20
|
import { clearPendingSpawnDirective } from './directive/directive-queue.js';
|
|
22
21
|
import { getFocusDeliveries } from './queries/focuses.js';
|
|
@@ -160,12 +159,13 @@ export async function runPrdControllerTick(prd, deps) {
|
|
|
160
159
|
clearedNodeIds.add(node.id);
|
|
161
160
|
}
|
|
162
161
|
}
|
|
163
|
-
|
|
162
|
+
// obstaclesEvaluated is retained in the result type for aggregator stability,
|
|
163
|
+
// but the predicate-eval gate was removed (the obstacle clearancePredicate was
|
|
164
|
+
// a redundant second verify altitude, shadowed by the completion bridge below),
|
|
165
|
+
// so it is always 0 now.
|
|
166
|
+
const obstaclesEvaluated = 0;
|
|
164
167
|
let obstaclesCleared = 0;
|
|
165
168
|
let focusesFinalized = 0;
|
|
166
|
-
// Obstacles whose predicate ran and definitively did NOT clear (not deferred).
|
|
167
|
-
// Feeds divergence detection (clearance_fail) and pathway viability.
|
|
168
|
-
const clearanceFailedObstacleIds = new Set();
|
|
169
169
|
// --- Completion bridge: focus completion -> obstacle cleared --------------
|
|
170
170
|
// The autonomous frontier driver. An overcome materializes as a focus; when
|
|
171
171
|
// that focus has finished all its delivery work (>=1 delivery, all 'done' --
|
|
@@ -244,32 +244,13 @@ export async function runPrdControllerTick(prd, deps) {
|
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
//
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
-
if (!obstacle.clearancePredicate) {
|
|
256
|
-
continue;
|
|
257
|
-
}
|
|
258
|
-
obstaclesEvaluated += 1;
|
|
259
|
-
const verdict = await deps.evaluateClearance(obstacle.clearancePredicate, {
|
|
260
|
-
worktreeDir: deps.worktreeDir,
|
|
261
|
-
});
|
|
262
|
-
if (verdict.cleared) {
|
|
263
|
-
clearedNodeIds.add(obstacle.id);
|
|
264
|
-
if (obstacle.status !== 'cleared') {
|
|
265
|
-
await deps.markNodeCleared(obstacle.id);
|
|
266
|
-
obstaclesCleared += 1;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
else if (!verdict.deferred) {
|
|
270
|
-
clearanceFailedObstacleIds.add(obstacle.id);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
247
|
+
// The per-obstacle deterministic clearancePredicate gate was REMOVED: it was a
|
|
248
|
+
// redundant second verification altitude on top of the focus/delivery verify
|
|
249
|
+
// gate one altitude down, and never ran in the normal path -- the completion
|
|
250
|
+
// bridge above clears the obstacle first. Obstacle clearance now has ONE
|
|
251
|
+
// signal: focus-completion (all of an overcome's focus's deliveries 'done',
|
|
252
|
+
// each having passed its own verify gate). `obstacles` is still used below for
|
|
253
|
+
// the "PRD complete when every obstacle is cleared" check.
|
|
273
254
|
const { needsMaterialize, needsArm } = computePrtFrontier(nodes, edges, clearedNodeIds);
|
|
274
255
|
const roleId = await deps.resolveArmRoleId(prd);
|
|
275
256
|
let materialized = 0;
|
|
@@ -384,7 +365,6 @@ export async function runPrdControllerTick(prd, deps) {
|
|
|
384
365
|
nodes,
|
|
385
366
|
edges,
|
|
386
367
|
clearedNodeIds,
|
|
387
|
-
clearanceFailedObstacleIds,
|
|
388
368
|
committedPathwayId: prd.committedPathId,
|
|
389
369
|
});
|
|
390
370
|
if (signals.length > 0) {
|
|
@@ -394,7 +374,7 @@ export async function runPrdControllerTick(prd, deps) {
|
|
|
394
374
|
id: p.id,
|
|
395
375
|
status: p.status,
|
|
396
376
|
}));
|
|
397
|
-
const viable = (pid) => isPathwayViable(pid, nodes, edges, clearedNodeIds
|
|
377
|
+
const viable = (pid) => isPathwayViable(pid, nodes, edges, clearedNodeIds);
|
|
398
378
|
// --- Cortex: the steward makes the JUDGMENT when the PRD is Played -----
|
|
399
379
|
// When the PRD is Played (assigned_agent_role_id set) AND a steward is
|
|
400
380
|
// wired, the steward (an LLM at the milestone altitude) decides
|
|
@@ -478,7 +458,7 @@ export async function runPrdControllerTick(prd, deps) {
|
|
|
478
458
|
id: p.id,
|
|
479
459
|
status: p.status,
|
|
480
460
|
}));
|
|
481
|
-
const viable = (pid) => isPathwayViable(pid, nodes, edges, clearedNodeIds
|
|
461
|
+
const viable = (pid) => isPathwayViable(pid, nodes, edges, clearedNodeIds);
|
|
482
462
|
const cadenceDecision = await deps.runStewardJudgment({
|
|
483
463
|
prd,
|
|
484
464
|
nodes,
|
|
@@ -526,7 +506,6 @@ function defaultDeps(config) {
|
|
|
526
506
|
// executionStatus is nullableString from the API; coerce null -> '' so a
|
|
527
507
|
// missing status is never miscounted as 'done' by the completion bridge.
|
|
528
508
|
ds.map((d) => ({ focusId, executionStatus: d.executionStatus ?? '' }))),
|
|
529
|
-
evaluateClearance: (predicate, ctx) => evaluateClearance(predicate, ctx),
|
|
530
509
|
markNodeCleared: (nodeId) => markNodeCleared(nodeId),
|
|
531
510
|
finalizeFrontierFocus: (focusId) => finalizeFrontierFocus(focusId),
|
|
532
511
|
clearPendingSpawnDirective: (focusId) => clearPendingSpawnDirective(focusId),
|