@oar-sh/oar 0.9.8 → 0.9.10
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/CHANGELOG.md +478 -0
- package/README.md +129 -39
- package/bin/bat/oar.bat +46 -46
- package/bin/oar.js +814 -228
- package/package.json +5 -6
- package/server/README.md +306 -4
- package/server/claude-worker/claude-remote-relay-tool.mjs +10 -0
- package/server/claude-worker/claude-session-process.mjs +35 -1
- package/server/claude-worker/claude-turn-publisher.mjs +3 -0
- package/server/claude-worker/sdk-message-normalizer.mjs +31 -4
- package/server/claude-worker/subagent-timeline-recorder.mjs +572 -0
- package/server/copilot-worker/copilot-sdk-session-process.mjs +3 -1
- package/server/cursor-worker/cursor-sdk-adapter.mjs +56 -2
- package/server/db-schema.mjs +44 -0
- package/server/migrations/0008-message-pins.mjs +85 -0
- package/server/migrations/0009-subagent-timeline.mjs +135 -0
- package/server/migrations/0010-subagent-timeline-pruning.mjs +89 -0
- package/server/migrations/0011-relay-event-subscriptions.mjs +125 -0
- package/server/migrations/0012-cross-relay-event-subscriptions.mjs +116 -0
- package/server/public/app/agent-exchange-fold-view.mjs +248 -0
- package/server/public/app/api-client.js +91 -0
- package/server/public/app/archive-confirm.mjs +28 -0
- package/server/public/app/ask-user-view.js +3 -0
- package/server/public/app/attachments-view.js +1024 -131
- package/server/public/app/back-guard.mjs +58 -0
- package/server/public/app/background-tasks-view.mjs +18 -26
- package/server/public/app/bootstrap.js +230 -35
- package/server/public/app/chat-actions-menu-state.mjs +116 -0
- package/server/public/app/claude-cloud-conversation-ui.js +10 -22
- package/server/public/app/composer-control-state.mjs +16 -0
- package/server/public/app/composer-keyboard.mjs +54 -0
- package/server/public/app/conversation-view.js +471 -110
- package/server/public/app/explorer-edit-state.mjs +68 -0
- package/server/public/app/external-link-policy.mjs +4 -1
- package/server/public/app/file-version.mjs +58 -0
- package/server/public/app/host-suspend-ui.js +6 -3
- package/server/public/app/journal-view.js +161 -27
- package/server/public/app/no-conversation-state.mjs +58 -0
- package/server/public/app/pinned-messages-view.mjs +253 -0
- package/server/public/app/provider-readiness.mjs +120 -0
- package/server/public/app/pwa-install.js +1 -1
- package/server/public/app/relay-board-view.js +3 -0
- package/server/public/app/relay-dot-state.mjs +8 -1
- package/server/public/app/relay-event-subscriptions-ui.js +184 -0
- package/server/public/app/relay-event-view.mjs +234 -0
- package/server/public/app/router.js +8 -2
- package/server/public/app/settings-modal.js +53 -1
- package/server/public/app/socket-handlers.js +65 -28
- package/server/public/app/store.js +25 -2
- package/server/public/app/subagent-row.mjs +138 -0
- package/server/public/app/subagent-timeline-view.mjs +186 -0
- package/server/public/app/subagent-viewer-watch.mjs +50 -0
- package/server/public/app/subagent-viewer.mjs +534 -0
- package/server/public/app/task-row-format.mjs +29 -0
- package/server/public/app/thinking-follow.js +4 -0
- package/server/public/app/transcript-jump-bottom-view.mjs +290 -0
- package/server/public/app/transcript-jump-bottom.mjs +99 -0
- package/server/public/app/transcript-reload-freshness.mjs +25 -0
- package/server/public/app/update-ui.js +1 -1
- package/server/public/app/viewer-chat-gallery.mjs +59 -0
- package/server/public/app/viewer-controls-state.mjs +59 -0
- package/server/public/app/viewer-gallery.mjs +46 -0
- package/server/public/app/viewer-gestures.mjs +105 -0
- package/server/public/app/viewer-history.mjs +45 -0
- package/server/public/app/viewer-tap.mjs +112 -0
- package/server/public/index.html +700 -59
- package/server/repositories/message-pin-statements.mjs +39 -0
- package/server/repositories/message-repository.mjs +34 -3
- package/server/repositories/question-repository.mjs +9 -3
- package/server/repositories/remote-relay-repository.mjs +6 -2
- package/server/repositories/subagent-timeline-statements.mjs +170 -0
- package/server/routes/ask-user-routes.mjs +3 -0
- package/server/routes/messages-routes.mjs +548 -111
- package/server/routes/relay-event-routes.mjs +157 -0
- package/server/routes/remote-relay-routes.mjs +15 -0
- package/server/routes/sessions-routes.mjs +164 -24
- package/server/server-runtime.mjs +274 -62
- package/server/services/cloudflared-tunnel-service.mjs +139 -41
- package/server/services/explorer-entry-name.mjs +26 -0
- package/server/services/explorer-mutations.mjs +122 -0
- package/server/services/file-serving.mjs +155 -0
- package/server/services/message-pin-list.mjs +52 -0
- package/server/services/oar-cli-helpers.mjs +139 -4
- package/server/services/oar-cli-menu.mjs +240 -0
- package/server/services/oar-cli-wsl.mjs +129 -0
- package/server/services/preview-proxy-server.mjs +41 -23
- package/server/services/push-dispatch-service.mjs +18 -0
- package/server/services/relay-event-link-service.mjs +289 -0
- package/server/services/relay-event-service.mjs +1935 -0
- package/server/services/relay-shutdown-gate.mjs +31 -0
- package/server/services/remote-relay-caller-context.mjs +52 -7
- package/server/services/remote-relay-dispatcher.mjs +494 -2
- package/server/services/remote-relay-registry-service.mjs +11 -1
- package/server/services/safe-served-content.mjs +61 -11
- package/server/services/session-activity-tracker.mjs +487 -0
- package/server/services/session-history-refresh-service.mjs +31 -0
- package/server/services/stale-attempt-log-limiter.mjs +96 -0
- package/server/services/stale-recovery-clock-guard.mjs +57 -0
- package/server/services/stale-subagent-run-sweep.mjs +109 -0
- package/server/services/subagent-record-retention.mjs +164 -0
- package/server/services/subagent-timeline-service.mjs +328 -0
- package/server/services/subagent-viewer-rooms.mjs +119 -0
- package/server/services/upgrade-socket-guard.mjs +16 -0
- package/shared/relay-events.mjs +371 -0
- package/shared/remote-relay-contract.mjs +157 -5
- package/shared/subagent-record-retention.mjs +31 -0
- package/shared/subagent-timeline.mjs +79 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// The sub-agent timeline's vocabulary and limits, shared by the workers that
|
|
2
|
+
// write it and the relay that stores and serves it.
|
|
3
|
+
|
|
4
|
+
export const SUBAGENT_TIMELINE_KINDS = Object.freeze(['thought', 'tool_call', 'tool_result', 'text', 'child', 'note']);
|
|
5
|
+
|
|
6
|
+
// Entries kept per run. One more, a note, says the record was cut there.
|
|
7
|
+
export const SUBAGENT_TIMELINE_MAX_ENTRIES = 2000;
|
|
8
|
+
|
|
9
|
+
// A tool result is kept to its first 4 KB: enough to see what came back,
|
|
10
|
+
// without a file read or a build log filling the database.
|
|
11
|
+
export const SUBAGENT_TOOL_RESULT_MAX_CHARS = 4096;
|
|
12
|
+
|
|
13
|
+
// Safety limit for every other entry (a thought, a tool call's input, reply
|
|
14
|
+
// text). Real entries stay far below it.
|
|
15
|
+
export const SUBAGENT_TIMELINE_ENTRY_MAX_CHARS = 256 * 1024;
|
|
16
|
+
|
|
17
|
+
export const SUBAGENT_TIMELINE_TOOL_NAME_MAX_CHARS = 200;
|
|
18
|
+
|
|
19
|
+
export function isSubagentTimelineKind(kind) {
|
|
20
|
+
return SUBAGENT_TIMELINE_KINDS.includes(String(kind || ''));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function subagentTimelineTextLimit(kind) {
|
|
24
|
+
return kind === 'tool_result' ? SUBAGENT_TOOL_RESULT_MAX_CHARS : SUBAGENT_TIMELINE_ENTRY_MAX_CHARS;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Cut `text` to the limit of its kind. Returns the text kept and, when it was
|
|
29
|
+
* cut, the original length (`cut`), which travels in the entry's metadata so
|
|
30
|
+
* the viewer can say how much is missing. Text a writer already cut keeps the
|
|
31
|
+
* writer's original length.
|
|
32
|
+
*/
|
|
33
|
+
export function cutSubagentTimelineText(kind, text, { cut: priorCut = null } = {}) {
|
|
34
|
+
const value = String(text ?? '');
|
|
35
|
+
const limit = subagentTimelineTextLimit(kind);
|
|
36
|
+
if (value.length <= limit) return { text: value, cut: Number.isFinite(priorCut) ? priorCut : null };
|
|
37
|
+
return { text: value.slice(0, limit), cut: Number.isFinite(priorCut) ? Math.max(priorCut, value.length) : value.length };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// The input fields a tool call is known by, in order of preference. The
|
|
41
|
+
// viewer's toolCallSummary (public/app/subagent-timeline-view.mjs) uses the
|
|
42
|
+
// same list; a test keeps the two in step.
|
|
43
|
+
export const SUBAGENT_TOOL_CALL_SUMMARY_FIELDS = Object.freeze(['command', 'file_path', 'path', 'pattern', 'url', 'query', 'description', 'prompt', 'notebook_path', 'skill']);
|
|
44
|
+
export const SUBAGENT_TOOL_CALL_SUMMARY_MAX_CHARS = 200;
|
|
45
|
+
|
|
46
|
+
/** The one line a tool call is known by: its command, path, pattern… */
|
|
47
|
+
export function subagentToolCallSummary(text) {
|
|
48
|
+
const value = String(text || '').trim();
|
|
49
|
+
let input = null;
|
|
50
|
+
if (value.startsWith('{')) {
|
|
51
|
+
try {
|
|
52
|
+
const parsed = JSON.parse(value);
|
|
53
|
+
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) input = parsed;
|
|
54
|
+
} catch {}
|
|
55
|
+
}
|
|
56
|
+
if (input) {
|
|
57
|
+
for (const field of SUBAGENT_TOOL_CALL_SUMMARY_FIELDS) {
|
|
58
|
+
const fieldValue = input[field];
|
|
59
|
+
if (typeof fieldValue === 'string' && fieldValue.trim()) return fieldValue.replace(/\s+/g, ' ').trim().slice(0, SUBAGENT_TOOL_CALL_SUMMARY_MAX_CHARS);
|
|
60
|
+
}
|
|
61
|
+
const keys = Object.keys(input);
|
|
62
|
+
return keys.length ? keys.slice(0, 4).join(', ') : '';
|
|
63
|
+
}
|
|
64
|
+
return String(text || '').split('\n')[0].trim().slice(0, SUBAGENT_TOOL_CALL_SUMMARY_MAX_CHARS);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Status words the relay keeps for a run. */
|
|
68
|
+
export function normalizeSubagentRunStatus(status) {
|
|
69
|
+
const value = String(status || '').trim().toLowerCase();
|
|
70
|
+
if (value === 'completed' || value === 'complete' || value === 'done' || value === 'succeeded') return 'completed';
|
|
71
|
+
if (value === 'failed' || value === 'error' || value === 'errored') return 'failed';
|
|
72
|
+
if (value === 'stopped' || value === 'cancelled' || value === 'canceled' || value === 'killed') return 'cancelled';
|
|
73
|
+
if (value === 'running' || value === '') return 'running';
|
|
74
|
+
return value.slice(0, 40);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function isTerminalSubagentRunStatus(status) {
|
|
78
|
+
return status === 'completed' || status === 'failed' || status === 'cancelled';
|
|
79
|
+
}
|