@pinecall/protocol 0.6.0 → 0.6.2

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.
@@ -46,7 +46,7 @@ export type Snake<T> = T extends readonly (infer Item)[] ? Snake<Item>[] : T ext
46
46
  } : T;
47
47
  /** The keys whose values belong to the app (its state, a tool's arguments, a map it named): never renamed below them. */
48
48
  export declare const OPAQUE_KEYS: Set<string>;
49
- export type OpaqueKey = "app_state" | "arguments" | "attributes" | "data" | "input" | "metadata" | "output" | "parameters" | "prompt" | "result" | "state";
49
+ export type OpaqueKey = "app_state" | "arguments" | "attributes" | "data" | "facts" | "input" | "metadata" | "output" | "parameters" | "prompt" | "result" | "state";
50
50
  /** Rename every key from snake_case to camelCase, deep. Values are never touched. */
51
51
  export declare function toCamel<T>(value: T): Camel<T>;
52
52
  /** Rename every key from camelCase to snake_case, deep. Values are never touched. */
@@ -37,7 +37,7 @@ export function isCommandType(type) {
37
37
  return Object.hasOwn(COMMAND_SCHEMAS, type);
38
38
  }
39
39
  /** The keys whose values belong to the app (its state, a tool's arguments, a map it named): never renamed below them. */
40
- export const OPAQUE_KEYS = new Set(["app_state", "arguments", "attributes", "data", "input", "metadata", "output", "parameters", "prompt", "result", "state"]);
40
+ export const OPAQUE_KEYS = new Set(["app_state", "arguments", "attributes", "data", "facts", "input", "metadata", "output", "parameters", "prompt", "result", "state"]);
41
41
  /** Rename every key from snake_case to camelCase, deep. Values are never touched. */
42
42
  export function toCamel(value) {
43
43
  return renameKeys(value, camelCase);
@@ -30,8 +30,8 @@ export declare const EnvSchema: z.ZodEnum<{
30
30
  export type Env = z.infer<typeof EnvSchema>;
31
31
  /**
32
32
  * What a console may ask of the process standing in the agent's directory, relayed by the gateway:
33
- * a written call to the class mounted there (chat), a simulated caller from its personas, its
34
- * goldens and a suite of them, its knowledge folder pushed or its golden asked, its memory
33
+ * a written call to the class mounted there (chat), a simulated caller put on the class it holds,
34
+ * its goldens and a suite of them, its knowledge folder pushed or its golden asked, its memory
35
35
  * goldens, a call promoted to a candidate file, the drift of the last two windows, and the
36
36
  * reproductions a broken run left on that disk. Everything else a console needs is a door of the
37
37
  * gateway.
@@ -54,7 +54,6 @@ export declare const DevVerbSchema: z.ZodEnum<{
54
54
  "promote.write": "promote.write";
55
55
  "reproductions.read": "reproductions.read";
56
56
  "reproductions.roster": "reproductions.roster";
57
- "simulate.roster": "simulate.roster";
58
57
  "simulate.start": "simulate.start";
59
58
  }>;
60
59
  export type DevVerb = z.infer<typeof DevVerbSchema>;
@@ -18,13 +18,13 @@ export const DirectionSchema = z.enum(["inbound", "outbound"]);
18
18
  export const EnvSchema = z.enum(["production", "sandbox"]);
19
19
  /**
20
20
  * What a console may ask of the process standing in the agent's directory, relayed by the gateway:
21
- * a written call to the class mounted there (chat), a simulated caller from its personas, its
22
- * goldens and a suite of them, its knowledge folder pushed or its golden asked, its memory
21
+ * a written call to the class mounted there (chat), a simulated caller put on the class it holds,
22
+ * its goldens and a suite of them, its knowledge folder pushed or its golden asked, its memory
23
23
  * goldens, a call promoted to a candidate file, the drift of the last two windows, and the
24
24
  * reproductions a broken run left on that disk. Everything else a console needs is a door of the
25
25
  * gateway.
26
26
  */
27
- export const DevVerbSchema = z.enum(["chat.roster", "chat.start", "chat.say", "chat.end", "simulate.roster", "simulate.start", "goldens.roster", "goldens.run", "knowledge.roster", "knowledge.push", "knowledge.eval", "memory.roster", "memory.eval", "memory.extraction", "promote.roster", "promote.write", "drift.read", "reproductions.roster", "reproductions.read"]);
27
+ export const DevVerbSchema = z.enum(["chat.roster", "chat.start", "chat.say", "chat.end", "simulate.start", "goldens.roster", "goldens.run", "knowledge.roster", "knowledge.push", "knowledge.eval", "memory.roster", "memory.eval", "memory.extraction", "promote.roster", "promote.write", "drift.read", "reproductions.roster", "reproductions.read"]);
28
28
  /**
29
29
  * Why the call is over. Who hung up, what failed before anybody could, drained: the platform took
30
30
  * the worker down (a deploy, a stop) with the call still on it, or app_detached: the app holding
@@ -228,6 +228,7 @@ export declare const CallStartedSchema: z.ZodObject<{
228
228
  from: z.ZodString;
229
229
  to: z.ZodString;
230
230
  run: z.ZodOptional<z.ZodNullable<z.ZodNullable<z.ZodString>>>;
231
+ persona: z.ZodOptional<z.ZodNullable<z.ZodNullable<z.ZodString>>>;
231
232
  caller: z.ZodNullable<z.ZodObject<{
232
233
  id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
233
234
  phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -465,7 +466,6 @@ export declare const DevRequestSchema: z.ZodObject<{
465
466
  "promote.write": "promote.write";
466
467
  "reproductions.read": "reproductions.read";
467
468
  "reproductions.roster": "reproductions.roster";
468
- "simulate.roster": "simulate.roster";
469
469
  "simulate.start": "simulate.start";
470
470
  }>;
471
471
  data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
@@ -126,6 +126,7 @@ export const CallStartedSchema = z.strictObject({
126
126
  from: z.string(),
127
127
  to: z.string(),
128
128
  run: z.string().nullable().nullish(),
129
+ persona: z.string().nullable().nullish(),
129
130
  caller: ContactSchema.nullable(),
130
131
  started_at: z.number(),
131
132
  env: EnvSchema.nullish(),
@@ -152,6 +152,7 @@ export declare const EVENT_SCHEMAS: {
152
152
  from: import("zod").ZodString;
153
153
  to: import("zod").ZodString;
154
154
  run: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNullable<import("zod").ZodString>>>;
155
+ persona: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodNullable<import("zod").ZodString>>>;
155
156
  caller: import("zod").ZodNullable<import("zod").ZodObject<{
156
157
  id: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
157
158
  phone: import("zod").ZodOptional<import("zod").ZodNullable<import("zod").ZodString>>;
@@ -352,7 +353,6 @@ export declare const EVENT_SCHEMAS: {
352
353
  "promote.write": "promote.write";
353
354
  "reproductions.read": "reproductions.read";
354
355
  "reproductions.roster": "reproductions.roster";
355
- "simulate.roster": "simulate.roster";
356
356
  "simulate.start": "simulate.start";
357
357
  }>;
358
358
  data: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>;
@@ -2175,6 +2175,56 @@ export declare const CallTuningSchema: z.ZodObject<{
2175
2175
  }, z.core.$strict>>;
2176
2176
  }, z.core.$strict>;
2177
2177
  export type CallTuning = z.infer<typeof CallTuningSchema>;
2178
+ /** One file of a base as the list draws it. */
2179
+ export declare const KnowledgeFileRowSchema: z.ZodObject<{
2180
+ path: z.ZodString;
2181
+ chars: z.ZodInt;
2182
+ chunks: z.ZodInt;
2183
+ pushed_at: z.ZodNumber;
2184
+ }, z.core.$strict>;
2185
+ export type KnowledgeFileRow = z.infer<typeof KnowledgeFileRowSchema>;
2186
+ /**
2187
+ * GET /v1/knowledge/{base}: every file of the base, by path, with its size and what it became.
2188
+ * Never the text: one file is read at a time.
2189
+ */
2190
+ export declare const KnowledgeFilesSchema: z.ZodObject<{
2191
+ base: z.ZodString;
2192
+ kept: z.ZodBoolean;
2193
+ files: z.ZodArray<z.ZodObject<{
2194
+ path: z.ZodString;
2195
+ chars: z.ZodInt;
2196
+ chunks: z.ZodInt;
2197
+ pushed_at: z.ZodNumber;
2198
+ }, z.core.$strict>>;
2199
+ }, z.core.$strict>;
2200
+ export type KnowledgeFiles = z.infer<typeof KnowledgeFilesSchema>;
2201
+ /** GET /v1/knowledge/{base}/files/{path}: one file, text and all. */
2202
+ export declare const KnowledgeFileReadSchema: z.ZodObject<{
2203
+ path: z.ZodString;
2204
+ text: z.ZodString;
2205
+ chunks: z.ZodInt;
2206
+ pushed_at: z.ZodNumber;
2207
+ }, z.core.$strict>;
2208
+ export type KnowledgeFileRead = z.infer<typeof KnowledgeFileReadSchema>;
2209
+ /**
2210
+ * PUT /v1/knowledge/{base}/files/{path}, the body: the file's whole text. New under that path, or
2211
+ * replaced in place; the base is begun when there is none.
2212
+ */
2213
+ export declare const KnowledgeFilePutSchema: z.ZodObject<{
2214
+ text: z.ZodString;
2215
+ }, z.core.$strict>;
2216
+ export type KnowledgeFilePut = z.infer<typeof KnowledgeFilePutSchema>;
2217
+ /**
2218
+ * PUT /v1/knowledge/{base}/files/{path}, the answer: which file, how many chunks it became, and
2219
+ * how long that took.
2220
+ */
2221
+ export declare const KnowledgeFilePushedSchema: z.ZodObject<{
2222
+ base: z.ZodString;
2223
+ path: z.ZodString;
2224
+ chunks: z.ZodInt;
2225
+ took_ms: z.ZodNumber;
2226
+ }, z.core.$strict>;
2227
+ export type KnowledgeFilePushed = z.infer<typeof KnowledgeFilePushedSchema>;
2178
2228
  /** One base and the agents whose settings attach it. */
2179
2229
  export declare const KnowledgeUseSchema: z.ZodObject<{
2180
2230
  base: z.ZodString;
@@ -2192,3 +2242,122 @@ export declare const KnowledgeUsesSchema: z.ZodObject<{
2192
2242
  }, z.core.$strict>>;
2193
2243
  }, z.core.$strict>;
2194
2244
  export type KnowledgeUses = z.infer<typeof KnowledgeUsesSchema>;
2245
+ /**
2246
+ * One synthetic caller of an ORG, kept by the gateway: what they want, how they talk, and what
2247
+ * they may state about themselves. A model plays them turn by turn — there is no script — for
2248
+ * `pinecall simulate` and the console's Simulations. A caller is a person on the phone, so who
2249
+ * they are does not depend on which of the org's agents answers: every agent of the org calls with
2250
+ * the same list.
2251
+ */
2252
+ export declare const PersonaSchema: z.ZodObject<{
2253
+ name: z.ZodString;
2254
+ about: z.ZodString;
2255
+ goal: z.ZodString;
2256
+ style: z.ZodString;
2257
+ facts: z.ZodRecord<z.ZodString, z.ZodString>;
2258
+ state: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2259
+ author: z.ZodString;
2260
+ set_at: z.ZodNumber;
2261
+ }, z.core.$strict>;
2262
+ export type Persona = z.infer<typeof PersonaSchema>;
2263
+ /**
2264
+ * GET /v1/personas: every caller the org wrote, by name. The same list for every agent of the org,
2265
+ * and the same one in both worlds.
2266
+ */
2267
+ export declare const PersonaListSchema: z.ZodObject<{
2268
+ personas: z.ZodArray<z.ZodObject<{
2269
+ name: z.ZodString;
2270
+ about: z.ZodString;
2271
+ goal: z.ZodString;
2272
+ style: z.ZodString;
2273
+ facts: z.ZodRecord<z.ZodString, z.ZodString>;
2274
+ state: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2275
+ author: z.ZodString;
2276
+ set_at: z.ZodNumber;
2277
+ }, z.core.$strict>>;
2278
+ }, z.core.$strict>;
2279
+ export type PersonaList = z.infer<typeof PersonaListSchema>;
2280
+ /**
2281
+ * PUT /v1/personas/{name}, the body: the caller, written whole. A name that exists is replaced;
2282
+ * `was` renames the caller it names.
2283
+ */
2284
+ export declare const PersonaPutSchema: z.ZodObject<{
2285
+ about: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2286
+ goal: z.ZodString;
2287
+ style: z.ZodString;
2288
+ facts: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
2289
+ state: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
2290
+ was: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2291
+ }, z.core.$strict>;
2292
+ export type PersonaPut = z.infer<typeof PersonaPutSchema>;
2293
+ /**
2294
+ * One simulation this caller has run: the call it was, and what the call came to. Read off the
2295
+ * call index, never off a log — the same row the sessions list is drawn from.
2296
+ */
2297
+ export declare const PersonaRunSchema: z.ZodObject<{
2298
+ call: z.ZodString;
2299
+ agent: z.ZodString;
2300
+ started_at: z.ZodNumber;
2301
+ ended_at: z.ZodNullable<z.ZodNumber>;
2302
+ turns: z.ZodInt;
2303
+ end_reason: z.ZodNullable<z.ZodEnum<{
2304
+ agent_hung_up: "agent_hung_up";
2305
+ app_detached: "app_detached";
2306
+ busy: "busy";
2307
+ caller_hung_up: "caller_hung_up";
2308
+ dial_failed: "dial_failed";
2309
+ drained: "drained";
2310
+ error: "error";
2311
+ no_answer: "no_answer";
2312
+ supervisor_ended: "supervisor_ended";
2313
+ timeout: "timeout";
2314
+ transferred: "transferred";
2315
+ }>>;
2316
+ outcome: z.ZodNullable<z.ZodString>;
2317
+ cost_eur: z.ZodNullable<z.ZodNumber>;
2318
+ score: z.ZodNullable<z.ZodObject<{
2319
+ held: z.ZodInt;
2320
+ judged: z.ZodInt;
2321
+ passed: z.ZodBoolean;
2322
+ reason: z.ZodNullable<z.ZodString>;
2323
+ }, z.core.$strict>>;
2324
+ }, z.core.$strict>;
2325
+ export type PersonaRun = z.infer<typeof PersonaRunSchema>;
2326
+ /**
2327
+ * Every simulation this caller has run, newest first, a page at a time. GET
2328
+ * /v1/personas/{name}/runs, in the key's own world and corner, paged exactly as the sessions list
2329
+ * is.
2330
+ */
2331
+ export declare const PersonaRunListSchema: z.ZodObject<{
2332
+ runs: z.ZodArray<z.ZodObject<{
2333
+ call: z.ZodString;
2334
+ agent: z.ZodString;
2335
+ started_at: z.ZodNumber;
2336
+ ended_at: z.ZodNullable<z.ZodNumber>;
2337
+ turns: z.ZodInt;
2338
+ end_reason: z.ZodNullable<z.ZodEnum<{
2339
+ agent_hung_up: "agent_hung_up";
2340
+ app_detached: "app_detached";
2341
+ busy: "busy";
2342
+ caller_hung_up: "caller_hung_up";
2343
+ dial_failed: "dial_failed";
2344
+ drained: "drained";
2345
+ error: "error";
2346
+ no_answer: "no_answer";
2347
+ supervisor_ended: "supervisor_ended";
2348
+ timeout: "timeout";
2349
+ transferred: "transferred";
2350
+ }>>;
2351
+ outcome: z.ZodNullable<z.ZodString>;
2352
+ cost_eur: z.ZodNullable<z.ZodNumber>;
2353
+ score: z.ZodNullable<z.ZodObject<{
2354
+ held: z.ZodInt;
2355
+ judged: z.ZodInt;
2356
+ passed: z.ZodBoolean;
2357
+ reason: z.ZodNullable<z.ZodString>;
2358
+ }, z.core.$strict>>;
2359
+ }, z.core.$strict>>;
2360
+ total: z.ZodInt;
2361
+ next: z.ZodNullable<z.ZodString>;
2362
+ }, z.core.$strict>;
2363
+ export type PersonaRunList = z.infer<typeof PersonaRunListSchema>;
@@ -779,6 +779,46 @@ export const CallTuningSchema = z.strictObject({
779
779
  config: TuningRowSchema.nullable(),
780
780
  lexicon: LexiconRowSchema.nullable(),
781
781
  });
782
+ /** One file of a base as the list draws it. */
783
+ export const KnowledgeFileRowSchema = z.strictObject({
784
+ path: z.string(),
785
+ chars: z.int(),
786
+ chunks: z.int(),
787
+ pushed_at: z.number(),
788
+ });
789
+ /**
790
+ * GET /v1/knowledge/{base}: every file of the base, by path, with its size and what it became.
791
+ * Never the text: one file is read at a time.
792
+ */
793
+ export const KnowledgeFilesSchema = z.strictObject({
794
+ base: z.string(),
795
+ kept: z.boolean(),
796
+ files: z.array(KnowledgeFileRowSchema),
797
+ });
798
+ /** GET /v1/knowledge/{base}/files/{path}: one file, text and all. */
799
+ export const KnowledgeFileReadSchema = z.strictObject({
800
+ path: z.string(),
801
+ text: z.string(),
802
+ chunks: z.int(),
803
+ pushed_at: z.number(),
804
+ });
805
+ /**
806
+ * PUT /v1/knowledge/{base}/files/{path}, the body: the file's whole text. New under that path, or
807
+ * replaced in place; the base is begun when there is none.
808
+ */
809
+ export const KnowledgeFilePutSchema = z.strictObject({
810
+ text: z.string(),
811
+ });
812
+ /**
813
+ * PUT /v1/knowledge/{base}/files/{path}, the answer: which file, how many chunks it became, and
814
+ * how long that took.
815
+ */
816
+ export const KnowledgeFilePushedSchema = z.strictObject({
817
+ base: z.string(),
818
+ path: z.string(),
819
+ chunks: z.int(),
820
+ took_ms: z.number(),
821
+ });
782
822
  /** One base and the agents whose settings attach it. */
783
823
  export const KnowledgeUseSchema = z.strictObject({
784
824
  base: z.string(),
@@ -791,3 +831,64 @@ export const KnowledgeUseSchema = z.strictObject({
791
831
  export const KnowledgeUsesSchema = z.strictObject({
792
832
  bases: z.array(KnowledgeUseSchema),
793
833
  });
834
+ /**
835
+ * One synthetic caller of an ORG, kept by the gateway: what they want, how they talk, and what
836
+ * they may state about themselves. A model plays them turn by turn — there is no script — for
837
+ * `pinecall simulate` and the console's Simulations. A caller is a person on the phone, so who
838
+ * they are does not depend on which of the org's agents answers: every agent of the org calls with
839
+ * the same list.
840
+ */
841
+ export const PersonaSchema = z.strictObject({
842
+ name: z.string(),
843
+ about: z.string(),
844
+ goal: z.string(),
845
+ style: z.string(),
846
+ facts: z.record(z.string(), z.string()),
847
+ state: z.record(z.string(), z.unknown()),
848
+ author: z.string(),
849
+ set_at: z.number(),
850
+ });
851
+ /**
852
+ * GET /v1/personas: every caller the org wrote, by name. The same list for every agent of the org,
853
+ * and the same one in both worlds.
854
+ */
855
+ export const PersonaListSchema = z.strictObject({
856
+ personas: z.array(PersonaSchema),
857
+ });
858
+ /**
859
+ * PUT /v1/personas/{name}, the body: the caller, written whole. A name that exists is replaced;
860
+ * `was` renames the caller it names.
861
+ */
862
+ export const PersonaPutSchema = z.strictObject({
863
+ about: z.string().nullish(),
864
+ goal: z.string(),
865
+ style: z.string(),
866
+ facts: z.record(z.string(), z.string()).nullish(),
867
+ state: z.record(z.string(), z.unknown()).nullish(),
868
+ was: z.string().nullish(),
869
+ });
870
+ /**
871
+ * One simulation this caller has run: the call it was, and what the call came to. Read off the
872
+ * call index, never off a log — the same row the sessions list is drawn from.
873
+ */
874
+ export const PersonaRunSchema = z.strictObject({
875
+ call: z.string(),
876
+ agent: z.string(),
877
+ started_at: z.number(),
878
+ ended_at: z.number().nullable(),
879
+ turns: z.int(),
880
+ end_reason: EndReasonSchema.nullable(),
881
+ outcome: z.string().nullable(),
882
+ cost_eur: z.number().nullable(),
883
+ score: SessionScoreSchema.nullable(),
884
+ });
885
+ /**
886
+ * Every simulation this caller has run, newest first, a page at a time. GET
887
+ * /v1/personas/{name}/runs, in the key's own world and corner, paged exactly as the sessions list
888
+ * is.
889
+ */
890
+ export const PersonaRunListSchema = z.strictObject({
891
+ runs: z.array(PersonaRunSchema),
892
+ total: z.int(),
893
+ next: z.string().nullable(),
894
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinecall/protocol",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "The Pinecall wire: zod schemas and types generated from the protocol schema, and the log reducer",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Pinecall <hello@pinecall.io>",