@inferencesh/sdk 0.6.19 → 0.6.21
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/agent/api.js +3 -0
- package/dist/agent/types.d.ts +6 -0
- package/dist/proxy/index.js +11 -3
- package/package.json +1 -1
package/dist/agent/api.js
CHANGED
|
@@ -55,6 +55,9 @@ export async function sendTemplateMessage(client, config, chatId, text, attachme
|
|
|
55
55
|
chat_id: chatId ?? undefined,
|
|
56
56
|
// Only include agent if it's not empty (for existing chats, backend uses chat's agent)
|
|
57
57
|
agent: config.agent || undefined,
|
|
58
|
+
// Agent-level context (version_id, app_id, ...). Omit when empty so we don't
|
|
59
|
+
// send a bare {} for agents that declare no context.
|
|
60
|
+
context: config.context && Object.keys(config.context).length > 0 ? config.context : undefined,
|
|
58
61
|
input: {
|
|
59
62
|
text,
|
|
60
63
|
attachments,
|
package/dist/agent/types.d.ts
CHANGED
|
@@ -62,6 +62,12 @@ export type AdHocAgentConfig = Omit<Partial<GeneratedAgentConfig>, 'tools' | 'co
|
|
|
62
62
|
export interface TemplateAgentConfig {
|
|
63
63
|
/** Agent reference: namespace/name@shortid */
|
|
64
64
|
agent: string;
|
|
65
|
+
/**
|
|
66
|
+
* Context values passed to the agent on every message, keyed by the context
|
|
67
|
+
* name declared in the agent definition. Equivalent to the CLI's
|
|
68
|
+
* `--context key=value`. Agents with required context won't run without it.
|
|
69
|
+
*/
|
|
70
|
+
context?: Record<string, string>;
|
|
65
71
|
}
|
|
66
72
|
/**
|
|
67
73
|
* Union type for agent configuration options
|
package/dist/proxy/index.js
CHANGED
|
@@ -95,14 +95,22 @@ export async function processProxyRequest(adapter, options) {
|
|
|
95
95
|
error: "Missing INFERENCE_API_KEY environment variable",
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
|
-
// 4. Collect
|
|
98
|
+
// 4. Collect headers to forward upstream.
|
|
99
|
+
//
|
|
100
|
+
// x-inf-* plus the SDK's own headers. X-API-Version is load-bearing: the
|
|
101
|
+
// API returns bare DTOs when it sees "2" and the legacy {success, status,
|
|
102
|
+
// data} envelope otherwise, and this SDK only parses the former. Dropping
|
|
103
|
+
// it here made every proxied response unparseable — requests succeeded
|
|
104
|
+
// server-side while the client silently saw nothing.
|
|
105
|
+
const FORWARD_HEADERS = ["x-api-version", "x-client-source"];
|
|
99
106
|
const forwardHeaders = {};
|
|
100
107
|
const allHeaders = adapter.headers();
|
|
101
108
|
for (const [key, value] of Object.entries(allHeaders)) {
|
|
102
|
-
|
|
109
|
+
const lower = key.toLowerCase();
|
|
110
|
+
if (lower.startsWith("x-inf-") || FORWARD_HEADERS.includes(lower)) {
|
|
103
111
|
const v = firstValue(value);
|
|
104
112
|
if (v)
|
|
105
|
-
forwardHeaders[
|
|
113
|
+
forwardHeaders[lower] = v;
|
|
106
114
|
}
|
|
107
115
|
}
|
|
108
116
|
// 5. Build request headers
|