@atlaswork/atlascode 0.1.125 → 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.
- package/dist/atlasweb-carrier.json +6 -0
- package/dist/cli.js +514 -18
- package/dist/web-session-runtime/atlascode/web/entry.d.ts +2 -0
- package/dist/web-session-runtime/atlascode/web/executionOutlet.d.ts +60 -0
- package/dist/web-session-runtime/atlascode/web/runtimeEntry.d.ts +16 -0
- package/dist/web-session-runtime/index.d.ts +1 -1
- package/dist/web-session-runtime/kernel/execution/executionOutlet.d.ts +60 -0
- package/dist/web-session-runtime/kernel/protocol/webExecutionV0.d.ts +542 -0
- package/dist/web-session-runtime/kernel/state/injection.d.ts +28 -0
- package/dist/web-session-runtime/kernel/state/ports.d.ts +67 -0
- package/dist/web-session-runtime-execution/atlascode/web/contract.d.ts +10 -0
- package/dist/web-session-runtime-execution/atlascode/web/cursorLedger.d.ts +63 -0
- package/dist/web-session-runtime-execution/atlascode/web/entry.d.ts +24 -0
- package/dist/web-session-runtime-execution/atlascode/web/errors.d.ts +16 -0
- package/dist/web-session-runtime-execution/atlascode/web/follow.d.ts +82 -0
- package/dist/web-session-runtime-execution/atlascode/web/limits.d.ts +63 -0
- package/dist/web-session-runtime-execution/atlascode/web/projection.d.ts +69 -0
- package/dist/web-session-runtime-execution/atlascode/web/readonlyRuntime.d.ts +156 -0
- package/dist/web-session-runtime-execution/atlascode/web/runtimeDefault.d.ts +26 -0
- package/dist/web-session-runtime-execution/atlascode/web/sessionStoreAdapter.d.ts +70 -0
- package/dist/web-session-runtime-execution/engine/session/env.d.ts +32 -0
- package/dist/web-session-runtime-execution/engine/session/firstPrompt.d.ts +21 -0
- package/dist/web-session-runtime-execution/engine/session/json.d.ts +27 -0
- package/dist/web-session-runtime-execution/engine/session/load.d.ts +88 -0
- package/dist/web-session-runtime-execution/engine/session/paths.d.ts +25 -0
- package/dist/web-session-runtime-execution/engine/session/predicates.d.ts +55 -0
- package/dist/web-session-runtime-execution/engine/session/readonly.d.ts +29 -0
- package/dist/web-session-runtime-execution/engine/session/scanner.d.ts +26 -0
- package/dist/web-session-runtime-execution/engine/session/search.d.ts +44 -0
- package/dist/web-session-runtime-execution/engine/session/types.d.ts +379 -0
- package/dist/web-session-runtime-execution/index.d.ts +1 -0
- package/dist/web-session-runtime-execution/index.js +8396 -0
- package/dist/web-session-runtime-execution/kernel/execution/executionOutlet.d.ts +60 -0
- package/dist/web-session-runtime-execution/kernel/protocol/webExecutionV0.d.ts +547 -0
- package/dist/web-session-runtime-execution/kernel/protocol/webSessionV0.d.ts +727 -0
- package/dist/web-session-runtime-execution/kernel/state/injection.d.ts +28 -0
- package/dist/web-session-runtime-execution/kernel/state/ports.d.ts +67 -0
- package/dist/web-session-runtime-execution/shared/ProductDefinition.d.ts +47 -0
- package/dist/web-session-runtime-execution/shared/agentRoleTemplates.d.ts +44 -0
- package/dist/web-session-runtime-execution/shared/agentSwarmsEnabled.d.ts +5 -0
- package/dist/web-session-runtime-execution/shared/boundedImageRead.d.ts +31 -0
- package/dist/web-session-runtime-execution/shared/circular-buffer.d.ts +42 -0
- package/dist/web-session-runtime-execution/shared/configDir.d.ts +57 -0
- package/dist/web-session-runtime-execution/shared/constants.d.ts +19 -0
- package/dist/web-session-runtime-execution/shared/debug.d.ts +32 -0
- package/dist/web-session-runtime-execution/shared/env.d.ts +38 -0
- package/dist/web-session-runtime-execution/shared/errors.d.ts +56 -0
- package/dist/web-session-runtime-execution/shared/feature.d.ts +25 -0
- package/dist/web-session-runtime-execution/shared/format.d.ts +11 -0
- package/dist/web-session-runtime-execution/shared/fs-operations.d.ts +116 -0
- package/dist/web-session-runtime-execution/shared/hash.d.ts +13 -0
- package/dist/web-session-runtime-execution/shared/identity.d.ts +23 -0
- package/dist/web-session-runtime-execution/shared/index.d.ts +46 -0
- package/dist/web-session-runtime-execution/shared/lazySchema.d.ts +12 -0
- package/dist/web-session-runtime-execution/shared/log.d.ts +1 -0
- package/dist/web-session-runtime-execution/shared/path.d.ts +22 -0
- package/dist/web-session-runtime-execution/shared/pdfPageImages.d.ts +19 -0
- package/dist/web-session-runtime-execution/shared/pdfReference.d.ts +70 -0
- package/dist/web-session-runtime-execution/shared/permissionDeadline.d.ts +24 -0
- package/dist/web-session-runtime-execution/shared/platform.d.ts +8 -0
- package/dist/web-session-runtime-execution/shared/stringUtils.d.ts +110 -0
- package/dist/web-session-runtime-execution/shared/swarmSchemaFilter.d.ts +23 -0
- package/dist/web-session-runtime-execution/shared/teamFileSchema.d.ts +151 -0
- package/dist/web-session-runtime-execution/shared/teamInboxSchema.d.ts +112 -0
- package/dist/web-session-runtime-execution/shared/teammateContext.d.ts +89 -0
- package/dist/web-session-runtime-execution/shared/tempDir.d.ts +1 -0
- package/dist/web-session-runtime-execution/shared/textEncoding.d.ts +41 -0
- package/dist/web-session-runtime-execution/shared/tokenEstimation.d.ts +36 -0
- package/dist/web-session-runtime-execution/shared/types-session.d.ts +266 -0
- package/dist/web-session-runtime-execution/shared/types.d.ts +190 -0
- package/dist/web-session-runtime-execution/shared/unc.d.ts +5 -0
- package/dist/web-session-runtime-execution/shared/windowsPaths.d.ts +24 -0
- package/package.json +11 -4
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type SessionEnv = {
|
|
2
|
+
/** 当前 session id(旧 bootstrap getSessionId)。 */
|
|
3
|
+
getSessionId(): string;
|
|
4
|
+
/** 切换 session(/resume/--continue;单参——projectDir 原子对随 d1 裁)。 */
|
|
5
|
+
switchSession(id: string): void;
|
|
6
|
+
/** 进程启动 cwd(旧 bootstrap getOriginalCwd;不可变语义)。 */
|
|
7
|
+
getOriginalCwd(): string;
|
|
8
|
+
/** transcript 项目根目录(`<configHome>/projects`,bootstrap defaultTranscriptDir 先例)。 */
|
|
9
|
+
getProjectsDir(): string;
|
|
10
|
+
/** 进程退出清理钩子注册(旧 utils/cleanupRegistry;缺省 no-op 收集,壳侧接线执行面)。 */
|
|
11
|
+
registerCleanup(handler: () => Promise<void>): void;
|
|
12
|
+
/**
|
|
13
|
+
* 活态 cwd(S-E3 A12,§8.52):旧仓 getCwd() 活态语义(ALS 覆盖层 ??
|
|
14
|
+
* cwdState,Bash cd 持久化 / --resume workDir / agent worktree 刷新)。域缺省
|
|
15
|
+
* = process.cwd() 活读(无 bootstrap 约束下旧活态语义最近等价,自包含不破);
|
|
16
|
+
* 组合根经 bootstrap pwd()(ALS 覆盖 ?? getCwdState)注真值。消费点 =
|
|
17
|
+
* project.ts insertMessageChain cwd 戳(A-1 审视值 delta 可选扩已落)。
|
|
18
|
+
*/
|
|
19
|
+
getCwd(): string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* 组合根注真 bootstrap 值(E-wave-end compose.ts 接线;测试覆写
|
|
23
|
+
* getProjectsDir → tmpdir 真盘面)。Partial 合并:未注成员沿用缺省。
|
|
24
|
+
*/
|
|
25
|
+
export declare function setSessionEnv(partial: Partial<SessionEnv>): void;
|
|
26
|
+
export declare function getSessionEnv(): SessionEnv;
|
|
27
|
+
/**
|
|
28
|
+
* 测试复位(恢复域缺省,丢弃组合根/测试注入的 Partial 合并;单进程连跑跨文件
|
|
29
|
+
* 泄漏守卫——setSessionEnv 为 Partial 合并进程内不可逆,本导出 = teardown 出口;
|
|
30
|
+
* 合并走 spread 新对象,defaultEnv 本体不被写,复位安全)。
|
|
31
|
+
*/
|
|
32
|
+
export declare function resetSessionEnv(): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Message, TranscriptMessage } from './types.js';
|
|
2
|
+
/** 旧 constants/xml.ts 逐字。 */
|
|
3
|
+
export declare const COMMAND_NAME_TAG = "command-name";
|
|
4
|
+
type BuiltinCommandNamesSource = () => Set<string>;
|
|
5
|
+
/**
|
|
6
|
+
* 内建命令名集合注入窗(S-C4 注入口回填,§8.71.1.4):CLI 域
|
|
7
|
+
* cli/commands.ts registerBuiltinCommandNames() 注入 engine/skill 域
|
|
8
|
+
* builtInCommandNames 读面(调用一次即持久;缺省空 Set = 未注入态行为)。
|
|
9
|
+
*/
|
|
10
|
+
export declare function setBuiltinCommandNamesSource(src: BuiltinCommandNamesSource): void;
|
|
11
|
+
/** 测试复位面(缺省空 Set 态)。 */
|
|
12
|
+
export declare function resetBuiltinCommandNamesSourceForTesting(): void;
|
|
13
|
+
declare function extractFirstPrompt(transcript: TranscriptMessage[]): string;
|
|
14
|
+
/**
|
|
15
|
+
* Gets the last user message that was processed (i.e., before any non-user
|
|
16
|
+
* message appears). Used to determine if a session has valid user
|
|
17
|
+
* interaction.(旧 L1757 逐字)
|
|
18
|
+
*/
|
|
19
|
+
export declare function getFirstMeaningfulUserMessageTextContent<T extends Message>(transcript: T[]): string | undefined;
|
|
20
|
+
/** 旧 L1736 逐字(convertToLogOption 消费;load 读面经本文件导入)。 */
|
|
21
|
+
export { extractFirstPrompt };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* session 域 — JSONL 解析/序列化域内小工具(E-7 S-7d d1,§8.49 详案 item 6
|
|
3
|
+
* 「域内小工具 parseJSONL / jsonParse / jsonStringify」独立小文件承载)
|
|
4
|
+
*
|
|
5
|
+
* 旧仓来源:src/utils/json.ts parseJSONL 族(L94-215 逐字)+ src/utils/
|
|
6
|
+
* slowOperations.ts jsonParse/jsonStringify(语义逐字,**计时面裁**——旧
|
|
7
|
+
* slowLogging 包裹归 telemetry 已删的 879 点同族,纯 JSON.parse/stringify
|
|
8
|
+
* 语义保留)。
|
|
9
|
+
*
|
|
10
|
+
* 裁面登记(审视 B-1,E-7 d1 独立审视 NIT):旧 readJSONLFile(json.ts
|
|
11
|
+
* L201,100MB 尾读)未随迁——全仓唯一消费者 = stats.ts:177(CLI 会话
|
|
12
|
+
* 统计面,d1 域外),归 CLI stats 波。
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Parses JSONL data from a string or Buffer, skipping malformed lines.
|
|
16
|
+
* Uses Bun.JSONL.parseChunk when available for better performance,
|
|
17
|
+
* falls back to indexOf-based scanning otherwise.
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseJSONL<T>(data: string | Buffer): T[];
|
|
20
|
+
/**
|
|
21
|
+
* 旧 slowOperations.jsonParse 语义逐字(计时包裹裁):V8 de-opts JSON.parse
|
|
22
|
+
* when a second argument is passed, even if undefined — branch explicitly so
|
|
23
|
+
* the common (no-reviver) path stays on the fast path.
|
|
24
|
+
*/
|
|
25
|
+
export declare const jsonParse: typeof JSON.parse;
|
|
26
|
+
/** 旧 slowOperations.jsonStringify 语义逐字(计时包裹裁)。 */
|
|
27
|
+
export declare function jsonStringify(data: unknown, space?: number): string;
|
|
@@ -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;
|