@codelia/shared-types 0.1.82 → 0.1.84

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 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
+ ATTACHMENT_ID_PATTERN: () => ATTACHMENT_ID_PATTERN,
23
24
  IMAGE_REFERENCE_MAX_COUNT: () => IMAGE_REFERENCE_MAX_COUNT,
24
25
  MODEL_REASONING_LEVELS: () => MODEL_REASONING_LEVELS,
25
26
  SkillCatalogSchema: () => SkillCatalogSchema,
@@ -29,19 +30,12 @@ __export(index_exports, {
29
30
  SkillSearchReasonSchema: () => SkillSearchReasonSchema,
30
31
  SkillSearchResultSchema: () => SkillSearchResultSchema,
31
32
  isImageModelView: () => isImageModelView,
33
+ isModelFastMode: () => isModelFastMode,
32
34
  isModelReasoningLevel: () => isModelReasoningLevel,
33
35
  parseApprovalMode: () => parseApprovalMode
34
36
  });
35
37
  module.exports = __toCommonJS(index_exports);
36
38
 
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
-
45
39
  // src/approval.ts
46
40
  var parseApprovalMode = (value) => {
47
41
  if (value === "minimal" || value === "trusted" || value === "full-access") {
@@ -50,7 +44,19 @@ var parseApprovalMode = (value) => {
50
44
  return void 0;
51
45
  };
52
46
 
47
+ // src/attachment.ts
48
+ var ATTACHMENT_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/;
49
+
50
+ // src/image-artifact.ts
51
+ var IMAGE_REFERENCE_MAX_COUNT = 16;
52
+ function isImageModelView(value) {
53
+ if (!value || typeof value !== "object") return false;
54
+ const view = value;
55
+ 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 <= 32 * 1024 * 1024;
56
+ }
57
+
53
58
  // src/model.ts
59
+ var isModelFastMode = (value) => typeof value === "boolean" || value === "ultrafast";
54
60
  var MODEL_REASONING_LEVELS = [
55
61
  "low",
56
62
  "medium",
@@ -94,6 +100,7 @@ var SkillSearchResultSchema = import_zod.z.object({
94
100
  }).strict();
95
101
  // Annotate the CommonJS export names for ESM import in node:
96
102
  0 && (module.exports = {
103
+ ATTACHMENT_ID_PATTERN,
97
104
  IMAGE_REFERENCE_MAX_COUNT,
98
105
  MODEL_REASONING_LEVELS,
99
106
  SkillCatalogSchema,
@@ -103,6 +110,7 @@ var SkillSearchResultSchema = import_zod.z.object({
103
110
  SkillSearchReasonSchema,
104
111
  SkillSearchResultSchema,
105
112
  isImageModelView,
113
+ isModelFastMode,
106
114
  isModelReasoningLevel,
107
115
  parseApprovalMode
108
116
  });
package/dist/index.d.cts CHANGED
@@ -1,5 +1,21 @@
1
1
  import { z } from 'zod';
2
2
 
3
+ type ApprovalMode = "minimal" | "trusted" | "full-access";
4
+ declare const parseApprovalMode: (value: unknown) => ApprovalMode | undefined;
5
+
6
+ declare const ATTACHMENT_ID_PATTERN: RegExp;
7
+ /** Immutable runtime-owned attachment metadata. No source path is retained. */
8
+ type AttachmentRef = {
9
+ attachment_id: string;
10
+ sha256: string;
11
+ byte_size: number;
12
+ media_type: string;
13
+ display_name: string;
14
+ width?: number;
15
+ height?: number;
16
+ origin?: "file" | "clipboard_image";
17
+ };
18
+
3
19
  /** Persistence/schema safety ceiling, not a provider capability promise. */
4
20
  declare const IMAGE_REFERENCE_MAX_COUNT = 16;
5
21
  type ImageMediaType = "image/png" | "image/jpeg" | "image/webp" | "image/gif";
@@ -23,7 +39,7 @@ type ImageArtifactRef = {
23
39
  };
24
40
  type GeneratedImageMetadata = ImageArtifactRef & {
25
41
  kind?: "generated";
26
- media_type: "image/png";
42
+ media_type: "image/png" | "image/jpeg";
27
43
  created_at: string;
28
44
  provider: string;
29
45
  requested_model: string;
@@ -42,10 +58,77 @@ type AttachedImageMetadata = ImageArtifactRef & {
42
58
  };
43
59
  type ImageArtifactMetadata = GeneratedImageMetadata | AttachedImageMetadata;
44
60
 
45
- type ApprovalMode = "minimal" | "trusted" | "full-access";
46
- declare const parseApprovalMode: (value: unknown) => ApprovalMode | undefined;
61
+ /**
62
+ * Message Content Parts
63
+ */
64
+ type ImageRefPart = {
65
+ type: "image_ref";
66
+ image_ref: ImageArtifactRef;
67
+ detail?: "auto" | "low" | "high";
68
+ };
69
+ type AttachmentRefPart = {
70
+ type: "attachment_ref";
71
+ attachment_ref: AttachmentRef;
72
+ image_ref?: ImageArtifactRef;
73
+ };
74
+ type TextPart = {
75
+ type: "text";
76
+ text: string;
77
+ };
78
+ type ImagePart = {
79
+ type: "image_url";
80
+ image_url: {
81
+ url: string;
82
+ detail?: "auto" | "low" | "high";
83
+ media_type?: "image/png" | "image/jpeg" | "image/webp" | "image/gif";
84
+ };
85
+ };
86
+ type DocumentPart = {
87
+ type: "document";
88
+ source: {
89
+ data: string;
90
+ media_type: "application/pdf";
91
+ };
92
+ };
93
+ type OtherPart = {
94
+ type: "other";
95
+ provider: string;
96
+ kind: string;
97
+ payload: unknown;
98
+ };
99
+ type ContentPart = TextPart | ImagePart | ImageRefPart | AttachmentRefPart | DocumentPart | OtherPart;
100
+
101
+ type ContextUsageCategory = "system" | "tools" | "messages" | "tool_results" | "images";
102
+ type ContextUsageBreakdownEntry = {
103
+ category: ContextUsageCategory;
104
+ /** Estimated tokens of the current history in this category. */
105
+ tokens: number;
106
+ /** Number of items (images only). */
107
+ count?: number;
108
+ };
109
+ /** Context window usage of one agent; produced by core, sent by runtime. */
110
+ type ContextUsage = {
111
+ /** Null only when no agent has been built yet. */
112
+ provider: string | null;
113
+ model: string | null;
114
+ /** Model input limit (`maxInputTokens ?? contextWindow`); null when unknown. */
115
+ limit_tokens: number | null;
116
+ /** Last provider-reported `total_tokens` (same basis as `left_percent`). */
117
+ used_tokens: number | null;
118
+ /** Last provider-reported `input_tokens`. */
119
+ input_tokens: number | null;
120
+ left_percent: number | null;
121
+ /** `provider`: used/input come from the last model call; `none`: no call yet. */
122
+ basis: "provider" | "none";
123
+ /**
124
+ * Size estimate of the current history and tool definitions by category
125
+ * (serialized bytes / 3; images via the model's image-token estimate). Not
126
+ * normalized to `used_tokens`, which stays provider-reported only.
127
+ */
128
+ breakdown: ContextUsageBreakdownEntry[];
129
+ };
47
130
 
48
- type BuiltinProviderName = "openai" | "anthropic" | "openrouter" | "google" | "moonshot" | "zai" | "xai";
131
+ type BuiltinProviderName = "openai" | "anthropic" | "openrouter" | "google" | "deepseek" | "moonshot" | "zai" | "xai";
49
132
  /** Runtime endpoint names are configured independently of builtin adapters. */
50
133
  type ProviderName = string;
51
134
 
@@ -59,6 +142,28 @@ type ReasoningEvent = {
59
142
  content: string;
60
143
  timestamp: number;
61
144
  };
145
+ /**
146
+ * Provisional, ephemeral text streamed while one model call attempt is in progress.
147
+ * `stream_id` identifies the attempt (a retried call gets a new id). `index` groups
148
+ * provisional blocks of one kind within that stream, numbered in order of their
149
+ * first delta; it does not identify a complete event. When the step's complete
150
+ * events arrive, replace all provisional text of the `stream_id` with them; discard
151
+ * it on `llm.retry` or when the run ends without them. Never persisted or replayed.
152
+ * Opt-in via `ui_capabilities.supports_text_delta`. See ui-protocol.md §5.2.
153
+ */
154
+ type TextDeltaEvent = {
155
+ type: "text.delta";
156
+ delta: string;
157
+ stream_id: string;
158
+ index: number;
159
+ };
160
+ /** Reasoning counterpart of `TextDeltaEvent`; the complete `reasoning` event stays authoritative. */
161
+ type ReasoningDeltaEvent = {
162
+ type: "reasoning.delta";
163
+ delta: string;
164
+ stream_id: string;
165
+ index: number;
166
+ };
62
167
  type LlmRetryEvent = {
63
168
  type: "llm.retry";
64
169
  provider: ProviderName;
@@ -138,12 +243,18 @@ type HiddenUserMessageEvent = {
138
243
  type: "hidden_user_message";
139
244
  content: string;
140
245
  };
246
+ type SteerAppliedEvent = {
247
+ type: "steer_applied";
248
+ steer_id: string;
249
+ content: string | ContentPart[];
250
+ timestamp: number;
251
+ };
141
252
  type FinalResponseEvent = {
142
253
  type: "final";
143
254
  content: string;
144
255
  termination_reason?: "normal" | "max_steps" | "permission_denied";
145
256
  };
146
- type AgentEvent = TextEvent | ReasoningEvent | LlmRetryEvent | LlmStatusEvent | StepStartEvent | ToolCallEvent | ToolResultEvent | PermissionPreviewEvent | PermissionReadyEvent | StepCompleteEvent | CompactionStartEvent | CompactionCompleteEvent | HiddenUserMessageEvent | FinalResponseEvent;
257
+ type AgentEvent = TextEvent | ReasoningEvent | TextDeltaEvent | ReasoningDeltaEvent | LlmRetryEvent | LlmStatusEvent | StepStartEvent | ToolCallEvent | ToolResultEvent | PermissionPreviewEvent | PermissionReadyEvent | StepCompleteEvent | CompactionStartEvent | CompactionCompleteEvent | HiddenUserMessageEvent | SteerAppliedEvent | FinalResponseEvent;
147
258
 
148
259
  /** Observed successful stream timing, measured with a monotonic clock. */
149
260
  type LlmCallTiming = {
@@ -151,13 +262,30 @@ type LlmCallTiming = {
151
262
  generation_duration_ms: number;
152
263
  /** Optional observed start of hidden reasoning, distinct from first delta. */
153
264
  generation_start_ms?: number;
154
- generation_start_source?: "reasoning_item";
265
+ generation_start_source?: "reasoning_item" | "thought_step";
155
266
  };
156
267
 
268
+ /** Explicit speed selection; booleans preserve the original fast-mode contract. */
269
+ type ModelFastMode = boolean | "ultrafast";
270
+ declare const isModelFastMode: (value: unknown) => value is ModelFastMode;
157
271
  declare const MODEL_REASONING_LEVELS: readonly ["low", "medium", "high", "xhigh", "max"];
158
272
  type ModelReasoningLevel = (typeof MODEL_REASONING_LEVELS)[number];
159
273
  declare const isModelReasoningLevel: (value: string) => value is ModelReasoningLevel;
160
274
 
275
+ /** Safe failure-only context for status notifications and retained errors. */
276
+ type RunErrorInfo = {
277
+ name: string;
278
+ message: string;
279
+ provider?: ProviderName;
280
+ kind?: string;
281
+ status?: number;
282
+ code?: string;
283
+ attempts?: number;
284
+ max_attempts?: number;
285
+ detail?: string;
286
+ hint?: string;
287
+ };
288
+
161
289
  type SessionStateSummary = {
162
290
  session_id: string;
163
291
  updated_at: string;
@@ -165,6 +293,8 @@ type SessionStateSummary = {
165
293
  message_count?: number;
166
294
  last_user_message?: string;
167
295
  workspace_root?: string;
296
+ pinned?: boolean;
297
+ archived_at?: string;
168
298
  };
169
299
 
170
300
  declare const SkillScopeSchema: z.ZodEnum<{
@@ -260,6 +390,29 @@ type TaskUsage = {
260
390
  total_tokens: number;
261
391
  total_cost_usd?: number | null;
262
392
  };
393
+ /**
394
+ * Parent-visible progress of a running subagent. Counts, phase and tool names
395
+ * only; arguments and results stay in the child session.
396
+ */
397
+ type TaskProgress = {
398
+ /** Model calls started so far (1-based once the first call starts). */
399
+ step: number;
400
+ max_steps?: number;
401
+ phase: "model" | "tool" | "compacting" | "finishing";
402
+ current_tool?: {
403
+ name: string;
404
+ tool_call_id: string;
405
+ started_at: string;
406
+ };
407
+ last_tool?: {
408
+ name: string;
409
+ status: "ok" | "error";
410
+ finished_at: string;
411
+ };
412
+ /** Tool calls requested so far. */
413
+ tool_calls: number;
414
+ updated_at: string;
415
+ };
263
416
  /** Stored peer content is untrusted; accepted does not mean acted on by a model. */
264
417
  type AgentMessage = {
265
418
  message_id: string;
@@ -271,4 +424,4 @@ type AgentMessage = {
271
424
  content: string;
272
425
  };
273
426
 
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 };
427
+ export { ATTACHMENT_ID_PATTERN, type AgentEvent, type AgentMessage, type ApprovalMode, type AttachedImageMetadata, type AttachmentRef, type AttachmentRefPart, type BuiltinProviderName, type CompactionCompleteEvent, type CompactionStartEvent, type ContentPart, type ContextUsage, type ContextUsageBreakdownEntry, type ContextUsageCategory, type DocumentPart, type FinalResponseEvent, type GeneratedImageMetadata, type HiddenUserMessageEvent, IMAGE_REFERENCE_MAX_COUNT, type ImageArtifactMetadata, type ImageArtifactRef, type ImageMediaType, type ImageModelView, type ImagePart, type ImageRefPart, type LlmCallTiming, type LlmRetryEvent, type LlmStatusEvent, MODEL_REASONING_LEVELS, type ModelFastMode, type ModelReasoningLevel, type OtherPart, type PermissionPreviewEvent, type PermissionReadyEvent, type ProviderName, type ReasoningDeltaEvent, type ReasoningEvent, type RunErrorInfo, type SessionStateSummary, type SkillCatalog, SkillCatalogSchema, type SkillLoadError, SkillLoadErrorSchema, type SkillMetadata, SkillMetadataSchema, type SkillScope, SkillScopeSchema, type SkillSearchReason, SkillSearchReasonSchema, type SkillSearchResult, SkillSearchResultSchema, type SteerAppliedEvent, type StepCompleteEvent, type StepStartEvent, type SubagentLineage, type TaskProgress, type TaskTerminationReason, type TaskUsage, type TextDeltaEvent, type TextEvent, type TextPart, type ToolCallEvent, type ToolResultEvent, isImageModelView, isModelFastMode, isModelReasoningLevel, parseApprovalMode };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,21 @@
1
1
  import { z } from 'zod';
2
2
 
3
+ type ApprovalMode = "minimal" | "trusted" | "full-access";
4
+ declare const parseApprovalMode: (value: unknown) => ApprovalMode | undefined;
5
+
6
+ declare const ATTACHMENT_ID_PATTERN: RegExp;
7
+ /** Immutable runtime-owned attachment metadata. No source path is retained. */
8
+ type AttachmentRef = {
9
+ attachment_id: string;
10
+ sha256: string;
11
+ byte_size: number;
12
+ media_type: string;
13
+ display_name: string;
14
+ width?: number;
15
+ height?: number;
16
+ origin?: "file" | "clipboard_image";
17
+ };
18
+
3
19
  /** Persistence/schema safety ceiling, not a provider capability promise. */
4
20
  declare const IMAGE_REFERENCE_MAX_COUNT = 16;
5
21
  type ImageMediaType = "image/png" | "image/jpeg" | "image/webp" | "image/gif";
@@ -23,7 +39,7 @@ type ImageArtifactRef = {
23
39
  };
24
40
  type GeneratedImageMetadata = ImageArtifactRef & {
25
41
  kind?: "generated";
26
- media_type: "image/png";
42
+ media_type: "image/png" | "image/jpeg";
27
43
  created_at: string;
28
44
  provider: string;
29
45
  requested_model: string;
@@ -42,10 +58,77 @@ type AttachedImageMetadata = ImageArtifactRef & {
42
58
  };
43
59
  type ImageArtifactMetadata = GeneratedImageMetadata | AttachedImageMetadata;
44
60
 
45
- type ApprovalMode = "minimal" | "trusted" | "full-access";
46
- declare const parseApprovalMode: (value: unknown) => ApprovalMode | undefined;
61
+ /**
62
+ * Message Content Parts
63
+ */
64
+ type ImageRefPart = {
65
+ type: "image_ref";
66
+ image_ref: ImageArtifactRef;
67
+ detail?: "auto" | "low" | "high";
68
+ };
69
+ type AttachmentRefPart = {
70
+ type: "attachment_ref";
71
+ attachment_ref: AttachmentRef;
72
+ image_ref?: ImageArtifactRef;
73
+ };
74
+ type TextPart = {
75
+ type: "text";
76
+ text: string;
77
+ };
78
+ type ImagePart = {
79
+ type: "image_url";
80
+ image_url: {
81
+ url: string;
82
+ detail?: "auto" | "low" | "high";
83
+ media_type?: "image/png" | "image/jpeg" | "image/webp" | "image/gif";
84
+ };
85
+ };
86
+ type DocumentPart = {
87
+ type: "document";
88
+ source: {
89
+ data: string;
90
+ media_type: "application/pdf";
91
+ };
92
+ };
93
+ type OtherPart = {
94
+ type: "other";
95
+ provider: string;
96
+ kind: string;
97
+ payload: unknown;
98
+ };
99
+ type ContentPart = TextPart | ImagePart | ImageRefPart | AttachmentRefPart | DocumentPart | OtherPart;
100
+
101
+ type ContextUsageCategory = "system" | "tools" | "messages" | "tool_results" | "images";
102
+ type ContextUsageBreakdownEntry = {
103
+ category: ContextUsageCategory;
104
+ /** Estimated tokens of the current history in this category. */
105
+ tokens: number;
106
+ /** Number of items (images only). */
107
+ count?: number;
108
+ };
109
+ /** Context window usage of one agent; produced by core, sent by runtime. */
110
+ type ContextUsage = {
111
+ /** Null only when no agent has been built yet. */
112
+ provider: string | null;
113
+ model: string | null;
114
+ /** Model input limit (`maxInputTokens ?? contextWindow`); null when unknown. */
115
+ limit_tokens: number | null;
116
+ /** Last provider-reported `total_tokens` (same basis as `left_percent`). */
117
+ used_tokens: number | null;
118
+ /** Last provider-reported `input_tokens`. */
119
+ input_tokens: number | null;
120
+ left_percent: number | null;
121
+ /** `provider`: used/input come from the last model call; `none`: no call yet. */
122
+ basis: "provider" | "none";
123
+ /**
124
+ * Size estimate of the current history and tool definitions by category
125
+ * (serialized bytes / 3; images via the model's image-token estimate). Not
126
+ * normalized to `used_tokens`, which stays provider-reported only.
127
+ */
128
+ breakdown: ContextUsageBreakdownEntry[];
129
+ };
47
130
 
48
- type BuiltinProviderName = "openai" | "anthropic" | "openrouter" | "google" | "moonshot" | "zai" | "xai";
131
+ type BuiltinProviderName = "openai" | "anthropic" | "openrouter" | "google" | "deepseek" | "moonshot" | "zai" | "xai";
49
132
  /** Runtime endpoint names are configured independently of builtin adapters. */
50
133
  type ProviderName = string;
51
134
 
@@ -59,6 +142,28 @@ type ReasoningEvent = {
59
142
  content: string;
60
143
  timestamp: number;
61
144
  };
145
+ /**
146
+ * Provisional, ephemeral text streamed while one model call attempt is in progress.
147
+ * `stream_id` identifies the attempt (a retried call gets a new id). `index` groups
148
+ * provisional blocks of one kind within that stream, numbered in order of their
149
+ * first delta; it does not identify a complete event. When the step's complete
150
+ * events arrive, replace all provisional text of the `stream_id` with them; discard
151
+ * it on `llm.retry` or when the run ends without them. Never persisted or replayed.
152
+ * Opt-in via `ui_capabilities.supports_text_delta`. See ui-protocol.md §5.2.
153
+ */
154
+ type TextDeltaEvent = {
155
+ type: "text.delta";
156
+ delta: string;
157
+ stream_id: string;
158
+ index: number;
159
+ };
160
+ /** Reasoning counterpart of `TextDeltaEvent`; the complete `reasoning` event stays authoritative. */
161
+ type ReasoningDeltaEvent = {
162
+ type: "reasoning.delta";
163
+ delta: string;
164
+ stream_id: string;
165
+ index: number;
166
+ };
62
167
  type LlmRetryEvent = {
63
168
  type: "llm.retry";
64
169
  provider: ProviderName;
@@ -138,12 +243,18 @@ type HiddenUserMessageEvent = {
138
243
  type: "hidden_user_message";
139
244
  content: string;
140
245
  };
246
+ type SteerAppliedEvent = {
247
+ type: "steer_applied";
248
+ steer_id: string;
249
+ content: string | ContentPart[];
250
+ timestamp: number;
251
+ };
141
252
  type FinalResponseEvent = {
142
253
  type: "final";
143
254
  content: string;
144
255
  termination_reason?: "normal" | "max_steps" | "permission_denied";
145
256
  };
146
- type AgentEvent = TextEvent | ReasoningEvent | LlmRetryEvent | LlmStatusEvent | StepStartEvent | ToolCallEvent | ToolResultEvent | PermissionPreviewEvent | PermissionReadyEvent | StepCompleteEvent | CompactionStartEvent | CompactionCompleteEvent | HiddenUserMessageEvent | FinalResponseEvent;
257
+ type AgentEvent = TextEvent | ReasoningEvent | TextDeltaEvent | ReasoningDeltaEvent | LlmRetryEvent | LlmStatusEvent | StepStartEvent | ToolCallEvent | ToolResultEvent | PermissionPreviewEvent | PermissionReadyEvent | StepCompleteEvent | CompactionStartEvent | CompactionCompleteEvent | HiddenUserMessageEvent | SteerAppliedEvent | FinalResponseEvent;
147
258
 
148
259
  /** Observed successful stream timing, measured with a monotonic clock. */
149
260
  type LlmCallTiming = {
@@ -151,13 +262,30 @@ type LlmCallTiming = {
151
262
  generation_duration_ms: number;
152
263
  /** Optional observed start of hidden reasoning, distinct from first delta. */
153
264
  generation_start_ms?: number;
154
- generation_start_source?: "reasoning_item";
265
+ generation_start_source?: "reasoning_item" | "thought_step";
155
266
  };
156
267
 
268
+ /** Explicit speed selection; booleans preserve the original fast-mode contract. */
269
+ type ModelFastMode = boolean | "ultrafast";
270
+ declare const isModelFastMode: (value: unknown) => value is ModelFastMode;
157
271
  declare const MODEL_REASONING_LEVELS: readonly ["low", "medium", "high", "xhigh", "max"];
158
272
  type ModelReasoningLevel = (typeof MODEL_REASONING_LEVELS)[number];
159
273
  declare const isModelReasoningLevel: (value: string) => value is ModelReasoningLevel;
160
274
 
275
+ /** Safe failure-only context for status notifications and retained errors. */
276
+ type RunErrorInfo = {
277
+ name: string;
278
+ message: string;
279
+ provider?: ProviderName;
280
+ kind?: string;
281
+ status?: number;
282
+ code?: string;
283
+ attempts?: number;
284
+ max_attempts?: number;
285
+ detail?: string;
286
+ hint?: string;
287
+ };
288
+
161
289
  type SessionStateSummary = {
162
290
  session_id: string;
163
291
  updated_at: string;
@@ -165,6 +293,8 @@ type SessionStateSummary = {
165
293
  message_count?: number;
166
294
  last_user_message?: string;
167
295
  workspace_root?: string;
296
+ pinned?: boolean;
297
+ archived_at?: string;
168
298
  };
169
299
 
170
300
  declare const SkillScopeSchema: z.ZodEnum<{
@@ -260,6 +390,29 @@ type TaskUsage = {
260
390
  total_tokens: number;
261
391
  total_cost_usd?: number | null;
262
392
  };
393
+ /**
394
+ * Parent-visible progress of a running subagent. Counts, phase and tool names
395
+ * only; arguments and results stay in the child session.
396
+ */
397
+ type TaskProgress = {
398
+ /** Model calls started so far (1-based once the first call starts). */
399
+ step: number;
400
+ max_steps?: number;
401
+ phase: "model" | "tool" | "compacting" | "finishing";
402
+ current_tool?: {
403
+ name: string;
404
+ tool_call_id: string;
405
+ started_at: string;
406
+ };
407
+ last_tool?: {
408
+ name: string;
409
+ status: "ok" | "error";
410
+ finished_at: string;
411
+ };
412
+ /** Tool calls requested so far. */
413
+ tool_calls: number;
414
+ updated_at: string;
415
+ };
263
416
  /** Stored peer content is untrusted; accepted does not mean acted on by a model. */
264
417
  type AgentMessage = {
265
418
  message_id: string;
@@ -271,4 +424,4 @@ type AgentMessage = {
271
424
  content: string;
272
425
  };
273
426
 
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 };
427
+ export { ATTACHMENT_ID_PATTERN, type AgentEvent, type AgentMessage, type ApprovalMode, type AttachedImageMetadata, type AttachmentRef, type AttachmentRefPart, type BuiltinProviderName, type CompactionCompleteEvent, type CompactionStartEvent, type ContentPart, type ContextUsage, type ContextUsageBreakdownEntry, type ContextUsageCategory, type DocumentPart, type FinalResponseEvent, type GeneratedImageMetadata, type HiddenUserMessageEvent, IMAGE_REFERENCE_MAX_COUNT, type ImageArtifactMetadata, type ImageArtifactRef, type ImageMediaType, type ImageModelView, type ImagePart, type ImageRefPart, type LlmCallTiming, type LlmRetryEvent, type LlmStatusEvent, MODEL_REASONING_LEVELS, type ModelFastMode, type ModelReasoningLevel, type OtherPart, type PermissionPreviewEvent, type PermissionReadyEvent, type ProviderName, type ReasoningDeltaEvent, type ReasoningEvent, type RunErrorInfo, type SessionStateSummary, type SkillCatalog, SkillCatalogSchema, type SkillLoadError, SkillLoadErrorSchema, type SkillMetadata, SkillMetadataSchema, type SkillScope, SkillScopeSchema, type SkillSearchReason, SkillSearchReasonSchema, type SkillSearchResult, SkillSearchResultSchema, type SteerAppliedEvent, type StepCompleteEvent, type StepStartEvent, type SubagentLineage, type TaskProgress, type TaskTerminationReason, type TaskUsage, type TextDeltaEvent, type TextEvent, type TextPart, type ToolCallEvent, type ToolResultEvent, isImageModelView, isModelFastMode, isModelReasoningLevel, parseApprovalMode };
package/dist/index.js CHANGED
@@ -1,11 +1,3 @@
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
-
9
1
  // src/approval.ts
10
2
  var parseApprovalMode = (value) => {
11
3
  if (value === "minimal" || value === "trusted" || value === "full-access") {
@@ -14,7 +6,19 @@ var parseApprovalMode = (value) => {
14
6
  return void 0;
15
7
  };
16
8
 
9
+ // src/attachment.ts
10
+ var ATTACHMENT_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/;
11
+
12
+ // src/image-artifact.ts
13
+ var IMAGE_REFERENCE_MAX_COUNT = 16;
14
+ function isImageModelView(value) {
15
+ if (!value || typeof value !== "object") return false;
16
+ const view = value;
17
+ 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 <= 32 * 1024 * 1024;
18
+ }
19
+
17
20
  // src/model.ts
21
+ var isModelFastMode = (value) => typeof value === "boolean" || value === "ultrafast";
18
22
  var MODEL_REASONING_LEVELS = [
19
23
  "low",
20
24
  "medium",
@@ -57,6 +61,7 @@ var SkillSearchResultSchema = z.object({
57
61
  reason: SkillSearchReasonSchema
58
62
  }).strict();
59
63
  export {
64
+ ATTACHMENT_ID_PATTERN,
60
65
  IMAGE_REFERENCE_MAX_COUNT,
61
66
  MODEL_REASONING_LEVELS,
62
67
  SkillCatalogSchema,
@@ -66,6 +71,7 @@ export {
66
71
  SkillSearchReasonSchema,
67
72
  SkillSearchResultSchema,
68
73
  isImageModelView,
74
+ isModelFastMode,
69
75
  isModelReasoningLevel,
70
76
  parseApprovalMode
71
77
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codelia/shared-types",
3
- "version": "0.1.82",
3
+ "version": "0.1.84",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "files": [