@codeworksh/plugin 0.0.1-dev.20260922103030

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 (93) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +111 -0
  3. package/error-ClDISWlT.d.mts +11 -0
  4. package/event-rIZpnOTo.d.mts +895 -0
  5. package/event.d.mts +2 -0
  6. package/event.mjs +125 -0
  7. package/event.mjs.map +1 -0
  8. package/filesystem-Cp-KapCE.d.mts +142 -0
  9. package/ids-CHjmAdTc.d.mts +43 -0
  10. package/ids.d.mts +2 -0
  11. package/ids.mjs +48 -0
  12. package/ids.mjs.map +1 -0
  13. package/index.d.mts +3 -0
  14. package/index.mjs +3 -0
  15. package/io-BYs7hbiY.d.mts +497 -0
  16. package/location-D4hAfuXF.d.mts +61 -0
  17. package/location.d.mts +2 -0
  18. package/location.mjs +48 -0
  19. package/location.mjs.map +1 -0
  20. package/package.json +200 -0
  21. package/plugin/prompt.d.mts +2 -0
  22. package/plugin/prompt.mjs +7 -0
  23. package/plugin/prompt.mjs.map +1 -0
  24. package/plugin/tool.d.mts +2 -0
  25. package/plugin/tool.mjs +29 -0
  26. package/plugin/tool.mjs.map +1 -0
  27. package/plugin-DbJEpY3M.d.mts +140 -0
  28. package/plugin-lorpq7Oi.mjs +41 -0
  29. package/plugin-lorpq7Oi.mjs.map +1 -0
  30. package/plugin.d.mts +4 -0
  31. package/plugin.mjs +4 -0
  32. package/posix.d.mts +6 -0
  33. package/posix.mjs +8 -0
  34. package/posix.mjs.map +1 -0
  35. package/project-CLGsIFD-.d.mts +21 -0
  36. package/project.d.mts +2 -0
  37. package/project.mjs +22 -0
  38. package/project.mjs.map +1 -0
  39. package/prompt-BcpagjGh.d.mts +10 -0
  40. package/repo.d.mts +42 -0
  41. package/repo.mjs +46 -0
  42. package/repo.mjs.map +1 -0
  43. package/rolldown-runtime-D7D4PA-g.mjs +13 -0
  44. package/sandbox/driver.d.mts +2 -0
  45. package/sandbox/driver.mjs +63 -0
  46. package/sandbox/driver.mjs.map +1 -0
  47. package/sandbox/error.d.mts +7 -0
  48. package/sandbox/error.mjs +15 -0
  49. package/sandbox/error.mjs.map +1 -0
  50. package/sandbox/errors.d.mts +2 -0
  51. package/sandbox/errors.mjs +160 -0
  52. package/sandbox/errors.mjs.map +1 -0
  53. package/sandbox/filesystem.d.mts +2 -0
  54. package/sandbox/filesystem.mjs +142 -0
  55. package/sandbox/filesystem.mjs.map +1 -0
  56. package/sandbox/instance.d.mts +2 -0
  57. package/sandbox/instance.mjs +144 -0
  58. package/sandbox/instance.mjs.map +1 -0
  59. package/sandbox/io.d.mts +2 -0
  60. package/sandbox/io.mjs +127 -0
  61. package/sandbox/io.mjs.map +1 -0
  62. package/sandbox/resource.d.mts +28 -0
  63. package/sandbox/resource.mjs +29 -0
  64. package/sandbox/resource.mjs.map +1 -0
  65. package/sandbox/shell.d.mts +2 -0
  66. package/sandbox/shell.mjs +93 -0
  67. package/sandbox/shell.mjs.map +1 -0
  68. package/sandbox.d.mts +17 -0
  69. package/sandbox.mjs +39 -0
  70. package/sandbox.mjs.map +1 -0
  71. package/schema.d.mts +91 -0
  72. package/schema.mjs +105 -0
  73. package/schema.mjs.map +1 -0
  74. package/settings-CYL6yyDD.d.mts +193 -0
  75. package/settings.d.mts +2 -0
  76. package/settings.mjs +102 -0
  77. package/settings.mjs.map +1 -0
  78. package/shell-CZ6Y4lNU.d.mts +109 -0
  79. package/space-CR-9UxdT.d.mts +25 -0
  80. package/space.d.mts +2 -0
  81. package/space.mjs +33 -0
  82. package/space.mjs.map +1 -0
  83. package/tool/error.d.mts +2 -0
  84. package/tool/error.mjs +11 -0
  85. package/tool/error.mjs.map +1 -0
  86. package/tool/progress.d.mts +2 -0
  87. package/tool/progress.mjs +11 -0
  88. package/tool/progress.mjs.map +1 -0
  89. package/tool-BoVqkYvL.d.mts +287 -0
  90. package/tool-DuYBgiJf.d.mts +142 -0
  91. package/tool.d.mts +2 -0
  92. package/tool.mjs +71 -0
  93. package/tool.mjs.map +1 -0
package/schema.d.mts ADDED
@@ -0,0 +1,91 @@
1
+ import { Message } from "@codeworksh/aikit";
2
+ import { Schema } from "effect";
3
+ //#region src/schema.d.ts
4
+ /** Validate an aikit message without coercing or rewriting durable data. */
5
+ export declare const validateAikitMessage: (value: unknown, label: string) => Message.Message;
6
+ export declare const validateAikitUserMessage: (value: unknown, label: string) => Message.UserMessage;
7
+ export declare const validateAikitAssistantMessage: (value: unknown, label: string) => Message.AssistantMessage;
8
+ export declare const validateAikitToolCallTerminalPart: (value: unknown, label: string) => Message.ToolCallTerminalPart;
9
+ export declare const isAikitAssistantMessage: (value: unknown) => value is Message.AssistantMessage;
10
+ export declare const isAikitToolCallTerminalPart: (value: unknown) => value is Message.ToolCallTerminalPart;
11
+ /**
12
+ * Integer greater than zero.
13
+ */
14
+ export declare const PositiveInt: Schema.Int;
15
+ /**
16
+ * Integer greater than or equal to zero.
17
+ */
18
+ export declare const NonNegativeInt: Schema.Int;
19
+ /**
20
+ * Cost greater than or equal with finite value
21
+ */
22
+ export declare const NonNegativeCost: Schema.Finite;
23
+ /**
24
+ * Absolute POSIX file path (e.g., `/home/user/projects/myapp/src/main.ts`).
25
+ */
26
+ export declare const AbsolutePath: Schema.brand<Schema.String, "AbsolutePath">;
27
+ export type AbsolutePath = Schema.Schema.Type<typeof AbsolutePath>;
28
+ /**
29
+ * Optional public JSON field that can hold explicit `undefined` on the type
30
+ * side but encodes it as an omitted key, matching legacy `JSON.stringify`.
31
+ */
32
+ export declare const optional: <S extends Schema.Top>(schema: S) => Schema.decodeTo<Schema.optional<Schema.toType<S>>, Schema.optionalKey<S>, never, never>;
33
+ /**
34
+ * Strip `readonly` from a nested type. Stand-in for `effect`'s `Types.DeepMutable`
35
+ * until `effect:core/x228my` ("Types.DeepMutable widens unknown to `{}`") lands.
36
+ *
37
+ * The upstream version falls through `unknown` into `{ -readonly [K in keyof T]: ... }`
38
+ * where `keyof unknown = never`, so `unknown` collapses to `{}`. This local
39
+ * version gates the object branch on `extends object` (which `unknown` does
40
+ * not) so `unknown` passes through untouched.
41
+ *
42
+ * Primitive bailout matches upstream — without it, branded strings like
43
+ * `string & Brand<"SessionID">` fall into the object branch and get their
44
+ * prototype methods walked.
45
+ *
46
+ * Tuple branch preserves readonly tuples (e.g. `ConfigPlugin.Spec`'s
47
+ * `readonly [string, Options]`); the general array branch would otherwise
48
+ * widen them to unbounded arrays.
49
+ */
50
+ export type DeepMutable<T> = T extends string | number | boolean | bigint | symbol | Function ? T : T extends readonly [unknown, ...unknown[]] ? { -readonly [K in keyof T]: DeepMutable<T[K]>; } : T extends readonly (infer U)[] ? DeepMutable<U>[] : T extends object ? { -readonly [K in keyof T]: DeepMutable<T[K]>; } : T;
51
+ /**
52
+ * Attach static methods to a schema object. Designed to be used with `.pipe()`:
53
+ *
54
+ * @example
55
+ * export const Foo = fooSchema.pipe(
56
+ * withStatics((schema) => ({
57
+ * zero: schema.make(0),
58
+ * from: Schema.decodeUnknownOption(schema),
59
+ * }))
60
+ * )
61
+ */
62
+ export declare const withStatics: <S extends object, M extends Record<string, unknown>>(methods: (schema: S) => M) => (schema: S) => S & M;
63
+ /**
64
+ * Nominal wrapper for scalar types. The class itself is a valid schema —
65
+ * pass it directly to `Schema.decode`, `Schema.decodeEffect`, etc.
66
+ *
67
+ * Overrides `~type.make` on the derived `Schema.Opaque` so `Schema.Schema.Type`
68
+ * of a field using this newtype resolves to `Self` rather than the underlying
69
+ * branded phantom. Without that override, passing a class instance to code
70
+ * typed against `Schema.Schema.Type<FieldSchema>` would require a cast even
71
+ * though the values are structurally equivalent at runtime.
72
+ *
73
+ * @example
74
+ * class QuestionID extends Newtype<QuestionID>()("QuestionID", Schema.String) {
75
+ * static make(id: string): QuestionID {
76
+ * return this.make(id)
77
+ * }
78
+ * }
79
+ *
80
+ * Schema.decodeEffect(QuestionID)(input)
81
+ */
82
+ export declare function Newtype<Self>(): <const Tag extends string, S extends Schema.Top>(tag: Tag, schema: S) => (abstract new (_: never) => {
83
+ readonly _newtype: Tag;
84
+ }) & {
85
+ readonly make: (value: Schema.Schema.Type<S>) => Self;
86
+ } & Omit<Schema.Opaque<Self, S, {}>, "make" | "~type.make"> & {
87
+ readonly "~type.make": Self;
88
+ };
89
+ export declare const DateTimeUtcFromMillis: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
90
+ //#endregion
91
+ //# sourceMappingURL=schema.d.mts.map
package/schema.mjs ADDED
@@ -0,0 +1,105 @@
1
+ import { Message } from "@codeworksh/aikit";
2
+ import { DateTime, Option, Schema, SchemaGetter } from "effect";
3
+ import TypeBoxSchema from "typebox/schema";
4
+ //#region src/schema.ts
5
+ const aikitValidators = /* @__PURE__ */ new WeakMap();
6
+ const aikitValidatorFor = (schema) => {
7
+ const cached = aikitValidators.get(schema);
8
+ if (cached !== void 0) return cached;
9
+ const compiled = TypeBoxSchema.Compile(schema);
10
+ aikitValidators.set(schema, compiled);
11
+ return compiled;
12
+ };
13
+ const aikitErrorPath = (error) => {
14
+ if (error.instancePath) return error.instancePath.substring(1);
15
+ const required = error.params?.requiredProperties;
16
+ return Array.isArray(required) ? required.join(", ") : "root";
17
+ };
18
+ const validateAikitSchema = (schema, value, label) => {
19
+ const validator = aikitValidatorFor(schema);
20
+ if (validator.Check(value)) return value;
21
+ const [, issues] = validator.Errors(value);
22
+ const details = issues.map((issue) => ` - ${aikitErrorPath(issue)}: ${issue.message}`).join("\n") || "unknown error";
23
+ throw new Error(`validation failed for ${label}\n${details}`);
24
+ };
25
+ /** Validate an aikit message without coercing or rewriting durable data. */
26
+ const validateAikitMessage = (value, label) => validateAikitSchema(Message.MessageSchema, value, label);
27
+ const validateAikitUserMessage = (value, label) => validateAikitSchema(Message.UserMessageSchema, value, label);
28
+ const validateAikitAssistantMessage = (value, label) => validateAikitSchema(Message.AssistantMessageSchema, value, label);
29
+ const validateAikitToolCallTerminalPart = (value, label) => validateAikitSchema(Message.ToolCallTerminalPartSchema, value, label);
30
+ const isAikitAssistantMessage = (value) => aikitValidatorFor(Message.AssistantMessageSchema).Check(value);
31
+ const isAikitToolCallTerminalPart = (value) => aikitValidatorFor(Message.ToolCallTerminalPartSchema).Check(value);
32
+ /**
33
+ * Integer greater than zero.
34
+ */
35
+ const PositiveInt = Schema.Int.check(Schema.isGreaterThan(0));
36
+ /**
37
+ * Integer greater than or equal to zero.
38
+ */
39
+ const NonNegativeInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
40
+ /**
41
+ * Cost greater than or equal with finite value
42
+ */
43
+ const NonNegativeCost = Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0));
44
+ /**
45
+ * Absolute POSIX file path (e.g., `/home/user/projects/myapp/src/main.ts`).
46
+ */
47
+ const AbsolutePath = Schema.String.check(Schema.isPattern(/^\//)).pipe(Schema.brand("AbsolutePath"));
48
+ /**
49
+ * Optional public JSON field that can hold explicit `undefined` on the type
50
+ * side but encodes it as an omitted key, matching legacy `JSON.stringify`.
51
+ */
52
+ const optional = (schema) => Schema.optionalKey(schema).pipe(Schema.decodeTo(Schema.optional(Schema.toType(schema)), {
53
+ decode: SchemaGetter.passthrough({ strict: false }),
54
+ encode: SchemaGetter.transformOptional(Option.filter((value) => value !== void 0))
55
+ }));
56
+ /**
57
+ * Attach static methods to a schema object. Designed to be used with `.pipe()`:
58
+ *
59
+ * @example
60
+ * export const Foo = fooSchema.pipe(
61
+ * withStatics((schema) => ({
62
+ * zero: schema.make(0),
63
+ * from: Schema.decodeUnknownOption(schema),
64
+ * }))
65
+ * )
66
+ */
67
+ const withStatics = (methods) => (schema) => Object.assign(schema, methods(schema));
68
+ /**
69
+ * Nominal wrapper for scalar types. The class itself is a valid schema —
70
+ * pass it directly to `Schema.decode`, `Schema.decodeEffect`, etc.
71
+ *
72
+ * Overrides `~type.make` on the derived `Schema.Opaque` so `Schema.Schema.Type`
73
+ * of a field using this newtype resolves to `Self` rather than the underlying
74
+ * branded phantom. Without that override, passing a class instance to code
75
+ * typed against `Schema.Schema.Type<FieldSchema>` would require a cast even
76
+ * though the values are structurally equivalent at runtime.
77
+ *
78
+ * @example
79
+ * class QuestionID extends Newtype<QuestionID>()("QuestionID", Schema.String) {
80
+ * static make(id: string): QuestionID {
81
+ * return this.make(id)
82
+ * }
83
+ * }
84
+ *
85
+ * Schema.decodeEffect(QuestionID)(input)
86
+ */
87
+ function Newtype() {
88
+ return (tag, schema) => {
89
+ class Base {
90
+ static make(value) {
91
+ return value;
92
+ }
93
+ }
94
+ Object.setPrototypeOf(Base, schema);
95
+ return Base;
96
+ };
97
+ }
98
+ const DateTimeUtcFromMillis = Schema.Finite.pipe(Schema.decodeTo(Schema.DateTimeUtc, {
99
+ decode: SchemaGetter.transform((value) => DateTime.makeUnsafe(value)),
100
+ encode: SchemaGetter.transform((value) => DateTime.toEpochMillis(value))
101
+ }));
102
+ //#endregion
103
+ export { AbsolutePath, DateTimeUtcFromMillis, Newtype, NonNegativeCost, NonNegativeInt, PositiveInt, isAikitAssistantMessage, isAikitToolCallTerminalPart, optional, validateAikitAssistantMessage, validateAikitMessage, validateAikitToolCallTerminalPart, validateAikitUserMessage, withStatics };
104
+
105
+ //# sourceMappingURL=schema.mjs.map
package/schema.mjs.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.mjs","names":[],"sources":["../../src/schema.ts"],"sourcesContent":["import { Message } from \"@codeworksh/aikit\";\nimport { DateTime, Option, Schema, SchemaGetter } from \"effect\";\nimport type { Static, TSchema } from \"typebox\";\nimport TypeBoxSchema from \"typebox/schema\";\n\nconst aikitValidators = new WeakMap<TSchema, ReturnType<typeof TypeBoxSchema.Compile>>();\n\nconst aikitValidatorFor = <T extends TSchema>(schema: T): ReturnType<typeof TypeBoxSchema.Compile<T>> => {\n\tconst cached = aikitValidators.get(schema) as ReturnType<typeof TypeBoxSchema.Compile<T>> | undefined;\n\tif (cached !== undefined) return cached;\n\tconst compiled = TypeBoxSchema.Compile(schema);\n\taikitValidators.set(schema, compiled);\n\treturn compiled;\n};\n\nconst aikitErrorPath = (error: {\n\treadonly instancePath?: string;\n\treadonly params?: Record<string, unknown>;\n}): string => {\n\tif (error.instancePath) return error.instancePath.substring(1);\n\tconst required = error.params?.requiredProperties;\n\treturn Array.isArray(required) ? required.join(\", \") : \"root\";\n};\n\nconst validateAikitSchema = <T extends TSchema>(schema: T, value: unknown, label: string): Static<T> => {\n\tconst validator = aikitValidatorFor(schema);\n\tif (validator.Check(value)) return value;\n\n\tconst [, issues] = validator.Errors(value);\n\tconst details = issues.map((issue) => ` - ${aikitErrorPath(issue)}: ${issue.message}`).join(\"\\n\") || \"unknown error\";\n\tthrow new Error(`validation failed for ${label}\\n${details}`);\n};\n\n/** Validate an aikit message without coercing or rewriting durable data. */\nexport const validateAikitMessage = (value: unknown, label: string): Message.Message =>\n\tvalidateAikitSchema(Message.MessageSchema, value, label);\n\nexport const validateAikitUserMessage = (value: unknown, label: string): Message.UserMessage =>\n\tvalidateAikitSchema(Message.UserMessageSchema, value, label);\n\nexport const validateAikitAssistantMessage = (value: unknown, label: string): Message.AssistantMessage =>\n\tvalidateAikitSchema(Message.AssistantMessageSchema, value, label);\n\nexport const validateAikitToolCallTerminalPart = (value: unknown, label: string): Message.ToolCallTerminalPart =>\n\tvalidateAikitSchema(Message.ToolCallTerminalPartSchema, value, label);\n\nexport const isAikitAssistantMessage = (value: unknown): value is Message.AssistantMessage =>\n\taikitValidatorFor(Message.AssistantMessageSchema).Check(value);\n\nexport const isAikitToolCallTerminalPart = (value: unknown): value is Message.ToolCallTerminalPart =>\n\taikitValidatorFor(Message.ToolCallTerminalPartSchema).Check(value);\n\n/**\n * Integer greater than zero.\n */\nexport const PositiveInt = Schema.Int.check(Schema.isGreaterThan(0));\n\n/**\n * Integer greater than or equal to zero.\n */\nexport const NonNegativeInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));\n\n/**\n * Cost greater than or equal with finite value\n */\nexport const NonNegativeCost = Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0));\n\n/**\n * Absolute POSIX file path (e.g., `/home/user/projects/myapp/src/main.ts`).\n */\nexport const AbsolutePath = Schema.String.check(Schema.isPattern(/^\\//)).pipe(Schema.brand(\"AbsolutePath\"));\nexport type AbsolutePath = Schema.Schema.Type<typeof AbsolutePath>;\n\n/**\n * Optional public JSON field that can hold explicit `undefined` on the type\n * side but encodes it as an omitted key, matching legacy `JSON.stringify`.\n */\nexport const optional = <S extends Schema.Top>(schema: S) =>\n\tSchema.optionalKey(schema).pipe(\n\t\tSchema.decodeTo(Schema.optional(Schema.toType(schema)), {\n\t\t\tdecode: SchemaGetter.passthrough({ strict: false }),\n\t\t\tencode: SchemaGetter.transformOptional(Option.filter((value) => value !== undefined)),\n\t\t}),\n\t);\n\n/**\n * Strip `readonly` from a nested type. Stand-in for `effect`'s `Types.DeepMutable`\n * until `effect:core/x228my` (\"Types.DeepMutable widens unknown to `{}`\") lands.\n *\n * The upstream version falls through `unknown` into `{ -readonly [K in keyof T]: ... }`\n * where `keyof unknown = never`, so `unknown` collapses to `{}`. This local\n * version gates the object branch on `extends object` (which `unknown` does\n * not) so `unknown` passes through untouched.\n *\n * Primitive bailout matches upstream — without it, branded strings like\n * `string & Brand<\"SessionID\">` fall into the object branch and get their\n * prototype methods walked.\n *\n * Tuple branch preserves readonly tuples (e.g. `ConfigPlugin.Spec`'s\n * `readonly [string, Options]`); the general array branch would otherwise\n * widen them to unbounded arrays.\n */\nexport type DeepMutable<T> = T extends string | number | boolean | bigint | symbol | Function\n\t? T\n\t: T extends readonly [unknown, ...unknown[]]\n\t\t? { -readonly [K in keyof T]: DeepMutable<T[K]> }\n\t\t: T extends readonly (infer U)[]\n\t\t\t? DeepMutable<U>[]\n\t\t\t: T extends object\n\t\t\t\t? { -readonly [K in keyof T]: DeepMutable<T[K]> }\n\t\t\t\t: T;\n\n/**\n * Attach static methods to a schema object. Designed to be used with `.pipe()`:\n *\n * @example\n * export const Foo = fooSchema.pipe(\n * withStatics((schema) => ({\n * zero: schema.make(0),\n * from: Schema.decodeUnknownOption(schema),\n * }))\n * )\n */\nexport const withStatics =\n\t<S extends object, M extends Record<string, unknown>>(methods: (schema: S) => M) =>\n\t(schema: S): S & M =>\n\t\tObject.assign(schema, methods(schema));\n\n/**\n * Nominal wrapper for scalar types. The class itself is a valid schema —\n * pass it directly to `Schema.decode`, `Schema.decodeEffect`, etc.\n *\n * Overrides `~type.make` on the derived `Schema.Opaque` so `Schema.Schema.Type`\n * of a field using this newtype resolves to `Self` rather than the underlying\n * branded phantom. Without that override, passing a class instance to code\n * typed against `Schema.Schema.Type<FieldSchema>` would require a cast even\n * though the values are structurally equivalent at runtime.\n *\n * @example\n * class QuestionID extends Newtype<QuestionID>()(\"QuestionID\", Schema.String) {\n * static make(id: string): QuestionID {\n * return this.make(id)\n * }\n * }\n *\n * Schema.decodeEffect(QuestionID)(input)\n */\nexport function Newtype<Self>() {\n\treturn <const Tag extends string, S extends Schema.Top>(tag: Tag, schema: S) => {\n\t\tabstract class Base {\n\t\t\tdeclare readonly _newtype: Tag;\n\n\t\t\tstatic make(value: Schema.Schema.Type<S>): Self {\n\t\t\t\treturn value as unknown as Self;\n\t\t\t}\n\t\t}\n\n\t\tObject.setPrototypeOf(Base, schema);\n\n\t\treturn Base as unknown as (abstract new (_: never) => { readonly _newtype: Tag }) & {\n\t\t\treadonly make: (value: Schema.Schema.Type<S>) => Self;\n\t\t} & Omit<Schema.Opaque<Self, S, {}>, \"make\" | \"~type.make\"> & {\n\t\t\t\treadonly \"~type.make\": Self;\n\t\t\t};\n\t};\n}\n\nexport const DateTimeUtcFromMillis = Schema.Finite.pipe(\n\tSchema.decodeTo(Schema.DateTimeUtc, {\n\t\tdecode: SchemaGetter.transform((value) => DateTime.makeUnsafe(value)),\n\t\tencode: SchemaGetter.transform((value) => DateTime.toEpochMillis(value)),\n\t}),\n);\n"],"mappings":";;;;AAKA,MAAM,kCAAkB,IAAI,QAA2D;AAEvF,MAAM,qBAAwC,WAA2D;CACxG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AC;;;;AAK/E,MAAa,kBAAkB,OAAO,OAAO,MAAM,OAAO,uBAAuB,CAAC,CAAC;;;;AAKnF,MAAa,eAAe,OAAO,OAAO,MAAM,OAAO,UAAU,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM,cAAc,CAAC;;;;;AAO1G,MAAa,YAAkC,WAC9C,OAAO,YAAY,MAAM,CAAC,CAAC,KAC1B,OAAO,SAAS,OAAO,SAAS,OAAO,OAAO,MAAM,CAAC,GAAG;CACvD,QAAQ,aAAa,YAAY,EAAE,QAAQ,MAAM,CAAC;CAClD,QAAQ,aAAa,kBAAkB,OAAO,QAAQ,UAAU,UAAU,KAAA,CAAS,CAAC;AACrF,CAAC,CACF;;;;;;;;;;;;AAwCD,MAAa,eAC0C,aACrD,WACA,OAAO,OAAO,QAAQ,QAAQ,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;AAqBvC,SAAgB,UAAgB;CAC/B,QAAwD,KAAU,WAAc;EAC/E,MAAe,KAAK;GAGnB,OAAO,KAAK,OAAoC;IAC/C,OAAO;GACR;EACD;EAEA,OAAO,eAAe,MAAM,MAAM;EAElC,OAAO;CAKR;AACD;AAEA,MAAa,wBAAwB,OAAO,OAAO,KAClD,OAAO,SAAS,OAAO,aAAa;CACnC,QAAQ,aAAa,WAAW,UAAU,SAAS,WAAW,KAAK,CAAC;CACpE,QAAQ,aAAa,WAAW,UAAU,SAAS,cAAc,KAAK,CAAC;AACxE,CAAC,CACF"}
@@ -0,0 +1,193 @@
1
+ import { Model } from "@codeworksh/aikit";
2
+ import { Schema } from "effect";
3
+ //#region src/settings.d.ts
4
+ declare const ThinkingLevel: Schema.Literals<("high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh")[]>;
5
+ declare const ToolExecution: Schema.Literals<readonly ["sequential", "parallel"]>;
6
+ type ToolExecution = typeof ToolExecution.Type;
7
+ /** Aikit does not export its request schema; keep this routing surface checked against its public types. */
8
+ declare const requestFields: {
9
+ temperature: Schema.optional<Schema.Finite>;
10
+ maxTokens: Schema.optional<Schema.Finite>;
11
+ cacheRetention: Schema.optional<Schema.Literals<readonly ["none", "short", "long"]>>;
12
+ headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
13
+ timeoutMs: Schema.optional<Schema.Finite>;
14
+ maxRetries: Schema.optional<Schema.Finite>;
15
+ metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
16
+ thinkingBudgets: Schema.optional<Schema.$Record<Schema.Literals<("high" | "low" | "max" | "medium" | "minimal" | "xhigh")[]>, Schema.optional<Schema.Finite>>>;
17
+ baseURL: Schema.optional<Schema.String>;
18
+ method: Schema.optional<Schema.Literals<("chat" | "completion" | "completionModel" | "languageModel" | "messages" | "responses")[]>>;
19
+ };
20
+ /** The wire protocol a model speaks, which a catalog entry may have wrong for a local endpoint. */
21
+ declare const ModelProtocol: Schema.Literals<("anthropic" | "google" | "google-vertex" | "google-vertex-anthropic" | "openai" | "openai-codex" | "openai-compatible" | "openrouter" | "xai")[]>;
22
+ declare const Block: Schema.StructWithRest<Schema.Struct<{
23
+ readonly temperature: Schema.optional<Schema.Finite>;
24
+ readonly maxTokens: Schema.optional<Schema.Finite>;
25
+ readonly cacheRetention: Schema.optional<Schema.Literals<readonly ["none", "short", "long"]>>;
26
+ readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
27
+ readonly timeoutMs: Schema.optional<Schema.Finite>;
28
+ readonly maxRetries: Schema.optional<Schema.Finite>;
29
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
30
+ readonly thinkingBudgets: Schema.optional<Schema.$Record<Schema.Literals<("high" | "low" | "max" | "medium" | "minimal" | "xhigh")[]>, Schema.optional<Schema.Finite>>>;
31
+ readonly baseURL: Schema.optional<Schema.String>;
32
+ readonly method: Schema.optional<Schema.Literals<("chat" | "completion" | "completionModel" | "languageModel" | "messages" | "responses")[]>>;
33
+ readonly protocol: Schema.optional<Schema.Literals<("anthropic" | "google" | "google-vertex" | "google-vertex-anthropic" | "openai" | "openai-codex" | "openai-compatible" | "openrouter" | "xai")[]>>;
34
+ readonly thinkingLevel: Schema.optional<Schema.Literals<("high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh")[]>>;
35
+ readonly toolExecution: Schema.optional<Schema.Literals<readonly ["sequential", "parallel"]>>;
36
+ readonly contextWindow: Schema.optional<Schema.Finite>;
37
+ readonly extras: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
38
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>;
39
+ type Block = typeof Block.Type;
40
+ declare const Model$1: Schema.Struct<{
41
+ readonly provider: Schema.optional<Schema.String>;
42
+ readonly id: Schema.optional<Schema.String>;
43
+ readonly thinkingLevel: Schema.optional<Schema.Literals<("high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh")[]>>;
44
+ readonly toolExecution: Schema.optional<Schema.Literals<readonly ["sequential", "parallel"]>>;
45
+ readonly thinkingBudgets: Schema.optional<Schema.$Record<Schema.Literals<("high" | "low" | "max" | "medium" | "minimal" | "xhigh")[]>, Schema.optional<Schema.Finite>>>;
46
+ readonly options: Schema.optional<Schema.StructWithRest<Schema.Struct<{
47
+ readonly temperature: Schema.optional<Schema.Finite>;
48
+ readonly maxTokens: Schema.optional<Schema.Finite>;
49
+ readonly cacheRetention: Schema.optional<Schema.Literals<readonly ["none", "short", "long"]>>;
50
+ readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
51
+ readonly timeoutMs: Schema.optional<Schema.Finite>;
52
+ readonly maxRetries: Schema.optional<Schema.Finite>;
53
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
54
+ readonly thinkingBudgets: Schema.optional<Schema.$Record<Schema.Literals<("high" | "low" | "max" | "medium" | "minimal" | "xhigh")[]>, Schema.optional<Schema.Finite>>>;
55
+ readonly baseURL: Schema.optional<Schema.String>;
56
+ readonly method: Schema.optional<Schema.Literals<("chat" | "completion" | "completionModel" | "languageModel" | "messages" | "responses")[]>>;
57
+ readonly protocol: Schema.optional<Schema.Literals<("anthropic" | "google" | "google-vertex" | "google-vertex-anthropic" | "openai" | "openai-codex" | "openai-compatible" | "openrouter" | "xai")[]>>;
58
+ readonly thinkingLevel: Schema.optional<Schema.Literals<("high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh")[]>>;
59
+ readonly toolExecution: Schema.optional<Schema.Literals<readonly ["sequential", "parallel"]>>;
60
+ readonly contextWindow: Schema.optional<Schema.Finite>;
61
+ readonly extras: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
62
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>;
63
+ readonly providerOptions: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.StructWithRest<Schema.Struct<{
64
+ readonly temperature: Schema.optional<Schema.Finite>;
65
+ readonly maxTokens: Schema.optional<Schema.Finite>;
66
+ readonly cacheRetention: Schema.optional<Schema.Literals<readonly ["none", "short", "long"]>>;
67
+ readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
68
+ readonly timeoutMs: Schema.optional<Schema.Finite>;
69
+ readonly maxRetries: Schema.optional<Schema.Finite>;
70
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
71
+ readonly thinkingBudgets: Schema.optional<Schema.$Record<Schema.Literals<("high" | "low" | "max" | "medium" | "minimal" | "xhigh")[]>, Schema.optional<Schema.Finite>>>;
72
+ readonly baseURL: Schema.optional<Schema.String>;
73
+ readonly method: Schema.optional<Schema.Literals<("chat" | "completion" | "completionModel" | "languageModel" | "messages" | "responses")[]>>;
74
+ readonly protocol: Schema.optional<Schema.Literals<("anthropic" | "google" | "google-vertex" | "google-vertex-anthropic" | "openai" | "openai-codex" | "openai-compatible" | "openrouter" | "xai")[]>>;
75
+ readonly thinkingLevel: Schema.optional<Schema.Literals<("high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh")[]>>;
76
+ readonly toolExecution: Schema.optional<Schema.Literals<readonly ["sequential", "parallel"]>>;
77
+ readonly contextWindow: Schema.optional<Schema.Finite>;
78
+ readonly extras: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
79
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>>>;
80
+ }>;
81
+ declare const PluginPatch: Schema.Union<readonly [Schema.Struct<{
82
+ readonly enabled: Schema.optional<Schema.Boolean>;
83
+ readonly options: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
84
+ readonly plugin: Schema.String;
85
+ }>, Schema.Struct<{
86
+ readonly enabled: Schema.optional<Schema.Boolean>;
87
+ readonly options: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
88
+ readonly package: Schema.String;
89
+ }>]>;
90
+ declare const PluginEntry: Schema.Union<readonly [Schema.String, Schema.Union<readonly [Schema.Struct<{
91
+ readonly enabled: Schema.optional<Schema.Boolean>;
92
+ readonly options: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
93
+ readonly plugin: Schema.String;
94
+ }>, Schema.Struct<{
95
+ readonly enabled: Schema.optional<Schema.Boolean>;
96
+ readonly options: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
97
+ readonly package: Schema.String;
98
+ }>]>]>;
99
+ type PluginEntry = typeof PluginEntry.Type;
100
+ declare const Patch: Schema.Struct<{
101
+ readonly $schema: Schema.optional<Schema.String>;
102
+ readonly plugins: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.String, Schema.Union<readonly [Schema.Struct<{
103
+ readonly enabled: Schema.optional<Schema.Boolean>;
104
+ readonly options: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
105
+ readonly plugin: Schema.String;
106
+ }>, Schema.Struct<{
107
+ readonly enabled: Schema.optional<Schema.Boolean>;
108
+ readonly options: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
109
+ readonly package: Schema.String;
110
+ }>]>]>>>;
111
+ readonly model: Schema.optional<Schema.Struct<{
112
+ readonly provider: Schema.optional<Schema.String>;
113
+ readonly id: Schema.optional<Schema.String>;
114
+ readonly thinkingLevel: Schema.optional<Schema.Literals<("high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh")[]>>;
115
+ readonly toolExecution: Schema.optional<Schema.Literals<readonly ["sequential", "parallel"]>>;
116
+ readonly thinkingBudgets: Schema.optional<Schema.$Record<Schema.Literals<("high" | "low" | "max" | "medium" | "minimal" | "xhigh")[]>, Schema.optional<Schema.Finite>>>;
117
+ readonly options: Schema.optional<Schema.StructWithRest<Schema.Struct<{
118
+ readonly temperature: Schema.optional<Schema.Finite>;
119
+ readonly maxTokens: Schema.optional<Schema.Finite>;
120
+ readonly cacheRetention: Schema.optional<Schema.Literals<readonly ["none", "short", "long"]>>;
121
+ readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
122
+ readonly timeoutMs: Schema.optional<Schema.Finite>;
123
+ readonly maxRetries: Schema.optional<Schema.Finite>;
124
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
125
+ readonly thinkingBudgets: Schema.optional<Schema.$Record<Schema.Literals<("high" | "low" | "max" | "medium" | "minimal" | "xhigh")[]>, Schema.optional<Schema.Finite>>>;
126
+ readonly baseURL: Schema.optional<Schema.String>;
127
+ readonly method: Schema.optional<Schema.Literals<("chat" | "completion" | "completionModel" | "languageModel" | "messages" | "responses")[]>>;
128
+ readonly protocol: Schema.optional<Schema.Literals<("anthropic" | "google" | "google-vertex" | "google-vertex-anthropic" | "openai" | "openai-codex" | "openai-compatible" | "openrouter" | "xai")[]>>;
129
+ readonly thinkingLevel: Schema.optional<Schema.Literals<("high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh")[]>>;
130
+ readonly toolExecution: Schema.optional<Schema.Literals<readonly ["sequential", "parallel"]>>;
131
+ readonly contextWindow: Schema.optional<Schema.Finite>;
132
+ readonly extras: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
133
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>;
134
+ readonly providerOptions: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.StructWithRest<Schema.Struct<{
135
+ readonly temperature: Schema.optional<Schema.Finite>;
136
+ readonly maxTokens: Schema.optional<Schema.Finite>;
137
+ readonly cacheRetention: Schema.optional<Schema.Literals<readonly ["none", "short", "long"]>>;
138
+ readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
139
+ readonly timeoutMs: Schema.optional<Schema.Finite>;
140
+ readonly maxRetries: Schema.optional<Schema.Finite>;
141
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
142
+ readonly thinkingBudgets: Schema.optional<Schema.$Record<Schema.Literals<("high" | "low" | "max" | "medium" | "minimal" | "xhigh")[]>, Schema.optional<Schema.Finite>>>;
143
+ readonly baseURL: Schema.optional<Schema.String>;
144
+ readonly method: Schema.optional<Schema.Literals<("chat" | "completion" | "completionModel" | "languageModel" | "messages" | "responses")[]>>;
145
+ readonly protocol: Schema.optional<Schema.Literals<("anthropic" | "google" | "google-vertex" | "google-vertex-anthropic" | "openai" | "openai-codex" | "openai-compatible" | "openrouter" | "xai")[]>>;
146
+ readonly thinkingLevel: Schema.optional<Schema.Literals<("high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh")[]>>;
147
+ readonly toolExecution: Schema.optional<Schema.Literals<readonly ["sequential", "parallel"]>>;
148
+ readonly contextWindow: Schema.optional<Schema.Finite>;
149
+ readonly extras: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
150
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>>>;
151
+ }>>;
152
+ }>;
153
+ type Patch = typeof Patch.Type;
154
+ /**
155
+ * One plugin entry, and where it came from.
156
+ *
157
+ * Flattening every layer's `plugins` into one array loses the file that declared each entry, and
158
+ * that cannot be recovered afterwards: two layers may declare the same string, so attribution is
159
+ * genuinely gone rather than merely inconvenient. Three things need it -- anchoring a relative
160
+ * path, naming the declaring layer in `plugin list`, and the missing-plugin diagnostic -- so the
161
+ * loaded shape carries it from the start.
162
+ */
163
+ interface Declared {
164
+ /** The entry exactly as the file spells it, which is the string a person will search for. */
165
+ readonly written: PluginEntry;
166
+ /** The same entry with any relative path anchored to the directory of its declaring file. */
167
+ readonly entry: PluginEntry;
168
+ /** The settings file that declared it. */
169
+ readonly file: string;
170
+ }
171
+ interface Info {
172
+ /**
173
+ * Plugin entries added to the harness selection, in order: every layer's entries, lowest
174
+ * priority first, so a project's list extends the user's rather than replacing it.
175
+ *
176
+ * Anchored, and stripped of provenance: this is the list the loader consumes. {@link Info.declared}
177
+ * is the same list with the file each entry came from.
178
+ */
179
+ readonly plugins: ReadonlyArray<PluginEntry>;
180
+ /** {@link Info.plugins}, with the origin of each entry. Same order, same length. */
181
+ readonly declared: ReadonlyArray<Declared>;
182
+ readonly model: typeof Model$1.Type & {
183
+ readonly provider: string;
184
+ readonly id: string;
185
+ readonly thinkingLevel: Model.ThinkingLevel;
186
+ readonly toolExecution: ToolExecution;
187
+ };
188
+ }
189
+ /** Let aikit supply model-aware generation defaults. */
190
+ declare const defaults: Info;
191
+ //#endregion
192
+ export { ModelProtocol as a, PluginPatch as c, defaults as d, requestFields as f, Model$1 as i, ThinkingLevel as l, Declared as n, Patch as o, Info as r, PluginEntry as s, Block as t, ToolExecution as u };
193
+ //# sourceMappingURL=settings-CYL6yyDD.d.mts.map
package/settings.d.mts ADDED
@@ -0,0 +1,2 @@
1
+ import { a as ModelProtocol, c as PluginPatch, d as defaults, f as requestFields, i as Model, l as ThinkingLevel, n as Declared, o as Patch, r as Info, s as PluginEntry, t as Block, u as ToolExecution } from "./settings-CYL6yyDD.mjs";
2
+ export { Block, Declared, Info, Model, ModelProtocol, Patch, PluginEntry, PluginPatch, ThinkingLevel, ToolExecution, defaults, requestFields };
package/settings.mjs ADDED
@@ -0,0 +1,102 @@
1
+ import { Model as Model$1 } from "@codeworksh/aikit";
2
+ import { Schema } from "effect";
3
+ //#region src/settings.ts
4
+ const ThinkingLevel = Schema.Literals(Object.values(Model$1.ThinkingLevelEnum));
5
+ const ToolExecution = Schema.Literals(["sequential", "parallel"]);
6
+ const Budgets = Schema.Record(Schema.Literals(Object.values(Model$1.ThinkingLevelEnum).filter((level) => level !== "off")), Schema.optional(Schema.Finite));
7
+ /** Aikit does not export its request schema; keep this routing surface checked against its public types. */
8
+ const requestFields = {
9
+ temperature: Schema.optional(Schema.Finite),
10
+ maxTokens: Schema.optional(Schema.Finite),
11
+ cacheRetention: Schema.optional(Schema.Literals([
12
+ "none",
13
+ "short",
14
+ "long"
15
+ ])),
16
+ headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),
17
+ timeoutMs: Schema.optional(Schema.Finite),
18
+ maxRetries: Schema.optional(Schema.Finite),
19
+ metadata: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
20
+ thinkingBudgets: Schema.optional(Budgets),
21
+ baseURL: Schema.optional(Schema.String),
22
+ method: Schema.optional(Schema.Literals(Object.values(Model$1.APIMethodEnum)))
23
+ };
24
+ const reserved = /* @__PURE__ */ new Set([
25
+ "toolChoice",
26
+ "activeTools",
27
+ "provider",
28
+ "id",
29
+ "signal",
30
+ "sessionId",
31
+ "reasoning",
32
+ "modelId",
33
+ "apiKey",
34
+ "onPayload",
35
+ "api",
36
+ "npm",
37
+ "providerOptionsKey",
38
+ "compat",
39
+ "thinkingLevelMap"
40
+ ]);
41
+ /** The wire protocol a model speaks, which a catalog entry may have wrong for a local endpoint. */
42
+ const ModelProtocol = Schema.Literals(Object.values(Model$1.KnownProviderEnum));
43
+ const Block = Schema.StructWithRest(Schema.Struct({
44
+ ...requestFields,
45
+ protocol: Schema.optional(ModelProtocol),
46
+ thinkingLevel: Schema.optional(ThinkingLevel),
47
+ toolExecution: Schema.optional(ToolExecution),
48
+ contextWindow: Schema.optional(Schema.Finite),
49
+ extras: Schema.optional(Schema.Record(Schema.String, Schema.Unknown))
50
+ }), [Schema.Record(Schema.String, Schema.Unknown)]).check(Schema.makeFilter((value) => Object.keys(value).every((key) => !reserved.has(key)) || "Reserved configuration key in model options"));
51
+ const Model = Schema.Struct({
52
+ provider: Schema.optional(Schema.String),
53
+ id: Schema.optional(Schema.String),
54
+ thinkingLevel: Schema.optional(ThinkingLevel),
55
+ toolExecution: Schema.optional(ToolExecution),
56
+ thinkingBudgets: Schema.optional(Budgets),
57
+ options: Schema.optional(Block),
58
+ providerOptions: Schema.optional(Schema.Record(Schema.String, Schema.Record(Schema.String, Block)))
59
+ });
60
+ /** A module to load: a path, a `file:` URL, or a package spec. */
61
+ const PluginReference = Schema.String.check(Schema.isNonEmpty());
62
+ /**
63
+ * Configuration for a plugin something else already selected, named by its ID (`plugin`) or by
64
+ * its registered module string (`package`). It never loads anything: an entry naming a plugin
65
+ * that is not in the selection is ignored.
66
+ */
67
+ const config = {
68
+ enabled: Schema.optional(Schema.Boolean),
69
+ options: Schema.optional(Schema.Record(Schema.String, Schema.Unknown))
70
+ };
71
+ const PluginPatch = Schema.Union([Schema.Struct({
72
+ plugin: PluginReference,
73
+ ...config
74
+ }), Schema.Struct({
75
+ package: PluginReference,
76
+ ...config
77
+ })], { mode: "oneOf" });
78
+ const PluginEntry = Schema.Union([PluginReference, PluginPatch]);
79
+ const Patch = Schema.Struct({
80
+ $schema: Schema.optional(Schema.String),
81
+ plugins: Schema.optional(Schema.Array(PluginEntry)),
82
+ model: Schema.optional(Model)
83
+ });
84
+ /** Let aikit supply model-aware generation defaults. */
85
+ const defaults = {
86
+ plugins: [],
87
+ declared: [],
88
+ model: {
89
+ provider: "openai",
90
+ id: "gpt-5.6-luna",
91
+ thinkingLevel: "high",
92
+ toolExecution: "sequential",
93
+ options: {
94
+ timeoutMs: 36e5,
95
+ maxRetries: 3
96
+ }
97
+ }
98
+ };
99
+ //#endregion
100
+ export { Block, Model, ModelProtocol, Patch, PluginEntry, PluginPatch, ThinkingLevel, ToolExecution, defaults, requestFields };
101
+
102
+ //# sourceMappingURL=settings.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.mjs","names":["AikitModel"],"sources":["../../src/settings.ts"],"sourcesContent":["import { Model as AikitModel, type Protocol } from \"@codeworksh/aikit\";\nimport { Schema } from \"effect\";\n\nexport const ThinkingLevel = Schema.Literals(Object.values(AikitModel.ThinkingLevelEnum));\nexport const ToolExecution = Schema.Literals([\"sequential\", \"parallel\"]);\nexport type ToolExecution = typeof ToolExecution.Type;\nconst Budgets = Schema.Record(\n\tSchema.Literals(Object.values(AikitModel.ThinkingLevelEnum).filter((level) => level !== \"off\")),\n\tSchema.optional(Schema.Finite),\n);\n\n/** Aikit does not export its request schema; keep this routing surface checked against its public types. */\nexport const requestFields = {\n\ttemperature: Schema.optional(Schema.Finite),\n\tmaxTokens: Schema.optional(Schema.Finite),\n\tcacheRetention: Schema.optional(Schema.Literals([\"none\", \"short\", \"long\"])),\n\theaders: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n\ttimeoutMs: Schema.optional(Schema.Finite),\n\tmaxRetries: Schema.optional(Schema.Finite),\n\tmetadata: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),\n\tthinkingBudgets: Schema.optional(Budgets),\n\tbaseURL: Schema.optional(Schema.String),\n\tmethod: Schema.optional(Schema.Literals(Object.values(AikitModel.APIMethodEnum))),\n} satisfies Record<\n\t| Exclude<keyof Protocol.CommonOptions, \"signal\" | \"sessionId\" | \"reasoning\" | \"apiKey\" | \"onPayload\">\n\t| \"baseURL\"\n\t| \"method\",\n\tSchema.Top\n>;\n\nconst reserved = new Set([\n\t\"toolChoice\",\n\t\"activeTools\",\n\t\"provider\",\n\t\"id\",\n\t\"signal\",\n\t\"sessionId\",\n\t\"reasoning\",\n\t\"modelId\",\n\t\"apiKey\",\n\t\"onPayload\",\n\t\"api\",\n\t\"npm\",\n\t\"providerOptionsKey\",\n\t\"compat\",\n\t\"thinkingLevelMap\",\n]);\n\n/** The wire protocol a model speaks, which a catalog entry may have wrong for a local endpoint. */\nexport const ModelProtocol = Schema.Literals(Object.values(AikitModel.KnownProviderEnum));\n\nexport const Block = Schema.StructWithRest(\n\tSchema.Struct({\n\t\t...requestFields,\n\t\tprotocol: Schema.optional(ModelProtocol),\n\t\tthinkingLevel: Schema.optional(ThinkingLevel),\n\t\ttoolExecution: Schema.optional(ToolExecution),\n\t\tcontextWindow: Schema.optional(Schema.Finite),\n\t\textras: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),\n\t}),\n\t[Schema.Record(Schema.String, Schema.Unknown)],\n).check(\n\tSchema.makeFilter(\n\t\t(value) => Object.keys(value).every((key) => !reserved.has(key)) || \"Reserved configuration key in model options\",\n\t),\n);\nexport type Block = typeof Block.Type;\n\nexport const Model = Schema.Struct({\n\tprovider: Schema.optional(Schema.String),\n\tid: Schema.optional(Schema.String),\n\tthinkingLevel: Schema.optional(ThinkingLevel),\n\ttoolExecution: Schema.optional(ToolExecution),\n\tthinkingBudgets: Schema.optional(Budgets),\n\toptions: Schema.optional(Block),\n\tproviderOptions: Schema.optional(Schema.Record(Schema.String, Schema.Record(Schema.String, Block))),\n});\n/** A module to load: a path, a `file:` URL, or a package spec. */\nconst PluginReference = Schema.String.check(Schema.isNonEmpty());\n/**\n * Configuration for a plugin something else already selected, named by its ID (`plugin`) or by\n * its registered module string (`package`). It never loads anything: an entry naming a plugin\n * that is not in the selection is ignored.\n */\nconst config = {\n\tenabled: Schema.optional(Schema.Boolean),\n\toptions: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),\n};\nexport const PluginPatch = Schema.Union(\n\t[Schema.Struct({ plugin: PluginReference, ...config }), Schema.Struct({ package: PluginReference, ...config })],\n\t// `oneOf`, so an entry carrying both keys is a decode failure rather than one of them being\n\t// quietly dropped -- naming a plugin two ways at once says two different things.\n\t{ mode: \"oneOf\" },\n);\nexport const PluginEntry = Schema.Union([PluginReference, PluginPatch]);\nexport type PluginEntry = typeof PluginEntry.Type;\n\nexport const Patch = Schema.Struct({\n\t$schema: Schema.optional(Schema.String),\n\tplugins: Schema.optional(Schema.Array(PluginEntry)),\n\tmodel: Schema.optional(Model),\n});\nexport type Patch = typeof Patch.Type;\n\n/**\n * One plugin entry, and where it came from.\n *\n * Flattening every layer's `plugins` into one array loses the file that declared each entry, and\n * that cannot be recovered afterwards: two layers may declare the same string, so attribution is\n * genuinely gone rather than merely inconvenient. Three things need it -- anchoring a relative\n * path, naming the declaring layer in `plugin list`, and the missing-plugin diagnostic -- so the\n * loaded shape carries it from the start.\n */\nexport interface Declared {\n\t/** The entry exactly as the file spells it, which is the string a person will search for. */\n\treadonly written: PluginEntry;\n\t/** The same entry with any relative path anchored to the directory of its declaring file. */\n\treadonly entry: PluginEntry;\n\t/** The settings file that declared it. */\n\treadonly file: string;\n}\n\nexport interface Info {\n\t/**\n\t * Plugin entries added to the harness selection, in order: every layer's entries, lowest\n\t * priority first, so a project's list extends the user's rather than replacing it.\n\t *\n\t * Anchored, and stripped of provenance: this is the list the loader consumes. {@link Info.declared}\n\t * is the same list with the file each entry came from.\n\t */\n\treadonly plugins: ReadonlyArray<PluginEntry>;\n\t/** {@link Info.plugins}, with the origin of each entry. Same order, same length. */\n\treadonly declared: ReadonlyArray<Declared>;\n\treadonly model: typeof Model.Type & {\n\t\treadonly provider: string;\n\t\treadonly id: string;\n\t\treadonly thinkingLevel: AikitModel.ThinkingLevel;\n\t\treadonly toolExecution: ToolExecution;\n\t};\n}\n\n/** Let aikit supply model-aware generation defaults. */\nexport const defaults: Info = {\n\tplugins: [],\n\tdeclared: [],\n\tmodel: {\n\t\tprovider: \"openai\",\n\t\tid: \"gpt-5.6-luna\",\n\t\tthinkingLevel: \"high\",\n\t\ttoolExecution: \"sequential\",\n\t\toptions: { timeoutMs: 3_600_000, maxRetries: 3 },\n\t},\n};\n"],"mappings":";;;AAGA,MAAa,gBAAgB,OAAO,SAAS,OAAO,OAAOA,QAAW,iBAAiB,CAAC;AACxF,MAAa,gBAAgB,OAAO,SAAS,CAAC,cAAc,UAAU,CAAC;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