@codelia/storage 0.1.79 → 0.1.81
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 +32 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +32 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -877,7 +877,14 @@ var isTaskTruncatedOutput = (value) => {
|
|
|
877
877
|
var isTaskResult = (value) => {
|
|
878
878
|
if (!value || typeof value !== "object") return false;
|
|
879
879
|
const result = value;
|
|
880
|
-
return (result.
|
|
880
|
+
return (result.termination_reason === void 0 || [
|
|
881
|
+
"normal",
|
|
882
|
+
"max_steps",
|
|
883
|
+
"timeout",
|
|
884
|
+
"cancelled",
|
|
885
|
+
"startup_error",
|
|
886
|
+
"execution_error"
|
|
887
|
+
].includes(result.termination_reason)) && (result.summary_cache_id === void 0 || isString(result.summary_cache_id)) && (result.usage === void 0 || isNumber(result.usage.total_tokens) && result.usage.total_tokens >= 0 && (result.usage.total_cost_usd == null || isNumber(result.usage.total_cost_usd))) && (result.summary === void 0 || isString(result.summary)) && (result.stdout === void 0 || isString(result.stdout)) && (result.stderr === void 0 || isString(result.stderr)) && (result.stdout_cache_id === void 0 || isString(result.stdout_cache_id)) && (result.stderr_cache_id === void 0 || isString(result.stderr_cache_id)) && (result.child_session_id === void 0 || isString(result.child_session_id)) && (result.worktree_path === void 0 || isString(result.worktree_path)) && (result.exit_code === void 0 || result.exit_code === null || isNumber(result.exit_code)) && (result.signal === void 0 || result.signal === null || isString(result.signal)) && (result.duration_ms === void 0 || isNumber(result.duration_ms)) && (result.truncated === void 0 || isTaskTruncatedOutput(result.truncated)) && (result.artifacts === void 0 || Array.isArray(result.artifacts) && result.artifacts.every(isTaskArtifact));
|
|
881
888
|
};
|
|
882
889
|
var normalizeTaskRecord = (value) => {
|
|
883
890
|
if (!value || typeof value !== "object") return null;
|
|
@@ -885,6 +892,30 @@ var normalizeTaskRecord = (value) => {
|
|
|
885
892
|
if (record.version !== 1 || !isString(record.task_id) || !isTaskKind(record.kind) || !isWorkspaceMode(record.workspace_mode) || !isTaskState(record.state) || !isString(record.owner_runtime_id) || !isNumber(record.owner_pid) || !isString(record.created_at) || !isString(record.updated_at)) {
|
|
886
893
|
return null;
|
|
887
894
|
}
|
|
895
|
+
if (record.messages !== void 0 && (!Array.isArray(record.messages) || record.messages.length > 256 || !record.messages.every(
|
|
896
|
+
(message) => message && [
|
|
897
|
+
message.message_id,
|
|
898
|
+
message.sender,
|
|
899
|
+
message.recipient,
|
|
900
|
+
message.created_at,
|
|
901
|
+
message.content
|
|
902
|
+
].every(isString) && (message.sender_name === void 0 || isString(message.sender_name)) && (message.recipient_name === void 0 || isString(message.recipient_name))
|
|
903
|
+
)))
|
|
904
|
+
return null;
|
|
905
|
+
if (record.subagent !== void 0) {
|
|
906
|
+
const node = record.subagent;
|
|
907
|
+
if (record.kind !== "subagent" || node.name !== void 0 && (!isString(node.name) || !node.name.trim() || node.name.length > 48) || node.depth !== 1 || node.context_mode !== "fresh" || !Number.isInteger(node.spawn_index) || node.spawn_index < 1 || ![
|
|
908
|
+
node.tree_id,
|
|
909
|
+
node.node_id,
|
|
910
|
+
node.parent_node_id,
|
|
911
|
+
node.owner_session_id,
|
|
912
|
+
node.effective_policy_id,
|
|
913
|
+
node.workspace_lease_id
|
|
914
|
+
].every(isString) || node.node_id !== record.task_id)
|
|
915
|
+
return null;
|
|
916
|
+
}
|
|
917
|
+
if (record.executor_identity !== void 0 && !isString(record.executor_identity))
|
|
918
|
+
return null;
|
|
888
919
|
if (record.key !== void 0 && !isString(record.key)) {
|
|
889
920
|
return null;
|
|
890
921
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StoragePaths, ResolveStorageOptions, RunEventStoreFactory, RunEventStoreInit, SessionStore, StoragePathService, SessionStateStore, SessionState, SessionStateSummary, SessionRecord, ToolOutputCacheStore, ToolOutputCacheRecord, ToolOutputRef, ToolOutputCacheReadOptions, ToolOutputCacheSearchOptions } from '@codelia/core';
|
|
2
2
|
export { ResolveStorageOptions, StorageLayout, StoragePathService, StoragePaths } from '@codelia/core';
|
|
3
|
-
import { ApprovalMode } from '@codelia/shared-types';
|
|
3
|
+
import { ApprovalMode, SubagentLineage, AgentMessage, TaskTerminationReason, TaskUsage } from '@codelia/shared-types';
|
|
4
4
|
|
|
5
5
|
type McpOAuthTokens = {
|
|
6
6
|
access_token: string;
|
|
@@ -110,6 +110,9 @@ type TaskTruncatedOutput = {
|
|
|
110
110
|
combined: boolean;
|
|
111
111
|
};
|
|
112
112
|
type TaskResult = {
|
|
113
|
+
termination_reason?: TaskTerminationReason;
|
|
114
|
+
usage?: TaskUsage;
|
|
115
|
+
summary_cache_id?: string;
|
|
113
116
|
summary?: string;
|
|
114
117
|
stdout?: string;
|
|
115
118
|
stderr?: string;
|
|
@@ -125,6 +128,9 @@ type TaskResult = {
|
|
|
125
128
|
};
|
|
126
129
|
type TaskRecord = {
|
|
127
130
|
version: 1;
|
|
131
|
+
subagent?: SubagentLineage;
|
|
132
|
+
messages?: AgentMessage[];
|
|
133
|
+
executor_identity?: string;
|
|
128
134
|
task_id: string;
|
|
129
135
|
kind: TaskKind;
|
|
130
136
|
workspace_mode: TaskWorkspaceMode;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StoragePaths, ResolveStorageOptions, RunEventStoreFactory, RunEventStoreInit, SessionStore, StoragePathService, SessionStateStore, SessionState, SessionStateSummary, SessionRecord, ToolOutputCacheStore, ToolOutputCacheRecord, ToolOutputRef, ToolOutputCacheReadOptions, ToolOutputCacheSearchOptions } from '@codelia/core';
|
|
2
2
|
export { ResolveStorageOptions, StorageLayout, StoragePathService, StoragePaths } from '@codelia/core';
|
|
3
|
-
import { ApprovalMode } from '@codelia/shared-types';
|
|
3
|
+
import { ApprovalMode, SubagentLineage, AgentMessage, TaskTerminationReason, TaskUsage } from '@codelia/shared-types';
|
|
4
4
|
|
|
5
5
|
type McpOAuthTokens = {
|
|
6
6
|
access_token: string;
|
|
@@ -110,6 +110,9 @@ type TaskTruncatedOutput = {
|
|
|
110
110
|
combined: boolean;
|
|
111
111
|
};
|
|
112
112
|
type TaskResult = {
|
|
113
|
+
termination_reason?: TaskTerminationReason;
|
|
114
|
+
usage?: TaskUsage;
|
|
115
|
+
summary_cache_id?: string;
|
|
113
116
|
summary?: string;
|
|
114
117
|
stdout?: string;
|
|
115
118
|
stderr?: string;
|
|
@@ -125,6 +128,9 @@ type TaskResult = {
|
|
|
125
128
|
};
|
|
126
129
|
type TaskRecord = {
|
|
127
130
|
version: 1;
|
|
131
|
+
subagent?: SubagentLineage;
|
|
132
|
+
messages?: AgentMessage[];
|
|
133
|
+
executor_identity?: string;
|
|
128
134
|
task_id: string;
|
|
129
135
|
kind: TaskKind;
|
|
130
136
|
workspace_mode: TaskWorkspaceMode;
|
package/dist/index.js
CHANGED
|
@@ -832,7 +832,14 @@ var isTaskTruncatedOutput = (value) => {
|
|
|
832
832
|
var isTaskResult = (value) => {
|
|
833
833
|
if (!value || typeof value !== "object") return false;
|
|
834
834
|
const result = value;
|
|
835
|
-
return (result.
|
|
835
|
+
return (result.termination_reason === void 0 || [
|
|
836
|
+
"normal",
|
|
837
|
+
"max_steps",
|
|
838
|
+
"timeout",
|
|
839
|
+
"cancelled",
|
|
840
|
+
"startup_error",
|
|
841
|
+
"execution_error"
|
|
842
|
+
].includes(result.termination_reason)) && (result.summary_cache_id === void 0 || isString(result.summary_cache_id)) && (result.usage === void 0 || isNumber(result.usage.total_tokens) && result.usage.total_tokens >= 0 && (result.usage.total_cost_usd == null || isNumber(result.usage.total_cost_usd))) && (result.summary === void 0 || isString(result.summary)) && (result.stdout === void 0 || isString(result.stdout)) && (result.stderr === void 0 || isString(result.stderr)) && (result.stdout_cache_id === void 0 || isString(result.stdout_cache_id)) && (result.stderr_cache_id === void 0 || isString(result.stderr_cache_id)) && (result.child_session_id === void 0 || isString(result.child_session_id)) && (result.worktree_path === void 0 || isString(result.worktree_path)) && (result.exit_code === void 0 || result.exit_code === null || isNumber(result.exit_code)) && (result.signal === void 0 || result.signal === null || isString(result.signal)) && (result.duration_ms === void 0 || isNumber(result.duration_ms)) && (result.truncated === void 0 || isTaskTruncatedOutput(result.truncated)) && (result.artifacts === void 0 || Array.isArray(result.artifacts) && result.artifacts.every(isTaskArtifact));
|
|
836
843
|
};
|
|
837
844
|
var normalizeTaskRecord = (value) => {
|
|
838
845
|
if (!value || typeof value !== "object") return null;
|
|
@@ -840,6 +847,30 @@ var normalizeTaskRecord = (value) => {
|
|
|
840
847
|
if (record.version !== 1 || !isString(record.task_id) || !isTaskKind(record.kind) || !isWorkspaceMode(record.workspace_mode) || !isTaskState(record.state) || !isString(record.owner_runtime_id) || !isNumber(record.owner_pid) || !isString(record.created_at) || !isString(record.updated_at)) {
|
|
841
848
|
return null;
|
|
842
849
|
}
|
|
850
|
+
if (record.messages !== void 0 && (!Array.isArray(record.messages) || record.messages.length > 256 || !record.messages.every(
|
|
851
|
+
(message) => message && [
|
|
852
|
+
message.message_id,
|
|
853
|
+
message.sender,
|
|
854
|
+
message.recipient,
|
|
855
|
+
message.created_at,
|
|
856
|
+
message.content
|
|
857
|
+
].every(isString) && (message.sender_name === void 0 || isString(message.sender_name)) && (message.recipient_name === void 0 || isString(message.recipient_name))
|
|
858
|
+
)))
|
|
859
|
+
return null;
|
|
860
|
+
if (record.subagent !== void 0) {
|
|
861
|
+
const node = record.subagent;
|
|
862
|
+
if (record.kind !== "subagent" || node.name !== void 0 && (!isString(node.name) || !node.name.trim() || node.name.length > 48) || node.depth !== 1 || node.context_mode !== "fresh" || !Number.isInteger(node.spawn_index) || node.spawn_index < 1 || ![
|
|
863
|
+
node.tree_id,
|
|
864
|
+
node.node_id,
|
|
865
|
+
node.parent_node_id,
|
|
866
|
+
node.owner_session_id,
|
|
867
|
+
node.effective_policy_id,
|
|
868
|
+
node.workspace_lease_id
|
|
869
|
+
].every(isString) || node.node_id !== record.task_id)
|
|
870
|
+
return null;
|
|
871
|
+
}
|
|
872
|
+
if (record.executor_identity !== void 0 && !isString(record.executor_identity))
|
|
873
|
+
return null;
|
|
843
874
|
if (record.key !== void 0 && !isString(record.key)) {
|
|
844
875
|
return null;
|
|
845
876
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codelia/storage",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.81",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"typecheck": "tsc --noEmit"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@codelia/core": "0.1.
|
|
28
|
-
"@codelia/shared-types": "0.1.
|
|
27
|
+
"@codelia/core": "0.1.81",
|
|
28
|
+
"@codelia/shared-types": "0.1.81",
|
|
29
29
|
"better-sqlite3": "^12.6.2"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|