@pasko70/pibo 1.7.10 → 1.7.12

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.
Files changed (41) hide show
  1. package/dist/apps/chat/chat-request-normalizers.js +1 -1
  2. package/dist/apps/chat/project-workflow-sessions.js +1 -1
  3. package/dist/apps/chat/ralph-api.js +1 -1
  4. package/dist/apps/chat-ui/assets/{dist-D6ImmtZ3.js → dist--lraqdDn.js} +1 -1
  5. package/dist/apps/chat-ui/assets/{dist-CCOZbHCt.js → dist-6pcjNbPQ.js} +1 -1
  6. package/dist/apps/chat-ui/assets/{dist-Daom6uMW.js → dist-CMFjl7MX.js} +1 -1
  7. package/dist/apps/chat-ui/assets/{dist-DTJJ5-iA.js → dist-COlFTw2x.js} +1 -1
  8. package/dist/apps/chat-ui/assets/{dist-DDQWCHTh.js → dist-CZSEM5So.js} +1 -1
  9. package/dist/apps/chat-ui/assets/{dist-Dgs6LwMW.js → dist-CajLLpaw.js} +1 -1
  10. package/dist/apps/chat-ui/assets/{dist-Bg2k47fY.js → dist-CoCvyd4f.js} +1 -1
  11. package/dist/apps/chat-ui/assets/{dist-BLYDOjGT.js → dist-Dgz3iWay.js} +1 -1
  12. package/dist/apps/chat-ui/assets/{dist-BLQTYmgi.js → dist-IlQbTNzw.js} +1 -1
  13. package/dist/apps/chat-ui/assets/{dist-Bv912fTl.js → dist-YdEosvsr.js} +1 -1
  14. package/dist/apps/chat-ui/assets/{dist-LRUZKp77.js → dist-bLd-NaVv.js} +1 -1
  15. package/dist/apps/chat-ui/assets/{index-BnZ0V5cJ.js → index-HPWlrJwv.js} +3 -3
  16. package/dist/apps/chat-ui/index.html +1 -1
  17. package/dist/apps/chat-vscode-web/assets/{index-CiQZTRZH.js → index-Dge6XEYB.js} +1 -1
  18. package/dist/apps/chat-vscode-web/index.html +1 -1
  19. package/dist/apps/cli-ui/InkSessionApp.js +3 -3
  20. package/dist/apps/cli-ui/cliSessionsCommand.js +1 -1
  21. package/dist/apps/vscode-artifacts/latest.vsix +0 -0
  22. package/dist/apps/vscode-artifacts/pibo-vscode-ext-1.7.12.vsix +0 -0
  23. package/dist/cli-session/fakeSessionSource.js +2 -2
  24. package/dist/cli.js +1 -1
  25. package/dist/core/routed-session.js +7 -0
  26. package/dist/core/runtime-telemetry.js +5 -5
  27. package/dist/core/runtime.js +22 -0
  28. package/dist/core/session-errors.js +16 -0
  29. package/dist/core/session-router.js +9 -0
  30. package/dist/core/thinking.js +1 -1
  31. package/dist/gateway/cli.js +35 -16
  32. package/dist/gateway/pidfile.js +90 -44
  33. package/dist/gateway/server.js +22 -16
  34. package/dist/gateway/web.js +29 -23
  35. package/dist/providers/openai-gpt56.js +2 -2
  36. package/dist/ralph/cli.js +2 -2
  37. package/dist/ralph/service.js +60 -20
  38. package/dist/ralph/store.js +2 -2
  39. package/dist/session-ui/commandCatalog.js +1 -1
  40. package/dist/tools/guides.js +1 -1
  41. package/package.json +1 -1
package/dist/ralph/cli.js CHANGED
@@ -121,13 +121,13 @@ export async function runRalphCli(argv = process.argv) {
121
121
  else
122
122
  for (const job of jobs)
123
123
  console.log(formatRalphJobLine(job)); store.close(); });
124
- program.command('add').description('Create a Ralph job').option('--template <id>', 'Built-in job template id').option('--prompt <text>', 'Task prompt').option('--name <name>', 'Job name').option('--description <text>', 'Job description').option('--profile <profile>', 'Agent profile', DEFAULT_PIBO_PROFILE_NAME).option('--room <room-id>', 'Target room id').option('--default-chat', 'Target the shared default chat').option('--max-iterations <n>', 'Stop after n completed run attempts').option('--model <provider/model>', 'Runtime model override, for example openai/gpt-5').option('--thinking <level>', 'Runtime thinking level override: off, minimal, low, medium, high, xhigh').option('--fast', 'Enable runtime fast mode').option('--no-fast', 'Disable runtime fast mode')
124
+ program.command('add').description('Create a Ralph job').option('--template <id>', 'Built-in job template id').option('--prompt <text>', 'Task prompt').option('--name <name>', 'Job name').option('--description <text>', 'Job description').option('--profile <profile>', 'Agent profile', DEFAULT_PIBO_PROFILE_NAME).option('--room <room-id>', 'Target room id').option('--default-chat', 'Target the shared default chat').option('--max-iterations <n>', 'Stop after n completed run attempts').option('--model <provider/model>', 'Runtime model override, for example openai/gpt-5').option('--thinking <level>', 'Runtime thinking level override: off, minimal, low, medium, high, xhigh, max').option('--fast', 'Enable runtime fast mode').option('--no-fast', 'Disable runtime fast mode')
125
125
  .option('--start', 'Start immediately').option('--json', 'Print JSON').action((options) => { const base = templatePatch(options.template); const prompt = options.prompt ?? base.prompt; if (typeof prompt !== 'string' || !prompt.trim())
126
126
  throw new Error('Choose --template <id> or provide --prompt <text>'); const input = { name: options.name ?? base.name, description: options.description ?? base.description, enabled: options.start === true, target: targetFromOptions(options), profile: options.profile, prompt, maxIterations: options.maxIterations !== undefined ? maxIterations(options.maxIterations) : typeof base.maxIterations === 'number' ? base.maxIterations : undefined, stopPolicy: base.stopPolicy ?? undefined }; applyRuntimeCreateOptions(input, options); const store = createDefaultPiboRalphStore({ path: program.opts().store }); const job = store.createJob(input); if (options.json)
127
127
  printJson(job);
128
128
  else
129
129
  console.log(`${job.id}\t${job.enabled ? 'running' : 'stopped'}\t${job.name}`); store.close(); });
130
- program.command('edit').argument('<id>', 'Ralph job id').description('Update a Ralph job').option('--template <id>', 'Apply a built-in job template before explicit overrides').option('--prompt <text>', 'Task prompt').option('--name <name>', 'Job name').option('--description <text>', 'Job description').option('--profile <profile>', 'Agent profile').option('--room <room-id>', 'Target room id').option('--default-chat', 'Target the shared default chat').option('--max-iterations <n>', 'Stop after n completed run attempts').option('--model <provider/model>', 'Set runtime model override, for example openai/gpt-5').option('--clear-model', 'Clear runtime model override').option('--thinking <level>', 'Set runtime thinking level override: off, minimal, low, medium, high, xhigh').option('--clear-thinking', 'Clear runtime thinking level override').option('--fast', 'Enable runtime fast mode').option('--no-fast', 'Disable runtime fast mode').option('--clear-fast', 'Clear runtime fast mode override').option('--json', 'Print JSON').action((id, options) => { const store = createDefaultPiboRalphStore({ path: program.opts().store }); const patch = { ...templatePatch(options.template) }; if (options.name !== undefined)
130
+ program.command('edit').argument('<id>', 'Ralph job id').description('Update a Ralph job').option('--template <id>', 'Apply a built-in job template before explicit overrides').option('--prompt <text>', 'Task prompt').option('--name <name>', 'Job name').option('--description <text>', 'Job description').option('--profile <profile>', 'Agent profile').option('--room <room-id>', 'Target room id').option('--default-chat', 'Target the shared default chat').option('--max-iterations <n>', 'Stop after n completed run attempts').option('--model <provider/model>', 'Set runtime model override, for example openai/gpt-5').option('--clear-model', 'Clear runtime model override').option('--thinking <level>', 'Set runtime thinking level override: off, minimal, low, medium, high, xhigh, max').option('--clear-thinking', 'Clear runtime thinking level override').option('--fast', 'Enable runtime fast mode').option('--no-fast', 'Disable runtime fast mode').option('--clear-fast', 'Clear runtime fast mode override').option('--json', 'Print JSON').action((id, options) => { const store = createDefaultPiboRalphStore({ path: program.opts().store }); const patch = { ...templatePatch(options.template) }; if (options.name !== undefined)
131
131
  patch.name = options.name; if (options.description !== undefined)
132
132
  patch.description = options.description; if (options.profile !== undefined)
133
133
  patch.profile = options.profile; if (options.prompt !== undefined)
@@ -10,6 +10,14 @@ import { createDefaultPiboRalphStore } from './store.js';
10
10
  import { createBuiltInRalphStopConditions, evaluateRalphStopPolicy } from './stopping.js';
11
11
  const CHAT_WEB_CHANNEL = 'pibo.chat-web';
12
12
  function errorMessage(error) { return error instanceof Error ? error.message : String(error); }
13
+ class RalphRunTimeoutError extends Error {
14
+ abortFailed;
15
+ constructor(message, abortFailed = false) {
16
+ super(message);
17
+ this.abortFailed = abortFailed;
18
+ this.name = 'RalphRunTimeoutError';
19
+ }
20
+ }
13
21
  function isUnknownProfileErrorMessage(message) { return /^Unknown profile "[^"]+"/.test(message); }
14
22
  function buildRalphPrompt(job) { return ['You are running a continuous Pibo Ralph job.', `Job: ${job.name}`, `Target: ${job.target.kind}`, '', 'Complete the task below. Return the result in this session. When this session finishes, Ralph may start a fresh session with the same task unless a configured stop condition is satisfied.', 'Important: if this job uses a promise-complete stop condition, do not quote, negate, explain, or mention its literal completion marker unless the task is fully complete and you intend to stop the job.', '', 'Task:', job.prompt].join('\n'); }
15
23
  function isJsonObject(value) { return !!value && typeof value === 'object' && !Array.isArray(value); }
@@ -137,9 +145,10 @@ export class PiboRalphService {
137
145
  const cancelled = this.cancelledRuns.delete(run.id);
138
146
  const message = errorMessage(error);
139
147
  const fatalProfileError = !cancelled && isUnknownProfileErrorMessage(message);
148
+ const timeoutAbortFailed = error instanceof RalphRunTimeoutError && error.abortFailed;
140
149
  const outcome = { status: cancelled ? 'cancelled' : 'error', error: cancelled ? undefined : message };
141
150
  const { evaluation, conditionStates } = await this.evaluateStopPolicy(this.store.getJob(job.id) ?? job, 'after-run', run, outcome);
142
- this.store.completeRun({ jobId: job.id, runId: run.id, status: outcome.status, error: outcome.error, reason: cancelled ? 'cancelled' : fatalProfileError ? 'unknown-profile' : evaluation.reason, stopAfterRun: fatalProfileError || evaluation.finalAction !== 'continue', stopEvaluation: evaluation, conditionStates });
151
+ this.store.completeRun({ jobId: job.id, runId: run.id, status: outcome.status, error: outcome.error, reason: cancelled ? 'cancelled' : fatalProfileError ? 'unknown-profile' : timeoutAbortFailed ? 'timeout-abort-failed' : evaluation.reason, stopAfterRun: fatalProfileError || timeoutAbortFailed || evaluation.finalAction !== 'continue', stopEvaluation: evaluation, conditionStates });
143
152
  await this.cleanupRunResources(job, run);
144
153
  if (!cancelled)
145
154
  console.error(`[ralph] job ${job.id} failed`, error);
@@ -256,24 +265,55 @@ export class PiboRalphService {
256
265
  } const room = this.roomService.ensureDefaultRoom({ name: 'Shared Chat' }); return { roomId: room.id, workspace: room.workspace ?? getDefaultPiboWorkspace() }; }
257
266
  async emitMessageAndWait(piboSessionId, text, options = {}) {
258
267
  const eventId = `ralph_msg_${randomUUID()}`;
259
- return await new Promise((resolve, reject) => { let settled = false; let deltaAnswer = ''; let finalAnswer = ''; let lastSessionError; let unsubscribe; let timeout; const finish = (error) => { if (settled)
260
- return; settled = true; if (timeout)
261
- clearTimeout(timeout); unsubscribe?.(); if (error)
262
- reject(error);
263
- else
264
- resolve(finalAnswer || deltaAnswer); }; if (this.runTimeoutMs !== undefined)
265
- timeout = setTimeout(() => finish(new Error(lastSessionError ? `Ralph run timed out after session error: ${lastSessionError}` : 'Ralph run timed out')), this.runTimeoutMs); unsubscribe = this.options.context.subscribe((event) => { if (event.piboSessionId !== piboSessionId)
266
- return; if ('eventId' in event && event.eventId !== eventId)
267
- return; if (event.type === 'assistant_delta')
268
- deltaAnswer += event.text; if (event.type === 'assistant_message') {
269
- finalAnswer = event.text;
270
- lastSessionError = undefined;
271
- } if (event.type === 'message_finished')
272
- finish(lastSessionError ? new Error(lastSessionError) : undefined); if (event.type === 'session_error') {
273
- lastSessionError = event.error;
274
- const providerAttempt = event.errorDetails?.origin === 'provider' && Boolean(event.errorDetails.api || event.errorDetails.provider || event.errorDetails.model);
275
- if (!providerAttempt || options.isCancelled?.())
276
- finish(new Error(event.error));
277
- } }); this.options.context.emit({ type: 'message', piboSessionId, id: eventId, source: 'service', text }).catch((error) => finish(error instanceof Error ? error : new Error(String(error)))); });
268
+ return await new Promise((resolve, reject) => {
269
+ let settled = false;
270
+ let deltaAnswer = '';
271
+ let finalAnswer = '';
272
+ let lastSessionError;
273
+ let timingOut = false;
274
+ let unsubscribe;
275
+ let timeout;
276
+ const finish = (error) => {
277
+ if (settled)
278
+ return;
279
+ settled = true;
280
+ if (timeout)
281
+ clearTimeout(timeout);
282
+ unsubscribe?.();
283
+ if (error)
284
+ reject(error);
285
+ else
286
+ resolve(finalAnswer || deltaAnswer);
287
+ };
288
+ if (this.runTimeoutMs !== undefined) {
289
+ timeout = setTimeout(() => {
290
+ timingOut = true;
291
+ const message = lastSessionError ? `Ralph run timed out after session error: ${lastSessionError}` : 'Ralph run timed out';
292
+ void this.options.context.emit({ type: 'execution', piboSessionId, action: 'abort', id: `ralph_timeout_${randomUUID()}` })
293
+ .then(() => finish(new RalphRunTimeoutError(message)), (abortError) => finish(new RalphRunTimeoutError(`${message}; session abort failed: ${errorMessage(abortError)}`, true)));
294
+ }, this.runTimeoutMs);
295
+ }
296
+ unsubscribe = this.options.context.subscribe((event) => {
297
+ if (timingOut || event.piboSessionId !== piboSessionId)
298
+ return;
299
+ if ('eventId' in event && event.eventId !== eventId)
300
+ return;
301
+ if (event.type === 'assistant_delta')
302
+ deltaAnswer += event.text;
303
+ if (event.type === 'assistant_message') {
304
+ finalAnswer = event.text;
305
+ lastSessionError = undefined;
306
+ }
307
+ if (event.type === 'message_finished')
308
+ finish(lastSessionError ? new Error(lastSessionError) : undefined);
309
+ if (event.type === 'session_error') {
310
+ lastSessionError = event.error;
311
+ const providerAttempt = event.errorDetails?.origin === 'provider' && Boolean(event.errorDetails.api || event.errorDetails.provider || event.errorDetails.model);
312
+ if (!providerAttempt || options.isCancelled?.())
313
+ finish(new Error(event.error));
314
+ }
315
+ });
316
+ this.options.context.emit({ type: 'message', piboSessionId, id: eventId, source: 'service', text }).catch((error) => finish(error instanceof Error ? error : new Error(String(error))));
317
+ });
278
318
  }
279
319
  }
@@ -111,7 +111,7 @@ function normalizeThinkingLevel(value) {
111
111
  if (value === undefined || value === null)
112
112
  return undefined;
113
113
  if (!isPiboThinkingLevel(value))
114
- throw new Error('thinkingLevel must be one of off, minimal, low, medium, high, xhigh');
114
+ throw new Error('thinkingLevel must be one of off, minimal, low, medium, high, xhigh, max');
115
115
  return value;
116
116
  }
117
117
  function normalizeFastMode(value) {
@@ -328,7 +328,7 @@ export class PiboRalphStore {
328
328
  if (!job)
329
329
  return;
330
330
  const timestamp = nowIso(now);
331
- const state = { ...job.state, runningAt: undefined, conditionStates: input.conditionStates ?? job.state.conditionStates, lastStopEvaluation: input.evaluation };
331
+ const state = { ...job.state, conditionStates: input.conditionStates ?? job.state.conditionStates, lastStopEvaluation: input.evaluation };
332
332
  this.db.prepare('UPDATE pibo_ralph_jobs SET enabled = ?, state_json = ?, updated_at = ? WHERE id = ?').run(input.disable ? 0 : job.enabled ? 1 : 0, JSON.stringify(state), timestamp, job.id);
333
333
  }
334
334
  completeRun(input, now = new Date()) {
@@ -18,7 +18,7 @@ export const WEB_PARITY_SLASH_COMMANDS = [
18
18
  { id: "kill", slash: "/kill", actionName: "kill", description: "Dispose the active session runtime.", group: "runtime", support: "terminal-adapted" },
19
19
  { id: "kill-all", slash: "/kill-all", actionName: "kill-all", description: "Dispose all routed runtimes for the selected app context when supported.", group: "runtime", support: "terminal-adapted" },
20
20
  { id: "fast", slash: "/fast", actionName: "fast_mode", description: "Toggle fast mode for the active session.", argumentHint: "[on|off]", group: "runtime", support: "terminal-adapted" },
21
- { id: "thinking", slash: "/thinking", actionName: "thinking", description: "Show or set model thinking level.", argumentHint: "[off|minimal|low|medium|high|xhigh]", group: "runtime", support: "terminal-adapted", terminalAdaptation: "Without an argument, open a keyboard picker." },
21
+ { id: "thinking", slash: "/thinking", actionName: "thinking", description: "Show or set model thinking level.", argumentHint: "[off|minimal|low|medium|high|xhigh|max]", group: "runtime", support: "terminal-adapted", terminalAdaptation: "Without an argument, open a keyboard picker." },
22
22
  { id: "model", slash: "/model", actionName: "model", description: "Choose an authenticated provider model.", group: "runtime", support: "terminal-adapted", terminalAdaptation: "Open provider and model pickers." },
23
23
  { id: "login", slash: "/login", actionName: "login", description: "Authenticate a model provider.", group: "runtime", support: "terminal-adapted", terminalAdaptation: "Show provider/auth-method instructions in terminal." },
24
24
  { id: "session-current", slash: "/session-current", actionName: "session-current", description: "Show metadata for the active session.", group: "session", support: "terminal-adapted" },
@@ -78,7 +78,7 @@ pibo ralph edit <job-id> --model openai/gpt-5 --thinking medium --no-fast --json
78
78
  pibo ralph edit <job-id> --clear-model --clear-thinking --clear-fast --json
79
79
  \`\`\`
80
80
 
81
- Use \`--model <provider/model>\`, \`--thinking off|minimal|low|medium|high|xhigh\`, and \`--fast\`/\`--no-fast\` to set runtime options. Use the \`--clear-*\` flags on \`edit\` to return to profile/default runtime behavior.
81
+ Use \`--model <provider/model>\`, \`--thinking off|minimal|low|medium|high|xhigh|max\`, and \`--fast\`/\`--no-fast\` to set runtime options. Use the \`--clear-*\` flags on \`edit\` to return to profile/default runtime behavior.
82
82
 
83
83
  ## Inspect and Debug
84
84
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pasko70/pibo",
3
- "version": "1.7.10",
3
+ "version": "1.7.12",
4
4
  "type": "module",
5
5
  "imports": {
6
6
  "vscode": "./src/apps/chat-vscode/extension/src/vscode-shim.js"