pinecall 0.8.2 → 0.8.4
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/README.md +1 -1
- package/dist/cli/agent.d.ts.map +1 -1
- package/dist/cli/agent.js +19 -4
- package/dist/cli/agent.js.map +1 -1
- package/dist/cli/docs-attach.d.ts.map +1 -1
- package/dist/cli/docs-attach.js +3 -2
- package/dist/cli/docs-attach.js.map +1 -1
- package/dist/cli/home.d.ts +5 -2
- package/dist/cli/home.d.ts.map +1 -1
- package/dist/cli/home.js +2 -3
- package/dist/cli/home.js.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/load.d.ts +5 -0
- package/dist/cli/load.d.ts.map +1 -1
- package/dist/cli/load.js +8 -2
- package/dist/cli/load.js.map +1 -1
- package/dist/cli/personas.d.ts +8 -2
- package/dist/cli/personas.d.ts.map +1 -1
- package/dist/cli/personas.js +240 -67
- package/dist/cli/personas.js.map +1 -1
- package/dist/cli/simulate.d.ts +1 -1
- package/dist/cli/simulate.d.ts.map +1 -1
- package/dist/cli/simulate.js +11 -70
- package/dist/cli/simulate.js.map +1 -1
- package/dist/cli/testing/caller.d.ts +6 -12
- package/dist/cli/testing/caller.d.ts.map +1 -1
- package/dist/cli/testing/caller.js +6 -12
- package/dist/cli/testing/caller.js.map +1 -1
- package/dist/cli/testing/heard.d.ts +21 -0
- package/dist/cli/testing/heard.d.ts.map +1 -0
- package/dist/cli/testing/heard.js +64 -0
- package/dist/cli/testing/heard.js.map +1 -0
- package/dist/cli/testing/models.d.ts +9 -0
- package/dist/cli/testing/models.d.ts.map +1 -1
- package/dist/cli/testing/models.js +16 -1
- package/dist/cli/testing/models.js.map +1 -1
- package/dist/cli/testing/personas.d.ts +37 -0
- package/dist/cli/testing/personas.d.ts.map +1 -0
- package/dist/cli/testing/personas.js +26 -0
- package/dist/cli/testing/personas.js.map +1 -0
- package/dist/cli/testing/voice.d.ts +2 -2
- package/dist/cli/testing/voice.js +2 -2
- package/dist/cli/ui/console/assets/{index-no-LQaTe.js → index-CQ0f4Qi4.js} +20 -16
- package/dist/cli/ui/console/assets/index-CXPFJbSz.css +1 -0
- package/dist/cli/ui/console/index.html +2 -2
- package/dist/cli/ui/doors.d.ts.map +1 -1
- package/dist/cli/ui/doors.js +0 -1
- package/dist/cli/ui/doors.js.map +1 -1
- package/dist/cli/ui/simulating.d.ts +4 -18
- package/dist/cli/ui/simulating.d.ts.map +1 -1
- package/dist/cli/ui/simulating.js +10 -18
- package/dist/cli/ui/simulating.js.map +1 -1
- package/package.json +1 -1
- package/dist/cli/ui/console/assets/index-CBStFn5_.css +0 -1
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
/**
|
|
2
|
-
import { readdir } from "node:fs/promises";
|
|
1
|
+
/** The personas a project still keeps as files: read once, by `pinecall personas push`, and never again. */
|
|
2
|
+
import { readdir, stat } from "node:fs/promises";
|
|
3
3
|
import { basename, extname, join, resolve } from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
5
|
import { useTypeScript } from "../load.js";
|
|
6
|
-
/** Where the tenant's personas live: one file per caller, beside the goldens they are run with. */
|
|
7
|
-
export const PERSONAS = "test/personas";
|
|
8
|
-
/** What to say when there are none: the directory, and that a persona is one file in it. */
|
|
9
|
-
export const NO_PERSONAS = `no personas at ${PERSONAS}: one file per caller, default-exporting one`;
|
|
10
6
|
/** Every persona in that directory, in the order `ls` prints them. */
|
|
11
|
-
export async function personasIn(folder
|
|
7
|
+
export async function personasIn(folder) {
|
|
12
8
|
const names = await readdir(resolve(folder)).catch(() => []);
|
|
13
9
|
const files = names.filter((name) => extname(name) === ".ts").sort();
|
|
14
10
|
return await Promise.all(files.map((name) => personaOf(join(resolve(folder), name))));
|
|
15
11
|
}
|
|
16
|
-
/** One persona by the name of its file, or undefined when nobody wrote that caller. */
|
|
17
|
-
export async function personaNamed(wanted, folder = PERSONAS) {
|
|
18
|
-
return (await personasIn(folder)).find((persona) => persona.name === wanted);
|
|
19
|
-
}
|
|
20
12
|
/** One file's persona. The file's own name is the caller's, so a directory listing is the roster. */
|
|
21
13
|
async function personaOf(file) {
|
|
22
14
|
await useTypeScript();
|
|
23
|
-
|
|
15
|
+
// Keyed by when the file last changed, so a push after an edit reads the edit and not the copy
|
|
16
|
+
// this process imported before.
|
|
17
|
+
const module_ = (await import(`${pathToFileURL(file).href}?v=${(await stat(file)).mtimeMs}`));
|
|
24
18
|
const written = module_.default;
|
|
25
19
|
if (typeof written !== "object" || written === null) {
|
|
26
20
|
throw new Error(`${file} has no default-exported persona`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"caller.js","sourceRoot":"","sources":["../../../src/cli/testing/caller.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"caller.js","sourceRoot":"","sources":["../../../src/cli/testing/caller.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAE5G,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAqB3C,sEAAsE;AACtE,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,MAAc;IAC7C,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IAC7D,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;IACrE,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACxF,CAAC;AAED,qGAAqG;AACrG,KAAK,UAAU,SAAS,CAAC,IAAY;IACnC,MAAM,aAAa,EAAE,CAAC;IACtB,+FAA+F;IAC/F,gCAAgC;IAChC,MAAM,OAAO,GAAG,CAAC,MAAM,MAAM,CAAC,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAA0B,CAAC;IACvH,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAChC,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACpD,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,kCAAkC,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,EAAE,GAAI,OAAmB,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** What a simulated call sounds like from this terminal: the log, printed as it lands. */
|
|
2
|
+
import type { Entry, Spoken } from "./gateway.js";
|
|
3
|
+
export declare const SETTLE_MS = 400;
|
|
4
|
+
export declare const A_TURN_MAY_TAKE_MS = 30000;
|
|
5
|
+
export declare class Heard {
|
|
6
|
+
private readonly out;
|
|
7
|
+
private readonly opened?;
|
|
8
|
+
call: string | undefined;
|
|
9
|
+
agentTurns: number;
|
|
10
|
+
readonly said: Spoken[];
|
|
11
|
+
private last;
|
|
12
|
+
constructor(out: NodeJS.WritableStream, opened?: ((call: string) => void) | undefined);
|
|
13
|
+
/** One entry: remembered, and printed when it is a line of the conversation rather than wiring. */
|
|
14
|
+
absorb(entry: Entry): void;
|
|
15
|
+
/** Waits until the agent has spoken again, and then until the app has finished reacting. */
|
|
16
|
+
answered(said: number): Promise<void>;
|
|
17
|
+
/** Waits until nothing has been written for a moment: the app has answered and re-rendered. */
|
|
18
|
+
quiet(): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export declare function after(ms: number): Promise<void>;
|
|
21
|
+
//# sourceMappingURL=heard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heard.d.ts","sourceRoot":"","sources":["../../../src/cli/testing/heard.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAI1F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAIlD,eAAO,MAAM,SAAS,MAAM,CAAC;AAC7B,eAAO,MAAM,kBAAkB,QAAS,CAAC;AAMzC,qBAAa,KAAK;IAOd,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;IAP1B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,UAAU,SAAK;IACf,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAM;IAC7B,OAAO,CAAC,IAAI,CAAc;IAE1B,YACmB,GAAG,EAAE,MAAM,CAAC,cAAc,EAC1B,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,EAC5D;IAEJ,mGAAmG;IACnG,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAqBzB;IAED,4FAA4F;IACtF,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI1C;IAED,+FAA+F;IACzF,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAG3B;CACF;AAED,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/** What a simulated call sounds like from this terminal: the log, printed as it lands. */
|
|
2
|
+
import { lineFor, metricsLine } from "../view.js";
|
|
3
|
+
// How long a written call is left quiet before the caller says the next thing, and how long one
|
|
4
|
+
// turn may take: the simulation's own two clocks, kept beside what waits on them.
|
|
5
|
+
export const SETTLE_MS = 400;
|
|
6
|
+
export const A_TURN_MAY_TAKE_MS = 30_000;
|
|
7
|
+
// The call's log as this terminal hears it: printed as it lands, and quiet when the app has
|
|
8
|
+
// finished reacting. Everything the simulation knows about where the call is, it knows from here —
|
|
9
|
+
// including the transcript the caller model is handed, which is the log's own turns and not a
|
|
10
|
+
// second copy this process kept.
|
|
11
|
+
export class Heard {
|
|
12
|
+
out;
|
|
13
|
+
opened;
|
|
14
|
+
call;
|
|
15
|
+
agentTurns = 0;
|
|
16
|
+
said = [];
|
|
17
|
+
last = Date.now();
|
|
18
|
+
constructor(out, opened) {
|
|
19
|
+
this.out = out;
|
|
20
|
+
this.opened = opened;
|
|
21
|
+
}
|
|
22
|
+
/** One entry: remembered, and printed when it is a line of the conversation rather than wiring. */
|
|
23
|
+
absorb(entry) {
|
|
24
|
+
this.last = Date.now();
|
|
25
|
+
if (typeof entry.call === "string" && this.call === undefined) {
|
|
26
|
+
this.call = entry.call;
|
|
27
|
+
this.opened?.(entry.call);
|
|
28
|
+
}
|
|
29
|
+
if (entry.type === "turn.agent")
|
|
30
|
+
this.agentTurns += 1;
|
|
31
|
+
if (entry.type === "turn.user" || entry.type === "turn.agent") {
|
|
32
|
+
this.said.push({
|
|
33
|
+
who: entry.type === "turn.agent" ? "agent" : "caller",
|
|
34
|
+
said: String(entry.data["text"] ?? ""),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
// Both sides are printed off the log and never off what this process sent: on a spoken call
|
|
38
|
+
// the caller's own turn is what the STT heard, which is the line that matters.
|
|
39
|
+
const line = lineFor(entry);
|
|
40
|
+
if (line === null)
|
|
41
|
+
return;
|
|
42
|
+
const metrics = entry.type === "turn.agent"
|
|
43
|
+
? ` ${metricsLine(entry.data["metrics"])}`
|
|
44
|
+
: "";
|
|
45
|
+
this.out.write(`${line.mark} ${line.text}${metrics}\n`);
|
|
46
|
+
}
|
|
47
|
+
/** Waits until the agent has spoken again, and then until the app has finished reacting. */
|
|
48
|
+
async answered(said) {
|
|
49
|
+
const deadline = Date.now() + A_TURN_MAY_TAKE_MS;
|
|
50
|
+
while (this.agentTurns === said && Date.now() < deadline)
|
|
51
|
+
await after(SETTLE_MS / 4);
|
|
52
|
+
await this.quiet();
|
|
53
|
+
}
|
|
54
|
+
/** Waits until nothing has been written for a moment: the app has answered and re-rendered. */
|
|
55
|
+
async quiet() {
|
|
56
|
+
const deadline = Date.now() + A_TURN_MAY_TAKE_MS;
|
|
57
|
+
while (Date.now() - this.last < SETTLE_MS && Date.now() < deadline)
|
|
58
|
+
await after(SETTLE_MS / 4);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export function after(ms) {
|
|
62
|
+
return new Promise((wake) => setTimeout(wake, ms));
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=heard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heard.js","sourceRoot":"","sources":["../../../src/cli/testing/heard.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAG1F,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGlD,gGAAgG;AAChG,kFAAkF;AAClF,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAC;AAC7B,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAEzC,4FAA4F;AAC5F,mGAAmG;AACnG,8FAA8F;AAC9F,iCAAiC;AACjC,MAAM,OAAO,KAAK;IAOG,GAAG;IACH,MAAM;IAPzB,IAAI,CAAqB;IACzB,UAAU,GAAG,CAAC,CAAC;IACN,IAAI,GAAa,EAAE,CAAC;IACrB,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC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O,IAAI,CAAC,CAAC;IAC1D,CAAC;IAED,4FAA4F;IAC5F,KAAK,CAAC,QAAQ,CAAC,IAAY;QACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,kBAAkB,CAAC;QACjD,OAAO,IAAI,CAAC,UAAU,KAAK,IAAI,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ;YAAE,MAAM,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;QACrF,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;IAED,+FAA+F;IAC/F,KAAK,CAAC,KAAK;QACT,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,kBAAkB,CAAC;QACjD,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,GAAG,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ;YAAE,MAAM,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IACjG,CAAC;CACF;AAED,MAAM,UAAU,KAAK,CAAC,EAAU;IAC9B,OAAO,IAAI,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
/** The model `pinecall test --model` names, as the wire wants it: a short name, or `vendor/model`. */
|
|
2
2
|
import type { Camel, ModelConfig } from "@pinecall/protocol";
|
|
3
|
+
export declare const SHORT_NAMES: Record<string, string>;
|
|
3
4
|
/** The model a name means, so `--model haiku` reaches the provider as an id it recognises. */
|
|
4
5
|
export declare function modelOf(value: string): Camel<ModelConfig> | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* The same name as a settings field wants it: one string, `vendor/model`. A short name is a tier
|
|
8
|
+
* of Anthropic's family, so it travels with its vendor; anything else is what the person typed —
|
|
9
|
+
* a vendor alone and a model alone are both what the gateway takes there, and prefixing either
|
|
10
|
+
* would name a model nobody has. `agent set --llm haiku` used to store `anthropic/haiku`, which
|
|
11
|
+
* is a 404 at the provider and nothing said so until a call went silent.
|
|
12
|
+
*/
|
|
13
|
+
export declare function theModelNamed(value: string): string | undefined;
|
|
5
14
|
//# sourceMappingURL=models.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/cli/testing/models.ts"],"names":[],"mappings":"AAAA,sGAAsG;AAEtG,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/cli/testing/models.ts"],"names":[],"mappings":"AAAA,sGAAsG;AAEtG,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAM7D,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAI9C,CAAC;AAEF,8FAA8F;AAC9F,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,SAAS,CAKrE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAI/D"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// "haiku" on its own is a 404 from Anthropic. The three short names are the family's tiers as the
|
|
4
4
|
// runtime prices them; anything else is passed through as written, with "provider/model" naming
|
|
5
5
|
// both halves and a bare name defaulting to Anthropic.
|
|
6
|
-
const SHORT_NAMES = {
|
|
6
|
+
export const SHORT_NAMES = {
|
|
7
7
|
haiku: "claude-haiku-4-5-20251001",
|
|
8
8
|
sonnet: "claude-sonnet-5",
|
|
9
9
|
opus: "claude-opus-5",
|
|
@@ -13,6 +13,21 @@ export function modelOf(value) {
|
|
|
13
13
|
if (value === "")
|
|
14
14
|
return undefined;
|
|
15
15
|
const [provider, name] = value.includes("/") ? value.split("/", 2) : ["anthropic", value];
|
|
16
|
+
if (provider === "" || name === "")
|
|
17
|
+
return undefined;
|
|
16
18
|
return { provider: provider, model: SHORT_NAMES[name] ?? name };
|
|
17
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* The same name as a settings field wants it: one string, `vendor/model`. A short name is a tier
|
|
22
|
+
* of Anthropic's family, so it travels with its vendor; anything else is what the person typed —
|
|
23
|
+
* a vendor alone and a model alone are both what the gateway takes there, and prefixing either
|
|
24
|
+
* would name a model nobody has. `agent set --llm haiku` used to store `anthropic/haiku`, which
|
|
25
|
+
* is a 404 at the provider and nothing said so until a call went silent.
|
|
26
|
+
*/
|
|
27
|
+
export function theModelNamed(value) {
|
|
28
|
+
const model = modelOf(value);
|
|
29
|
+
if (model === undefined)
|
|
30
|
+
return undefined;
|
|
31
|
+
return value.includes("/") || SHORT_NAMES[value] !== undefined ? `${model.provider}/${model.model}` : value;
|
|
32
|
+
}
|
|
18
33
|
//# sourceMappingURL=models.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/cli/testing/models.ts"],"names":[],"mappings":"AAAA,sGAAsG;AAItG,gGAAgG;AAChG,kGAAkG;AAClG,gGAAgG;AAChG,uDAAuD;AACvD,MAAM,WAAW,GAA2B;
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/cli/testing/models.ts"],"names":[],"mappings":"AAAA,sGAAsG;AAItG,gGAAgG;AAChG,kGAAkG;AAClG,gGAAgG;AAChG,uDAAuD;AACvD,MAAM,CAAC,MAAM,WAAW,GAA2B;IACjD,KAAK,EAAE,2BAA2B;IAClC,MAAM,EAAE,iBAAiB;IACzB,IAAI,EAAE,eAAe;CACtB,CAAC;AAEF,8FAA8F;AAC9F,MAAM,UAAU,OAAO,CAAC,KAAa;IACnC,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IACnC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IAC1F,IAAI,QAAQ,KAAK,EAAE,IAAI,IAAI,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IACrD,OAAO,EAAE,QAAQ,EAAE,QAAS,EAAE,KAAK,EAAE,WAAW,CAAC,IAAK,CAAC,IAAI,IAAK,EAAE,CAAC;AACrE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,WAAW,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AAC9G,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** The agent's callers, as the gateway keeps them: read, written and dropped over its own doors. */
|
|
2
|
+
import { type Door } from "./gateway.js";
|
|
3
|
+
/** One caller the gateway holds: the three declarations, the facts, the state, and who wrote it. */
|
|
4
|
+
export interface Persona {
|
|
5
|
+
name: string;
|
|
6
|
+
about: string;
|
|
7
|
+
goal: string;
|
|
8
|
+
style: string;
|
|
9
|
+
facts: Record<string, string>;
|
|
10
|
+
state: Record<string, unknown>;
|
|
11
|
+
author: string;
|
|
12
|
+
set_at: number;
|
|
13
|
+
}
|
|
14
|
+
/** What a write sends: the caller whole, and the name it had when the write is a rename. */
|
|
15
|
+
export interface Written {
|
|
16
|
+
about?: string;
|
|
17
|
+
goal: string;
|
|
18
|
+
style: string;
|
|
19
|
+
facts?: Record<string, string>;
|
|
20
|
+
state?: Record<string, unknown>;
|
|
21
|
+
was?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* What a name nobody wrote reads as, for everybody who looks one up: the terminal's verbs, the
|
|
25
|
+
* console's own door, and the simulation both of them start. Where a caller is written now that it
|
|
26
|
+
* is not a file — the verb, and the screen that writes the same one.
|
|
27
|
+
*/
|
|
28
|
+
export declare const NOBODY: (name: string, agent: string) => string;
|
|
29
|
+
/** Every caller written for this agent, by name. */
|
|
30
|
+
export declare function personasOf(gateway: Door, agent: string): Promise<Persona[]>;
|
|
31
|
+
/** One caller by name, or undefined when nobody wrote them. */
|
|
32
|
+
export declare function personaNamed(gateway: Door, agent: string, name: string): Promise<Persona | undefined>;
|
|
33
|
+
/** The caller written whole — new, replaced, or renamed — and every caller after it. */
|
|
34
|
+
export declare function writePersona(gateway: Door, agent: string, name: string, written: Written): Promise<Persona[]>;
|
|
35
|
+
/** The caller dropped, and every caller after it. */
|
|
36
|
+
export declare function dropPersona(gateway: Door, agent: string, name: string): Promise<Persona[]>;
|
|
37
|
+
//# sourceMappingURL=personas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"personas.d.ts","sourceRoot":"","sources":["../../../src/cli/testing/personas.ts"],"names":[],"mappings":"AAAA,oGAAoG;AAEpG,OAAO,EAAS,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AAEhD,oGAAoG;AACpG,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,4FAA4F;AAC5F,MAAM,WAAW,OAAO;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,eAAO,MAAM,MAAM,SAAU,MAAM,SAAS,MAAM,KAAG,MAC0E,CAAC;AAKhI,oDAAoD;AACpD,wBAAsB,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAEjF;AAED,+DAA+D;AAC/D,wBAAsB,YAAY,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAE3G;AAED,wFAAwF;AACxF,wBAAsB,YAAY,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAEnH;AAED,qDAAqD;AACrD,wBAAsB,WAAW,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAEhG"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** The agent's callers, as the gateway keeps them: read, written and dropped over its own doors. */
|
|
2
|
+
import { asked } from "./gateway.js";
|
|
3
|
+
/**
|
|
4
|
+
* What a name nobody wrote reads as, for everybody who looks one up: the terminal's verbs, the
|
|
5
|
+
* console's own door, and the simulation both of them start. Where a caller is written now that it
|
|
6
|
+
* is not a file — the verb, and the screen that writes the same one.
|
|
7
|
+
*/
|
|
8
|
+
export const NOBODY = (name, agent) => `no persona called ${name} for ${agent}: \`pinecall personas add ${name} --goal '…' --style '…'\`, or the console's Personas`;
|
|
9
|
+
const door = (agent, name) => `/v1/agents/${encodeURIComponent(agent)}/personas${name === undefined ? "" : `/${encodeURIComponent(name)}`}`;
|
|
10
|
+
/** Every caller written for this agent, by name. */
|
|
11
|
+
export async function personasOf(gateway, agent) {
|
|
12
|
+
return (await asked(gateway, door(agent))).personas;
|
|
13
|
+
}
|
|
14
|
+
/** One caller by name, or undefined when nobody wrote them. */
|
|
15
|
+
export async function personaNamed(gateway, agent, name) {
|
|
16
|
+
return (await personasOf(gateway, agent)).find((one) => one.name === name);
|
|
17
|
+
}
|
|
18
|
+
/** The caller written whole — new, replaced, or renamed — and every caller after it. */
|
|
19
|
+
export async function writePersona(gateway, agent, name, written) {
|
|
20
|
+
return (await asked(gateway, door(agent, name), { method: "PUT", body: written })).personas;
|
|
21
|
+
}
|
|
22
|
+
/** The caller dropped, and every caller after it. */
|
|
23
|
+
export async function dropPersona(gateway, agent, name) {
|
|
24
|
+
return (await asked(gateway, door(agent, name), { method: "DELETE" })).personas;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=personas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"personas.js","sourceRoot":"","sources":["../../../src/cli/testing/personas.ts"],"names":[],"mappings":"AAAA,oGAAoG;AAEpG,OAAO,EAAE,KAAK,EAAa,MAAM,cAAc,CAAC;AAwBhD;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,KAAa,EAAU,EAAE,CAC5D,qBAAqB,IAAI,QAAQ,KAAK,6BAA6B,IAAI,sDAAsD,CAAC;AAEhI,MAAM,IAAI,GAAG,CAAC,KAAa,EAAE,IAAa,EAAU,EAAE,CACpD,cAAc,kBAAkB,CA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runtime because everything it needs is there — the LiveKit pair
|
|
21
|
-
* that signs the caller's seat, the provider key the persona is played with, and the
|
|
22
|
-
*
|
|
21
|
+
* that signs the caller's seat, the provider key the persona is played with, and the vendor that
|
|
22
|
+
* gives it a voice. This side mints the id and watches the log; nothing here opens an audio device.
|
|
23
23
|
*/
|
|
24
24
|
export declare function aVoiceCall(door: Door, wanted: {
|
|
25
25
|
call: string;
|
|
@@ -11,8 +11,8 @@ export function aCallId() {
|
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* One spoken call, held in the runtime because everything it needs is there — the LiveKit pair
|
|
14
|
-
* that signs the caller's seat, the provider key the persona is played with, and the
|
|
15
|
-
*
|
|
14
|
+
* that signs the caller's seat, the provider key the persona is played with, and the vendor that
|
|
15
|
+
* gives it a voice. This side mints the id and watches the log; nothing here opens an audio device.
|
|
16
16
|
*/
|
|
17
17
|
export async function aVoiceCall(door, wanted) {
|
|
18
18
|
return await asked(door, "/v1/evals/voice", {
|