@atlaswork/atlascode 0.1.124 → 0.1.126

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 (76) hide show
  1. package/dist/atlasweb-carrier.json +6 -0
  2. package/dist/cli.js +514 -18
  3. package/dist/web-session-runtime/atlascode/web/entry.d.ts +2 -0
  4. package/dist/web-session-runtime/atlascode/web/executionOutlet.d.ts +60 -0
  5. package/dist/web-session-runtime/atlascode/web/limits.d.ts +5 -0
  6. package/dist/web-session-runtime/atlascode/web/runtimeEntry.d.ts +16 -0
  7. package/dist/web-session-runtime/atlascode/web/sessionStoreAdapter.d.ts +12 -0
  8. package/dist/web-session-runtime/index.d.ts +1 -1
  9. package/dist/web-session-runtime/index.js +104 -3
  10. package/dist/web-session-runtime/kernel/execution/executionOutlet.d.ts +60 -0
  11. package/dist/web-session-runtime/kernel/protocol/webExecutionV0.d.ts +542 -0
  12. package/dist/web-session-runtime/kernel/state/injection.d.ts +28 -0
  13. package/dist/web-session-runtime/kernel/state/ports.d.ts +67 -0
  14. package/dist/web-session-runtime-execution/atlascode/web/contract.d.ts +10 -0
  15. package/dist/web-session-runtime-execution/atlascode/web/cursorLedger.d.ts +63 -0
  16. package/dist/web-session-runtime-execution/atlascode/web/entry.d.ts +24 -0
  17. package/dist/web-session-runtime-execution/atlascode/web/errors.d.ts +16 -0
  18. package/dist/web-session-runtime-execution/atlascode/web/follow.d.ts +82 -0
  19. package/dist/web-session-runtime-execution/atlascode/web/limits.d.ts +63 -0
  20. package/dist/web-session-runtime-execution/atlascode/web/projection.d.ts +69 -0
  21. package/dist/web-session-runtime-execution/atlascode/web/readonlyRuntime.d.ts +156 -0
  22. package/dist/web-session-runtime-execution/atlascode/web/runtimeDefault.d.ts +26 -0
  23. package/dist/web-session-runtime-execution/atlascode/web/sessionStoreAdapter.d.ts +70 -0
  24. package/dist/web-session-runtime-execution/engine/session/env.d.ts +32 -0
  25. package/dist/web-session-runtime-execution/engine/session/firstPrompt.d.ts +21 -0
  26. package/dist/web-session-runtime-execution/engine/session/json.d.ts +27 -0
  27. package/dist/web-session-runtime-execution/engine/session/load.d.ts +88 -0
  28. package/dist/web-session-runtime-execution/engine/session/paths.d.ts +25 -0
  29. package/dist/web-session-runtime-execution/engine/session/predicates.d.ts +55 -0
  30. package/dist/web-session-runtime-execution/engine/session/readonly.d.ts +29 -0
  31. package/dist/web-session-runtime-execution/engine/session/scanner.d.ts +26 -0
  32. package/dist/web-session-runtime-execution/engine/session/search.d.ts +44 -0
  33. package/dist/web-session-runtime-execution/engine/session/types.d.ts +379 -0
  34. package/dist/web-session-runtime-execution/index.d.ts +1 -0
  35. package/dist/web-session-runtime-execution/index.js +8396 -0
  36. package/dist/web-session-runtime-execution/kernel/execution/executionOutlet.d.ts +60 -0
  37. package/dist/web-session-runtime-execution/kernel/protocol/webExecutionV0.d.ts +547 -0
  38. package/dist/web-session-runtime-execution/kernel/protocol/webSessionV0.d.ts +727 -0
  39. package/dist/web-session-runtime-execution/kernel/state/injection.d.ts +28 -0
  40. package/dist/web-session-runtime-execution/kernel/state/ports.d.ts +67 -0
  41. package/dist/web-session-runtime-execution/shared/ProductDefinition.d.ts +47 -0
  42. package/dist/web-session-runtime-execution/shared/agentRoleTemplates.d.ts +44 -0
  43. package/dist/web-session-runtime-execution/shared/agentSwarmsEnabled.d.ts +5 -0
  44. package/dist/web-session-runtime-execution/shared/boundedImageRead.d.ts +31 -0
  45. package/dist/web-session-runtime-execution/shared/circular-buffer.d.ts +42 -0
  46. package/dist/web-session-runtime-execution/shared/configDir.d.ts +57 -0
  47. package/dist/web-session-runtime-execution/shared/constants.d.ts +19 -0
  48. package/dist/web-session-runtime-execution/shared/debug.d.ts +32 -0
  49. package/dist/web-session-runtime-execution/shared/env.d.ts +38 -0
  50. package/dist/web-session-runtime-execution/shared/errors.d.ts +56 -0
  51. package/dist/web-session-runtime-execution/shared/feature.d.ts +25 -0
  52. package/dist/web-session-runtime-execution/shared/format.d.ts +11 -0
  53. package/dist/web-session-runtime-execution/shared/fs-operations.d.ts +116 -0
  54. package/dist/web-session-runtime-execution/shared/hash.d.ts +13 -0
  55. package/dist/web-session-runtime-execution/shared/identity.d.ts +23 -0
  56. package/dist/web-session-runtime-execution/shared/index.d.ts +46 -0
  57. package/dist/web-session-runtime-execution/shared/lazySchema.d.ts +12 -0
  58. package/dist/web-session-runtime-execution/shared/log.d.ts +1 -0
  59. package/dist/web-session-runtime-execution/shared/path.d.ts +22 -0
  60. package/dist/web-session-runtime-execution/shared/pdfPageImages.d.ts +19 -0
  61. package/dist/web-session-runtime-execution/shared/pdfReference.d.ts +70 -0
  62. package/dist/web-session-runtime-execution/shared/permissionDeadline.d.ts +24 -0
  63. package/dist/web-session-runtime-execution/shared/platform.d.ts +8 -0
  64. package/dist/web-session-runtime-execution/shared/stringUtils.d.ts +110 -0
  65. package/dist/web-session-runtime-execution/shared/swarmSchemaFilter.d.ts +23 -0
  66. package/dist/web-session-runtime-execution/shared/teamFileSchema.d.ts +151 -0
  67. package/dist/web-session-runtime-execution/shared/teamInboxSchema.d.ts +112 -0
  68. package/dist/web-session-runtime-execution/shared/teammateContext.d.ts +89 -0
  69. package/dist/web-session-runtime-execution/shared/tempDir.d.ts +1 -0
  70. package/dist/web-session-runtime-execution/shared/textEncoding.d.ts +41 -0
  71. package/dist/web-session-runtime-execution/shared/tokenEstimation.d.ts +36 -0
  72. package/dist/web-session-runtime-execution/shared/types-session.d.ts +266 -0
  73. package/dist/web-session-runtime-execution/shared/types.d.ts +190 -0
  74. package/dist/web-session-runtime-execution/shared/unc.d.ts +5 -0
  75. package/dist/web-session-runtime-execution/shared/windowsPaths.d.ts +24 -0
  76. package/package.json +11 -4
@@ -0,0 +1,88 @@
1
+ import type { ContentReplacementRecord, LogOption, PersistedWorktreeSession, SerializedMessage, TranscriptMessage } from './types.js';
2
+ /** 旧 L1825 逐字。 */
3
+ export declare function removeExtraFields(transcript: TranscriptMessage[]): SerializedMessage[];
4
+ /**
5
+ * Builds a conversation chain from a leaf message to root(旧 L2069 逐字)
6
+ * @param messages Map of all messages
7
+ * @param leafMessage The leaf message to start from
8
+ * @returns Array of messages from root to leaf
9
+ */
10
+ export declare function buildConversationChain(messages: Map<string, TranscriptMessage>, leafMessage: TranscriptMessage): TranscriptMessage[];
11
+ /**
12
+ * Loads a transcript from a JSON or JSONL file and converts it to LogOption
13
+ * format(旧 L2283 逐字裁剪:fileHistory/attribution/contextCollapse 链
14
+ * 构造裁除,留 worktreeSession 面)
15
+ * @param filePath Path to the transcript file (.json or .jsonl)
16
+ * @returns LogOption containing the transcript messages
17
+ * @throws Error if file doesn't exist or contains invalid data
18
+ */
19
+ export declare function loadTranscriptFromFile(filePath: string): Promise<LogOption>;
20
+ /**
21
+ * Loads all messages, summaries, and metadata from a transcript file.
22
+ * (旧 L3443 逐字裁剪,返回面按头注裁面登记收缩)
23
+ */
24
+ /**
25
+ * S0-R3 定型错(工单 §8-2):transcript 超出调用方声明的 maxBytes 界。
26
+ * message 安全化钉死——零盘路径、零 stack(web 错误面 contract 纪律)。
27
+ * 尺寸/界数值单源在调用方(web 域 = limits.ts;loader 经 opts 接收禁第二常量)。
28
+ */
29
+ export declare class TranscriptTooLargeError extends Error {
30
+ readonly name = "TranscriptTooLargeError";
31
+ readonly size: number;
32
+ readonly maxBytes: number;
33
+ constructor(size: number, maxBytes: number);
34
+ }
35
+ /**
36
+ * S0-R3 格 2 定型错:持 fd 读期间文件身份变化(ino/size 读毕复核不等)。
37
+ * 不连续分态——replay 映射 ioUnavailable retryable / follow resetRequired;
38
+ * 零半旧半新交付。message 安全化:零盘路径。
39
+ */
40
+ export declare class TranscriptChangedDuringReadError extends Error {
41
+ readonly name = "TranscriptChangedDuringReadError";
42
+ constructor();
43
+ }
44
+ export declare function loadTranscriptFile(filePath: string, opts?: {
45
+ keepAllLeaves?: boolean;
46
+ /**
47
+ * S0-R 只读 runtime 加性修形(呈批书 §7.3,f4 批复 @f1f1099d):
48
+ * 'force-full' 跳过 >5MB precompact 两段剔除(尺寸门 + walkChainBeforeParse)
49
+ * 全量读;缺省/'auto' = 逐字节现状恒等。不 mutate env
50
+ * (ATLAS_DISABLE_PRECOMPACT_SKIP 进程级全局,禁触)。
51
+ */
52
+ precompactSkip?: 'auto' | 'force-full';
53
+ /**
54
+ * S0-R3 加性 opts(工单 §8-2):transcript 预解析字节界;undefined =
55
+ * 不设界(缺省臂语义,TUI 107-151MB 合法 session 不受影响——分账 A)。
56
+ * 传入本 opt 即进 fd 链作用域(§8-1 opts 在场支)。界值单源 = 调用方
57
+ * (web 域 limits.ts),loader 不持第二常量。
58
+ */
59
+ maxBytes?: number;
60
+ /**
61
+ * S0-R4 F1 加性 opts(工单 §11-1/呈批书 L3,f4 §10 批复):授权身份锚
62
+ * ——授权支 open 后 fd.stat().ino !== expectIno → 复用
63
+ * TranscriptChangedDuringReadError(开的文件 ≠ 授权身份 ≈ 非稳定快照
64
+ * 同族;零新错误类型)。undefined = 不锚定(默认臂与未传授权支恒等)。
65
+ * 锚来源 = 调用方既有采样(web adapter 双采样 pre-stat,零新采样点)。
66
+ */
67
+ expectIno?: number;
68
+ }): Promise<{
69
+ messages: Map<string, TranscriptMessage>;
70
+ summaries: Map<string, string>;
71
+ customTitles: Map<string, string>;
72
+ tags: Map<string, string>;
73
+ worktreeStates: Map<string, PersistedWorktreeSession | null>;
74
+ contentReplacements: Map<string, ContentReplacementRecord[]>;
75
+ goalStates: Map<string, {
76
+ armed: boolean;
77
+ condition: string;
78
+ } | null>;
79
+ leafUuids: Set<string>;
80
+ }>;
81
+ /**
82
+ * Loads a transcript from a specific session file.(旧 L3788 逐字解耦:
83
+ * sessionProjectDir CC-34 原子对裁)
84
+ * S0-R2(lock-face @25cb7454 §3-3):改域内导出——会话去重缓存模块
85
+ * (sessionMessagesCache.ts,必改钉① 整体迁移)经本函数读盘;本模块对
86
+ * 缓存零引用(载体加载图结构性缺席的构造面)。
87
+ */
88
+ export declare function loadSessionFile(sessionId: string): Promise<Awaited<ReturnType<typeof loadTranscriptFile>>>;
@@ -0,0 +1,25 @@
1
+ export declare const getProjectDir: (projectDir: string) => string;
2
+ export declare function getProjectsDir(): string;
3
+ export declare function getTranscriptPath(): string;
4
+ export declare function getTranscriptPathForSession(sessionId: string): string;
5
+ export declare const MAX_TRANSCRIPT_READ_BYTES: number;
6
+ export declare function setAgentTranscriptSubdir(agentId: string, subdir: string): void;
7
+ export declare function clearAgentTranscriptSubdir(agentId: string): void;
8
+ export declare function getAgentTranscriptPath(agentId: string): string;
9
+ export declare function getUserType(): string;
10
+ export declare function getEntrypoint(): string;
11
+ /**
12
+ * 域内 git branch 探针(旧 utils/git.ts getBranch 语义;域自包含,scheduler
13
+ * 「域内小工具」先例)。非 git 仓 / git 失败 → undefined(调用方
14
+ * insertMessageChain 的 try/catch 逐字兜底)。
15
+ *
16
+ * 【审视 A-2 登记(E-7 d1 独立审视 MINOR,值 delta 裁定接受)】
17
+ * 机制面:旧 getBranch = 缓存族(gitWatcher.get('branch', computeBranch))
18
+ * → 域内逐次 execFile spawn(无缓存,域自包含)。值面:detached-HEAD /
19
+ * 非 git 仓 / HEAD 缺失时旧 computeBranch(gitFilesystem L500)返字符串
20
+ * 'HEAD';本实现 `branch !== 'HEAD' ? branch : undefined` 映射为字段
21
+ * 缺省。消费面 = gitBranch 戳 CLI 列表展示(归 CLI 波),链完整性零
22
+ * delta。
23
+ */
24
+ export declare function getGitBranch(): Promise<string | undefined>;
25
+ export declare function getVersion(): string;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * session 域 — 消息/entry 判别谓词族(E-7 S-7d d1,§8.49 详案;旧
3
+ * sessionStorage.ts L134-190 + messages.ts L4596 isCompactBoundaryMessage
4
+ * 逐字随迁;独立小文件供 project/record/load 三面共享,避免 record↔load
5
+ * 运行时环依赖)
6
+ *
7
+ * H6 前向接缝登记(§8.51 复审 A-NOTE-2,复审勿当遗漏重提):旧
8
+ * messages.ts L4606 findLastCompactBoundaryIndex / L4631
9
+ * getMessagesAfterCompactBoundary(REPL snip 消费者,依赖 snipProjection /
10
+ * HISTORY_SNIP 面 ∉ 新仓)未随迁——shell/REPL 波若需 compact-boundary 检索
11
+ * 前向补裁。
12
+ */
13
+ import type { Message, Entry, TranscriptMessage, SystemCompactBoundaryMessage } from './types.js';
14
+ import type { Message as SharedMessage } from '../../shared.js';
15
+ /**
16
+ * 旧 L134 逐字。Type guard to check if an entry is a transcript message.
17
+ * Transcript messages include user, assistant, attachment, and system
18
+ * messages. IMPORTANT: This is the single source of truth for what
19
+ * constitutes a transcript message. loadTranscriptFile() uses this to
20
+ * determine which messages to load into the chain.
21
+ *
22
+ * Progress messages are NOT transcript messages. They are ephemeral UI
23
+ * state and must not be persisted to the JSONL or participate in the
24
+ * parentUuid chain. Including them caused chain forks that orphaned real
25
+ * conversation messages on resume (see #14373, #23537).
26
+ */
27
+ export declare function isTranscriptMessage(entry: Entry): entry is TranscriptMessage;
28
+ /**
29
+ * 旧 L149 逐字。Entries that participate in the parentUuid chain. Used on
30
+ * the write path (insertMessageChain, useLogMessages) to skip progress when
31
+ * assigning parentUuid. Old transcripts with progress already in the chain
32
+ * are handled by the progressBridge rewrite in loadTranscriptFile.
33
+ */
34
+ export declare function isChainParticipant(m: Pick<Message, 'type'>): boolean;
35
+ export type LegacyProgressEntry = {
36
+ type: 'progress';
37
+ uuid: string;
38
+ parentUuid: string | null;
39
+ };
40
+ /**
41
+ * 旧 L164 逐字。Progress entries in transcripts written before PR #24099.
42
+ * They are not in the Entry type union anymore but still exist on disk
43
+ * with uuid and parentUuid fields. loadTranscriptFile bridges the chain
44
+ * across them.
45
+ */
46
+ export declare function isLegacyProgressEntry(entry: unknown): entry is LegacyProgressEntry;
47
+ export declare function isEphemeralToolProgress(dataType: unknown): boolean;
48
+ /**
49
+ * 旧 messages.ts L4596 逐字(D-2a S1 入参放宽:域 Message 型 → shared
50
+ * Message 单源契约——结构谓词只读 {type, subtype} 两字段判别,session 域
51
+ * Message / Entry 并集 / shared Message 均结构可赋,判别收窄形不变;
52
+ * 新仓跨子域消费方 context/snipRuntime 经 shared Message 单源调用)。
53
+ * Checks if a message is a compact boundary marker.
54
+ */
55
+ export declare function isCompactBoundaryMessage(message: SharedMessage): message is SystemCompactBoundaryMessage;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * engine/session 只读子门面(S0-R 工单 §4.1 / 呈批书 §7.3,f4 批复
3
+ * @f1f1099d)。域内只读服务:web 只读 runtime 经本门面复用 load 族纯
4
+ * 函数,零全局槽、零写面(禁调清单 = session/index.ts 头注写面黑名单:
5
+ * 不触 getSessionMessages 缓存 Map、不触 project 写面、不触发 flush hook)。
6
+ *
7
+ * loadTranscriptFull = 呈批书 §7.3 唯一修形消费点:precompactSkip
8
+ * 'force-full'(跳过 >5MB 尺寸门与 walkChainBeforeParse 两段剔除,全量
9
+ * 读)——persisted-effective-conversation 定义(必改 5b):
10
+ * 全量读取(skip 禁用)+ terminal leaf 链 + preserved 段物理在盘自然并入
11
+ * + compact 边界行/session 级元数据行不投影(进 summary 域)。不 mutate
12
+ * env(ATLAS_DISABLE_PRECOMPACT_SKIP 禁触)。
13
+ */
14
+ import { loadTranscriptFile } from './load.js';
15
+ export { buildConversationChain, TranscriptChangedDuringReadError, TranscriptTooLargeError, } from './load.js';
16
+ export type { TranscriptMessage } from './types.js';
17
+ export type ReadonlyTranscriptLoad = Awaited<ReturnType<typeof loadTranscriptFile>>;
18
+ /** 全量只读加载(force-full,零截断;只读 runtime 专用)。 */
19
+ export declare function loadTranscriptFull(filePath: string,
20
+ /**
21
+ * S0-R3 加性透传(工单 §8-2):maxBytes 预解析界(undefined = 不设界);
22
+ * force-full 恒传 → loader fd 链作用域(§8-1 opts 在场支)。
23
+ * S0-R4 加性透传(工单 §11-1 F1):expectIno 授权身份锚(undefined =
24
+ * 不锚定),loader open 后 fd.stat().ino 比对臂。
25
+ */
26
+ opts?: {
27
+ maxBytes?: number;
28
+ expectIno?: number;
29
+ }): Promise<ReadonlyTranscriptLoad>;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Chunk size for the forward transcript reader. 1 MB balances I/O calls vs buffer growth.
3
+ * S0-R4(工单 §11-2 F2 / f4 §10 补钉):改导出单源——load.ts 授权支位置化
4
+ * 分块读复用本常量,禁第二常量(loader 域界值单源纪律)。
5
+ */
6
+ export declare const TRANSCRIPT_READ_CHUNK_SIZE: number;
7
+ /**
8
+ * File size below which precompact filtering is skipped.
9
+ * Large sessions (>5 MB) almost always have compact boundaries — they got big
10
+ * because of many turns triggering auto-compact.
11
+ */
12
+ export declare const SKIP_PRECOMPACT_THRESHOLD: number;
13
+ export declare function readTranscriptForLoad(filePath: string, fileSize: number,
14
+ /**
15
+ * S0-R3 加性 fd 参(工单 §8-1,:1066 scanner 点——所有权归 caller):
16
+ * fd 在场 = 全程该 fd 位置读(positional read,零 seek 依赖)、不关
17
+ * (caller finally 关);缺省 = 自开自关形逐字节恒等(attribution.ts/
18
+ * SDK 消费面零适配)。
19
+ */
20
+ opts?: {
21
+ fd?: Awaited<ReturnType<typeof import('fs/promises').open>>;
22
+ }): Promise<{
23
+ boundaryStartOffset: number;
24
+ postBoundaryBuf: Buffer;
25
+ hasPreservedSegment: boolean;
26
+ }>;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * transcript 搜索文本面(E-7 S-7d d2,§8.49):旧仓 utils/transcriptSearch.ts
3
+ * 202L 逐字随迁(renderableSearchText / computeSearchText / toolUseSearchText /
4
+ * toolResultSearchText + WeakMap 缓存 + RENDERED_AS_SENTINEL 防虚影 + system-reminder
5
+ * 剥离)。算法体逐字;仅类型面 delta 登记如下。
6
+ *
7
+ * 裁面 / 解耦登记(H6 前向接缝——预声明接缝非遗漏,复审勿当遗漏重提):
8
+ * - INTERRUPT_MESSAGE / INTERRUPT_MESSAGE_FOR_TOOL_USE:旧仓 utils/messages.ts:218-220
9
+ * (shell 消息域)→ 本域内化常量(串逐字),使搜索文本面与 shell 消息域解耦;
10
+ * shell /interrupt 渲染面自持副本(跨波重复,UI 波登记)。
11
+ * - RenderableMessage:旧仓 types/message.ts:30 `RenderableMessage = Message`
12
+ * (Message = 带 `[key: string]: any` 索引签名的宽接口,非 union;审视 N-3
13
+ * 措辞订正)→ 本域最小形(types.ts:computeSearchText 消费 6 型面 +
14
+ * toolUseResult duck 面;兼容口径 = 运行时对象层,旧 TS 宽类型不可直接
15
+ * 赋给字面量判别联合);UI 渲染消费面 = REPL /transcript 搜索波,前向接缝。
16
+ * - ContentBlock 类型面 delta:旧仓 types/atlas.ts:1 `[key: string]: any` → 新仓
17
+ * shared/types.ts:20 收窄 `[key: string]: unknown`;本文件 b.text 3 处直接索引
18
+ * 以 `as string` 还原 string 面(TextBlock 形 { type: 'text'; text: string },
19
+ * cast 健全),算法体零 delta。
20
+ * - 探针锚点 P-S4:toolResultSearchText `if (typeof o.stdout === 'string')` 支
21
+ * (Bash {stdout,stderr} duck 形;删支 → func/unit duck 测恰 1 红)。
22
+ */
23
+ import type { RenderableMessage } from './types.js';
24
+ /** 旧仓 utils/messages.ts:218 逐字(解耦登记见文件头)。 */
25
+ export declare const INTERRUPT_MESSAGE = "[Request interrupted by user]";
26
+ /** 旧仓 utils/messages.ts:219-220 逐字(解耦登记见文件头)。 */
27
+ export declare const INTERRUPT_MESSAGE_FOR_TOOL_USE = "[Request interrupted by user for tool use]";
28
+ /** Flatten a RenderableMessage to lowercased searchable text. WeakMap-
29
+ * cached — messages are append-only and immutable so a hit is always
30
+ * valid. Lowercased at cache time: the only caller immediately
31
+ * .toLowerCase()d the result, re-lowering ~1.5MB on every keystroke
32
+ * (the backspace hang). Returns '' for non-searchable types. */
33
+ export declare function renderableSearchText(msg: RenderableMessage): string;
34
+ /** Tool invocation display: renderToolUseMessage shows input fields like
35
+ * command (Bash), pattern (Grep), file_path (Read/Edit), prompt (Agent).
36
+ * Same duck-type strategy as toolResultSearchText — known field names,
37
+ * unknown → empty. Under-count > phantom. */
38
+ export declare function toolUseSearchText(input: unknown): string;
39
+ /** Duck-type the tool's native Out for searchable text. Known shapes:
40
+ * {stdout,stderr} (Bash/Shell), {content} (Grep), {file:{content}} (Read),
41
+ * {filenames:[]} (Grep/Glob), {output} (generic). Falls back to concating
42
+ * all top-level string fields — crude but better than indexing model-chatter.
43
+ * Empty for unknown shapes: under-count > phantom. */
44
+ export declare function toolResultSearchText(r: unknown): string;
@@ -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"