@codelia/shared-types 0.1.0

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 ADDED
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ SkillCatalogSchema: () => SkillCatalogSchema,
24
+ SkillLoadErrorSchema: () => SkillLoadErrorSchema,
25
+ SkillMetadataSchema: () => SkillMetadataSchema,
26
+ SkillScopeSchema: () => SkillScopeSchema,
27
+ SkillSearchReasonSchema: () => SkillSearchReasonSchema,
28
+ SkillSearchResultSchema: () => SkillSearchResultSchema
29
+ });
30
+ module.exports = __toCommonJS(index_exports);
31
+
32
+ // src/skills/schema.ts
33
+ var import_zod = require("zod");
34
+ var SkillScopeSchema = import_zod.z.enum(["repo", "user"]);
35
+ var SkillMetadataSchema = import_zod.z.object({
36
+ id: import_zod.z.string().min(1),
37
+ name: import_zod.z.string().min(1),
38
+ description: import_zod.z.string().min(1),
39
+ path: import_zod.z.string().min(1),
40
+ dir: import_zod.z.string().min(1),
41
+ scope: SkillScopeSchema,
42
+ mtime_ms: import_zod.z.number().int().nonnegative()
43
+ }).strict();
44
+ var SkillLoadErrorSchema = import_zod.z.object({
45
+ path: import_zod.z.string().min(1),
46
+ message: import_zod.z.string().min(1)
47
+ }).strict();
48
+ var SkillCatalogSchema = import_zod.z.object({
49
+ skills: import_zod.z.array(SkillMetadataSchema),
50
+ errors: import_zod.z.array(SkillLoadErrorSchema),
51
+ truncated: import_zod.z.boolean()
52
+ }).strict();
53
+ var SkillSearchReasonSchema = import_zod.z.enum([
54
+ "exact_name",
55
+ "exact_path",
56
+ "prefix",
57
+ "token_overlap"
58
+ ]);
59
+ var SkillSearchResultSchema = import_zod.z.object({
60
+ skill: SkillMetadataSchema,
61
+ score: import_zod.z.number(),
62
+ reason: SkillSearchReasonSchema
63
+ }).strict();
64
+ // Annotate the CommonJS export names for ESM import in node:
65
+ 0 && (module.exports = {
66
+ SkillCatalogSchema,
67
+ SkillLoadErrorSchema,
68
+ SkillMetadataSchema,
69
+ SkillScopeSchema,
70
+ SkillSearchReasonSchema,
71
+ SkillSearchResultSchema
72
+ });
@@ -0,0 +1,141 @@
1
+ import { z } from 'zod';
2
+
3
+ type TextEvent = {
4
+ type: "text";
5
+ content: string;
6
+ timestamp: number;
7
+ };
8
+ type ReasoningEvent = {
9
+ type: "reasoning";
10
+ content: string;
11
+ timestamp: number;
12
+ };
13
+ type StepStartEvent = {
14
+ type: "step_start";
15
+ step_id: string;
16
+ title: string;
17
+ step_number: number;
18
+ };
19
+ type ToolCallEvent = {
20
+ type: "tool_call";
21
+ tool: string;
22
+ args: Record<string, unknown>;
23
+ tool_call_id: string;
24
+ display_name?: string;
25
+ };
26
+ type ToolResultEvent = {
27
+ type: "tool_result";
28
+ tool: string;
29
+ result: string;
30
+ tool_call_id: string;
31
+ is_error?: boolean;
32
+ screenshot_base64?: string | null;
33
+ };
34
+ type StepCompleteEvent = {
35
+ type: "step_complete";
36
+ step_id: string;
37
+ status: "completed" | "error";
38
+ duration_ms: number;
39
+ };
40
+ type CompactionStartEvent = {
41
+ type: "compaction_start";
42
+ timestamp: number;
43
+ };
44
+ type CompactionCompleteEvent = {
45
+ type: "compaction_complete";
46
+ timestamp: number;
47
+ compacted: boolean;
48
+ };
49
+ type HiddenUserMessageEvent = {
50
+ type: "hidden_user_message";
51
+ content: string;
52
+ };
53
+ type FinalResponseEvent = {
54
+ type: "final";
55
+ content: string;
56
+ };
57
+ type AgentEvent = TextEvent | ReasoningEvent | StepStartEvent | ToolCallEvent | ToolResultEvent | StepCompleteEvent | CompactionStartEvent | CompactionCompleteEvent | HiddenUserMessageEvent | FinalResponseEvent;
58
+
59
+ type SessionStateSummary = {
60
+ session_id: string;
61
+ updated_at: string;
62
+ run_id?: string;
63
+ message_count?: number;
64
+ last_user_message?: string;
65
+ };
66
+
67
+ declare const SkillScopeSchema: z.ZodEnum<{
68
+ repo: "repo";
69
+ user: "user";
70
+ }>;
71
+ declare const SkillMetadataSchema: z.ZodObject<{
72
+ id: z.ZodString;
73
+ name: z.ZodString;
74
+ description: z.ZodString;
75
+ path: z.ZodString;
76
+ dir: z.ZodString;
77
+ scope: z.ZodEnum<{
78
+ repo: "repo";
79
+ user: "user";
80
+ }>;
81
+ mtime_ms: z.ZodNumber;
82
+ }, z.core.$strict>;
83
+ declare const SkillLoadErrorSchema: z.ZodObject<{
84
+ path: z.ZodString;
85
+ message: z.ZodString;
86
+ }, z.core.$strict>;
87
+ declare const SkillCatalogSchema: z.ZodObject<{
88
+ skills: z.ZodArray<z.ZodObject<{
89
+ id: z.ZodString;
90
+ name: z.ZodString;
91
+ description: z.ZodString;
92
+ path: z.ZodString;
93
+ dir: z.ZodString;
94
+ scope: z.ZodEnum<{
95
+ repo: "repo";
96
+ user: "user";
97
+ }>;
98
+ mtime_ms: z.ZodNumber;
99
+ }, z.core.$strict>>;
100
+ errors: z.ZodArray<z.ZodObject<{
101
+ path: z.ZodString;
102
+ message: z.ZodString;
103
+ }, z.core.$strict>>;
104
+ truncated: z.ZodBoolean;
105
+ }, z.core.$strict>;
106
+ declare const SkillSearchReasonSchema: z.ZodEnum<{
107
+ exact_name: "exact_name";
108
+ exact_path: "exact_path";
109
+ prefix: "prefix";
110
+ token_overlap: "token_overlap";
111
+ }>;
112
+ declare const SkillSearchResultSchema: z.ZodObject<{
113
+ skill: z.ZodObject<{
114
+ id: z.ZodString;
115
+ name: z.ZodString;
116
+ description: z.ZodString;
117
+ path: z.ZodString;
118
+ dir: z.ZodString;
119
+ scope: z.ZodEnum<{
120
+ repo: "repo";
121
+ user: "user";
122
+ }>;
123
+ mtime_ms: z.ZodNumber;
124
+ }, z.core.$strict>;
125
+ score: z.ZodNumber;
126
+ reason: z.ZodEnum<{
127
+ exact_name: "exact_name";
128
+ exact_path: "exact_path";
129
+ prefix: "prefix";
130
+ token_overlap: "token_overlap";
131
+ }>;
132
+ }, z.core.$strict>;
133
+
134
+ type SkillScope = z.infer<typeof SkillScopeSchema>;
135
+ type SkillMetadata = z.infer<typeof SkillMetadataSchema>;
136
+ type SkillLoadError = z.infer<typeof SkillLoadErrorSchema>;
137
+ type SkillCatalog = z.infer<typeof SkillCatalogSchema>;
138
+ type SkillSearchReason = z.infer<typeof SkillSearchReasonSchema>;
139
+ type SkillSearchResult = z.infer<typeof SkillSearchResultSchema>;
140
+
141
+ export { type AgentEvent, type CompactionCompleteEvent, type CompactionStartEvent, type FinalResponseEvent, type HiddenUserMessageEvent, 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 TextEvent, type ToolCallEvent, type ToolResultEvent };
@@ -0,0 +1,141 @@
1
+ import { z } from 'zod';
2
+
3
+ type TextEvent = {
4
+ type: "text";
5
+ content: string;
6
+ timestamp: number;
7
+ };
8
+ type ReasoningEvent = {
9
+ type: "reasoning";
10
+ content: string;
11
+ timestamp: number;
12
+ };
13
+ type StepStartEvent = {
14
+ type: "step_start";
15
+ step_id: string;
16
+ title: string;
17
+ step_number: number;
18
+ };
19
+ type ToolCallEvent = {
20
+ type: "tool_call";
21
+ tool: string;
22
+ args: Record<string, unknown>;
23
+ tool_call_id: string;
24
+ display_name?: string;
25
+ };
26
+ type ToolResultEvent = {
27
+ type: "tool_result";
28
+ tool: string;
29
+ result: string;
30
+ tool_call_id: string;
31
+ is_error?: boolean;
32
+ screenshot_base64?: string | null;
33
+ };
34
+ type StepCompleteEvent = {
35
+ type: "step_complete";
36
+ step_id: string;
37
+ status: "completed" | "error";
38
+ duration_ms: number;
39
+ };
40
+ type CompactionStartEvent = {
41
+ type: "compaction_start";
42
+ timestamp: number;
43
+ };
44
+ type CompactionCompleteEvent = {
45
+ type: "compaction_complete";
46
+ timestamp: number;
47
+ compacted: boolean;
48
+ };
49
+ type HiddenUserMessageEvent = {
50
+ type: "hidden_user_message";
51
+ content: string;
52
+ };
53
+ type FinalResponseEvent = {
54
+ type: "final";
55
+ content: string;
56
+ };
57
+ type AgentEvent = TextEvent | ReasoningEvent | StepStartEvent | ToolCallEvent | ToolResultEvent | StepCompleteEvent | CompactionStartEvent | CompactionCompleteEvent | HiddenUserMessageEvent | FinalResponseEvent;
58
+
59
+ type SessionStateSummary = {
60
+ session_id: string;
61
+ updated_at: string;
62
+ run_id?: string;
63
+ message_count?: number;
64
+ last_user_message?: string;
65
+ };
66
+
67
+ declare const SkillScopeSchema: z.ZodEnum<{
68
+ repo: "repo";
69
+ user: "user";
70
+ }>;
71
+ declare const SkillMetadataSchema: z.ZodObject<{
72
+ id: z.ZodString;
73
+ name: z.ZodString;
74
+ description: z.ZodString;
75
+ path: z.ZodString;
76
+ dir: z.ZodString;
77
+ scope: z.ZodEnum<{
78
+ repo: "repo";
79
+ user: "user";
80
+ }>;
81
+ mtime_ms: z.ZodNumber;
82
+ }, z.core.$strict>;
83
+ declare const SkillLoadErrorSchema: z.ZodObject<{
84
+ path: z.ZodString;
85
+ message: z.ZodString;
86
+ }, z.core.$strict>;
87
+ declare const SkillCatalogSchema: z.ZodObject<{
88
+ skills: z.ZodArray<z.ZodObject<{
89
+ id: z.ZodString;
90
+ name: z.ZodString;
91
+ description: z.ZodString;
92
+ path: z.ZodString;
93
+ dir: z.ZodString;
94
+ scope: z.ZodEnum<{
95
+ repo: "repo";
96
+ user: "user";
97
+ }>;
98
+ mtime_ms: z.ZodNumber;
99
+ }, z.core.$strict>>;
100
+ errors: z.ZodArray<z.ZodObject<{
101
+ path: z.ZodString;
102
+ message: z.ZodString;
103
+ }, z.core.$strict>>;
104
+ truncated: z.ZodBoolean;
105
+ }, z.core.$strict>;
106
+ declare const SkillSearchReasonSchema: z.ZodEnum<{
107
+ exact_name: "exact_name";
108
+ exact_path: "exact_path";
109
+ prefix: "prefix";
110
+ token_overlap: "token_overlap";
111
+ }>;
112
+ declare const SkillSearchResultSchema: z.ZodObject<{
113
+ skill: z.ZodObject<{
114
+ id: z.ZodString;
115
+ name: z.ZodString;
116
+ description: z.ZodString;
117
+ path: z.ZodString;
118
+ dir: z.ZodString;
119
+ scope: z.ZodEnum<{
120
+ repo: "repo";
121
+ user: "user";
122
+ }>;
123
+ mtime_ms: z.ZodNumber;
124
+ }, z.core.$strict>;
125
+ score: z.ZodNumber;
126
+ reason: z.ZodEnum<{
127
+ exact_name: "exact_name";
128
+ exact_path: "exact_path";
129
+ prefix: "prefix";
130
+ token_overlap: "token_overlap";
131
+ }>;
132
+ }, z.core.$strict>;
133
+
134
+ type SkillScope = z.infer<typeof SkillScopeSchema>;
135
+ type SkillMetadata = z.infer<typeof SkillMetadataSchema>;
136
+ type SkillLoadError = z.infer<typeof SkillLoadErrorSchema>;
137
+ type SkillCatalog = z.infer<typeof SkillCatalogSchema>;
138
+ type SkillSearchReason = z.infer<typeof SkillSearchReasonSchema>;
139
+ type SkillSearchResult = z.infer<typeof SkillSearchResultSchema>;
140
+
141
+ export { type AgentEvent, type CompactionCompleteEvent, type CompactionStartEvent, type FinalResponseEvent, type HiddenUserMessageEvent, 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 TextEvent, type ToolCallEvent, type ToolResultEvent };
package/dist/index.js ADDED
@@ -0,0 +1,40 @@
1
+ // src/skills/schema.ts
2
+ import { z } from "zod";
3
+ var SkillScopeSchema = z.enum(["repo", "user"]);
4
+ var SkillMetadataSchema = z.object({
5
+ id: z.string().min(1),
6
+ name: z.string().min(1),
7
+ description: z.string().min(1),
8
+ path: z.string().min(1),
9
+ dir: z.string().min(1),
10
+ scope: SkillScopeSchema,
11
+ mtime_ms: z.number().int().nonnegative()
12
+ }).strict();
13
+ var SkillLoadErrorSchema = z.object({
14
+ path: z.string().min(1),
15
+ message: z.string().min(1)
16
+ }).strict();
17
+ var SkillCatalogSchema = z.object({
18
+ skills: z.array(SkillMetadataSchema),
19
+ errors: z.array(SkillLoadErrorSchema),
20
+ truncated: z.boolean()
21
+ }).strict();
22
+ var SkillSearchReasonSchema = z.enum([
23
+ "exact_name",
24
+ "exact_path",
25
+ "prefix",
26
+ "token_overlap"
27
+ ]);
28
+ var SkillSearchResultSchema = z.object({
29
+ skill: SkillMetadataSchema,
30
+ score: z.number(),
31
+ reason: SkillSearchReasonSchema
32
+ }).strict();
33
+ export {
34
+ SkillCatalogSchema,
35
+ SkillLoadErrorSchema,
36
+ SkillMetadataSchema,
37
+ SkillScopeSchema,
38
+ SkillSearchReasonSchema,
39
+ SkillSearchResultSchema
40
+ };
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@codelia/shared-types",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "files": [
6
+ "dist"
7
+ ],
8
+ "main": "./dist/index.cjs",
9
+ "module": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js",
15
+ "require": "./dist/index.cjs"
16
+ }
17
+ },
18
+ "scripts": {
19
+ "build": "tsup src/index.ts --format esm,cjs --dts --clean",
20
+ "typecheck": "tsc --noEmit"
21
+ },
22
+ "dependencies": {
23
+ "zod": "^4.3.5"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ }
28
+ }