@atlaswork/atlascode 0.0.0-stage → 0.1.125

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/README.md +124 -2
  2. package/dist/cli.js +506227 -0
  3. package/dist/web-contract/index.d.ts +727 -0
  4. package/dist/web-contract/index.js +260 -0
  5. package/dist/web-session-runtime/atlascode/web/contract.d.ts +10 -0
  6. package/dist/web-session-runtime/atlascode/web/cursorLedger.d.ts +63 -0
  7. package/dist/web-session-runtime/atlascode/web/entry.d.ts +19 -0
  8. package/dist/web-session-runtime/atlascode/web/errors.d.ts +16 -0
  9. package/dist/web-session-runtime/atlascode/web/follow.d.ts +82 -0
  10. package/dist/web-session-runtime/atlascode/web/limits.d.ts +63 -0
  11. package/dist/web-session-runtime/atlascode/web/projection.d.ts +69 -0
  12. package/dist/web-session-runtime/atlascode/web/readonlyRuntime.d.ts +156 -0
  13. package/dist/web-session-runtime/atlascode/web/runtimeDefault.d.ts +26 -0
  14. package/dist/web-session-runtime/atlascode/web/sessionStoreAdapter.d.ts +70 -0
  15. package/dist/web-session-runtime/engine/session/env.d.ts +32 -0
  16. package/dist/web-session-runtime/engine/session/firstPrompt.d.ts +21 -0
  17. package/dist/web-session-runtime/engine/session/json.d.ts +27 -0
  18. package/dist/web-session-runtime/engine/session/load.d.ts +88 -0
  19. package/dist/web-session-runtime/engine/session/paths.d.ts +25 -0
  20. package/dist/web-session-runtime/engine/session/predicates.d.ts +55 -0
  21. package/dist/web-session-runtime/engine/session/readonly.d.ts +29 -0
  22. package/dist/web-session-runtime/engine/session/scanner.d.ts +26 -0
  23. package/dist/web-session-runtime/engine/session/search.d.ts +44 -0
  24. package/dist/web-session-runtime/engine/session/types.d.ts +379 -0
  25. package/dist/web-session-runtime/index.d.ts +1 -0
  26. package/dist/web-session-runtime/index.js +2635 -0
  27. package/dist/web-session-runtime/kernel/protocol/webSessionV0.d.ts +727 -0
  28. package/dist/web-session-runtime/shared/ProductDefinition.d.ts +47 -0
  29. package/dist/web-session-runtime/shared/agentRoleTemplates.d.ts +44 -0
  30. package/dist/web-session-runtime/shared/agentSwarmsEnabled.d.ts +5 -0
  31. package/dist/web-session-runtime/shared/boundedImageRead.d.ts +31 -0
  32. package/dist/web-session-runtime/shared/circular-buffer.d.ts +42 -0
  33. package/dist/web-session-runtime/shared/configDir.d.ts +57 -0
  34. package/dist/web-session-runtime/shared/constants.d.ts +19 -0
  35. package/dist/web-session-runtime/shared/debug.d.ts +32 -0
  36. package/dist/web-session-runtime/shared/env.d.ts +38 -0
  37. package/dist/web-session-runtime/shared/errors.d.ts +56 -0
  38. package/dist/web-session-runtime/shared/feature.d.ts +25 -0
  39. package/dist/web-session-runtime/shared/format.d.ts +11 -0
  40. package/dist/web-session-runtime/shared/fs-operations.d.ts +116 -0
  41. package/dist/web-session-runtime/shared/hash.d.ts +13 -0
  42. package/dist/web-session-runtime/shared/identity.d.ts +23 -0
  43. package/dist/web-session-runtime/shared/index.d.ts +46 -0
  44. package/dist/web-session-runtime/shared/lazySchema.d.ts +12 -0
  45. package/dist/web-session-runtime/shared/log.d.ts +1 -0
  46. package/dist/web-session-runtime/shared/path.d.ts +22 -0
  47. package/dist/web-session-runtime/shared/pdfPageImages.d.ts +19 -0
  48. package/dist/web-session-runtime/shared/pdfReference.d.ts +70 -0
  49. package/dist/web-session-runtime/shared/permissionDeadline.d.ts +24 -0
  50. package/dist/web-session-runtime/shared/platform.d.ts +8 -0
  51. package/dist/web-session-runtime/shared/stringUtils.d.ts +110 -0
  52. package/dist/web-session-runtime/shared/swarmSchemaFilter.d.ts +23 -0
  53. package/dist/web-session-runtime/shared/teamFileSchema.d.ts +151 -0
  54. package/dist/web-session-runtime/shared/teamInboxSchema.d.ts +112 -0
  55. package/dist/web-session-runtime/shared/teammateContext.d.ts +89 -0
  56. package/dist/web-session-runtime/shared/tempDir.d.ts +1 -0
  57. package/dist/web-session-runtime/shared/textEncoding.d.ts +41 -0
  58. package/dist/web-session-runtime/shared/tokenEstimation.d.ts +36 -0
  59. package/dist/web-session-runtime/shared/types-session.d.ts +266 -0
  60. package/dist/web-session-runtime/shared/types.d.ts +190 -0
  61. package/dist/web-session-runtime/shared/unc.d.ts +5 -0
  62. package/dist/web-session-runtime/shared/windowsPaths.d.ts +24 -0
  63. package/package.json +116 -4
@@ -0,0 +1,379 @@
1
+ /**
2
+ * session 域 — transcript 持久化类型面(E-7 S-7d d1,§8.49 详案 item 1)
3
+ *
4
+ * 旧仓来源(a8af45b):src/types/logs.ts 330L 裁剪随迁 + transcript 消息形状
5
+ * (旧 types/message.ts 薄联合收敛为域内 Message 扩展形)+ ContentReplacementRecord
6
+ * (旧 toolResultStorage.ts:539 三字段逐字)。
7
+ *
8
+ * 裁剪登记(H6 前向接缝,复审勿当遗漏重提):
9
+ * - FileHistorySnapshotMessage / AttributionSnapshotMessage(+FileAttributionState)
10
+ * = shell 域 fileHistory/attribution 面;QueueOperationMessage = UI 队列面;
11
+ * SpeculationAcceptMessage = 推测接受面;ContextCollapseCommitEntry /
12
+ * ContextCollapseSnapshotEntry(marble-origami 上下文折叠)= 零消费者
13
+ * (grep 确证)。以上 entry type 不入门面——**loader 侧对未知 entry type
14
+ * 走「跳过非报错」容错**(旧 AtlasHarness 磁盘 JSONL 含这些 entry;shell
15
+ * 域波补全时收紧)。
16
+ * - TranscriptMessage stamp 裁剪:sessionProjectDir(CC-34 原子对)/ promptId /
17
+ * slug 三戳弃——旧 bootstrap getSessionProjectDir(`: any` 恒 null)/
18
+ * getPromptId(`({}) as any`)/ getPlanSlugCache(per-call fresh Map →
19
+ * `.get` 恒 undefined)皆为 `: any` 退化 stub,裁除零行为 delta;存活戳 =
20
+ * userType/entrypoint/cwd/sessionId/version/gitBranch(insertMessageChain
21
+ * 头注钉死字段序)。
22
+ * - LogOption 裁至 engine resume 消费子集(teamName/isTeammate/agentSetting/
23
+ * prNumber/prUrl/prRepository + fileHistory/attribution/contextCollapse 四字段
24
+ * = CLI list 面,归相邻 8 项 CLI 波残留守)。
25
+ *
26
+ * 类型适配登记(旧仓 → 新仓,行为不变):
27
+ * - UUID(旧 crypto 品牌串)→ 本域 `type UUID = string` 别名,旧文 `as UUID`
28
+ * cast 逐字保留(no-op)。
29
+ * - AgentId / SessionId(旧 types/ids brand)→ string(残余 ② 口径,同
30
+ * coordinator/worktree 域先例),asAgentId/asSessionId 收敛为恒等。
31
+ * - Message = shared Message(旧 types/message.ts 薄联合)+ session 域字段面
32
+ * 扩展(message/id/content/usage 内层 + isMeta/isVirtual/subtype/
33
+ * sourceToolAssistantUUID/attachment):旧仓 `(m as any).message.id` 类
34
+ * cast 在域扩展型下直接可访,逐字块内按需去 cast(语义逐字不变)。
35
+ */
36
+ import type { ContentBlock, Message as BaseMessage, Usage } from '../../shared.js';
37
+ export type UUID = string;
38
+ /** 旧 types/ids brand → string(残余 ② 口径)。 */
39
+ export type AgentId = string;
40
+ export type SessionId = string;
41
+ /**
42
+ * 旧 Transcript = (UserMessage | AssistantMessage | AttachmentMessage |
43
+ * SystemMessage)[] → 域 Message[](薄联合收敛,isTranscriptMessage 仍是
44
+ * 「什么是 transcript 消息」的单一事实源)。
45
+ */
46
+ export type Transcript = Message[];
47
+ /** 域 Message:shared 基型 + session 域字段面(旧 types/message.ts 薄联合收敛)。 */
48
+ export interface Message extends BaseMessage {
49
+ uuid?: string;
50
+ type?: string;
51
+ timestamp?: string;
52
+ subtype?: string;
53
+ isMeta?: boolean;
54
+ isVirtual?: boolean;
55
+ /** 旧 types/message.ts UserMessage.isMeta / 内层 API message 面。 */
56
+ message?: {
57
+ id?: string;
58
+ content?: unknown;
59
+ usage?: Usage;
60
+ };
61
+ /** 旧 UserMessage.sourceToolAssistantUUID(tool_result 回指 assistant uuid)。 */
62
+ sourceToolAssistantUUID?: string;
63
+ /** 旧 UserMessage.toolUseResult(UI-native tool Out;messaging 域
64
+ * isHumanTurn 判别字段 + transcriptSearch duck 面;S-7e d1 随迁补字段,
65
+ * search.ts RenderableMessage duck 面同名同语义)。 */
66
+ toolUseResult?: unknown;
67
+ /** 旧 AttachmentMessage.attachment 面(isLoggableMessage hook 分支消费)。 */
68
+ attachment?: {
69
+ type: string;
70
+ [key: string]: unknown;
71
+ };
72
+ /** 旧 UserMessage.isCompactSummary(compact summary 消息标记)。 */
73
+ isCompactSummary?: boolean;
74
+ /** 旧 SystemMessage.compactMetadata 面(applyPreservedSegmentRelinks
75
+ * 消费 preservedSegment 三段 uuid;SystemCompactBoundaryMessage 为
76
+ * 判别收窄形,此处为宽域字段声明)。 */
77
+ compactMetadata?: {
78
+ preservedSegment?: {
79
+ headUuid: string;
80
+ tailUuid: string;
81
+ anchorUuid: string;
82
+ };
83
+ };
84
+ }
85
+ /**
86
+ * 旧 SystemCompactBoundaryMessage(旧仓 = any stub)→ 最小形状(session 域
87
+ * 消费面:isCompactBoundaryMessage 判别 + applyPreservedSegmentRelinks 的
88
+ * compactMetadata.preservedSegment 三段 uuid)。
89
+ */
90
+ export interface SystemCompactBoundaryMessage {
91
+ type: 'system';
92
+ subtype: 'compact_boundary';
93
+ uuid?: string;
94
+ compactMetadata?: {
95
+ preservedSegment?: {
96
+ headUuid: string;
97
+ tailUuid: string;
98
+ anchorUuid: string;
99
+ };
100
+ };
101
+ [key: string]: unknown;
102
+ }
103
+ /** 旧 types/logs.ts SerializedMessage 逐字(Message 换域扩展型)。 */
104
+ export type SerializedMessage = Message & {
105
+ cwd: string;
106
+ userType: string;
107
+ entrypoint?: string;
108
+ sessionId: string;
109
+ timestamp: string;
110
+ version: string;
111
+ gitBranch?: string;
112
+ };
113
+ /** 旧 types/logs.ts LogOption 裁至 engine resume 消费子集(裁剪面见头注登记)。 */
114
+ export type LogOption = {
115
+ date: string;
116
+ messages: SerializedMessage[];
117
+ fullPath?: string;
118
+ value: number;
119
+ created: Date;
120
+ modified: Date;
121
+ firstPrompt: string;
122
+ messageCount: number;
123
+ fileSize?: number;
124
+ isSidechain: boolean;
125
+ teamName?: string;
126
+ isLite?: boolean;
127
+ sessionId?: string;
128
+ agentName?: string;
129
+ agentColor?: string;
130
+ leafUuid?: UUID;
131
+ summary?: string;
132
+ customTitle?: string;
133
+ tag?: string;
134
+ gitBranch?: string;
135
+ projectPath?: string;
136
+ mode?: 'coordinator' | 'normal';
137
+ worktreeSession?: PersistedWorktreeSession | null;
138
+ contentReplacements?: ContentReplacementRecord[];
139
+ /**
140
+ * 0.1.62 /goal P1:armed goal 快照(session metadata goal-state entry 恢复面)。
141
+ * null = cleared 快照(恢复时 no-op);undefined = 从无 goal。与 GoalStateEntry.goal
142
+ * 同形(restoreSessionMetadata + restoreGoalState 双消费:缓存 + 运行态单例)。
143
+ */
144
+ goal?: {
145
+ armed: boolean;
146
+ condition: string;
147
+ } | null;
148
+ };
149
+ export type SummaryMessage = {
150
+ type: 'summary';
151
+ leafUuid: UUID;
152
+ summary: string;
153
+ };
154
+ export type CustomTitleMessage = {
155
+ type: 'custom-title';
156
+ sessionId: UUID;
157
+ customTitle: string;
158
+ };
159
+ /**
160
+ * AI-generated session title. Distinct from CustomTitleMessage so that:
161
+ * - User renames (custom-title) always win over AI titles in read preference
162
+ * - reAppendSessionMetadata never re-appends AI titles (they're ephemeral/
163
+ * regeneratable; re-appending would clobber user renames on resume)
164
+ * - VS Code's onlyIfNoCustomTitle CAS check only matches user titles,
165
+ * allowing AI to overwrite its own previous AI title but not user titles
166
+ */
167
+ export type AiTitleMessage = {
168
+ type: 'ai-title';
169
+ sessionId: UUID;
170
+ aiTitle: string;
171
+ };
172
+ export type LastPromptMessage = {
173
+ type: 'last-prompt';
174
+ sessionId: UUID;
175
+ lastPrompt: string;
176
+ };
177
+ /**
178
+ * Periodic fork-generated summary of what the agent is currently doing.
179
+ * Written every min(5 steps, 2min) by forking the main thread mid-turn so
180
+ * `atlas ps` can show something more useful than the last user prompt
181
+ * (which is often "ok go" or "fix it").
182
+ */
183
+ export type TaskSummaryMessage = {
184
+ type: 'task-summary';
185
+ sessionId: UUID;
186
+ summary: string;
187
+ timestamp: string;
188
+ };
189
+ export type TagMessage = {
190
+ type: 'tag';
191
+ sessionId: UUID;
192
+ tag: string;
193
+ };
194
+ export type AgentNameMessage = {
195
+ type: 'agent-name';
196
+ sessionId: UUID;
197
+ agentName: string;
198
+ };
199
+ export type AgentColorMessage = {
200
+ type: 'agent-color';
201
+ sessionId: UUID;
202
+ agentColor: string;
203
+ };
204
+ export type AgentSettingMessage = {
205
+ type: 'agent-setting';
206
+ sessionId: UUID;
207
+ agentSetting: string;
208
+ };
209
+ /**
210
+ * PR link message stored in session transcript.
211
+ * Links a session to a GitHub pull request for tracking and navigation.
212
+ */
213
+ export type PRLinkMessage = {
214
+ type: 'pr-link';
215
+ sessionId: UUID;
216
+ prNumber: number;
217
+ prUrl: string;
218
+ prRepository: string;
219
+ timestamp: string;
220
+ };
221
+ export type ModeEntry = {
222
+ type: 'mode';
223
+ sessionId: UUID;
224
+ mode: 'coordinator' | 'normal';
225
+ };
226
+ /**
227
+ * Worktree session state persisted to the transcript for resume.
228
+ * Subset of WorktreeSession from utils/worktree.ts — excludes ephemeral
229
+ * fields (creationDurationMs, usedSparsePaths) that are only used for
230
+ * first-run analytics.
231
+ */
232
+ export type PersistedWorktreeSession = {
233
+ originalCwd: string;
234
+ worktreePath: string;
235
+ worktreeName: string;
236
+ worktreeBranch?: string;
237
+ originalBranch?: string;
238
+ originalHeadCommit?: string;
239
+ sessionId: string;
240
+ tmuxSessionName?: string;
241
+ hookBased?: boolean;
242
+ };
243
+ /**
244
+ * Records whether the session is currently inside a worktree created by
245
+ * EnterWorktree or --worktree. Last-wins: an enter writes the session,
246
+ * an exit writes null. On --resume, restored only if the worktreePath
247
+ * still exists on disk (the /exit dialog may have removed it).
248
+ */
249
+ export type WorktreeStateEntry = {
250
+ type: 'worktree-state';
251
+ sessionId: UUID;
252
+ worktreeSession: PersistedWorktreeSession | null;
253
+ };
254
+ /**
255
+ * 0.1.62 /goal P1 持久化(CC 2.1.139 resume/compact 恢复):armed goal
256
+ * 条件持久化(session metadata goal-state entry)。--resume/--continue
257
+ * 恢复 armed goal;compact 后 goal 不丢(reAppendSessionMetadata 尾部窗)。
258
+ * armed=false = cleared 快照(恢复时 no-op,防旧 cleared 态泄漏)。
259
+ */
260
+ export type GoalStateEntry = {
261
+ type: 'goal-state';
262
+ sessionId: UUID;
263
+ goal: {
264
+ armed: boolean;
265
+ condition: string;
266
+ };
267
+ };
268
+ /**
269
+ * Records content blocks whose in-context representation was replaced with a
270
+ * smaller stub (the full content was persisted elsewhere). Replayed on resume
271
+ * for prompt cache stability. Written once per enforcement pass that replaces
272
+ * at least one block. When agentId is set, the record belongs to a subagent
273
+ * sidechain (AgentTool resume reads these); when absent, it's main-thread
274
+ * (/resume reads these).
275
+ */
276
+ export type ContentReplacementEntry = {
277
+ type: 'content-replacement';
278
+ sessionId: UUID;
279
+ agentId?: AgentId;
280
+ replacements: ContentReplacementRecord[];
281
+ };
282
+ /**
283
+ * 旧 toolResultStorage.ts:539 三字段逐字(ContentReplacementRecord):
284
+ * Serializable record of one content-replacement decision. Written to the
285
+ * transcript as a ContentReplacementEntry so decisions survive resume.
286
+ * Discriminated by `kind` so future replacement mechanisms (user text,
287
+ * offloaded images) can share the same transcript entry type.
288
+ *
289
+ * `replacement` is the exact string the model saw — stored rather than
290
+ * derived on resume so code changes to the preview template, size formatting,
291
+ * or path layout can't silently break prompt cache.
292
+ */
293
+ export type ContentReplacementRecord = {
294
+ kind: 'tool-result';
295
+ toolUseId: string;
296
+ replacement: string;
297
+ };
298
+ export type TranscriptMessage = SerializedMessage & {
299
+ /** 域 Message.uuid 为可选扩展;transcript 消息(磁盘 JSONL 行)恒带
300
+ * uuid(旧仓 Message 基型必填),此处覆回必填(类型适配登记)。 */
301
+ uuid: string;
302
+ /** 覆域 Message.type?(string 可选宽型)为必填字面量联合——Entry 并集
303
+ * 的判别式收窄依赖(appendEntry else-if 链 / load entry 分发);
304
+ * 旧仓 Message 各成员 type 均必填字面量,语义逐字。 */
305
+ type: 'user' | 'assistant' | 'attachment' | 'system';
306
+ parentUuid: UUID | null;
307
+ logicalParentUuid?: UUID | null;
308
+ isSidechain: boolean;
309
+ gitBranch?: string;
310
+ agentId?: string;
311
+ teamName?: string;
312
+ agentName?: string;
313
+ agentColor?: string;
314
+ };
315
+ /**
316
+ * Entry 并集(按留面缩,旧 logs.ts Entry 31 成员 → 18 成员;已裁成员见
317
+ * 头注裁剪登记)。loader 对磁盘上的已裁 entry type(file-history-snapshot /
318
+ * attribution-snapshot / queue-operation / speculation-accept /
319
+ * marble-origami-* / progress)走「未知 type 跳过」容错。
320
+ */
321
+ export type Entry = TranscriptMessage | SummaryMessage | CustomTitleMessage | AiTitleMessage | LastPromptMessage | TaskSummaryMessage | TagMessage | AgentNameMessage | AgentColorMessage | AgentSettingMessage | PRLinkMessage | ModeEntry | WorktreeStateEntry | GoalStateEntry | ContentReplacementEntry;
322
+ export declare function sortLogs(logs: LogOption[]): LogOption[];
323
+ /**
324
+ * RenderableMessage 最小形(E-7 S-7d d2,§8.49):旧仓 types/message.ts:30
325
+ * `RenderableMessage = Message`(Message = 带 `[key: string]: any` 索引签名
326
+ * 的宽接口,非 union;2026-09-24 审视 N-3 措辞订正)→ 本域仅留 search.ts
327
+ * computeSearchText 消费的 6 型面 + toolUseResult duck 面(UI 渲染消费方
328
+ * = REPL /transcript 搜索波,前向接缝;兼容口径 = 运行时对象层——旧 UI
329
+ * 消息对象满足本最小形,但旧 TS 宽类型(`type?: string` 宽判别式)不可
330
+ * 直接赋给本字面量判别联合,UI 波落地需 cast / 重定型)。
331
+ *
332
+ * attachment 双成员面:relevant_memories 变体保证 memories 非缺省(computeSearchText
333
+ * 逐字 `memories.map` 无 `!`);catch-all 变体携带 queued_command 守卫字段
334
+ * (commandMode/isMeta/prompt)+ 可选 memories。过检机制(2026-09-24 审视
335
+ * M-1 订正,复现坐实):catch-all 的 `type: string` 宽判别式**不被**
336
+ * `=== 'relevant_memories'` 字面量比较排除(TS 对非字面量判别式成员不收窄),
337
+ * 真支 `memories` 为 `Array | undefined`——今日通过依赖本仓 tsconfig
338
+ * `strict: false`(无 strictNullChecks;复现 `--strict` 红 TS18048 /
339
+ * `--strict false` 绿)。UI 波 / strict 化落地时须补守卫或重构变体
340
+ * (catch-all 判别式收窄为具体字面量联合 / memories 移出 catch-all)。
341
+ */
342
+ export type RenderableMessage = {
343
+ type: 'user';
344
+ message: {
345
+ content: string | ContentBlock[];
346
+ };
347
+ /** UI-native tool Out(duck 面;见 search.ts toolResultSearchText)。 */
348
+ toolUseResult?: unknown;
349
+ } | {
350
+ type: 'assistant';
351
+ message: {
352
+ content: string | ContentBlock[];
353
+ };
354
+ } | {
355
+ type: 'attachment';
356
+ attachment: {
357
+ type: 'relevant_memories';
358
+ memories: Array<{
359
+ content: string;
360
+ }>;
361
+ } | {
362
+ type: string;
363
+ memories?: Array<{
364
+ content: string;
365
+ }>;
366
+ commandMode?: string;
367
+ isMeta?: boolean;
368
+ prompt?: string | ContentBlock[];
369
+ };
370
+ } | {
371
+ type: 'collapsed_read_search';
372
+ relevantMemories?: Array<{
373
+ content: string;
374
+ }>;
375
+ } | {
376
+ type: 'grouped_tool_use';
377
+ } | {
378
+ type: 'system';
379
+ };
@@ -0,0 +1 @@
1
+ export * from "./atlascode/web/entry.js"