@pinecall/agents 0.9.20 → 0.9.22
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 +33 -19
- package/dist/call/room.d.ts +1 -1
- package/dist/call/room.d.ts.map +1 -1
- package/dist/serve/index.d.ts +2 -1
- package/dist/serve/index.d.ts.map +1 -1
- package/dist/serve/index.js +4 -2
- package/dist/serve/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,12 +5,13 @@ methods are what the model can call, docstrings are the prompt, and `render()` d
|
|
|
5
5
|
current turn.
|
|
6
6
|
|
|
7
7
|
```tsx
|
|
8
|
+
/** You are the front desk of Clínica Norte. Formal, short sentences. */
|
|
8
9
|
export default class ClinicaNorte extends Agent {
|
|
9
10
|
stage: Stages<"identify" | "choose" | "book"> = "identify";
|
|
10
11
|
patient?: Patient | undefined;
|
|
11
12
|
slot?: Slot | undefined;
|
|
12
13
|
|
|
13
|
-
/**
|
|
14
|
+
/** Finds the patient by name and phone. Ask for both before calling it. */
|
|
14
15
|
@tool({ stage: "identify", pii: ["name", "phone"] })
|
|
15
16
|
async findPatient(name: string, phone: string): Promise<Patient | null> {
|
|
16
17
|
this.patient = await this.agenda().find(name, phone);
|
|
@@ -22,8 +23,8 @@ export default class ClinicaNorte extends Agent {
|
|
|
22
23
|
override render() {
|
|
23
24
|
return (
|
|
24
25
|
<>
|
|
25
|
-
{this.stage === "identify" && <p>
|
|
26
|
-
{this.patient && <p>
|
|
26
|
+
{this.stage === "identify" && <p>Greet the caller and ask for their name and phone.</p>}
|
|
27
|
+
{this.patient && <p>You are talking to {this.patient.name}, already on file.</p>}
|
|
27
28
|
</>
|
|
28
29
|
);
|
|
29
30
|
}
|
|
@@ -38,17 +39,31 @@ WebSocket.
|
|
|
38
39
|
## Install
|
|
39
40
|
|
|
40
41
|
```bash
|
|
41
|
-
npm i @pinecall/agents
|
|
42
|
+
npm i @pinecall/agents # in the project: the framework your agents are written in
|
|
43
|
+
npm i -g pinecall # once per machine: the CLI, the same for TypeScript, Ruby and Python
|
|
42
44
|
```
|
|
43
45
|
|
|
44
|
-
The CLI is its own package, [`pinecall`](https://github.com/pinecall/cli)
|
|
45
|
-
one, it starts the agents of your project through
|
|
46
|
-
|
|
47
|
-
[`pip install pinecall`](https://github.com/pinecall/runtime) (see
|
|
48
|
-
[
|
|
46
|
+
The CLI is its own package, [`pinecall`](https://github.com/pinecall/cli), and never a dependency
|
|
47
|
+
of the project: it never loads this one, it starts the agents of your project through the
|
|
48
|
+
`@pinecall/agents/serve` your project pinned. It needs a gateway: use Pinecall's hosted one, or run your own with
|
|
49
|
+
[`pip install pinecall-runtime`](https://github.com/pinecall/runtime) (see
|
|
50
|
+
[Self-hosting](https://docs.pinecall.io/self-hosting/overview/)).
|
|
49
51
|
|
|
50
52
|
## Quick start
|
|
51
53
|
|
|
54
|
+
```bash
|
|
55
|
+
npm i -g pinecall
|
|
56
|
+
pinecall new front-desk # a project of one agent: the class, its test, a golden, the toolchain
|
|
57
|
+
cd front-desk && npm install
|
|
58
|
+
pinecall link # sign in through the browser; writes your key to ./.env
|
|
59
|
+
pinecall chat # talk to the agent in this terminal
|
|
60
|
+
pinecall test # run its golden against a real model
|
|
61
|
+
pinecall start # run the agent (this is the process you deploy)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The whole example, a clinic's receptionist with stages, a calendar and documents, from this
|
|
65
|
+
checkout:
|
|
66
|
+
|
|
52
67
|
```bash
|
|
53
68
|
pnpm install
|
|
54
69
|
npm i -g pinecall # the CLI; the example takes the framework from this checkout
|
|
@@ -63,8 +78,8 @@ pinecall test # run the goldens
|
|
|
63
78
|
Other useful verbs: `pinecall prompt --state <file>` prints the exact prompt a state produces
|
|
64
79
|
(`--channel web --medium text` for the one a written chat gets);
|
|
65
80
|
`pinecall docs push` uploads a knowledge base and `pinecall docs attach <base>` gives it to the
|
|
66
|
-
agent; `pinecall deploy` runs the project on
|
|
67
|
-
`pinecall secrets` for what it is started with ([
|
|
81
|
+
agent; `pinecall deploy` runs the project on Pinecall instead of your own server, with
|
|
82
|
+
`pinecall secrets` for what it is started with ([Deploy to Pinecall](https://docs.pinecall.io/guides/deploy/)). Every verb runs against the sandbox unless `--prod` is given. The CLI reads `PINECALL_KEY`
|
|
68
83
|
and `PINECALL_URL` from the environment or the project's `.env`. Full reference:
|
|
69
84
|
[docs/the-cli.md](https://github.com/pinecall/cli/blob/main/docs/the-cli.md).
|
|
70
85
|
|
|
@@ -72,7 +87,7 @@ A project holds one or more agents: `agents/<name>/agent.tsx` and their tests in
|
|
|
72
87
|
`test/<name>/`. Voice, model, language, greeting, knowledge and the documents an agent searches
|
|
73
88
|
are per-world settings, not class fields or files in the repository: `pinecall agent set
|
|
74
89
|
--language es` is how the agent's calls come to be in Spanish. Running in production on your own server:
|
|
75
|
-
[
|
|
90
|
+
[Run it on your own server](https://docs.pinecall.io/guides/own-server/).
|
|
76
91
|
|
|
77
92
|
## Development
|
|
78
93
|
|
|
@@ -107,14 +122,13 @@ The wire is the runtime's, kept in `src/wire/`; the runtime's golden call log, i
|
|
|
107
122
|
|
|
108
123
|
| | |
|
|
109
124
|
|---|---|
|
|
110
|
-
| [
|
|
111
|
-
| [
|
|
112
|
-
| [
|
|
113
|
-
| [
|
|
114
|
-
| [
|
|
115
|
-
| [docs/worlds-and-teams.md](docs/worlds-and-teams.md) | keys, sandbox and production, teams |
|
|
116
|
-
| [docs/production.md](docs/production.md) | running an agent on your own server |
|
|
125
|
+
| [Tutorial](docs/tutorial.md) | forty minutes, from an empty directory to an agent with knowledge and memory, tested and shipped |
|
|
126
|
+
| [Writing an agent](docs/writing-an-agent.md) | the class: config, state, stages, tools, hooks, the call, the panel |
|
|
127
|
+
| [The view](docs/the-view.md) | the four blocks of the prompt, and `render()` |
|
|
128
|
+
| [Testing an agent](docs/testing-an-agent.md) | ring 0 with no network, no key and no model, and the rings above |
|
|
129
|
+
| [Production](docs/production.md) | `pinecall deploy`, `mount` in your own app, or `pinecall start --prod` |
|
|
117
130
|
| [ARCHITECTURE.md](ARCHITECTURE.md) | the package file by file |
|
|
131
|
+
| [docs.pinecall.io](https://docs.pinecall.io) | the product: agents, judges, goldens, the console, the CLI |
|
|
118
132
|
|
|
119
133
|
## License
|
|
120
134
|
|
package/dist/call/room.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** The call's room: its participants and the commands that act on them. */
|
|
2
2
|
import { type Camel, type CommandData } from "../wire/codec.js";
|
|
3
3
|
import { type CommandType } from "../wire/registry.js";
|
|
4
|
-
/** A participant's role in the call (
|
|
4
|
+
/** A participant's role in the call (the wire's `ParticipantKind`, src/wire/defs.ts). */
|
|
5
5
|
export type ParticipantKind = "caller" | "agent" | "supervisor" | "listener" | "sip";
|
|
6
6
|
/** One participant in the room. */
|
|
7
7
|
export interface Participant {
|
package/dist/call/room.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"room.d.ts","sourceRoot":"","sources":["../../src/call/room.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAE3E,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,
|
|
1
|
+
{"version":3,"file":"room.d.ts","sourceRoot":"","sources":["../../src/call/room.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAE3E,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,yFAAyF;AACzF,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,OAAO,GAAG,YAAY,GAAG,UAAU,GAAG,KAAK,CAAC;AAErF,mCAAmC;AACnC,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAA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AE,MAAM,CAAA;KAAE,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAIzF;IAED,0BAA0B;IAC1B,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAE3B;IAED,6DAA6D;IAC7D,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI,CAGlD;CACF"}
|
package/dist/serve/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** `@pinecall/agents/serve`: the entry the CLI starts an agent with — `start` holds it, `prompt` prints it. */
|
|
2
2
|
import { type Io } from "./io.js";
|
|
3
|
-
/** Run one verb; 2 when it cannot run at all, with the sentence on `err
|
|
3
|
+
/** Run one verb; 2 when it cannot run at all, with the sentence on `err` — a flag it does not have,
|
|
4
|
+
* a class it cannot serve, or a gateway that refuses the registration (a slug of another org). */
|
|
4
5
|
export declare function main(argv: string[], io?: Io): Promise<number>;
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/serve/index.ts"],"names":[],"mappings":"AAAA,+GAA+G;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/serve/index.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAQ/G,OAAO,EAAa,KAAK,EAAE,EAAE,MAAM,SAAS,CAAC;AAW7C;kGACkG;AAClG,wBAAsB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAE,EAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAYhF"}
|
package/dist/serve/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { realpathSync } from "node:fs";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
4
|
import { DeclarationRefused } from "../agent/tools.js";
|
|
5
|
+
import { Refused } from "../client/index.js";
|
|
5
6
|
import { processIo } from "./io.js";
|
|
6
7
|
import { CannotServe } from "./load.js";
|
|
7
8
|
import { prompt } from "./prompt.js";
|
|
@@ -11,7 +12,8 @@ const USAGE = `usage: serve start --file <agent.tsx> --slug <slug> [--file … -
|
|
|
11
12
|
|
|
12
13
|
Reads PINECALL_URL, PINECALL_KEY and PINECALL_ENV from its environment and nothing else.
|
|
13
14
|
start leaves on SIGINT, SIGTERM or the end of its stdin, draining first; a second signal leaves now.`;
|
|
14
|
-
/** Run one verb; 2 when it cannot run at all, with the sentence on `err
|
|
15
|
+
/** Run one verb; 2 when it cannot run at all, with the sentence on `err` — a flag it does not have,
|
|
16
|
+
* a class it cannot serve, or a gateway that refuses the registration (a slug of another org). */
|
|
15
17
|
export async function main(argv, io = processIo()) {
|
|
16
18
|
const [verb, ...rest] = argv;
|
|
17
19
|
try {
|
|
@@ -21,7 +23,7 @@ export async function main(argv, io = processIo()) {
|
|
|
21
23
|
return await prompt(rest, io);
|
|
22
24
|
}
|
|
23
25
|
catch (failed) {
|
|
24
|
-
if (!(failed instanceof CannotServe) && !(failed instanceof DeclarationRefused) && !isAFlag(failed))
|
|
26
|
+
if (!(failed instanceof CannotServe) && !(failed instanceof DeclarationRefused) && !(failed instanceof Refused) && !isAFlag(failed))
|
|
25
27
|
throw failed;
|
|
26
28
|
io.err.write(`${failed.message}\n`);
|
|
27
29
|
return 2;
|
package/dist/serve/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/serve/index.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAE/G,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/serve/index.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAE/G,OAAO,EAAE,YAAY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,CAAC;AAED,SAAS,OAAO,CAAC,MAAe;IAC9B,MAAM,IAAI,GAAI,MAAgC,CAAC,IAAI,CAAC;IACpD,OAAO,MAAM,YAAY,KAAK,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;AACnG,CAAC;AAED,kFAAkF;AAClF,SAAS,OAAO;IACd,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9B,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACtC,IAAI,CAAC;QACH,OAAO,OAAO,IAAI,CAAC,GAAG,KAAK,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IACrE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,IAAI,OAAO,EAAE;IAAE,OAAO,CAAC,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pinecall/agents",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.22",
|
|
4
4
|
"description": "Write an agent as a class: its fields are the state, its @tool methods are the model's verbs, and its docstrings are the prompt. The pinecall CLI serves it",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Pinecall <hello@pinecall.io>",
|