@effect/ai-typesafe 0.0.1 → 4.0.0-rc.117

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.
Files changed (111) hide show
  1. package/AGENTS.md +410 -0
  2. package/CLAUDE.md +410 -0
  3. package/LICENSE +21 -0
  4. package/README.md +3 -41
  5. package/ai-docs/README.md +44 -0
  6. package/ai-docs/package.json +36 -0
  7. package/ai-docs/src/01_effect/01_basics/01_effect-gen.ts +30 -0
  8. package/ai-docs/src/01_effect/01_basics/02_effect-fn.ts +52 -0
  9. package/ai-docs/src/01_effect/01_basics/10_creating-effects.ts +74 -0
  10. package/ai-docs/src/01_effect/01_basics/index.md +7 -0
  11. package/ai-docs/src/01_effect/02_schema/10_schema-basics.ts +43 -0
  12. package/ai-docs/src/01_effect/02_schema/index.md +7 -0
  13. package/ai-docs/src/01_effect/03_services/01_service.ts +45 -0
  14. package/ai-docs/src/01_effect/03_services/10_reference.ts +10 -0
  15. package/ai-docs/src/01_effect/03_services/20_layer-composition.ts +70 -0
  16. package/ai-docs/src/01_effect/03_services/20_layer-unwrap.ts +66 -0
  17. package/ai-docs/src/01_effect/03_services/index.md +5 -0
  18. package/ai-docs/src/01_effect/04_errors/01_error-handling.ts +30 -0
  19. package/ai-docs/src/01_effect/04_errors/10_catch-tags.ts +24 -0
  20. package/ai-docs/src/01_effect/04_errors/20_reason-errors.ts +64 -0
  21. package/ai-docs/src/01_effect/04_errors/index.md +1 -0
  22. package/ai-docs/src/01_effect/05_resources/10_acquire-release.ts +105 -0
  23. package/ai-docs/src/01_effect/05_resources/20_layer-side-effects.ts +31 -0
  24. package/ai-docs/src/01_effect/05_resources/30_layer-map.ts +86 -0
  25. package/ai-docs/src/01_effect/05_resources/index.md +3 -0
  26. package/ai-docs/src/01_effect/06_running/10_run-main.ts +30 -0
  27. package/ai-docs/src/01_effect/06_running/20_layer-launch.ts +27 -0
  28. package/ai-docs/src/01_effect/06_running/index.md +1 -0
  29. package/ai-docs/src/01_effect/07_pubsub/10_pubsub.ts +56 -0
  30. package/ai-docs/src/01_effect/07_pubsub/index.md +3 -0
  31. package/ai-docs/src/03_stream/10_creating-streams.ts +103 -0
  32. package/ai-docs/src/03_stream/20_consuming-streams.ts +137 -0
  33. package/ai-docs/src/03_stream/30_encoding.ts +163 -0
  34. package/ai-docs/src/03_stream/index.md +4 -0
  35. package/ai-docs/src/04_integration/10_managed-runtime.ts +129 -0
  36. package/ai-docs/src/04_integration/index.md +5 -0
  37. package/ai-docs/src/05_batching/10_request-resolver.ts +89 -0
  38. package/ai-docs/src/05_batching/index.md +3 -0
  39. package/ai-docs/src/06_schedule/10_schedules.ts +110 -0
  40. package/ai-docs/src/06_schedule/index.md +3 -0
  41. package/ai-docs/src/07_datetime/10_creating-and-formatting.ts +30 -0
  42. package/ai-docs/src/07_datetime/20_time-zones.ts +44 -0
  43. package/ai-docs/src/07_datetime/index.md +5 -0
  44. package/ai-docs/src/08_observability/10_logging.ts +66 -0
  45. package/ai-docs/src/08_observability/20_otlp-tracing.ts +95 -0
  46. package/ai-docs/src/08_observability/index.md +7 -0
  47. package/ai-docs/src/09_testing/10_effect-tests.ts +55 -0
  48. package/ai-docs/src/09_testing/20_layer-tests.ts +138 -0
  49. package/ai-docs/src/09_testing/index.md +1 -0
  50. package/ai-docs/src/10_predicate/01_basics.ts +14 -0
  51. package/ai-docs/src/10_predicate/index.md +9 -0
  52. package/ai-docs/src/40_sql/10_basics.ts +175 -0
  53. package/ai-docs/src/40_sql/index.md +6 -0
  54. package/ai-docs/src/50_http-client/10_basics.ts +102 -0
  55. package/ai-docs/src/50_http-client/index.md +3 -0
  56. package/ai-docs/src/51_http-server/10_basics.ts +118 -0
  57. package/ai-docs/src/51_http-server/20_testing.ts +100 -0
  58. package/ai-docs/src/51_http-server/fixtures/api/Api.ts +14 -0
  59. package/ai-docs/src/51_http-server/fixtures/api/Authorization.ts +36 -0
  60. package/ai-docs/src/51_http-server/fixtures/api/System.ts +10 -0
  61. package/ai-docs/src/51_http-server/fixtures/api/Users.ts +107 -0
  62. package/ai-docs/src/51_http-server/fixtures/domain/User.ts +21 -0
  63. package/ai-docs/src/51_http-server/fixtures/domain/UserErrors.ts +22 -0
  64. package/ai-docs/src/51_http-server/fixtures/server/Authorization.ts +37 -0
  65. package/ai-docs/src/51_http-server/fixtures/server/Users/http.ts +80 -0
  66. package/ai-docs/src/51_http-server/fixtures/server/Users.ts +183 -0
  67. package/ai-docs/src/51_http-server/index.md +3 -0
  68. package/ai-docs/src/60_child-process/10_working-with-child-processes.ts +117 -0
  69. package/ai-docs/src/60_child-process/index.md +3 -0
  70. package/ai-docs/src/70_cli/10_basics.ts +162 -0
  71. package/ai-docs/src/70_cli/index.md +5 -0
  72. package/ai-docs/src/71_ai/10_language-model.ts +156 -0
  73. package/ai-docs/src/71_ai/20_tools.ts +226 -0
  74. package/ai-docs/src/71_ai/30_chat.ts +158 -0
  75. package/ai-docs/src/71_ai/fixtures/domain/LaunchPlan.ts +9 -0
  76. package/ai-docs/src/71_ai/index.md +5 -0
  77. package/ai-docs/src/80_cluster/10_entities.ts +97 -0
  78. package/ai-docs/src/80_cluster/index.md +4 -0
  79. package/ai-docs/src/index.md +10 -0
  80. package/ai-docs/tsconfig.json +24 -0
  81. package/dist/TypeSafeClient.d.ts +71 -0
  82. package/dist/TypeSafeClient.d.ts.map +1 -0
  83. package/dist/TypeSafeClient.js +74 -0
  84. package/dist/TypeSafeClient.js.map +1 -0
  85. package/dist/TypeSafeConfig.d.ts +68 -0
  86. package/dist/TypeSafeConfig.d.ts.map +1 -0
  87. package/dist/TypeSafeConfig.js +36 -0
  88. package/dist/TypeSafeConfig.js.map +1 -0
  89. package/dist/TypeSafeDecisionModel.d.ts +44 -0
  90. package/dist/TypeSafeDecisionModel.d.ts.map +1 -0
  91. package/dist/TypeSafeDecisionModel.js +118 -0
  92. package/dist/TypeSafeDecisionModel.js.map +1 -0
  93. package/dist/TypeSafeSchema.d.ts +188 -0
  94. package/dist/TypeSafeSchema.d.ts.map +1 -0
  95. package/dist/TypeSafeSchema.js +130 -0
  96. package/dist/TypeSafeSchema.js.map +1 -0
  97. package/dist/index.d.ts +20 -0
  98. package/dist/index.d.ts.map +1 -0
  99. package/dist/index.js +21 -0
  100. package/dist/index.js.map +1 -0
  101. package/dist/internal/errors.d.ts +7 -0
  102. package/dist/internal/errors.d.ts.map +1 -0
  103. package/dist/internal/errors.js +120 -0
  104. package/dist/internal/errors.js.map +1 -0
  105. package/package.json +58 -7
  106. package/src/TypeSafeClient.ts +143 -0
  107. package/src/TypeSafeConfig.ts +85 -0
  108. package/src/TypeSafeDecisionModel.ts +106 -0
  109. package/src/TypeSafeSchema.ts +134 -0
  110. package/src/index.ts +25 -0
  111. package/src/internal/errors.ts +113 -0
@@ -0,0 +1,118 @@
1
+ /**
2
+ * TypeSafe's System One implementation of DecisionModel.
3
+ *
4
+ * @since 4.0.0
5
+ */
6
+ import * as Effect from "effect/Effect";
7
+ import * as Layer from "effect/Layer";
8
+ import * as DecisionModel from "effect/unstable/ai/DecisionModel";
9
+ import * as AiModel from "effect/unstable/ai/Model";
10
+ import { TypeSafeClient } from "./TypeSafeClient.js";
11
+ /**
12
+ * Creates a decision model with TypeSafe provider metadata.
13
+ *
14
+ * @category constructors
15
+ * @since 4.0.0
16
+ */
17
+ export const model = model => AiModel.make("typesafe", model, layer({
18
+ model
19
+ }));
20
+ /**
21
+ * Builds a decision service. Provider values are preserved without normalization;
22
+ * DecisionModel validates distributions and derives rating labels.
23
+ *
24
+ * @category constructors
25
+ * @since 4.0.0
26
+ */
27
+ export const make = /*#__PURE__*/Effect.fnUntraced(function* (options) {
28
+ const client = yield* TypeSafeClient;
29
+ return yield* DecisionModel.make({
30
+ decide: Effect.fnUntraced(function* ({
31
+ state,
32
+ decisions
33
+ }) {
34
+ const questions = Object.create(null);
35
+ for (const [key, decision] of Object.entries(decisions)) {
36
+ switch (decision._tag) {
37
+ case "Classify":
38
+ questions[key] = {
39
+ type: "choice",
40
+ instructions: decision.instructions,
41
+ criteria: decision.criteria
42
+ };
43
+ break;
44
+ case "Rate":
45
+ questions[key] = {
46
+ type: "score",
47
+ instructions: decision.instructions,
48
+ criteria: decision.criteria
49
+ };
50
+ break;
51
+ case "Probability":
52
+ questions[key] = {
53
+ type: "noul",
54
+ instructions: decision.instructions,
55
+ criteria: decision.criteria
56
+ };
57
+ break;
58
+ }
59
+ }
60
+ const response = yield* client.systemOne({
61
+ model: options.model,
62
+ state,
63
+ questions
64
+ });
65
+ const answers = Object.create(null);
66
+ for (const [key, decision] of Object.entries(decisions)) {
67
+ const answer = response.answers[key];
68
+ switch (answer?.type) {
69
+ case "choice":
70
+ answers[key] = {
71
+ _tag: "Classify",
72
+ label: answer.choice,
73
+ probabilities: answer.probabilities,
74
+ confidence: answer.confidence
75
+ };
76
+ break;
77
+ case "score":
78
+ {
79
+ const levels = decision._tag === "Rate" ? decision.criteria : [];
80
+ const probabilities = Object.create(null);
81
+ for (let index = 0; index < levels.length; index++) {
82
+ const probability = answer.probabilities[String(index)];
83
+ if (probability !== undefined) probabilities[levels[index]] = probability;
84
+ }
85
+ answers[key] = {
86
+ _tag: "Rate",
87
+ rating: answer.score,
88
+ probabilities,
89
+ confidence: answer.confidence
90
+ };
91
+ break;
92
+ }
93
+ case "noul":
94
+ answers[key] = {
95
+ _tag: "Probability",
96
+ probability: answer.noul
97
+ };
98
+ break;
99
+ }
100
+ }
101
+ return {
102
+ answers,
103
+ usage: {
104
+ inputTokens: response.usage?.input_tokens,
105
+ outputTokens: response.usage?.output_tokens
106
+ }
107
+ };
108
+ })
109
+ });
110
+ });
111
+ /**
112
+ * Provides DecisionModel using an existing TypeSafeClient.
113
+ *
114
+ * @category layers
115
+ * @since 4.0.0
116
+ */
117
+ export const layer = options => Layer.effect(DecisionModel.DecisionModel, make(options));
118
+ //# sourceMappingURL=TypeSafeDecisionModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypeSafeDecisionModel.js","names":[],"sources":["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,UAAU,EAAE,MAAM,CAAC;cAAU,CAAE;cACnG;YACF;UACA,KAAK,MAAM;YACT,OAAO,CAAC,GAAG,CAAC,GAAG;cAAE,IAAI,EAAE,aAAa;cAAE,WAAW,EAAE,MAAM,CAAC;YAAI,CAAE;YAChE;QACJ;MACF;MACA,OAAO;QACL,OAAO;QACP,KAAK,EAAE;UAAE,WAAW,EAAE,QAAQ,CAAC,KAAK,EAAE,YAAY;UAAE,YAAY,EAAE,QAAQ,CAAC,KAAK,EAAE;QAAa;OAChG;IACH,CAAC;GACF,CAAC;AACJ,CAAC,CACF;AAED;;;;;;AAMA,OAAO,MAAM,KAAK,GAChB,OAAkD,IAElD,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,188 @@
1
+ /**
2
+ * Codecs for the TypeSafe System One API.
3
+ *
4
+ * @since 4.0.0
5
+ */
6
+ import * as Schema from "effect/Schema";
7
+ /**
8
+ * A classification question.
9
+ *
10
+ * @category schemas
11
+ * @since 4.0.0
12
+ */
13
+ export declare const ChoiceQuestion: Schema.Struct<{
14
+ readonly type: Schema.Literal<"choice">;
15
+ readonly instructions: Schema.String;
16
+ readonly criteria: Schema.$Record<Schema.String, Schema.String>;
17
+ }>;
18
+ /**
19
+ * An ordered rating question.
20
+ *
21
+ * @category schemas
22
+ * @since 4.0.0
23
+ */
24
+ export declare const ScoreQuestion: Schema.Struct<{
25
+ readonly type: Schema.Literal<"score">;
26
+ readonly instructions: Schema.String;
27
+ readonly criteria: Schema.$Array<Schema.String>;
28
+ }>;
29
+ /**
30
+ * A probability question.
31
+ *
32
+ * @category schemas
33
+ * @since 4.0.0
34
+ */
35
+ export declare const NoulQuestion: Schema.Struct<{
36
+ readonly type: Schema.Literal<"noul">;
37
+ readonly instructions: Schema.String;
38
+ readonly criteria: Schema.optional<Schema.Struct<{
39
+ readonly false: Schema.String;
40
+ readonly true: Schema.String;
41
+ }>>;
42
+ }>;
43
+ /**
44
+ * A System One question.
45
+ *
46
+ * @category schemas
47
+ * @since 4.0.0
48
+ */
49
+ export declare const Question: Schema.Union<readonly [Schema.Struct<{
50
+ readonly type: Schema.Literal<"choice">;
51
+ readonly instructions: Schema.String;
52
+ readonly criteria: Schema.$Record<Schema.String, Schema.String>;
53
+ }>, Schema.Struct<{
54
+ readonly type: Schema.Literal<"score">;
55
+ readonly instructions: Schema.String;
56
+ readonly criteria: Schema.$Array<Schema.String>;
57
+ }>, Schema.Struct<{
58
+ readonly type: Schema.Literal<"noul">;
59
+ readonly instructions: Schema.String;
60
+ readonly criteria: Schema.optional<Schema.Struct<{
61
+ readonly false: Schema.String;
62
+ readonly true: Schema.String;
63
+ }>>;
64
+ }>]>;
65
+ /**
66
+ * A batch of questions against encoded state.
67
+ *
68
+ * @category schemas
69
+ * @since 4.0.0
70
+ */
71
+ export declare const SystemOneRequest: Schema.Struct<{
72
+ readonly model: Schema.String;
73
+ readonly state: Schema.Codec<Schema.Json, Schema.Json, never, never>;
74
+ readonly questions: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Struct<{
75
+ readonly type: Schema.Literal<"choice">;
76
+ readonly instructions: Schema.String;
77
+ readonly criteria: Schema.$Record<Schema.String, Schema.String>;
78
+ }>, Schema.Struct<{
79
+ readonly type: Schema.Literal<"score">;
80
+ readonly instructions: Schema.String;
81
+ readonly criteria: Schema.$Array<Schema.String>;
82
+ }>, Schema.Struct<{
83
+ readonly type: Schema.Literal<"noul">;
84
+ readonly instructions: Schema.String;
85
+ readonly criteria: Schema.optional<Schema.Struct<{
86
+ readonly false: Schema.String;
87
+ readonly true: Schema.String;
88
+ }>>;
89
+ }>]>>;
90
+ }>;
91
+ /**
92
+ * A classification distribution.
93
+ *
94
+ * @category schemas
95
+ * @since 4.0.0
96
+ */
97
+ export declare const ChoiceAnswer: Schema.Struct<{
98
+ readonly type: Schema.Literal<"choice">;
99
+ readonly choice: Schema.String;
100
+ readonly probabilities: Schema.$Record<Schema.String, Schema.Number>;
101
+ readonly confidence: Schema.Number;
102
+ }>;
103
+ /**
104
+ * A zero-based rating and index-keyed distribution.
105
+ *
106
+ * @category schemas
107
+ * @since 4.0.0
108
+ */
109
+ export declare const ScoreAnswer: Schema.Struct<{
110
+ readonly type: Schema.Literal<"score">;
111
+ readonly score: Schema.Number;
112
+ readonly probabilities: Schema.$Record<Schema.String, Schema.Number>;
113
+ readonly confidence: Schema.Number;
114
+ readonly legend: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
115
+ }>;
116
+ /**
117
+ * A Bernoulli probability.
118
+ *
119
+ * @category schemas
120
+ * @since 4.0.0
121
+ */
122
+ export declare const NoulAnswer: Schema.Struct<{
123
+ readonly type: Schema.Literal<"noul">;
124
+ readonly noul: Schema.Number;
125
+ }>;
126
+ /**
127
+ * A System One answer.
128
+ *
129
+ * @category schemas
130
+ * @since 4.0.0
131
+ */
132
+ export declare const Answer: Schema.Union<readonly [Schema.Struct<{
133
+ readonly type: Schema.Literal<"choice">;
134
+ readonly choice: Schema.String;
135
+ readonly probabilities: Schema.$Record<Schema.String, Schema.Number>;
136
+ readonly confidence: Schema.Number;
137
+ }>, Schema.Struct<{
138
+ readonly type: Schema.Literal<"score">;
139
+ readonly score: Schema.Number;
140
+ readonly probabilities: Schema.$Record<Schema.String, Schema.Number>;
141
+ readonly confidence: Schema.Number;
142
+ readonly legend: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
143
+ }>, Schema.Struct<{
144
+ readonly type: Schema.Literal<"noul">;
145
+ readonly noul: Schema.Number;
146
+ }>]>;
147
+ /**
148
+ * Answers and token usage for a batch.
149
+ *
150
+ * @category schemas
151
+ * @since 4.0.0
152
+ */
153
+ export declare const SystemOneResponse: Schema.Struct<{
154
+ readonly model: Schema.String;
155
+ readonly answers: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Struct<{
156
+ readonly type: Schema.Literal<"choice">;
157
+ readonly choice: Schema.String;
158
+ readonly probabilities: Schema.$Record<Schema.String, Schema.Number>;
159
+ readonly confidence: Schema.Number;
160
+ }>, Schema.Struct<{
161
+ readonly type: Schema.Literal<"score">;
162
+ readonly score: Schema.Number;
163
+ readonly probabilities: Schema.$Record<Schema.String, Schema.Number>;
164
+ readonly confidence: Schema.Number;
165
+ readonly legend: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
166
+ }>, Schema.Struct<{
167
+ readonly type: Schema.Literal<"noul">;
168
+ readonly noul: Schema.Number;
169
+ }>]>>;
170
+ readonly usage: Schema.optional<Schema.Struct<{
171
+ readonly input_tokens: Schema.optional<Schema.Number>;
172
+ readonly output_tokens: Schema.optional<Schema.Number>;
173
+ }>>;
174
+ }>;
175
+ /**
176
+ * Available TypeSafe models.
177
+ *
178
+ * @category schemas
179
+ * @since 4.0.0
180
+ */
181
+ export declare const ListModelsResponse: Schema.Struct<{
182
+ readonly models: Schema.$Array<Schema.Struct<{
183
+ readonly name: Schema.String;
184
+ readonly description: Schema.optional<Schema.String>;
185
+ readonly release_date: Schema.optional<Schema.String>;
186
+ }>>;
187
+ }>;
188
+ //# sourceMappingURL=TypeSafeSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypeSafeSchema.d.ts","sourceRoot":"","sources":["../src/TypeSafeSchema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,cAAc;;;;EAIzB,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa;;;;EAIxB,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY;;;;;;;EAIvB,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;IAA8D,CAAA;AAEnF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;EAI3B,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY;;;;;EAKvB,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW;;;;;;EAMtB,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU;;;EAAuE,CAAA;AAE9F;;;;;GAKG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;IAAwD,CAAA;AAE3E;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;EAO5B,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;;;;EAM7B,CAAA"}
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Codecs for the TypeSafe System One API.
3
+ *
4
+ * @since 4.0.0
5
+ */
6
+ import * as Schema from "effect/Schema";
7
+ /**
8
+ * A classification question.
9
+ *
10
+ * @category schemas
11
+ * @since 4.0.0
12
+ */
13
+ export const ChoiceQuestion = /*#__PURE__*/Schema.Struct({
14
+ type: /*#__PURE__*/Schema.Literal("choice"),
15
+ instructions: Schema.String,
16
+ criteria: /*#__PURE__*/Schema.Record(Schema.String, Schema.String)
17
+ });
18
+ /**
19
+ * An ordered rating question.
20
+ *
21
+ * @category schemas
22
+ * @since 4.0.0
23
+ */
24
+ export const ScoreQuestion = /*#__PURE__*/Schema.Struct({
25
+ type: /*#__PURE__*/Schema.Literal("score"),
26
+ instructions: Schema.String,
27
+ criteria: /*#__PURE__*/Schema.Array(Schema.String)
28
+ });
29
+ /**
30
+ * A probability question.
31
+ *
32
+ * @category schemas
33
+ * @since 4.0.0
34
+ */
35
+ export const NoulQuestion = /*#__PURE__*/Schema.Struct({
36
+ type: /*#__PURE__*/Schema.Literal("noul"),
37
+ instructions: Schema.String,
38
+ criteria: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Struct({
39
+ false: Schema.String,
40
+ true: Schema.String
41
+ }))
42
+ });
43
+ /**
44
+ * A System One question.
45
+ *
46
+ * @category schemas
47
+ * @since 4.0.0
48
+ */
49
+ export const Question = /*#__PURE__*/Schema.Union([ChoiceQuestion, ScoreQuestion, NoulQuestion]);
50
+ /**
51
+ * A batch of questions against encoded state.
52
+ *
53
+ * @category schemas
54
+ * @since 4.0.0
55
+ */
56
+ export const SystemOneRequest = /*#__PURE__*/Schema.Struct({
57
+ model: Schema.String,
58
+ state: Schema.Json,
59
+ questions: /*#__PURE__*/Schema.Record(Schema.String, Question)
60
+ });
61
+ /**
62
+ * A classification distribution.
63
+ *
64
+ * @category schemas
65
+ * @since 4.0.0
66
+ */
67
+ export const ChoiceAnswer = /*#__PURE__*/Schema.Struct({
68
+ type: /*#__PURE__*/Schema.Literal("choice"),
69
+ choice: Schema.String,
70
+ probabilities: /*#__PURE__*/Schema.Record(Schema.String, Schema.Number),
71
+ confidence: Schema.Number
72
+ });
73
+ /**
74
+ * A zero-based rating and index-keyed distribution.
75
+ *
76
+ * @category schemas
77
+ * @since 4.0.0
78
+ */
79
+ export const ScoreAnswer = /*#__PURE__*/Schema.Struct({
80
+ type: /*#__PURE__*/Schema.Literal("score"),
81
+ score: Schema.Number,
82
+ probabilities: /*#__PURE__*/Schema.Record(Schema.String, Schema.Number),
83
+ confidence: Schema.Number,
84
+ legend: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Record(Schema.String, Schema.String))
85
+ });
86
+ /**
87
+ * A Bernoulli probability.
88
+ *
89
+ * @category schemas
90
+ * @since 4.0.0
91
+ */
92
+ export const NoulAnswer = /*#__PURE__*/Schema.Struct({
93
+ type: /*#__PURE__*/Schema.Literal("noul"),
94
+ noul: Schema.Number
95
+ });
96
+ /**
97
+ * A System One answer.
98
+ *
99
+ * @category schemas
100
+ * @since 4.0.0
101
+ */
102
+ export const Answer = /*#__PURE__*/Schema.Union([ChoiceAnswer, ScoreAnswer, NoulAnswer]);
103
+ /**
104
+ * Answers and token usage for a batch.
105
+ *
106
+ * @category schemas
107
+ * @since 4.0.0
108
+ */
109
+ export const SystemOneResponse = /*#__PURE__*/Schema.Struct({
110
+ model: Schema.String,
111
+ answers: /*#__PURE__*/Schema.Record(Schema.String, Answer),
112
+ usage: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Struct({
113
+ input_tokens: /*#__PURE__*/Schema.optional(Schema.Number),
114
+ output_tokens: /*#__PURE__*/Schema.optional(Schema.Number)
115
+ }))
116
+ });
117
+ /**
118
+ * Available TypeSafe models.
119
+ *
120
+ * @category schemas
121
+ * @since 4.0.0
122
+ */
123
+ export const ListModelsResponse = /*#__PURE__*/Schema.Struct({
124
+ models: /*#__PURE__*/Schema.Array(/*#__PURE__*/Schema.Struct({
125
+ name: Schema.String,
126
+ description: /*#__PURE__*/Schema.optional(Schema.String),
127
+ release_date: /*#__PURE__*/Schema.optional(Schema.String)
128
+ }))
129
+ });
130
+ //# sourceMappingURL=TypeSafeSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypeSafeSchema.js","names":[],"sources":["../src/TypeSafeSchema.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;AAKA,OAAO,KAAK,MAAM,MAAM,eAAe;AAEvC;;;;;;AAMA,OAAO,MAAM,cAAc,gBAAG,MAAM,CAAC,MAAM,CAAC;EAC1C,IAAI,eAAE,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC;EAC9B,YAAY,EAAE,MAAM,CAAC,MAAM;EAC3B,QAAQ,eAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM;CACrD,CAAC;AAEF;;;;;;AAMA,OAAO,MAAM,aAAa,gBAAG,MAAM,CAAC,MAAM,CAAC;EACzC,IAAI,eAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;EAC7B,YAAY,EAAE,MAAM,CAAC,MAAM;EAC3B,QAAQ,eAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM;CACrC,CAAC;AAEF;;;;;;AAMA,OAAO,MAAM,YAAY,gBAAG,MAAM,CAAC,MAAM,CAAC;EACxC,IAAI,eAAE,MAAM,CAAC,OAAO,CAAC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export * as TypeSafeConfig from "./TypeSafeConfig.ts";
12
+ /**
13
+ * @since 4.0.0
14
+ */
15
+ export * as TypeSafeDecisionModel from "./TypeSafeDecisionModel.ts";
16
+ /**
17
+ * @since 4.0.0
18
+ */
19
+ export * as TypeSafeSchema from "./TypeSafeSchema.ts";
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA;AAErD;;GAEG;AACH,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA;AAErD;;GAEG;AACH,OAAO,KAAK,qBAAqB,MAAM,4BAA4B,CAAA;AAEnE;;GAEG;AACH,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @since 4.0.0
3
+ */
4
+ // @barrel
5
+ /**
6
+ * @since 4.0.0
7
+ */
8
+ export * as TypeSafeClient from "./TypeSafeClient.js";
9
+ /**
10
+ * @since 4.0.0
11
+ */
12
+ export * as TypeSafeConfig from "./TypeSafeConfig.js";
13
+ /**
14
+ * @since 4.0.0
15
+ */
16
+ export * as TypeSafeDecisionModel from "./TypeSafeDecisionModel.js";
17
+ /**
18
+ * @since 4.0.0
19
+ */
20
+ export * as TypeSafeSchema from "./TypeSafeSchema.js";
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAIA;AAEA;;;AAGA,OAAO,KAAK,cAAc,MAAM,qBAAqB;AAErD;;;AAGA,OAAO,KAAK,cAAc,MAAM,qBAAqB;AAErD;;;AAGA,OAAO,KAAK,qBAAqB,MAAM,4BAA4B;AAEnE;;;AAGA,OAAO,KAAK,cAAc,MAAM,qBAAqB","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Schema from "effect/Schema";
3
+ import * as AiError from "effect/unstable/ai/AiError";
4
+ import type * as HttpClientError from "effect/unstable/http/HttpClientError";
5
+ export declare const mapSchemaError: (error: Schema.SchemaError, method: string) => AiError.AiError;
6
+ export declare const mapHttpClientError: (error: HttpClientError.HttpClientError, method: string) => Effect.Effect<never, AiError.AiError, never>;
7
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/internal/errors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAIvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,4BAA4B,CAAA;AACrD,OAAO,KAAK,KAAK,eAAe,MAAM,sCAAsC,CAAA;AAoC5E,eAAO,MAAM,cAAc,UAAW,MAAM,CAAC,WAAW,UAAU,MAAM,KAAG,OAAO,CAAC,OAK/E,CAAA;AAEJ,eAAO,MAAM,kBAAkB,0GA8D9B,CAAA"}
@@ -0,0 +1,120 @@
1
+ import * as Duration from "effect/Duration";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Num from "effect/Number";
4
+ import * as Option from "effect/Option";
5
+ import * as Redactable from "effect/Redactable";
6
+ import * as Schema from "effect/Schema";
7
+ import * as AiError from "effect/unstable/ai/AiError";
8
+ const requestDetails = request => ({
9
+ method: request.method,
10
+ url: request.url,
11
+ urlParams: Array.from(request.urlParams),
12
+ hash: Option.getOrUndefined(request.hash),
13
+ headers: Redactable.redact(request.headers)
14
+ });
15
+ const ErrorBody = /*#__PURE__*/Schema.Struct({
16
+ message: /*#__PURE__*/Schema.optional(Schema.String),
17
+ type: /*#__PURE__*/Schema.optional(Schema.String),
18
+ code: /*#__PURE__*/Schema.optional(Schema.String)
19
+ });
20
+ const decodeErrorBody = /*#__PURE__*/Schema.decodeUnknownOption(ErrorBody);
21
+ const nonNegative = value => {
22
+ if (value === undefined) return undefined;
23
+ const parsed = Option.getOrUndefined(Num.parse(value));
24
+ return parsed !== undefined && Number.isFinite(parsed) && parsed >= 0 ? parsed : undefined;
25
+ };
26
+ const retryAfter = headers => {
27
+ const ms = nonNegative(headers["retry-after-ms"]);
28
+ if (ms !== undefined) return Duration.millis(ms);
29
+ const raw = headers["retry-after"];
30
+ if (raw === undefined || raw.trim() === "") return undefined;
31
+ const seconds = nonNegative(raw);
32
+ if (seconds !== undefined) return Duration.seconds(seconds);
33
+ const date = Date.parse(raw);
34
+ return Number.isNaN(date) ? undefined : Duration.millis(Math.max(0, date - Date.now()));
35
+ };
36
+ export const mapSchemaError = (error, method) => AiError.make({
37
+ module: "TypeSafeClient",
38
+ method,
39
+ reason: AiError.InvalidOutputError.fromSchemaError(error)
40
+ });
41
+ export const mapHttpClientError = /*#__PURE__*/Effect.fnUntraced(function* (error, method) {
42
+ const source = error.reason;
43
+ let reason;
44
+ switch (source._tag) {
45
+ case "TransportError":
46
+ case "EncodeError":
47
+ case "InvalidUrlError":
48
+ reason = new AiError.NetworkError({
49
+ reason: source._tag,
50
+ description: source.description,
51
+ request: requestDetails(source.request)
52
+ });
53
+ break;
54
+ case "DecodeError":
55
+ case "EmptyBodyError":
56
+ reason = new AiError.InvalidOutputError({
57
+ description: source.description ?? "Failed to decode TypeSafe response"
58
+ });
59
+ break;
60
+ case "StatusCodeError":
61
+ {
62
+ const {
63
+ request,
64
+ response
65
+ } = source;
66
+ const body = yield* response.text.pipe(Effect.catch(() => Effect.succeed(source.description)));
67
+ const parsed = yield* Effect.try(() => JSON.parse(body ?? "")).pipe(Effect.orElseSucceed(() => undefined));
68
+ const details = Option.getOrUndefined(decodeErrorBody(parsed));
69
+ const http = {
70
+ request: requestDetails(request),
71
+ response: {
72
+ status: response.status,
73
+ headers: Redactable.redact(response.headers)
74
+ },
75
+ body
76
+ };
77
+ const description = AiError.buildErrorDescription({
78
+ status: response.status,
79
+ method: request.method,
80
+ url: request.url,
81
+ body,
82
+ message: details?.message,
83
+ errorCode: details?.code,
84
+ errorType: details?.type,
85
+ requestId: response.headers["x-typesafe-request-id"]
86
+ });
87
+ if (response.status === 429) {
88
+ reason = new AiError.RateLimitError({
89
+ retryAfter: retryAfter(response.headers),
90
+ http,
91
+ metadata: {
92
+ typesafe: {
93
+ requestId: response.headers["x-typesafe-request-id"] ?? null,
94
+ errorCode: details?.code ?? null,
95
+ errorType: details?.type ?? null
96
+ }
97
+ }
98
+ });
99
+ } else if (response.status === 404 || response.status === 422) {
100
+ reason = new AiError.InvalidRequestError({
101
+ description,
102
+ http
103
+ });
104
+ } else {
105
+ reason = AiError.reasonFromHttpStatus({
106
+ status: response.status,
107
+ description,
108
+ http
109
+ });
110
+ }
111
+ break;
112
+ }
113
+ }
114
+ return yield* AiError.make({
115
+ module: "TypeSafeClient",
116
+ method,
117
+ reason
118
+ });
119
+ });
120
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","names":[],"sources":["../../src/internal/errors.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,iBAAiB;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe;AACvC,OAAO,KAAK,GAAG,MAAM,eAAe;AACpC,OAAO,KAAK,MAAM,MAAM,eAAe;AACvC,OAAO,KAAK,UAAU,MAAM,mBAAmB;AAC/C,OAAO,KAAK,MAAM,MAAM,eAAe;AACvC,OAAO,KAAK,OAAO,MAAM,4BAA4B;AAIrD,MAAM,cAAc,GAAI,OAA4C,KAAM;EACxE,MAAM,EAAE,OAAO,CAAC,MAAM;EACtB,GAAG,EAAE,OAAO,CAAC,GAAG;EAChB,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;EACxC,IAAI,EAAE,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC;EACzC,OAAO,EAAE,UAAU,CAAC,MAA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