@dahura/super-agent-runtime 0.1.1

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 (98) hide show
  1. package/LICENSE +21 -0
  2. package/dist/ask.d.ts +75 -0
  3. package/dist/ask.d.ts.map +1 -0
  4. package/dist/ask.js +140 -0
  5. package/dist/ask.js.map +1 -0
  6. package/dist/builder.d.ts +73 -0
  7. package/dist/builder.d.ts.map +1 -0
  8. package/dist/builder.js +477 -0
  9. package/dist/builder.js.map +1 -0
  10. package/dist/env.d.ts +36 -0
  11. package/dist/env.d.ts.map +1 -0
  12. package/dist/env.js +63 -0
  13. package/dist/env.js.map +1 -0
  14. package/dist/errors.d.ts +40 -0
  15. package/dist/errors.d.ts.map +1 -0
  16. package/dist/errors.js +43 -0
  17. package/dist/errors.js.map +1 -0
  18. package/dist/index.d.ts +30 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +21 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/loaders.d.ts +39 -0
  23. package/dist/loaders.d.ts.map +1 -0
  24. package/dist/loaders.js +113 -0
  25. package/dist/loaders.js.map +1 -0
  26. package/dist/model.d.ts +64 -0
  27. package/dist/model.d.ts.map +1 -0
  28. package/dist/model.js +2 -0
  29. package/dist/model.js.map +1 -0
  30. package/dist/providers/anthropic.d.ts +14 -0
  31. package/dist/providers/anthropic.d.ts.map +1 -0
  32. package/dist/providers/anthropic.js +19 -0
  33. package/dist/providers/anthropic.js.map +1 -0
  34. package/dist/providers/anthropic.provider.d.ts +22 -0
  35. package/dist/providers/anthropic.provider.d.ts.map +1 -0
  36. package/dist/providers/anthropic.provider.js +62 -0
  37. package/dist/providers/anthropic.provider.js.map +1 -0
  38. package/dist/providers/audio-local.d.ts +21 -0
  39. package/dist/providers/audio-local.d.ts.map +1 -0
  40. package/dist/providers/audio-local.js +451 -0
  41. package/dist/providers/audio-local.js.map +1 -0
  42. package/dist/providers/audio-local.provider.d.ts +15 -0
  43. package/dist/providers/audio-local.provider.d.ts.map +1 -0
  44. package/dist/providers/audio-local.provider.js +137 -0
  45. package/dist/providers/audio-local.provider.js.map +1 -0
  46. package/dist/providers/index.d.ts +30 -0
  47. package/dist/providers/index.d.ts.map +1 -0
  48. package/dist/providers/index.js +56 -0
  49. package/dist/providers/index.js.map +1 -0
  50. package/dist/providers/llama-server.d.ts +57 -0
  51. package/dist/providers/llama-server.d.ts.map +1 -0
  52. package/dist/providers/llama-server.js +231 -0
  53. package/dist/providers/llama-server.js.map +1 -0
  54. package/dist/providers/llama-server.provider.d.ts +34 -0
  55. package/dist/providers/llama-server.provider.d.ts.map +1 -0
  56. package/dist/providers/llama-server.provider.js +147 -0
  57. package/dist/providers/llama-server.provider.js.map +1 -0
  58. package/dist/providers/openai-compatible.d.ts +32 -0
  59. package/dist/providers/openai-compatible.d.ts.map +1 -0
  60. package/dist/providers/openai-compatible.js +53 -0
  61. package/dist/providers/openai-compatible.js.map +1 -0
  62. package/dist/providers/openai-compatible.provider.d.ts +24 -0
  63. package/dist/providers/openai-compatible.provider.d.ts.map +1 -0
  64. package/dist/providers/openai-compatible.provider.js +76 -0
  65. package/dist/providers/openai-compatible.provider.js.map +1 -0
  66. package/dist/providers/openai.d.ts +14 -0
  67. package/dist/providers/openai.d.ts.map +1 -0
  68. package/dist/providers/openai.js +24 -0
  69. package/dist/providers/openai.js.map +1 -0
  70. package/dist/providers/openai.provider.d.ts +23 -0
  71. package/dist/providers/openai.provider.d.ts.map +1 -0
  72. package/dist/providers/openai.provider.js +68 -0
  73. package/dist/providers/openai.provider.js.map +1 -0
  74. package/dist/providers/whisper-cpp.d.ts +23 -0
  75. package/dist/providers/whisper-cpp.d.ts.map +1 -0
  76. package/dist/providers/whisper-cpp.js +110 -0
  77. package/dist/providers/whisper-cpp.js.map +1 -0
  78. package/dist/providers/whisper-cpp.provider.d.ts +27 -0
  79. package/dist/providers/whisper-cpp.provider.d.ts.map +1 -0
  80. package/dist/providers/whisper-cpp.provider.js +139 -0
  81. package/dist/providers/whisper-cpp.provider.js.map +1 -0
  82. package/dist/proxy.d.ts +11 -0
  83. package/dist/proxy.d.ts.map +1 -0
  84. package/dist/proxy.js +12 -0
  85. package/dist/proxy.js.map +1 -0
  86. package/dist/registry.d.ts +111 -0
  87. package/dist/registry.d.ts.map +1 -0
  88. package/dist/registry.js +328 -0
  89. package/dist/registry.js.map +1 -0
  90. package/dist/resolver.d.ts +47 -0
  91. package/dist/resolver.d.ts.map +1 -0
  92. package/dist/resolver.js +365 -0
  93. package/dist/resolver.js.map +1 -0
  94. package/dist/workflow.d.ts +86 -0
  95. package/dist/workflow.d.ts.map +1 -0
  96. package/dist/workflow.js +343 -0
  97. package/dist/workflow.js.map +1 -0
  98. package/package.json +57 -0
package/dist/errors.js ADDED
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Typed errors thrown at the runtime boundary. Consumers can `instanceof`
3
+ * them to render targeted UI / take corrective action.
4
+ */
5
+ export class AgentError extends Error {
6
+ name = "AgentError";
7
+ cause;
8
+ constructor(message, cause) {
9
+ super(message);
10
+ this.cause = cause;
11
+ }
12
+ }
13
+ /**
14
+ * Input failed schema validation BEFORE the agent's `run` is invoked.
15
+ * Indicates the consumer passed an unsupported file type, exceeded the
16
+ * declared `max`, etc.
17
+ */
18
+ export class AgentValidationError extends AgentError {
19
+ name = "AgentValidationError";
20
+ }
21
+ /**
22
+ * The model resolver could not find a usable model. Usually one of:
23
+ * - `model.allow` blocks the requested override
24
+ * - all configured providers are unreachable
25
+ * - required env vars (e.g. `WHISPER_CPP_BIN`) are missing
26
+ */
27
+ export class ProviderError extends AgentError {
28
+ name = "ProviderError";
29
+ }
30
+ /**
31
+ * The model returned a response, but it failed output validation against
32
+ * the agent's declared `output.schema`.
33
+ */
34
+ export class OutputValidationError extends AgentError {
35
+ name = "OutputValidationError";
36
+ }
37
+ /**
38
+ * Catch-all for failures inside the model call (HTTP error, timeout, etc).
39
+ */
40
+ export class ModelError extends AgentError {
41
+ name = "ModelError";
42
+ }
43
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,OAAO,UAAW,SAAQ,KAAK;IAC1B,IAAI,GAAG,YAAY,CAAC;IACX,KAAK,CAAW;IAClC,YAAY,OAAe,EAAE,KAAe;QAC1C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,oBAAqB,SAAQ,UAAU;IACzC,IAAI,GAAG,sBAAsB,CAAC;CACxC;AAED;;;;;GAKG;AACH,MAAM,OAAO,aAAc,SAAQ,UAAU;IAClC,IAAI,GAAG,eAAe,CAAC;CACjC;AAED;;;GAGG;AACH,MAAM,OAAO,qBAAsB,SAAQ,UAAU;IAC1C,IAAI,GAAG,uBAAuB,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,UAAU;IAC/B,IAAI,GAAG,YAAY,CAAC;CAC9B"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @dahura/super-agent-runtime — Ask smart object, fluent AgentClient builder, .env
3
+ * model resolver, and providers (local-first: openai-compatible + whisper-cpp;
4
+ * cloud opt-in: openai + anthropic).
5
+ */
6
+ export { Ask } from "./ask";
7
+ export type { AskProducer, AskProduction, AskMeta } from "./ask";
8
+ export { AgentClient } from "./builder";
9
+ export type { AgentClientOptions, ModelResolver } from "./builder";
10
+ export type { ProcessorSelection, SubagentSelection } from "@dahura/super-agent-kit";
11
+ export { createAgentClient } from "./proxy";
12
+ export { WorkflowClient, WorkflowRun, createWorkflowClient } from "./workflow";
13
+ export type { WorkflowClientOptions, WorkflowTraceListener, WorkflowTraceEntry, WorkflowSnapshot, WorkflowStopResult, } from "./workflow";
14
+ export { AgentError, AgentValidationError, ProviderError, OutputValidationError, ModelError, } from "./errors";
15
+ export type { ResolvedModel, CustomInvokeInput, CustomInvokeOutput } from "./model";
16
+ export { normalizeAudio, normalizeImage, normalizeText, normalizeFile, stripPathArtifacts, } from "./loaders";
17
+ export type { SingleAudioInput, SingleImageInput, SingleTextInput, SingleFileInput, AudioBlobInput, ImageBlobInput, FileBlobInput, } from "./loaders";
18
+ export { createResolver, RESOLVER_LOCAL_DEFAULTS } from "./resolver";
19
+ export type { ResolverOptions, LocalBackend } from "./resolver";
20
+ export { exportNameToScreaming, readScopedEnv, readModelAlias, maskSecret, } from "./env";
21
+ export type { EnvSource } from "./env";
22
+ export { probeOpenAICompatible } from "./providers/openai-compatible";
23
+ export type { ProviderProbeResult } from "./providers/openai-compatible";
24
+ export { probeLlamaServer, shutdownAllManagedLlamaServers } from "./providers/llama-server";
25
+ export type { LlamaServerConfig } from "./providers/llama-server";
26
+ export { defaultRegistry, ProviderRegistry, buildProviderConfig, isProviderConfigured, } from "./registry";
27
+ export type { DiscoveredModel, ProviderProbeEntry, BuildConfigOptions, } from "./registry";
28
+ export { llamaServerProvider, whisperCppProvider, openaiCompatibleProvider, openaiProvider, anthropicProvider, registerBuiltinProviders, } from "./providers/index";
29
+ export { resolveBundledVoiceSidecar } from "./providers/audio-local";
30
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,YAAY,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACnE,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAErF,OAAO,EAAE,iBAAiB,EAA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,CAAC;AAGpB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,wBAAwB,EACxB,cAAc,EACd,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @dahura/super-agent-runtime — Ask smart object, fluent AgentClient builder, .env
3
+ * model resolver, and providers (local-first: openai-compatible + whisper-cpp;
4
+ * cloud opt-in: openai + anthropic).
5
+ */
6
+ export { Ask } from "./ask";
7
+ export { AgentClient } from "./builder";
8
+ export { createAgentClient } from "./proxy";
9
+ export { WorkflowClient, WorkflowRun, createWorkflowClient } from "./workflow";
10
+ export { AgentError, AgentValidationError, ProviderError, OutputValidationError, ModelError, } from "./errors";
11
+ export { normalizeAudio, normalizeImage, normalizeText, normalizeFile, stripPathArtifacts, } from "./loaders";
12
+ export { createResolver, RESOLVER_LOCAL_DEFAULTS } from "./resolver";
13
+ export { exportNameToScreaming, readScopedEnv, readModelAlias, maskSecret, } from "./env";
14
+ export { probeOpenAICompatible } from "./providers/openai-compatible";
15
+ export { probeLlamaServer, shutdownAllManagedLlamaServers } from "./providers/llama-server";
16
+ // Provider Registry
17
+ export { defaultRegistry, ProviderRegistry, buildProviderConfig, isProviderConfigured, } from "./registry";
18
+ // Provider definitions (auto-registers with defaultRegistry)
19
+ export { llamaServerProvider, whisperCppProvider, openaiCompatibleProvider, openaiProvider, anthropicProvider, registerBuiltinProviders, } from "./providers/index";
20
+ export { resolveBundledVoiceSidecar } from "./providers/audio-local";
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAG5B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAIxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAS/E,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,aAAa,EACb,qBAAqB,EACrB,UAAU,GACX,MAAM,UAAU,CAAC;AAIlB,OAAO,EACL,cAAc,EACd,cAAc,EACd,aAAa,EACb,aAAa,EACb,kBAAkB,GACnB,MAAM,WAAW,CAAC;AAWnB,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAGrE,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,UAAU,GACX,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAGtE,OAAO,EAAE,gBAAgB,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAG5F,oBAAoB;AACpB,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAOpB,6DAA6D;AAC7D,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,wBAAwB,EACxB,cAAc,EACd,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,39 @@
1
+ import type { InputItem } from "@dahura/super-agent-kit";
2
+ /**
3
+ * Public type for loader input. Each `loadXxx` accepts either a single path /
4
+ * buffer or an array thereof. This avoids the awkward .loadAudio.loadAudio.
5
+ * cascade discussed in the design doc.
6
+ */
7
+ export type SingleAudioInput = string | Uint8Array | AudioBlobInput;
8
+ export type SingleImageInput = string | Uint8Array | ImageBlobInput;
9
+ export type SingleTextInput = string;
10
+ export type SingleFileInput = string | Uint8Array | FileBlobInput;
11
+ export type AudioBlobInput = {
12
+ data: Uint8Array;
13
+ mime: string;
14
+ source?: string;
15
+ };
16
+ export type ImageBlobInput = {
17
+ data: Uint8Array;
18
+ mime: string;
19
+ source?: string;
20
+ };
21
+ export type FileBlobInput = {
22
+ data: Uint8Array;
23
+ mime: string;
24
+ source?: string;
25
+ };
26
+ /**
27
+ * Strip URL/RFC-ish artifacts before parsing extensions. Otherwise timestamps like
28
+ * `chunk.wav#12.04` make naive matchers treat `.04` as the extension (fragment hides `.wav`).
29
+ */
30
+ export declare function stripPathArtifacts(pathLike: string): string;
31
+ /** Normalize a single image input into an InputItem<"image">. */
32
+ export declare function normalizeImage(input: SingleImageInput): Promise<InputItem<"image">>;
33
+ /** Normalize a single audio input into an InputItem<"audio">. */
34
+ export declare function normalizeAudio(input: SingleAudioInput): Promise<InputItem<"audio">>;
35
+ /** Normalize a single text input. Always inline. */
36
+ export declare function normalizeText(input: SingleTextInput): InputItem<"text">;
37
+ /** Normalize a single file input. Mime defaults to application/octet-stream. */
38
+ export declare function normalizeFile(input: SingleFileInput): Promise<InputItem<"file">>;
39
+ //# sourceMappingURL=loaders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loaders.d.ts","sourceRoot":"","sources":["../src/loaders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGzD;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,UAAU,GAAG,cAAc,CAAC;AACpE,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,UAAU,GAAG,cAAc,CAAC;AACpE,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC;AACrC,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,UAAU,GAAG,aAAa,CAAC;AAElE,MAAM,MAAM,cAAc,GAAG;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AACjF,MAAM,MAAM,cAAc,GAAG;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AACjF,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAiBhF;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAG3D;AAiBD,iEAAiE;AACjE,wBAAsB,cAAc,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAqBzF;AAED,iEAAiE;AACjE,wBAAsB,cAAc,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAqBzF;AAED,oDAAoD;AACpD,wBAAgB,aAAa,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,CAAC,MAAM,CAAC,CAMvE;AAED,gFAAgF;AAChF,wBAAsB,aAAa,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAwBtF"}
@@ -0,0 +1,113 @@
1
+ import { AgentValidationError } from "./errors";
2
+ const IMAGE_MIME_BY_EXT = {
3
+ png: "image/png",
4
+ jpg: "image/jpeg",
5
+ jpeg: "image/jpeg",
6
+ webp: "image/webp",
7
+ gif: "image/gif",
8
+ };
9
+ const AUDIO_MIME_BY_EXT = {
10
+ wav: "audio/wav",
11
+ mp3: "audio/mpeg",
12
+ m4a: "audio/mp4",
13
+ flac: "audio/flac",
14
+ ogg: "audio/ogg",
15
+ };
16
+ /**
17
+ * Strip URL/RFC-ish artifacts before parsing extensions. Otherwise timestamps like
18
+ * `chunk.wav#12.04` make naive matchers treat `.04` as the extension (fragment hides `.wav`).
19
+ */
20
+ export function stripPathArtifacts(pathLike) {
21
+ const withoutQuery = pathLike.includes("?") ? pathLike.slice(0, pathLike.indexOf("?")) : pathLike;
22
+ return withoutQuery.includes("#") ? withoutQuery.slice(0, withoutQuery.indexOf("#")) : withoutQuery;
23
+ }
24
+ function inferMimeFromPath(path, table) {
25
+ const ext = stripPathArtifacts(path).toLowerCase().match(/\.([a-z0-9]+)$/)?.[1];
26
+ if (!ext)
27
+ return null;
28
+ return table[ext] ?? null;
29
+ }
30
+ async function readFileToUint8(path) {
31
+ const file = Bun.file(path);
32
+ const exists = await file.exists();
33
+ if (!exists) {
34
+ throw new AgentValidationError(`File not found: ${path}`);
35
+ }
36
+ return new Uint8Array(await file.arrayBuffer());
37
+ }
38
+ /** Normalize a single image input into an InputItem<"image">. */
39
+ export async function normalizeImage(input) {
40
+ if (typeof input === "string") {
41
+ const mime = inferMimeFromPath(input, IMAGE_MIME_BY_EXT);
42
+ if (!mime) {
43
+ throw new AgentValidationError(`Cannot infer image mime from path "${input}" (supported: ${Object.keys(IMAGE_MIME_BY_EXT).join(", ")})`);
44
+ }
45
+ const data = await readFileToUint8(input);
46
+ return { kind: "image", source: input, mime, data, text: null };
47
+ }
48
+ if (input instanceof Uint8Array) {
49
+ return { kind: "image", source: "<inline>", mime: "image/png", data: input, text: null };
50
+ }
51
+ return {
52
+ kind: "image",
53
+ source: input.source ?? "<inline>",
54
+ mime: input.mime,
55
+ data: input.data,
56
+ text: null,
57
+ };
58
+ }
59
+ /** Normalize a single audio input into an InputItem<"audio">. */
60
+ export async function normalizeAudio(input) {
61
+ if (typeof input === "string") {
62
+ const mime = inferMimeFromPath(input, AUDIO_MIME_BY_EXT);
63
+ if (!mime) {
64
+ throw new AgentValidationError(`Cannot infer audio mime from path "${input}" (supported: ${Object.keys(AUDIO_MIME_BY_EXT).join(", ")})`);
65
+ }
66
+ const data = await readFileToUint8(input);
67
+ return { kind: "audio", source: input, mime, data, text: null };
68
+ }
69
+ if (input instanceof Uint8Array) {
70
+ return { kind: "audio", source: "<inline>", mime: "audio/wav", data: input, text: null };
71
+ }
72
+ return {
73
+ kind: "audio",
74
+ source: input.source ?? "<inline>",
75
+ mime: input.mime,
76
+ data: input.data,
77
+ text: null,
78
+ };
79
+ }
80
+ /** Normalize a single text input. Always inline. */
81
+ export function normalizeText(input) {
82
+ if (typeof input !== "string") {
83
+ throw new AgentValidationError("loadText expects a string");
84
+ }
85
+ const data = new TextEncoder().encode(input);
86
+ return { kind: "text", source: "<inline>", mime: "text/plain", data, text: input };
87
+ }
88
+ /** Normalize a single file input. Mime defaults to application/octet-stream. */
89
+ export async function normalizeFile(input) {
90
+ if (typeof input === "string") {
91
+ const data = await readFileToUint8(input);
92
+ const ext = stripPathArtifacts(input).toLowerCase().match(/\.([a-z0-9]+)$/)?.[1] ?? "";
93
+ const mime = IMAGE_MIME_BY_EXT[ext] ?? AUDIO_MIME_BY_EXT[ext] ?? "application/octet-stream";
94
+ return { kind: "file", source: input, mime, data, text: null };
95
+ }
96
+ if (input instanceof Uint8Array) {
97
+ return {
98
+ kind: "file",
99
+ source: "<inline>",
100
+ mime: "application/octet-stream",
101
+ data: input,
102
+ text: null,
103
+ };
104
+ }
105
+ return {
106
+ kind: "file",
107
+ source: input.source ?? "<inline>",
108
+ mime: input.mime,
109
+ data: input.data,
110
+ text: null,
111
+ };
112
+ }
113
+ //# sourceMappingURL=loaders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loaders.js","sourceRoot":"","sources":["../src/loaders.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAgBhD,MAAM,iBAAiB,GAA2B;IAChD,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,YAAY;IACjB,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,YAAY;IAClB,GAAG,EAAE,WAAW;CACjB,CAAC;AACF,MAAM,iBAAiB,GAA2B;IAChD,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,YAAY;IACjB,GAAG,EAAE,WAAW;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,WAAW,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACvF,MAAM,IAAI,GACR,iBAAiB,CAAC,GAAG,CAAC,IAAI,iBAAiB,CAAC,GAAG,CAAC,IAAI,0BAA0B,CAAC;QACjF,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACjE,CAAC;IACD,IAAI,KAAK,YAAY,UAAU,EAAE,CAAC;QAChC,OAAO;YACL,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,UAAU;YAClB,IAAI,EAAE,0BAA0B;YAChC,IAAI,EAAE,KAAK;YACX,IAAI,EAAE,IAAI;SACX,CAAC;IACJ,CAAC;IACD,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,UAAU;QAClC,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,IAAI,EAAE,IAAI;KACX,CAAC;AACJ,CAAC"}
@@ -0,0 +1,64 @@
1
+ import type { LanguageModel } from "ai";
2
+ /**
3
+ * Resolved model handle. Two flavors:
4
+ *
5
+ * - `ai-sdk` — first-class AI SDK LanguageModel, used by openai-compatible,
6
+ * openai, anthropic, etc. Author code passes `model.model` directly to
7
+ * `streamText`, `generateText`, `generateObject`, ...
8
+ *
9
+ * - `custom` — a non-AI-SDK provider (e.g. local audio runtimes invoked as a
10
+ * child process). The provider exposes a single `invoke` callable that takes
11
+ * a tagged payload and returns structured output.
12
+ */
13
+ export type ResolvedModel = {
14
+ kind: "ai-sdk";
15
+ /** Original "provider/model" id as it appeared in env / agent policy. */
16
+ id: string;
17
+ /** Final concrete model id after alias resolution. */
18
+ resolvedId: string;
19
+ provider: "openai-compatible" | "openai" | "anthropic";
20
+ model: LanguageModel;
21
+ meta: {
22
+ baseURL?: string;
23
+ apiKeyMasked?: string;
24
+ };
25
+ } | {
26
+ kind: "ai-sdk";
27
+ id: string;
28
+ resolvedId: string;
29
+ /** Managed llama.cpp server — OpenAI-compatible HTTP, but lifecycle owned by superagent. */
30
+ provider: "llama-server";
31
+ model: LanguageModel;
32
+ meta: {
33
+ baseURL: string;
34
+ bin: string;
35
+ modelPath: string;
36
+ port: number;
37
+ host: string;
38
+ managedProcess?: boolean;
39
+ };
40
+ } | {
41
+ kind: "custom";
42
+ id: string;
43
+ resolvedId: string;
44
+ provider: string;
45
+ invoke: (input: CustomInvokeInput) => Promise<CustomInvokeOutput>;
46
+ meta: Record<string, unknown>;
47
+ };
48
+ /**
49
+ * Payload passed to a custom provider. Audio-local providers use `task` to
50
+ * route one audio input through the selected speech runtime.
51
+ */
52
+ export type CustomInvokeInput = {
53
+ kind: "audio";
54
+ data: Uint8Array;
55
+ mime: string;
56
+ source: string;
57
+ task?: "transcription" | "diarization" | "embedding" | "voice-enrollment" | "voice-matching";
58
+ name?: string;
59
+ };
60
+ export type CustomInvokeOutput = Record<string, unknown> & {
61
+ text?: string;
62
+ meta?: Record<string, unknown>;
63
+ };
64
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAExC;;;;;;;;;;GAUG;AACH,MAAM,MAAM,aAAa,GACrB;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,yEAAyE;IACzE,EAAE,EAAE,MAAM,CAAC;IACX,sDAAsD;IACtD,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,mBAAmB,GAAG,QAAQ,GAAG,WAAW,CAAC;IACvD,KAAK,EAAE,aAAa,CAAC;IACrB,IAAI,EAAE;QACJ,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,YAAY,CAAC,EAAE,MAAM,CA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# sourceMappingURL=model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import type { ResolvedModel } from "../model";
2
+ /**
3
+ * Anthropic cloud provider. Opt-in at usage time (only when an agent resolves
4
+ * an `anthropic/...` model and `ANTHROPIC_API_KEY` is set). Listed as a
5
+ * dependency of `@dahura/super-agent-runtime` (like `@ai-sdk/openai`) so bundlers
6
+ * can resolve the module when compiling apps such as the Playground.
7
+ */
8
+ export type AnthropicConfig = {
9
+ apiKey: string;
10
+ resolvedModelId: string;
11
+ originalModelId: string;
12
+ };
13
+ export declare function buildAnthropicModel(cfg: AnthropicConfig): ResolvedModel;
14
+ //# sourceMappingURL=anthropic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../src/providers/anthropic.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,eAAe,GAAG,aAAa,CAqBvE"}
@@ -0,0 +1,19 @@
1
+ import { createAnthropic } from "@ai-sdk/anthropic";
2
+ import { ProviderError } from "../errors";
3
+ export function buildAnthropicModel(cfg) {
4
+ if (!cfg.apiKey) {
5
+ throw new ProviderError("anthropic provider requires ANTHROPIC_API_KEY (cloud is opt-in; set the key only when an agent's model.allow permits anthropic/*)");
6
+ }
7
+ const provider = createAnthropic({ apiKey: cfg.apiKey });
8
+ return {
9
+ kind: "ai-sdk",
10
+ id: cfg.originalModelId,
11
+ resolvedId: cfg.resolvedModelId,
12
+ provider: "anthropic",
13
+ model: provider(cfg.resolvedModelId),
14
+ meta: {
15
+ apiKeyMasked: cfg.apiKey ? `${cfg.apiKey.slice(0, 3)}…${cfg.apiKey.slice(-4)}` : "(none)",
16
+ },
17
+ };
18
+ }
19
+ //# sourceMappingURL=anthropic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../src/providers/anthropic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAc1C,MAAM,UAAU,mBAAmB,CAAC,GAAoB;IACtD,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;QAChB,MAAM,IAAI,aAAa,CACrB,mIAAmI,CACpI,CAAC;IACJ,CAAC;IACD,MAAM,QAAQ,GAAG,eAAe,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IACzD,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,EAAE,EAAE,GAAG,CAAC,eAAe;QACvB,UAAU,EAAE,GAAG,CAAC,eAAe;QAC/B,QAAQ,EAAE,WAAW;QACrB,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,eAAe,CAI1B;QACT,IAAI,EAAE;YACJ,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;SAC1F;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Anthropic cloud provider definition using defineProvider.
3
+ *
4
+ * Opt-in cloud provider for Anthropic's Claude API.
5
+ */
6
+ import { type ProviderConfig } from "@dahura/super-agent-kit";
7
+ /**
8
+ * Configuration type for Anthropic provider.
9
+ */
10
+ export type AnthropicProviderConfig = ProviderConfig & {
11
+ apiKey?: string;
12
+ };
13
+ /**
14
+ * Anthropic cloud provider definition.
15
+ *
16
+ * Features:
17
+ * - Opt-in cloud provider (only used when explicitly allowed)
18
+ * - Uses @ai-sdk/anthropic (declared dependency of @dahura/super-agent-runtime)
19
+ * - No live probe to avoid API charges
20
+ */
21
+ export declare const anthropicProvider: import("@dahura/super-agent-kit").ProviderModule<AnthropicProviderConfig>;
22
+ //# sourceMappingURL=anthropic.provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anthropic.provider.d.ts","sourceRoot":"","sources":["../../src/providers/anthropic.provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAkB,KAAK,cAAc,EAA4B,MAAM,yBAAyB,CAAC;AAGxG;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,cAAc,GAAG;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAuCF;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,2EAgB5B,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Anthropic cloud provider definition using defineProvider.
3
+ *
4
+ * Opt-in cloud provider for Anthropic's Claude API.
5
+ */
6
+ import { defineProvider } from "@dahura/super-agent-kit";
7
+ import { buildAnthropicModel } from "./anthropic";
8
+ /**
9
+ * Probe function for Anthropic provider.
10
+ * Just checks if API key is set (doesn't make a live call to avoid charges).
11
+ */
12
+ async function probeAnthropicProvider(config) {
13
+ if (!config.apiKey) {
14
+ return {
15
+ ok: false,
16
+ error: "ANTHROPIC_API_KEY not set (cloud is opt-in)",
17
+ };
18
+ }
19
+ return {
20
+ ok: true,
21
+ meta: {
22
+ apiKeySet: true,
23
+ },
24
+ };
25
+ }
26
+ /**
27
+ * Build function wrapper for defineProvider compatibility.
28
+ */
29
+ async function buildAnthropicProviderModel(config) {
30
+ const anthropicConfig = {
31
+ apiKey: config.apiKey ?? "",
32
+ resolvedModelId: "claude-3-5-sonnet-20241022",
33
+ originalModelId: "anthropic/claude-3-5-sonnet-20241022",
34
+ };
35
+ return buildAnthropicModel(anthropicConfig);
36
+ }
37
+ /**
38
+ * Anthropic cloud provider definition.
39
+ *
40
+ * Features:
41
+ * - Opt-in cloud provider (only used when explicitly allowed)
42
+ * - Uses @ai-sdk/anthropic (declared dependency of @dahura/super-agent-runtime)
43
+ * - No live probe to avoid API charges
44
+ */
45
+ export const anthropicProvider = defineProvider({
46
+ meta: {
47
+ id: "anthropic",
48
+ description: "Anthropic cloud API (Claude 3.5, Claude 3, etc.)",
49
+ version: "1.0.0",
50
+ capabilities: ["text", "vision"],
51
+ },
52
+ kind: "ai-sdk",
53
+ env: {
54
+ apiKey: {
55
+ env: "API_KEY",
56
+ description: "Anthropic API key (reads ANTHROPIC_API_KEY)",
57
+ },
58
+ },
59
+ probe: probeAnthropicProvider,
60
+ build: buildAnthropicProviderModel,
61
+ });
62
+ //# sourceMappingURL=anthropic.provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anthropic.provider.js","sourceRoot":"","sources":["../../src/providers/anthropic.provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAiD,MAAM,yBAAyB,CAAC;AACxG,OAAO,EAAE,mBAAmB,EAAwB,MAAM,aAAa,CAAC;AASxE;;;GAGG;AACH,KAAK,UAAU,sBAAsB,CACnC,MAA+B;IAE/B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACnB,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,6CAA6C;SACrD,CAAC;IACJ,CAAC;IAED,OAAO;QACL,EAAE,EAAE,IAAI;QACR,IAAI,EAAE;YACJ,SAAS,EAAE,IAAI;SAChB;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,2BAA2B,CACxC,MAA+B;IAE/B,MAAM,eAAe,GAAoB;QACvC,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE;QAC3B,eAAe,EAAE,4BAA4B;QAC7C,eAAe,EAAE,sCAAsC;KACxD,CAAC;IAEF,OAAO,mBAAmB,CAAC,eAAe,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAA0B;IACvE,IAAI,EAAE;QACJ,EAAE,EAAE,WAAW;QACf,WAAW,EAAE,kDAAkD;QAC/D,OAAO,EAAE,OAAO;QAChB,YAAY,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;KACjC;IACD,IAAI,EAAE,QAAQ;IACd,GAAG,EAAE;QACH,MAAM,EAAE;YACN,GAAG,EAAE,SAAS;YACd,WAAW,EAAE,6CAA6C;SAC3D;KACF;IACD,KAAK,EAAE,sBAAsB;IAC7B,KAAK,EAAE,2BAA2B;CACnC,CAAC,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { ResolvedModel } from "../model";
2
+ export type AudioLocalRuntime = "whisper-cpp" | "sortformer" | "pyannote" | "ecapa";
3
+ export type AudioLocalConfig = {
4
+ sidecar?: string;
5
+ whisperBin?: string;
6
+ whisperModelPath?: string;
7
+ language?: string;
8
+ threads?: number;
9
+ voiceProfilesDir?: string;
10
+ sortformerModel?: string;
11
+ sortformerModelPath?: string;
12
+ pyannoteModel?: string;
13
+ ecapaModel?: string;
14
+ resolvedModelId: string;
15
+ originalModelId: string;
16
+ };
17
+ export declare function audioRuntimeForModel(modelId: string): AudioLocalRuntime | null;
18
+ export declare function buildAudioLocalModel(cfg: AudioLocalConfig): Promise<ResolvedModel>;
19
+ export declare function resolveBundledVoiceSidecar(): Promise<string | undefined>;
20
+ export declare function audioLocalFileExists(path: string | undefined): Promise<boolean>;
21
+ //# sourceMappingURL=audio-local.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audio-local.d.ts","sourceRoot":"","sources":["../../src/providers/audio-local.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAyC,aAAa,EAAE,MAAM,UAAU,CAAC;AAIrF,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG,YAAY,GAAG,UAAU,GAAG,OAAO,CAAC;AAEpF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAeF,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAe9E;AAED,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,CAmHxF;AAiHD,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAe9E;AA0ND,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAErF"}