@oar-sh/oar 0.9.11 → 0.9.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 (63) hide show
  1. package/CHANGELOG.md +126 -0
  2. package/README.md +10 -10
  3. package/package.json +1 -1
  4. package/server/README.md +17 -3
  5. package/server/claude-worker/claude-remote-relay-tool.mjs +2 -0
  6. package/server/claude-worker/claude-sdk-adapter.mjs +57 -4
  7. package/server/claude-worker/claude-session-process.mjs +128 -0
  8. package/server/claude-worker/claude-session-worker.mjs +17 -0
  9. package/server/claude-worker/task-output-discovery.mjs +126 -0
  10. package/server/copilot-worker/copilot-sdk-session-process.mjs +159 -3
  11. package/server/copilot-worker/copilot-sdk-session-worker.mjs +2 -0
  12. package/server/copilot-worker/copilot-shell-output-mirror.mjs +94 -0
  13. package/server/copilot-worker/copilot-task-settle.mjs +96 -0
  14. package/server/db-schema.mjs +9 -0
  15. package/server/grok-worker/acp-host-services.mjs +42 -3
  16. package/server/grok-worker/grok-background-tasks.mjs +241 -0
  17. package/server/grok-worker/grok-sdk-adapter.mjs +3 -1
  18. package/server/grok-worker/grok-session-worker.mjs +33 -1
  19. package/server/grok-worker/grok-turn-runner.mjs +11 -0
  20. package/server/migrations/0017-conversation-history-indexes.mjs +89 -0
  21. package/server/public/app/api-client.js +13 -0
  22. package/server/public/app/background-tasks-view.mjs +285 -16
  23. package/server/public/app/bootstrap.js +95 -5
  24. package/server/public/app/claude-background-command-limit-options.mjs +21 -0
  25. package/server/public/app/conversation-payload-cache.mjs +357 -0
  26. package/server/public/app/conversation-turn-state.mjs +1 -1
  27. package/server/public/app/conversation-view.js +433 -3
  28. package/server/public/app/conversation-window-retention.mjs +96 -0
  29. package/server/public/app/journal-view.js +252 -66
  30. package/server/public/app/relay-prompt-sanitizer.mjs +11 -4
  31. package/server/public/app/settings-modal.js +110 -2
  32. package/server/public/app/socket-handlers.js +59 -7
  33. package/server/public/app/store.js +25 -0
  34. package/server/public/app/subagent-viewer.mjs +7 -1
  35. package/server/public/app/task-console-render.mjs +237 -0
  36. package/server/public/app/task-console-watch.mjs +42 -0
  37. package/server/public/app/task-console.mjs +630 -0
  38. package/server/public/app/task-output-text.mjs +234 -0
  39. package/server/public/app/transcript-island.mjs +73 -0
  40. package/server/public/app/transcript-jump-bottom-view.mjs +38 -8
  41. package/server/public/app/transcript-jump-bottom.mjs +48 -11
  42. package/server/public/app/transcript-reading-anchor.mjs +256 -0
  43. package/server/public/app/transcript-reload-freshness.mjs +17 -1
  44. package/server/public/app/transcript-viewport-anchor.mjs +20 -1
  45. package/server/public/index.html +239 -6
  46. package/server/relay-tools.md +1 -0
  47. package/server/repositories/message-repository.mjs +8 -0
  48. package/server/repositories/question-repository.mjs +4 -0
  49. package/server/routes/messages-routes.mjs +249 -3
  50. package/server/routes/sessions-routes.mjs +133 -63
  51. package/server/server-runtime.mjs +77 -0
  52. package/server/services/background-task-store.mjs +240 -3
  53. package/server/services/cli-process-runner.mjs +4 -21
  54. package/server/services/conversation-history-page.mjs +199 -0
  55. package/server/services/relay-prompt-sanitizer.mjs +11 -4
  56. package/server/services/remote-relay-dispatcher.mjs +130 -2
  57. package/server/services/session-activity-tracker.mjs +6 -2
  58. package/server/services/task-output-rooms.mjs +259 -0
  59. package/server/services/task-output-service.mjs +562 -0
  60. package/shared/claude-background-command-limit.mjs +83 -0
  61. package/shared/remote-relay-contract.mjs +32 -2
  62. package/shared/task-output-text.mjs +737 -0
  63. package/shared/worker-runtime/task-output-spool.mjs +181 -0
@@ -37,6 +37,7 @@ export const REMOTE_RELAY_ACTIONS = Object.freeze([
37
37
  'usage',
38
38
  'list_sessions',
39
39
  'read_session',
40
+ 'read_task_output',
40
41
  'wait',
41
42
  'send',
42
43
  'create_session',
@@ -63,6 +64,7 @@ export const REMOTE_RELAY_ACTION_PERMISSION = Object.freeze({
63
64
  usage: 'read',
64
65
  list_sessions: 'read',
65
66
  read_session: 'read',
67
+ read_task_output: 'read',
66
68
  wait: 'read',
67
69
  send: 'prompt',
68
70
  create_session: 'full',
@@ -120,6 +122,11 @@ export const REMOTE_RELAY_LIMITS = Object.freeze({
120
122
  listMax: 100,
121
123
  readDefault: 10,
122
124
  readMax: 50,
125
+ // read_task_output: lines of a background task's output, and the most
126
+ // text one call returns.
127
+ taskOutputLinesDefault: 200,
128
+ taskOutputLinesMax: 500,
129
+ taskOutputBytesMax: 32 * 1024,
123
130
  maxCharsDefault: 12000,
124
131
  maxCharsMax: 50000,
125
132
  perMessageChars: 4000,
@@ -235,6 +242,9 @@ export const REMOTE_RELAY_TOOL_DESCRIPTION =
235
242
  + 'usage reports what the provider plans of a relay have left (Copilot, Claude, Claude Cloud, Cursor, Grok: '
236
243
  + 'meters with used, allowance, remaining, utilization and reset time; providers not set up or not tracked say so) '
237
244
  + 'and whether a Claude usage limit has paused turns there, before you start work that costs. '
245
+ + 'read_task_output {session, task_id} reads the end of a background shell or Monitor task\'s output there '
246
+ + '(task ids from read_session\'s tasks; also for an hour after the task ended): the last lines, minutes '
247
+ + 'since its last output, and pass/fail counts when it is a test run; credentials are scrubbed. '
238
248
  + 'Event subscriptions: subscribe to sessions of this relay or of a paired relay (ids, or "all" for every '
239
249
  + 'session there, later ones too) and the relay wakes you with a message when something happens there: '
240
250
  + 'question_asked (with the question and its options), error (failed turn, usage limit, worker died), '
@@ -263,7 +273,8 @@ export const REMOTE_RELAY_TOOL_INPUT_SCHEMA = Object.freeze({
263
273
  type: 'string',
264
274
  enum: [...REMOTE_RELAY_ACTIONS],
265
275
  description: 'list_relays: the relays (this one included when allowed) and whether each is unlocked here. relay_info: providers, models, '
266
- + 'workspaces of a relay. usage: what each provider\'s plan has left there and any usage-limit pause. list_sessions / read_session: discover and read sessions. send: prompt an '
276
+ + 'workspaces of a relay. usage: what each provider\'s plan has left there and any usage-limit pause. list_sessions / read_session: discover and read sessions. '
277
+ + 'read_task_output: the end of a background shell task\'s output. send: prompt an '
267
278
  + 'existing session. create_session: start a new session with a first prompt. wait: keep waiting for '
268
279
  + 'a reply. answer_question: answer a question the remote agent asked. stop: stop the running turn. '
269
280
  + 'archive: archive a session. subscribe / unsubscribe / list_subscriptions / transfer_subscriptions: '
@@ -371,6 +382,13 @@ export const REMOTE_RELAY_TOOL_INPUT_SCHEMA = Object.freeze({
371
382
  subscription_id: { type: 'string', description: 'unsubscribe: the id subscribe returned, or "all".' },
372
383
  watcher: { type: 'string', description: 'list_subscriptions: another conversation\'s id, to see its subscriptions (default: this one).' },
373
384
  from: { type: 'string', description: 'transfer_subscriptions: the id of the conversation whose subscriptions move here.' },
385
+ task_id: { type: 'string', description: 'read_task_output: the background task\'s id (taskId in read_session\'s tasks).' },
386
+ lines: {
387
+ type: 'integer',
388
+ minimum: 1,
389
+ maximum: REMOTE_RELAY_LIMITS.taskOutputLinesMax,
390
+ description: `read_task_output: how many of the last output lines (default ${REMOTE_RELAY_LIMITS.taskOutputLinesDefault}).`,
391
+ },
374
392
  },
375
393
  required: ['action'],
376
394
  });
@@ -390,7 +408,7 @@ function invalid(error) {
390
408
  return { ok: false, code: REMOTE_RELAY_ERROR_CODES.invalidInput, error };
391
409
  }
392
410
 
393
- const SESSION_ACTIONS = new Set(['read_session', 'wait', 'send', 'stop', 'archive']);
411
+ const SESSION_ACTIONS = new Set(['read_session', 'read_task_output', 'wait', 'send', 'stop', 'archive']);
394
412
 
395
413
  /**
396
414
  * The longest wait a relay may be set to allow, from whatever was stored or
@@ -495,6 +513,18 @@ export function validateRemoteRelayToolInput(input = {}, { maxWaitSeconds } = {}
495
513
  args.max_chars = maxChars;
496
514
  args.include_activity = input?.include_activity === true || toText(input?.include_activity).toLowerCase() === 'true';
497
515
  optionalText('before', 1000);
516
+ } else if (action === 'read_task_output') {
517
+ const taskId = toText(input?.task_id);
518
+ if (!taskId) return invalid('read_task_output needs task_id (a taskId from read_session\'s tasks)');
519
+ if (taskId.length > 200 || /[\s/\\]/.test(taskId)) return invalid('task_id is not a task id');
520
+ args.task_id = taskId;
521
+ const lines = clampInteger(input?.lines, {
522
+ min: 1,
523
+ max: REMOTE_RELAY_LIMITS.taskOutputLinesMax,
524
+ fallback: REMOTE_RELAY_LIMITS.taskOutputLinesDefault,
525
+ });
526
+ if (lines === null) return invalid('lines must be a number');
527
+ args.lines = lines;
498
528
  } else if (action === 'wait') {
499
529
  const messageId = toText(input?.message_id);
500
530
  if (!messageId) return invalid('wait needs message_id (from send or create_session)');