@codelia/storage 0.1.85 → 0.1.86
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/index.cjs +467 -90
- package/dist/index.d.cts +46 -10
- package/dist/index.d.ts +46 -10
- package/dist/index.js +470 -90
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _codelia_core from '@codelia/core';
|
|
2
|
-
import { StoragePaths, ResolveStorageOptions, RunEventStoreFactory, RunEventStoreInit, SessionStore, ConversationSearchResult, ConversationMessage, SessionStateStore, SessionState, SessionStateSummary, StoragePathService, SessionRecord, ToolOutputCacheStore, ToolOutputCacheRecord, ToolOutputRef, ToolOutputCacheReadOptions, ToolOutputCacheSearchOptions } from '@codelia/core';
|
|
2
|
+
import { StoragePaths, ResolveStorageOptions, RunEventStoreFactory, RunEventStoreInit, SessionStore, BaseMessage, ConversationApprovalProvenance, ConversationSearchResult, ConversationMessage, ConversationApprovalScope, ConversationApprovalContext, SessionStateStore, SessionState, SessionStateSummary, StoragePathService, SessionRecord, ToolOutputCacheStore, ToolOutputCacheRecord, ToolOutputRef, ToolOutputCacheReadOptions, ToolOutputCacheSearchOptions } from '@codelia/core';
|
|
3
3
|
export { ResolveStorageOptions, StorageLayout, StoragePathService, StoragePaths } from '@codelia/core';
|
|
4
|
-
import { GeneratedImageMetadata, ImageArtifactRef, ImageMediaType, AttachedImageMetadata, ImageArtifactMetadata, AttachmentRef, ApprovalMode, GoalRecord, SubagentLineage, AgentMessage, TaskTerminationReason, TaskUsage } from '@codelia/shared-types';
|
|
4
|
+
import { GeneratedImageMetadata, ImageArtifactRef, ImageMediaType, AttachedImageMetadata, ImageArtifactMetadata, AttachmentRef, ApprovalMode, SandboxMode, GoalRecord, SubagentLineage, AgentMessage, TaskTerminationReason, TaskUsage } from '@codelia/shared-types';
|
|
5
5
|
|
|
6
6
|
type AttachmentWriteOptions = {
|
|
7
7
|
artifactId?: string;
|
|
@@ -108,20 +108,42 @@ declare const getProcessIdentity: (pid: number, options?: {
|
|
|
108
108
|
canonicalEnvironment?: boolean;
|
|
109
109
|
}) => Promise<string | null>;
|
|
110
110
|
|
|
111
|
+
type ProjectSandboxPolicy = {
|
|
112
|
+
remembered_tool_allows?: Array<{
|
|
113
|
+
tool: string;
|
|
114
|
+
}>;
|
|
115
|
+
trust_project_allows?: boolean;
|
|
116
|
+
approval_mode?: ApprovalMode;
|
|
117
|
+
sandbox_mode?: SandboxMode;
|
|
118
|
+
protected_paths?: string[];
|
|
119
|
+
};
|
|
111
120
|
type ProjectsPolicyFile = {
|
|
112
121
|
version: 1;
|
|
113
|
-
default?:
|
|
114
|
-
|
|
115
|
-
};
|
|
116
|
-
projects?: Record<string, {
|
|
117
|
-
approval_mode?: ApprovalMode;
|
|
118
|
-
}>;
|
|
122
|
+
default?: ProjectSandboxPolicy;
|
|
123
|
+
projects?: Record<string, ProjectSandboxPolicy>;
|
|
119
124
|
};
|
|
120
125
|
declare class ProjectsPolicyStore {
|
|
121
126
|
private readonly paths;
|
|
122
127
|
constructor(paths?: StoragePaths);
|
|
123
128
|
getFilePath(): string;
|
|
124
|
-
|
|
129
|
+
private verifyWorkspaceLocation;
|
|
130
|
+
private trustedPath;
|
|
131
|
+
private readUserFile;
|
|
132
|
+
/** Read user-authored permission settings through the same private-file boundary as project trust. */
|
|
133
|
+
readUserConfig(workspace: string, configured: string): Promise<string | undefined>;
|
|
134
|
+
private readPolicyFile;
|
|
135
|
+
private readTrusted;
|
|
136
|
+
private hasUnverifiableProtectedPaths;
|
|
137
|
+
loadUserOwned(workspace: string, { strict }?: {
|
|
138
|
+
strict?: boolean;
|
|
139
|
+
}): Promise<ProjectsPolicyFile | null>;
|
|
140
|
+
verifyProjectModeWritable(workspace: string): Promise<void>;
|
|
141
|
+
/** Merge into a private user policy while other runtimes are excluded. */
|
|
142
|
+
writeProjectMode(workspace: string, mode: SandboxMode): Promise<void>;
|
|
143
|
+
writeProjectAllowTrust(workspace: string, trusted: boolean, verify: () => void): Promise<void>;
|
|
144
|
+
updateRememberedTool(workspace: string, tool: string, allow: boolean, verify?: () => void): Promise<boolean>;
|
|
145
|
+
private updateProject;
|
|
146
|
+
load(canonicalPath?: string): Promise<ProjectsPolicyFile | null>;
|
|
125
147
|
save(data: ProjectsPolicyFile): Promise<void>;
|
|
126
148
|
}
|
|
127
149
|
|
|
@@ -169,6 +191,11 @@ declare class RunEventStoreFactoryImpl implements RunEventStoreFactory {
|
|
|
169
191
|
declare const resolveRunLogPath: (file: string) => string;
|
|
170
192
|
declare function readRunLogLines(file: string): AsyncGenerator<string>;
|
|
171
193
|
|
|
194
|
+
declare function appendOriginalMessages(file: string, messages: BaseMessage[], provenance?: readonly (ConversationApprovalProvenance | undefined)[]): void;
|
|
195
|
+
declare function readOriginalApprovalContext(file: string, { userMessageId, proposalMessageId, workspace, cwd, workspaceIdentity, cwdIdentity, }: ConversationApprovalScope & {
|
|
196
|
+
userMessageId: string;
|
|
197
|
+
proposalMessageId?: string;
|
|
198
|
+
}, isAppliedSteer: (runId: string, steerId: string) => boolean): Promise<ConversationApprovalContext | null>;
|
|
172
199
|
declare function searchOriginalMessages(file: string, options: {
|
|
173
200
|
query: string;
|
|
174
201
|
cursor?: string;
|
|
@@ -197,6 +224,13 @@ type StoredSessionGoal = {
|
|
|
197
224
|
key: string;
|
|
198
225
|
runs: number;
|
|
199
226
|
};
|
|
227
|
+
/** Applied user Steers for this goal. Null means the evidence is incomplete. */
|
|
228
|
+
approvalSteers?: Array<string | Readonly<{
|
|
229
|
+
text: string;
|
|
230
|
+
attachmentsOmitted: true;
|
|
231
|
+
}>> | null;
|
|
232
|
+
/** Steers before this index predate the latest objective edit. */
|
|
233
|
+
approvalObjectiveAfterSteers?: number;
|
|
200
234
|
};
|
|
201
235
|
type Sqlite = {
|
|
202
236
|
exec(sql: string): void;
|
|
@@ -253,9 +287,11 @@ declare class SessionStateStoreImpl implements SessionStateStore, SessionRunReco
|
|
|
253
287
|
private loadLegacy;
|
|
254
288
|
private loadFromIndex;
|
|
255
289
|
private saveToIndex;
|
|
256
|
-
appendMessages(sessionId: string, messages: SessionState["messages"]): Promise<void>;
|
|
290
|
+
appendMessages(sessionId: string, messages: SessionState["messages"], origins?: Parameters<typeof appendOriginalMessages>[2]): Promise<void>;
|
|
257
291
|
searchMessages(sessionId: string, options: Parameters<typeof searchOriginalMessages>[1]): Promise<_codelia_core.ConversationSearchResult>;
|
|
258
292
|
readMessage(sessionId: string, options: Parameters<typeof readOriginalMessage>[1]): Promise<_codelia_core.ConversationMessage | null>;
|
|
293
|
+
readApprovalContext(sessionId: string, references: Parameters<typeof readOriginalApprovalContext>[1]): Promise<_codelia_core.ConversationApprovalContext | null>;
|
|
294
|
+
confirmApprovalSteer(sessionId: string, runId: string, steerId: string): Promise<void>;
|
|
259
295
|
load(sessionId: string): Promise<SessionState | null>;
|
|
260
296
|
save(state: SessionState): Promise<void>;
|
|
261
297
|
getSummary(sessionId: string): Promise<SessionStateSummary | null>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _codelia_core from '@codelia/core';
|
|
2
|
-
import { StoragePaths, ResolveStorageOptions, RunEventStoreFactory, RunEventStoreInit, SessionStore, ConversationSearchResult, ConversationMessage, SessionStateStore, SessionState, SessionStateSummary, StoragePathService, SessionRecord, ToolOutputCacheStore, ToolOutputCacheRecord, ToolOutputRef, ToolOutputCacheReadOptions, ToolOutputCacheSearchOptions } from '@codelia/core';
|
|
2
|
+
import { StoragePaths, ResolveStorageOptions, RunEventStoreFactory, RunEventStoreInit, SessionStore, BaseMessage, ConversationApprovalProvenance, ConversationSearchResult, ConversationMessage, ConversationApprovalScope, ConversationApprovalContext, SessionStateStore, SessionState, SessionStateSummary, StoragePathService, SessionRecord, ToolOutputCacheStore, ToolOutputCacheRecord, ToolOutputRef, ToolOutputCacheReadOptions, ToolOutputCacheSearchOptions } from '@codelia/core';
|
|
3
3
|
export { ResolveStorageOptions, StorageLayout, StoragePathService, StoragePaths } from '@codelia/core';
|
|
4
|
-
import { GeneratedImageMetadata, ImageArtifactRef, ImageMediaType, AttachedImageMetadata, ImageArtifactMetadata, AttachmentRef, ApprovalMode, GoalRecord, SubagentLineage, AgentMessage, TaskTerminationReason, TaskUsage } from '@codelia/shared-types';
|
|
4
|
+
import { GeneratedImageMetadata, ImageArtifactRef, ImageMediaType, AttachedImageMetadata, ImageArtifactMetadata, AttachmentRef, ApprovalMode, SandboxMode, GoalRecord, SubagentLineage, AgentMessage, TaskTerminationReason, TaskUsage } from '@codelia/shared-types';
|
|
5
5
|
|
|
6
6
|
type AttachmentWriteOptions = {
|
|
7
7
|
artifactId?: string;
|
|
@@ -108,20 +108,42 @@ declare const getProcessIdentity: (pid: number, options?: {
|
|
|
108
108
|
canonicalEnvironment?: boolean;
|
|
109
109
|
}) => Promise<string | null>;
|
|
110
110
|
|
|
111
|
+
type ProjectSandboxPolicy = {
|
|
112
|
+
remembered_tool_allows?: Array<{
|
|
113
|
+
tool: string;
|
|
114
|
+
}>;
|
|
115
|
+
trust_project_allows?: boolean;
|
|
116
|
+
approval_mode?: ApprovalMode;
|
|
117
|
+
sandbox_mode?: SandboxMode;
|
|
118
|
+
protected_paths?: string[];
|
|
119
|
+
};
|
|
111
120
|
type ProjectsPolicyFile = {
|
|
112
121
|
version: 1;
|
|
113
|
-
default?:
|
|
114
|
-
|
|
115
|
-
};
|
|
116
|
-
projects?: Record<string, {
|
|
117
|
-
approval_mode?: ApprovalMode;
|
|
118
|
-
}>;
|
|
122
|
+
default?: ProjectSandboxPolicy;
|
|
123
|
+
projects?: Record<string, ProjectSandboxPolicy>;
|
|
119
124
|
};
|
|
120
125
|
declare class ProjectsPolicyStore {
|
|
121
126
|
private readonly paths;
|
|
122
127
|
constructor(paths?: StoragePaths);
|
|
123
128
|
getFilePath(): string;
|
|
124
|
-
|
|
129
|
+
private verifyWorkspaceLocation;
|
|
130
|
+
private trustedPath;
|
|
131
|
+
private readUserFile;
|
|
132
|
+
/** Read user-authored permission settings through the same private-file boundary as project trust. */
|
|
133
|
+
readUserConfig(workspace: string, configured: string): Promise<string | undefined>;
|
|
134
|
+
private readPolicyFile;
|
|
135
|
+
private readTrusted;
|
|
136
|
+
private hasUnverifiableProtectedPaths;
|
|
137
|
+
loadUserOwned(workspace: string, { strict }?: {
|
|
138
|
+
strict?: boolean;
|
|
139
|
+
}): Promise<ProjectsPolicyFile | null>;
|
|
140
|
+
verifyProjectModeWritable(workspace: string): Promise<void>;
|
|
141
|
+
/** Merge into a private user policy while other runtimes are excluded. */
|
|
142
|
+
writeProjectMode(workspace: string, mode: SandboxMode): Promise<void>;
|
|
143
|
+
writeProjectAllowTrust(workspace: string, trusted: boolean, verify: () => void): Promise<void>;
|
|
144
|
+
updateRememberedTool(workspace: string, tool: string, allow: boolean, verify?: () => void): Promise<boolean>;
|
|
145
|
+
private updateProject;
|
|
146
|
+
load(canonicalPath?: string): Promise<ProjectsPolicyFile | null>;
|
|
125
147
|
save(data: ProjectsPolicyFile): Promise<void>;
|
|
126
148
|
}
|
|
127
149
|
|
|
@@ -169,6 +191,11 @@ declare class RunEventStoreFactoryImpl implements RunEventStoreFactory {
|
|
|
169
191
|
declare const resolveRunLogPath: (file: string) => string;
|
|
170
192
|
declare function readRunLogLines(file: string): AsyncGenerator<string>;
|
|
171
193
|
|
|
194
|
+
declare function appendOriginalMessages(file: string, messages: BaseMessage[], provenance?: readonly (ConversationApprovalProvenance | undefined)[]): void;
|
|
195
|
+
declare function readOriginalApprovalContext(file: string, { userMessageId, proposalMessageId, workspace, cwd, workspaceIdentity, cwdIdentity, }: ConversationApprovalScope & {
|
|
196
|
+
userMessageId: string;
|
|
197
|
+
proposalMessageId?: string;
|
|
198
|
+
}, isAppliedSteer: (runId: string, steerId: string) => boolean): Promise<ConversationApprovalContext | null>;
|
|
172
199
|
declare function searchOriginalMessages(file: string, options: {
|
|
173
200
|
query: string;
|
|
174
201
|
cursor?: string;
|
|
@@ -197,6 +224,13 @@ type StoredSessionGoal = {
|
|
|
197
224
|
key: string;
|
|
198
225
|
runs: number;
|
|
199
226
|
};
|
|
227
|
+
/** Applied user Steers for this goal. Null means the evidence is incomplete. */
|
|
228
|
+
approvalSteers?: Array<string | Readonly<{
|
|
229
|
+
text: string;
|
|
230
|
+
attachmentsOmitted: true;
|
|
231
|
+
}>> | null;
|
|
232
|
+
/** Steers before this index predate the latest objective edit. */
|
|
233
|
+
approvalObjectiveAfterSteers?: number;
|
|
200
234
|
};
|
|
201
235
|
type Sqlite = {
|
|
202
236
|
exec(sql: string): void;
|
|
@@ -253,9 +287,11 @@ declare class SessionStateStoreImpl implements SessionStateStore, SessionRunReco
|
|
|
253
287
|
private loadLegacy;
|
|
254
288
|
private loadFromIndex;
|
|
255
289
|
private saveToIndex;
|
|
256
|
-
appendMessages(sessionId: string, messages: SessionState["messages"]): Promise<void>;
|
|
290
|
+
appendMessages(sessionId: string, messages: SessionState["messages"], origins?: Parameters<typeof appendOriginalMessages>[2]): Promise<void>;
|
|
257
291
|
searchMessages(sessionId: string, options: Parameters<typeof searchOriginalMessages>[1]): Promise<_codelia_core.ConversationSearchResult>;
|
|
258
292
|
readMessage(sessionId: string, options: Parameters<typeof readOriginalMessage>[1]): Promise<_codelia_core.ConversationMessage | null>;
|
|
293
|
+
readApprovalContext(sessionId: string, references: Parameters<typeof readOriginalApprovalContext>[1]): Promise<_codelia_core.ConversationApprovalContext | null>;
|
|
294
|
+
confirmApprovalSteer(sessionId: string, runId: string, steerId: string): Promise<void>;
|
|
259
295
|
load(sessionId: string): Promise<SessionState | null>;
|
|
260
296
|
save(state: SessionState): Promise<void>;
|
|
261
297
|
getSummary(sessionId: string): Promise<SessionStateSummary | null>;
|