@botlearn-course/daemon 0.0.20-beta.15 → 0.0.20-beta.16

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.
@@ -20,67 +20,12 @@ export declare function runtimeProfileDir(agentRunId: string): string;
20
20
  export declare function runtimeProfileRunRootDir(agentRunId: string): string;
21
21
  export declare function runtimeSessionRootDir(runtimeSessionId: string, sandboxGeneration: number): string;
22
22
  /**
23
- * per-session workspace(ADR-015 §7):managed sandbox 使用稳定路径
24
- * `<root>/sessions/<runtime_session_id>/workspace`。该路径不含 generation,
23
+ * durable workspacemanaged sandbox 使用稳定路径
24
+ * `<root>/sessions/<workspace_id>/workspace`。该路径不含 generation,
25
25
  * 因为 NAS image 跨 generation 重新挂载后必须解析到同一个目录。
26
26
  */
27
- export declare function runtimeSessionWorkspaceDir(runtimeSessionId: string, sandboxGeneration: number): string;
27
+ export declare function runtimeSessionWorkspaceDir(workspaceId: string, sandboxGeneration: number): string;
28
28
  export declare function runtimeSessionTranscriptPath(runtimeSessionId: string, sandboxGeneration: number, agentRunId: string): string;
29
- export declare const WORKSPACE_COPY_POLICY_V1: Readonly<{
30
- policyId: "WorkspaceCopyPolicyV1";
31
- maxTotalEntries: 25000;
32
- maxFiles: 20000;
33
- maxSymlinks: 2000;
34
- maxBytes: number;
35
- maxDepth: 64;
36
- maxRelativePathBytes: 4096;
37
- maxDurationSeconds: 600;
38
- markerName: ".botlearn-workspace-copy";
39
- }>;
40
- export type WorkspaceCopyErrorCode = "workspace_migration_source_unavailable" | "workspace_migration_content_unsafe" | "workspace_migration_limit_exceeded" | "workspace_migration_io_failed" | "workspace_migration_receipt_mismatch";
41
- export declare class WorkspaceCopyError extends Error {
42
- readonly code: WorkspaceCopyErrorCode;
43
- constructor(code: WorkspaceCopyErrorCode);
44
- }
45
- export interface WorkspaceCopyReceiptV1 {
46
- schema_version: "botlearn-workspace-copy-receipt/1";
47
- policy_id: "WorkspaceCopyPolicyV1";
48
- copy_id: string;
49
- source_runtime_session_id: string;
50
- target_runtime_session_id: string;
51
- source_sandbox_id: string;
52
- source_generation: number;
53
- file_count: number;
54
- directory_count: number;
55
- symlink_count: number;
56
- total_bytes: number;
57
- manifest_digest: string;
58
- }
59
- export interface WorkspaceCopyResult {
60
- receipt: WorkspaceCopyReceiptV1;
61
- markerPath: string;
62
- }
63
- interface ManifestEntry {
64
- type: "file" | "dir" | "link";
65
- relativePath: string;
66
- modeTag: "file-0600" | "file-0700" | "dir-0700" | "link";
67
- byteSize?: number;
68
- contentDigest?: Buffer;
69
- linkTarget?: string;
70
- }
71
- export declare function workspaceCopyManifestDigest(entries: ManifestEntry[]): string;
72
- export declare function workspaceCopyV1Supported(): boolean;
73
- /** Remove crash-left staging directories before advertising workspace_copy_v1. */
74
- export declare function cleanupRuntimeSessionWorkspaceCopyStaging(): Promise<void>;
75
- /** Copy learner-owned files into a new Session and durably stage a content-free receipt. */
76
- export declare function copyRuntimeSessionWorkspace(request: {
77
- copyId: string;
78
- sourceRuntimeSessionId: string;
79
- targetRuntimeSessionId: string;
80
- sandboxId: string;
81
- sandboxGeneration: number;
82
- }): Promise<WorkspaceCopyResult>;
83
- export declare function finalizeRuntimeSessionWorkspaceCopy(markerPath: string): Promise<void>;
84
29
  export declare function ensureRunWorkspace(agentRunId: string): {
85
30
  rootDir: string;
86
31
  workspaceDir: string;
@@ -89,7 +34,7 @@ export declare function ensureRunWorkspace(agentRunId: string): {
89
34
  * session.open 时创建 per-session 目录。managed workspace 默认保持 0700,只有当前
90
35
  * activation 会通过 exposeRuntimeSessionWorkspace() 临时开放给 runtime 组。
91
36
  */
92
- export declare function ensureRuntimeSessionDirectories(runtimeSessionId: string, sandboxGeneration: number): {
37
+ export declare function ensureRuntimeSessionDirectories(runtimeSessionId: string, sandboxGeneration: number, workspaceId?: string): {
93
38
  rootDir: string;
94
39
  workspaceDir: string;
95
40
  };
@@ -98,14 +43,13 @@ export declare function ensureRuntimeSessionDirectories(runtimeSessionId: string
98
43
  * 0710,因此 runtime 只能穿过根目录,不能列举其他 session id;未激活 session
99
44
  * 的父目录与 workspace 始终为 0700。
100
45
  */
101
- export declare function exposeRuntimeSessionWorkspace(runtimeSessionId: string, sandboxGeneration: number): void;
46
+ export declare function exposeRuntimeSessionWorkspace(runtimeSessionId: string, sandboxGeneration: number, workspaceId?: string): void;
102
47
  /** Revoke a managed workspace without deleting the session's durable local materialization. */
103
- export declare function revokeRuntimeSessionWorkspace(runtimeSessionId: string, sandboxGeneration: number): void;
104
- /** session.close 时删除 workspace 与本地 session 物化状态(transcripts 等)。幂等。 */
105
- export declare function removeRuntimeSessionWorkspace(runtimeSessionId: string, sandboxGeneration: number, preserveManagedWorkspace?: boolean): void;
106
- export declare function ensureRuntimeSessionWorkspace(runtimeSessionId: string, sandboxGeneration: number, agentRunId: string): {
48
+ export declare function revokeRuntimeSessionWorkspace(runtimeSessionId: string, sandboxGeneration: number, workspaceId?: string): void;
49
+ /** session.close 时删除本地 Session 状态;Workspace 由独立生命周期拥有。 */
50
+ export declare function removeRuntimeSessionWorkspace(runtimeSessionId: string, sandboxGeneration: number, preserveManagedWorkspace?: boolean, workspaceId?: string): void;
51
+ export declare function ensureRuntimeSessionWorkspace(runtimeSessionId: string, sandboxGeneration: number, agentRunId: string, workspaceId?: string): {
107
52
  rootDir: string;
108
53
  workspaceDir: string;
109
54
  transcriptFile: string;
110
55
  };
111
- export {};