@nebutra/agents 1.1.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -676
- package/README.md +7 -3
- package/dist/{agent-CahnMASx.d.ts → agent-DDGWuUpe.d.ts} +1 -1
- package/dist/{chunk-B7XWL35G.js → chunk-7VL333VJ.js} +5 -1
- package/dist/{chunk-5LX742GP.js → chunk-C4CC5UEF.js} +25 -53
- package/{src/env.ts → dist/chunk-FCXWOXII.js} +23 -47
- package/dist/chunk-HVLFZW6E.js +71 -0
- package/dist/chunk-HZQXXUKB.js +171 -0
- package/dist/{chunk-RLWM437Q.js → chunk-KC6SOI5Z.js} +19 -4
- package/dist/{chunk-NPQECBXL.js → chunk-S5N743EP.js} +60 -7
- package/dist/chunk-VZPQOXWW.js +47 -0
- package/dist/{chunk-NVPE5EDI.js → chunk-YBCIJKC7.js} +20 -3
- package/dist/env.d.ts +45 -0
- package/dist/env.js +12 -0
- package/dist/fallback.d.ts +100 -0
- package/dist/fallback.js +18 -0
- package/dist/generation/index.d.ts +122 -0
- package/dist/generation/index.js +19 -0
- package/dist/index.d.ts +22 -329
- package/dist/index.js +59 -245
- package/dist/observability.d.ts +46 -0
- package/dist/observability.js +13 -0
- package/dist/providers/langchain.d.ts +2 -2
- package/dist/providers/vercel-ai.d.ts +2 -2
- package/dist/providers/vercel-ai.js +15 -7
- package/dist/sdk/config.d.ts +6 -0
- package/dist/sdk/config.js +2 -1
- package/dist/sdk/index.d.ts +37 -4
- package/dist/sdk/index.js +23 -8
- package/dist/sdk/models.d.ts +20 -27
- package/dist/sdk/models.js +5 -3
- package/dist/sdk/provider.d.ts +1 -0
- package/dist/sdk/provider.js +3 -3
- package/dist/tools.d.ts +1 -1
- package/dist/{types-NtgB3pch.d.ts → types-BytC-HfQ.d.ts} +1 -5
- package/package.json +73 -19
- package/.turbo/turbo-build.log +0 -40
- package/.turbo/turbo-test.log +0 -19
- package/.turbo/turbo-typecheck.log +0 -4
- package/AGENTS.md +0 -63
- package/CHANGELOG.md +0 -36
- package/dist/chunk-5JZJ5KMC.js +0 -37
- package/src/__tests__/cost-observability.test.ts +0 -172
- package/src/__tests__/fallback-wiring.test.ts +0 -313
- package/src/__tests__/generation.test.ts +0 -111
- package/src/__tests__/public-api.test.ts +0 -114
- package/src/__tests__/runtime-gateway.test.ts +0 -108
- package/src/agent.ts +0 -117
- package/src/context.ts +0 -99
- package/src/fallback.ts +0 -358
- package/src/gateway.ts +0 -234
- package/src/generation/index.ts +0 -157
- package/src/generation/mock-provider.ts +0 -123
- package/src/generation/types.ts +0 -87
- package/src/index.ts +0 -104
- package/src/memory.ts +0 -126
- package/src/observability.ts +0 -102
- package/src/orchestrator.ts +0 -147
- package/src/providers/langchain.ts +0 -28
- package/src/providers/vercel-ai.ts +0 -114
- package/src/router.ts +0 -158
- package/src/sdk/config.ts +0 -73
- package/src/sdk/index.ts +0 -214
- package/src/sdk/models.ts +0 -57
- package/src/sdk/provider.ts +0 -80
- package/src/tenant.ts +0 -52
- package/src/tools.ts +0 -65
- package/src/types.ts +0 -114
- package/tsconfig.json +0 -12
- package/tsup.config.ts +0 -21
package/src/types.ts
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core types for the multi-agent orchestration engine.
|
|
3
|
-
*
|
|
4
|
-
* All tenant-scoped operations require an AgentContext carrying `tenantId`.
|
|
5
|
-
* Usage tracking is emitted on every execution for downstream billing.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// ─── Agent Configuration ──────────────────────────────────────────────────────
|
|
9
|
-
|
|
10
|
-
export interface AgentConfig {
|
|
11
|
-
/** Unique identifier for this agent */
|
|
12
|
-
readonly id: string;
|
|
13
|
-
/** Human-readable name */
|
|
14
|
-
readonly name: string;
|
|
15
|
-
/** What this agent does (used by the router for intent matching) */
|
|
16
|
-
readonly description: string;
|
|
17
|
-
/** Model identifier, e.g. "openai/gpt-5.4" or "anthropic/claude-sonnet-4.6" */
|
|
18
|
-
readonly model: string;
|
|
19
|
-
/** System prompt / instructions */
|
|
20
|
-
readonly instructions: string;
|
|
21
|
-
/** Tools this agent can invoke */
|
|
22
|
-
readonly tools?: readonly AgentTool[];
|
|
23
|
-
/** Maximum tool-loop iterations (default 20) */
|
|
24
|
-
readonly maxSteps?: number;
|
|
25
|
-
/** Memory configuration */
|
|
26
|
-
readonly memory?: MemoryConfig;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// ─── Tools ────────────────────────────────────────────────────────────────────
|
|
30
|
-
|
|
31
|
-
export interface AgentTool {
|
|
32
|
-
readonly name: string;
|
|
33
|
-
readonly description: string;
|
|
34
|
-
readonly inputSchema: Record<string, unknown>;
|
|
35
|
-
readonly execute: (input: unknown, context: AgentContext) => Promise<unknown>;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// ─── Execution Context ────────────────────────────────────────────────────────
|
|
39
|
-
|
|
40
|
-
export interface AgentContext {
|
|
41
|
-
readonly tenantId: string;
|
|
42
|
-
readonly userId: string;
|
|
43
|
-
readonly conversationId: string;
|
|
44
|
-
readonly metadata?: Record<string, unknown>;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// ─── Messages ─────────────────────────────────────────────────────────────────
|
|
48
|
-
|
|
49
|
-
export interface AgentMessage {
|
|
50
|
-
readonly role: "user" | "assistant" | "system" | "tool";
|
|
51
|
-
readonly content: string;
|
|
52
|
-
readonly toolCalls?: readonly ToolCallResult[];
|
|
53
|
-
readonly timestamp: Date;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface ToolCallResult {
|
|
57
|
-
readonly toolName: string;
|
|
58
|
-
readonly args: unknown;
|
|
59
|
-
readonly result: unknown;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// ─── Response ─────────────────────────────────────────────────────────────────
|
|
63
|
-
|
|
64
|
-
export interface AgentResponse {
|
|
65
|
-
readonly messages: readonly AgentMessage[];
|
|
66
|
-
readonly usage: TokenUsage;
|
|
67
|
-
readonly finishReason: string;
|
|
68
|
-
readonly agentId: string;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface TokenUsage {
|
|
72
|
-
readonly promptTokens: number;
|
|
73
|
-
readonly completionTokens: number;
|
|
74
|
-
readonly totalTokens: number;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// ─── Memory ───────────────────────────────────────────────────────────────────
|
|
78
|
-
|
|
79
|
-
export interface MemoryConfig {
|
|
80
|
-
readonly shortTerm?: { readonly maxMessages: number };
|
|
81
|
-
readonly longTerm?: { readonly enabled: boolean };
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// ─── Orchestrator ─────────────────────────────────────────────────────────────
|
|
85
|
-
|
|
86
|
-
export interface OrchestratorConfig {
|
|
87
|
-
readonly agents: readonly AgentConfig[];
|
|
88
|
-
readonly router?: RouterConfig;
|
|
89
|
-
readonly defaultAgentId?: string;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export interface RouterConfig {
|
|
93
|
-
readonly strategy: "keyword" | "llm" | "custom";
|
|
94
|
-
readonly customRouter?: (message: string, context: AgentContext) => Promise<string>;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export interface PipelineStep {
|
|
98
|
-
readonly agentId: string;
|
|
99
|
-
readonly transformInput?: (prevOutput: string) => string;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// ─── Usage / Billing ──────────────────────────────────────────────────────────
|
|
103
|
-
|
|
104
|
-
export interface AgentUsageEvent {
|
|
105
|
-
readonly tenantId: string;
|
|
106
|
-
readonly userId: string;
|
|
107
|
-
readonly agentId: string;
|
|
108
|
-
readonly model: string;
|
|
109
|
-
readonly promptTokens: number;
|
|
110
|
-
readonly completionTokens: number;
|
|
111
|
-
readonly totalTokens: number;
|
|
112
|
-
readonly durationMs: number;
|
|
113
|
-
readonly timestamp: Date;
|
|
114
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"target": "esnext",
|
|
7
|
-
"types": ["node"],
|
|
8
|
-
"incremental": false
|
|
9
|
-
},
|
|
10
|
-
"include": ["src"],
|
|
11
|
-
"exclude": ["node_modules", "dist"]
|
|
12
|
-
}
|
package/tsup.config.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "tsup";
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
entry: [
|
|
5
|
-
"src/index.ts",
|
|
6
|
-
"src/tools.ts",
|
|
7
|
-
"src/providers/vercel-ai.ts",
|
|
8
|
-
"src/providers/langchain.ts",
|
|
9
|
-
"src/sdk/index.ts",
|
|
10
|
-
"src/sdk/config.ts",
|
|
11
|
-
"src/sdk/models.ts",
|
|
12
|
-
"src/sdk/provider.ts",
|
|
13
|
-
],
|
|
14
|
-
format: ["esm"],
|
|
15
|
-
dts: true,
|
|
16
|
-
clean: true,
|
|
17
|
-
target: "node20",
|
|
18
|
-
outDir: "dist",
|
|
19
|
-
splitting: true,
|
|
20
|
-
external: ["ai", "@nebutra/logger", "@nebutra/cache", "@nebutra/billing"],
|
|
21
|
-
});
|