@qcobro/sdk 1.26.0 → 1.27.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.
- package/dist/client.d.ts +11 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +38 -16
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/resources/agentEvaluations.d.ts +30 -0
- package/dist/resources/agentEvaluations.d.ts.map +1 -0
- package/dist/resources/agentEvaluations.js +72 -0
- package/dist/resources/agentEvaluations.js.map +1 -0
- package/dist/resources/agentTemplates.d.ts +12 -2
- package/dist/resources/agentTemplates.d.ts.map +1 -1
- package/dist/resources/agentTemplates.js +14 -10
- package/dist/resources/agentTemplates.js.map +1 -1
- package/dist/validate.d.ts +4 -0
- package/dist/validate.d.ts.map +1 -0
- package/dist/validate.js +9 -0
- package/dist/validate.js.map +1 -0
- package/package.json +3 -3
package/dist/client.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { AppRouter } from "@qcobro/apiserver";
|
|
|
3
3
|
import type { LoginInput, ApiKeyLoginInput } from "@qcobro/common";
|
|
4
4
|
import { PortfoliosResource } from "./resources/portfolios.js";
|
|
5
5
|
import { AgentTemplatesResource } from "./resources/agentTemplates.js";
|
|
6
|
+
import { AgentEvaluationsResource } from "./resources/agentEvaluations.js";
|
|
6
7
|
/** Tokens issued by the QCobro Identity service. */
|
|
7
8
|
export interface Tokens {
|
|
8
9
|
/** Short-lived bearer token attached to every authenticated request. */
|
|
@@ -31,6 +32,13 @@ export interface ClientOptions {
|
|
|
31
32
|
refreshToken?: string;
|
|
32
33
|
/** The accessKeyId of the workspace to act in. Also settable via {@link Client.useWorkspace}. */
|
|
33
34
|
workspace?: string;
|
|
35
|
+
/**
|
|
36
|
+
* `WebSocket` implementation used for subscriptions (`agentEvaluations.evaluate`) —
|
|
37
|
+
* the `realtime-streaming` transport at `/trpc-ws`. Defaults to the global `WebSocket`
|
|
38
|
+
* (stable in modern Node and every browser). Provide a ponyfill in older Node runtimes
|
|
39
|
+
* that lack it.
|
|
40
|
+
*/
|
|
41
|
+
WebSocket?: typeof WebSocket;
|
|
34
42
|
/**
|
|
35
43
|
* When `true` (the default), an `UNAUTHORIZED` response triggers a single
|
|
36
44
|
* token refresh and one replay of the failed request, provided a refresh
|
|
@@ -69,8 +77,10 @@ export declare class Client {
|
|
|
69
77
|
readonly trpc: CreateTRPCClient<AppRouter>;
|
|
70
78
|
/** Portfolio operations (list, get, create, update, delete, accounts, sync). */
|
|
71
79
|
readonly portfolios: PortfoliosResource;
|
|
72
|
-
/** Agent template operations (list, get, create, sync). */
|
|
80
|
+
/** Agent template operations (list, get, create, sync, preview). */
|
|
73
81
|
readonly agentTemplates: AgentTemplatesResource;
|
|
82
|
+
/** Agent evaluation operations (evaluate — streams over the WebSocket transport). */
|
|
83
|
+
readonly agentEvaluations: AgentEvaluationsResource;
|
|
74
84
|
constructor(options?: ClientOptions);
|
|
75
85
|
/**
|
|
76
86
|
* Run a request, transparently refreshing the access token once on an
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,gBAAgB,EACtB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,M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eAAe,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC;IAO/D;;;;;;OAMG;IACG,OAAO,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAWrD;;;OAGG;IACH,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAKvC,mFAAmF;IACnF,IAAI,SAAS,IAAI,MAAM,GAAG,SAAS,CAElC;IAED,mEAAmE;IACnE,SAAS,IAAI,MAAM;IAInB;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAKhC"}
|
package/dist/client.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { createTRPCClient, httpBatchLink } from "@trpc/client";
|
|
1
|
+
import { createTRPCClient, createWSClient, httpBatchLink, splitLink, wsLink } from "@trpc/client";
|
|
2
2
|
import { PortfoliosResource } from "./resources/portfolios.js";
|
|
3
3
|
import { AgentTemplatesResource } from "./resources/agentTemplates.js";
|
|
4
|
+
import { AgentEvaluationsResource } from "./resources/agentEvaluations.js";
|
|
4
5
|
/** Header the apiserver reads to scope a request to a workspace. */
|
|
5
6
|
const WORKSPACE_HEADER = "x-workspace";
|
|
6
7
|
/** Default QCobro API base URL, used when no `endpoint` is provided. */
|
|
@@ -35,8 +36,10 @@ export class Client {
|
|
|
35
36
|
trpc;
|
|
36
37
|
/** Portfolio operations (list, get, create, update, delete, accounts, sync). */
|
|
37
38
|
portfolios;
|
|
38
|
-
/** Agent template operations (list, get, create, sync). */
|
|
39
|
+
/** Agent template operations (list, get, create, sync, preview). */
|
|
39
40
|
agentTemplates;
|
|
41
|
+
/** Agent evaluation operations (evaluate — streams over the WebSocket transport). */
|
|
42
|
+
agentEvaluations;
|
|
40
43
|
#accessToken;
|
|
41
44
|
#refreshToken;
|
|
42
45
|
#workspace;
|
|
@@ -48,27 +51,46 @@ export class Client {
|
|
|
48
51
|
this.#refreshToken = options.refreshToken;
|
|
49
52
|
this.#workspace = options.workspace;
|
|
50
53
|
this.#autoRefresh = options.autoRefresh ?? true;
|
|
51
|
-
const
|
|
54
|
+
const base = (options.endpoint ?? DEFAULT_ENDPOINT).replace(/\/+$/, "");
|
|
55
|
+
const url = `${base}/trpc`;
|
|
56
|
+
// Realtime-streaming capability's WebSocket transport (`/trpc-ws`), used only for
|
|
57
|
+
// subscription-type operations (agentEvaluations.evaluate) — mirrors the webapp's
|
|
58
|
+
// `lib/trpc.ts` split exactly. `connectionParams` carries the same auth the HTTP link
|
|
59
|
+
// sends as headers, since a WebSocket handshake can't carry custom headers.
|
|
60
|
+
const wsClient = createWSClient({
|
|
61
|
+
url: () => `${base.replace(/^http/, "ws")}/trpc-ws`,
|
|
62
|
+
WebSocket: options.WebSocket,
|
|
63
|
+
connectionParams: () => ({
|
|
64
|
+
token: this.#accessToken ?? "",
|
|
65
|
+
workspace: this.#workspace ?? ""
|
|
66
|
+
}),
|
|
67
|
+
lazy: { enabled: true, closeMs: 0 }
|
|
68
|
+
});
|
|
52
69
|
this.trpc = createTRPCClient({
|
|
53
70
|
links: [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
71
|
+
splitLink({
|
|
72
|
+
condition: (op) => op.type === "subscription",
|
|
73
|
+
true: wsLink({ client: wsClient }),
|
|
74
|
+
false: httpBatchLink({
|
|
75
|
+
url,
|
|
76
|
+
fetch: options.fetch,
|
|
77
|
+
// Read current auth state on every request so a `login()` or
|
|
78
|
+
// `useWorkspace()` after construction applies without rebuilding.
|
|
79
|
+
headers: () => {
|
|
80
|
+
const headers = {};
|
|
81
|
+
if (this.#accessToken)
|
|
82
|
+
headers.Authorization = `Bearer ${this.#accessToken}`;
|
|
83
|
+
if (this.#workspace)
|
|
84
|
+
headers[WORKSPACE_HEADER] = this.#workspace;
|
|
85
|
+
return headers;
|
|
86
|
+
}
|
|
87
|
+
})
|
|
67
88
|
})
|
|
68
89
|
]
|
|
69
90
|
});
|
|
70
91
|
this.portfolios = new PortfoliosResource(this.trpc, (fn) => this.request(fn));
|
|
71
92
|
this.agentTemplates = new AgentTemplatesResource(this.trpc, (fn) => this.request(fn));
|
|
93
|
+
this.agentEvaluations = new AgentEvaluationsResource(this.trpc);
|
|
72
94
|
}
|
|
73
95
|
/**
|
|
74
96
|
* Run a request, transparently refreshing the access token once on an
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,SAAS,EACT,MAAM,EAEP,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,oEAAoE;AACpE,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAEvC,wEAAwE;AACxE,MAAM,gBAAgB,GAAG,wBAAwB,CAAC;AA8ClD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,MAAM;IACjB;;;OAGG;IACM,IAAI,CAA8B;IAE3C,gFAAgF;IACvE,UAAU,CAAqB;IAExC,oEAAoE;IAC3D,cAAc,CAAyB;IAEhD,qFAAqF;IAC5E,gBAAgB,CAA2B;IAEpD,YAAY,CAAU;IACtB,aAAa,CAAU;IACvB,UAAU,CAAU;IACpB,YAAY,CAAU;IACtB,2EAA2E;IAC3E,gBAAgB,GAAyB,IAAI,CAAC;IAE9C,YAAY,UAAyB,EAA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AE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;QACjF,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;QAC5E,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC;QACvC,IAAI,MAAM,CAAC,YAAY;YAAE,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC;QAClE,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;OAGG;IACH,YAAY,CAAC,WAAmB;QAC9B,IAAI,CAAC,UAAU,GAAG,WAAW,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,mFAAmF;IACnF,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,mEAAmE;IACnE,SAAS;QACP,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,YAAY,EAAE,YAAY,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC;IAC9E,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,MAAc;QACtB,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { Client } from "./client.js";
|
|
|
10
10
|
export type { ClientOptions, Tokens } from "./client.js";
|
|
11
11
|
export { PortfoliosResource } from "./resources/portfolios.js";
|
|
12
12
|
export { AgentTemplatesResource } from "./resources/agentTemplates.js";
|
|
13
|
+
export { AgentEvaluationsResource } from "./resources/agentEvaluations.js";
|
|
13
14
|
export { listPortfoliosSchema, getPortfolioSchema, listAccountsSchema } from "./schemas.js";
|
|
14
15
|
export type { ListPortfoliosInput, GetPortfolioInput, ListAccountsInput } from "./schemas.js";
|
|
15
16
|
export { listAgentTemplatesSchema, getAgentTemplateSchema } from "./schemas.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAK3E,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC5F,YAAY,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC9F,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAChF,YAAY,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAInF,OAAO,EAAE,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
export { Client } from "./client.js";
|
|
10
10
|
export { PortfoliosResource } from "./resources/portfolios.js";
|
|
11
11
|
export { AgentTemplatesResource } from "./resources/agentTemplates.js";
|
|
12
|
+
export { AgentEvaluationsResource } from "./resources/agentEvaluations.js";
|
|
12
13
|
// Schemas for inputs the apiserver defines inline (not in `@qcobro/common`), so
|
|
13
14
|
// other packages (e.g. `@qcobro/mcp`, `@qcobro/ctl`) can validate against the
|
|
14
15
|
// same rules the SDK itself uses, without duplicating them.
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,gFAAgF;AAChF,8EAA8E;AAC9E,4DAA4D;AAC5D,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAE5F,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAGhF,0EAA0E;AAC1E,sEAAsE;AACtE,OAAO,EAAE,eAAe,EAAmB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { CreateTRPCClient } from "@trpc/client";
|
|
2
|
+
import type { AppRouter } from "@qcobro/apiserver";
|
|
3
|
+
import { type EvalEvent } from "@qcobro/common";
|
|
4
|
+
type RouterClient = CreateTRPCClient<AppRouter>;
|
|
5
|
+
type AgentEvaluations = RouterClient["agentEvaluations"];
|
|
6
|
+
type EvaluateInput = Parameters<AgentEvaluations["evaluate"]["subscribe"]>[0];
|
|
7
|
+
/**
|
|
8
|
+
* Agent evaluation operations.
|
|
9
|
+
*
|
|
10
|
+
* `evaluate` starts a streaming evaluation of a `VOICE_AI`, `EMAIL`, or `WHATSAPP` agent —
|
|
11
|
+
* either an existing template by id (with caller-supplied scenarios) or a YAML eval
|
|
12
|
+
* template (agent definition + its own embedded scenarios, never persisted) — and returns
|
|
13
|
+
* an async iterable of events, consumed with `for await`. It is distinct from and unrelated
|
|
14
|
+
* to `@qcobro/common`'s `evaluate(events, parameters)` (the `engine-scorecard` capability),
|
|
15
|
+
* which judges dispatch/engine behavior, not agent conversation logic.
|
|
16
|
+
*
|
|
17
|
+
* Streams over the `realtime-streaming` WebSocket transport (`/trpc-ws`), the same one the
|
|
18
|
+
* webapp's Gestiones list uses — tRPC's callback-based `.subscribe` is adapted into an
|
|
19
|
+
* async generator here so callers never touch that transport directly.
|
|
20
|
+
*
|
|
21
|
+
* Obtain an instance via `client.agentEvaluations`; do not construct it directly.
|
|
22
|
+
*/
|
|
23
|
+
export declare class AgentEvaluationsResource {
|
|
24
|
+
#private;
|
|
25
|
+
/** @internal */
|
|
26
|
+
constructor(trpc: RouterClient);
|
|
27
|
+
evaluate(input: EvaluateInput): AsyncGenerator<EvalEvent>;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=agentEvaluations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentEvaluations.d.ts","sourceRoot":"","sources":["../../src/resources/agentEvaluations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGrE,KAAK,YAAY,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;AAChD,KAAK,gBAAgB,GAAG,YAAY,CAAC,kBAAkB,CAAC,CAAC;AACzD,KAAK,aAAa,GAAG,UAAU,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9E;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,wBAAwB;;IAGnC,gBAAgB;gBACJ,IAAI,EAAE,YAAY;IAIvB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,cAAc,CAAC,SAAS,CAAC;CAgDjE"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { evaluateInputSchema } from "@qcobro/common";
|
|
2
|
+
import { parse } from "../validate.js";
|
|
3
|
+
/**
|
|
4
|
+
* Agent evaluation operations.
|
|
5
|
+
*
|
|
6
|
+
* `evaluate` starts a streaming evaluation of a `VOICE_AI`, `EMAIL`, or `WHATSAPP` agent —
|
|
7
|
+
* either an existing template by id (with caller-supplied scenarios) or a YAML eval
|
|
8
|
+
* template (agent definition + its own embedded scenarios, never persisted) — and returns
|
|
9
|
+
* an async iterable of events, consumed with `for await`. It is distinct from and unrelated
|
|
10
|
+
* to `@qcobro/common`'s `evaluate(events, parameters)` (the `engine-scorecard` capability),
|
|
11
|
+
* which judges dispatch/engine behavior, not agent conversation logic.
|
|
12
|
+
*
|
|
13
|
+
* Streams over the `realtime-streaming` WebSocket transport (`/trpc-ws`), the same one the
|
|
14
|
+
* webapp's Gestiones list uses — tRPC's callback-based `.subscribe` is adapted into an
|
|
15
|
+
* async generator here so callers never touch that transport directly.
|
|
16
|
+
*
|
|
17
|
+
* Obtain an instance via `client.agentEvaluations`; do not construct it directly.
|
|
18
|
+
*/
|
|
19
|
+
export class AgentEvaluationsResource {
|
|
20
|
+
#trpc;
|
|
21
|
+
/** @internal */
|
|
22
|
+
constructor(trpc) {
|
|
23
|
+
this.#trpc = trpc;
|
|
24
|
+
}
|
|
25
|
+
async *evaluate(input) {
|
|
26
|
+
const parsed = parse(evaluateInputSchema, input);
|
|
27
|
+
const queue = [];
|
|
28
|
+
let waiter = null;
|
|
29
|
+
let done = false;
|
|
30
|
+
let failure = null;
|
|
31
|
+
const wake = () => {
|
|
32
|
+
const resolve = waiter;
|
|
33
|
+
waiter = null;
|
|
34
|
+
resolve?.();
|
|
35
|
+
};
|
|
36
|
+
const subscription = this.#trpc.agentEvaluations.evaluate.subscribe(parsed, {
|
|
37
|
+
onData: (event) => {
|
|
38
|
+
queue.push(event);
|
|
39
|
+
wake();
|
|
40
|
+
},
|
|
41
|
+
onError: (err) => {
|
|
42
|
+
failure = err;
|
|
43
|
+
done = true;
|
|
44
|
+
wake();
|
|
45
|
+
},
|
|
46
|
+
onComplete: () => {
|
|
47
|
+
done = true;
|
|
48
|
+
wake();
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
try {
|
|
52
|
+
for (;;) {
|
|
53
|
+
if (queue.length > 0) {
|
|
54
|
+
yield queue.shift();
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (done) {
|
|
58
|
+
if (failure)
|
|
59
|
+
throw failure;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
await new Promise((resolve) => {
|
|
63
|
+
waiter = resolve;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
finally {
|
|
68
|
+
subscription.unsubscribe();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=agentEvaluations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentEvaluations.js","sourceRoot":"","sources":["../../src/resources/agentEvaluations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,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AM,KAAK,CAAC,KAAK,EAAe,CAAC;oBACjC,SAAS;gBACX,CAAC;gBACD,IAAI,IAAI,EAAE,CAAC;oBACT,IAAI,OAAO;wBAAE,MAAM,OAAO,CAAC;oBAC3B,OAAO;gBACT,CAAC;gBACD,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;oBAClC,MAAM,GAAG,OAAO,CAAC;gBACnB,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,YAAY,CAAC,WAAW,EAAE,CAAC;QAC7B,CAAC;IACH,CAAC;CACF"}
|
|
@@ -7,6 +7,7 @@ type ListInput = Parameters<AgentTemplates["list"]["query"]>[0];
|
|
|
7
7
|
type GetInput = Parameters<AgentTemplates["get"]["query"]>[0];
|
|
8
8
|
type CreateInput = Parameters<AgentTemplates["create"]["mutate"]>[0];
|
|
9
9
|
type SyncInput = Parameters<AgentTemplates["sync"]["mutate"]>[0];
|
|
10
|
+
type PreviewInput = Parameters<AgentTemplates["preview"]["query"]>[0];
|
|
10
11
|
/** Runs a request, transparently refreshing + replaying once on `UNAUTHORIZED`. */
|
|
11
12
|
type RequestRunner = <T>(fn: () => Promise<T>) => Promise<T>;
|
|
12
13
|
/**
|
|
@@ -17,8 +18,9 @@ type RequestRunner = <T>(fn: () => Promise<T>) => Promise<T>;
|
|
|
17
18
|
* shared `@qcobro/common` schemas before any request is sent — invalid input
|
|
18
19
|
* throws a {@link ValidationError} and never reaches the network.
|
|
19
20
|
*
|
|
20
|
-
* `sync` re-attempts a voice template's Fonoster sync
|
|
21
|
-
* conversational-intelligence evaluation
|
|
21
|
+
* `sync` re-attempts a voice template's Fonoster sync — it is not a
|
|
22
|
+
* conversational-intelligence evaluation. For that, see `client.agentEvaluations.evaluate`
|
|
23
|
+
* (VOICE_AI/EMAIL/WHATSAPP) and `preview` below (SMS/VOICE_PRERECORDED render-only preview).
|
|
22
24
|
*
|
|
23
25
|
* Obtain an instance via `client.agentTemplates`; do not construct it directly.
|
|
24
26
|
*/
|
|
@@ -127,6 +129,14 @@ export declare class AgentTemplatesResource {
|
|
|
127
129
|
updatedAt: string;
|
|
128
130
|
workspaceRef: string;
|
|
129
131
|
}>;
|
|
132
|
+
/**
|
|
133
|
+
* Render an `SMS`/`VOICE_PRERECORDED` template's message body or script against a
|
|
134
|
+
* sample account — no conversation, no streaming. Accepts either an existing template
|
|
135
|
+
* by id or a not-yet-created YAML definition (both alongside a sample `account`).
|
|
136
|
+
*/
|
|
137
|
+
preview(input: PreviewInput): Promise<{
|
|
138
|
+
rendered: string;
|
|
139
|
+
}>;
|
|
130
140
|
}
|
|
131
141
|
export {};
|
|
132
142
|
//# sourceMappingURL=agentTemplates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentTemplates.d.ts","sourceRoot":"","sources":["../../src/resources/agentTemplates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AASnD,KAAK,YAAY,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;AAChD,KAAK,cAAc,GAAG,YAAY,CAAC,gBAAgB,CAAC,CAAC;AAErD,oFAAoF;AACpF,KAAK,SAAS,GAAG,UAAU,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChE,KAAK,QAAQ,GAAG,UAAU,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9D,KAAK,WAAW,GAAG,UAAU,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrE,KAAK,SAAS,GAAG,UAAU,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,C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AAC,KAAK,EAAE,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKzB,+FAA+F;IACzF,MAAM,CAAC,KAAK,EAAE,WAAW;;;;;;;;;IAK/B;;;;;OAKG;IACG,IAAI,CAAC,KAAK,EAAE,SAAS;;;;;;;;;IAK3B;;;;OAIG;IACG,OAAO,CAAC,KAAK,EAAE,YAAY;;;CAIlC"}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import { createAgentTemplateSchema,
|
|
1
|
+
import { createAgentTemplateSchema, previewInputSchema, syncAgentTemplateSchema } from "@qcobro/common";
|
|
2
2
|
import { listAgentTemplatesSchema, getAgentTemplateSchema } from "../schemas.js";
|
|
3
|
-
|
|
4
|
-
function parse(schema, input) {
|
|
5
|
-
const result = schema.safeParse(input);
|
|
6
|
-
if (!result.success)
|
|
7
|
-
throw new ValidationError(result.error);
|
|
8
|
-
return result.data;
|
|
9
|
-
}
|
|
3
|
+
import { parse } from "../validate.js";
|
|
10
4
|
/**
|
|
11
5
|
* Agent template operations.
|
|
12
6
|
*
|
|
@@ -15,8 +9,9 @@ function parse(schema, input) {
|
|
|
15
9
|
* shared `@qcobro/common` schemas before any request is sent — invalid input
|
|
16
10
|
* throws a {@link ValidationError} and never reaches the network.
|
|
17
11
|
*
|
|
18
|
-
* `sync` re-attempts a voice template's Fonoster sync
|
|
19
|
-
* conversational-intelligence evaluation
|
|
12
|
+
* `sync` re-attempts a voice template's Fonoster sync — it is not a
|
|
13
|
+
* conversational-intelligence evaluation. For that, see `client.agentEvaluations.evaluate`
|
|
14
|
+
* (VOICE_AI/EMAIL/WHATSAPP) and `preview` below (SMS/VOICE_PRERECORDED render-only preview).
|
|
20
15
|
*
|
|
21
16
|
* Obtain an instance via `client.agentTemplates`; do not construct it directly.
|
|
22
17
|
*/
|
|
@@ -53,5 +48,14 @@ export class AgentTemplatesResource {
|
|
|
53
48
|
const parsed = parse(syncAgentTemplateSchema, input);
|
|
54
49
|
return this.#request(() => this.#trpc.agentTemplates.sync.mutate(parsed));
|
|
55
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Render an `SMS`/`VOICE_PRERECORDED` template's message body or script against a
|
|
53
|
+
* sample account — no conversation, no streaming. Accepts either an existing template
|
|
54
|
+
* by id or a not-yet-created YAML definition (both alongside a sample `account`).
|
|
55
|
+
*/
|
|
56
|
+
async preview(input) {
|
|
57
|
+
const parsed = parse(previewInputSchema, input);
|
|
58
|
+
return this.#request(() => this.#trpc.agentTemplates.preview.query(parsed));
|
|
59
|
+
}
|
|
56
60
|
}
|
|
57
61
|
//# sourceMappingURL=agentTemplates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentTemplates.js","sourceRoot":"","sources":["../../src/resources/agentTemplates.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agentTemplates.js","sourceRoot":"","sources":["../../src/resources/agentTemplates.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,yBAAyB,EACzB,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAevC;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,sBAAsB;IACxB,KAAK,CAAe;IACpB,QAAQ,CAAgB;IAEjC,gBAAgB;IAChB,YAAY,IAAkB,EAAE,OAAsB;QACpD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED,kGAAkG;IAClG,KAAK,CAAC,IAAI,CAAC,KAAiB;QAC1B,MAAM,MAAM,GAAG,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAc,CAAC;QACnE,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,IA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+
import { z } from "zod";
|
|
2
|
+
/** Validate `input` against `schema`, throwing a structured {@link ValidationError} on failure. */
|
|
3
|
+
export declare function parse<TSchema extends z.ZodType>(schema: TSchema, input: unknown): z.infer<TSchema>;
|
|
4
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,mGAAmG;AACnG,wBAAgB,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC,OAAO,EAC7C,MAAM,EAAE,OAAO,EACf,KAAK,EAAE,OAAO,GACb,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAIlB"}
|
package/dist/validate.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ValidationError } from "@qcobro/common";
|
|
2
|
+
/** Validate `input` against `schema`, throwing a structured {@link ValidationError} on failure. */
|
|
3
|
+
export function parse(schema, input) {
|
|
4
|
+
const result = schema.safeParse(input);
|
|
5
|
+
if (!result.success)
|
|
6
|
+
throw new ValidationError(result.error);
|
|
7
|
+
return result.data;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,mGAAmG;AACnG,MAAM,UAAU,KAAK,CACnB,MAAe,EACf,KAAc;IAEd,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACvC,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,MAAM,IAAI,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7D,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qcobro/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.27.1",
|
|
4
4
|
"description": "Developer-friendly TypeScript SDK for the QCobro API.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"docs": "typedoc"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@qcobro/common": "^1.
|
|
23
|
+
"@qcobro/common": "^1.27.0",
|
|
24
24
|
"@trpc/client": "^11.0.0",
|
|
25
25
|
"zod": "^4.0.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@qcobro/apiserver": "^1.
|
|
28
|
+
"@qcobro/apiserver": "^1.27.1",
|
|
29
29
|
"@trpc/server": "^11.0.0",
|
|
30
30
|
"@types/express": "^5.0.0",
|
|
31
31
|
"express": "^5.0.0",
|