@assemble-dev/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/LICENSE ADDED
@@ -0,0 +1,93 @@
1
+ Elastic License 2.0
2
+
3
+ Copyright (c) 2026 Assemble (github.com/smundhra-git/assemble)
4
+
5
+ ## Acceptance
6
+
7
+ By using the software, you agree to all of the terms and conditions below.
8
+
9
+ ## Copyright License
10
+
11
+ The licensor grants you a non-exclusive, royalty-free, worldwide,
12
+ non-sublicensable, non-transferable license to use, copy, distribute, make
13
+ available, and prepare derivative works of the software, in each case subject
14
+ to the limitations and conditions below.
15
+
16
+ ## Limitations
17
+
18
+ You may not provide the software to third parties as a hosted or managed
19
+ service, where the service provides users with access to any substantial set of
20
+ the features or functionality of the software.
21
+
22
+ You may not move, change, disable, or circumvent the license key functionality
23
+ in the software, and you may not remove or obscure any functionality in the
24
+ software that is protected by the license key.
25
+
26
+ You may not alter, remove, or obscure any licensing, copyright, or other
27
+ notices of the licensor in the software. Any use of the licensor's trademarks
28
+ is subject to applicable law.
29
+
30
+ ## Patents
31
+
32
+ The licensor grants you a license, under any patent claims the licensor can
33
+ license, or becomes able to license, to make, have made, use, sell, offer for
34
+ sale, import and have imported the software, in each case subject to the
35
+ limitations and conditions in this license. This license does not cover any
36
+ patent claims that you cause to be infringed by modifications or additions to
37
+ the software. If you or your company make any written claim that the software
38
+ infringes or contributes to infringement of any patent, your patent license for
39
+ the software granted under these terms ends immediately. If your company makes
40
+ such a claim, your patent license ends immediately for work on behalf of your
41
+ company.
42
+
43
+ ## Notices
44
+
45
+ You must ensure that anyone who gets a copy of any part of the software from
46
+ you also gets a copy of these terms.
47
+
48
+ If you modify the software, you must include in any modified copies of the
49
+ software prominent notices stating that you have modified the software.
50
+
51
+ ## No Other Rights
52
+
53
+ These terms do not imply any licenses other than those expressly granted in
54
+ these terms.
55
+
56
+ ## Termination
57
+
58
+ If you use the software in violation of these terms, such use is not licensed,
59
+ and your licenses will automatically terminate. If the licensor provides you
60
+ with a notice of your violation, and you cease all violation of this license no
61
+ later than 30 days after you receive that notice, your licenses will be
62
+ reinstated retroactively. However, if you violate these terms after such
63
+ reinstatement, any additional violation of these terms will cause your licenses
64
+ to terminate automatically and permanently.
65
+
66
+ ## No Liability
67
+
68
+ *As far as the law allows, the software comes as is, without any warranty or
69
+ condition, and the licensor will not be liable to you for any damages arising
70
+ out of these terms or the use or nature of the software, under any kind of
71
+ legal claim.*
72
+
73
+ ## Definitions
74
+
75
+ The **licensor** is the entity offering these terms, and the **software** is
76
+ the software the licensor makes available under these terms, including any
77
+ portion of it.
78
+
79
+ **you** refers to the individual or entity agreeing to these terms.
80
+
81
+ **your company** is any legal entity, sole proprietorship, or other kind of
82
+ organization that you work for, plus all organizations that have control over,
83
+ are under the control of, or are under common control with that organization.
84
+ **control** means ownership of substantially all the assets of an entity, or
85
+ the power to direct its management and policies by vote, contract, or
86
+ otherwise. Control can be direct or indirect.
87
+
88
+ **your licenses** are all the licenses granted to you for the software under
89
+ these terms.
90
+
91
+ **use** means anything you do with the software requiring one of your licenses.
92
+
93
+ **trademark** means trademarks, service marks, and similar rights.
@@ -0,0 +1,31 @@
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/api-keys.ts
21
+ var api_keys_exports = {};
22
+ __export(api_keys_exports, {
23
+ ApiKeyEnvironmentSchema: () => ApiKeyEnvironmentSchema
24
+ });
25
+ module.exports = __toCommonJS(api_keys_exports);
26
+ var import_zod = require("zod");
27
+ var ApiKeyEnvironmentSchema = import_zod.z.enum(["dev", "prod", "ci"]);
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ ApiKeyEnvironmentSchema
31
+ });
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const ApiKeyEnvironmentSchema: z.ZodEnum<{
4
+ dev: "dev";
5
+ prod: "prod";
6
+ ci: "ci";
7
+ }>;
8
+ type ApiKeyEnvironment = z.infer<typeof ApiKeyEnvironmentSchema>;
9
+
10
+ export { type ApiKeyEnvironment, ApiKeyEnvironmentSchema };
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const ApiKeyEnvironmentSchema: z.ZodEnum<{
4
+ dev: "dev";
5
+ prod: "prod";
6
+ ci: "ci";
7
+ }>;
8
+ type ApiKeyEnvironment = z.infer<typeof ApiKeyEnvironmentSchema>;
9
+
10
+ export { type ApiKeyEnvironment, ApiKeyEnvironmentSchema };
@@ -0,0 +1,6 @@
1
+ import {
2
+ ApiKeyEnvironmentSchema
3
+ } from "./chunk-Z3WAEROF.js";
4
+ export {
5
+ ApiKeyEnvironmentSchema
6
+ };
@@ -0,0 +1,22 @@
1
+ // src/json.ts
2
+ import { z } from "zod";
3
+ var JsonPrimitiveSchema = z.union([
4
+ z.string(),
5
+ z.number(),
6
+ z.boolean(),
7
+ z.null()
8
+ ]);
9
+ var JsonValueSchema = z.lazy(
10
+ () => z.union([
11
+ JsonPrimitiveSchema,
12
+ z.array(JsonValueSchema),
13
+ z.record(z.string(), JsonValueSchema)
14
+ ])
15
+ );
16
+ var JsonObjectSchema = z.record(z.string(), JsonValueSchema);
17
+
18
+ export {
19
+ JsonPrimitiveSchema,
20
+ JsonValueSchema,
21
+ JsonObjectSchema
22
+ };
@@ -0,0 +1,13 @@
1
+ // src/run-metadata.ts
2
+ import { z } from "zod";
3
+ var RunMetadataSchema = z.object({
4
+ sessionId: z.string().optional(),
5
+ userId: z.string().optional(),
6
+ tags: z.array(z.string()).optional(),
7
+ parentTraceId: z.string().optional(),
8
+ parentSpanId: z.string().optional()
9
+ });
10
+
11
+ export {
12
+ RunMetadataSchema
13
+ };
@@ -0,0 +1,21 @@
1
+ // src/errors.ts
2
+ var AppErrorCode = /* @__PURE__ */ ((AppErrorCode2) => {
3
+ AppErrorCode2["BadRequest"] = "BAD_REQUEST";
4
+ AppErrorCode2["Unauthorized"] = "UNAUTHORIZED";
5
+ AppErrorCode2["Forbidden"] = "FORBIDDEN";
6
+ AppErrorCode2["NotFound"] = "NOT_FOUND";
7
+ AppErrorCode2["Conflict"] = "CONFLICT";
8
+ AppErrorCode2["Canceled"] = "CANCELED";
9
+ AppErrorCode2["RateLimited"] = "RATE_LIMITED";
10
+ AppErrorCode2["CostBudgetExceeded"] = "COST_BUDGET_EXCEEDED";
11
+ AppErrorCode2["ValidationFailed"] = "VALIDATION_FAILED";
12
+ AppErrorCode2["UserAlreadyExists"] = "USER_ALREADY_EXISTS";
13
+ AppErrorCode2["WorkspaceNotFound"] = "WORKSPACE_NOT_FOUND";
14
+ AppErrorCode2["InternalServerError"] = "INTERNAL_SERVER_ERROR";
15
+ AppErrorCode2["ServiceUnavailable"] = "SERVICE_UNAVAILABLE";
16
+ return AppErrorCode2;
17
+ })(AppErrorCode || {});
18
+
19
+ export {
20
+ AppErrorCode
21
+ };
File without changes
@@ -0,0 +1,197 @@
1
+ import {
2
+ RunMetadataSchema
3
+ } from "./chunk-F5XOAPYA.js";
4
+ import {
5
+ PolicyActionSchema
6
+ } from "./chunk-WTIOTJHP.js";
7
+ import {
8
+ JsonValueSchema
9
+ } from "./chunk-4FCV35HE.js";
10
+
11
+ // src/trace-events.ts
12
+ import { z } from "zod";
13
+ var TraceEventErrorSchema = z.object({
14
+ message: z.string(),
15
+ code: z.string().optional(),
16
+ stack: z.string().optional()
17
+ });
18
+ var TraceEventBaseSchema = z.object({
19
+ id: z.string(),
20
+ runId: z.string(),
21
+ workflowName: z.string(),
22
+ timestamp: z.iso.datetime(),
23
+ parentEventId: z.string().nullable(),
24
+ redacted: z.boolean(),
25
+ metadata: RunMetadataSchema.optional()
26
+ });
27
+ var RunStartedEventSchema = TraceEventBaseSchema.extend({
28
+ type: z.literal("run.started"),
29
+ input: JsonValueSchema
30
+ });
31
+ var RunCompletedEventSchema = TraceEventBaseSchema.extend({
32
+ type: z.literal("run.completed"),
33
+ output: JsonValueSchema,
34
+ latencyMs: z.number().nonnegative()
35
+ });
36
+ var RunFailedEventSchema = TraceEventBaseSchema.extend({
37
+ type: z.literal("run.failed"),
38
+ error: TraceEventErrorSchema,
39
+ latencyMs: z.number().nonnegative()
40
+ });
41
+ var AgentStartedEventSchema = TraceEventBaseSchema.extend({
42
+ type: z.literal("agent.started"),
43
+ agentName: z.string(),
44
+ input: JsonValueSchema
45
+ });
46
+ var AgentCompletedEventSchema = TraceEventBaseSchema.extend({
47
+ type: z.literal("agent.completed"),
48
+ agentName: z.string(),
49
+ output: JsonValueSchema,
50
+ latencyMs: z.number().nonnegative()
51
+ });
52
+ var AgentFailedEventSchema = TraceEventBaseSchema.extend({
53
+ type: z.literal("agent.failed"),
54
+ agentName: z.string(),
55
+ error: TraceEventErrorSchema,
56
+ latencyMs: z.number().nonnegative()
57
+ });
58
+ var ToolRequestedEventSchema = TraceEventBaseSchema.extend({
59
+ type: z.literal("tool.requested"),
60
+ toolName: z.string(),
61
+ agentName: z.string(),
62
+ input: JsonValueSchema
63
+ });
64
+ var ToolApprovedEventSchema = TraceEventBaseSchema.extend({
65
+ type: z.literal("tool.approved"),
66
+ toolName: z.string(),
67
+ agentName: z.string(),
68
+ approvalId: z.string().nullable()
69
+ });
70
+ var ToolBlockedEventSchema = TraceEventBaseSchema.extend({
71
+ type: z.literal("tool.blocked"),
72
+ toolName: z.string(),
73
+ agentName: z.string(),
74
+ policyName: z.string(),
75
+ reason: z.string()
76
+ });
77
+ var ToolCompletedEventSchema = TraceEventBaseSchema.extend({
78
+ type: z.literal("tool.completed"),
79
+ toolName: z.string(),
80
+ agentName: z.string(),
81
+ output: JsonValueSchema,
82
+ latencyMs: z.number().nonnegative()
83
+ });
84
+ var ToolFailedEventSchema = TraceEventBaseSchema.extend({
85
+ type: z.literal("tool.failed"),
86
+ toolName: z.string(),
87
+ agentName: z.string(),
88
+ error: TraceEventErrorSchema,
89
+ latencyMs: z.number().nonnegative()
90
+ });
91
+ var PolicyEvaluatedEventSchema = TraceEventBaseSchema.extend({
92
+ type: z.literal("policy.evaluated"),
93
+ policyName: z.string(),
94
+ action: PolicyActionSchema,
95
+ agentName: z.string().optional(),
96
+ toolName: z.string().optional(),
97
+ reason: z.string()
98
+ });
99
+ var RouteSelectedEventSchema = TraceEventBaseSchema.extend({
100
+ type: z.literal("route.selected"),
101
+ supervisorName: z.string(),
102
+ selectedAgentName: z.string(),
103
+ candidateAgentNames: z.array(z.string()),
104
+ reason: z.string()
105
+ });
106
+ var ApprovalRequiredEventSchema = TraceEventBaseSchema.extend({
107
+ type: z.literal("approval.required"),
108
+ approvalId: z.string(),
109
+ toolName: z.string().optional(),
110
+ agentName: z.string().optional(),
111
+ reason: z.string()
112
+ });
113
+ var ApprovalApprovedEventSchema = TraceEventBaseSchema.extend({
114
+ type: z.literal("approval.approved"),
115
+ approvalId: z.string(),
116
+ decidedBy: z.string().nullable()
117
+ });
118
+ var ApprovalRejectedEventSchema = TraceEventBaseSchema.extend({
119
+ type: z.literal("approval.rejected"),
120
+ approvalId: z.string(),
121
+ decidedBy: z.string().nullable(),
122
+ reason: z.string()
123
+ });
124
+ var EvalStartedEventSchema = TraceEventBaseSchema.extend({
125
+ type: z.literal("eval.started"),
126
+ evalRunId: z.string(),
127
+ suiteName: z.string(),
128
+ caseCount: z.number().int().nonnegative()
129
+ });
130
+ var EvalCompletedEventSchema = TraceEventBaseSchema.extend({
131
+ type: z.literal("eval.completed"),
132
+ evalRunId: z.string(),
133
+ passedCaseCount: z.number().int().nonnegative(),
134
+ failedCaseCount: z.number().int().nonnegative(),
135
+ latencyMs: z.number().nonnegative()
136
+ });
137
+ var ReplayStartedEventSchema = TraceEventBaseSchema.extend({
138
+ type: z.literal("replay.started"),
139
+ sourceRunId: z.string(),
140
+ fromEventId: z.string().nullable()
141
+ });
142
+ var ReplayCompletedEventSchema = TraceEventBaseSchema.extend({
143
+ type: z.literal("replay.completed"),
144
+ sourceRunId: z.string(),
145
+ latencyMs: z.number().nonnegative()
146
+ });
147
+ var TraceEventSchema = z.discriminatedUnion("type", [
148
+ RunStartedEventSchema,
149
+ RunCompletedEventSchema,
150
+ RunFailedEventSchema,
151
+ AgentStartedEventSchema,
152
+ AgentCompletedEventSchema,
153
+ AgentFailedEventSchema,
154
+ ToolRequestedEventSchema,
155
+ ToolApprovedEventSchema,
156
+ ToolBlockedEventSchema,
157
+ ToolCompletedEventSchema,
158
+ ToolFailedEventSchema,
159
+ PolicyEvaluatedEventSchema,
160
+ RouteSelectedEventSchema,
161
+ ApprovalRequiredEventSchema,
162
+ ApprovalApprovedEventSchema,
163
+ ApprovalRejectedEventSchema,
164
+ EvalStartedEventSchema,
165
+ EvalCompletedEventSchema,
166
+ ReplayStartedEventSchema,
167
+ ReplayCompletedEventSchema
168
+ ]);
169
+ var traceEventTypes = TraceEventSchema.options.map(
170
+ (option) => option.shape.type.value
171
+ );
172
+
173
+ export {
174
+ TraceEventErrorSchema,
175
+ RunStartedEventSchema,
176
+ RunCompletedEventSchema,
177
+ RunFailedEventSchema,
178
+ AgentStartedEventSchema,
179
+ AgentCompletedEventSchema,
180
+ AgentFailedEventSchema,
181
+ ToolRequestedEventSchema,
182
+ ToolApprovedEventSchema,
183
+ ToolBlockedEventSchema,
184
+ ToolCompletedEventSchema,
185
+ ToolFailedEventSchema,
186
+ PolicyEvaluatedEventSchema,
187
+ RouteSelectedEventSchema,
188
+ ApprovalRequiredEventSchema,
189
+ ApprovalApprovedEventSchema,
190
+ ApprovalRejectedEventSchema,
191
+ EvalStartedEventSchema,
192
+ EvalCompletedEventSchema,
193
+ ReplayStartedEventSchema,
194
+ ReplayCompletedEventSchema,
195
+ TraceEventSchema,
196
+ traceEventTypes
197
+ };
@@ -0,0 +1,160 @@
1
+ import {
2
+ JsonValueSchema
3
+ } from "./chunk-4FCV35HE.js";
4
+
5
+ // src/runs.ts
6
+ import { z } from "zod";
7
+ var RunStatusSchema = z.enum([
8
+ "pending",
9
+ "running",
10
+ "awaiting_approval",
11
+ "completed",
12
+ "failed",
13
+ "canceled",
14
+ "rejected"
15
+ ]);
16
+ var PolicyActionSchema = z.enum([
17
+ "allow",
18
+ "block",
19
+ "requireApproval",
20
+ "logOnly",
21
+ "redact"
22
+ ]);
23
+ var ApprovalStatusSchema = z.enum(["pending", "approved", "rejected"]);
24
+ var RunErrorSchema = z.object({
25
+ message: z.string(),
26
+ code: z.string().optional(),
27
+ agentName: z.string().optional(),
28
+ toolName: z.string().optional(),
29
+ timestamp: z.iso.datetime()
30
+ });
31
+ var RunMessageRoleSchema = z.enum([
32
+ "system",
33
+ "user",
34
+ "assistant",
35
+ "tool"
36
+ ]);
37
+ var RunMessageSchema = z.object({
38
+ role: RunMessageRoleSchema,
39
+ content: z.string(),
40
+ agentName: z.string().optional(),
41
+ toolName: z.string().optional(),
42
+ timestamp: z.iso.datetime()
43
+ });
44
+ var AgentCallStatusSchema = z.enum(["running", "completed", "failed"]);
45
+ var AgentCallSchema = z.object({
46
+ id: z.string(),
47
+ agentName: z.string(),
48
+ status: AgentCallStatusSchema,
49
+ input: JsonValueSchema,
50
+ output: JsonValueSchema.nullable(),
51
+ error: RunErrorSchema.nullable(),
52
+ startedAt: z.iso.datetime(),
53
+ completedAt: z.iso.datetime().nullable(),
54
+ latencyMs: z.number().nonnegative().nullable()
55
+ });
56
+ var ToolCallStatusSchema = z.enum([
57
+ "requested",
58
+ "approved",
59
+ "blocked",
60
+ "completed",
61
+ "failed"
62
+ ]);
63
+ var ToolCallSchema = z.object({
64
+ id: z.string(),
65
+ toolName: z.string(),
66
+ agentName: z.string(),
67
+ status: ToolCallStatusSchema,
68
+ input: JsonValueSchema,
69
+ output: JsonValueSchema.nullable(),
70
+ error: RunErrorSchema.nullable(),
71
+ requestedAt: z.iso.datetime(),
72
+ completedAt: z.iso.datetime().nullable(),
73
+ latencyMs: z.number().nonnegative().nullable()
74
+ });
75
+ var PolicyDecisionSchema = z.object({
76
+ policyName: z.string(),
77
+ action: PolicyActionSchema,
78
+ agentName: z.string().optional(),
79
+ toolName: z.string().optional(),
80
+ reason: z.string(),
81
+ timestamp: z.iso.datetime()
82
+ });
83
+ var RoutingDecisionSchema = z.object({
84
+ supervisorName: z.string(),
85
+ selectedAgentName: z.string(),
86
+ candidateAgentNames: z.array(z.string()),
87
+ reason: z.string(),
88
+ timestamp: z.iso.datetime()
89
+ });
90
+ var RunApprovalSchema = z.object({
91
+ id: z.string(),
92
+ status: ApprovalStatusSchema,
93
+ toolCallId: z.string().nullable(),
94
+ toolName: z.string().optional(),
95
+ agentName: z.string().optional(),
96
+ reason: z.string(),
97
+ requestedAt: z.iso.datetime(),
98
+ decidedAt: z.iso.datetime().nullable(),
99
+ decidedBy: z.string().nullable()
100
+ });
101
+ var RunArtifactSchema = z.object({
102
+ key: z.string(),
103
+ value: JsonValueSchema,
104
+ producedByAgentName: z.string().optional(),
105
+ createdAt: z.iso.datetime()
106
+ });
107
+ var TokenUsageSchema = z.object({
108
+ inputTokens: z.number().int().nonnegative(),
109
+ outputTokens: z.number().int().nonnegative(),
110
+ totalTokens: z.number().int().nonnegative(),
111
+ cacheCreationInputTokens: z.number().int().nonnegative().optional(),
112
+ cacheReadInputTokens: z.number().int().nonnegative().optional()
113
+ });
114
+ var RunMetricsSchema = z.object({
115
+ totalLatencyMs: z.number().nonnegative().nullable(),
116
+ tokenUsage: TokenUsageSchema.nullable(),
117
+ agentCallCount: z.number().int().nonnegative(),
118
+ toolCallCount: z.number().int().nonnegative(),
119
+ policyDecisionCount: z.number().int().nonnegative(),
120
+ approvalCount: z.number().int().nonnegative()
121
+ });
122
+ var RunStateSchema = z.object({
123
+ runId: z.string(),
124
+ workflowName: z.string(),
125
+ status: RunStatusSchema,
126
+ input: JsonValueSchema,
127
+ messages: z.array(RunMessageSchema),
128
+ agentCalls: z.array(AgentCallSchema),
129
+ toolCalls: z.array(ToolCallSchema),
130
+ policyDecisions: z.array(PolicyDecisionSchema),
131
+ routingDecisions: z.array(RoutingDecisionSchema),
132
+ approvals: z.array(RunApprovalSchema),
133
+ artifacts: z.array(RunArtifactSchema),
134
+ errors: z.array(RunErrorSchema),
135
+ metrics: RunMetricsSchema,
136
+ finalOutput: JsonValueSchema.nullable(),
137
+ createdAt: z.iso.datetime(),
138
+ startedAt: z.iso.datetime().nullable(),
139
+ completedAt: z.iso.datetime().nullable()
140
+ });
141
+
142
+ export {
143
+ RunStatusSchema,
144
+ PolicyActionSchema,
145
+ ApprovalStatusSchema,
146
+ RunErrorSchema,
147
+ RunMessageRoleSchema,
148
+ RunMessageSchema,
149
+ AgentCallStatusSchema,
150
+ AgentCallSchema,
151
+ ToolCallStatusSchema,
152
+ ToolCallSchema,
153
+ PolicyDecisionSchema,
154
+ RoutingDecisionSchema,
155
+ RunApprovalSchema,
156
+ RunArtifactSchema,
157
+ TokenUsageSchema,
158
+ RunMetricsSchema,
159
+ RunStateSchema
160
+ };
@@ -0,0 +1,7 @@
1
+ // src/api-keys.ts
2
+ import { z } from "zod";
3
+ var ApiKeyEnvironmentSchema = z.enum(["dev", "prod", "ci"]);
4
+
5
+ export {
6
+ ApiKeyEnvironmentSchema
7
+ };
@@ -0,0 +1,45 @@
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/errors.ts
21
+ var errors_exports = {};
22
+ __export(errors_exports, {
23
+ AppErrorCode: () => AppErrorCode
24
+ });
25
+ module.exports = __toCommonJS(errors_exports);
26
+ var AppErrorCode = /* @__PURE__ */ ((AppErrorCode2) => {
27
+ AppErrorCode2["BadRequest"] = "BAD_REQUEST";
28
+ AppErrorCode2["Unauthorized"] = "UNAUTHORIZED";
29
+ AppErrorCode2["Forbidden"] = "FORBIDDEN";
30
+ AppErrorCode2["NotFound"] = "NOT_FOUND";
31
+ AppErrorCode2["Conflict"] = "CONFLICT";
32
+ AppErrorCode2["Canceled"] = "CANCELED";
33
+ AppErrorCode2["RateLimited"] = "RATE_LIMITED";
34
+ AppErrorCode2["CostBudgetExceeded"] = "COST_BUDGET_EXCEEDED";
35
+ AppErrorCode2["ValidationFailed"] = "VALIDATION_FAILED";
36
+ AppErrorCode2["UserAlreadyExists"] = "USER_ALREADY_EXISTS";
37
+ AppErrorCode2["WorkspaceNotFound"] = "WORKSPACE_NOT_FOUND";
38
+ AppErrorCode2["InternalServerError"] = "INTERNAL_SERVER_ERROR";
39
+ AppErrorCode2["ServiceUnavailable"] = "SERVICE_UNAVAILABLE";
40
+ return AppErrorCode2;
41
+ })(AppErrorCode || {});
42
+ // Annotate the CommonJS export names for ESM import in node:
43
+ 0 && (module.exports = {
44
+ AppErrorCode
45
+ });
@@ -0,0 +1,32 @@
1
+ declare enum AppErrorCode {
2
+ BadRequest = "BAD_REQUEST",
3
+ Unauthorized = "UNAUTHORIZED",
4
+ Forbidden = "FORBIDDEN",
5
+ NotFound = "NOT_FOUND",
6
+ Conflict = "CONFLICT",
7
+ Canceled = "CANCELED",
8
+ RateLimited = "RATE_LIMITED",
9
+ CostBudgetExceeded = "COST_BUDGET_EXCEEDED",
10
+ ValidationFailed = "VALIDATION_FAILED",
11
+ UserAlreadyExists = "USER_ALREADY_EXISTS",
12
+ WorkspaceNotFound = "WORKSPACE_NOT_FOUND",
13
+ InternalServerError = "INTERNAL_SERVER_ERROR",
14
+ ServiceUnavailable = "SERVICE_UNAVAILABLE"
15
+ }
16
+ type AppErrorDetails = Record<string, string | number | boolean | null>;
17
+ type AppErrorInput = {
18
+ code: AppErrorCode;
19
+ message: string;
20
+ statusCode: number;
21
+ details?: AppErrorDetails;
22
+ cause?: Error;
23
+ };
24
+ type AppErrorResponse = {
25
+ error: {
26
+ code: AppErrorCode;
27
+ message: string;
28
+ details?: AppErrorDetails;
29
+ };
30
+ };
31
+
32
+ export { AppErrorCode, type AppErrorDetails, type AppErrorInput, type AppErrorResponse };
@@ -0,0 +1,32 @@
1
+ declare enum AppErrorCode {
2
+ BadRequest = "BAD_REQUEST",
3
+ Unauthorized = "UNAUTHORIZED",
4
+ Forbidden = "FORBIDDEN",
5
+ NotFound = "NOT_FOUND",
6
+ Conflict = "CONFLICT",
7
+ Canceled = "CANCELED",
8
+ RateLimited = "RATE_LIMITED",
9
+ CostBudgetExceeded = "COST_BUDGET_EXCEEDED",
10
+ ValidationFailed = "VALIDATION_FAILED",
11
+ UserAlreadyExists = "USER_ALREADY_EXISTS",
12
+ WorkspaceNotFound = "WORKSPACE_NOT_FOUND",
13
+ InternalServerError = "INTERNAL_SERVER_ERROR",
14
+ ServiceUnavailable = "SERVICE_UNAVAILABLE"
15
+ }
16
+ type AppErrorDetails = Record<string, string | number | boolean | null>;
17
+ type AppErrorInput = {
18
+ code: AppErrorCode;
19
+ message: string;
20
+ statusCode: number;
21
+ details?: AppErrorDetails;
22
+ cause?: Error;
23
+ };
24
+ type AppErrorResponse = {
25
+ error: {
26
+ code: AppErrorCode;
27
+ message: string;
28
+ details?: AppErrorDetails;
29
+ };
30
+ };
31
+
32
+ export { AppErrorCode, type AppErrorDetails, type AppErrorInput, type AppErrorResponse };