@jmanuelcorral/bond-app 0.1.4 → 0.1.6
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 +241 -7
- package/app/brand/TOKENS.md +5 -5
- package/app/layouts/bond.json +10 -14
- package/app/mods/bond-agents/api.js +35 -0
- package/app/mods/bond-agents/branch.svg +1 -0
- package/app/mods/bond-agents/brand.js +53 -2
- package/app/mods/bond-agents/config.js +8 -0
- package/app/mods/bond-agents/eye-off.svg +1 -0
- package/app/mods/bond-agents/eye.svg +1 -0
- package/app/mods/bond-agents/main.js +316 -330
- package/app/mods/bond-agents/model.js +400 -6
- package/app/mods/bond-board/api.js +35 -0
- package/app/mods/bond-board/branch.svg +1 -0
- package/app/mods/bond-board/brand.js +53 -2
- package/app/mods/bond-board/config.js +8 -0
- package/app/mods/bond-board/main.js +1054 -366
- package/app/mods/bond-board/model.js +138 -17
- package/app/mods/bond-pane/close.svg +1 -0
- package/app/mods/bond-pane/hide.svg +1 -0
- package/app/mods/bond-pane/main.js +103 -0
- package/app/mods/bond-pane/mod.json +1 -0
- package/app/mods/bond-pane/model.js +18 -0
- package/app/mods/bond-pane/split-down.svg +1 -0
- package/app/mods/bond-pane/split-right.svg +1 -0
- package/app/mods/bond-pane/unzoom.svg +1 -0
- package/app/mods/bond-pane/zoom.svg +1 -0
- package/app/mods/bond-settings/api.js +35 -0
- package/app/mods/bond-settings/brand.js +53 -2
- package/app/mods/bond-settings/config.js +8 -0
- package/app/mods/bond-settings/main.js +1645 -87
- package/app/mods/bond-settings/mod.json +1 -1
- package/app/mods/bond-settings/pi-models.js +144 -0
- package/app/mods/bond-status/api.js +35 -0
- package/app/mods/bond-status/brand.js +53 -2
- package/app/mods/bond-status/config.js +8 -0
- package/app/mods/bond-status/main.js +37 -15
- package/app/mods/bond-status/model.js +19 -1
- package/app/mods/bond-tabs/brand.js +53 -2
- package/app/mods/bond-tabs/main.js +45 -3
- package/app/mods/bond-titlebar/brand.js +53 -2
- package/app/mods/bond-titlebar/main.js +115 -55
- package/app/mods/bond-titlebar/version.js +3 -0
- package/app/themes/bond-dark.json +5 -5
- package/app/themes/bond-light.json +5 -5
- package/package.json +1 -1
- package/runner/Dockerfile +58 -15
- package/runner/SPIKE-BOND.md +89 -0
- package/runner/build-config/.none +0 -0
- package/runner/build-creds/.none +0 -0
- package/runner/config.example/README.md +27 -0
- package/runner/config.example/pi/models.json +22 -0
- package/runner/credentials.example.env +27 -0
- package/runner/entrypoint.sh +16 -0
- package/runner/setup.sh +927 -0
- package/runner/versions.env +61 -0
- package/scripts/app-install.ts +64 -1
- package/src/cli.ts +53 -3
- package/src/config.ts +8 -0
- package/src/core/agy-login.ts +682 -0
- package/src/core/delivery.ts +3 -1
- package/src/core/hub-session.ts +9 -7
- package/src/core/orchestrator.ts +1186 -168
- package/src/core/repo-host.ts +60 -0
- package/src/core/setup.ts +239 -0
- package/src/core/watchdog.ts +6 -6
- package/src/db/database.ts +55 -1
- package/src/db/settings-repo.ts +440 -7
- package/src/db/ticket-repo.ts +73 -17
- package/src/index.ts +4 -4
- package/src/runner/azure-devops-client.ts +163 -0
- package/src/runner/docker-client.ts +84 -5
- package/src/runner/github-client.ts +146 -0
- package/src/runner/hc-client.ts +40 -5
- package/src/runner/image-builder.ts +268 -10
- package/src/runner/jira-client.ts +368 -0
- package/src/runner/tool-catalog.ts +84 -0
- package/src/server/app.ts +585 -9
- package/src/types.ts +168 -1
package/src/types.ts
CHANGED
|
@@ -35,13 +35,25 @@ export type FailureReason =
|
|
|
35
35
|
| 'invalid_issue_url'
|
|
36
36
|
| 'issue_inaccessible';
|
|
37
37
|
|
|
38
|
-
export const SUPPORTED_AGENTS = ['pi', 'claude', 'codex', '
|
|
38
|
+
export const SUPPORTED_AGENTS = ['pi', 'claude', 'codex', 'copilot', 'agy'] as const;
|
|
39
39
|
export type SupportedAgent = (typeof SUPPORTED_AGENTS)[number];
|
|
40
40
|
|
|
41
41
|
export function isValidAgent(agent: string): agent is SupportedAgent {
|
|
42
42
|
return (SUPPORTED_AGENTS as readonly string[]).includes(agent);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Wizard plan (D-W3, image plan D-B): the agents runner/setup.sh can bake into the image,
|
|
47
|
+
* which are the ones the setup wizard offers and `agents_selected` validates against.
|
|
48
|
+
* Since 2026-11-24 the same five as SUPPORTED_AGENTS (opencode and crush were dropped).
|
|
49
|
+
*/
|
|
50
|
+
export const SETUP_AGENTS = ['pi', 'claude', 'codex', 'copilot', 'agy'] as const;
|
|
51
|
+
export type SetupAgent = (typeof SETUP_AGENTS)[number];
|
|
52
|
+
|
|
53
|
+
export function isSetupAgent(agent: string): agent is SetupAgent {
|
|
54
|
+
return (SETUP_AGENTS as readonly string[]).includes(agent);
|
|
55
|
+
}
|
|
56
|
+
|
|
45
57
|
export function validateBranchName(name: string): boolean {
|
|
46
58
|
if (!name || typeof name !== 'string') return false;
|
|
47
59
|
const trimmed = name.trim();
|
|
@@ -85,12 +97,17 @@ export interface Ticket {
|
|
|
85
97
|
mode: TicketMode;
|
|
86
98
|
target_branch: string;
|
|
87
99
|
budget_usd: number;
|
|
100
|
+
/** Max minutes before the watchdog terminates the run; 0 (the default) = no timeout. */
|
|
88
101
|
timeout_minutes: number;
|
|
89
102
|
agent: string;
|
|
90
103
|
model?: string;
|
|
91
104
|
prompt?: string;
|
|
92
105
|
/** P4: shell commands run in the clone (as `runner`) before the push; all must pass. */
|
|
93
106
|
verify_commands: string[];
|
|
107
|
+
/** P4 (D-U): auto-bondify the cloned repo if not already bondified; default true. */
|
|
108
|
+
bondify: boolean;
|
|
109
|
+
/** Plan bond-app-ajustes-imagen P4: Docker inside the run (privileged container); default false. */
|
|
110
|
+
docker?: boolean;
|
|
94
111
|
/** P9: engine for bond team inside run container: 'hc' (default, native panes) or 'herdr' (TUI mode). */
|
|
95
112
|
team_engine?: 'hc' | 'herdr';
|
|
96
113
|
status: RunState;
|
|
@@ -114,11 +131,16 @@ export interface CreateTicketInput {
|
|
|
114
131
|
repo_agents?: Record<string, string>;
|
|
115
132
|
target_branch?: string;
|
|
116
133
|
budget_usd?: number;
|
|
134
|
+
/** Timeout in minutes; 0 (the default) = no timeout, negative is rejected. */
|
|
117
135
|
timeout_minutes?: number;
|
|
118
136
|
agent?: string;
|
|
119
137
|
model?: string;
|
|
120
138
|
prompt?: string;
|
|
121
139
|
verify_commands?: string[];
|
|
140
|
+
/** P4 (D-U): auto-bondify the cloned repo if not already bondified; default true. */
|
|
141
|
+
bondify?: boolean;
|
|
142
|
+
/** Plan bond-app-ajustes-imagen P4: Docker inside the run (privileged container); default false. */
|
|
143
|
+
docker?: boolean;
|
|
122
144
|
/** P9: engine for bond team inside run container: 'hc' (default) or 'herdr'. */
|
|
123
145
|
team_engine?: 'hc' | 'herdr';
|
|
124
146
|
}
|
|
@@ -156,6 +178,24 @@ export function parseGitHubIssueUrl(url: string): { owner: string; repo: string;
|
|
|
156
178
|
};
|
|
157
179
|
}
|
|
158
180
|
|
|
181
|
+
/** Plan bond-app-azure-jira P2: validate Jira issue URL: https://<site>.atlassian.net/browse/<KEY-123> */
|
|
182
|
+
export function validateJiraIssueUrl(url: string): boolean {
|
|
183
|
+
if (!url || typeof url !== 'string') return false;
|
|
184
|
+
const clean = url.trim().replace(/[#?].*$/, '');
|
|
185
|
+
return /^https:\/\/[a-zA-Z0-9_-]+\.atlassian\.net\/browse\/[a-zA-Z0-9_-]+$/.test(clean);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** Plan bond-app-azure-jira P2: parse Jira issue URL into site and issueKey. */
|
|
189
|
+
export function parseJiraIssueUrl(url: string): { site: string; issueKey: string } {
|
|
190
|
+
const clean = url.trim().replace(/[#?].*$/, '');
|
|
191
|
+
const m = /^https:\/\/([a-zA-Z0-9_-]+\.atlassian\.net)\/browse\/([a-zA-Z0-9_-]+)$/.exec(clean);
|
|
192
|
+
if (!m) throw new Error(`Not a Jira issue URL: '${url}'`);
|
|
193
|
+
return {
|
|
194
|
+
site: `https://${m[1]}`,
|
|
195
|
+
issueKey: m[2],
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
159
199
|
export interface Run {
|
|
160
200
|
id: string;
|
|
161
201
|
ticket_id: string;
|
|
@@ -294,6 +334,41 @@ export interface AgentCredentialSummary {
|
|
|
294
334
|
provider?: string;
|
|
295
335
|
configured: boolean;
|
|
296
336
|
updated_at?: string;
|
|
337
|
+
/** P1: account email for agy (read from id_token_email of antigravity-oauth-token; never the token). */
|
|
338
|
+
email?: string;
|
|
339
|
+
/** claude: when its `claude setup-token` token ends (one year after it was stored). */
|
|
340
|
+
expires_at?: string;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export type AgyLoginStatus =
|
|
344
|
+
| 'idle'
|
|
345
|
+
| 'starting'
|
|
346
|
+
| 'waiting_code'
|
|
347
|
+
| 'authenticating'
|
|
348
|
+
| 'success'
|
|
349
|
+
| 'error';
|
|
350
|
+
|
|
351
|
+
export interface AgyLoginSessionState {
|
|
352
|
+
status: AgyLoginStatus;
|
|
353
|
+
url?: string;
|
|
354
|
+
/** Device flows (copilot): the code the person types at `url`; nothing to paste back. */
|
|
355
|
+
user_code?: string;
|
|
356
|
+
/** True when the login finishes by itself once authorized (no code to submit). */
|
|
357
|
+
device?: boolean;
|
|
358
|
+
/** The orchestrator catches the browser's return itself (codex); pasting is the fallback. */
|
|
359
|
+
auto?: boolean;
|
|
360
|
+
email?: string;
|
|
361
|
+
error?: string;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/** Plan bond-app-azure-jira P1: what the API says about the Azure DevOps PAT (never the PAT). */
|
|
365
|
+
export interface AzureDevOpsCredentialSummary {
|
|
366
|
+
configured: boolean;
|
|
367
|
+
org_url?: string;
|
|
368
|
+
account?: string;
|
|
369
|
+
/** The PAT also reaches the run's agents (AZURE_DEVOPS_* variables). */
|
|
370
|
+
agents_enabled?: boolean;
|
|
371
|
+
updated_at?: string;
|
|
297
372
|
}
|
|
298
373
|
|
|
299
374
|
/** D20: what the API says about the stored GitHub credential (never the token). */
|
|
@@ -303,6 +378,48 @@ export interface GitHubCredentialSummary {
|
|
|
303
378
|
updated_at?: string;
|
|
304
379
|
}
|
|
305
380
|
|
|
381
|
+
/** W-P1: what the API says about the runner image (presence and, when the image carries
|
|
382
|
+
* the /opt/runner-agents manifest, the agents baked into it). */
|
|
383
|
+
export interface RunnerImageInfo {
|
|
384
|
+
present: boolean;
|
|
385
|
+
agents?: string[];
|
|
386
|
+
/** Plan bond-app-ajustes-imagen P2: tool groups and extra apt packages it was built with. */
|
|
387
|
+
tools?: string[];
|
|
388
|
+
apt_extra?: string[];
|
|
389
|
+
/** Filled by the setup state: what it lacks against the selection (⟳ in Ajustes). */
|
|
390
|
+
stale?: boolean;
|
|
391
|
+
missing_agents?: string[];
|
|
392
|
+
missing_tools?: string[];
|
|
393
|
+
extra_tools?: string[];
|
|
394
|
+
apt_changed?: boolean;
|
|
395
|
+
/** Fingerprint of the recipe it was built with (image label); absent on older images. */
|
|
396
|
+
recipe?: string;
|
|
397
|
+
/** The recipe (Dockerfile, setup.sh, versions.env…) changed since it was built. */
|
|
398
|
+
recipe_changed?: boolean;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/** W-P1: the aggregated setup state the wizard and the Ajustes panel read. */
|
|
402
|
+
export interface SetupState {
|
|
403
|
+
/** gh configured + at least one agent with credential + runner image present. */
|
|
404
|
+
complete: boolean;
|
|
405
|
+
setup_done: boolean;
|
|
406
|
+
agents_selected: string[];
|
|
407
|
+
agents: Array<{ agent: string; configured: boolean }>;
|
|
408
|
+
github: { configured: boolean; login?: string };
|
|
409
|
+
image: RunnerImageInfo;
|
|
410
|
+
/** W-P4: model chosen for prompt suggestions (supi); null = «sin sugerencias». */
|
|
411
|
+
suggestions_model: string | null;
|
|
412
|
+
/** D-M1: default working model for pi; null = provider baked default. */
|
|
413
|
+
default_model: string | null;
|
|
414
|
+
/** P3: full model ids configured for pi (provider/id). */
|
|
415
|
+
models: string[];
|
|
416
|
+
/** Plan bond-app-ajustes-imagen P2: tool groups and extra apt packages chosen for the image. */
|
|
417
|
+
tools_selected: string[];
|
|
418
|
+
apt_extra: string[];
|
|
419
|
+
/** The tool groups the image can carry (id, label, description, default, size_mb). */
|
|
420
|
+
catalog: Array<{ id: string; label: string; description: string; default: boolean; size_mb: number }>;
|
|
421
|
+
}
|
|
422
|
+
|
|
306
423
|
/** gh / GitHub tokens: gho_…, ghp_…, github_pat_… — one word, no whitespace. */
|
|
307
424
|
export function validateGitHubToken(token: unknown): token is string {
|
|
308
425
|
return typeof token === 'string' && /^[A-Za-z0-9_]{20,255}$/.test(token);
|
|
@@ -313,6 +430,42 @@ export function validateGitHubLogin(login: unknown): login is string {
|
|
|
313
430
|
return typeof login === 'string' && /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})$/.test(login);
|
|
314
431
|
}
|
|
315
432
|
|
|
433
|
+
/** Plan bond-app-azure-jira P2: Jira Cloud credential. */
|
|
434
|
+
export interface JiraCredential {
|
|
435
|
+
site: string;
|
|
436
|
+
email: string;
|
|
437
|
+
token: string;
|
|
438
|
+
agents_enabled: boolean;
|
|
439
|
+
account_name?: string | null;
|
|
440
|
+
updated_at: string;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
export interface JiraCredentialSummary {
|
|
444
|
+
configured: boolean;
|
|
445
|
+
site?: string;
|
|
446
|
+
email?: string;
|
|
447
|
+
agents_enabled?: boolean;
|
|
448
|
+
account_name?: string | null;
|
|
449
|
+
updated_at?: string;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
export function validateJiraSite(site: unknown): site is string {
|
|
453
|
+
if (typeof site !== 'string') return false;
|
|
454
|
+
return /^https:\/\/[a-zA-Z0-9_-]+\.atlassian\.net\/?$/.test(site.trim());
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
export function normalizeJiraSite(site: string): string {
|
|
458
|
+
return site.trim().replace(/\/+$/, '');
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
export function validateJiraEmail(email: unknown): email is string {
|
|
462
|
+
return typeof email === 'string' && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email.trim());
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
export function validateJiraToken(token: unknown): token is string {
|
|
466
|
+
return typeof token === 'string' && token.trim().length > 0;
|
|
467
|
+
}
|
|
468
|
+
|
|
316
469
|
/** P7: Row of `bond team status --json` inside the run's container. */
|
|
317
470
|
export interface TeamStatusRow {
|
|
318
471
|
branch: string;
|
|
@@ -336,3 +489,17 @@ export interface TeamStatusRow {
|
|
|
336
489
|
notice?: boolean;
|
|
337
490
|
};
|
|
338
491
|
}
|
|
492
|
+
|
|
493
|
+
/** P4: Live terminal of a run machine reported by hc. */
|
|
494
|
+
export interface RunTerminal {
|
|
495
|
+
address: string;
|
|
496
|
+
name: string;
|
|
497
|
+
agent: string;
|
|
498
|
+
state: string;
|
|
499
|
+
status: unknown;
|
|
500
|
+
turn: number;
|
|
501
|
+
where: string;
|
|
502
|
+
cwd: string;
|
|
503
|
+
labels?: Record<string, string>;
|
|
504
|
+
exit_code?: number | null;
|
|
505
|
+
}
|