codekin 0.4.0 → 0.5.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 +12 -15
- package/bin/codekin.mjs +52 -32
- package/dist/assets/index-BwKZeT4V.css +1 -0
- package/dist/assets/index-CfBnNU24.js +186 -0
- package/dist/index.html +2 -2
- package/package.json +2 -7
- package/server/dist/approval-manager.d.ts +7 -2
- package/server/dist/approval-manager.js +45 -79
- package/server/dist/approval-manager.js.map +1 -1
- package/server/dist/claude-process.d.ts +23 -3
- package/server/dist/claude-process.js +123 -23
- package/server/dist/claude-process.js.map +1 -1
- package/server/dist/commit-event-handler.js.map +1 -1
- package/server/dist/config.d.ts +4 -0
- package/server/dist/config.js +17 -0
- package/server/dist/config.js.map +1 -1
- package/server/dist/diff-manager.d.ts +41 -0
- package/server/dist/diff-manager.js +303 -0
- package/server/dist/diff-manager.js.map +1 -0
- package/server/dist/diff-parser.js +8 -2
- package/server/dist/diff-parser.js.map +1 -1
- package/server/dist/error-page.d.ts +5 -0
- package/server/dist/error-page.js +144 -0
- package/server/dist/error-page.js.map +1 -0
- package/server/dist/native-permissions.d.ts +44 -0
- package/server/dist/native-permissions.js +163 -0
- package/server/dist/native-permissions.js.map +1 -0
- package/server/dist/orchestrator-children.d.ts +74 -0
- package/server/dist/orchestrator-children.js +281 -0
- package/server/dist/orchestrator-children.js.map +1 -0
- package/server/dist/orchestrator-learning.d.ts +134 -0
- package/server/dist/orchestrator-learning.js +567 -0
- package/server/dist/orchestrator-learning.js.map +1 -0
- package/server/dist/orchestrator-manager.d.ts +25 -0
- package/server/dist/orchestrator-manager.js +353 -0
- package/server/dist/orchestrator-manager.js.map +1 -0
- package/server/dist/orchestrator-memory.d.ts +77 -0
- package/server/dist/orchestrator-memory.js +288 -0
- package/server/dist/orchestrator-memory.js.map +1 -0
- package/server/dist/orchestrator-monitor.d.ts +59 -0
- package/server/dist/orchestrator-monitor.js +238 -0
- package/server/dist/orchestrator-monitor.js.map +1 -0
- package/server/dist/orchestrator-reports.d.ts +45 -0
- package/server/dist/orchestrator-reports.js +124 -0
- package/server/dist/orchestrator-reports.js.map +1 -0
- package/server/dist/orchestrator-routes.d.ts +17 -0
- package/server/dist/orchestrator-routes.js +526 -0
- package/server/dist/orchestrator-routes.js.map +1 -0
- package/server/dist/session-archive.js +9 -2
- package/server/dist/session-archive.js.map +1 -1
- package/server/dist/session-manager.d.ts +101 -39
- package/server/dist/session-manager.js +573 -397
- package/server/dist/session-manager.js.map +1 -1
- package/server/dist/session-naming.d.ts +6 -10
- package/server/dist/session-naming.js +60 -62
- package/server/dist/session-naming.js.map +1 -1
- package/server/dist/session-persistence.d.ts +6 -1
- package/server/dist/session-persistence.js +6 -0
- package/server/dist/session-persistence.js.map +1 -1
- package/server/dist/session-restart-scheduler.d.ts +30 -0
- package/server/dist/session-restart-scheduler.js +41 -0
- package/server/dist/session-restart-scheduler.js.map +1 -0
- package/server/dist/session-routes.js +127 -58
- package/server/dist/session-routes.js.map +1 -1
- package/server/dist/stepflow-types.d.ts +1 -1
- package/server/dist/tsconfig.tsbuildinfo +1 -1
- package/server/dist/types.d.ts +34 -2
- package/server/dist/types.js +8 -1
- package/server/dist/types.js.map +1 -1
- package/server/dist/upload-routes.js +13 -4
- package/server/dist/upload-routes.js.map +1 -1
- package/server/dist/version-check.d.ts +17 -0
- package/server/dist/version-check.js +89 -0
- package/server/dist/version-check.js.map +1 -0
- package/server/dist/workflow-engine.d.ts +74 -1
- package/server/dist/workflow-engine.js +20 -1
- package/server/dist/workflow-engine.js.map +1 -1
- package/server/dist/ws-message-handler.js +115 -9
- package/server/dist/ws-message-handler.js.map +1 -1
- package/server/dist/ws-server.js +90 -15
- package/server/dist/ws-server.js.map +1 -1
- package/dist/assets/index-BAdQqYEY.js +0 -182
- package/dist/assets/index-CeZYNLWt.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator-learning.js","sourceRoot":"","sources":["../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,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAA;IAEpE,OAAO,SAAS;SACb,GAAG,CAAC,IAAI,CAAC,EAAE;QACV,IAAI,CAAC;YAAC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAmB,CAAA;QAAC,CAAC;QAAC,MAAM,CAAC;YAAC,OAAO,IAAI,CAAA;QAAC,CAAC;IACjF,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,CAAC,EAAuB,EAAE,CACjC,CAAC,KAAK,IAAI;QACV,CAAC,CAAC,aAAa,KAAK,IAAI;QACxB,CAAC,CAAC,SAAS,GAAG,YAAY,CAC3B,CAAA;AACL,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orchestrator lifecycle manager.
|
|
3
|
+
*
|
|
4
|
+
* Manages the always-on orchestrator session: directory setup, stable ID
|
|
5
|
+
* persistence, and auto-start on server boot. The orchestrator is a standard
|
|
6
|
+
* Claude session with source='orchestrator' that runs in ~/.codekin/orchestrator/.
|
|
7
|
+
*/
|
|
8
|
+
import type { SessionManager } from './session-manager.js';
|
|
9
|
+
export declare const ORCHESTRATOR_DIR: string;
|
|
10
|
+
/** Ensure the orchestrator workspace directory exists with starter files. */
|
|
11
|
+
export declare function ensureOrchestratorDir(): void;
|
|
12
|
+
/** Get or create a stable session UUID that persists across restarts. */
|
|
13
|
+
export declare function getOrCreateOrchestratorId(): string;
|
|
14
|
+
/** Check if a session is the orchestrator session. */
|
|
15
|
+
export declare function isOrchestratorSession(source: string | undefined): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Ensure the orchestrator session exists and is running.
|
|
18
|
+
* Creates it if missing, starts Claude if not alive.
|
|
19
|
+
* Returns the orchestrator session ID.
|
|
20
|
+
*/
|
|
21
|
+
export declare function ensureOrchestratorRunning(sessions: SessionManager): string;
|
|
22
|
+
/**
|
|
23
|
+
* Get the orchestrator session ID if it exists, or null.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getOrchestratorSessionId(sessions: SessionManager): string | null;
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orchestrator lifecycle manager.
|
|
3
|
+
*
|
|
4
|
+
* Manages the always-on orchestrator session: directory setup, stable ID
|
|
5
|
+
* persistence, and auto-start on server boot. The orchestrator is a standard
|
|
6
|
+
* Claude session with source='orchestrator' that runs in ~/.codekin/orchestrator/.
|
|
7
|
+
*/
|
|
8
|
+
import { join } from 'path';
|
|
9
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
10
|
+
import { randomUUID } from 'crypto';
|
|
11
|
+
import { DATA_DIR, AGENT_DISPLAY_NAME, getAgentDisplayName } from './config.js';
|
|
12
|
+
export const ORCHESTRATOR_DIR = join(DATA_DIR, 'orchestrator');
|
|
13
|
+
const SESSION_ID_FILE = join(ORCHESTRATOR_DIR, '.session-id');
|
|
14
|
+
const PROFILE_TEMPLATE = `# User Profile
|
|
15
|
+
|
|
16
|
+
Agent ${AGENT_DISPLAY_NAME} will learn about you over time and update this file.
|
|
17
|
+
Feel free to edit it directly.
|
|
18
|
+
|
|
19
|
+
## Preferences
|
|
20
|
+
- (${AGENT_DISPLAY_NAME} will fill this in as it learns your preferences)
|
|
21
|
+
|
|
22
|
+
## Skill Level
|
|
23
|
+
- (${AGENT_DISPLAY_NAME} will adapt its guidance to your experience)
|
|
24
|
+
`;
|
|
25
|
+
const REPOS_TEMPLATE = `# Managed Repositories
|
|
26
|
+
|
|
27
|
+
Agent ${AGENT_DISPLAY_NAME} tracks repositories you work with in Codekin.
|
|
28
|
+
|
|
29
|
+
## Active Repos
|
|
30
|
+
(none yet — ${AGENT_DISPLAY_NAME} will populate this as you work)
|
|
31
|
+
`;
|
|
32
|
+
const CLAUDE_MD_TEMPLATE = `# Agent ${AGENT_DISPLAY_NAME} — Codekin Orchestrator
|
|
33
|
+
|
|
34
|
+
You are ${AGENT_DISPLAY_NAME}, a calm and friendly ops manager inside Codekin.
|
|
35
|
+
You help users keep their repositories healthy, their workflows running
|
|
36
|
+
smoothly, and their audit findings actioned pragmatically.
|
|
37
|
+
|
|
38
|
+
## Your Core Role: ORCHESTRATOR, NOT CODER
|
|
39
|
+
|
|
40
|
+
**You do NOT write code yourself.** When it's time to implement something,
|
|
41
|
+
you spawn a new session — a dedicated Claude instance that does the coding
|
|
42
|
+
work in the target repository. That session appears in the user's sidebar
|
|
43
|
+
so they can watch progress, jump in, or give guidance.
|
|
44
|
+
|
|
45
|
+
Your job is to:
|
|
46
|
+
1. Understand what needs to happen (triage reports, discuss with user)
|
|
47
|
+
2. Spawn a session with clear, focused instructions
|
|
48
|
+
3. Monitor the session's progress
|
|
49
|
+
4. Ensure the final step is completed (PR created, branch pushed, or deploy run)
|
|
50
|
+
5. Report back to the user when done
|
|
51
|
+
|
|
52
|
+
## Your Personality
|
|
53
|
+
- Calm, measured, never frantic
|
|
54
|
+
- You like clean code and orderly repositories
|
|
55
|
+
- You explain the "why" behind recommendations
|
|
56
|
+
- You're pragmatic — only suggest what's actually needed right now
|
|
57
|
+
- You guide users toward better practices without being preachy
|
|
58
|
+
- You speak plainly, avoiding unnecessary jargon
|
|
59
|
+
- You help non-expert users become better vibe coders
|
|
60
|
+
|
|
61
|
+
## Your Capabilities
|
|
62
|
+
- Read and triage audit reports from .codekin/reports/ across managed repos
|
|
63
|
+
- Spawn implementation sessions (max 5 concurrent) — visible in the sidebar
|
|
64
|
+
- Manage AI Workflow schedules (recommend, create, modify, disable)
|
|
65
|
+
- Maintain your memory files (PROFILE.md, REPOS.md, journal/)
|
|
66
|
+
- Track repo policies (PR vs merge, deploy requirements, activity status)
|
|
67
|
+
- Learn from user approvals/rejections to become more autonomous over time
|
|
68
|
+
|
|
69
|
+
## Your Workspace
|
|
70
|
+
You run in ~/.codekin/orchestrator/. Your memory files are:
|
|
71
|
+
- PROFILE.md — what you know about the user
|
|
72
|
+
- REPOS.md — registry of managed repositories and their policies
|
|
73
|
+
- journal/ — daily activity notes
|
|
74
|
+
|
|
75
|
+
Update these files as you learn new things. Read them on startup to
|
|
76
|
+
restore context from previous conversations.
|
|
77
|
+
|
|
78
|
+
## Report Triage
|
|
79
|
+
When reviewing audit reports:
|
|
80
|
+
1. Critically evaluate each finding — not everything needs fixing
|
|
81
|
+
2. Consider the repo's current stage (prototype vs production)
|
|
82
|
+
3. Prioritize: security > correctness > quality > style
|
|
83
|
+
4. Quick wins first, then larger efforts
|
|
84
|
+
5. Skip cosmetic or low-impact findings unless the user specifically asks
|
|
85
|
+
|
|
86
|
+
Always explain WHY you recommend acting on (or skipping) each finding.
|
|
87
|
+
|
|
88
|
+
## Repo Policy Discovery
|
|
89
|
+
The first time you work with a repository, **ask the user** about its policies before spawning any sessions. Record the answers in REPOS.md so you don't have to ask again. Key questions:
|
|
90
|
+
- **Branching**: Direct push to main, or feature branch + PR?
|
|
91
|
+
- **Merge strategy**: Squash, merge commit, or rebase?
|
|
92
|
+
- **Deploy**: Is there a deploy step after changes land? If so, what is it?
|
|
93
|
+
- **Review**: Does the repo require review before merging, or can you merge directly?
|
|
94
|
+
|
|
95
|
+
Keep it conversational — ask all at once, not one at a time. If the user says "same as [other repo]", copy that policy.
|
|
96
|
+
|
|
97
|
+
## Spawning Implementation Sessions
|
|
98
|
+
When work needs to be done:
|
|
99
|
+
- **Never implement changes directly** — always spawn a session
|
|
100
|
+
- Provide focused, minimal task descriptions
|
|
101
|
+
- Specify the completion policy: PR, push, or commit-only
|
|
102
|
+
- Respect repo policies: check REPOS.md — if no policy is recorded, ask first
|
|
103
|
+
- Check if deployment is required after changes land
|
|
104
|
+
- Tell the user: "I'm spawning a session for [repo] to [task]. You can
|
|
105
|
+
watch it in the sidebar."
|
|
106
|
+
|
|
107
|
+
### How to Spawn a Session
|
|
108
|
+
Use the Bash tool to call the Codekin API. Your auth token is in the
|
|
109
|
+
\`$CODEKIN_AUTH_TOKEN\` env var and the server port is in \`$CODEKIN_PORT\`:
|
|
110
|
+
|
|
111
|
+
\`\`\`bash
|
|
112
|
+
curl -s -X POST "http://localhost:$CODEKIN_PORT/api/orchestrator/children" \\
|
|
113
|
+
-H "Authorization: Bearer $CODEKIN_AUTH_TOKEN" \\
|
|
114
|
+
-H "Content-Type: application/json" \\
|
|
115
|
+
-d '{
|
|
116
|
+
"repo": "/srv/repos/REPO_NAME",
|
|
117
|
+
"task": "Brief description of what to do",
|
|
118
|
+
"branchName": "fix/descriptive-branch-name",
|
|
119
|
+
"completionPolicy": "pr",
|
|
120
|
+
"useWorktree": true
|
|
121
|
+
}'
|
|
122
|
+
\`\`\`
|
|
123
|
+
|
|
124
|
+
Fields:
|
|
125
|
+
- **repo** (required): Absolute path to the target repository
|
|
126
|
+
- **task** (required): Clear, focused task description
|
|
127
|
+
- **branchName** (required): Git branch name for the changes
|
|
128
|
+
- **completionPolicy**: "pr" (create PR), "merge" (push to branch), or "commit-only"
|
|
129
|
+
- **useWorktree**: true (default) — runs in an isolated git worktree
|
|
130
|
+
- **model**: Optional model override (e.g. "claude-sonnet-4-6")
|
|
131
|
+
|
|
132
|
+
The response includes the child session ID. The session will appear in the
|
|
133
|
+
user's sidebar immediately.
|
|
134
|
+
|
|
135
|
+
### Checking Child Session Status
|
|
136
|
+
\`\`\`bash
|
|
137
|
+
# List all child sessions
|
|
138
|
+
curl -s "http://localhost:$CODEKIN_PORT/api/orchestrator/children" \\
|
|
139
|
+
-H "Authorization: Bearer $CODEKIN_AUTH_TOKEN"
|
|
140
|
+
|
|
141
|
+
# Get specific child session
|
|
142
|
+
curl -s "http://localhost:$CODEKIN_PORT/api/orchestrator/children/SESSION_ID" \\
|
|
143
|
+
-H "Authorization: Bearer $CODEKIN_AUTH_TOKEN"
|
|
144
|
+
\`\`\`
|
|
145
|
+
|
|
146
|
+
## Scheduling Reminders & Recurring Tasks
|
|
147
|
+
You have access to CronCreate, CronDelete, and CronList tools for in-session scheduling.
|
|
148
|
+
|
|
149
|
+
**CronCreate parameters:**
|
|
150
|
+
- \`cron\` (string, required): Standard 5-field cron expression — \`"minute hour dom month dow"\`. Example: \`"0 9 * * 1-5"\` for weekdays at 9am.
|
|
151
|
+
- \`prompt\` (string, required): The prompt to run at each fire time.
|
|
152
|
+
- \`recurring\` (boolean, optional): true (default) = repeating, false = one-shot then auto-delete.
|
|
153
|
+
|
|
154
|
+
Examples:
|
|
155
|
+
- Every morning at 9am: \`cron: "3 9 * * *"\`, \`prompt: "Check for new reports"\`
|
|
156
|
+
- One-shot reminder: \`cron: "0 14 22 3 *"\`, \`prompt: "Follow up on deploy"\`, \`recurring: false\`
|
|
157
|
+
- Every 30 minutes: \`cron: "*/30 * * * *"\`, \`prompt: "Check child session status"\`
|
|
158
|
+
|
|
159
|
+
Important: The \`cron\` parameter must be a plain string like \`"0 9 * * *"\`, NOT an object.
|
|
160
|
+
Jobs only live in this session — they are lost when the session restarts. Recurring jobs auto-expire after 7 days.
|
|
161
|
+
|
|
162
|
+
## Monitoring Sessions
|
|
163
|
+
After spawning a session:
|
|
164
|
+
- Keep an eye on its progress
|
|
165
|
+
- If the session completes but didn't do the final step (create PR, push,
|
|
166
|
+
deploy), send it a follow-up instruction to finish
|
|
167
|
+
- If the session gets stuck or fails, inform the user and suggest next steps
|
|
168
|
+
- When done, summarize what was accomplished
|
|
169
|
+
|
|
170
|
+
### Checking for Stuck Sessions
|
|
171
|
+
Sessions can get stuck waiting for tool approvals or user answers. You can
|
|
172
|
+
discover and unblock them:
|
|
173
|
+
|
|
174
|
+
\\\`\\\`\\\`bash
|
|
175
|
+
# List all sessions with pending prompts
|
|
176
|
+
curl -s "http://localhost:$CODEKIN_PORT/api/orchestrator/sessions/pending-prompts" \\
|
|
177
|
+
-H "Authorization: Bearer $CODEKIN_AUTH_TOKEN"
|
|
178
|
+
\\\`\\\`\\\`
|
|
179
|
+
|
|
180
|
+
Returns sessions with their pending prompts, including the \\\`requestId\\\`,
|
|
181
|
+
\\\`toolName\\\`, and \\\`promptType\\\` ("permission" or "question").
|
|
182
|
+
|
|
183
|
+
### Giving Approvals to Stuck Sessions
|
|
184
|
+
If a child session is blocked on a tool approval and you're confident it's
|
|
185
|
+
safe, you can approve it directly:
|
|
186
|
+
|
|
187
|
+
\\\`\\\`\\\`bash
|
|
188
|
+
curl -s -X POST "http://localhost:$CODEKIN_PORT/api/orchestrator/sessions/SESSION_ID/respond" \\
|
|
189
|
+
-H "Authorization: Bearer $CODEKIN_AUTH_TOKEN" \\
|
|
190
|
+
-H "Content-Type: application/json" \\
|
|
191
|
+
-d '{"requestId": "REQUEST_ID", "value": "allow"}'
|
|
192
|
+
\\\`\\\`\\\`
|
|
193
|
+
|
|
194
|
+
Values: \\\`"allow"\\\`, \\\`"deny"\\\`, \\\`"always_allow"\\\`, or free text for question prompts.
|
|
195
|
+
|
|
196
|
+
**Guidelines for giving approvals:**
|
|
197
|
+
- Only approve tools you understand — if unsure, ask the user
|
|
198
|
+
- Prefer \\\`"allow"\\\` over \\\`"always_allow"\\\` for child sessions
|
|
199
|
+
- Never approve destructive commands (rm -rf, git push --force, DROP TABLE)
|
|
200
|
+
without user confirmation
|
|
201
|
+
- For question prompts, provide a reasonable answer or ask the user
|
|
202
|
+
- Log approvals you give to the journal so the user can review them
|
|
203
|
+
|
|
204
|
+
## Trust & Autonomy
|
|
205
|
+
You learn from user approvals:
|
|
206
|
+
- First time: always ASK before acting
|
|
207
|
+
- After 2 approvals of the same action pattern: NOTIFY and proceed
|
|
208
|
+
- After 5 approvals: proceed SILENTLY (log to journal)
|
|
209
|
+
- A single rejection resets trust for that action pattern
|
|
210
|
+
- High-severity actions (security, deploys) require more approvals
|
|
211
|
+
- The user can say "always do X" or "never auto-approve Y" to override
|
|
212
|
+
|
|
213
|
+
Be transparent about your trust level:
|
|
214
|
+
"I'm auto-approving this dependency update — you've approved the same
|
|
215
|
+
pattern 3 times before. Say 'stop' if you want me to ask first again."
|
|
216
|
+
|
|
217
|
+
## Self-Improving Memory
|
|
218
|
+
You learn and get smarter over time:
|
|
219
|
+
- After significant interactions, extract memory candidates (preferences,
|
|
220
|
+
decisions, repo context) and store them in your memory database
|
|
221
|
+
- Before storing, check for duplicates — update existing items if similar
|
|
222
|
+
- Track finding outcomes: when you act on or skip a finding, record what
|
|
223
|
+
happened so you can make better triage decisions next time
|
|
224
|
+
- Periodically review past decisions and assess their outcomes
|
|
225
|
+
- Build a user skill profile to adapt your guidance level
|
|
226
|
+
|
|
227
|
+
## User Skill Model
|
|
228
|
+
Observe signals about the user's skill level per domain:
|
|
229
|
+
- "new to React" → beginner in React, give detailed explanations
|
|
230
|
+
- Confidently uses advanced git → expert in git, keep it concise
|
|
231
|
+
- Adapt your guidance style based on the overall profile
|
|
232
|
+
- skill-profile.json tracks domains, levels, and evidence
|
|
233
|
+
|
|
234
|
+
## Trust Override Commands
|
|
235
|
+
Users can manage trust directly in chat:
|
|
236
|
+
- "Always auto-approve dependency updates" → pin to SILENT globally
|
|
237
|
+
- "Always ask before deploying" → pin deploy actions to ASK permanently
|
|
238
|
+
- "Show me what you're auto-approving" → list all NOTIFY+DO/SILENT records
|
|
239
|
+
- "Reset trust" → clear all learned trust, back to ASK for everything
|
|
240
|
+
|
|
241
|
+
## Rules
|
|
242
|
+
- **NEVER write code directly** — always spawn a session for implementation
|
|
243
|
+
- NEVER spawn sessions without user approval (until trust is earned)
|
|
244
|
+
- ALWAYS explain why you recommend (or skip) a finding
|
|
245
|
+
- ALWAYS ensure the final step (PR/push/deploy) is completed
|
|
246
|
+
- Be honest about uncertainty — if you're not sure, say so
|
|
247
|
+
- Keep your memory files tidy and up to date
|
|
248
|
+
- Log important actions and decisions to the journal
|
|
249
|
+
- When spawning sessions, always inform the user
|
|
250
|
+
- Record decisions and review their outcomes after a week
|
|
251
|
+
|
|
252
|
+
## On Startup
|
|
253
|
+
1. Read PROFILE.md for user context
|
|
254
|
+
2. Read REPOS.md for repo registry and policies
|
|
255
|
+
3. Read the last 3 journal entries (if any)
|
|
256
|
+
4. Read skill-profile.json for guidance style adaptation
|
|
257
|
+
5. Check for new audit reports that may have landed
|
|
258
|
+
6. Check for decisions pending outcome assessment
|
|
259
|
+
7. Greet the user with a brief, friendly status update
|
|
260
|
+
|
|
261
|
+
### Greeting Guidelines
|
|
262
|
+
Your greeting should:
|
|
263
|
+
- Briefly introduce yourself and what you do — including setting up AI workflows to audit code repositories
|
|
264
|
+
- Mention any pending reports or notable findings if they exist
|
|
265
|
+
- End with a **specific, actionable next step** — not a generic "what would you like to do?"
|
|
266
|
+
For example: "Want me to audit your repositories and propose audit workflows for the most recently active ones?"
|
|
267
|
+
- Keep it concise — 3-5 short paragraphs max
|
|
268
|
+
`;
|
|
269
|
+
/** Ensure the orchestrator workspace directory exists with starter files. */
|
|
270
|
+
export function ensureOrchestratorDir() {
|
|
271
|
+
// Create directories
|
|
272
|
+
if (!existsSync(ORCHESTRATOR_DIR))
|
|
273
|
+
mkdirSync(ORCHESTRATOR_DIR, { recursive: true });
|
|
274
|
+
const journalDir = join(ORCHESTRATOR_DIR, 'journal');
|
|
275
|
+
if (!existsSync(journalDir))
|
|
276
|
+
mkdirSync(journalDir, { recursive: true });
|
|
277
|
+
// Seed files only if they don't exist (preserve user edits)
|
|
278
|
+
const seeds = [
|
|
279
|
+
[join(ORCHESTRATOR_DIR, 'PROFILE.md'), PROFILE_TEMPLATE],
|
|
280
|
+
[join(ORCHESTRATOR_DIR, 'REPOS.md'), REPOS_TEMPLATE],
|
|
281
|
+
[join(ORCHESTRATOR_DIR, 'CLAUDE.md'), CLAUDE_MD_TEMPLATE],
|
|
282
|
+
];
|
|
283
|
+
for (const [path, content] of seeds) {
|
|
284
|
+
if (!existsSync(path))
|
|
285
|
+
writeFileSync(path, content, 'utf-8');
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
/** Get or create a stable session UUID that persists across restarts. */
|
|
289
|
+
export function getOrCreateOrchestratorId() {
|
|
290
|
+
if (existsSync(SESSION_ID_FILE)) {
|
|
291
|
+
const id = readFileSync(SESSION_ID_FILE, 'utf-8').trim();
|
|
292
|
+
if (id)
|
|
293
|
+
return id;
|
|
294
|
+
}
|
|
295
|
+
const id = randomUUID();
|
|
296
|
+
writeFileSync(SESSION_ID_FILE, id, 'utf-8');
|
|
297
|
+
return id;
|
|
298
|
+
}
|
|
299
|
+
/** Check if a session is the orchestrator session. */
|
|
300
|
+
export function isOrchestratorSession(source) {
|
|
301
|
+
return source === 'orchestrator';
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Ensure the orchestrator session exists and is running.
|
|
305
|
+
* Creates it if missing, starts Claude if not alive.
|
|
306
|
+
* Returns the orchestrator session ID.
|
|
307
|
+
*/
|
|
308
|
+
export function ensureOrchestratorRunning(sessions) {
|
|
309
|
+
ensureOrchestratorDir();
|
|
310
|
+
const stableId = getOrCreateOrchestratorId();
|
|
311
|
+
const ORCHESTRATOR_ALLOWED_TOOLS = ['Bash(curl:*)', 'CronCreate', 'CronDelete', 'CronList'];
|
|
312
|
+
// Check if session already exists
|
|
313
|
+
const existing = sessions.get(stableId);
|
|
314
|
+
if (existing) {
|
|
315
|
+
// Ensure allowedTools is up-to-date (may be missing if the session was
|
|
316
|
+
// created before CronCreate/Delete/List were added, or lost during
|
|
317
|
+
// a persistence round-trip).
|
|
318
|
+
if (!existing.allowedTools || existing.allowedTools.length === 0) {
|
|
319
|
+
existing.allowedTools = ORCHESTRATOR_ALLOWED_TOOLS;
|
|
320
|
+
sessions.persistToDisk();
|
|
321
|
+
}
|
|
322
|
+
// Session exists — start Claude if not alive
|
|
323
|
+
if (!existing.claudeProcess?.isAlive()) {
|
|
324
|
+
console.log('[orchestrator] Restarting orchestrator Claude process');
|
|
325
|
+
sessions.startClaude(stableId);
|
|
326
|
+
}
|
|
327
|
+
return stableId;
|
|
328
|
+
}
|
|
329
|
+
// Create the session
|
|
330
|
+
const displayName = getAgentDisplayName();
|
|
331
|
+
console.log(`[orchestrator] Creating Agent ${displayName} session`);
|
|
332
|
+
sessions.create(`Agent ${displayName}`, ORCHESTRATOR_DIR, {
|
|
333
|
+
source: 'orchestrator',
|
|
334
|
+
id: stableId,
|
|
335
|
+
permissionMode: 'acceptEdits',
|
|
336
|
+
allowedTools: ORCHESTRATOR_ALLOWED_TOOLS,
|
|
337
|
+
});
|
|
338
|
+
// Start Claude
|
|
339
|
+
sessions.startClaude(stableId);
|
|
340
|
+
return stableId;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Get the orchestrator session ID if it exists, or null.
|
|
344
|
+
*/
|
|
345
|
+
export function getOrchestratorSessionId(sessions) {
|
|
346
|
+
const stableId = existsSync(SESSION_ID_FILE)
|
|
347
|
+
? readFileSync(SESSION_ID_FILE, 'utf-8').trim()
|
|
348
|
+
: null;
|
|
349
|
+
if (!stableId)
|
|
350
|
+
return null;
|
|
351
|
+
return sessions.get(stableId) ? stableId : null;
|
|
352
|
+
}
|
|
353
|
+
//# sourceMappingURL=orchestrator-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator-manager.js","sourceRoot":"","sources":["../orchestrator-manager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAA;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAG/E,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAA;AAC9D,MAAM,eAAe,GAAG,IAAI,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAA;AAE7D,MAAM,gBAAgB,GAAG;;QAEjB,kBAAkB;;;;KAIrB,kBAAkB;;;KAGlB,kBAAkB;CACtB,CAAA;AAED,MAAM,cAAc,GAAG;;QAEf,kBAAkB;;;cA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IAED,qBAAqB;IACrB,MAAM,WAAW,GAAG,mBAAmB,EAAE,CAAA;IACzC,OAAO,CAAC,GAAG,CAAC,iCAAiC,WAAW,UAAU,CAAC,CAAA;IACnE,QAAQ,CAAC,MAAM,CAAC,SAAS,WAAW,EAAE,EAAE,gBAAgB,EAAE;QACxD,MAAM,EAAE,cAAc;QACtB,EAAE,EAAE,QAAQ;QACZ,cAAc,EAAE,aAAa;QAC7B,YAAY,EAAE,0BAA0B;KACzC,CAAC,CAAA;IAEF,eAAe;IACf,QAAQ,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;IAC9B,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,QAAwB;IAC/D,MAAM,QAAQ,GAAG,UAAU,CAAC,eAAe,CAAC;QAC1C,CAAC,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE;QAC/C,CAAC,CAAC,IAAI,CAAA;IACR,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAA;IAC1B,OAAO,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAA;AACjD,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orchestrator memory store — SQLite + FTS5 for structured, searchable memory.
|
|
3
|
+
*
|
|
4
|
+
* Provides durable memory across restarts with full-text search retrieval,
|
|
5
|
+
* trust record tracking, and automatic expiry/aging of stale items.
|
|
6
|
+
*/
|
|
7
|
+
export type MemoryType = 'user_preference' | 'repo_context' | 'decision' | 'finding_outcome' | 'session_summary' | 'journal';
|
|
8
|
+
export interface MemoryItem {
|
|
9
|
+
id: string;
|
|
10
|
+
memoryType: MemoryType;
|
|
11
|
+
scope: string | null;
|
|
12
|
+
title: string | null;
|
|
13
|
+
content: string;
|
|
14
|
+
sourceRef: string | null;
|
|
15
|
+
confidence: number;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
updatedAt: string;
|
|
18
|
+
expiresAt: string | null;
|
|
19
|
+
isPinned: boolean;
|
|
20
|
+
tags: string[];
|
|
21
|
+
}
|
|
22
|
+
export type TrustLevel = 'ask' | 'notify_do' | 'silent';
|
|
23
|
+
export interface TrustRecord {
|
|
24
|
+
id: string;
|
|
25
|
+
action: string;
|
|
26
|
+
category: string;
|
|
27
|
+
severity: string;
|
|
28
|
+
repo: string | null;
|
|
29
|
+
approvalCount: number;
|
|
30
|
+
rejectionCount: number;
|
|
31
|
+
lastApprovedAt: string | null;
|
|
32
|
+
lastRejectedAt: string | null;
|
|
33
|
+
pinnedLevel: TrustLevel | null;
|
|
34
|
+
}
|
|
35
|
+
export declare class OrchestratorMemory {
|
|
36
|
+
private db;
|
|
37
|
+
constructor(dbPath?: string);
|
|
38
|
+
private createTables;
|
|
39
|
+
/** Insert or update a memory item. */
|
|
40
|
+
upsert(item: Omit<MemoryItem, 'id' | 'createdAt' | 'updatedAt'> & {
|
|
41
|
+
id?: string;
|
|
42
|
+
}): string;
|
|
43
|
+
/** Delete a memory item by ID. */
|
|
44
|
+
delete(id: string): boolean;
|
|
45
|
+
/** Get a memory item by ID. */
|
|
46
|
+
get(id: string): MemoryItem | null;
|
|
47
|
+
/** List memory items with optional filters. */
|
|
48
|
+
list(filters?: {
|
|
49
|
+
memoryType?: MemoryType;
|
|
50
|
+
scope?: string | null;
|
|
51
|
+
pinnedOnly?: boolean;
|
|
52
|
+
limit?: number;
|
|
53
|
+
}): MemoryItem[];
|
|
54
|
+
/** Full-text search across memory items. */
|
|
55
|
+
search(query: string, limit?: number): MemoryItem[];
|
|
56
|
+
/** Remove expired items. */
|
|
57
|
+
expireStale(): number;
|
|
58
|
+
/** Get or create a trust record for an action pattern. */
|
|
59
|
+
getTrust(action: string, category: string, repo: string | null): TrustRecord;
|
|
60
|
+
/** Record a user approval for an action pattern. */
|
|
61
|
+
recordApproval(action: string, category: string, repo: string | null): TrustRecord;
|
|
62
|
+
/** Record a user rejection — resets trust to ASK level. */
|
|
63
|
+
recordRejection(action: string, category: string, repo: string | null): TrustRecord;
|
|
64
|
+
/** Pin a trust record to a specific level (user override). */
|
|
65
|
+
pinTrust(action: string, category: string, repo: string | null, level: TrustLevel): void;
|
|
66
|
+
/** Reset all trust records back to ASK. */
|
|
67
|
+
resetAllTrust(): void;
|
|
68
|
+
/** Compute the effective trust level for an action. */
|
|
69
|
+
computeTrustLevel(action: string, category: string, severity: string, repo: string | null): TrustLevel;
|
|
70
|
+
/** List all trust records with their effective levels. */
|
|
71
|
+
listTrustRecords(): (TrustRecord & {
|
|
72
|
+
effectiveLevel: TrustLevel;
|
|
73
|
+
})[];
|
|
74
|
+
close(): void;
|
|
75
|
+
private rowToItem;
|
|
76
|
+
private rowToTrust;
|
|
77
|
+
}
|