@codelia/shared-types 0.1.80 → 0.1.82
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 +12 -0
- package/dist/index.d.cts +100 -3
- package/dist/index.d.ts +100 -3
- package/dist/index.js +10 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
IMAGE_REFERENCE_MAX_COUNT: () => IMAGE_REFERENCE_MAX_COUNT,
|
|
23
24
|
MODEL_REASONING_LEVELS: () => MODEL_REASONING_LEVELS,
|
|
24
25
|
SkillCatalogSchema: () => SkillCatalogSchema,
|
|
25
26
|
SkillLoadErrorSchema: () => SkillLoadErrorSchema,
|
|
@@ -27,11 +28,20 @@ __export(index_exports, {
|
|
|
27
28
|
SkillScopeSchema: () => SkillScopeSchema,
|
|
28
29
|
SkillSearchReasonSchema: () => SkillSearchReasonSchema,
|
|
29
30
|
SkillSearchResultSchema: () => SkillSearchResultSchema,
|
|
31
|
+
isImageModelView: () => isImageModelView,
|
|
30
32
|
isModelReasoningLevel: () => isModelReasoningLevel,
|
|
31
33
|
parseApprovalMode: () => parseApprovalMode
|
|
32
34
|
});
|
|
33
35
|
module.exports = __toCommonJS(index_exports);
|
|
34
36
|
|
|
37
|
+
// src/image-artifact.ts
|
|
38
|
+
var IMAGE_REFERENCE_MAX_COUNT = 16;
|
|
39
|
+
function isImageModelView(value) {
|
|
40
|
+
if (!value || typeof value !== "object") return false;
|
|
41
|
+
const view = value;
|
|
42
|
+
return view.version === "jpeg-q90-444-v1" && view.media_type === "image/jpeg" && typeof view.sha256 === "string" && /^[0-9a-f]{64}$/.test(view.sha256) && typeof view.byte_size === "number" && Number.isSafeInteger(view.byte_size) && view.byte_size > 0 && view.byte_size <= 8 * 1024 * 1024;
|
|
43
|
+
}
|
|
44
|
+
|
|
35
45
|
// src/approval.ts
|
|
36
46
|
var parseApprovalMode = (value) => {
|
|
37
47
|
if (value === "minimal" || value === "trusted" || value === "full-access") {
|
|
@@ -84,6 +94,7 @@ var SkillSearchResultSchema = import_zod.z.object({
|
|
|
84
94
|
}).strict();
|
|
85
95
|
// Annotate the CommonJS export names for ESM import in node:
|
|
86
96
|
0 && (module.exports = {
|
|
97
|
+
IMAGE_REFERENCE_MAX_COUNT,
|
|
87
98
|
MODEL_REASONING_LEVELS,
|
|
88
99
|
SkillCatalogSchema,
|
|
89
100
|
SkillLoadErrorSchema,
|
|
@@ -91,6 +102,7 @@ var SkillSearchResultSchema = import_zod.z.object({
|
|
|
91
102
|
SkillScopeSchema,
|
|
92
103
|
SkillSearchReasonSchema,
|
|
93
104
|
SkillSearchResultSchema,
|
|
105
|
+
isImageModelView,
|
|
94
106
|
isModelReasoningLevel,
|
|
95
107
|
parseApprovalMode
|
|
96
108
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,53 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
+
/** Persistence/schema safety ceiling, not a provider capability promise. */
|
|
4
|
+
declare const IMAGE_REFERENCE_MAX_COUNT = 16;
|
|
5
|
+
type ImageMediaType = "image/png" | "image/jpeg" | "image/webp" | "image/gif";
|
|
6
|
+
/** Fixed model input representation; absent means the immutable original. */
|
|
7
|
+
type ImageModelView = {
|
|
8
|
+
version: "jpeg-q90-444-v1";
|
|
9
|
+
media_type: "image/jpeg";
|
|
10
|
+
sha256: string;
|
|
11
|
+
byte_size: number;
|
|
12
|
+
};
|
|
13
|
+
declare function isImageModelView(value: unknown): value is ImageModelView;
|
|
14
|
+
/** Durable image identity. Bytes are resolved only at the request/preview boundary. */
|
|
15
|
+
type ImageArtifactRef = {
|
|
16
|
+
artifact_id: string;
|
|
17
|
+
sha256: string;
|
|
18
|
+
media_type: ImageMediaType;
|
|
19
|
+
byte_size: number;
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
model_view?: ImageModelView;
|
|
23
|
+
};
|
|
24
|
+
type GeneratedImageMetadata = ImageArtifactRef & {
|
|
25
|
+
kind?: "generated";
|
|
26
|
+
media_type: "image/png";
|
|
27
|
+
created_at: string;
|
|
28
|
+
provider: string;
|
|
29
|
+
requested_model: string;
|
|
30
|
+
effective_model?: string;
|
|
31
|
+
endpoint: string;
|
|
32
|
+
parent_artifact_ids: string[];
|
|
33
|
+
usage?: {
|
|
34
|
+
input_tokens?: number;
|
|
35
|
+
output_tokens?: number;
|
|
36
|
+
cost_usd?: number;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
type AttachedImageMetadata = ImageArtifactRef & {
|
|
40
|
+
kind: "attachment";
|
|
41
|
+
created_at: string;
|
|
42
|
+
};
|
|
43
|
+
type ImageArtifactMetadata = GeneratedImageMetadata | AttachedImageMetadata;
|
|
44
|
+
|
|
3
45
|
type ApprovalMode = "minimal" | "trusted" | "full-access";
|
|
4
46
|
declare const parseApprovalMode: (value: unknown) => ApprovalMode | undefined;
|
|
5
47
|
|
|
6
|
-
type
|
|
48
|
+
type BuiltinProviderName = "openai" | "anthropic" | "openrouter" | "google" | "moonshot" | "zai" | "xai";
|
|
49
|
+
/** Runtime endpoint names are configured independently of builtin adapters. */
|
|
50
|
+
type ProviderName = string;
|
|
7
51
|
|
|
8
52
|
type TextEvent = {
|
|
9
53
|
type: "text";
|
|
@@ -25,6 +69,19 @@ type LlmRetryEvent = {
|
|
|
25
69
|
delay_source: "retry-after" | "reset-header" | "provider-body" | "backoff";
|
|
26
70
|
status?: number;
|
|
27
71
|
};
|
|
72
|
+
/** Informational provider status; never assistant history or model selection. */
|
|
73
|
+
type LlmStatusEvent = {
|
|
74
|
+
type: "llm.status";
|
|
75
|
+
provider: "openai";
|
|
76
|
+
kind: "verification";
|
|
77
|
+
verification: "trusted_access_for_cyber";
|
|
78
|
+
} | {
|
|
79
|
+
type: "llm.status";
|
|
80
|
+
provider: "openai";
|
|
81
|
+
kind: "buffering";
|
|
82
|
+
active: boolean;
|
|
83
|
+
faster_model?: string;
|
|
84
|
+
};
|
|
28
85
|
type StepStartEvent = {
|
|
29
86
|
type: "step_start";
|
|
30
87
|
step_id: string;
|
|
@@ -84,8 +141,18 @@ type HiddenUserMessageEvent = {
|
|
|
84
141
|
type FinalResponseEvent = {
|
|
85
142
|
type: "final";
|
|
86
143
|
content: string;
|
|
144
|
+
termination_reason?: "normal" | "max_steps" | "permission_denied";
|
|
145
|
+
};
|
|
146
|
+
type AgentEvent = TextEvent | ReasoningEvent | LlmRetryEvent | LlmStatusEvent | StepStartEvent | ToolCallEvent | ToolResultEvent | PermissionPreviewEvent | PermissionReadyEvent | StepCompleteEvent | CompactionStartEvent | CompactionCompleteEvent | HiddenUserMessageEvent | FinalResponseEvent;
|
|
147
|
+
|
|
148
|
+
/** Observed successful stream timing, measured with a monotonic clock. */
|
|
149
|
+
type LlmCallTiming = {
|
|
150
|
+
time_to_first_token_ms: number;
|
|
151
|
+
generation_duration_ms: number;
|
|
152
|
+
/** Optional observed start of hidden reasoning, distinct from first delta. */
|
|
153
|
+
generation_start_ms?: number;
|
|
154
|
+
generation_start_source?: "reasoning_item";
|
|
87
155
|
};
|
|
88
|
-
type AgentEvent = TextEvent | ReasoningEvent | LlmRetryEvent | StepStartEvent | ToolCallEvent | ToolResultEvent | PermissionPreviewEvent | PermissionReadyEvent | StepCompleteEvent | CompactionStartEvent | CompactionCompleteEvent | HiddenUserMessageEvent | FinalResponseEvent;
|
|
89
156
|
|
|
90
157
|
declare const MODEL_REASONING_LEVELS: readonly ["low", "medium", "high", "xhigh", "max"];
|
|
91
158
|
type ModelReasoningLevel = (typeof MODEL_REASONING_LEVELS)[number];
|
|
@@ -174,4 +241,34 @@ type SkillCatalog = z.infer<typeof SkillCatalogSchema>;
|
|
|
174
241
|
type SkillSearchReason = z.infer<typeof SkillSearchReasonSchema>;
|
|
175
242
|
type SkillSearchResult = z.infer<typeof SkillSearchResultSchema>;
|
|
176
243
|
|
|
177
|
-
|
|
244
|
+
/** Stable delegated-task metadata shared by runtime, storage, and protocol. */
|
|
245
|
+
type TaskTerminationReason = "normal" | "max_steps" | "timeout" | "cancelled" | "startup_error" | "execution_error";
|
|
246
|
+
type SubagentLineage = {
|
|
247
|
+
/** Immutable agent display name; absent on older records. */
|
|
248
|
+
name?: string;
|
|
249
|
+
tree_id: string;
|
|
250
|
+
node_id: string;
|
|
251
|
+
parent_node_id: string;
|
|
252
|
+
owner_session_id: string;
|
|
253
|
+
depth: 1;
|
|
254
|
+
spawn_index: number;
|
|
255
|
+
context_mode: "fresh";
|
|
256
|
+
effective_policy_id: string;
|
|
257
|
+
workspace_lease_id: string;
|
|
258
|
+
};
|
|
259
|
+
type TaskUsage = {
|
|
260
|
+
total_tokens: number;
|
|
261
|
+
total_cost_usd?: number | null;
|
|
262
|
+
};
|
|
263
|
+
/** Stored peer content is untrusted; accepted does not mean acted on by a model. */
|
|
264
|
+
type AgentMessage = {
|
|
265
|
+
message_id: string;
|
|
266
|
+
sender: string;
|
|
267
|
+
sender_name?: string;
|
|
268
|
+
recipient: string;
|
|
269
|
+
recipient_name?: string;
|
|
270
|
+
created_at: string;
|
|
271
|
+
content: string;
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
export { type AgentEvent, type AgentMessage, type ApprovalMode, type AttachedImageMetadata, type BuiltinProviderName, type CompactionCompleteEvent, type CompactionStartEvent, type FinalResponseEvent, type GeneratedImageMetadata, type HiddenUserMessageEvent, IMAGE_REFERENCE_MAX_COUNT, type ImageArtifactMetadata, type ImageArtifactRef, type ImageMediaType, type ImageModelView, type LlmCallTiming, type LlmRetryEvent, type LlmStatusEvent, MODEL_REASONING_LEVELS, type ModelReasoningLevel, type PermissionPreviewEvent, type PermissionReadyEvent, type ProviderName, type ReasoningEvent, type SessionStateSummary, type SkillCatalog, SkillCatalogSchema, type SkillLoadError, SkillLoadErrorSchema, type SkillMetadata, SkillMetadataSchema, type SkillScope, SkillScopeSchema, type SkillSearchReason, SkillSearchReasonSchema, type SkillSearchResult, SkillSearchResultSchema, type StepCompleteEvent, type StepStartEvent, type SubagentLineage, type TaskTerminationReason, type TaskUsage, type TextEvent, type ToolCallEvent, type ToolResultEvent, isImageModelView, isModelReasoningLevel, parseApprovalMode };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,53 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
+
/** Persistence/schema safety ceiling, not a provider capability promise. */
|
|
4
|
+
declare const IMAGE_REFERENCE_MAX_COUNT = 16;
|
|
5
|
+
type ImageMediaType = "image/png" | "image/jpeg" | "image/webp" | "image/gif";
|
|
6
|
+
/** Fixed model input representation; absent means the immutable original. */
|
|
7
|
+
type ImageModelView = {
|
|
8
|
+
version: "jpeg-q90-444-v1";
|
|
9
|
+
media_type: "image/jpeg";
|
|
10
|
+
sha256: string;
|
|
11
|
+
byte_size: number;
|
|
12
|
+
};
|
|
13
|
+
declare function isImageModelView(value: unknown): value is ImageModelView;
|
|
14
|
+
/** Durable image identity. Bytes are resolved only at the request/preview boundary. */
|
|
15
|
+
type ImageArtifactRef = {
|
|
16
|
+
artifact_id: string;
|
|
17
|
+
sha256: string;
|
|
18
|
+
media_type: ImageMediaType;
|
|
19
|
+
byte_size: number;
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
model_view?: ImageModelView;
|
|
23
|
+
};
|
|
24
|
+
type GeneratedImageMetadata = ImageArtifactRef & {
|
|
25
|
+
kind?: "generated";
|
|
26
|
+
media_type: "image/png";
|
|
27
|
+
created_at: string;
|
|
28
|
+
provider: string;
|
|
29
|
+
requested_model: string;
|
|
30
|
+
effective_model?: string;
|
|
31
|
+
endpoint: string;
|
|
32
|
+
parent_artifact_ids: string[];
|
|
33
|
+
usage?: {
|
|
34
|
+
input_tokens?: number;
|
|
35
|
+
output_tokens?: number;
|
|
36
|
+
cost_usd?: number;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
type AttachedImageMetadata = ImageArtifactRef & {
|
|
40
|
+
kind: "attachment";
|
|
41
|
+
created_at: string;
|
|
42
|
+
};
|
|
43
|
+
type ImageArtifactMetadata = GeneratedImageMetadata | AttachedImageMetadata;
|
|
44
|
+
|
|
3
45
|
type ApprovalMode = "minimal" | "trusted" | "full-access";
|
|
4
46
|
declare const parseApprovalMode: (value: unknown) => ApprovalMode | undefined;
|
|
5
47
|
|
|
6
|
-
type
|
|
48
|
+
type BuiltinProviderName = "openai" | "anthropic" | "openrouter" | "google" | "moonshot" | "zai" | "xai";
|
|
49
|
+
/** Runtime endpoint names are configured independently of builtin adapters. */
|
|
50
|
+
type ProviderName = string;
|
|
7
51
|
|
|
8
52
|
type TextEvent = {
|
|
9
53
|
type: "text";
|
|
@@ -25,6 +69,19 @@ type LlmRetryEvent = {
|
|
|
25
69
|
delay_source: "retry-after" | "reset-header" | "provider-body" | "backoff";
|
|
26
70
|
status?: number;
|
|
27
71
|
};
|
|
72
|
+
/** Informational provider status; never assistant history or model selection. */
|
|
73
|
+
type LlmStatusEvent = {
|
|
74
|
+
type: "llm.status";
|
|
75
|
+
provider: "openai";
|
|
76
|
+
kind: "verification";
|
|
77
|
+
verification: "trusted_access_for_cyber";
|
|
78
|
+
} | {
|
|
79
|
+
type: "llm.status";
|
|
80
|
+
provider: "openai";
|
|
81
|
+
kind: "buffering";
|
|
82
|
+
active: boolean;
|
|
83
|
+
faster_model?: string;
|
|
84
|
+
};
|
|
28
85
|
type StepStartEvent = {
|
|
29
86
|
type: "step_start";
|
|
30
87
|
step_id: string;
|
|
@@ -84,8 +141,18 @@ type HiddenUserMessageEvent = {
|
|
|
84
141
|
type FinalResponseEvent = {
|
|
85
142
|
type: "final";
|
|
86
143
|
content: string;
|
|
144
|
+
termination_reason?: "normal" | "max_steps" | "permission_denied";
|
|
145
|
+
};
|
|
146
|
+
type AgentEvent = TextEvent | ReasoningEvent | LlmRetryEvent | LlmStatusEvent | StepStartEvent | ToolCallEvent | ToolResultEvent | PermissionPreviewEvent | PermissionReadyEvent | StepCompleteEvent | CompactionStartEvent | CompactionCompleteEvent | HiddenUserMessageEvent | FinalResponseEvent;
|
|
147
|
+
|
|
148
|
+
/** Observed successful stream timing, measured with a monotonic clock. */
|
|
149
|
+
type LlmCallTiming = {
|
|
150
|
+
time_to_first_token_ms: number;
|
|
151
|
+
generation_duration_ms: number;
|
|
152
|
+
/** Optional observed start of hidden reasoning, distinct from first delta. */
|
|
153
|
+
generation_start_ms?: number;
|
|
154
|
+
generation_start_source?: "reasoning_item";
|
|
87
155
|
};
|
|
88
|
-
type AgentEvent = TextEvent | ReasoningEvent | LlmRetryEvent | StepStartEvent | ToolCallEvent | ToolResultEvent | PermissionPreviewEvent | PermissionReadyEvent | StepCompleteEvent | CompactionStartEvent | CompactionCompleteEvent | HiddenUserMessageEvent | FinalResponseEvent;
|
|
89
156
|
|
|
90
157
|
declare const MODEL_REASONING_LEVELS: readonly ["low", "medium", "high", "xhigh", "max"];
|
|
91
158
|
type ModelReasoningLevel = (typeof MODEL_REASONING_LEVELS)[number];
|
|
@@ -174,4 +241,34 @@ type SkillCatalog = z.infer<typeof SkillCatalogSchema>;
|
|
|
174
241
|
type SkillSearchReason = z.infer<typeof SkillSearchReasonSchema>;
|
|
175
242
|
type SkillSearchResult = z.infer<typeof SkillSearchResultSchema>;
|
|
176
243
|
|
|
177
|
-
|
|
244
|
+
/** Stable delegated-task metadata shared by runtime, storage, and protocol. */
|
|
245
|
+
type TaskTerminationReason = "normal" | "max_steps" | "timeout" | "cancelled" | "startup_error" | "execution_error";
|
|
246
|
+
type SubagentLineage = {
|
|
247
|
+
/** Immutable agent display name; absent on older records. */
|
|
248
|
+
name?: string;
|
|
249
|
+
tree_id: string;
|
|
250
|
+
node_id: string;
|
|
251
|
+
parent_node_id: string;
|
|
252
|
+
owner_session_id: string;
|
|
253
|
+
depth: 1;
|
|
254
|
+
spawn_index: number;
|
|
255
|
+
context_mode: "fresh";
|
|
256
|
+
effective_policy_id: string;
|
|
257
|
+
workspace_lease_id: string;
|
|
258
|
+
};
|
|
259
|
+
type TaskUsage = {
|
|
260
|
+
total_tokens: number;
|
|
261
|
+
total_cost_usd?: number | null;
|
|
262
|
+
};
|
|
263
|
+
/** Stored peer content is untrusted; accepted does not mean acted on by a model. */
|
|
264
|
+
type AgentMessage = {
|
|
265
|
+
message_id: string;
|
|
266
|
+
sender: string;
|
|
267
|
+
sender_name?: string;
|
|
268
|
+
recipient: string;
|
|
269
|
+
recipient_name?: string;
|
|
270
|
+
created_at: string;
|
|
271
|
+
content: string;
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
export { type AgentEvent, type AgentMessage, type ApprovalMode, type AttachedImageMetadata, type BuiltinProviderName, type CompactionCompleteEvent, type CompactionStartEvent, type FinalResponseEvent, type GeneratedImageMetadata, type HiddenUserMessageEvent, IMAGE_REFERENCE_MAX_COUNT, type ImageArtifactMetadata, type ImageArtifactRef, type ImageMediaType, type ImageModelView, type LlmCallTiming, type LlmRetryEvent, type LlmStatusEvent, MODEL_REASONING_LEVELS, type ModelReasoningLevel, type PermissionPreviewEvent, type PermissionReadyEvent, type ProviderName, type ReasoningEvent, type SessionStateSummary, type SkillCatalog, SkillCatalogSchema, type SkillLoadError, SkillLoadErrorSchema, type SkillMetadata, SkillMetadataSchema, type SkillScope, SkillScopeSchema, type SkillSearchReason, SkillSearchReasonSchema, type SkillSearchResult, SkillSearchResultSchema, type StepCompleteEvent, type StepStartEvent, type SubagentLineage, type TaskTerminationReason, type TaskUsage, type TextEvent, type ToolCallEvent, type ToolResultEvent, isImageModelView, isModelReasoningLevel, parseApprovalMode };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
// src/image-artifact.ts
|
|
2
|
+
var IMAGE_REFERENCE_MAX_COUNT = 16;
|
|
3
|
+
function isImageModelView(value) {
|
|
4
|
+
if (!value || typeof value !== "object") return false;
|
|
5
|
+
const view = value;
|
|
6
|
+
return view.version === "jpeg-q90-444-v1" && view.media_type === "image/jpeg" && typeof view.sha256 === "string" && /^[0-9a-f]{64}$/.test(view.sha256) && typeof view.byte_size === "number" && Number.isSafeInteger(view.byte_size) && view.byte_size > 0 && view.byte_size <= 8 * 1024 * 1024;
|
|
7
|
+
}
|
|
8
|
+
|
|
1
9
|
// src/approval.ts
|
|
2
10
|
var parseApprovalMode = (value) => {
|
|
3
11
|
if (value === "minimal" || value === "trusted" || value === "full-access") {
|
|
@@ -49,6 +57,7 @@ var SkillSearchResultSchema = z.object({
|
|
|
49
57
|
reason: SkillSearchReasonSchema
|
|
50
58
|
}).strict();
|
|
51
59
|
export {
|
|
60
|
+
IMAGE_REFERENCE_MAX_COUNT,
|
|
52
61
|
MODEL_REASONING_LEVELS,
|
|
53
62
|
SkillCatalogSchema,
|
|
54
63
|
SkillLoadErrorSchema,
|
|
@@ -56,6 +65,7 @@ export {
|
|
|
56
65
|
SkillScopeSchema,
|
|
57
66
|
SkillSearchReasonSchema,
|
|
58
67
|
SkillSearchResultSchema,
|
|
68
|
+
isImageModelView,
|
|
59
69
|
isModelReasoningLevel,
|
|
60
70
|
parseApprovalMode
|
|
61
71
|
};
|