pinecall 0.1.0 → 0.3.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/README.md +23 -5
- package/dist/agent/agent.d.ts +1 -1
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/agent.js +1 -0
- package/dist/agent/agent.js.map +1 -1
- package/dist/cli/chat.d.ts.map +1 -1
- package/dist/cli/chat.js +7 -3
- package/dist/cli/chat.js.map +1 -1
- package/dist/cli/home.d.ts +50 -0
- package/dist/cli/home.d.ts.map +1 -0
- package/dist/cli/home.js +77 -0
- package/dist/cli/home.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +5 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/knowledge.d.ts.map +1 -1
- package/dist/cli/knowledge.js +40 -5
- package/dist/cli/knowledge.js.map +1 -1
- package/dist/cli/line.d.ts.map +1 -1
- package/dist/cli/line.js +16 -7
- package/dist/cli/line.js.map +1 -1
- package/dist/cli/load.d.ts +7 -0
- package/dist/cli/load.d.ts.map +1 -1
- package/dist/cli/load.js +31 -4
- package/dist/cli/load.js.map +1 -1
- package/dist/cli/memory.d.ts.map +1 -1
- package/dist/cli/memory.js +8 -5
- package/dist/cli/memory.js.map +1 -1
- package/dist/cli/personas.d.ts.map +1 -1
- package/dist/cli/personas.js +26 -14
- package/dist/cli/personas.js.map +1 -1
- package/dist/cli/prompt.d.ts.map +1 -1
- package/dist/cli/prompt.js +5 -3
- package/dist/cli/prompt.js.map +1 -1
- package/dist/cli/remember.d.ts.map +1 -1
- package/dist/cli/remember.js +12 -5
- package/dist/cli/remember.js.map +1 -1
- package/dist/cli/run-console.d.ts +15 -0
- package/dist/cli/run-console.d.ts.map +1 -0
- package/dist/cli/run-console.js +49 -0
- package/dist/cli/run-console.js.map +1 -0
- package/dist/cli/run-screens.d.ts +23 -0
- package/dist/cli/run-screens.d.ts.map +1 -0
- package/dist/cli/run-screens.js +134 -0
- package/dist/cli/run-screens.js.map +1 -0
- package/dist/cli/run.d.ts +4 -5
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +151 -205
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/serve/server.d.ts +35 -0
- package/dist/cli/serve/server.d.ts.map +1 -0
- package/dist/cli/serve/server.js +199 -0
- package/dist/cli/serve/server.js.map +1 -0
- package/dist/cli/serve/sidecar.d.ts +31 -0
- package/dist/cli/serve/sidecar.d.ts.map +1 -0
- package/dist/cli/serve/sidecar.js +74 -0
- package/dist/cli/serve/sidecar.js.map +1 -0
- package/dist/cli/serve.d.ts +14 -0
- package/dist/cli/serve.d.ts.map +1 -0
- package/dist/cli/serve.js +81 -0
- package/dist/cli/serve.js.map +1 -0
- package/dist/cli/simulate.d.ts.map +1 -1
- package/dist/cli/simulate.js +7 -4
- package/dist/cli/simulate.js.map +1 -1
- package/dist/cli/test.d.ts.map +1 -1
- package/dist/cli/test.js +50 -9
- package/dist/cli/test.js.map +1 -1
- package/dist/cli/testing/goldens.d.ts +2 -0
- package/dist/cli/testing/goldens.d.ts.map +1 -1
- package/dist/cli/testing/goldens.js +9 -0
- package/dist/cli/testing/goldens.js.map +1 -1
- package/dist/cli/testing/reproduction.d.ts +6 -1
- package/dist/cli/testing/reproduction.d.ts.map +1 -1
- package/dist/cli/testing/reproduction.js +11 -1
- package/dist/cli/testing/reproduction.js.map +1 -1
- package/dist/cli/ui/admin/assets/{index-C3WMXdfL.css → index-BlHXSYVz.css} +1 -1
- package/dist/cli/ui/admin/assets/{index-DR1mxoAh.js → index-BpdIOuyO.js} +1 -1
- package/dist/cli/ui/admin/index.html +2 -2
- package/dist/cli/ui/chatting.d.ts +1 -1
- package/dist/cli/ui/chatting.d.ts.map +1 -1
- package/dist/cli/ui/chatting.js +2 -2
- package/dist/cli/ui/chatting.js.map +1 -1
- package/dist/cli/ui/console/assets/index-BUlGAwqn.css +1 -0
- package/dist/cli/ui/console/assets/{index-dOcE4usU.js → index-D9StTnoH.js} +12 -9
- package/dist/cli/ui/console/index.html +2 -2
- package/dist/cli/ui/knowing.d.ts +3 -0
- package/dist/cli/ui/knowing.d.ts.map +1 -1
- package/dist/cli/ui/knowing.js +4 -0
- package/dist/cli/ui/knowing.js.map +1 -1
- package/dist/cli/ui/remembering.d.ts +3 -0
- package/dist/cli/ui/remembering.d.ts.map +1 -1
- package/dist/cli/ui/remembering.js +10 -2
- package/dist/cli/ui/remembering.js.map +1 -1
- package/dist/cli/ui/simulating.d.ts +3 -0
- package/dist/cli/ui/simulating.d.ts.map +1 -1
- package/dist/cli/ui/simulating.js +7 -0
- package/dist/cli/ui/simulating.js.map +1 -1
- package/dist/cli/ui/testing.d.ts +3 -0
- package/dist/cli/ui/testing.d.ts.map +1 -1
- package/dist/cli/ui/testing.js +11 -3
- package/dist/cli/ui/testing.js.map +1 -1
- package/dist/client/client.d.ts +6 -0
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +20 -0
- package/dist/client/client.js.map +1 -1
- package/dist/runtime/connect.d.ts +1 -0
- package/dist/runtime/connect.d.ts.map +1 -1
- package/dist/runtime/connect.js +17 -0
- package/dist/runtime/connect.js.map +1 -1
- package/package.json +1 -1
- package/dist/cli/ui/console/assets/index-DCTnou52.css +0 -1
package/dist/cli/line.js
CHANGED
|
@@ -2,30 +2,34 @@
|
|
|
2
2
|
import { callsFrom as keptOnTheProfile } from "./profiles.js";
|
|
3
3
|
import { theDoor } from "./env.js";
|
|
4
4
|
import { load } from "./load.js";
|
|
5
|
+
import { oneHome } from "./home.js";
|
|
5
6
|
import { slugOf } from "../runtime/connect.js";
|
|
6
7
|
import { asked } from "./testing/gateway.js";
|
|
7
|
-
const USAGE = "usage: pinecall line [from <+number> | forget | claim | release] [agent.tsx]";
|
|
8
|
+
const USAGE = "usage: pinecall line [from <+number> | forget | claim | release] [agent.tsx] [--agent <name>]";
|
|
8
9
|
// A number exists once in a world, so it rings in one place. In production that place is the box
|
|
9
10
|
// and there is nothing to decide; in the sandbox an org shares ONE number and three developers
|
|
10
11
|
// may be running the same agent, so which terminal it rings in is claimed out loud. Alone nobody
|
|
11
12
|
// claims anything — the first `pinecall run` takes it. See the runtime's docs/protocol/gateway-api.md.
|
|
12
13
|
export const group = {
|
|
13
|
-
purpose: "whose terminal
|
|
14
|
+
purpose: "which phone is yours, and whose terminal anybody else's call rings in",
|
|
14
15
|
usage: `${USAGE}
|
|
15
16
|
|
|
16
17
|
With nothing after it: who is answering this agent's number right now, and who else is running
|
|
17
18
|
it and could take it.
|
|
18
19
|
|
|
19
20
|
\`from <+number>\` is the one you want. Say which phone is YOURS, once, and every call you make
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
reaches your own agent — on the number your customers call, in production, as much as on a
|
|
22
|
+
sandbox one: while you are running the agent your phone reaches your copy, and everybody else
|
|
23
|
+
reaches production. No claim, no coordination, three of you testing at the same time. It is
|
|
24
|
+
remembered for this gateway and re-sent by every \`pinecall run\`, each time it connects.
|
|
25
|
+
\`forget\` undoes it.
|
|
23
26
|
|
|
24
27
|
\`claim\` and \`release\` are the fallback, for a call from a number nobody said was theirs — a
|
|
25
28
|
customer, a colleague's phone. The first terminal to hold the agent has it; alone, you never
|
|
26
29
|
need either word.
|
|
27
30
|
|
|
28
|
-
The agent is the one in this directory
|
|
31
|
+
The agent is the one in this directory; at the root of a project of several, \`claim\`,
|
|
32
|
+
\`release\` and the bare \`line\` take --agent <name>. \`from\` and \`forget\` are about your phone.`,
|
|
29
33
|
run,
|
|
30
34
|
};
|
|
31
35
|
const VERBS = new Set(["from", "forget", "claim", "release"]);
|
|
@@ -53,7 +57,12 @@ export async function run(argv, out = process.stdout) {
|
|
|
53
57
|
out.write(`${forgotten(said.forgot)}\n`);
|
|
54
58
|
return 0;
|
|
55
59
|
}
|
|
56
|
-
|
|
60
|
+
// `--agent <name>` at a project's root names one of its agents; otherwise the class of this
|
|
61
|
+
// directory, or the file typed.
|
|
62
|
+
const flag = rest.indexOf("--agent");
|
|
63
|
+
const named = flag === -1 ? undefined : rest[flag + 1];
|
|
64
|
+
const file = (flag === -1 ? rest : [...rest.slice(0, flag), ...rest.slice(flag + 2)])[0];
|
|
65
|
+
const slug = slugOf((await load((await oneHome("line", file, named)).file)).ctor);
|
|
57
66
|
const said = verb === "claim"
|
|
58
67
|
? await claimed(door, slug)
|
|
59
68
|
: verb === "release"
|
package/dist/cli/line.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line.js","sourceRoot":"","sources":["../../src/cli/line.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAI3G,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAa,MAAM,sBAAsB,CAAC;AAExD,MAAM,KAAK,GAAG,
|
|
1
|
+
{"version":3,"file":"line.js","sourceRoot":"","sources":["../../src/cli/line.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAI3G,OAAO,EAAE,SAAS,IAAI,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAa,MAAM,sBAAsB,CAAC;AAExD,MAAM,KAAK,GAAG,+FAA+F,CAAC;AAE9G,iGAAiG;AACjG,+FAA+F;AAC/F,iGAAiG;AACjG,uGAAuG;AACvG,MAAM,CAAC,MAAM,KAAK,GAAU;IAC1B,OAAO,EAAE,uEAAuE;IAChF,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K,SAAS,CAAC,CAAC,CAAC,wCAAwC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC/F,CAAC;AAED,mFAAmF;AACnF,SAAS,OAAO,CAAC,IAAa;IAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,mBAAmB,CAAC,CAAC;IACzE,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,iBAAiB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AAC9E,CAAC"}
|
package/dist/cli/load.d.ts
CHANGED
|
@@ -32,6 +32,13 @@ export declare function load(file?: string): Promise<Loaded>;
|
|
|
32
32
|
export declare function instanceFor(loaded: Loaded, channel?: string): Agent;
|
|
33
33
|
/** What `mount` is given for a loaded agent: the client, the source and the file it came from. */
|
|
34
34
|
export declare function mountOptions(loaded: Loaded, pc: MountOptions["pc"]): MountOptions;
|
|
35
|
+
/** The folder a project of several agents keeps them in, one file each: `agents/<name>.tsx`. */
|
|
36
|
+
export declare const PROJECT_AGENTS = "agents";
|
|
37
|
+
/**
|
|
38
|
+
* The agents of the project rooted here: every `agents/<name>.tsx` (or `.ts`), sorted — and none
|
|
39
|
+
* when this directory holds an `agent.tsx` of its own, which makes it one agent's folder.
|
|
40
|
+
*/
|
|
41
|
+
export declare function agentFilesOfTheProject(root?: string): string[];
|
|
35
42
|
/** The refusal for a file typed where a slug is taken, or undefined when it is a slug. */
|
|
36
43
|
export declare function notASlug(said: string | undefined): string | undefined;
|
|
37
44
|
export declare function agentOfThisDirectory(): Promise<string | null>;
|
package/dist/cli/load.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../src/cli/load.ts"],"names":[],"mappings":"AAAA,wGAAwG;AAMxG,OAAO,EAAE,KAAK,EAAW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AC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAczD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,SAAQ,GAAG,KAAK,CAIlE;AAED,kGAAkG;AAClG,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,YAAY,CAAC,IAAI,CAAC,GAAG,YAAY,CAEjF;AAED,gGAAgG;AAChG,eAAO,MAAM,cAAc,WAAW,CAAC;AAKvC;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,GAAE,MAAsB,GAAG,MAAM,EAAE,CAQ7E;AA6BD,0FAA0F;AAC1F,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAGrE;AAED,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAOnE"}
|
package/dist/cli/load.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Loading a tenant's agent file from the CLI: the TypeScript loader, the class, and its own source. */
|
|
2
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
-
import { resolve } from "node:path";
|
|
2
|
+
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
3
|
+
import { basename, extname, resolve } from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
5
|
import { Agent, setCall } from "../agent/agent.js";
|
|
6
6
|
import { describe } from "../agent/docstrings.js";
|
|
@@ -64,14 +64,41 @@ export function instanceFor(loaded, channel = "web") {
|
|
|
64
64
|
export function mountOptions(loaded, pc) {
|
|
65
65
|
return { pc, source: loaded.source, file: loaded.file };
|
|
66
66
|
}
|
|
67
|
+
/** The folder a project of several agents keeps them in, one file each: `agents/<name>.tsx`. */
|
|
68
|
+
export const PROJECT_AGENTS = "agents";
|
|
69
|
+
// A file under agents/ that is not an agent: a test beside it, a type declaration.
|
|
70
|
+
const NOT_AN_AGENT = /\.(test|spec|d)\.tsx?$/;
|
|
71
|
+
/**
|
|
72
|
+
* The agents of the project rooted here: every `agents/<name>.tsx` (or `.ts`), sorted — and none
|
|
73
|
+
* when this directory holds an `agent.tsx` of its own, which makes it one agent's folder.
|
|
74
|
+
*/
|
|
75
|
+
export function agentFilesOfTheProject(root = process.cwd()) {
|
|
76
|
+
if (DEFAULT_AGENTS.some((name) => existsSync(resolve(root, name))))
|
|
77
|
+
return [];
|
|
78
|
+
const folder = resolve(root, PROJECT_AGENTS);
|
|
79
|
+
if (!existsSync(folder))
|
|
80
|
+
return [];
|
|
81
|
+
return readdirSync(folder, { withFileTypes: true })
|
|
82
|
+
.filter((entry) => entry.isFile() && /\.tsx?$/.test(entry.name) && !NOT_AN_AGENT.test(entry.name))
|
|
83
|
+
.map((entry) => resolve(folder, entry.name))
|
|
84
|
+
.sort();
|
|
85
|
+
}
|
|
67
86
|
// Nobody named a file. Looking for both names and saying so is the whole of it: a directory with
|
|
68
87
|
// neither is a directory somebody typed the verb in by mistake, and the refusal has to say where
|
|
69
|
-
// it looked rather than "no agent at /…/agent.tsx" for a project written in .ts.
|
|
88
|
+
// it looked rather than "no agent at /…/agent.tsx" for a project written in .ts. At a project's
|
|
89
|
+
// root the one agent is that agent; several have to be named.
|
|
70
90
|
function theAgentHere() {
|
|
71
91
|
const found = DEFAULT_AGENTS.map((name) => resolve(name)).find((path) => existsSync(path));
|
|
72
92
|
if (found !== undefined)
|
|
73
93
|
return found;
|
|
74
|
-
|
|
94
|
+
const project = agentFilesOfTheProject();
|
|
95
|
+
if (project.length === 1)
|
|
96
|
+
return project[0];
|
|
97
|
+
if (project.length > 1) {
|
|
98
|
+
const names = project.map((file) => `--agent ${basename(file, extname(file))}`).join(" or ");
|
|
99
|
+
throw new Error(`this project has ${project.length} agents: name one with ${names}`);
|
|
100
|
+
}
|
|
101
|
+
throw new Error(`no agent here: looked for ${DEFAULT_AGENTS.join(" and ")}, and ${PROJECT_AGENTS}/*.tsx, in ${process.cwd()}`);
|
|
75
102
|
}
|
|
76
103
|
// The slug of the agent this terminal is standing in, read the way `run` reads it, so no two verbs
|
|
77
104
|
// disagree about whose directory this is. No file here is not an error: it is a terminal outside
|
package/dist/cli/load.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.js","sourceRoot":"","sources":["../../src/cli/load.ts"],"names":[],"mappings":"AAAA,wGAAwG;AAExG,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"load.js","sourceRoot":"","sources":["../../src/cli/load.ts"],"names":[],"mappings":"AAAA,wGAAwG;AAExG,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAqB,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAStD;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,WAAW,EAAE,UAAU,CAAU,CAAC;AAEjE,IAAI,UAAU,GAAG,KAAK,CAAC;AAEvB,6FAA6F;AAC7F,gGAAgG;AAChG,mGAAmG;AACnG,sGAAsG;AACtG,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,IAAI,UAAU;QAAE,OAAO;IACvB,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;IACjD,QAAQ,EAAE,CAAC;IACX,U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QACH,MAAM,MAAM,GAAG,MAAM,IAAI,EAAE,CAAC;QAC5B,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/cli/memory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/cli/memory.ts"],"names":[],"mappings":"AAAA,uJAAuJ;AAOvJ,OAAO,KAAK,EAAE,WAAW,EAA4B,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAG7F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/cli/memory.ts"],"names":[],"mappings":"AAAA,uJAAuJ;AAOvJ,OAAO,KAAK,EAAE,WAAW,EAA4B,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAG7F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAIzC,OAAO,EAAS,KAAK,IAAI,EAAE,MAAM,sBAAsB,CAAC;AASxD,eAAO,MAAM,cAAc,uBAAuB,CAAC;AAKnD,+FAA+F;AAC/F,eAAO,MAAM,SAAS,WAAY,MAAM,KAAG,MAAyE,CAAC;AACrH,eAAO,MAAM,eAAe,WAAY,MAAM,KAAG,MACkC,CAAC;AAOpF,eAAO,MAAM,KAAK,EAAE,KAenB,CAAC;AAEF,gHAAgH;AAChH,MAAM,WAAW,SAAS;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,oGAAoG;IACpG,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAClD;AAED,2FAA2F;AAC3F,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,GAAE,SAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA0B9E;AAwDD,sGAAsG;AACtG,wBAAsB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAE9G;AAED,+GAA+G;AAC/G,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,EAAE,CAWxD;AAED,0GAA0G;AAC1G,wBAAgB,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,OAAO,GAAG,MAAM,CAOhE"}
|
package/dist/cli/memory.js
CHANGED
|
@@ -6,11 +6,12 @@ import { parseArgs } from "node:util";
|
|
|
6
6
|
import { theDoor } from "./env.js";
|
|
7
7
|
import { dayAndTime, theQuestionsIn } from "./knowledge.js";
|
|
8
8
|
import { load } from "./load.js";
|
|
9
|
+
import { AGENT_FLAG, homeOf, oneHome } from "./home.js";
|
|
9
10
|
import { asked } from "./testing/gateway.js";
|
|
10
11
|
import { refusal } from "./whoami.js";
|
|
11
12
|
const USAGE = `usage: pinecall memory <contact>
|
|
12
13
|
pinecall memory forget <contact>
|
|
13
|
-
pinecall memory eval [golden.json] [--k <n>] [--file agent.tsx]`;
|
|
14
|
+
pinecall memory eval [golden.json] [--k <n>] [--agent <name>] [--file agent.tsx]`;
|
|
14
15
|
// The golden beside the agent that answers with those facts: the questions recall is held to, and
|
|
15
16
|
// what each should have brought back. `memory/golden.json` is where `eval` looks when nobody says.
|
|
16
17
|
export const DEFAULT_GOLDEN = "memory/golden.json";
|
|
@@ -46,15 +47,17 @@ export async function run(argv, how = {}) {
|
|
|
46
47
|
const { values, positionals } = parseArgs({
|
|
47
48
|
args: argv,
|
|
48
49
|
allowPositionals: true,
|
|
49
|
-
options: { file: { type: "string" }, k: { type: "string" } },
|
|
50
|
+
options: { file: { type: "string" }, k: { type: "string" }, ...AGENT_FLAG },
|
|
50
51
|
});
|
|
51
52
|
const [verb, second] = positionals;
|
|
52
53
|
const door = theDoor(how.env ?? process.env, err);
|
|
53
54
|
if (door === undefined)
|
|
54
55
|
return 2;
|
|
55
56
|
try {
|
|
56
|
-
if (verb === "eval")
|
|
57
|
-
|
|
57
|
+
if (verb === "eval") {
|
|
58
|
+
const file = second === undefined ? (await oneHome("memory eval", values.file, values.agent)).file : values.file;
|
|
59
|
+
return await evaluate(door, second, values.k, file, out, err);
|
|
60
|
+
}
|
|
58
61
|
if (verb === "forget" && second !== undefined) {
|
|
59
62
|
return await forget(door, second, how.confirm ?? askOnATerminal, out);
|
|
60
63
|
}
|
|
@@ -93,7 +96,7 @@ async function forget(door, contact, confirm, out) {
|
|
|
93
96
|
// knob — never on a caller's clock — so it reads its questions off the disk and asks them in order.
|
|
94
97
|
// No contact of the org is read: each question's facts are the question's own.
|
|
95
98
|
async function evaluate(door, file, k, agent, out, err) {
|
|
96
|
-
const golden = resolve(file ??
|
|
99
|
+
const golden = resolve(file ?? homeOf((await load(agent)).file).memoryGolden);
|
|
97
100
|
if (!existsSync(golden)) {
|
|
98
101
|
err.write(`${NO_GOLDEN(golden)}\n`);
|
|
99
102
|
return 2;
|
package/dist/cli/memory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../src/cli/memory.ts"],"names":[],"mappings":"AAAA,uJAAuJ;AAEvJ,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAItC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC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AAK,EAAE,CAAC;IAChB,OAAO,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"personas.d.ts","sourceRoot":"","sources":["../../src/cli/personas.ts"],"names":[],"mappings":"AAAA,oGAAoG;AAIpG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"personas.d.ts","sourceRoot":"","sources":["../../src/cli/personas.ts"],"names":[],"mappings":"AAAA,oGAAoG;AAIpG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAOzC,eAAO,MAAM,KAAK,EAAE,KAanB,CAAC;AAMF,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,GAAE,MAAM,CAAC,cAA+B,GAAG,OAAO,CAAC,MAAM,CAAC,CA2BtG"}
|
package/dist/cli/personas.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { parseArgs } from "node:util";
|
|
3
3
|
import { aSimulation, TURNS } from "./simulate.js";
|
|
4
4
|
import { NO_PERSONAS, personaNamed, personasIn } from "./testing/caller.js";
|
|
5
|
-
|
|
5
|
+
import { AGENT_FLAG, homesFor, oneHome } from "./home.js";
|
|
6
|
+
const USAGE = "usage: pinecall personas list | show <name> | try <name> [--agent <name>] [--file agent.tsx]\n";
|
|
6
7
|
export const group = {
|
|
7
8
|
purpose: "list | show | try the synthetic callers in test/personas",
|
|
8
9
|
usage: `${USAGE}
|
|
@@ -24,23 +25,34 @@ export async function run(argv, out = process.stdout) {
|
|
|
24
25
|
const { values, positionals } = parseArgs({
|
|
25
26
|
args: argv,
|
|
26
27
|
allowPositionals: true,
|
|
27
|
-
options: { file: { type: "string" }, json: { type: "boolean", default: false } },
|
|
28
|
+
options: { file: { type: "string" }, json: { type: "boolean", default: false }, ...AGENT_FLAG },
|
|
28
29
|
});
|
|
29
30
|
const [verb, name] = positionals;
|
|
30
|
-
if (verb === "list")
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
if (verb === "list") {
|
|
32
|
+
const homes = await homesFor(values.file, values.agent);
|
|
33
|
+
let worst = 0;
|
|
34
|
+
for (const home of homes) {
|
|
35
|
+
if (homes.length > 1)
|
|
36
|
+
out.write(`── ${home.name} ──\n`);
|
|
37
|
+
worst = Math.max(worst, await listed(values.json === true, out, home.personas));
|
|
38
|
+
}
|
|
39
|
+
return worst;
|
|
40
|
+
}
|
|
41
|
+
if (verb === "show" && name !== undefined) {
|
|
42
|
+
return await shown(name, values.json === true, out, (await oneHome("personas show", values.file, values.agent)).personas);
|
|
43
|
+
}
|
|
34
44
|
// `try` runs the caller against the class, because reading a persona tells you who they are and
|
|
35
45
|
// only a call tells you how they land. It is `simulate` without the judge — one implementation.
|
|
36
|
-
if (verb === "try" && name !== undefined)
|
|
37
|
-
|
|
46
|
+
if (verb === "try" && name !== undefined) {
|
|
47
|
+
const home = await oneHome("personas try", values.file, values.agent);
|
|
48
|
+
return await tried(name, home.file, out, home.personas);
|
|
49
|
+
}
|
|
38
50
|
process.stderr.write(USAGE);
|
|
39
51
|
return 2;
|
|
40
52
|
}
|
|
41
53
|
/** One line per caller: the name a verb takes, and the goal it is written to pursue. */
|
|
42
|
-
async function listed(asJson, out) {
|
|
43
|
-
const personas = await personasIn();
|
|
54
|
+
async function listed(asJson, out, folder) {
|
|
55
|
+
const personas = await personasIn(folder);
|
|
44
56
|
if (personas.length === 0) {
|
|
45
57
|
process.stderr.write(`${NO_PERSONAS}\n`);
|
|
46
58
|
return 2;
|
|
@@ -52,8 +64,8 @@ async function listed(asJson, out) {
|
|
|
52
64
|
return 0;
|
|
53
65
|
}
|
|
54
66
|
/** One caller whole: how they talk, and every fact about themselves they are allowed to state. */
|
|
55
|
-
async function shown(name, asJson, out) {
|
|
56
|
-
const persona = await personaNamed(name);
|
|
67
|
+
async function shown(name, asJson, out, folder) {
|
|
68
|
+
const persona = await personaNamed(name, folder);
|
|
57
69
|
if (persona === undefined) {
|
|
58
70
|
process.stderr.write(`no persona called ${name}: ${NO_PERSONAS}\n`);
|
|
59
71
|
return 2;
|
|
@@ -73,8 +85,8 @@ function linesOf(persona) {
|
|
|
73
85
|
...(facts.length === 0 ? [` ${NO_FACTS}`] : facts.map(([name, value]) => ` ${name}: ${String(value)}`)),
|
|
74
86
|
];
|
|
75
87
|
}
|
|
76
|
-
async function tried(name, agentFile, out) {
|
|
77
|
-
const persona = await personaNamed(name);
|
|
88
|
+
async function tried(name, agentFile, out, folder) {
|
|
89
|
+
const persona = await personaNamed(name, folder);
|
|
78
90
|
if (persona === undefined) {
|
|
79
91
|
process.stderr.write(`no persona called ${name}: ${NO_PERSONAS}\n`);
|
|
80
92
|
return 2;
|
package/dist/cli/personas.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"personas.js","sourceRoot":"","sources":["../../src/cli/personas.ts"],"names":[],"mappings":"AAAA,oGAAoG;AAEpG,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAgB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"personas.js","sourceRoot":"","sources":["../../src/cli/personas.ts"],"names":[],"mappings":"AAAA,oGAAoG;AAEpG,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAgB,MAAM,qBAAqB,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1D,MAAM,KAAK,GAAG,gGAAgG,CAAC;AAE/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,CAAC,CAAC;IACjD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,IAAI,KAAK,WAAW,IAAI,CAAC,CAAC;QACpE,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE;QACtC,SAAS;QACT,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,KAAK;QACZ,GAAG;KACJ,CAAC,CAAC;IACH,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,OAAO,CAAC,OAAgB;IAC/B,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,EAAE,CAAC;AACpF,CAAC"}
|
package/dist/cli/prompt.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/cli/prompt.ts"],"names":[],"mappings":"AAAA,mGAAmG;AAKnG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/cli/prompt.ts"],"names":[],"mappings":"AAAA,mGAAmG;AAKnG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AASzC,eAAO,MAAM,KAAK,EAAE,KAanB,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,GAAG,CACvB,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,GAAE,MAAM,CAAC,cAA+B,EAC3C,GAAG,GAAE,MAAM,CAAC,cAA+B,GAC1C,OAAO,CAAC,MAAM,CAAC,CAejB;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,CAO5E"}
|
package/dist/cli/prompt.js
CHANGED
|
@@ -4,15 +4,17 @@ import { parseArgs } from "node:util";
|
|
|
4
4
|
import { showPrompt } from "../views/render.js";
|
|
5
5
|
import { showMachine } from "./machine.js";
|
|
6
6
|
import { instanceFor, load } from "./load.js";
|
|
7
|
+
import { AGENT_FLAG, oneHome } from "./home.js";
|
|
7
8
|
export const group = {
|
|
8
9
|
purpose: "the exact prompt a state would produce, offline",
|
|
9
|
-
usage: `usage: pinecall prompt [agent.tsx] --state <file> [--case n]
|
|
10
|
+
usage: `usage: pinecall prompt [agent.tsx] --state <file> [--case n] [--agent <name>]
|
|
10
11
|
|
|
11
12
|
The three regions of the prompt as the model would receive them — the static prefix, the
|
|
12
13
|
history, the dynamic blocks at the end — and under them the stage and the tools that stage
|
|
13
14
|
shows. No gateway, no key, no call: the class is loaded here and put in the state the file
|
|
14
15
|
describes, so this answers in the time it takes to save the file.
|
|
15
16
|
|
|
17
|
+
--agent <name> which agent of a project of several, by its file's name or its slug
|
|
16
18
|
--state file a goldens file: an array of cases, each with its own \`state\`, or one object
|
|
17
19
|
--case n which case of that file, when it holds several (default 0)`,
|
|
18
20
|
run,
|
|
@@ -27,13 +29,13 @@ export async function run(argv, out = process.stdout, err = process.stderr) {
|
|
|
27
29
|
const { values, positionals } = parseArgs({
|
|
28
30
|
args: argv,
|
|
29
31
|
allowPositionals: true,
|
|
30
|
-
options: { state: { type: "string" }, case: { type: "string" } },
|
|
32
|
+
options: { state: { type: "string" }, case: { type: "string" }, ...AGENT_FLAG },
|
|
31
33
|
});
|
|
32
34
|
if (values.state === undefined) {
|
|
33
35
|
err.write("pinecall prompt: --state <file> is required\n");
|
|
34
36
|
return 2;
|
|
35
37
|
}
|
|
36
|
-
const loaded = await load(positionals[0]);
|
|
38
|
+
const loaded = await load((await oneHome("prompt", positionals[0], values.agent)).file);
|
|
37
39
|
const agent = instanceFor(loaded);
|
|
38
40
|
agent.startIn(firstState(values.state, values.case));
|
|
39
41
|
out.write(`${showPrompt(agent)}\n\n${showMachine(agent)}\n`);
|
package/dist/cli/prompt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/cli/prompt.ts"],"names":[],"mappings":"AAAA,mGAAmG;AAEnG,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/cli/prompt.ts"],"names":[],"mappings":"AAAA,mGAAmG;AAEnG,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOhD,MAAM,CAAC,MAAM,KAAK,GAAU;IAC1B,OAAO,EAAE,iDAAiD;IAC1D,KAAK,EAAE;;;;;;;;;6EASoE;IAC3E,GAAG;CACJ,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,KAAK,U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AC,CAAC,MAAM,CAAC,CAAC;IACxD,MAAM,KAAK,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IAC5B,IAAI,MAAM,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,gBAAgB,KAAK,EAAE,CAAC,CAAC;IAC1E,OAAO,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC;AAC5B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remember.d.ts","sourceRoot":"","sources":["../../src/cli/remember.ts"],"names":[],"mappings":"AAAA,gIAAgI;AAKhI,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAM1E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"remember.d.ts","sourceRoot":"","sources":["../../src/cli/remember.ts"],"names":[],"mappings":"AAAA,gIAAgI;AAKhI,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAM1E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAS,KAAK,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAKxD;;;GAGG;AACH,eAAO,MAAM,KAAK,gBAAgB,CAAC;AAEnC,eAAO,MAAM,QAAQ,0FAAuF,CAAC;AAI7G,eAAO,MAAM,KAAK,EAAE,KAanB,CAAC;AAEF,qGAAqG;AACrG,MAAM,WAAW,OAAO;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,GAAE,OAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CA6C5E;AAED,kGAAkG;AAClG,wBAAsB,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAK5G;AAED,mGAAmG;AACnG,wBAAgB,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,EAAE,CAkBvD"}
|
package/dist/cli/remember.js
CHANGED
|
@@ -5,6 +5,7 @@ import { Pinecall } from "../client/index.js";
|
|
|
5
5
|
import { mount } from "../runtime/connect.js";
|
|
6
6
|
import { theDoor } from "./env.js";
|
|
7
7
|
import { load, mountOptions } from "./load.js";
|
|
8
|
+
import { AGENT_FLAG, oneHome } from "./home.js";
|
|
8
9
|
import { asked } from "./testing/gateway.js";
|
|
9
10
|
import { casesIn, matching } from "./testing/goldens.js";
|
|
10
11
|
import { BROKEN, HELD } from "./testing/score.js";
|
|
@@ -15,7 +16,7 @@ import { refusal } from "./whoami.js";
|
|
|
15
16
|
*/
|
|
16
17
|
export const CASES = "test/memory";
|
|
17
18
|
export const NO_CASES = `no extraction goldens at ${CASES}: write one, or name the file or directory to run`;
|
|
18
|
-
const USAGE = "usage: pinecall remember [paths] [--file agent.tsx] [--grep x] [--json]";
|
|
19
|
+
const USAGE = "usage: pinecall remember [paths] [--agent <name>] [--file agent.tsx] [--grep x] [--json]";
|
|
19
20
|
export const group = {
|
|
20
21
|
purpose: "the goldens memory.remember is held to: what a call teaches, and what it never keeps",
|
|
21
22
|
usage: `${USAGE}
|
|
@@ -44,6 +45,7 @@ export async function run(argv, how = {}) {
|
|
|
44
45
|
allowPositionals: true,
|
|
45
46
|
options: {
|
|
46
47
|
file: { type: "string" },
|
|
48
|
+
...AGENT_FLAG,
|
|
47
49
|
grep: { type: "string" },
|
|
48
50
|
json: { type: "boolean", default: false },
|
|
49
51
|
},
|
|
@@ -51,16 +53,21 @@ export async function run(argv, how = {}) {
|
|
|
51
53
|
const door = theDoor(how.env ?? process.env, err);
|
|
52
54
|
if (door === undefined)
|
|
53
55
|
return 2;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
// The agent's home says where its cases are; a directory with no agent at all is told where a
|
|
57
|
+
// case belongs, before any class is looked for.
|
|
58
|
+
const home = await oneHome("remember", values.file, values.agent).catch(() => undefined);
|
|
59
|
+
const folder = home?.memoryCases ?? CASES;
|
|
60
|
+
const paths = positionals.length > 0 ? positionals : [folder];
|
|
61
|
+
if (positionals.length === 0 && !existsSync(folder)) {
|
|
62
|
+
err.write(`${home === undefined ? NO_CASES : NO_CASES.replace(CASES, folder)}\n${USAGE}\n`);
|
|
56
63
|
return 2;
|
|
57
64
|
}
|
|
58
|
-
const cases = matching(await casesIn(
|
|
65
|
+
const cases = matching(await casesIn(paths, CASES), values.grep);
|
|
59
66
|
if (cases.length === 0) {
|
|
60
67
|
err.write(`no case matched${values.grep === undefined ? "" : ` --grep ${values.grep}`}\n`);
|
|
61
68
|
return 2;
|
|
62
69
|
}
|
|
63
|
-
const loaded = await load(values.file);
|
|
70
|
+
const loaded = await load(home?.file ?? values.file);
|
|
64
71
|
const pc = new Pinecall({ url: door.url, apiKey: door.apiKey });
|
|
65
72
|
// takesUnclaimed: false for the reason `test` has it: this process holds the agent so the run
|
|
66
73
|
// reaches THIS class, and a real call must not ring in a terminal running a suite.
|
package/dist/cli/remember.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remember.js","sourceRoot":"","sources":["../../src/cli/remember.ts"],"names":[],"mappings":"AAAA,gIAAgI;AAEhI,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAItC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,OAAO,EAA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,MAAM,CAAC,KAAK,MAAM,OAAO,MAAM,MAAM,CAAC,IAAI,WAAW,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK;KAC1G,CAAC;IACF,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACpC,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YAChB,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;YACvC,SAAS;QACX,CAAC;QACD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC;QACjC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QAChE,KAAK,CAAC,IAAI,CAAC,KAAK,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QACzC,KAAK,MAAM,GAAG,IAAI,KAAK;YAAE,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;QACvF,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,KAAK,IAAI,EAAE;YAAE,KAAK,CAAC,IAAI,CAAC,mBAAmB,KAAK,EAAE,CAAC,CAAC;QAC/E,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,OAAO,IAAI,EAAE;YAAE,KAAK,CAAC,IAAI,CAAC,mBAAmB,OAAO,EAAE,CAAC,CAAC;IACvF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** The `console` line `pinecall run` prints: where a person looks at what this process is running. */
|
|
2
|
+
import { type Door } from "./testing/gateway.js";
|
|
3
|
+
/** `where` when the key opens production: the console is the gateway's own page. */
|
|
4
|
+
export declare const HOSTED = "hosted";
|
|
5
|
+
/** `where` when the key opens the sandbox and no `pinecall serve` is up on this machine. */
|
|
6
|
+
export declare const NOWHERE = "nowhere";
|
|
7
|
+
/** Where the gateway's console of this agent is, with the code that signs the browser in. */
|
|
8
|
+
export declare function consoleUrl(gateway: string, slug: string, code: string): string;
|
|
9
|
+
/** Where this machine's console of this agent is: nothing to sign in to, so nothing in the URL. */
|
|
10
|
+
export declare function localUrl(sidecar: string, slug: string): string;
|
|
11
|
+
/** Why the console line has no URL in it, in words that name the next move. */
|
|
12
|
+
export declare function whyNoConsole(refused: unknown): string;
|
|
13
|
+
/** The line under `connected`: the console's URL, or the verb that opens one. */
|
|
14
|
+
export declare function consoleLine(door: Door, slug: string, where: string): Promise<string>;
|
|
15
|
+
//# sourceMappingURL=run-console.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-console.d.ts","sourceRoot":"","sources":["../../src/cli/run-console.ts"],"names":[],"mappings":"AAAA,sGAAsG;AAEtG,OAAO,EAAkB,KAAK,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAKjE,oFAAoF;AACpF,eAAO,MAAM,MAAM,WAAW,CAAC;AAE/B,4FAA4F;AAC5F,eAAO,MAAM,OAAO,YAAY,CAAC;AAMjC,6FAA6F;AAC7F,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9E;AAED,mGAAmG;AACnG,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9D;AAQD,+EAA+E;AAC/E,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAKrD;AAKD,iFAAiF;AACjF,wBAAsB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAS1F"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** The `console` line `pinecall run` prints: where a person looks at what this process is running. */
|
|
2
|
+
import { asked, Refused } from "./testing/gateway.js";
|
|
3
|
+
// What a gateway answers for a path no router of its declared.
|
|
4
|
+
const NO_SUCH_DOOR = 404;
|
|
5
|
+
/** `where` when the key opens production: the console is the gateway's own page. */
|
|
6
|
+
export const HOSTED = "hosted";
|
|
7
|
+
/** `where` when the key opens the sandbox and no `pinecall serve` is up on this machine. */
|
|
8
|
+
export const NOWHERE = "nowhere";
|
|
9
|
+
// Production's console is the gateway's page at `/a/<agent>`, and it holds a key of its own — never
|
|
10
|
+
// this process's. So this process mints a one-use code standing for its key (five minutes, once)
|
|
11
|
+
// and prints the URL that carries it; the page spends it for a key of the tab's own. A gateway
|
|
12
|
+
// that refuses the code is one line, and the app runs on.
|
|
13
|
+
/** Where the gateway's console of this agent is, with the code that signs the browser in. */
|
|
14
|
+
export function consoleUrl(gateway, slug, code) {
|
|
15
|
+
return `${gateway.replace(/\/$/, "")}/a/${encodeURIComponent(slug)}?login=${encodeURIComponent(code)}`;
|
|
16
|
+
}
|
|
17
|
+
/** Where this machine's console of this agent is: nothing to sign in to, so nothing in the URL. */
|
|
18
|
+
export function localUrl(sidecar, slug) {
|
|
19
|
+
return `${sidecar.replace(/\/$/, "")}/a/${encodeURIComponent(slug)}`;
|
|
20
|
+
}
|
|
21
|
+
// A 404 at this door means the gateway has no such door, which means it is OLDER than this CLI —
|
|
22
|
+
// a long-running dev gateway is the usual way to meet it, since nothing restarts one for you. A
|
|
23
|
+
// status is not a thing a person can act on, so the sentence says the cause and the fix instead.
|
|
24
|
+
const OLDER_GATEWAY = "this gateway has no login-code door, so it is older than this CLI. Restart it: it serves the console too, and that will be stale as well.";
|
|
25
|
+
/** Why the console line has no URL in it, in words that name the next move. */
|
|
26
|
+
export function whyNoConsole(refused) {
|
|
27
|
+
if (refused instanceof Refused) {
|
|
28
|
+
return refused.status === NO_SUCH_DOOR ? OLDER_GATEWAY : `the gateway answered ${refused.status}`;
|
|
29
|
+
}
|
|
30
|
+
return refused instanceof Error ? refused.message : String(refused);
|
|
31
|
+
}
|
|
32
|
+
// The sandbox is watched on this machine and production on the gateway: two consoles, and this
|
|
33
|
+
// line is where a person learns which one is theirs right now. `where` is a sidecar's URL, or
|
|
34
|
+
// HOSTED, or NOWHERE.
|
|
35
|
+
/** The line under `connected`: the console's URL, or the verb that opens one. */
|
|
36
|
+
export async function consoleLine(door, slug, where) {
|
|
37
|
+
if (where === NOWHERE)
|
|
38
|
+
return "console `pinecall serve` opens it on this machine (or `pinecall run --serve`)";
|
|
39
|
+
if (where !== HOSTED)
|
|
40
|
+
return `console ${localUrl(where, slug)}`;
|
|
41
|
+
try {
|
|
42
|
+
const minted = await asked(door, "/v1/login/codes", { method: "POST", body: {} });
|
|
43
|
+
return `console ${consoleUrl(door.url, slug, minted.code)} (opens within five minutes, once)`;
|
|
44
|
+
}
|
|
45
|
+
catch (refused) {
|
|
46
|
+
return `console not available: ${whyNoConsole(refused)}`;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=run-console.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-console.js","sourceRoot":"","sources":["../../src/cli/run-console.ts"],"names":[],"mappings":"AAAA,sGAAsG;AAEtG,OAAO,EAAE,KAAK,EAAE,OAAO,EAAa,MAAM,sBAAsB,CAAC;AAEjE,+DAA+D;AAC/D,MAAM,YAAY,GAAG,GAAG,CAAC;AAEzB,oFAAoF;AACpF,MAAM,CAAC,MAAM,MAAM,GAAG,QAAQ,CAAC;AAE/B,4FAA4F;AAC5F,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;AAEjC,oGAAoG;AACpG,iGAAiG;AACjG,+FAA+F;AAC/F,0DAA0D;AAC1D,6FAA6F;AAC7F,MAAM,UAAU,UAAU,CAAC,OAAe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CAAC,CAAC;QACpG,OAAO,YAAY,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC;IACnG,CAAC;IAAC,OAAO,OAAO,EAAE,CAAC;QACjB,OAAO,2BAA2B,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC;IAC5D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** What `pinecall run` prints while it holds the agents: the plain log, the JSON pipe, and the full-screen view. */
|
|
2
|
+
import type { CamelEvent, Pinecall } from "../client/index.js";
|
|
3
|
+
/** What `run` knows about the agent it just registered: everything the one line names. */
|
|
4
|
+
export type Listen = (listener: (event: CamelEvent) => void) => () => void;
|
|
5
|
+
export declare function stream(pc: Pinecall, listen: Listen): Promise<number>;
|
|
6
|
+
/** One agent as the plain log prints it: its events, its connected line, and what follows it. */
|
|
7
|
+
export interface Plain {
|
|
8
|
+
slug: string;
|
|
9
|
+
heard: Listen;
|
|
10
|
+
connected: string;
|
|
11
|
+
after: () => Promise<string[]>;
|
|
12
|
+
}
|
|
13
|
+
export declare function plain(pc: Pinecall, agents: Plain[], url: string): Promise<number>;
|
|
14
|
+
/** The full-screen terminal view: absorb every event, and repaint at most ten times a second. */
|
|
15
|
+
export declare function live(pc: Pinecall, listen: Listen, watching: Watching): Promise<number>;
|
|
16
|
+
/** What the view needs beyond the events: who it is watching, and how to ask for the prompt. */
|
|
17
|
+
export interface Watching {
|
|
18
|
+
slug: string;
|
|
19
|
+
url: string;
|
|
20
|
+
prompt(): string;
|
|
21
|
+
}
|
|
22
|
+
export declare function forever(): Promise<void>;
|
|
23
|
+
//# sourceMappingURL=run-screens.d.ts.map
|