@dexto/server 1.6.17 → 1.6.18
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/dist/hono/__tests__/test-fixtures.cjs +3 -2
- package/dist/hono/__tests__/test-fixtures.d.ts +6 -2
- package/dist/hono/__tests__/test-fixtures.d.ts.map +1 -1
- package/dist/hono/__tests__/test-fixtures.js +3 -2
- package/dist/hono/index.d.ts +92 -5
- package/dist/hono/index.d.ts.map +1 -1
- package/dist/hono/routes/messages.d.ts +1 -1
- package/dist/hono/routes/search.d.ts +2 -2
- package/dist/hono/routes/sessions.cjs +198 -2
- package/dist/hono/routes/sessions.d.ts +88 -1
- package/dist/hono/routes/sessions.d.ts.map +1 -1
- package/dist/hono/routes/sessions.js +202 -3
- package/dist/hono/routes/system-prompt.d.ts +1 -1
- package/dist/hono/schemas/responses.d.ts +26 -26
- package/package.json +7 -7
|
@@ -80,14 +80,15 @@ function createTestAgentConfig() {
|
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
async function createTestAgent(config) {
|
|
83
|
+
async function createTestAgent(config, options) {
|
|
84
84
|
const agentConfig = config ?? createTestAgentConfig();
|
|
85
85
|
const validatedConfig = import_agent_config.AgentConfigSchema.parse(agentConfig);
|
|
86
86
|
const services = await (0, import_agent_config.resolveServicesFromConfig)(validatedConfig, import_image_local.default);
|
|
87
87
|
const agent = new import_core.DextoAgent(
|
|
88
88
|
(0, import_agent_config.toDextoAgentOptions)({
|
|
89
89
|
config: validatedConfig,
|
|
90
|
-
services
|
|
90
|
+
services,
|
|
91
|
+
...options?.runtimeOverrides ? { runtimeOverrides: options.runtimeOverrides } : {}
|
|
91
92
|
})
|
|
92
93
|
);
|
|
93
94
|
await agent.start();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type AgentConfig } from '@dexto/agent-config';
|
|
2
2
|
import { DextoAgent } from '@dexto/core';
|
|
3
|
-
import type { AgentCard } from '@dexto/core';
|
|
3
|
+
import type { AgentCard, DextoAgentConfigInput } from '@dexto/core';
|
|
4
4
|
import type { Server as HttpServer } from 'node:http';
|
|
5
5
|
import type { DextoApp } from '../types.js';
|
|
6
6
|
import { type NodeBridgeResult } from '../node/index.js';
|
|
@@ -10,11 +10,14 @@ import type { CreateDextoAppOptions } from '../index.js';
|
|
|
10
10
|
* Uses in-memory storage to avoid side effects
|
|
11
11
|
*/
|
|
12
12
|
export declare function createTestAgentConfig(): AgentConfig;
|
|
13
|
+
interface CreateTestAgentOptions {
|
|
14
|
+
runtimeOverrides?: Pick<DextoAgentConfigInput, 'usageScopeId'> | undefined;
|
|
15
|
+
}
|
|
13
16
|
/**
|
|
14
17
|
* Creates a real DextoAgent instance with in-memory storage
|
|
15
18
|
* No mocks - uses real implementations
|
|
16
19
|
*/
|
|
17
|
-
export declare function createTestAgent(config?: AgentConfig): Promise<DextoAgent>;
|
|
20
|
+
export declare function createTestAgent(config?: AgentConfig, options?: CreateTestAgentOptions): Promise<DextoAgent>;
|
|
18
21
|
/**
|
|
19
22
|
* Test server setup result
|
|
20
23
|
*/
|
|
@@ -63,4 +66,5 @@ export declare const validators: {
|
|
|
63
66
|
optionalArray: (value: unknown) => boolean;
|
|
64
67
|
optionalObject: (value: unknown) => boolean;
|
|
65
68
|
};
|
|
69
|
+
export {};
|
|
66
70
|
//# sourceMappingURL=test-fixtures.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-fixtures.d.ts","sourceRoot":"","sources":["../../../src/hono/__tests__/test-fixtures.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,KAAK,WAAW,EACnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAmB,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"test-fixtures.d.ts","sourceRoot":"","sources":["../../../src/hono/__tests__/test-fixtures.ts"],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AACH,wBAAsB,WAAW,CAC7B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACjC,OAAO,CAAC;IACP,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC,CAmCD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACnC,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,GACpD,IAAI,CAgBN;AAED;;GAEG;AACH,eAAO,MAAM,UAAU;oBACH,OAAO,KAAG,OAAO;oBACjB,OAAO,KAAG,OAAO;qBAChB,OAAO,KAAG,OAAO;mBACnB,OAAO,KAAG,OAAO;oBAChB,OAAO,KAAG,OAAO;4BAET,OAAO,KAAG,OAAO;4BACjB,OAAO,KAAG,OAAO;2BAClB,OAAO,KAAG,OAAO;4BAChB,OAAO,KAAG,OAAO;CAG5C,CAAC"}
|
|
@@ -46,14 +46,15 @@ function createTestAgentConfig() {
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
async function createTestAgent(config) {
|
|
49
|
+
async function createTestAgent(config, options) {
|
|
50
50
|
const agentConfig = config ?? createTestAgentConfig();
|
|
51
51
|
const validatedConfig = AgentConfigSchema.parse(agentConfig);
|
|
52
52
|
const services = await resolveServicesFromConfig(validatedConfig, imageLocal);
|
|
53
53
|
const agent = new DextoAgent(
|
|
54
54
|
toDextoAgentOptions({
|
|
55
55
|
config: validatedConfig,
|
|
56
|
-
services
|
|
56
|
+
services,
|
|
57
|
+
...options?.runtimeOverrides ? { runtimeOverrides: options.runtimeOverrides } : {}
|
|
57
58
|
})
|
|
58
59
|
);
|
|
59
60
|
await agent.start();
|
package/dist/hono/index.d.ts
CHANGED
|
@@ -86,9 +86,9 @@ export declare function createDextoApp(options: CreateDextoAppOptions): OpenAPIH
|
|
|
86
86
|
output: {
|
|
87
87
|
id: string;
|
|
88
88
|
enabled: boolean;
|
|
89
|
-
removed?: boolean | undefined;
|
|
90
89
|
priority?: number | undefined;
|
|
91
90
|
replaced?: boolean | undefined;
|
|
91
|
+
removed?: boolean | undefined;
|
|
92
92
|
contentLength?: number | undefined;
|
|
93
93
|
truncated?: boolean | undefined;
|
|
94
94
|
};
|
|
@@ -2335,6 +2335,7 @@ export declare function createDextoApp(options: CreateDextoAppOptions): OpenAPIH
|
|
|
2335
2335
|
} | undefined;
|
|
2336
2336
|
})[] | null;
|
|
2337
2337
|
role: "system" | "user" | "assistant" | "tool";
|
|
2338
|
+
usageScopeId?: string | undefined;
|
|
2338
2339
|
id?: string | undefined;
|
|
2339
2340
|
name?: string | undefined;
|
|
2340
2341
|
timestamp?: number | undefined;
|
|
@@ -2349,7 +2350,6 @@ export declare function createDextoApp(options: CreateDextoAppOptions): OpenAPIH
|
|
|
2349
2350
|
} | undefined;
|
|
2350
2351
|
estimatedCost?: number | undefined;
|
|
2351
2352
|
pricingStatus?: "estimated" | "unpriced" | undefined;
|
|
2352
|
-
usageScopeId?: string | undefined;
|
|
2353
2353
|
model?: string | undefined;
|
|
2354
2354
|
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova" | undefined;
|
|
2355
2355
|
toolCalls?: {
|
|
@@ -2422,6 +2422,7 @@ export declare function createDextoApp(options: CreateDextoAppOptions): OpenAPIH
|
|
|
2422
2422
|
} | undefined;
|
|
2423
2423
|
})[] | null;
|
|
2424
2424
|
role: "system" | "user" | "assistant" | "tool";
|
|
2425
|
+
usageScopeId?: string | undefined;
|
|
2425
2426
|
id?: string | undefined;
|
|
2426
2427
|
name?: string | undefined;
|
|
2427
2428
|
timestamp?: number | undefined;
|
|
@@ -2436,7 +2437,6 @@ export declare function createDextoApp(options: CreateDextoAppOptions): OpenAPIH
|
|
|
2436
2437
|
} | undefined;
|
|
2437
2438
|
estimatedCost?: number | undefined;
|
|
2438
2439
|
pricingStatus?: "estimated" | "unpriced" | undefined;
|
|
2439
|
-
usageScopeId?: string | undefined;
|
|
2440
2440
|
model?: string | undefined;
|
|
2441
2441
|
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova" | undefined;
|
|
2442
2442
|
toolCalls?: {
|
|
@@ -2719,6 +2719,7 @@ export declare function createDextoApp(options: CreateDextoAppOptions): OpenAPIH
|
|
|
2719
2719
|
} | undefined;
|
|
2720
2720
|
})[] | null;
|
|
2721
2721
|
role: "system" | "user" | "assistant" | "tool";
|
|
2722
|
+
usageScopeId?: string | undefined;
|
|
2722
2723
|
id?: string | undefined;
|
|
2723
2724
|
name?: string | undefined;
|
|
2724
2725
|
timestamp?: number | undefined;
|
|
@@ -2733,7 +2734,6 @@ export declare function createDextoApp(options: CreateDextoAppOptions): OpenAPIH
|
|
|
2733
2734
|
} | undefined;
|
|
2734
2735
|
estimatedCost?: number | undefined;
|
|
2735
2736
|
pricingStatus?: "estimated" | "unpriced" | undefined;
|
|
2736
|
-
usageScopeId?: string | undefined;
|
|
2737
2737
|
model?: string | undefined;
|
|
2738
2738
|
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova" | undefined;
|
|
2739
2739
|
toolCalls?: {
|
|
@@ -2753,6 +2753,93 @@ export declare function createDextoApp(options: CreateDextoAppOptions): OpenAPIH
|
|
|
2753
2753
|
status: 200;
|
|
2754
2754
|
};
|
|
2755
2755
|
};
|
|
2756
|
+
} & {
|
|
2757
|
+
"/sessions/:sessionId/system-prompt/contributors": {
|
|
2758
|
+
$get: {
|
|
2759
|
+
input: {
|
|
2760
|
+
param: {
|
|
2761
|
+
sessionId: string;
|
|
2762
|
+
};
|
|
2763
|
+
};
|
|
2764
|
+
output: never;
|
|
2765
|
+
outputFormat: "json";
|
|
2766
|
+
status: 404;
|
|
2767
|
+
} | {
|
|
2768
|
+
input: {
|
|
2769
|
+
param: {
|
|
2770
|
+
sessionId: string;
|
|
2771
|
+
};
|
|
2772
|
+
};
|
|
2773
|
+
output: {
|
|
2774
|
+
contributors: {
|
|
2775
|
+
id: string;
|
|
2776
|
+
priority: number;
|
|
2777
|
+
}[];
|
|
2778
|
+
};
|
|
2779
|
+
outputFormat: "json";
|
|
2780
|
+
status: 200;
|
|
2781
|
+
};
|
|
2782
|
+
};
|
|
2783
|
+
} & {
|
|
2784
|
+
"/sessions/:sessionId/system-prompt/contributors": {
|
|
2785
|
+
$post: {
|
|
2786
|
+
input: {
|
|
2787
|
+
param: {
|
|
2788
|
+
sessionId: string;
|
|
2789
|
+
};
|
|
2790
|
+
} & {
|
|
2791
|
+
json: {
|
|
2792
|
+
id: string;
|
|
2793
|
+
content?: string | undefined;
|
|
2794
|
+
enabled?: boolean | undefined;
|
|
2795
|
+
priority?: number | undefined;
|
|
2796
|
+
};
|
|
2797
|
+
};
|
|
2798
|
+
output: never;
|
|
2799
|
+
outputFormat: "json";
|
|
2800
|
+
status: 400;
|
|
2801
|
+
} | {
|
|
2802
|
+
input: {
|
|
2803
|
+
param: {
|
|
2804
|
+
sessionId: string;
|
|
2805
|
+
};
|
|
2806
|
+
} & {
|
|
2807
|
+
json: {
|
|
2808
|
+
id: string;
|
|
2809
|
+
content?: string | undefined;
|
|
2810
|
+
enabled?: boolean | undefined;
|
|
2811
|
+
priority?: number | undefined;
|
|
2812
|
+
};
|
|
2813
|
+
};
|
|
2814
|
+
output: never;
|
|
2815
|
+
outputFormat: "json";
|
|
2816
|
+
status: 404;
|
|
2817
|
+
} | {
|
|
2818
|
+
input: {
|
|
2819
|
+
param: {
|
|
2820
|
+
sessionId: string;
|
|
2821
|
+
};
|
|
2822
|
+
} & {
|
|
2823
|
+
json: {
|
|
2824
|
+
id: string;
|
|
2825
|
+
content?: string | undefined;
|
|
2826
|
+
enabled?: boolean | undefined;
|
|
2827
|
+
priority?: number | undefined;
|
|
2828
|
+
};
|
|
2829
|
+
};
|
|
2830
|
+
output: {
|
|
2831
|
+
id: string;
|
|
2832
|
+
enabled: boolean;
|
|
2833
|
+
priority?: number | undefined;
|
|
2834
|
+
replaced?: boolean | undefined;
|
|
2835
|
+
removed?: boolean | undefined;
|
|
2836
|
+
contentLength?: number | undefined;
|
|
2837
|
+
truncated?: boolean | undefined;
|
|
2838
|
+
};
|
|
2839
|
+
outputFormat: "json";
|
|
2840
|
+
status: 200;
|
|
2841
|
+
};
|
|
2842
|
+
};
|
|
2756
2843
|
} & {
|
|
2757
2844
|
"/sessions/:sessionId": {
|
|
2758
2845
|
$delete: {
|
|
@@ -3809,6 +3896,7 @@ export declare function createDextoApp(options: CreateDextoAppOptions): OpenAPIH
|
|
|
3809
3896
|
output: {
|
|
3810
3897
|
sessionId: string;
|
|
3811
3898
|
response: string;
|
|
3899
|
+
usageScopeId?: string | undefined;
|
|
3812
3900
|
reasoning?: string | undefined;
|
|
3813
3901
|
tokenUsage?: {
|
|
3814
3902
|
inputTokens?: number | undefined;
|
|
@@ -3820,7 +3908,6 @@ export declare function createDextoApp(options: CreateDextoAppOptions): OpenAPIH
|
|
|
3820
3908
|
} | undefined;
|
|
3821
3909
|
estimatedCost?: number | undefined;
|
|
3822
3910
|
pricingStatus?: "estimated" | "unpriced" | undefined;
|
|
3823
|
-
usageScopeId?: string | undefined;
|
|
3824
3911
|
model?: string | undefined;
|
|
3825
3912
|
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova" | undefined;
|
|
3826
3913
|
messageId?: string | undefined;
|
package/dist/hono/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hono/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAmBzD,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAUlF,OAAO,EAGH,KAAK,kBAAkB,EAC1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAKxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAiE1E,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAC5E,MAAM,MAAM,oBAAoB,GAAG,CAC/B,GAAG,EAAE,OAAO,KACX,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AAEtD,MAAM,MAAM,qBAAqB,GAAG;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,UAAU,CAAC;IACrB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,oBAAoB,CAAC;IAC1C,YAAY,EAAE,MAAM,SAAS,CAAC;IAC9B,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,iBAAiB,EAAE,sBAAsB,CAAC;IAC1C,aAAa,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA6QhC;AAID,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAGxD,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -98,6 +98,7 @@ export declare function createMessagesRouter(getAgent: GetAgentFn, approvalCoord
|
|
|
98
98
|
output: {
|
|
99
99
|
sessionId: string;
|
|
100
100
|
response: string;
|
|
101
|
+
usageScopeId?: string | undefined;
|
|
101
102
|
reasoning?: string | undefined;
|
|
102
103
|
tokenUsage?: {
|
|
103
104
|
inputTokens?: number | undefined;
|
|
@@ -109,7 +110,6 @@ export declare function createMessagesRouter(getAgent: GetAgentFn, approvalCoord
|
|
|
109
110
|
} | undefined;
|
|
110
111
|
estimatedCost?: number | undefined;
|
|
111
112
|
pricingStatus?: "estimated" | "unpriced" | undefined;
|
|
112
|
-
usageScopeId?: string | undefined;
|
|
113
113
|
model?: string | undefined;
|
|
114
114
|
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova" | undefined;
|
|
115
115
|
messageId?: string | undefined;
|
|
@@ -45,6 +45,7 @@ export declare function createSearchRouter(getAgent: GetAgentFn): OpenAPIHono<im
|
|
|
45
45
|
} | undefined;
|
|
46
46
|
})[] | null;
|
|
47
47
|
role: "system" | "user" | "assistant" | "tool";
|
|
48
|
+
usageScopeId?: string | undefined;
|
|
48
49
|
id?: string | undefined;
|
|
49
50
|
name?: string | undefined;
|
|
50
51
|
timestamp?: number | undefined;
|
|
@@ -59,7 +60,6 @@ export declare function createSearchRouter(getAgent: GetAgentFn): OpenAPIHono<im
|
|
|
59
60
|
} | undefined;
|
|
60
61
|
estimatedCost?: number | undefined;
|
|
61
62
|
pricingStatus?: "estimated" | "unpriced" | undefined;
|
|
62
|
-
usageScopeId?: string | undefined;
|
|
63
63
|
model?: string | undefined;
|
|
64
64
|
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova" | undefined;
|
|
65
65
|
toolCalls?: {
|
|
@@ -132,6 +132,7 @@ export declare function createSearchRouter(getAgent: GetAgentFn): OpenAPIHono<im
|
|
|
132
132
|
} | undefined;
|
|
133
133
|
})[] | null;
|
|
134
134
|
role: "system" | "user" | "assistant" | "tool";
|
|
135
|
+
usageScopeId?: string | undefined;
|
|
135
136
|
id?: string | undefined;
|
|
136
137
|
name?: string | undefined;
|
|
137
138
|
timestamp?: number | undefined;
|
|
@@ -146,7 +147,6 @@ export declare function createSearchRouter(getAgent: GetAgentFn): OpenAPIHono<im
|
|
|
146
147
|
} | undefined;
|
|
147
148
|
estimatedCost?: number | undefined;
|
|
148
149
|
pricingStatus?: "estimated" | "unpriced" | undefined;
|
|
149
|
-
usageScopeId?: string | undefined;
|
|
150
150
|
model?: string | undefined;
|
|
151
151
|
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova" | undefined;
|
|
152
152
|
toolCalls?: {
|
|
@@ -24,9 +24,33 @@ module.exports = __toCommonJS(sessions_exports);
|
|
|
24
24
|
var import_zod_openapi = require("@hono/zod-openapi");
|
|
25
25
|
var import_core = require("@dexto/core");
|
|
26
26
|
var import_responses = require("../schemas/responses.js");
|
|
27
|
+
var import_error = require("../middleware/error.js");
|
|
27
28
|
const CreateSessionSchema = import_zod_openapi.z.object({
|
|
28
29
|
sessionId: import_zod_openapi.z.string().optional().describe("A custom ID for the new session")
|
|
29
30
|
}).describe("Request body for creating a new session");
|
|
31
|
+
const MAX_SYSTEM_PROMPT_CONTRIBUTOR_CONTENT_CHARS = 12e4;
|
|
32
|
+
const DEFAULT_SYSTEM_PROMPT_CONTRIBUTOR_PRIORITY = 45;
|
|
33
|
+
const SessionPromptContributorInfoSchema = import_zod_openapi.z.object({
|
|
34
|
+
id: import_zod_openapi.z.string().describe("Contributor identifier"),
|
|
35
|
+
priority: import_zod_openapi.z.number().describe("Contributor priority")
|
|
36
|
+
}).strict().describe("Session-scoped system prompt contributor metadata.");
|
|
37
|
+
const UpsertSessionPromptContributorSchema = import_zod_openapi.z.object({
|
|
38
|
+
id: import_zod_openapi.z.string().min(1).describe("Contributor identifier"),
|
|
39
|
+
priority: import_zod_openapi.z.number().int().nonnegative().optional().default(DEFAULT_SYSTEM_PROMPT_CONTRIBUTOR_PRIORITY).describe("Optional priority override"),
|
|
40
|
+
enabled: import_zod_openapi.z.boolean().default(true).describe("Set false to remove the contributor instead of adding or updating it"),
|
|
41
|
+
content: import_zod_openapi.z.string().optional().describe("Static contributor content for this session (required when enabled)")
|
|
42
|
+
}).strict().superRefine((value, ctx) => {
|
|
43
|
+
if (value.enabled !== false && (!value.content || value.content.trim().length === 0)) {
|
|
44
|
+
ctx.addIssue({
|
|
45
|
+
code: import_zod_openapi.z.ZodIssueCode.custom,
|
|
46
|
+
path: ["content"],
|
|
47
|
+
message: "Contributor content is required when enabled"
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}).describe("Session-scoped system prompt contributor update payload.");
|
|
51
|
+
function sanitizeContributorId(value) {
|
|
52
|
+
return value.trim().replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80);
|
|
53
|
+
}
|
|
30
54
|
function mapSessionMetadata(sessionId, metadata, defaults) {
|
|
31
55
|
return {
|
|
32
56
|
id: sessionId,
|
|
@@ -45,7 +69,24 @@ function mapSessionMetadata(sessionId, metadata, defaults) {
|
|
|
45
69
|
};
|
|
46
70
|
}
|
|
47
71
|
function createSessionsRouter(getAgent) {
|
|
48
|
-
const app = new import_zod_openapi.OpenAPIHono(
|
|
72
|
+
const app = new import_zod_openapi.OpenAPIHono({
|
|
73
|
+
defaultHook: (result, ctx) => {
|
|
74
|
+
if (!result.success) {
|
|
75
|
+
const issues = (0, import_core.zodToIssues)(result.error);
|
|
76
|
+
return (0, import_error.handleHonoError)(
|
|
77
|
+
ctx,
|
|
78
|
+
new import_core.DextoRuntimeError(
|
|
79
|
+
"validation_failed",
|
|
80
|
+
"validation",
|
|
81
|
+
import_core.ErrorType.USER,
|
|
82
|
+
issues[0]?.message ?? "Validation failed",
|
|
83
|
+
{ issues }
|
|
84
|
+
)
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
app.onError((err, ctx) => (0, import_error.handleHonoError)(ctx, err));
|
|
49
90
|
const listRoute = (0, import_zod_openapi.createRoute)({
|
|
50
91
|
method: "get",
|
|
51
92
|
path: "/sessions",
|
|
@@ -174,6 +215,86 @@ function createSessionsRouter(getAgent) {
|
|
|
174
215
|
}
|
|
175
216
|
}
|
|
176
217
|
});
|
|
218
|
+
const listSessionPromptContributorsRoute = (0, import_zod_openapi.createRoute)({
|
|
219
|
+
method: "get",
|
|
220
|
+
path: "/sessions/{sessionId}/system-prompt/contributors",
|
|
221
|
+
summary: "List Session System Prompt Contributors",
|
|
222
|
+
description: "Lists static system prompt contributors that apply only to the specified session.",
|
|
223
|
+
tags: ["sessions", "config"],
|
|
224
|
+
request: { params: import_zod_openapi.z.object({ sessionId: import_zod_openapi.z.string().describe("Session identifier") }) },
|
|
225
|
+
responses: {
|
|
226
|
+
200: {
|
|
227
|
+
description: "Current session contributor list",
|
|
228
|
+
content: {
|
|
229
|
+
"application/json": {
|
|
230
|
+
schema: import_zod_openapi.z.object({
|
|
231
|
+
contributors: import_zod_openapi.z.array(SessionPromptContributorInfoSchema).describe("Registered session prompt contributors.")
|
|
232
|
+
}).strict()
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
404: {
|
|
237
|
+
description: "Session not found",
|
|
238
|
+
content: {
|
|
239
|
+
"application/json": {
|
|
240
|
+
schema: import_responses.StandardErrorEnvelopeSchema
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
const upsertSessionPromptContributorRoute = (0, import_zod_openapi.createRoute)({
|
|
247
|
+
method: "post",
|
|
248
|
+
path: "/sessions/{sessionId}/system-prompt/contributors",
|
|
249
|
+
summary: "Upsert Session System Prompt Contributor",
|
|
250
|
+
description: "Adds or updates a static system prompt contributor that applies only to the specified session. Set enabled=false to remove it.",
|
|
251
|
+
tags: ["sessions", "config"],
|
|
252
|
+
request: {
|
|
253
|
+
params: import_zod_openapi.z.object({ sessionId: import_zod_openapi.z.string().describe("Session identifier") }),
|
|
254
|
+
body: {
|
|
255
|
+
required: true,
|
|
256
|
+
content: {
|
|
257
|
+
"application/json": {
|
|
258
|
+
schema: UpsertSessionPromptContributorSchema
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
responses: {
|
|
264
|
+
200: {
|
|
265
|
+
description: "Session contributor upsert result",
|
|
266
|
+
content: {
|
|
267
|
+
"application/json": {
|
|
268
|
+
schema: import_zod_openapi.z.object({
|
|
269
|
+
id: import_zod_openapi.z.string().describe("Contributor identifier"),
|
|
270
|
+
enabled: import_zod_openapi.z.boolean().describe("Whether the contributor remains enabled"),
|
|
271
|
+
priority: import_zod_openapi.z.number().optional().describe("Contributor priority"),
|
|
272
|
+
replaced: import_zod_openapi.z.boolean().optional().describe("Whether an existing contributor was replaced"),
|
|
273
|
+
removed: import_zod_openapi.z.boolean().optional().describe("Whether the contributor was removed"),
|
|
274
|
+
contentLength: import_zod_openapi.z.number().optional().describe("Stored content length in characters"),
|
|
275
|
+
truncated: import_zod_openapi.z.boolean().optional().describe("Whether the submitted content was truncated")
|
|
276
|
+
}).strict()
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
400: {
|
|
281
|
+
description: "Invalid session contributor request",
|
|
282
|
+
content: {
|
|
283
|
+
"application/json": {
|
|
284
|
+
schema: import_responses.StandardErrorEnvelopeSchema
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
404: {
|
|
289
|
+
description: "Session not found",
|
|
290
|
+
content: {
|
|
291
|
+
"application/json": {
|
|
292
|
+
schema: import_responses.StandardErrorEnvelopeSchema
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
});
|
|
177
298
|
const deleteRoute = (0, import_zod_openapi.createRoute)({
|
|
178
299
|
method: "delete",
|
|
179
300
|
path: "/sessions/{sessionId}",
|
|
@@ -420,6 +541,81 @@ function createSessionsRouter(getAgent) {
|
|
|
420
541
|
history,
|
|
421
542
|
isBusy
|
|
422
543
|
});
|
|
544
|
+
}).openapi(listSessionPromptContributorsRoute, async (ctx) => {
|
|
545
|
+
const agent = await getAgent(ctx);
|
|
546
|
+
const { sessionId } = ctx.req.valid("param");
|
|
547
|
+
const contributors = await agent.getSessionSystemPromptContributors(sessionId);
|
|
548
|
+
return ctx.json(
|
|
549
|
+
{
|
|
550
|
+
contributors: contributors.map((contributor) => ({
|
|
551
|
+
id: contributor.id,
|
|
552
|
+
priority: contributor.priority
|
|
553
|
+
}))
|
|
554
|
+
},
|
|
555
|
+
200
|
|
556
|
+
);
|
|
557
|
+
}).openapi(upsertSessionPromptContributorRoute, async (ctx) => {
|
|
558
|
+
const agent = await getAgent(ctx);
|
|
559
|
+
const { sessionId } = ctx.req.valid("param");
|
|
560
|
+
const payload = ctx.req.valid("json");
|
|
561
|
+
const contributorId = sanitizeContributorId(payload.id);
|
|
562
|
+
if (contributorId.length === 0) {
|
|
563
|
+
throw new import_core.DextoRuntimeError(
|
|
564
|
+
"session_systemprompt_contributor_config_invalid",
|
|
565
|
+
import_core.ErrorScope.SYSTEM_PROMPT,
|
|
566
|
+
import_core.ErrorType.USER,
|
|
567
|
+
"A valid contributor id is required",
|
|
568
|
+
{
|
|
569
|
+
id: payload.id,
|
|
570
|
+
sessionId
|
|
571
|
+
}
|
|
572
|
+
);
|
|
573
|
+
}
|
|
574
|
+
const rawContent = payload.content ?? "";
|
|
575
|
+
const content = rawContent.slice(0, MAX_SYSTEM_PROMPT_CONTRIBUTOR_CONTENT_CHARS);
|
|
576
|
+
if (!payload.enabled) {
|
|
577
|
+
const removed = await agent.removeSessionSystemPromptContributor(
|
|
578
|
+
sessionId,
|
|
579
|
+
contributorId
|
|
580
|
+
);
|
|
581
|
+
return ctx.json(
|
|
582
|
+
{
|
|
583
|
+
id: contributorId,
|
|
584
|
+
enabled: false,
|
|
585
|
+
removed
|
|
586
|
+
},
|
|
587
|
+
200
|
|
588
|
+
);
|
|
589
|
+
}
|
|
590
|
+
if (content.trim().length === 0) {
|
|
591
|
+
throw new import_core.DextoRuntimeError(
|
|
592
|
+
"session_systemprompt_contributor_config_invalid",
|
|
593
|
+
import_core.ErrorScope.SYSTEM_PROMPT,
|
|
594
|
+
import_core.ErrorType.USER,
|
|
595
|
+
"Contributor content is required when enabled",
|
|
596
|
+
{
|
|
597
|
+
id: payload.id,
|
|
598
|
+
sessionId
|
|
599
|
+
}
|
|
600
|
+
);
|
|
601
|
+
}
|
|
602
|
+
const priority = payload.priority;
|
|
603
|
+
const result = await agent.upsertSessionSystemPromptContributor(sessionId, {
|
|
604
|
+
id: contributorId,
|
|
605
|
+
priority,
|
|
606
|
+
content
|
|
607
|
+
});
|
|
608
|
+
return ctx.json(
|
|
609
|
+
{
|
|
610
|
+
id: contributorId,
|
|
611
|
+
enabled: true,
|
|
612
|
+
priority,
|
|
613
|
+
replaced: result.replaced,
|
|
614
|
+
contentLength: content.length,
|
|
615
|
+
truncated: rawContent.length > content.length
|
|
616
|
+
},
|
|
617
|
+
200
|
|
618
|
+
);
|
|
423
619
|
}).openapi(deleteRoute, async (ctx) => {
|
|
424
620
|
const agent = await getAgent(ctx);
|
|
425
621
|
const { sessionId } = ctx.req.param();
|
|
@@ -464,7 +660,7 @@ function createSessionsRouter(getAgent) {
|
|
|
464
660
|
const metadata = await agent.getSessionMetadata(sessionId);
|
|
465
661
|
const isBusy = await agent.isSessionBusy(sessionId);
|
|
466
662
|
const usageSummary = await agent.getSessionUsageSummary(sessionId);
|
|
467
|
-
const activeUsageScopeId =
|
|
663
|
+
const activeUsageScopeId = agent.getEffectiveConfig().usageScopeId ?? null;
|
|
468
664
|
const activeUsageScope = activeUsageScopeId ? {
|
|
469
665
|
scopeId: activeUsageScopeId,
|
|
470
666
|
...await agent.getSessionUsageSummary(sessionId, activeUsageScopeId)
|
|
@@ -256,6 +256,7 @@ export declare function createSessionsRouter(getAgent: GetAgentFn): OpenAPIHono<
|
|
|
256
256
|
} | undefined;
|
|
257
257
|
})[] | null;
|
|
258
258
|
role: "system" | "user" | "assistant" | "tool";
|
|
259
|
+
usageScopeId?: string | undefined;
|
|
259
260
|
id?: string | undefined;
|
|
260
261
|
name?: string | undefined;
|
|
261
262
|
timestamp?: number | undefined;
|
|
@@ -270,7 +271,6 @@ export declare function createSessionsRouter(getAgent: GetAgentFn): OpenAPIHono<
|
|
|
270
271
|
} | undefined;
|
|
271
272
|
estimatedCost?: number | undefined;
|
|
272
273
|
pricingStatus?: "estimated" | "unpriced" | undefined;
|
|
273
|
-
usageScopeId?: string | undefined;
|
|
274
274
|
model?: string | undefined;
|
|
275
275
|
provider?: "openai" | "openai-compatible" | "anthropic" | "google" | "groq" | "xai" | "cohere" | "minimax" | "glm" | "openrouter" | "litellm" | "glama" | "vertex" | "bedrock" | "local" | "ollama" | "dexto-nova" | undefined;
|
|
276
276
|
toolCalls?: {
|
|
@@ -290,6 +290,93 @@ export declare function createSessionsRouter(getAgent: GetAgentFn): OpenAPIHono<
|
|
|
290
290
|
status: 200;
|
|
291
291
|
};
|
|
292
292
|
};
|
|
293
|
+
} & {
|
|
294
|
+
"/sessions/:sessionId/system-prompt/contributors": {
|
|
295
|
+
$get: {
|
|
296
|
+
input: {
|
|
297
|
+
param: {
|
|
298
|
+
sessionId: string;
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
output: never;
|
|
302
|
+
outputFormat: "json";
|
|
303
|
+
status: 404;
|
|
304
|
+
} | {
|
|
305
|
+
input: {
|
|
306
|
+
param: {
|
|
307
|
+
sessionId: string;
|
|
308
|
+
};
|
|
309
|
+
};
|
|
310
|
+
output: {
|
|
311
|
+
contributors: {
|
|
312
|
+
id: string;
|
|
313
|
+
priority: number;
|
|
314
|
+
}[];
|
|
315
|
+
};
|
|
316
|
+
outputFormat: "json";
|
|
317
|
+
status: 200;
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
} & {
|
|
321
|
+
"/sessions/:sessionId/system-prompt/contributors": {
|
|
322
|
+
$post: {
|
|
323
|
+
input: {
|
|
324
|
+
param: {
|
|
325
|
+
sessionId: string;
|
|
326
|
+
};
|
|
327
|
+
} & {
|
|
328
|
+
json: {
|
|
329
|
+
id: string;
|
|
330
|
+
content?: string | undefined;
|
|
331
|
+
enabled?: boolean | undefined;
|
|
332
|
+
priority?: number | undefined;
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
output: never;
|
|
336
|
+
outputFormat: "json";
|
|
337
|
+
status: 400;
|
|
338
|
+
} | {
|
|
339
|
+
input: {
|
|
340
|
+
param: {
|
|
341
|
+
sessionId: string;
|
|
342
|
+
};
|
|
343
|
+
} & {
|
|
344
|
+
json: {
|
|
345
|
+
id: string;
|
|
346
|
+
content?: string | undefined;
|
|
347
|
+
enabled?: boolean | undefined;
|
|
348
|
+
priority?: number | undefined;
|
|
349
|
+
};
|
|
350
|
+
};
|
|
351
|
+
output: never;
|
|
352
|
+
outputFormat: "json";
|
|
353
|
+
status: 404;
|
|
354
|
+
} | {
|
|
355
|
+
input: {
|
|
356
|
+
param: {
|
|
357
|
+
sessionId: string;
|
|
358
|
+
};
|
|
359
|
+
} & {
|
|
360
|
+
json: {
|
|
361
|
+
id: string;
|
|
362
|
+
content?: string | undefined;
|
|
363
|
+
enabled?: boolean | undefined;
|
|
364
|
+
priority?: number | undefined;
|
|
365
|
+
};
|
|
366
|
+
};
|
|
367
|
+
output: {
|
|
368
|
+
id: string;
|
|
369
|
+
enabled: boolean;
|
|
370
|
+
priority?: number | undefined;
|
|
371
|
+
replaced?: boolean | undefined;
|
|
372
|
+
removed?: boolean | undefined;
|
|
373
|
+
contentLength?: number | undefined;
|
|
374
|
+
truncated?: boolean | undefined;
|
|
375
|
+
};
|
|
376
|
+
outputFormat: "json";
|
|
377
|
+
status: 200;
|
|
378
|
+
};
|
|
379
|
+
};
|
|
293
380
|
} & {
|
|
294
381
|
"/sessions/:sessionId": {
|
|
295
382
|
$delete: {
|