@proletariat/cli 0.3.109 → 0.3.111
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/commands/orchestrator/attach.d.ts +2 -0
- package/dist/commands/orchestrator/attach.js +80 -118
- package/dist/commands/orchestrator/attach.js.map +1 -1
- package/dist/commands/orchestrator/start.js +21 -0
- package/dist/commands/orchestrator/start.js.map +1 -1
- package/dist/commands/orchestrator/status.d.ts +3 -0
- package/dist/commands/orchestrator/status.js +104 -130
- package/dist/commands/orchestrator/status.js.map +1 -1
- package/dist/commands/orchestrator/stop.d.ts +2 -0
- package/dist/commands/orchestrator/stop.js +105 -107
- package/dist/commands/orchestrator/stop.js.map +1 -1
- package/dist/commands/session/attach.d.ts +2 -6
- package/dist/commands/session/attach.js +68 -97
- package/dist/commands/session/attach.js.map +1 -1
- package/dist/commands/session/list.d.ts +4 -1
- package/dist/commands/session/list.js +160 -326
- package/dist/commands/session/list.js.map +1 -1
- package/dist/commands/work/start.js +104 -49
- package/dist/commands/work/start.js.map +1 -1
- package/dist/lib/execution/session-utils.d.ts +4 -1
- package/dist/lib/execution/session-utils.js +3 -0
- package/dist/lib/execution/session-utils.js.map +1 -1
- package/dist/lib/machine-db-mirror.d.ts +64 -0
- package/dist/lib/machine-db-mirror.js +82 -0
- package/dist/lib/machine-db-mirror.js.map +1 -0
- package/dist/lib/machine-db.d.ts +11 -0
- package/dist/lib/machine-db.js +17 -0
- package/dist/lib/machine-db.js.map +1 -1
- package/dist/lib/orchestrate/actions.d.ts +8 -0
- package/dist/lib/orchestrate/actions.js +166 -94
- package/dist/lib/orchestrate/actions.js.map +1 -1
- package/dist/lib/orchestrate/prompt-chain.d.ts +181 -0
- package/dist/lib/orchestrate/prompt-chain.js +323 -0
- package/dist/lib/orchestrate/prompt-chain.js.map +1 -0
- package/dist/lib/prompt-command.d.ts +61 -1
- package/dist/lib/prompt-command.js +167 -1
- package/dist/lib/prompt-command.js.map +1 -1
- package/dist/lib/prompt-json.d.ts +129 -2
- package/dist/lib/prompt-json.js +157 -0
- package/dist/lib/prompt-json.js.map +1 -1
- package/dist/lib/runtime-command.d.ts +3 -1
- package/dist/lib/runtime-command.js +4 -2
- package/dist/lib/runtime-command.js.map +1 -1
- package/dist/lib/session/renderer.d.ts +121 -0
- package/dist/lib/session/renderer.js +547 -0
- package/dist/lib/session/renderer.js.map +1 -0
- package/dist/lib/update-check.d.ts +64 -7
- package/dist/lib/update-check.js +164 -20
- package/dist/lib/update-check.js.map +1 -1
- package/oclif.manifest.json +1173 -1062
- package/package.json +1 -1
|
@@ -18,6 +18,7 @@ import { openWorkspaceDatabase } from '../../lib/database/index.js';
|
|
|
18
18
|
import { generateBranchName, DEFAULT_EXECUTION_CONFIG, } from '../../lib/execution/types.js';
|
|
19
19
|
import { runExecution, isDockerRunning, isGitHubTokenAvailable, isDevcontainerCliInstalled, dockerCredentialsExist, getDockerCredentialInfo, isClaudeExecutor, getExecutorDisplayName } from '../../lib/execution/runners.js';
|
|
20
20
|
import { ExecutionStorage, ContainerStorage } from '../../lib/execution/storage.js';
|
|
21
|
+
import { createMirrorExecution, updateMirrorExecution, closeMirrorExecution, } from '../../lib/machine-db-mirror.js';
|
|
21
22
|
import { loadExecutionConfig, getTerminalApp, promptTerminalPreference, getShell, promptShellPreference, hasTerminalPreference, hasShellPreference, getAuthMethod, saveAuthMethod, getCreatePrDefault, getVerifyCiDefault, getMirrorToPmoDefault, getCleanupPolicy } from '../../lib/execution/config.js';
|
|
22
23
|
import { hasDevcontainerConfig } from '../../lib/execution/devcontainer.js';
|
|
23
24
|
import { detectRepoWorktrees, resolveWorktreePath, buildWorkspaceRepos } from '../../lib/execution/context.js';
|
|
@@ -541,6 +542,9 @@ export default class WorkStart extends PMOCommand {
|
|
|
541
542
|
// Open database for execution storage
|
|
542
543
|
const db = openWorkspaceDatabase(workspaceInfo.path);
|
|
543
544
|
const executionStorage = new ExecutionStorage(db);
|
|
545
|
+
// PRLT-1275: Machine.db mirror handle (hoisted so the catch block can
|
|
546
|
+
// always close it). Populated once the execution row is created.
|
|
547
|
+
let mirrorHandle = null;
|
|
544
548
|
try {
|
|
545
549
|
// Handle batch mode (--all)
|
|
546
550
|
if (flags.all) {
|
|
@@ -2205,6 +2209,19 @@ export default class WorkStart extends PMOCommand {
|
|
|
2205
2209
|
externalId: ticketExternalMetadata.id,
|
|
2206
2210
|
externalUrl: ticketExternalMetadata.url,
|
|
2207
2211
|
});
|
|
2212
|
+
// PRLT-1275: Mirror to machine.db so the execution is discoverable
|
|
2213
|
+
// machine-wide (from other HQs, from /tmp, etc). Non-fatal on failure —
|
|
2214
|
+
// workspace.db is authoritative for ticketed work.
|
|
2215
|
+
mirrorHandle = createMirrorExecution({
|
|
2216
|
+
ticketId: ticket.id,
|
|
2217
|
+
agentName: assignedAgent,
|
|
2218
|
+
executor,
|
|
2219
|
+
environment,
|
|
2220
|
+
repoPath: workspaceInfo.path,
|
|
2221
|
+
branch,
|
|
2222
|
+
persistent: cleanupPolicy === 'persistent',
|
|
2223
|
+
prompt: `${ticket.id}: ${ticket.title}`,
|
|
2224
|
+
});
|
|
2208
2225
|
if (!jsonMode) {
|
|
2209
2226
|
this.log(styles.muted(` Work ID: ${execution.id}`));
|
|
2210
2227
|
this.log('');
|
|
@@ -2292,6 +2309,12 @@ export default class WorkStart extends PMOCommand {
|
|
|
2292
2309
|
sessionId: result.sessionId,
|
|
2293
2310
|
logPath: result.logPath,
|
|
2294
2311
|
});
|
|
2312
|
+
// PRLT-1275: Mirror status/process info to machine.db.
|
|
2313
|
+
updateMirrorExecution(mirrorHandle, {
|
|
2314
|
+
status: 'running',
|
|
2315
|
+
sessionId: result.sessionId,
|
|
2316
|
+
containerId: result.containerId,
|
|
2317
|
+
});
|
|
2295
2318
|
// Track container in containers table (for devcontainer environment)
|
|
2296
2319
|
// PRLT-1077: Only store infrastructure metadata, not lifecycle status.
|
|
2297
2320
|
// Agent lifecycle state comes from agent_work, not the containers table.
|
|
@@ -2408,6 +2431,10 @@ export default class WorkStart extends PMOCommand {
|
|
|
2408
2431
|
}
|
|
2409
2432
|
else {
|
|
2410
2433
|
executionStorage.updateStatus(execution.id, 'failed');
|
|
2434
|
+
updateMirrorExecution(mirrorHandle, {
|
|
2435
|
+
status: 'failed',
|
|
2436
|
+
errorMessage: result.error,
|
|
2437
|
+
});
|
|
2411
2438
|
// Track primitive spawn failure
|
|
2412
2439
|
trackPrimitiveExecuted({
|
|
2413
2440
|
primitive: context.actionId || 'implement',
|
|
@@ -2464,9 +2491,11 @@ export default class WorkStart extends PMOCommand {
|
|
|
2464
2491
|
return handleError('START_FAILED', errorLines.join('\n'));
|
|
2465
2492
|
}
|
|
2466
2493
|
}
|
|
2494
|
+
closeMirrorExecution(mirrorHandle);
|
|
2467
2495
|
db.close();
|
|
2468
2496
|
}
|
|
2469
2497
|
catch (error) {
|
|
2498
|
+
closeMirrorExecution(mirrorHandle);
|
|
2470
2499
|
db.close();
|
|
2471
2500
|
throw error;
|
|
2472
2501
|
}
|
|
@@ -3040,6 +3069,18 @@ export default class WorkStart extends PMOCommand {
|
|
|
3040
3069
|
externalId: ticketExternalMetadata.id,
|
|
3041
3070
|
externalUrl: ticketExternalMetadata.url,
|
|
3042
3071
|
});
|
|
3072
|
+
// PRLT-1275: Mirror to machine.db so the execution is discoverable
|
|
3073
|
+
// machine-wide. Non-fatal on failure.
|
|
3074
|
+
const mirrorHandle = createMirrorExecution({
|
|
3075
|
+
ticketId: ticket.id,
|
|
3076
|
+
agentName,
|
|
3077
|
+
executor,
|
|
3078
|
+
environment,
|
|
3079
|
+
repoPath: workspaceInfo.path,
|
|
3080
|
+
branch,
|
|
3081
|
+
persistent: cleanupPolicy === 'persistent',
|
|
3082
|
+
prompt: `${ticket.id}: ${ticket.title}`,
|
|
3083
|
+
});
|
|
3043
3084
|
// Note: Ticket status update moved to after successful spawn
|
|
3044
3085
|
// Load execution config
|
|
3045
3086
|
const executionConfig = loadExecutionConfig(db);
|
|
@@ -3052,59 +3093,73 @@ export default class WorkStart extends PMOCommand {
|
|
|
3052
3093
|
displayMode,
|
|
3053
3094
|
sessionManager: environment === 'devcontainer' ? batchSessionManager : undefined,
|
|
3054
3095
|
});
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
agentName: context.agentName,
|
|
3067
|
-
projectPath: workspaceInfo.path,
|
|
3096
|
+
try {
|
|
3097
|
+
if (result.success) {
|
|
3098
|
+
executionStorage.updateStatus(execution.id, 'running');
|
|
3099
|
+
executionStorage.updateProcessInfo(execution.id, {
|
|
3100
|
+
pid: result.pid,
|
|
3101
|
+
containerId: result.containerId,
|
|
3102
|
+
sessionId: result.sessionId,
|
|
3103
|
+
logPath: result.logPath,
|
|
3104
|
+
});
|
|
3105
|
+
updateMirrorExecution(mirrorHandle, {
|
|
3106
|
+
status: 'running',
|
|
3068
3107
|
sessionId: result.sessionId,
|
|
3069
|
-
|
|
3108
|
+
containerId: result.containerId,
|
|
3070
3109
|
});
|
|
3110
|
+
// Register in machine-wide agent registry
|
|
3111
|
+
try {
|
|
3112
|
+
registerAgent({
|
|
3113
|
+
agentName: context.agentName,
|
|
3114
|
+
projectPath: workspaceInfo.path,
|
|
3115
|
+
sessionId: result.sessionId,
|
|
3116
|
+
ticketId: context.ticketId,
|
|
3117
|
+
});
|
|
3118
|
+
}
|
|
3119
|
+
catch {
|
|
3120
|
+
// Non-fatal — registry is best-effort
|
|
3121
|
+
}
|
|
3122
|
+
// Update ticket assignee ONLY after successful spawn
|
|
3123
|
+
if (!ticket.assignee || ticket.assignee !== agentName) {
|
|
3124
|
+
await this.storage.updateTicket(ticket.id, { assignee: agentName });
|
|
3125
|
+
}
|
|
3126
|
+
// Move ticket to In Progress column ONLY after successful spawn — via intent resolution
|
|
3127
|
+
const transition = await moveTicketByIntent({
|
|
3128
|
+
db,
|
|
3129
|
+
storage: this.storage,
|
|
3130
|
+
ticket,
|
|
3131
|
+
intent: 'started',
|
|
3132
|
+
providerName: 'pmo',
|
|
3133
|
+
resolveProvider: (tid, pid) => this.resolveTicketProvider(tid, pid),
|
|
3134
|
+
});
|
|
3135
|
+
await autoExportToBoard(this.pmoPath, this.storage, () => { });
|
|
3136
|
+
this.log(styles.success(` ✓ ${ticket.id} started (${execution.id})`));
|
|
3071
3137
|
}
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
// Include diagnostic details in the error message
|
|
3094
|
-
const spawnError = result.error || 'Unknown error';
|
|
3095
|
-
const diag = runPreflightChecks({
|
|
3096
|
-
environment,
|
|
3097
|
-
executor,
|
|
3098
|
-
db,
|
|
3099
|
-
ticket: { id: ticket.id, title: ticket.title },
|
|
3100
|
-
agentDir: context.agentDir,
|
|
3101
|
-
});
|
|
3102
|
-
const diagIssues = diag.errors;
|
|
3103
|
-
if (diagIssues.length > 0) {
|
|
3104
|
-
const details = diagIssues.map(e => `${e.label}: ${e.message}`).join('; ');
|
|
3105
|
-
throw new Error(`${spawnError} [${details}]`);
|
|
3138
|
+
else {
|
|
3139
|
+
executionStorage.updateStatus(execution.id, 'failed');
|
|
3140
|
+
updateMirrorExecution(mirrorHandle, {
|
|
3141
|
+
status: 'failed',
|
|
3142
|
+
errorMessage: result.error,
|
|
3143
|
+
});
|
|
3144
|
+
// Include diagnostic details in the error message
|
|
3145
|
+
const spawnError = result.error || 'Unknown error';
|
|
3146
|
+
const diag = runPreflightChecks({
|
|
3147
|
+
environment,
|
|
3148
|
+
executor,
|
|
3149
|
+
db,
|
|
3150
|
+
ticket: { id: ticket.id, title: ticket.title },
|
|
3151
|
+
agentDir: context.agentDir,
|
|
3152
|
+
});
|
|
3153
|
+
const diagIssues = diag.errors;
|
|
3154
|
+
if (diagIssues.length > 0) {
|
|
3155
|
+
const details = diagIssues.map(e => `${e.label}: ${e.message}`).join('; ');
|
|
3156
|
+
throw new Error(`${spawnError} [${details}]`);
|
|
3157
|
+
}
|
|
3158
|
+
throw new Error(spawnError);
|
|
3106
3159
|
}
|
|
3107
|
-
|
|
3160
|
+
}
|
|
3161
|
+
finally {
|
|
3162
|
+
closeMirrorExecution(mirrorHandle);
|
|
3108
3163
|
}
|
|
3109
3164
|
}
|
|
3110
3165
|
}
|