@onepointfour-packs/flaredeck-agent 0.2.209 → 0.2.211
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/dist/agent.js +2 -1
- package/dist/agent.js.map +1 -1
- package/dist/assistant.d.ts +1 -1
- package/dist/assistant.js +4 -2
- package/dist/assistant.js.map +1 -1
- package/dist/check.d.ts +32 -0
- package/dist/check.js +251 -0
- package/dist/check.js.map +1 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.js.map +1 -1
- package/dist/environment.d.ts +13 -3
- package/dist/environment.js +25 -15
- package/dist/environment.js.map +1 -1
- package/dist/envtools.d.ts +29 -0
- package/dist/envtools.js +67 -5
- package/dist/envtools.js.map +1 -1
- package/dist/features/card-folder.d.ts +69 -0
- package/dist/features/card-folder.js +305 -0
- package/dist/features/card-folder.js.map +1 -0
- package/dist/features/chat.d.ts +45 -0
- package/dist/features/chat.js +90 -0
- package/dist/features/chat.js.map +1 -0
- package/dist/features/dispatch.d.ts +55 -0
- package/dist/features/dispatch.js +101 -0
- package/dist/features/dispatch.js.map +1 -0
- package/dist/features/hand-back.d.ts +60 -0
- package/dist/features/hand-back.js +127 -0
- package/dist/features/hand-back.js.map +1 -0
- package/dist/features/manage-pane.d.ts +31 -0
- package/dist/features/manage-pane.js +60 -0
- package/dist/features/manage-pane.js.map +1 -0
- package/dist/features/release-wiring.d.ts +18 -0
- package/dist/features/release-wiring.js +56 -0
- package/dist/features/release-wiring.js.map +1 -0
- package/dist/features/services.d.ts +45 -0
- package/dist/features/services.js +147 -0
- package/dist/features/services.js.map +1 -0
- package/dist/features/sign-in-request.d.ts +81 -0
- package/dist/features/sign-in-request.js +91 -0
- package/dist/features/sign-in-request.js.map +1 -0
- package/dist/github.d.ts +14 -0
- package/dist/github.js +39 -8
- package/dist/github.js.map +1 -1
- package/dist/harness/events.d.ts +58 -0
- package/dist/harness/events.js +126 -0
- package/dist/harness/events.js.map +1 -0
- package/dist/harness/handover.d.ts +39 -0
- package/dist/harness/handover.js +63 -0
- package/dist/harness/handover.js.map +1 -0
- package/dist/harness/pause.d.ts +67 -0
- package/dist/harness/pause.js +128 -0
- package/dist/harness/pause.js.map +1 -0
- package/dist/harness/plan-usage.d.ts +49 -0
- package/dist/harness/plan-usage.js +69 -0
- package/dist/harness/plan-usage.js.map +1 -0
- package/dist/harness/prompt.d.ts +59 -0
- package/dist/harness/prompt.js +289 -0
- package/dist/harness/prompt.js.map +1 -0
- package/dist/harness/repo-notes.d.ts +1 -0
- package/dist/harness/repo-notes.js +26 -0
- package/dist/harness/repo-notes.js.map +1 -0
- package/dist/harness/restarter.d.ts +33 -0
- package/dist/harness/restarter.js +78 -0
- package/dist/harness/restarter.js.map +1 -0
- package/dist/harness/start-scripts.d.ts +7 -0
- package/dist/harness/start-scripts.js +44 -0
- package/dist/harness/start-scripts.js.map +1 -0
- package/dist/harness/tools.d.ts +37 -0
- package/dist/harness/tools.js +17 -0
- package/dist/harness/tools.js.map +1 -0
- package/dist/hydrate.d.ts +5 -0
- package/dist/hydrate.js +1 -0
- package/dist/hydrate.js.map +1 -1
- package/dist/main.js +32 -1
- package/dist/main.js.map +1 -1
- package/dist/profile.d.ts +80 -0
- package/dist/profile.js +77 -0
- package/dist/profile.js.map +1 -0
- package/dist/release.js +3 -0
- package/dist/release.js.map +1 -1
- package/dist/sandbox.js +3 -1
- package/dist/sandbox.js.map +1 -1
- package/dist/serve.d.ts +21 -115
- package/dist/serve.js +971 -1612
- package/dist/serve.js.map +1 -1
- package/dist/stream.d.ts +5 -0
- package/dist/stream.js.map +1 -1
- package/dist/workspace.d.ts +6 -0
- package/dist/workspace.js +19 -0
- package/dist/workspace.js.map +1 -1
- package/dist/worktree.d.ts +55 -2
- package/dist/worktree.js +130 -5
- package/dist/worktree.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { assistantBrief } from '../assistant.js';
|
|
2
|
+
import { freeWorkerBrief } from '../features/dispatch.js';
|
|
3
|
+
/**
|
|
4
|
+
* What the agent is actually asked.
|
|
5
|
+
*
|
|
6
|
+
* The event's own one-line rendering is the instruction — it already says what happened and to
|
|
7
|
+
* whom — with only enough added to make clear that acting is expected and that stopping quietly
|
|
8
|
+
* is not an option.
|
|
9
|
+
*/
|
|
10
|
+
/** What a pull request should target — the repo's own default, not a guess. */
|
|
11
|
+
/**
|
|
12
|
+
* A few words for the pane from a needs-human reason: its first sentence, without a leading
|
|
13
|
+
* "1." — a reason written as a numbered list was shown as "waiting on a person (1)".
|
|
14
|
+
*/
|
|
15
|
+
export function parkLabel(reason) {
|
|
16
|
+
const plain = reason.replace(/\*\*/g, '').replace(/^[\s#*>-]*(?:\d+[.)]\s*)?/, '');
|
|
17
|
+
const first = plain.split(/(?<=[a-z0-9)])[.?!](?:\s|$)|\n/i)[0] ?? '';
|
|
18
|
+
return first.trim().slice(0, 60) || 'an agent asked for help';
|
|
19
|
+
}
|
|
20
|
+
export const LEAD_SWEEP_GOAL = 'Every card that get-portfolio (state todo) lists for your boards has been dealt with: handed to ' +
|
|
21
|
+
'a worker that reports to you and is free, with assign-card, or left where it is with a one-line ' +
|
|
22
|
+
'reason it must wait (no free worker, blocked, waiting on a person). You dispatch; you do not ' +
|
|
23
|
+
'build cards yourself. The goal is met when your most recent turn called get-portfolio with ' +
|
|
24
|
+
'state todo and you quoted how many cards it listed and, for each one still unassigned, its ' +
|
|
25
|
+
'one-line reason. One call is enough: do not call get-portfolio again to re-check a list that ' +
|
|
26
|
+
'has not changed. The harness ends this after 8 turns whatever the state of the goal.';
|
|
27
|
+
/**
|
|
28
|
+
* What a manager is told on every turn, on top of its own description in FlareDeck.
|
|
29
|
+
*
|
|
30
|
+
* It says what this harness gives a manager TODAY and, as plainly, what it does not yet stop:
|
|
31
|
+
* the approval, heads-up and escalation steps of docs/spec-manager-role.md are not built, so the
|
|
32
|
+
* limits below are instructions rather than guards. They come out as each guard goes in.
|
|
33
|
+
*/
|
|
34
|
+
export const MANAGER_BRIEF = '\n\nYou are a MANAGER, not a worker. Nobody above you hands you cards or reviews them; you ' +
|
|
35
|
+
'answer to the person named in your description.\n' +
|
|
36
|
+
' · `list-agents` shows your teams — the leads that report to you and their agents — what each ' +
|
|
37
|
+
'is working on, how long since it checked in, and the machine it runs on (disk, memory, load, ' +
|
|
38
|
+
'what is wrong there).\n' +
|
|
39
|
+
' · `machine-exec` runs a command on one of those agents\' machines, as that agent\'s user: ' +
|
|
40
|
+
'read a log, see what is running, restore a missing file, stop servers a dead checkout left ' +
|
|
41
|
+
'behind. It runs under YOUR judgement, not the worker\'s guards, and every call is recorded.\n' +
|
|
42
|
+
'Your job is to unblock: do not build a worker\'s card for it. When an agent is stuck, find out ' +
|
|
43
|
+
'why and fix the cause, or tell its lead what you found.\n' +
|
|
44
|
+
'Your teams\' TECHNICAL, ACCESS and INFORMATION questions come to you before any person; ' +
|
|
45
|
+
'product, design and client questions go straight to the person the board names, and are not ' +
|
|
46
|
+
'yours. When one arrives, read the card and settle it if you can: look the answer up, fix the ' +
|
|
47
|
+
'machine, or answer from what the board already decided — then say so on the card and ' +
|
|
48
|
+
'clear-needs-human, so the agent carries on. If it turns out to need a person, pass it up: ' +
|
|
49
|
+
'set-needs-human on that card with the question, its options, your recommendation, and the kind ' +
|
|
50
|
+
'of question it really is. It goes to the person the board names for that kind.\n' +
|
|
51
|
+
'MERGING AND PROMOTING go through the `release` tool, and only through it. The board decides who may ' +
|
|
52
|
+
'release into each environment and who must agree first, and the tool enforces that and asks them ' +
|
|
53
|
+
'by itself — so do NOT ask a person for a merge or promote the board already lets you do, and do not ' +
|
|
54
|
+
'write merge scripts or keep a clone for them. If release refuses, its reason is the answer.\n' +
|
|
55
|
+
'NOT YET GUARDED HERE, so until it is, you do not do these without the person\'s say-so, asked ' +
|
|
56
|
+
'for with set-needs-human naming the exact action: deploying to production by any route other than ' +
|
|
57
|
+
'release; deleting directories, checkouts or data on a shared machine; changing board settings, ' +
|
|
58
|
+
'access or credentials; moving a card out of Backlog or a hidden lane.' +
|
|
59
|
+
'\n · A place of your own that outlives any card: `~/.config/flaredeck-agent/scratch/`. Your ' +
|
|
60
|
+
'card\'s checkout is for that card; do not make clones anywhere else.';
|
|
61
|
+
/** A manager's regular check is of its TEAMS, not of cards assigned to it. */
|
|
62
|
+
export const MANAGER_SWEEP_BRIEF = '\n\nThis check is of your teams. Call `list-agents`. Look for: an agent with no word for a long ' +
|
|
63
|
+
'time, or stopped; one stuck on the same card with work queued behind it; a machine short of ' +
|
|
64
|
+
'disk or memory, or an agent running in a bare SSH session; a question to a person that has ' +
|
|
65
|
+
'waited long. Act on what you can fix yourself within the limits above. If everything is in ' +
|
|
66
|
+
'order, say so in one line and stop — do not message anyone to report that nothing happened.';
|
|
67
|
+
/** For a lead handed a card in a folder with no code of its own. See leadWithoutCode. */
|
|
68
|
+
/** For an agent whose profile does not change code (an analyst): what its work is instead. */
|
|
69
|
+
export const READ_ONLY_BRIEF = '\n\n## You read code; you do not change it\n\n' +
|
|
70
|
+
'Your work here is understanding and writing it down for whoever builds it. Read the repository ' +
|
|
71
|
+
'to see how things actually work, then write the result where people and agents will use it: a new ' +
|
|
72
|
+
'card with create-card, a sharper description or story on an existing one (set-card-description, ' +
|
|
73
|
+
'set-card-story), or a comment that answers the question asked. Name the files, functions and data ' +
|
|
74
|
+
'involved, what must change and what must not, and how someone would know it is done.\n\n' +
|
|
75
|
+
'Do not edit files, commit, branch or publish: you have no checkout of your own, and anything ' +
|
|
76
|
+
'written outside scratch space is refused. If a card needs code changed, say so on it — building it ' +
|
|
77
|
+
'is someone else\'s job.\n';
|
|
78
|
+
export const LEAD_WITHOUT_CODE_BRIEF = '\n\nYou have no checkout of this card\'s code here, so you cannot build it yourself — and you ' +
|
|
79
|
+
'do not need to: you lead. Hand it to a worker who reports to you and is free, with assign-card ' +
|
|
80
|
+
'and a one-line note of what is wanted. If none is free, say so on the card and leave it assigned ' +
|
|
81
|
+
'to you; do not ask a person to set up a repository.';
|
|
82
|
+
/**
|
|
83
|
+
* An event that waited behind other work says so. Norm (15 Oct): "by the time I act, the thing has
|
|
84
|
+
* often already been done" — it re-checked everything before every action, not knowing which
|
|
85
|
+
* events were fresh. Only past a few minutes; a fresh one needs no warning.
|
|
86
|
+
*/
|
|
87
|
+
export function waitedNote(event, now = Date.now()) {
|
|
88
|
+
const m = event.receivedAt ? Math.round((now - event.receivedAt) / 60_000) : 0;
|
|
89
|
+
if (m < 3)
|
|
90
|
+
return '';
|
|
91
|
+
const age = m < 90 ? `${m} minutes` : `${Math.round(m / 60)} hours`;
|
|
92
|
+
return `(This arrived ${age} ago and waited behind other work. Check the card's lane and newest comments, and the branch, before acting: it may already be done.)\n\n`;
|
|
93
|
+
}
|
|
94
|
+
/** A card assigned to a lead in a lane where work has not started: the lead hands it out. */
|
|
95
|
+
export function isLeadDispatch(event, isLead) {
|
|
96
|
+
if (!isLead || event.event !== 'assigned')
|
|
97
|
+
return false;
|
|
98
|
+
return !/doing|progress|review|test|deploy|await|release|waiting|done/i.test(String(event.laneName ?? ''));
|
|
99
|
+
}
|
|
100
|
+
export function prompt(event, isLead = false) {
|
|
101
|
+
/* A person giving the lead a card is giving it to the TEAM. JARVIS was assigned six cards at once
|
|
102
|
+
(19 Oct) and tried to start four itself, refused each time by the one-card rule. */
|
|
103
|
+
if (isLeadDispatch(event, isLead)) {
|
|
104
|
+
return [
|
|
105
|
+
`${event.line}`,
|
|
106
|
+
'',
|
|
107
|
+
'This card is on you to HAND OUT, not to do. Read it with get-card-details, then one of:',
|
|
108
|
+
'- It is clear and wanted: assign it to a free worker with assign-card (list-agents shows who is',
|
|
109
|
+
' free and what each holds). Say on the card who has it and why, in one line.',
|
|
110
|
+
'- It needs a product or business decision first: ask with set-needs-human (short question,',
|
|
111
|
+
' options), and leave it unassigned to a worker until it is answered.',
|
|
112
|
+
'- No worker is free: leave it where it is; workers take the next card themselves.',
|
|
113
|
+
'',
|
|
114
|
+
'Do not move it to Doing and do not start building it yourself.',
|
|
115
|
+
].join('\n');
|
|
116
|
+
}
|
|
117
|
+
if (event.event === 'sweep') {
|
|
118
|
+
return [
|
|
119
|
+
'Nothing has arrived for a while, so this is a check of what you already hold. It is a',
|
|
120
|
+
'HANDOVER, not a working turn: you find the next piece of work and start it moving, and it',
|
|
121
|
+
'comes back to you properly a moment later.',
|
|
122
|
+
'',
|
|
123
|
+
'Call get-outstanding. It lists the cards assigned to you that are not done, and the comments',
|
|
124
|
+
'addressed to you that nobody has actioned.',
|
|
125
|
+
'',
|
|
126
|
+
...(isLead
|
|
127
|
+
? [
|
|
128
|
+
'Then call get-portfolio, because get-outstanding only ever shows what is assigned to',
|
|
129
|
+
'YOU. A card assigned to nobody is on no outstanding list anywhere — not yours, not any',
|
|
130
|
+
'worker\'s — so it is invisible to the whole team for as long as it stays that way. Four',
|
|
131
|
+
'bugs sat in a column unassigned while every agent reported itself idle.',
|
|
132
|
+
'',
|
|
133
|
+
'Anything actionable with no assignee is yours to place: give it to a worker with',
|
|
134
|
+
'assign-card, newest bugs first. A worker can be given several cards that have not',
|
|
135
|
+
'started: they queue, and it takes them one at a time. Spread them about evenly.',
|
|
136
|
+
'',
|
|
137
|
+
'Then look at the balance. list_agents shows what each one holds and how many are',
|
|
138
|
+
'queued behind it. Where one worker has several cards waiting and another has none,',
|
|
139
|
+
'move a card across with assign-card: a card queued behind a busy agent is not being',
|
|
140
|
+
'worked, and the idle one could finish it today.',
|
|
141
|
+
'',
|
|
142
|
+
'Each agent is shown with the repository it has checked out. Move a card only to an',
|
|
143
|
+
'agent that has the repository the card is for — on a board where everyone works the',
|
|
144
|
+
'same one they are interchangeable, and on a board with a ui agent and an api agent',
|
|
145
|
+
'they are not.',
|
|
146
|
+
'',
|
|
147
|
+
]
|
|
148
|
+
: []),
|
|
149
|
+
'If it returns nothing, say so in one line and stop. That is a perfectly good outcome and',
|
|
150
|
+
'costs nothing — do NOT go looking for work elsewhere, do not scan logs, and do not invent a',
|
|
151
|
+
'task to justify the turn.',
|
|
152
|
+
'',
|
|
153
|
+
'Otherwise take the FIRST one by priority and, depending on what it is:',
|
|
154
|
+
'',
|
|
155
|
+
'- A card for one of the agents who report to you: assign it to the right one. That dispatch',
|
|
156
|
+
' IS the work, and this turn is done.',
|
|
157
|
+
'- A card that is yours and NOT already in progress: hand it to a worker if you have one free,',
|
|
158
|
+
' with assign-card. You run one turn at a time, and a card takes minutes — for all of them you',
|
|
159
|
+
' would be unable to assign anything or answer anyone, which is the one job only you can do.',
|
|
160
|
+
' With nobody free, move it to the board\'s in-progress lane with update-card-status and stop:',
|
|
161
|
+
' that hands it back to you as a card of its own, with a checkout and a branch, which is the',
|
|
162
|
+
' only place work can be done and published from. Either way, stop here — reading it, starting',
|
|
163
|
+
' it or commenting on it in this turn all edit the shared checkout, which publishes nowhere.',
|
|
164
|
+
'- A card already in progress: say which one in a line, and stop. The harness picks those up',
|
|
165
|
+
' by itself, shortly, with a checkout of its own — you do not need to do anything for it.',
|
|
166
|
+
'',
|
|
167
|
+
'Then stop. One handover per check — the rest are still there next time.',
|
|
168
|
+
].join('\n');
|
|
169
|
+
}
|
|
170
|
+
if (event.event === 'ask') {
|
|
171
|
+
return [
|
|
172
|
+
'The person watching this pane typed a question for you:',
|
|
173
|
+
'',
|
|
174
|
+
event.line,
|
|
175
|
+
'',
|
|
176
|
+
'Answer it here, in the pane, briefly and concretely — they are reading this terminal, not a',
|
|
177
|
+
'card. Use your FlareDeck tools to look things up: list-boards and get-board-info for the',
|
|
178
|
+
'board and its columns, get-cards-by-column for what sits in a column, get-card-details and',
|
|
179
|
+
'get-outstanding for who holds a card and whether anyone is on it, read-messages for a',
|
|
180
|
+
'thread. Look, then say what you found. Do NOT change anything — no comments, no moves, no',
|
|
181
|
+
'claims, no assignments, no needs-human — unless the question explicitly asks you to do it.',
|
|
182
|
+
].join('\n');
|
|
183
|
+
}
|
|
184
|
+
if (event.event === 'scheduled') {
|
|
185
|
+
return [
|
|
186
|
+
`A scheduled task has come due: "${event.scheduleName || 'unnamed'}". A person approved this schedule,`,
|
|
187
|
+
'and FlareDeck is running it now. It is not a card — do what it says and report the result where it',
|
|
188
|
+
'says to (an email, a message, a comment). If it names nobody or nowhere to report, post a comment',
|
|
189
|
+
'on the most relevant card or send a direct message to the person who would care.',
|
|
190
|
+
'',
|
|
191
|
+
'The instruction:',
|
|
192
|
+
'',
|
|
193
|
+
event.prompt || event.message || event.line,
|
|
194
|
+
'',
|
|
195
|
+
'You have no memory of earlier runs, and nothing here may be undone by waiting: act, then finish.',
|
|
196
|
+
'Do not create further schedules from this run.',
|
|
197
|
+
].join('\n');
|
|
198
|
+
}
|
|
199
|
+
// Card intake (docs/spec-card-intake.md): this agent is the board's reviewer of new cards.
|
|
200
|
+
if (event.event === 'intake') {
|
|
201
|
+
return [
|
|
202
|
+
'You are this board\'s intake reviewer. A card is waiting for you in the review lane:',
|
|
203
|
+
'',
|
|
204
|
+
event.line,
|
|
205
|
+
'',
|
|
206
|
+
'Read it with get-card-details. Your one question: could an agent work it as written? It needs',
|
|
207
|
+
'WHAT should change, WHERE (the screen, in the menu\'s words), and HOW YOU WOULD KNOW it is done;',
|
|
208
|
+
'for a bug, how to make it happen. Look in the code (find_code) before deciding something is',
|
|
209
|
+
'unclear — "the Goals page" may be obvious once you look.',
|
|
210
|
+
'',
|
|
211
|
+
'Then one review-card decision, and stop:',
|
|
212
|
+
'- Clear already: pass, with a one-line note.',
|
|
213
|
+
'- Clear enough to make clear: rewrite it first — set-card-description (keep the person\'s own',
|
|
214
|
+
' words under a "Reported as" line), set-card-story with its "Done when", set-card-meta parts —',
|
|
215
|
+
' then pass.',
|
|
216
|
+
'- Not clear: ask — ONE comment with every question in it, short, in plain words. At most two',
|
|
217
|
+
' rounds; after that leave a one-line note of what is missing and stop. Do not chase.',
|
|
218
|
+
'- A worker\'s proposal (it says "Proposed by an agent"): pass it if it is real separate work,',
|
|
219
|
+
' merge it into the card it belongs on, or decline it saying why.',
|
|
220
|
+
'',
|
|
221
|
+
'You review; you do not do the work, assign it, or start it. A card it was suggested to edit',
|
|
222
|
+
'shows the suggestion: apply it with set-card-description if it is right.',
|
|
223
|
+
].join('\n');
|
|
224
|
+
}
|
|
225
|
+
if (event.event === 'review') {
|
|
226
|
+
return [
|
|
227
|
+
'A worker that reports to you is asking to run a script against production, and it cannot',
|
|
228
|
+
'go to a person until you have reviewed it:',
|
|
229
|
+
'',
|
|
230
|
+
event.line,
|
|
231
|
+
'',
|
|
232
|
+
'Read the card with get-card-details. The request is the newest comment carrying an approval,',
|
|
233
|
+
'with its comment id, the script, the worker\'s own account of it, and the harness\'s row-count',
|
|
234
|
+
'preview. Check that the WHERE clause matches the stated purpose and that the preview matches',
|
|
235
|
+
'the expected effect. Then call review_script with that comment id: endorse, and the',
|
|
236
|
+
'people who can approve it are asked; reject, and the worker is refused with your note. Do not',
|
|
237
|
+
'dispatch, re-assign, or change anything else — this is a review, not a card to work.',
|
|
238
|
+
].join('\n');
|
|
239
|
+
}
|
|
240
|
+
// A card the HARNESS picked back up because it sits in progress with this agent's name on it.
|
|
241
|
+
// Finished work left there comes back on every check and blocks every other card.
|
|
242
|
+
const resumed = String(event.id ?? '').startsWith('resume-')
|
|
243
|
+
? ['', 'You were handed this card again only because it is still in an in-progress lane assigned to',
|
|
244
|
+
'you. If its work is already finished — answered, delivered, nothing left for you — move it on to',
|
|
245
|
+
'its next lane with update-card-status NOW. Left in progress, it is handed back to you on every',
|
|
246
|
+
'check and FlareDeck will not let you start any other card. If it is waiting on a PERSON and you',
|
|
247
|
+
'may not move it yourself, call set-needs-human saying what they need to do — a card waiting on a',
|
|
248
|
+
'person is not handed back to you, and their answer wakes you.']
|
|
249
|
+
: [];
|
|
250
|
+
/* The event's one line quotes a message or comment only up to 200 characters, then says
|
|
251
|
+
"(truncated — read-messages for the full text)". The event itself carries the full text, and
|
|
252
|
+
the model was never given it: a person's longer instructions arrived cut ("his message reached
|
|
253
|
+
me cut off after 'for every c…'"), the fetch for the rest failed, and the agent acted on a
|
|
254
|
+
guess. When the line was cut, the full text goes in the prompt. */
|
|
255
|
+
const full = event.message && /\(truncated — /.test(event.line ?? '')
|
|
256
|
+
? ['', 'The full text of that message:', '', ...String(event.message).split('\n').map((l) => `> ${l}`)]
|
|
257
|
+
: [];
|
|
258
|
+
return [
|
|
259
|
+
`A FlareDeck event just arrived for you:`,
|
|
260
|
+
'',
|
|
261
|
+
event.line,
|
|
262
|
+
...full,
|
|
263
|
+
...resumed,
|
|
264
|
+
'',
|
|
265
|
+
'Deal with it. Read the card before you change anything — INCLUDING its agent notes, where a',
|
|
266
|
+
'previous session may have left a handover: what it got to, what it tried that failed,',
|
|
267
|
+
'what about this environment cost it time. Those notes are the CARD\'s, and the last agent',
|
|
268
|
+
'to work it wrote them — the card says who. If that was not you, the "I" in them is that',
|
|
269
|
+
'agent: use them to know where the card stands, never as your own history, and never as',
|
|
270
|
+
'your own comments or your own lessons. Keep your todo list in step with the',
|
|
271
|
+
'work, and comment on the card so a person can follow what you did. If you cannot finish —',
|
|
272
|
+
'you need a decision, an approval, or something is blocking you — call set-needs-human and say',
|
|
273
|
+
'what you need. Nobody is watching this terminal, so stopping without saying so is the one',
|
|
274
|
+
'thing that does not work.',
|
|
275
|
+
].join('\n');
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* The parts of a turn's brief that depend on what kind of agent this is, by feature: a lead's
|
|
279
|
+
* (a worker free, a card with no code here), a manager's, a chat with one person, and one that
|
|
280
|
+
* does not change code. In this order, after the card's own brief.
|
|
281
|
+
*/
|
|
282
|
+
export function roleBriefs(p, o) {
|
|
283
|
+
return ((p.dispatch ? freeWorkerBrief(o.event) : '') + (o.leadWithoutCode ? LEAD_WITHOUT_CODE_BRIEF : '') +
|
|
284
|
+
(o.queuedBehind ? `\n\nThis card is QUEUED behind ${o.queuedBehind}, which you are working now. Reply to what was said here if it needs a reply, and stop: do not start this card's work, change its code or move it. It is handed to you when ${o.queuedBehind} is done.` : '') +
|
|
285
|
+
(p.manage ? MANAGER_BRIEF + (o.event.event === 'sweep' ? MANAGER_SWEEP_BRIEF : '') : '') +
|
|
286
|
+
(o.chat ? assistantBrief(o.person, p.kind === 'general' ? 'general' : 'assistant') : '') +
|
|
287
|
+
(p.code ? '' : READ_ONLY_BRIEF));
|
|
288
|
+
}
|
|
289
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/harness/prompt.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAwB,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;;;;;GAMG;AACH,+EAA+E;AAC/E;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,MAAc;IACtC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,2BAA2B,EAAE,EAAE,CAAC,CAAC;IACnF,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACtE,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,yBAAyB,CAAC;AAChE,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAC1B,kGAAkG;IAClG,kGAAkG;IAClG,+FAA+F;IAC/F,6FAA6F;IAC7F,6FAA6F;IAC7F,+FAA+F;IAC/F,sFAAsF,CAAC;AAEzF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GACxB,6FAA6F;IAC7F,mDAAmD;IACnD,iGAAiG;IACjG,+FAA+F;IAC/F,yBAAyB;IACzB,8FAA8F;IAC9F,6FAA6F;IAC7F,+FAA+F;IAC/F,iGAAiG;IACjG,2DAA2D;IAC3D,0FAA0F;IAC1F,8FAA8F;IAC9F,+FAA+F;IAC/F,uFAAuF;IACvF,4FA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AI,CAAC,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,CAAU,EAAE,CAStC;IACC,OAAO,CACL,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,CAAC;QACjG,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,YAAY,+KAA+K,CAAC,CAAC,YAAY,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;QAChR,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACxF,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACxF,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,CAChC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function repoNotes(repositories: string[], fetchNotes: (repositories: string[]) => Promise<Record<string, string>>): Promise<string>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The agent's own notes on a card's repositories, for the turn's brief.
|
|
3
|
+
*
|
|
4
|
+
* An agent's general memory is 400 words and loads into every session, which is tight for one
|
|
5
|
+
* that works several repositories: what it learns about the Intranet API's local run and the CMS's
|
|
6
|
+
* area config crowds out everything else. So each repository has notes of its own (`remember` with
|
|
7
|
+
* `repository`, 400 words each), kept on the account, and a card brings only the notes on the
|
|
8
|
+
* repositories it touches — its own and the others in its folder.
|
|
9
|
+
*/
|
|
10
|
+
import { shortName } from '../workspace.js';
|
|
11
|
+
/** `owner/name`, lower-cased, as the notes are kept. */
|
|
12
|
+
const keyOf = (url) => shortName(url).toLowerCase();
|
|
13
|
+
export async function repoNotes(repositories, fetchNotes) {
|
|
14
|
+
const keys = [...new Set(repositories.filter(Boolean).map(keyOf).filter((k) => k.includes('/')))];
|
|
15
|
+
if (!keys.length)
|
|
16
|
+
return '';
|
|
17
|
+
const got = await fetchNotes(keys);
|
|
18
|
+
const have = keys.filter((k) => got[k]?.trim());
|
|
19
|
+
const none = keys.filter((k) => !got[k]?.trim());
|
|
20
|
+
return (`\n\n## Your notes on these repositories\n\n` +
|
|
21
|
+
(have.length ? `${have.map((k) => `### ${k}\n\n${got[k].trim()}`).join('\n\n')}\n\n` : '') +
|
|
22
|
+
`${none.length ? `None yet on ${none.join(', ')}. ` : ''}A lesson about one of these repositories — how it runs, a ` +
|
|
23
|
+
`convention, a trap — goes in its own notes: \`remember\` with \`repository\` set to it (owner/name). ` +
|
|
24
|
+
`They are 400 words each and load only with its cards, so keep your general memory for what is true everywhere.`);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=repo-notes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo-notes.js","sourceRoot":"","sources":["../../src/harness/repo-notes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,wDAAwD;AACxD,MAAM,KAAK,GAAG,CAAC,GAAW,EAAU,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;AAEpE,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,YAAsB,EACtB,UAAuE;IAEvE,MAAM,IAAI,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAClG,IAAI,CAAC,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IAC5B,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,OAAO,CACL,6CAA6C;QAC7C,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,GAAG,CAAC,CAAC,CAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3F,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,4DAA4D;QACpH,uGAAuG;QACvG,gHAAgH,CACjH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Minutes before trying a failed harness install again: 10 min, 30 min, 2h, then every 6h. */
|
|
2
|
+
export declare const INSTALL_BACKOFF_MIN: number[];
|
|
3
|
+
export type RestarterDeps = {
|
|
4
|
+
log: (kind: 'tool' | 'warn', text: string) => void;
|
|
5
|
+
/** What the agent is doing right now. */
|
|
6
|
+
busy: () => {
|
|
7
|
+
stopping: boolean;
|
|
8
|
+
working: boolean;
|
|
9
|
+
queued: number;
|
|
10
|
+
live: number;
|
|
11
|
+
};
|
|
12
|
+
/** Stop the normal way; the process then relaunches into `relaunchTo()`. */
|
|
13
|
+
shutdown: () => void;
|
|
14
|
+
/** Carry on with the queue that was held for a restart that did not happen. */
|
|
15
|
+
resume: () => void;
|
|
16
|
+
running?: string;
|
|
17
|
+
enabled?: () => boolean;
|
|
18
|
+
newer?: (running: string) => Promise<string>;
|
|
19
|
+
/** Install the newer harness; true when it is now on disk. */
|
|
20
|
+
install?: (running: string, log: (text: string) => void) => Promise<boolean>;
|
|
21
|
+
now?: () => number;
|
|
22
|
+
};
|
|
23
|
+
export type Restarter = {
|
|
24
|
+
/** Between two events: is a restart due? True while installing too, so no new turn starts. */
|
|
25
|
+
due: () => boolean;
|
|
26
|
+
/** Look for a newer version, and restart into it if the agent is free. */
|
|
27
|
+
maybe: () => Promise<void>;
|
|
28
|
+
/** The version to relaunch into, once a restart has begun; '' otherwise. */
|
|
29
|
+
relaunchTo: () => string;
|
|
30
|
+
/** Look every ten minutes. */
|
|
31
|
+
start: () => NodeJS.Timeout;
|
|
32
|
+
};
|
|
33
|
+
export declare function createRestarter(d: RestarterDeps): Restarter;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A newer harness, taken while idle. Startup already installs the newest version; a RUNNING agent
|
|
3
|
+
* never did, so every release meant restarting ten agents by hand. Now: look on a timer; when
|
|
4
|
+
* there is a newer version, stop the normal way (stream closed, FlareDeck told it stopped) and come
|
|
5
|
+
* back up in the same pane on the new one. Never mid-turn. See restartDecision in self-update.ts.
|
|
6
|
+
* Split out of serve.ts (docs/spec-harness-profiles.md, step 2).
|
|
7
|
+
*/
|
|
8
|
+
import { updatesEnabled, harnessVersion } from '../updater.js';
|
|
9
|
+
import { isCheckout, newerHarness, readyOnDisk, restartDecision, updateSelf } from '../self-update.js';
|
|
10
|
+
/** Minutes before trying a failed harness install again: 10 min, 30 min, 2h, then every 6h. */
|
|
11
|
+
export const INSTALL_BACKOFF_MIN = [10, 30, 120, 360];
|
|
12
|
+
const installReal = async (running, log) =>
|
|
13
|
+
// Nothing to install is fine when another agent on this machine already installed it.
|
|
14
|
+
isCheckout() || !!(await updateSelf(log)) || readyOnDisk(running);
|
|
15
|
+
export function createRestarter(d) {
|
|
16
|
+
const running = d.running ?? harnessVersion();
|
|
17
|
+
const enabled = d.enabled ?? updatesEnabled;
|
|
18
|
+
const newer = d.newer ?? newerHarness;
|
|
19
|
+
const install = d.install ?? installReal;
|
|
20
|
+
const now = d.now ?? Date.now;
|
|
21
|
+
let restartTo = '';
|
|
22
|
+
let readySince = 0;
|
|
23
|
+
let restarting = false;
|
|
24
|
+
let lookAgainAt = 0;
|
|
25
|
+
let installFailures = 0;
|
|
26
|
+
// LOOKING happens whether or not a turn is running — a busy agent never had an idle moment at
|
|
27
|
+
// the check, so it never even saw the new version (TARS). Acting waits for a gap.
|
|
28
|
+
const lookForNewer = async () => {
|
|
29
|
+
if (restartTo || !enabled() || !running || now() < lookAgainAt)
|
|
30
|
+
return;
|
|
31
|
+
restartTo = await newer(running);
|
|
32
|
+
if (!restartTo)
|
|
33
|
+
return;
|
|
34
|
+
readySince = now();
|
|
35
|
+
d.log('tool', `harness ${restartTo} is ready — restarting into it between turns`);
|
|
36
|
+
};
|
|
37
|
+
const decide = (working) => {
|
|
38
|
+
const b = d.busy();
|
|
39
|
+
return restartDecision({ ready: restartTo, stopping: b.stopping, working, queued: b.queued, live: b.live, readySince, now: now() });
|
|
40
|
+
};
|
|
41
|
+
const maybe = async () => {
|
|
42
|
+
if (d.busy().stopping || restarting)
|
|
43
|
+
return;
|
|
44
|
+
await lookForNewer();
|
|
45
|
+
if (d.busy().working)
|
|
46
|
+
return; // a gap comes at the end of this turn: the queue checks between events
|
|
47
|
+
if (!decide(false))
|
|
48
|
+
return;
|
|
49
|
+
// Install BEFORE stopping. Coming back up on the same version would only find it "ready" again
|
|
50
|
+
// ten minutes later — a restart loop — so a failed install keeps this one running.
|
|
51
|
+
restarting = true;
|
|
52
|
+
if (!(await install(running, (t) => d.log('tool', t)))) {
|
|
53
|
+
restarting = false;
|
|
54
|
+
restartTo = '';
|
|
55
|
+
// Soon at first: most failures are a release asked for before npm had it everywhere, and six
|
|
56
|
+
// hours of the old version for that is what FRIDAY got. Backs off if it keeps failing.
|
|
57
|
+
const wait = INSTALL_BACKOFF_MIN[Math.min(installFailures++, INSTALL_BACKOFF_MIN.length - 1)];
|
|
58
|
+
lookAgainAt = now() + wait * 60_000;
|
|
59
|
+
d.log('warn', `could not install the newer harness — staying on ${running}, trying again in ${wait < 60 ? `${wait} min` : `${wait / 60}h`}`);
|
|
60
|
+
d.resume();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
installFailures = 0;
|
|
64
|
+
d.log('tool', `restarting into harness ${restartTo}`);
|
|
65
|
+
d.shutdown();
|
|
66
|
+
};
|
|
67
|
+
return {
|
|
68
|
+
due: () => !!restartTo && (restarting || decide(false)),
|
|
69
|
+
maybe,
|
|
70
|
+
relaunchTo: () => (restarting ? restartTo : ''),
|
|
71
|
+
start: () => {
|
|
72
|
+
const t = setInterval(() => void maybe(), 10 * 60_000);
|
|
73
|
+
t.unref();
|
|
74
|
+
return t;
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=restarter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restarter.js","sourceRoot":"","sources":["../../src/harness/restarter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE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,OAAO,qBAAqB,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;YAC7I,CAAC,CAAC,MAAM,EAAE,CAAC;YACX,OAAO;QACT,CAAC;QACD,eAAe,GAAG,CAAC,CAAC;QACpB,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,2BAA2B,SAAS,EAAE,CAAC,CAAC;QACtD,CAAC,CAAC,QAAQ,EAAE,CAAC;IACf,CAAC,CAAC;IAEF,OAAO;QACL,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;QACvD,KAAK;QACL,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/C,KAAK,EAAE,GAAG,EAAE;YACV,MAAM,CAAC,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,KAAK,KAAK,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC,CAAC;YACvD,CAAC,CAAC,KAAK,EAAE,CAAC;YACV,OAAO,CAAC,CAAC;QACX,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Write each script; remove ones FlareDeck no longer has. Returns repository id → absolute path. */
|
|
2
|
+
export declare function installStartScripts(entries: Array<{
|
|
3
|
+
repository: string;
|
|
4
|
+
body: string;
|
|
5
|
+
}>, dir: string): Record<string, string>;
|
|
6
|
+
/** The stored script for a repository URL, if FlareDeck keeps one. */
|
|
7
|
+
export declare function storedStartScript(scripts: Record<string, string> | undefined, repository: string | undefined): string | undefined;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Start scripts kept in FlareDeck for a workspace's repositories (Integrations → Repositories),
|
|
3
|
+
* written into the harness's own folder — never into the repository, so a client's repository need
|
|
4
|
+
* not carry ours — and rewritten every session so what runs is what FlareDeck holds. A script
|
|
5
|
+
* committed in the repository still wins (startEnvironment). Split out per
|
|
6
|
+
* docs/spec-workspace-repositories.md, step 3.
|
|
7
|
+
*/
|
|
8
|
+
import { chmodSync, mkdirSync, readdirSync, rmSync, writeFileSync } from 'node:fs';
|
|
9
|
+
import { join } from 'node:path';
|
|
10
|
+
import { repoIdentity } from '../workspace.js';
|
|
11
|
+
/** `owner/name` → `owner__name.sh`. */
|
|
12
|
+
const fileFor = (id) => `${id.replace(/\//g, '__').replace(/[^\w.-]/g, '_')}.sh`;
|
|
13
|
+
/** Write each script; remove ones FlareDeck no longer has. Returns repository id → absolute path. */
|
|
14
|
+
export function installStartScripts(entries, dir) {
|
|
15
|
+
mkdirSync(dir, { recursive: true });
|
|
16
|
+
const out = {};
|
|
17
|
+
for (const e of entries) {
|
|
18
|
+
const id = repoIdentity(e.repository);
|
|
19
|
+
if (!id.includes('/') || !e.body)
|
|
20
|
+
continue;
|
|
21
|
+
const path = join(dir, fileFor(id));
|
|
22
|
+
try {
|
|
23
|
+
writeFileSync(path, e.body, { mode: 0o755 });
|
|
24
|
+
chmodSync(path, 0o755);
|
|
25
|
+
out[id] = path;
|
|
26
|
+
}
|
|
27
|
+
catch { /* not offered */ }
|
|
28
|
+
}
|
|
29
|
+
const keep = new Set(Object.values(out).map((p) => p.split('/').pop()));
|
|
30
|
+
for (const f of (() => { try {
|
|
31
|
+
return readdirSync(dir);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return [];
|
|
35
|
+
} })())
|
|
36
|
+
if (!keep.has(f))
|
|
37
|
+
rmSync(join(dir, f), { force: true });
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
40
|
+
/** The stored script for a repository URL, if FlareDeck keeps one. */
|
|
41
|
+
export function storedStartScript(scripts, repository) {
|
|
42
|
+
return repository ? scripts?.[repoIdentity(repository)] : undefined;
|
|
43
|
+
}
|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AC,MAAM,CAAC,CAAC,iBAAiB,CAAC,CAAC;IAC3H,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IACxE,KAAK,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;QAAC,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,EAAE,CAAC;IAAC,CAAC,CAAC,CAAC,CAAC,EAAE;QAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAAE,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7I,OAAO,GAAG,CAAC;AACb,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,iBAAiB,CAAC,OAA2C,EAAE,UAA8B;IAC3G,OAAO,UAAU,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which tool sets a turn is given. This is where a profile's features become what the model can
|
|
3
|
+
* actually do: an agent with `code` off gets no git, no publishing and no release, whatever else
|
|
4
|
+
* is configured. Kept apart from the turn so it can be read — and tested — in one place.
|
|
5
|
+
* Split out of serve.ts (docs/spec-harness-profiles.md, step 2).
|
|
6
|
+
*/
|
|
7
|
+
import type { ToolSet } from '../engine.js';
|
|
8
|
+
import type { Profile } from '../profile.js';
|
|
9
|
+
export type TurnToolSets = {
|
|
10
|
+
/** Always there: FlareDeck itself, the browser, starting the environment. */
|
|
11
|
+
flaredeck: ToolSet;
|
|
12
|
+
browser: ToolSet;
|
|
13
|
+
env: ToolSet;
|
|
14
|
+
team?: ToolSet;
|
|
15
|
+
runs?: ToolSet;
|
|
16
|
+
schedules?: ToolSet;
|
|
17
|
+
/** Small sub-agents (helpers.ts), when on and the engine is Claude. */
|
|
18
|
+
helpers?: ToolSet | null;
|
|
19
|
+
/** The project's file store, when a person set one up for these boards. */
|
|
20
|
+
files?: Record<string, ToolSet> | null;
|
|
21
|
+
/** Commit and publish this card's branch — only when the turn has a card checkout (a job). */
|
|
22
|
+
git?: ToolSet | null;
|
|
23
|
+
/** Uploaded trusted scripts (trusted-scripts.ts), when any are uploaded. */
|
|
24
|
+
scripts?: ToolSet | null;
|
|
25
|
+
/** Merge and promote along the board's environments. */
|
|
26
|
+
release?: ToolSet | null;
|
|
27
|
+
};
|
|
28
|
+
export type MountWhy = {
|
|
29
|
+
profile: Profile;
|
|
30
|
+
/** The turn has a card checkout to commit and publish from. */
|
|
31
|
+
hasJob: boolean;
|
|
32
|
+
/** This agent may release here: its profile does, the board names it, or it is the hotfix agent. */
|
|
33
|
+
mayRelease: boolean;
|
|
34
|
+
/** Any trusted scripts are uploaded for this workspace. */
|
|
35
|
+
hasScripts: boolean;
|
|
36
|
+
};
|
|
37
|
+
export declare function mountTools(sets: TurnToolSets, why: MountWhy): Record<string, ToolSet | undefined>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function mountTools(sets, why) {
|
|
2
|
+
const code = why.profile.code;
|
|
3
|
+
return {
|
|
4
|
+
...(sets.helpers ? { helpers: sets.helpers } : {}),
|
|
5
|
+
...(code && why.hasJob && sets.git ? { git: sets.git } : {}),
|
|
6
|
+
...(sets.files ?? {}),
|
|
7
|
+
browser: sets.browser,
|
|
8
|
+
env: sets.env,
|
|
9
|
+
team: sets.team,
|
|
10
|
+
flaredeck: sets.flaredeck,
|
|
11
|
+
runs: sets.runs,
|
|
12
|
+
schedules: sets.schedules,
|
|
13
|
+
...(why.hasScripts && sets.scripts ? { scripts: sets.scripts } : {}),
|
|
14
|
+
...(code && why.mayRelease && sets.release ? { release: sets.release } : {}),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/harness/tools.ts"],"names":[],"mappings":"AAuCA,MAAM,UAAU,UAAU,CAAC,IAAkB,EAAE,GAAa;IAC1D,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC;IAC9B,OAAO;QACL,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAClD,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,MAAM,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5D,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;QACrB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,GAAG,CAAC,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACpE,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC7E,CAAC;AACJ,CAAC"}
|
package/dist/hydrate.d.ts
CHANGED
|
@@ -35,6 +35,11 @@ export type Hydrated = {
|
|
|
35
35
|
description: string;
|
|
36
36
|
body: string;
|
|
37
37
|
}>;
|
|
38
|
+
/** Start scripts kept in FlareDeck, per repository (Integrations → Repositories in the MCP). */
|
|
39
|
+
startScripts?: Array<{
|
|
40
|
+
repository: string;
|
|
41
|
+
body: string;
|
|
42
|
+
}>;
|
|
38
43
|
/**
|
|
39
44
|
* Servers the workspace marked REQUIRED that FlareDeck could not give a working token for.
|
|
40
45
|
* Non-empty means: do no work until they are connected. Absent when FlareDeck was unreachable —
|
package/dist/hydrate.js
CHANGED
|
@@ -52,6 +52,7 @@ export async function hydrateMcpServers(config, fetchConfig) {
|
|
|
52
52
|
providers: answer.providers ?? null,
|
|
53
53
|
secrets: answer.secrets ?? null,
|
|
54
54
|
trustedScripts: answer.trustedScripts ?? [],
|
|
55
|
+
startScripts: answer.startScripts ?? [],
|
|
55
56
|
...(parts.length ? { note: `MCP servers: ${parts.join(', ')}` } : {}),
|
|
56
57
|
};
|
|
57
58
|
}
|
package/dist/hydrate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydrate.js","sourceRoot":"","sources":["../src/hydrate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hydrate.js","sourceRoot":"","sources":["../src/hydrate.ts"],"names":[],"mappings":"AAiDA;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAkC,EAClC,WAA0U;IAE1U,MAAM,KAAK,GAAG,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;IAEzE,IAAI,MAA+C,CAAC;IACpD,IAAI,CAAC;QACH,MAAM,GAAG,MAAM,WAAW,EA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