negotium 0.1.6 → 0.1.8
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 +2 -2
- package/dist/chunk-0ay6cjdy.js +1331 -0
- package/dist/chunk-0ay6cjdy.js.map +16 -0
- package/dist/chunk-1k7t7bnx.js +97 -0
- package/dist/chunk-1k7t7bnx.js.map +10 -0
- package/dist/chunk-5ahkew9c.js +806 -0
- package/dist/chunk-5ahkew9c.js.map +17 -0
- package/dist/chunk-6cpn7ht2.js +287 -0
- package/dist/chunk-6cpn7ht2.js.map +13 -0
- package/dist/chunk-6kctn20e.js +3529 -0
- package/dist/chunk-6kctn20e.js.map +20 -0
- package/dist/chunk-7xqj7aex.js +77 -0
- package/dist/chunk-7xqj7aex.js.map +11 -0
- package/dist/chunk-9p0ww3tk.js +41 -0
- package/dist/chunk-9p0ww3tk.js.map +10 -0
- package/dist/chunk-a92a7nrk.js +252 -0
- package/dist/chunk-a92a7nrk.js.map +10 -0
- package/dist/chunk-c500xe9z.js +33 -0
- package/dist/chunk-c500xe9z.js.map +10 -0
- package/dist/chunk-cds1qxsf.js +1644 -0
- package/dist/chunk-cds1qxsf.js.map +17 -0
- package/dist/chunk-e4407g8x.js +274 -0
- package/dist/chunk-e4407g8x.js.map +10 -0
- package/dist/chunk-e5pbggsh.js +363 -0
- package/dist/chunk-e5pbggsh.js.map +11 -0
- package/dist/chunk-edb07sjp.js +567 -0
- package/dist/chunk-edb07sjp.js.map +14 -0
- package/dist/chunk-exd0v74a.js +3012 -0
- package/dist/chunk-exd0v74a.js.map +32 -0
- package/dist/chunk-fgrme9tr.js +4398 -0
- package/dist/chunk-fgrme9tr.js.map +47 -0
- package/dist/chunk-fka9eqe1.js +581 -0
- package/dist/chunk-fka9eqe1.js.map +11 -0
- package/dist/chunk-g82jygez.js +108 -0
- package/dist/chunk-g82jygez.js.map +10 -0
- package/dist/chunk-ghs2j1fr.js +312 -0
- package/dist/chunk-ghs2j1fr.js.map +10 -0
- package/dist/chunk-gmy11efb.js +125 -0
- package/dist/chunk-gmy11efb.js.map +10 -0
- package/dist/chunk-gxma4c70.js +110 -0
- package/dist/chunk-gxma4c70.js.map +10 -0
- package/dist/chunk-hkdqhm34.js +61 -0
- package/dist/chunk-hkdqhm34.js.map +10 -0
- package/dist/chunk-hpa0cpzh.js +134 -0
- package/dist/chunk-hpa0cpzh.js.map +10 -0
- package/dist/chunk-hwy3n31w.js +21 -0
- package/dist/chunk-hwy3n31w.js.map +9 -0
- package/dist/chunk-j2behpy7.js +214 -0
- package/dist/chunk-j2behpy7.js.map +10 -0
- package/dist/chunk-jc0at0tc.js +102 -0
- package/dist/chunk-jc0at0tc.js.map +10 -0
- package/dist/chunk-jkqq5ef6.js +243 -0
- package/dist/chunk-jkqq5ef6.js.map +11 -0
- package/dist/chunk-jzkw2f01.js +51 -0
- package/dist/chunk-jzkw2f01.js.map +10 -0
- package/dist/chunk-jzz91jwh.js +70 -0
- package/dist/chunk-jzz91jwh.js.map +10 -0
- package/dist/chunk-k9z47mab.js +247 -0
- package/dist/chunk-k9z47mab.js.map +12 -0
- package/dist/chunk-n17yxpa8.js +23 -0
- package/dist/chunk-n17yxpa8.js.map +10 -0
- package/dist/chunk-naa09ags.js +2143 -0
- package/dist/chunk-naa09ags.js.map +15 -0
- package/dist/chunk-ns3ke88n.js +142 -0
- package/dist/chunk-ns3ke88n.js.map +10 -0
- package/dist/chunk-p3cr2ejg.js +1626 -0
- package/dist/chunk-p3cr2ejg.js.map +15 -0
- package/dist/chunk-q5bcpf23.js +2925 -0
- package/dist/chunk-q5bcpf23.js.map +20 -0
- package/dist/chunk-rafc55bs.js +424 -0
- package/dist/chunk-rafc55bs.js.map +11 -0
- package/dist/chunk-rbrxjvbj.js +2830 -0
- package/dist/chunk-rbrxjvbj.js.map +23 -0
- package/dist/chunk-sa874j5c.js +9 -0
- package/dist/chunk-sa874j5c.js.map +10 -0
- package/dist/chunk-sgsz2fpq.js +289 -0
- package/dist/chunk-sgsz2fpq.js.map +10 -0
- package/dist/chunk-sm6fh5c5.js +569 -0
- package/dist/chunk-sm6fh5c5.js.map +14 -0
- package/dist/chunk-t9zcg8f1.js +499 -0
- package/dist/chunk-t9zcg8f1.js.map +13 -0
- package/dist/chunk-vp2db42d.js +121 -0
- package/dist/chunk-vp2db42d.js.map +10 -0
- package/dist/chunk-w13jjf4a.js +46 -0
- package/dist/chunk-w13jjf4a.js.map +10 -0
- package/dist/chunk-x1arr7ze.js +63 -0
- package/dist/chunk-x1arr7ze.js.map +10 -0
- package/dist/chunk-xfq68rch.js +583 -0
- package/dist/chunk-xfq68rch.js.map +11 -0
- package/dist/main.js +132 -20
- package/dist/main.js.map +4 -4
- package/dist/runtime/scripts/faster-whisper-wrapper.py +87 -0
- package/dist/runtime/scripts/mcp-patchright-http.mjs +349 -0
- package/dist/runtime/src/agents/api-topic-agent-switch.ts +178 -0
- package/dist/runtime/src/agents/archiver.ts +396 -0
- package/dist/runtime/src/agents/auth-check.ts +64 -0
- package/dist/runtime/src/agents/claude-provider.ts +737 -0
- package/dist/runtime/src/agents/claude-registry.ts +115 -0
- package/dist/runtime/src/agents/codex-native-multi-agent.ts +177 -0
- package/dist/runtime/src/agents/codex-provider.ts +785 -0
- package/dist/runtime/src/agents/codex-registry.ts +115 -0
- package/dist/runtime/src/agents/codex-tree-kill.ts +365 -0
- package/dist/runtime/src/agents/contracts.ts +69 -0
- package/dist/runtime/src/agents/deep-map.ts +13 -0
- package/dist/runtime/src/agents/execution-host.ts +91 -0
- package/dist/runtime/src/agents/fixtures/claude-attachments.jsonl +2 -0
- package/dist/runtime/src/agents/fixtures/codex-shell.jsonl +5 -0
- package/dist/runtime/src/agents/fork.ts +65 -0
- package/dist/runtime/src/agents/hosted-agent.ts +48 -0
- package/dist/runtime/src/agents/idle-archiver.ts +128 -0
- package/dist/runtime/src/agents/index.ts +205 -0
- package/dist/runtime/src/agents/maestro-provider.ts +206 -0
- package/dist/runtime/src/agents/maestro-registry.ts +31 -0
- package/dist/runtime/src/agents/mcp-tools/ask-user.ts +280 -0
- package/dist/runtime/src/agents/mcp-tools/common.ts +21 -0
- package/dist/runtime/src/agents/mcp-tools/self-config.ts +220 -0
- package/dist/runtime/src/agents/mcp-tools/spawn-subagent.ts +525 -0
- package/dist/runtime/src/agents/mcp-tools/visuals.ts +88 -0
- package/dist/runtime/src/agents/model-catalog.ts +151 -0
- package/dist/runtime/src/agents/registry.ts +24 -0
- package/dist/runtime/src/agents/rollout/claude.ts +331 -0
- package/dist/runtime/src/agents/rollout/codex.ts +569 -0
- package/dist/runtime/src/agents/rollout/shared.ts +205 -0
- package/dist/runtime/src/agents/self-config-core.ts +415 -0
- package/dist/runtime/src/agents/task-events.ts +44 -0
- package/dist/runtime/src/agents/tool-format.ts +352 -0
- package/dist/runtime/src/agents/topic-agent-switch.ts +193 -0
- package/dist/runtime/src/agents/topic-cleanup.ts +231 -0
- package/dist/runtime/src/agents/vault-tool-policy.ts +33 -0
- package/dist/runtime/src/application/execute-external-user-turn.ts +23 -0
- package/dist/runtime/src/application/submit-user-message.ts +47 -0
- package/dist/runtime/src/application/switch-topic-effort.ts +48 -0
- package/dist/runtime/src/application/switch-topic-model.ts +79 -0
- package/dist/runtime/src/application/topic-service.ts +139 -0
- package/dist/runtime/src/application/vault-command.ts +170 -0
- package/dist/runtime/src/bus.ts +319 -0
- package/dist/runtime/src/index.ts +333 -0
- package/dist/runtime/src/mcp/agent-health-server.ts +309 -0
- package/dist/runtime/src/mcp/background-bash-server.ts +346 -0
- package/dist/runtime/src/mcp/canonical-bridge-config.ts +84 -0
- package/dist/runtime/src/mcp/canonical-proxy-server.ts +171 -0
- package/dist/runtime/src/mcp/dm-ipc.ts +60 -0
- package/dist/runtime/src/mcp/mcp-helpers.ts +40 -0
- package/dist/runtime/src/mcp/paddleocr-server.ts +105 -0
- package/dist/runtime/src/mcp/peer-bridge.ts +114 -0
- package/dist/runtime/src/mcp/runtime-spec.ts +134 -0
- package/dist/runtime/src/mcp/session-comm/bridge-ipc-config.ts +27 -0
- package/dist/runtime/src/mcp/session-comm/peer-forward.ts +165 -0
- package/dist/runtime/src/mcp/session-comm/runtime.ts +115 -0
- package/dist/runtime/src/mcp/session-comm/server.ts +649 -0
- package/dist/runtime/src/mcp/session-comm/topic-config.ts +131 -0
- package/dist/runtime/src/mcp/session-comm/topics.ts +229 -0
- package/dist/runtime/src/mcp/stdio-protect.ts +84 -0
- package/dist/runtime/src/mcp/system-health-server.ts +130 -0
- package/dist/runtime/src/mcp/task-server.ts +173 -0
- package/dist/runtime/src/mcp/token-stats-server.ts +98 -0
- package/dist/runtime/src/mcp/vault-http.ts +219 -0
- package/dist/runtime/src/mcp/vault-run.ts +153 -0
- package/dist/runtime/src/mcp/vault-server.ts +104 -0
- package/dist/runtime/src/mcp/wiki-server.ts +755 -0
- package/dist/runtime/src/media/file-events.ts +33 -0
- package/dist/runtime/src/media/text-extractor.ts +312 -0
- package/dist/runtime/src/media/video.ts +92 -0
- package/dist/runtime/src/outbox/file-ops.ts +210 -0
- package/dist/runtime/src/outbox/index.ts +8 -0
- package/dist/runtime/src/outbox/utils.ts +51 -0
- package/dist/runtime/src/platform/background-bash/manager.ts +279 -0
- package/dist/runtime/src/platform/config.ts +371 -0
- package/dist/runtime/src/platform/constants.ts +18 -0
- package/dist/runtime/src/platform/debug-users.ts +14 -0
- package/dist/runtime/src/platform/delay.ts +1 -0
- package/dist/runtime/src/platform/error.ts +9 -0
- package/dist/runtime/src/platform/file-utils.ts +16 -0
- package/dist/runtime/src/platform/jsonl.ts +202 -0
- package/dist/runtime/src/platform/lifecycle.ts +174 -0
- package/dist/runtime/src/platform/logger.ts +31 -0
- package/dist/runtime/src/platform/maestro-bootstrap-env.ts +3 -0
- package/dist/runtime/src/platform/mcp-config.ts +865 -0
- package/dist/runtime/src/platform/modules.ts +145 -0
- package/dist/runtime/src/platform/node-plugins.ts +46 -0
- package/dist/runtime/src/platform/playwright/manager.ts +1233 -0
- package/dist/runtime/src/prompts/agents/wiki-archiver.md +261 -0
- package/dist/runtime/src/prompts/builders.ts +357 -0
- package/dist/runtime/src/prompts/sessions/channel-system.md +48 -0
- package/dist/runtime/src/prompts/sessions/manager-system.md +37 -0
- package/dist/runtime/src/prompts/sessions/topic-system.md +47 -0
- package/dist/runtime/src/prompts/sessions/visual-design.md +86 -0
- package/dist/runtime/src/query/active-rooms.ts +532 -0
- package/dist/runtime/src/query/control.ts +313 -0
- package/dist/runtime/src/query/index.ts +24 -0
- package/dist/runtime/src/query/session-inbox-cleanup.ts +44 -0
- package/dist/runtime/src/query/session-inbox-path.ts +42 -0
- package/dist/runtime/src/query/state.ts +94 -0
- package/dist/runtime/src/query/types.ts +83 -0
- package/dist/runtime/src/runtime/ask-callbacks.ts +153 -0
- package/dist/runtime/src/runtime/attachments.ts +151 -0
- package/dist/runtime/src/runtime/background-sessions.ts +83 -0
- package/dist/runtime/src/runtime/channel-context.ts +107 -0
- package/dist/runtime/src/runtime/errors.ts +69 -0
- package/dist/runtime/src/runtime/event-heartbeat.ts +77 -0
- package/dist/runtime/src/runtime/file-hooks.ts +81 -0
- package/dist/runtime/src/runtime/footer.ts +23 -0
- package/dist/runtime/src/runtime/inbox.ts +946 -0
- package/dist/runtime/src/runtime/tasks.ts +56 -0
- package/dist/runtime/src/runtime/topic-config.ts +29 -0
- package/dist/runtime/src/runtime/turn-runner.ts +2286 -0
- package/dist/runtime/src/runtime/usage-alert.ts +84 -0
- package/dist/runtime/src/runtime/visual-html.ts +109 -0
- package/dist/runtime/src/runtime/visual-store.ts +430 -0
- package/dist/runtime/src/runtime/visuals.ts +171 -0
- package/dist/runtime/src/security/sanitize.ts +27 -0
- package/dist/runtime/src/security/sensitive-path.ts +34 -0
- package/dist/runtime/src/storage/activity-log.ts +152 -0
- package/dist/runtime/src/storage/api-messages.ts +617 -0
- package/dist/runtime/src/storage/api-topic-brief.ts +127 -0
- package/dist/runtime/src/storage/api-topic-config.ts +192 -0
- package/dist/runtime/src/storage/api-topics.ts +844 -0
- package/dist/runtime/src/storage/app-settings.ts +44 -0
- package/dist/runtime/src/storage/browser-profiles.ts +133 -0
- package/dist/runtime/src/storage/conversations.ts +268 -0
- package/dist/runtime/src/storage/forum/agent-settings.ts +20 -0
- package/dist/runtime/src/storage/forum/index.ts +4 -0
- package/dist/runtime/src/storage/forum/repository.ts +283 -0
- package/dist/runtime/src/storage/forum/schema.ts +300 -0
- package/dist/runtime/src/storage/forum-db.ts +23 -0
- package/dist/runtime/src/storage/runtime-events.ts +130 -0
- package/dist/runtime/src/storage/runtime-leases.ts +189 -0
- package/dist/runtime/src/storage/runtime-process-leases.ts +216 -0
- package/dist/runtime/src/storage/runtime-topic-state.ts +148 -0
- package/dist/runtime/src/storage/runtime-turn-requests.ts +300 -0
- package/dist/runtime/src/storage/self-schedules.ts +298 -0
- package/dist/runtime/src/storage/session-asks.ts +347 -0
- package/dist/runtime/src/storage/sqlite.ts +129 -0
- package/dist/runtime/src/storage/tasks.ts +179 -0
- package/dist/runtime/src/storage/token-stats.ts +144 -0
- package/dist/runtime/src/storage/topic-archive-state.ts +59 -0
- package/dist/runtime/src/storage/topic-archive.ts +74 -0
- package/dist/runtime/src/storage/topic-settings.ts +67 -0
- package/dist/runtime/src/storage/topic-transcript.ts +98 -0
- package/dist/runtime/src/storage/vault-crypto.ts +65 -0
- package/dist/runtime/src/storage/vault.ts +225 -0
- package/dist/runtime/src/storage/wiki-summary-names.ts +33 -0
- package/dist/runtime/src/storage/wiki.ts +85 -0
- package/dist/runtime/src/topics/create.ts +123 -0
- package/dist/runtime/src/topics/derive.ts +398 -0
- package/dist/runtime/src/topics/lifecycle.ts +311 -0
- package/dist/runtime/src/topics/links.ts +7 -0
- package/dist/runtime/src/topics/personal-general.ts +65 -0
- package/dist/runtime/src/topics/session.ts +381 -0
- package/dist/runtime/src/types/api.ts +497 -0
- package/dist/runtime/src/types.ts +255 -0
- package/dist/runtime/src/version.ts +1 -0
- package/dist/runtime/tsconfig.json +13 -0
- package/package.json +16 -3
- package/dist/main.d.ts +0 -3
- package/dist/main.d.ts.map +0 -1
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Otium REST/WS API 계약 타입 — backend와 클라이언트(web-app 등)가 공유하는
|
|
3
|
+
* 단일 소스. 타입 전용 패키지: 런타임 코드 없음 (모든 import는 `import type`).
|
|
4
|
+
*
|
|
5
|
+
* canonical 기준은 서버(backend) 직렬화 형태다. 클라이언트가 더 느슨한 형태가
|
|
6
|
+
* 필요하면 이 타입을 extend/Omit 해서 로컬로 확장한다 (드리프트를 명시적으로).
|
|
7
|
+
*
|
|
8
|
+
* 주의: AgentKind/EffortLevel/ToolCallSummary*는 backend 내부(@/types,
|
|
9
|
+
* agents/tool-format)에 값(배열 상수)과 함께 정의된 원본이 따로 있다 —
|
|
10
|
+
* 여기 선언은 구조적으로 동일한 계약 사본이며, 값 추가 시 양쪽을 함께 갱신한다.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** Agent identifier — one of the supported AI provider backends. */
|
|
14
|
+
export type AgentKind = "maestro" | "claude" | "codex";
|
|
15
|
+
export type TopicKind = "channel" | "agent" | "manager";
|
|
16
|
+
/** Adapter access boundary for a user-facing topic. */
|
|
17
|
+
export type TopicAccessMode = "private" | "shared";
|
|
18
|
+
/** Whether adapters may expose a topic in user-facing discovery surfaces. */
|
|
19
|
+
export type TopicVisibility = "visible" | "hidden";
|
|
20
|
+
export type ResponsePolicy = "off" | "mention" | "always";
|
|
21
|
+
/** @deprecated use ResponsePolicy. */
|
|
22
|
+
export type AiMode = ResponsePolicy;
|
|
23
|
+
|
|
24
|
+
/** Reasoning effort levels (union across all agents; per-agent subsets은 backend 레지스트리가 검증). */
|
|
25
|
+
export type EffortLevel = "low" | "medium" | "high" | "xhigh" | "max";
|
|
26
|
+
|
|
27
|
+
/** Display-only tool call summary values (never raw tool args). */
|
|
28
|
+
export type ToolCallSummaryValue =
|
|
29
|
+
| string
|
|
30
|
+
| number
|
|
31
|
+
| boolean
|
|
32
|
+
| Array<{ label: string; description?: string }>;
|
|
33
|
+
|
|
34
|
+
export type ToolCallSummaryInput = Record<string, ToolCallSummaryValue>;
|
|
35
|
+
|
|
36
|
+
export interface ApiResponse<T = unknown> {
|
|
37
|
+
ok: boolean;
|
|
38
|
+
data?: T;
|
|
39
|
+
error?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface PaginatedResponse<T> extends ApiResponse<T[]> {
|
|
42
|
+
cursor?: string;
|
|
43
|
+
hasMore: boolean;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface LoginRequest {
|
|
47
|
+
identifier: string;
|
|
48
|
+
}
|
|
49
|
+
export interface LoginResponse {
|
|
50
|
+
token: string;
|
|
51
|
+
user: UserDto;
|
|
52
|
+
expiresAt: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface UserDto {
|
|
56
|
+
id: string;
|
|
57
|
+
displayName: string;
|
|
58
|
+
email?: string;
|
|
59
|
+
avatarUrl?: string;
|
|
60
|
+
isAI: boolean;
|
|
61
|
+
agentType?: AgentKind;
|
|
62
|
+
createdAt: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface TopicDto {
|
|
66
|
+
id: string;
|
|
67
|
+
title: string;
|
|
68
|
+
kind?: TopicKind;
|
|
69
|
+
description?: string;
|
|
70
|
+
/** AI agent invited to this topic. */
|
|
71
|
+
agent?: AgentKind;
|
|
72
|
+
/** Canonical base model alias used by newer clients. */
|
|
73
|
+
baseModel?: string;
|
|
74
|
+
/** Canonical base effort alias used by newer clients. */
|
|
75
|
+
baseEffort?: EffortLevel;
|
|
76
|
+
/** Canonical response-policy alias used by newer clients. */
|
|
77
|
+
responsePolicy?: ResponsePolicy;
|
|
78
|
+
/** Base/fallback model used when no topic config override exists. */
|
|
79
|
+
defaultModel: string;
|
|
80
|
+
/** Base/fallback effort used when no topic config override exists. */
|
|
81
|
+
defaultEffort: EffortLevel;
|
|
82
|
+
/** Resolved per-topic model after applying the persisted self-config override. */
|
|
83
|
+
effectiveModel?: string;
|
|
84
|
+
/** Resolved per-topic effort after applying the persisted self-config override. */
|
|
85
|
+
effectiveEffort?: EffortLevel;
|
|
86
|
+
/**
|
|
87
|
+
* Response policy stored as `response_policy`.
|
|
88
|
+
* - manager rooms are system-managed and always `always`.
|
|
89
|
+
* - agent rooms are always `always` and have an agent.
|
|
90
|
+
* - channel rooms are `off` or `mention`.
|
|
91
|
+
*/
|
|
92
|
+
aiMode?: AiMode;
|
|
93
|
+
/** @deprecated response compatibility alias; use aiMode. */
|
|
94
|
+
aiMention?: boolean;
|
|
95
|
+
participants: ParticipantDto[];
|
|
96
|
+
createdAt: string;
|
|
97
|
+
lastMessageAt: string;
|
|
98
|
+
/** Preview of the most recent message text (subtitle in the topic list). */
|
|
99
|
+
lastMessagePreview?: string;
|
|
100
|
+
/** Current user's unread message count for this topic. */
|
|
101
|
+
unreadCount?: number;
|
|
102
|
+
/** Current user's last read message id for this topic. */
|
|
103
|
+
lastReadMessageId?: string;
|
|
104
|
+
/** ID of the parent topic, set when this topic was spawned or forked. */
|
|
105
|
+
parentTopicId?: string;
|
|
106
|
+
/** True when the topic was created via fork (copies history). */
|
|
107
|
+
isFork?: boolean;
|
|
108
|
+
/** True when this topic was spawned by an agent as a subagent worker room. */
|
|
109
|
+
isSubagent?: boolean;
|
|
110
|
+
/** Hidden topics remain executable/addressable by id but stay out of adapter pickers. */
|
|
111
|
+
visibility?: TopicVisibility;
|
|
112
|
+
/** Private stays on local adapters; shared may be exposed through Otium too. */
|
|
113
|
+
accessMode?: TopicAccessMode;
|
|
114
|
+
/** Stable execution placement. Absent means the hub runs this topic locally. */
|
|
115
|
+
executionNode?: {
|
|
116
|
+
nodeId: string;
|
|
117
|
+
nodeName: string;
|
|
118
|
+
};
|
|
119
|
+
/** True when an AI turn is currently in flight for this topic (snapshot at list time). */
|
|
120
|
+
running?: boolean;
|
|
121
|
+
/** Query id associated with the list-time running snapshot. */
|
|
122
|
+
runningQueryId?: string;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** Read-only internal work shown by operational clients. */
|
|
126
|
+
export interface BackgroundSessionDto {
|
|
127
|
+
id: string;
|
|
128
|
+
kind: "memory" | "cron";
|
|
129
|
+
title: string;
|
|
130
|
+
startedAt: string;
|
|
131
|
+
topicId?: string;
|
|
132
|
+
status: string;
|
|
133
|
+
/** False for durable sessions that are currently waiting for their next run. */
|
|
134
|
+
active?: boolean;
|
|
135
|
+
agent?: AgentKind;
|
|
136
|
+
model?: string;
|
|
137
|
+
effort?: EffortLevel;
|
|
138
|
+
/** User/task prompt that started the displayed run. Never includes system instructions. */
|
|
139
|
+
prompt?: string;
|
|
140
|
+
promptTitle?: string;
|
|
141
|
+
steps: string[];
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface ParticipantDto {
|
|
145
|
+
userId: string;
|
|
146
|
+
role: "owner" | "member";
|
|
147
|
+
aiConfig?: {
|
|
148
|
+
enabled: boolean;
|
|
149
|
+
agent: AgentKind;
|
|
150
|
+
model: string;
|
|
151
|
+
effort: EffortLevel;
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface CreateTopicRequest {
|
|
156
|
+
title: string;
|
|
157
|
+
kind?: TopicKind;
|
|
158
|
+
description?: string;
|
|
159
|
+
agent?: AgentKind | null | "none";
|
|
160
|
+
baseModel?: string;
|
|
161
|
+
baseEffort?: EffortLevel;
|
|
162
|
+
responsePolicy?: ResponsePolicy;
|
|
163
|
+
/** @deprecated input aliases accepted during API transition. */
|
|
164
|
+
defaultModel?: string;
|
|
165
|
+
defaultEffort?: EffortLevel;
|
|
166
|
+
aiMode?: AiMode;
|
|
167
|
+
aiMention?: boolean;
|
|
168
|
+
}
|
|
169
|
+
export interface UpdateTopicRequest {
|
|
170
|
+
/** Backward-compatible rename alias; normalized to title. */
|
|
171
|
+
name?: string;
|
|
172
|
+
title?: string;
|
|
173
|
+
kind?: TopicKind;
|
|
174
|
+
description?: string;
|
|
175
|
+
agent?: AgentKind | null | "none";
|
|
176
|
+
baseModel?: string;
|
|
177
|
+
baseEffort?: EffortLevel;
|
|
178
|
+
responsePolicy?: ResponsePolicy;
|
|
179
|
+
/** @deprecated input aliases accepted during API transition. */
|
|
180
|
+
defaultModel?: string;
|
|
181
|
+
defaultEffort?: EffortLevel;
|
|
182
|
+
aiMode?: AiMode;
|
|
183
|
+
aiMention?: boolean;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface MessageTokenUsage {
|
|
187
|
+
/** Aggregate input consumed by every model call in the turn. */
|
|
188
|
+
input: number;
|
|
189
|
+
output: number;
|
|
190
|
+
cachedInput?: number;
|
|
191
|
+
/** Latest-request context occupancy, distinct from aggregate turn input. */
|
|
192
|
+
context?: number;
|
|
193
|
+
contextWindow?: number;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export interface MessageDto {
|
|
197
|
+
id: string;
|
|
198
|
+
topicId: string;
|
|
199
|
+
parentId?: string;
|
|
200
|
+
authorId: string;
|
|
201
|
+
/** Originating adapter for live cross-channel echo suppression/routing. */
|
|
202
|
+
sourceAdapter?: string;
|
|
203
|
+
/** Display name of the author, resolved from the user store at read time. */
|
|
204
|
+
authorName?: string;
|
|
205
|
+
/** Current profile image URL for the author, resolved from the user store at read time. */
|
|
206
|
+
authorAvatarUrl?: string | null;
|
|
207
|
+
text: string;
|
|
208
|
+
attachments?: AttachmentDto[];
|
|
209
|
+
queryId?: string;
|
|
210
|
+
agentType?: AgentKind;
|
|
211
|
+
model?: string;
|
|
212
|
+
usage?: MessageTokenUsage;
|
|
213
|
+
/** Soft-delete tombstone flag. Deleted messages keep rowid stable. */
|
|
214
|
+
deleted?: boolean;
|
|
215
|
+
/** Set when a message's text was edited in place. */
|
|
216
|
+
editedAt?: string;
|
|
217
|
+
/** User ids mentioned in the message text (e.g. "@정연우"), resolved at send time. */
|
|
218
|
+
mentions?: string[];
|
|
219
|
+
/** Root message id when this message is a Slack-style thread reply. */
|
|
220
|
+
threadRootId?: string;
|
|
221
|
+
/** Number of thread replies under this message (only stamped on thread roots). */
|
|
222
|
+
threadReplyCount?: number;
|
|
223
|
+
/** Timestamp of the latest thread reply (only stamped on thread roots). */
|
|
224
|
+
threadLastReplyAt?: string;
|
|
225
|
+
/** Emoji reactions, one entry per (user, emoji). */
|
|
226
|
+
reactions?: ReactionDto[];
|
|
227
|
+
kind?: "message" | "system" | "tool" | "ask_user_question" | "subagent";
|
|
228
|
+
askUserQuestion?: AskUserQuestionDto;
|
|
229
|
+
subagentCard?: SubagentCardDto;
|
|
230
|
+
createdAt: string;
|
|
231
|
+
}
|
|
232
|
+
export interface AskUserQuestionDto {
|
|
233
|
+
question: string;
|
|
234
|
+
choices: { label: string; description?: string }[];
|
|
235
|
+
selectedLabel?: string;
|
|
236
|
+
expired?: boolean;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export type SubagentCardStatus = "spawned" | "running" | "completed" | "failed";
|
|
240
|
+
|
|
241
|
+
/** Live-updating subagent delegation card, persisted on a parent-room message. */
|
|
242
|
+
export interface SubagentCardDto {
|
|
243
|
+
/** Child agent-topic id (navigation target). */
|
|
244
|
+
subagentTopicId: string;
|
|
245
|
+
/** Child topic title, e.g. "research-agent-1". */
|
|
246
|
+
name: string;
|
|
247
|
+
/** The self-contained task brief the child received. */
|
|
248
|
+
task: string;
|
|
249
|
+
status: SubagentCardStatus;
|
|
250
|
+
/** Truncated final response (set when completed). */
|
|
251
|
+
resultSummary?: string;
|
|
252
|
+
/** Failure reason (set when failed). */
|
|
253
|
+
errorMessage?: string;
|
|
254
|
+
startedAt: string;
|
|
255
|
+
finishedAt?: string;
|
|
256
|
+
}
|
|
257
|
+
export interface ReactionDto {
|
|
258
|
+
emoji: string;
|
|
259
|
+
userId: string;
|
|
260
|
+
/** Display name of the reacting user, resolved at write time. */
|
|
261
|
+
userName: string;
|
|
262
|
+
}
|
|
263
|
+
export interface AttachmentDto {
|
|
264
|
+
id: string;
|
|
265
|
+
type: "image" | "file" | "audio";
|
|
266
|
+
filename: string;
|
|
267
|
+
url: string;
|
|
268
|
+
mimeType: string;
|
|
269
|
+
sizeBytes: number;
|
|
270
|
+
transcription?: string;
|
|
271
|
+
}
|
|
272
|
+
export interface SendMessageRequest {
|
|
273
|
+
text: string;
|
|
274
|
+
attachments?: string[];
|
|
275
|
+
parentId?: string;
|
|
276
|
+
replyTo?: string;
|
|
277
|
+
/** User ids explicitly mentioned in the message (client-selected). */
|
|
278
|
+
mentions?: string[];
|
|
279
|
+
/** Root message id when posting a Slack-style thread reply. */
|
|
280
|
+
threadRootId?: string;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export interface MarkTopicReadRequest {
|
|
284
|
+
lastReadMessageId?: string | null;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export interface PushRegisterRequest {
|
|
288
|
+
token: string;
|
|
289
|
+
platform?: string;
|
|
290
|
+
deviceId?: string;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export interface PushUnregisterRequest {
|
|
294
|
+
token?: string;
|
|
295
|
+
deviceId?: string;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export interface AiQueryRequest {
|
|
299
|
+
text: string;
|
|
300
|
+
parentId?: string;
|
|
301
|
+
agent?: AgentKind;
|
|
302
|
+
model?: string;
|
|
303
|
+
effort?: EffortLevel;
|
|
304
|
+
attachments?: string[];
|
|
305
|
+
}
|
|
306
|
+
export interface AiQueryResponse {
|
|
307
|
+
queryId: string;
|
|
308
|
+
topicId: string;
|
|
309
|
+
status: "pending";
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export interface AiQueryStatusResponse {
|
|
313
|
+
queryId: string;
|
|
314
|
+
topicId: string;
|
|
315
|
+
status: "running" | "not_found";
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export interface AskUserQuestionAnswerResponse {
|
|
319
|
+
askMessage: MessageDto;
|
|
320
|
+
answerMessage: MessageDto;
|
|
321
|
+
queryId?: string;
|
|
322
|
+
status: "pending" | "sent";
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export interface FileUploadResponse {
|
|
326
|
+
fileId: string;
|
|
327
|
+
url: string;
|
|
328
|
+
filename: string;
|
|
329
|
+
mimeType: string;
|
|
330
|
+
sizeBytes: number;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export interface AgentInfoDto {
|
|
334
|
+
kind: AgentKind;
|
|
335
|
+
displayName: string;
|
|
336
|
+
models: string[];
|
|
337
|
+
defaultModel: string;
|
|
338
|
+
effortLevels: EffortLevel[];
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export type WsClientMessage =
|
|
342
|
+
| { type: "subscribe"; topicId: string }
|
|
343
|
+
| { type: "unsubscribe"; topicId: string }
|
|
344
|
+
| { type: "subscribe_presence"; topicId: string }
|
|
345
|
+
| { type: "unsubscribe_presence"; topicId: string }
|
|
346
|
+
| { type: "typing"; topicId: string; isTyping: boolean };
|
|
347
|
+
|
|
348
|
+
export type WsServerMessage =
|
|
349
|
+
| {
|
|
350
|
+
type: "ai_done";
|
|
351
|
+
queryId: string;
|
|
352
|
+
topicId: string;
|
|
353
|
+
usage?: MessageTokenUsage;
|
|
354
|
+
// Provider metadata for the completed turn. The answer text itself is
|
|
355
|
+
// delivered by the persisted `message` event.
|
|
356
|
+
agent?: AgentKind;
|
|
357
|
+
model?: string;
|
|
358
|
+
}
|
|
359
|
+
| {
|
|
360
|
+
// A live AI turn exists on this room. Broadcast at turn start and sent
|
|
361
|
+
// as a snapshot to late subscribers, so clients can bind typing/tool UI
|
|
362
|
+
// to turns they did not initiate (subagent task turns, session injects).
|
|
363
|
+
type: "ai_active";
|
|
364
|
+
queryId: string;
|
|
365
|
+
topicId: string;
|
|
366
|
+
}
|
|
367
|
+
| { type: "ai_error"; queryId: string; topicId: string; error: string }
|
|
368
|
+
| {
|
|
369
|
+
type: "ai_aborted";
|
|
370
|
+
queryId: string;
|
|
371
|
+
topicId: string;
|
|
372
|
+
// Why the turn ended: "superseded" = a new user message on the same room
|
|
373
|
+
// interrupted and replaced it (Otium AbortReason.Internal); "stopped" =
|
|
374
|
+
// explicit cancel / abort_session / DELETE (Otium AbortReason.External).
|
|
375
|
+
// Absent on legacy emitters → clients treat as "stopped".
|
|
376
|
+
reason?: "superseded" | "stopped";
|
|
377
|
+
}
|
|
378
|
+
| {
|
|
379
|
+
type: "tool_call";
|
|
380
|
+
queryId: string;
|
|
381
|
+
topicId: string;
|
|
382
|
+
name: string;
|
|
383
|
+
/** Small display-only summary; never raw tool args such as full HTML/content. */
|
|
384
|
+
input?: ToolCallSummaryInput;
|
|
385
|
+
/** Human-readable label (formatToolUse), e.g. "Bash(npm test)". Single source of truth. */
|
|
386
|
+
label: string;
|
|
387
|
+
toolUseId: string; // non-empty id for client-side tool_call↔tool_output matching
|
|
388
|
+
}
|
|
389
|
+
| {
|
|
390
|
+
type: "tool_output";
|
|
391
|
+
queryId: string;
|
|
392
|
+
topicId: string;
|
|
393
|
+
toolUseId: string;
|
|
394
|
+
content: string;
|
|
395
|
+
}
|
|
396
|
+
| {
|
|
397
|
+
type: "tool_status";
|
|
398
|
+
queryId: string;
|
|
399
|
+
topicId: string;
|
|
400
|
+
kind: "status" | "progress" | "summary";
|
|
401
|
+
content: string;
|
|
402
|
+
toolName?: string;
|
|
403
|
+
elapsed?: number;
|
|
404
|
+
}
|
|
405
|
+
| {
|
|
406
|
+
type: "file_ready";
|
|
407
|
+
queryId: string;
|
|
408
|
+
topicId: string;
|
|
409
|
+
path: string;
|
|
410
|
+
source: string;
|
|
411
|
+
}
|
|
412
|
+
| {
|
|
413
|
+
type: "visual";
|
|
414
|
+
queryId: string;
|
|
415
|
+
topicId: string;
|
|
416
|
+
url: string;
|
|
417
|
+
id?: number;
|
|
418
|
+
title?: string | null;
|
|
419
|
+
kind?: "html" | "mermaid" | "image" | "video";
|
|
420
|
+
}
|
|
421
|
+
| { type: "message"; topicId: string; message: MessageDto }
|
|
422
|
+
| {
|
|
423
|
+
type: "message_updated";
|
|
424
|
+
topicId: string;
|
|
425
|
+
messageId: string;
|
|
426
|
+
text?: string;
|
|
427
|
+
deleted?: boolean;
|
|
428
|
+
editedAt?: string;
|
|
429
|
+
usage?: MessageTokenUsage;
|
|
430
|
+
askUserQuestion?: AskUserQuestionDto;
|
|
431
|
+
subagentCard?: SubagentCardDto;
|
|
432
|
+
}
|
|
433
|
+
| {
|
|
434
|
+
type: "reaction_update";
|
|
435
|
+
topicId: string;
|
|
436
|
+
messageId: string;
|
|
437
|
+
reactions: ReactionDto[];
|
|
438
|
+
}
|
|
439
|
+
| { type: "typing"; topicId: string; userId: string }
|
|
440
|
+
| {
|
|
441
|
+
type: "unread_update";
|
|
442
|
+
topicId: string;
|
|
443
|
+
userId: string;
|
|
444
|
+
unreadCount: number;
|
|
445
|
+
}
|
|
446
|
+
| {
|
|
447
|
+
type: "user_typing";
|
|
448
|
+
topicId: string;
|
|
449
|
+
userId: string;
|
|
450
|
+
userName: string;
|
|
451
|
+
isTyping: boolean;
|
|
452
|
+
}
|
|
453
|
+
| {
|
|
454
|
+
// User-level foreground notification (web tier-1). Delivered on the user
|
|
455
|
+
// socket so an open web/desktop client can surface an OS notification.
|
|
456
|
+
type: "notification";
|
|
457
|
+
topicId: string;
|
|
458
|
+
userId: string;
|
|
459
|
+
title: string;
|
|
460
|
+
body: string;
|
|
461
|
+
messageId: string;
|
|
462
|
+
}
|
|
463
|
+
| {
|
|
464
|
+
// Emitted when a thread's reply count changes so the parent message's
|
|
465
|
+
// "N replies" chip updates live in the channel list.
|
|
466
|
+
type: "thread_update";
|
|
467
|
+
topicId: string;
|
|
468
|
+
rootMessageId: string;
|
|
469
|
+
replyCount: number;
|
|
470
|
+
lastReplyAt: string;
|
|
471
|
+
}
|
|
472
|
+
| { type: "topic_created"; topicId: string; topic: TopicDto }
|
|
473
|
+
| { type: "topic_updated"; topicId: string; patch: Partial<TopicDto> }
|
|
474
|
+
// Sent to a user's socket when a room stops existing *for them* — hard
|
|
475
|
+
// delete, or their own membership was revoked.
|
|
476
|
+
| { type: "topic_deleted"; topicId: string };
|
|
477
|
+
|
|
478
|
+
/** Request to spawn (config-only copy) or fork (config+history copy) a topic. */
|
|
479
|
+
export interface SpawnForkRequest {
|
|
480
|
+
name?: string;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/** Spawn/fork result — the newly created topic. */
|
|
484
|
+
export interface SpawnForkResponse {
|
|
485
|
+
topic: TopicDto;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/** Export format options. */
|
|
489
|
+
export type ExportFormat = "text" | "json" | "markdown";
|
|
490
|
+
|
|
491
|
+
/** Exported conversation data. */
|
|
492
|
+
export interface ExportResponse {
|
|
493
|
+
topicId: string;
|
|
494
|
+
topicTitle: string;
|
|
495
|
+
format: ExportFormat;
|
|
496
|
+
content: string;
|
|
497
|
+
}
|