@parlor/chat 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/items.d.ts +3 -0
- package/dist/items.d.ts.map +1 -1
- package/dist/items.js +8 -2
- package/dist/items.js.map +1 -1
- package/dist/model.d.ts +42 -0
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js.map +1 -1
- package/dist/protocol.d.ts +14 -2
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +4 -1
- package/dist/protocol.js.map +1 -1
- package/dist/server/actions.d.ts +125 -7
- package/dist/server/actions.d.ts.map +1 -1
- package/dist/server/actions.js +91 -48
- package/dist/server/actions.js.map +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +8 -3
- package/dist/server/index.js.map +1 -1
- package/dist/server/live.d.ts +7 -2
- package/dist/server/live.d.ts.map +1 -1
- package/dist/server/live.js +17 -5
- package/dist/server/live.js.map +1 -1
- package/dist/server/push.d.ts +26 -0
- package/dist/server/push.d.ts.map +1 -0
- package/dist/server/push.js +56 -0
- package/dist/server/push.js.map +1 -0
- package/dist/server/rows.d.ts +21 -0
- package/dist/server/rows.d.ts.map +1 -1
- package/dist/server/rows.js +32 -0
- package/dist/server/rows.js.map +1 -1
- package/dist/server/store.d.ts.map +1 -1
- package/dist/server/store.js +3 -0
- package/dist/server/store.js.map +1 -1
- package/dist/view.d.ts +2 -0
- package/dist/view.d.ts.map +1 -1
- package/dist/view.js.map +1 -1
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ export { CHAT_EVENTS, type ChatEvent } from "./events.js";
|
|
|
2
2
|
export type { Author, AuthorOf, ChatItemBody, ChatItemKind, HostItemDraft, HostItemKind, ItemSignature, LoggedItem, UserItemKind, } from "./items.js";
|
|
3
3
|
export { type AppliedFrame, applyFrame } from "./open-turns.js";
|
|
4
4
|
export { isPromptTooLong, MAX_PROMPT_CHARS, PROMPT_LIMIT_MESSAGE } from "./limits.js";
|
|
5
|
-
export type { AgentInfo, AgentRef, AnswerToSign, ChatOwner, ChatSnapshot, ClaimedDevice, ClaimedTurn, HostSummary, OpenItem, OpenTurn, PromptToSign, ThreadHistory, ThreadList, ThreadPage, ThreadSummary, TurnFailure, TurnOutcome, TurnSignals, TurnState, TurnStatus, } from "./model.js";
|
|
6
|
-
export { CHAT_CHANNEL, CHAT_PLUGIN, type ChatFrame, HOST_PROTOCOL, type HostFrame, type HostHello, type HostStreamBatch, type HostWelcome, parseChatFrame, type ProtocolRange, type StreamingKind, } from "./protocol.js";
|
|
5
|
+
export type { AgentInfo, AgentOption, AgentOptionValue, AgentRef, AgentUsage, AgentUsageWindow, AnswerToSign, ChatOwner, ChatSnapshot, ClaimedDevice, ClaimedTurn, HostSummary, OpenItem, OpenTurn, PromptToSign, ThreadHistory, ThreadList, ThreadPage, ThreadSummary, TurnFailure, TurnOutcome, TurnSignals, TurnState, TurnStatus, } from "./model.js";
|
|
6
|
+
export { CHAT_CHANNEL, CHAT_PLUGIN, type ChatFrame, HOST_PROTOCOL, type HostFrame, type HostHello, type HostStreamBatch, type HostWelcome, parseChatFrame, PUSHED_TURNS_PROTOCOL, type PushedTurn, type ProtocolRange, type StreamingKind, } from "./protocol.js";
|
|
7
7
|
export { CHAT_ACTIVITY_TAG, CHAT_TAG, HOSTS_TAG } from "./tags.js";
|
|
8
8
|
export { type AskState, type ChatItem, type FoldedKind, type FoldInput, foldThread, type ItemFolders, type ThreadConfirmation, } from "./view.js";
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,SAAS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a,EACb,UAAU,EACV,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACtF,YAAY,EACV,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,aAAa,EACb,WAAW,EACX,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,UAAU,EACV,UAAU,EACV,aAAa,EACb,WAAW,EACX,WAAW,EACX,WAAW,EACX,SAAS,EACT,UAAU,GACX,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,YAAY,EACZ,WAAW,EACX,KAAK,SAAS,EACd,aAAa,EACb,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,cAAc,EACd,qBAAqB,EACrB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,aAAa,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,SAAS,EACd,UAAU,EACV,KAAK,WAAW,EAChB,KAAK,kBAAkB,GACxB,MAAM,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { CHAT_EVENTS } from "./events.js";
|
|
2
2
|
export { applyFrame } from "./open-turns.js";
|
|
3
3
|
export { isPromptTooLong, MAX_PROMPT_CHARS, PROMPT_LIMIT_MESSAGE } from "./limits.js";
|
|
4
|
-
export { CHAT_CHANNEL, CHAT_PLUGIN, HOST_PROTOCOL, parseChatFrame, } from "./protocol.js";
|
|
4
|
+
export { CHAT_CHANNEL, CHAT_PLUGIN, HOST_PROTOCOL, parseChatFrame, PUSHED_TURNS_PROTOCOL, } from "./protocol.js";
|
|
5
5
|
export { CHAT_ACTIVITY_TAG, CHAT_TAG, HOSTS_TAG } from "./tags.js";
|
|
6
6
|
export { foldThread, } from "./view.js";
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,aAAa,CAAC;AAY1D,OAAO,EAAqB,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,aAAa,CAAC;AAY1D,OAAO,EAAqB,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AA2BtF,OAAO,EACL,YAAY,EACZ,WAAW,EAEX,aAAa,EAKb,cAAc,EACd,qBAAqB,GAItB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAKL,UAAU,GAGX,MAAM,WAAW,CAAC","sourcesContent":["export { CHAT_EVENTS, type ChatEvent } from \"./events.js\";\nexport type {\n Author,\n AuthorOf,\n ChatItemBody,\n ChatItemKind,\n HostItemDraft,\n HostItemKind,\n ItemSignature,\n LoggedItem,\n UserItemKind,\n} from \"./items.js\";\nexport { type AppliedFrame, applyFrame } from \"./open-turns.js\";\nexport { isPromptTooLong, MAX_PROMPT_CHARS, PROMPT_LIMIT_MESSAGE } from \"./limits.js\";\nexport type {\n AgentInfo,\n AgentOption,\n AgentOptionValue,\n AgentRef,\n AgentUsage,\n AgentUsageWindow,\n AnswerToSign,\n ChatOwner,\n ChatSnapshot,\n ClaimedDevice,\n ClaimedTurn,\n HostSummary,\n OpenItem,\n OpenTurn,\n PromptToSign,\n ThreadHistory,\n ThreadList,\n ThreadPage,\n ThreadSummary,\n TurnFailure,\n TurnOutcome,\n TurnSignals,\n TurnState,\n TurnStatus,\n} from \"./model.js\";\nexport {\n CHAT_CHANNEL,\n CHAT_PLUGIN,\n type ChatFrame,\n HOST_PROTOCOL,\n type HostFrame,\n type HostHello,\n type HostStreamBatch,\n type HostWelcome,\n parseChatFrame,\n PUSHED_TURNS_PROTOCOL,\n type PushedTurn,\n type ProtocolRange,\n type StreamingKind,\n} from \"./protocol.js\";\nexport { CHAT_ACTIVITY_TAG, CHAT_TAG, HOSTS_TAG } from \"./tags.js\";\nexport {\n type AskState,\n type ChatItem,\n type FoldedKind,\n type FoldInput,\n foldThread,\n type ItemFolders,\n type ThreadConfirmation,\n} from \"./view.js\";\n"]}
|
package/dist/items.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export declare const chatItemBodies: {
|
|
|
52
52
|
}, z.core.$strip>;
|
|
53
53
|
pairing: z.ZodOptional<z.ZodString>;
|
|
54
54
|
}, z.core.$strip>>;
|
|
55
|
+
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
55
56
|
}, z.core.$strip>;
|
|
56
57
|
};
|
|
57
58
|
readonly answer: {
|
|
@@ -147,6 +148,7 @@ export declare const chatItemBodies: {
|
|
|
147
148
|
form: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
148
149
|
approval: z.ZodOptional<z.ZodEnum<{
|
|
149
150
|
computer: "computer";
|
|
151
|
+
device: "device";
|
|
150
152
|
presence: "presence";
|
|
151
153
|
}>>;
|
|
152
154
|
}, z.core.$strip>;
|
|
@@ -268,6 +270,7 @@ export declare const hostItemDraft: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
268
270
|
form: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
269
271
|
approval: z.ZodOptional<z.ZodEnum<{
|
|
270
272
|
computer: "computer";
|
|
273
|
+
device: "device";
|
|
271
274
|
presence: "presence";
|
|
272
275
|
}>>;
|
|
273
276
|
}, z.core.$strip>;
|
package/dist/items.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../src/items.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAY3C,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;iBASV,CAAC;AAUH;;;GAGG;AACH,eAAO,MAAM,cAAc;aACzB,MAAM;iBACJ,MAAM,EAAE,MAAM;iBACd,IAAI
|
|
1
|
+
{"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../src/items.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAY3C,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;iBASV,CAAC;AAUH;;;GAGG;AACH,eAAO,MAAM,cAAc;aACzB,MAAM;iBACJ,MAAM,EAAE,MAAM;iBACd,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAWN,MAAM;iBACJ,MAAM,EAAE,MAAM;iBACd,IAAI;;;;;;;;;;;;;;;;;;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AO,QAAQ,CAAC,MAAM,CAAC,CAAC;;;;;;;;;;;;;;;;;;2BAiBvC,CAAC"}
|
package/dist/items.js
CHANGED
|
@@ -37,6 +37,11 @@ export const chatItemBodies = {
|
|
|
37
37
|
text: z.string().min(1).max(MAX_PROMPT_CHARS),
|
|
38
38
|
agent: agentRef,
|
|
39
39
|
signed: signed.optional(),
|
|
40
|
+
/**
|
|
41
|
+
* The agent's options this turn runs with, by option id. Not signed: the computer runs
|
|
42
|
+
* only values the agent offers, and none of them widens what the agent may do.
|
|
43
|
+
*/
|
|
44
|
+
options: z.record(z.string().max(100), z.string().max(200)).optional(),
|
|
40
45
|
}),
|
|
41
46
|
},
|
|
42
47
|
answer: {
|
|
@@ -82,9 +87,10 @@ export const chatItemBodies = {
|
|
|
82
87
|
form: z.record(z.string(), z.unknown()).optional(),
|
|
83
88
|
/**
|
|
84
89
|
* Set by the host's policy, never by the app. Absent: any device answers from the
|
|
85
|
-
* chat, without presence.
|
|
90
|
+
* chat, without presence. `device`: only the device that sent the turn's prompt, from
|
|
91
|
+
* the chat, without presence.
|
|
86
92
|
*/
|
|
87
|
-
approval: z.enum(["presence", "computer"]).optional(),
|
|
93
|
+
approval: z.enum(["presence", "computer", "device"]).optional(),
|
|
88
94
|
}),
|
|
89
95
|
},
|
|
90
96
|
event: {
|
package/dist/items.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"items.js","sourceRoot":"","sources":["../src/items.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IACzB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,QAAQ,EA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AyB;CACrD,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IACxD,KAAK,CAAC,OAAO,CAAC;IACd,KAAK,CAAC,WAAW,CAAC;IAClB,KAAK,CAAC,MAAM,CAAC;IACb,KAAK,CAAC,MAAM,CAAC;IACb,KAAK,CAAC,KAAK,CAAC;IACZ,KAAK,CAAC,OAAO,CAAC;CACf,CAAC,CAAC","sourcesContent":["import type { ItemId, ThreadId, TurnId } from \"@parlor/core\";\nimport { z } from \"zod\";\n\nimport { CHAT_EVENTS } from \"./events.js\";\nimport { idSchema } from \"./id-schemas.js\";\nimport { MAX_PROMPT_CHARS } from \"./limits.js\";\n\nconst signature = z.object({\n keyId: z.string(),\n presence: z.enum([\"none\", \"user\"]),\n format: z.enum([\"es256-raw\", \"webauthn\"]),\n signature: z.string(),\n authenticatorData: z.string().optional(),\n clientDataJSON: z.string().optional(),\n});\n\nconst signed = z.object({\n deviceId: idSchema(\"device\"),\n at: z.number(),\n signature,\n /** The browser that approved the computer's connect proving it, so the computer trusts it unasked. */\n pairing: z\n .string()\n .regex(/^[A-Za-z0-9_-]{43}$/)\n .optional(),\n});\n\nconst agentRef = z.object({ hostId: idSchema(\"host\"), agentId: z.string().min(1) });\n\nconst askChoice = z.object({\n id: z.string().min(1),\n label: z.string(),\n effect: z.enum([\"allow_once\", \"allow_always\", \"reject_once\", \"reject_always\"]),\n});\n\n/**\n * The one table of item kinds: who writes each and the body it carries. Types, the\n * server's parsers, the host's append type and the client's view all derive from it.\n */\nexport const chatItemBodies = {\n prompt: {\n author: \"user\",\n body: z.object({\n text: z.string().min(1).max(MAX_PROMPT_CHARS),\n agent: agentRef,\n signed: signed.optional(),\n /**\n * The agent's options this turn runs with, by option id. Not signed: the computer runs\n * only values the agent offers, and none of them widens what the agent may do.\n */\n options: z.record(z.string().max(100), z.string().max(200)).optional(),\n }),\n },\n answer: {\n author: \"user\",\n body: z.object({\n askId: idSchema(\"item\"),\n choice: z.string().min(1),\n values: z\n .record(z.string(), z.union([z.string(), z.number(), z.boolean()]))\n .optional(),\n signed: signed.optional(),\n }),\n },\n cancel: { author: \"user\", body: z.object({}) },\n reply: {\n author: \"agent\",\n body: z.object({ text: z.string(), interrupted: z.literal(true).optional() }),\n },\n reasoning: { author: \"agent\", body: z.object({ text: z.string() }) },\n tool: {\n author: \"agent\",\n body: z.object({\n title: z.string(),\n tool: z.object({ kind: z.enum([\"app\", \"local\"]), name: z.string() }),\n status: z.enum([\"done\", \"failed\", \"cancelled\"]),\n detail: z.string().max(4_000).optional(),\n }),\n },\n plan: {\n author: \"agent\",\n body: z.object({\n entries: z.array(\n z.object({\n content: z.string(),\n status: z.enum([\"pending\", \"in_progress\", \"completed\"]),\n }),\n ),\n }),\n },\n ask: {\n author: \"agent\",\n body: z.object({\n question: z.string(),\n choices: z.array(askChoice),\n form: z.record(z.string(), z.unknown()).optional(),\n /**\n * Set by the host's policy, never by the app. Absent: any device answers from the\n * chat, without presence. `device`: only the device that sent the turn's prompt, from\n * the chat, without presence.\n */\n approval: z.enum([\"presence\", \"computer\", \"device\"]).optional(),\n }),\n },\n event: {\n author: \"system\",\n body: z.object({\n event: z.enum(CHAT_EVENTS),\n detail: z.string().max(500).optional(),\n itemId: idSchema(\"item\").optional(),\n choice: z.string().min(1).optional(),\n }),\n },\n} as const;\n\ntype Bodies = typeof chatItemBodies;\n\nexport type ChatItemKind = keyof Bodies;\nexport type Author = Bodies[ChatItemKind][\"author\"];\nexport type AuthorOf<K extends ChatItemKind> = Bodies[K][\"author\"];\nexport type ChatItemBody<K extends ChatItemKind> = z.output<Bodies[K][\"body\"]>;\nexport type ItemSignature = z.output<typeof signed>;\n\ntype KindsBy<A extends Author> = {\n [K in ChatItemKind]: AuthorOf<K> extends A ? K : never;\n}[ChatItemKind];\n\n/** Appended only by the user's devices, through the user actions. */\nexport type UserItemKind = KindsBy<\"user\">;\n/** Appended only by the user's computer, through the host actions. */\nexport type HostItemKind = KindsBy<\"agent\" | \"system\">;\n\nexport type LoggedItem<K extends ChatItemKind = ChatItemKind> = {\n [Kind in K]: {\n readonly id: ItemId;\n readonly threadId: ThreadId;\n readonly turnId: TurnId;\n /** Gap-free per thread, assigned under the thread row's lock. */\n readonly seq: number;\n readonly at: number;\n readonly author: AuthorOf<Kind>;\n readonly kind: Kind;\n readonly body: ChatItemBody<Kind>;\n };\n}[K];\n\n/** Its id is `<turnId>.<n>`, chosen by the host, so a retried append is a no-op. */\nexport type HostItemDraft = {\n [K in HostItemKind]: {\n readonly id: ItemId;\n readonly kind: K;\n readonly body: ChatItemBody<K>;\n };\n}[HostItemKind];\n\nconst draft = <K extends HostItemKind>(\n kind: K,\n): z.ZodObject<{\n id: ReturnType<typeof idSchema<\"item\">>;\n kind: z.ZodLiteral<K>;\n body: Bodies[K][\"body\"];\n}> =>\n z.object({\n id: idSchema(\"item\"),\n kind: z.literal(kind),\n body: chatItemBodies[kind].body as Bodies[K][\"body\"],\n });\n\nexport const hostItemDraft = z.discriminatedUnion(\"kind\", [\n draft(\"reply\"),\n draft(\"reasoning\"),\n draft(\"tool\"),\n draft(\"plan\"),\n draft(\"ask\"),\n draft(\"event\"),\n]);\n"]}
|
package/dist/model.d.ts
CHANGED
|
@@ -35,6 +35,48 @@ export interface AgentInfo {
|
|
|
35
35
|
readonly ready: boolean;
|
|
36
36
|
/** Why a not-ready agent cannot run yet ("run `claude` to log in"). */
|
|
37
37
|
readonly problem?: string | undefined;
|
|
38
|
+
/** What a prompt may choose for its turn, as the agent last offered it; absent until it has. */
|
|
39
|
+
readonly options?: readonly AgentOption[] | undefined;
|
|
40
|
+
/** The account's allowance, as the agent last reported it; absent until it has. */
|
|
41
|
+
readonly usage?: AgentUsage | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* The name this agent knows the app by outside the sidebar, when the user let it use the
|
|
44
|
+
* app there: "use coursekit to ..." in Claude Code.
|
|
45
|
+
*/
|
|
46
|
+
readonly outsideName?: string | undefined;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* One setting a prompt may choose, such as the model or how hard it thinks. Never the
|
|
50
|
+
* permission mode: that is the computer's to set.
|
|
51
|
+
*/
|
|
52
|
+
export interface AgentOption {
|
|
53
|
+
readonly id: string;
|
|
54
|
+
readonly name: string;
|
|
55
|
+
/** `model` and `thought_level` as the agent tags them; any other the agent names. */
|
|
56
|
+
readonly category?: string | undefined;
|
|
57
|
+
/** The agent's own default, the value a prompt that chooses nothing runs with. */
|
|
58
|
+
readonly current: string;
|
|
59
|
+
readonly values: readonly AgentOptionValue[];
|
|
60
|
+
}
|
|
61
|
+
export interface AgentOptionValue {
|
|
62
|
+
readonly id: string;
|
|
63
|
+
readonly name: string;
|
|
64
|
+
readonly description?: string | undefined;
|
|
65
|
+
}
|
|
66
|
+
export interface AgentUsage {
|
|
67
|
+
/** Account-wide windows first, each set shortest first. */
|
|
68
|
+
readonly windows: readonly AgentUsageWindow[];
|
|
69
|
+
/** When the agent reported it (epoch ms). */
|
|
70
|
+
readonly at: number;
|
|
71
|
+
}
|
|
72
|
+
export interface AgentUsageWindow {
|
|
73
|
+
/** The vendor's name for it: `five_hour`, `seven_day`, `seven_day_opus`. */
|
|
74
|
+
readonly id: string;
|
|
75
|
+
readonly minutes: number;
|
|
76
|
+
/** Share of the window used, 0 to 1. */
|
|
77
|
+
readonly used: number;
|
|
78
|
+
/** When the window rolls over (epoch ms). */
|
|
79
|
+
readonly resetsAt?: number | undefined;
|
|
38
80
|
}
|
|
39
81
|
export interface ThreadSummary {
|
|
40
82
|
readonly id: ThreadId;
|
package/dist/model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,KAAK,EAA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C3B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC;CACpD"}
|
package/dist/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"","sourcesContent":["import type { HostId, ItemId, ThreadId, TurnId, UserId } from \"@parlor/core\";\nimport type { Delegation, DeviceKeys } from \"@parlor/server\";\n\nimport type { ChatItemBody, LoggedItem, UserItemKind } from \"./items.js\";\n\nexport interface AgentRef {\n readonly hostId: HostId;\n /** A profile id on that host (`claude`, `codex`), not an entity. */\n readonly agentId: string;\n}\n\n/**\n * Whose chat a row is. Every thread, turn and host row carries both and every chat query\n * filters by both, so members of one organization scope never see each other's chats.\n */\nexport interface ChatOwner {\n readonly scope: string;\n readonly userId: UserId;\n}\n\nexport interface HostSummary {\n readonly id: HostId;\n readonly name: string;\n readonly platform: string;\n readonly online: boolean;\n readonly agents: readonly AgentInfo[];\n /** The devices this computer runs prompts from; absent when it is too old to say. */\n readonly devices?: readonly string[] | undefined;\n /**\n * When each of those devices must sign its next prompt with Face ID or Touch ID again\n * (epoch ms); a device it never asks is missing.\n */\n readonly presenceDue?: Readonly<Record<string, number>> | undefined;\n}\n\nexport interface AgentInfo {\n readonly id: string;\n readonly name: string;\n readonly version?: string | undefined;\n readonly ready: boolean;\n /** Why a not-ready agent cannot run yet (\"run `claude` to log in\"). */\n readonly problem?: string | undefined;\n}\n\nexport interface ThreadSummary {\n readonly id: ThreadId;\n readonly title: string;\n readonly agent: AgentRef | undefined;\n readonly updatedAt: number;\n readonly lastSeq: number;\n}\n\nexport type TurnState = \"queued\" | \"running\" | \"done\" | \"failed\" | \"cancelled\";\n\nexport type TurnFailure =\n | \"agent_exited\"\n | \"agent_unavailable\"\n | \"device_rejected\"\n | \"signature_invalid\"\n | \"prompt_expired\"\n | \"host_lost\";\n\nexport type TurnOutcome =\n | { readonly state: \"done\"; readonly stopReason: string }\n | { readonly state: \"cancelled\" }\n | { readonly state: \"failed\"; readonly reason: TurnFailure };\n\n/** Still being produced: only in memory, on the instance the host posts to. */\nexport type OpenItem =\n | { readonly id: ItemId; readonly kind: \"reply\" | \"reasoning\"; readonly text: string }\n | {\n readonly id: ItemId;\n readonly kind: \"tool\";\n readonly title: string;\n readonly status: \"pending\" | \"running\";\n }\n | {\n readonly id: ItemId;\n readonly kind: \"plan\";\n readonly entries: ChatItemBody<\"plan\">[\"entries\"];\n };\n\nexport interface OpenTurn {\n readonly turnId: TurnId;\n readonly threadId: ThreadId;\n readonly items: readonly OpenItem[];\n}\n\nexport interface TurnStatus {\n readonly turnId: TurnId;\n readonly state: TurnState;\n readonly agent: AgentRef;\n readonly failure?: TurnFailure | undefined;\n}\n\nexport interface ThreadPage {\n readonly thread: ThreadSummary | undefined;\n readonly items: readonly LoggedItem[];\n readonly open: readonly OpenTurn[];\n readonly turns: readonly TurnStatus[];\n readonly hasMore: boolean;\n}\n\nexport interface ChatSnapshot {\n readonly threads: readonly ThreadSummary[];\n /** `threads` was cut at its limit; `threadsBefore` reads on from its last one. */\n readonly moreThreads?: boolean | undefined;\n readonly hosts: readonly HostSummary[];\n readonly page: ThreadPage;\n}\n\n/** What `history` returns: earlier items of a thread, oldest first, with their turns. */\nexport interface ThreadHistory {\n readonly items: readonly LoggedItem[];\n readonly turns: readonly TurnStatus[];\n readonly hasMore: boolean;\n}\n\n/** What `threadsBefore` returns: the next older threads, newest first. */\nexport interface ThreadList {\n readonly threads: readonly ThreadSummary[];\n readonly hasMore: boolean;\n}\n\n/** The device's keys as the account has them; the host compares them with its own pins. */\nexport type ClaimedDevice = DeviceKeys;\n\nexport interface ClaimedTurn {\n /** The thread id; every chat write returns it as `id`, which becomes its sync tag. */\n readonly id: ThreadId;\n readonly turnId: TurnId;\n readonly agent: AgentRef;\n /** The client the prompt came from; the turn token binds `ui_*` to it. */\n readonly clientId: string;\n readonly prompt: LoggedItem<\"prompt\">;\n readonly device: ClaimedDevice | undefined;\n /** The `<parlor-context>` block for a fresh agent session. */\n readonly context: string;\n readonly token: Delegation;\n readonly leaseUntil: number;\n}\n\nexport interface TurnSignals {\n readonly turnId: TurnId;\n readonly items: readonly LoggedItem<Exclude<UserItemKind, \"prompt\">>[];\n /** The keys of each device that answered, as the account lists them; revoked ones are left out. */\n readonly devices?: readonly DeviceKeys[];\n}\n\n/** What a device signs for a prompt; the host rebuilds the same statement from the item. */\nexport interface PromptToSign {\n readonly threadId: ThreadId;\n readonly turnId: TurnId;\n readonly agent: AgentRef;\n readonly text: string;\n}\n\nexport interface AnswerToSign {\n readonly threadId: ThreadId;\n readonly askId: ItemId;\n readonly choice: string;\n readonly values?: ChatItemBody<\"answer\">[\"values\"];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"","sourcesContent":["import type { HostId, ItemId, ThreadId, TurnId, UserId } from \"@parlor/core\";\nimport type { Delegation, DeviceKeys } from \"@parlor/server\";\n\nimport type { ChatItemBody, LoggedItem, UserItemKind } from \"./items.js\";\n\nexport interface AgentRef {\n readonly hostId: HostId;\n /** A profile id on that host (`claude`, `codex`), not an entity. */\n readonly agentId: string;\n}\n\n/**\n * Whose chat a row is. Every thread, turn and host row carries both and every chat query\n * filters by both, so members of one organization scope never see each other's chats.\n */\nexport interface ChatOwner {\n readonly scope: string;\n readonly userId: UserId;\n}\n\nexport interface HostSummary {\n readonly id: HostId;\n readonly name: string;\n readonly platform: string;\n readonly online: boolean;\n readonly agents: readonly AgentInfo[];\n /** The devices this computer runs prompts from; absent when it is too old to say. */\n readonly devices?: readonly string[] | undefined;\n /**\n * When each of those devices must sign its next prompt with Face ID or Touch ID again\n * (epoch ms); a device it never asks is missing.\n */\n readonly presenceDue?: Readonly<Record<string, number>> | undefined;\n}\n\nexport interface AgentInfo {\n readonly id: string;\n readonly name: string;\n readonly version?: string | undefined;\n readonly ready: boolean;\n /** Why a not-ready agent cannot run yet (\"run `claude` to log in\"). */\n readonly problem?: string | undefined;\n /** What a prompt may choose for its turn, as the agent last offered it; absent until it has. */\n readonly options?: readonly AgentOption[] | undefined;\n /** The account's allowance, as the agent last reported it; absent until it has. */\n readonly usage?: AgentUsage | undefined;\n /**\n * The name this agent knows the app by outside the sidebar, when the user let it use the\n * app there: \"use coursekit to ...\" in Claude Code.\n */\n readonly outsideName?: string | undefined;\n}\n\n/**\n * One setting a prompt may choose, such as the model or how hard it thinks. Never the\n * permission mode: that is the computer's to set.\n */\nexport interface AgentOption {\n readonly id: string;\n readonly name: string;\n /** `model` and `thought_level` as the agent tags them; any other the agent names. */\n readonly category?: string | undefined;\n /** The agent's own default, the value a prompt that chooses nothing runs with. */\n readonly current: string;\n readonly values: readonly AgentOptionValue[];\n}\n\nexport interface AgentOptionValue {\n readonly id: string;\n readonly name: string;\n readonly description?: string | undefined;\n}\n\nexport interface AgentUsage {\n /** Account-wide windows first, each set shortest first. */\n readonly windows: readonly AgentUsageWindow[];\n /** When the agent reported it (epoch ms). */\n readonly at: number;\n}\n\nexport interface AgentUsageWindow {\n /** The vendor's name for it: `five_hour`, `seven_day`, `seven_day_opus`. */\n readonly id: string;\n readonly minutes: number;\n /** Share of the window used, 0 to 1. */\n readonly used: number;\n /** When the window rolls over (epoch ms). */\n readonly resetsAt?: number | undefined;\n}\n\nexport interface ThreadSummary {\n readonly id: ThreadId;\n readonly title: string;\n readonly agent: AgentRef | undefined;\n readonly updatedAt: number;\n readonly lastSeq: number;\n}\n\nexport type TurnState = \"queued\" | \"running\" | \"done\" | \"failed\" | \"cancelled\";\n\nexport type TurnFailure =\n | \"agent_exited\"\n | \"agent_unavailable\"\n | \"device_rejected\"\n | \"signature_invalid\"\n | \"prompt_expired\"\n | \"host_lost\";\n\nexport type TurnOutcome =\n | { readonly state: \"done\"; readonly stopReason: string }\n | { readonly state: \"cancelled\" }\n | { readonly state: \"failed\"; readonly reason: TurnFailure };\n\n/** Still being produced: only in memory, on the instance the host posts to. */\nexport type OpenItem =\n | { readonly id: ItemId; readonly kind: \"reply\" | \"reasoning\"; readonly text: string }\n | {\n readonly id: ItemId;\n readonly kind: \"tool\";\n readonly title: string;\n readonly status: \"pending\" | \"running\";\n }\n | {\n readonly id: ItemId;\n readonly kind: \"plan\";\n readonly entries: ChatItemBody<\"plan\">[\"entries\"];\n };\n\nexport interface OpenTurn {\n readonly turnId: TurnId;\n readonly threadId: ThreadId;\n readonly items: readonly OpenItem[];\n}\n\nexport interface TurnStatus {\n readonly turnId: TurnId;\n readonly state: TurnState;\n readonly agent: AgentRef;\n readonly failure?: TurnFailure | undefined;\n}\n\nexport interface ThreadPage {\n readonly thread: ThreadSummary | undefined;\n readonly items: readonly LoggedItem[];\n readonly open: readonly OpenTurn[];\n readonly turns: readonly TurnStatus[];\n readonly hasMore: boolean;\n}\n\nexport interface ChatSnapshot {\n readonly threads: readonly ThreadSummary[];\n /** `threads` was cut at its limit; `threadsBefore` reads on from its last one. */\n readonly moreThreads?: boolean | undefined;\n readonly hosts: readonly HostSummary[];\n readonly page: ThreadPage;\n}\n\n/** What `history` returns: earlier items of a thread, oldest first, with their turns. */\nexport interface ThreadHistory {\n readonly items: readonly LoggedItem[];\n readonly turns: readonly TurnStatus[];\n readonly hasMore: boolean;\n}\n\n/** What `threadsBefore` returns: the next older threads, newest first. */\nexport interface ThreadList {\n readonly threads: readonly ThreadSummary[];\n readonly hasMore: boolean;\n}\n\n/** The device's keys as the account has them; the host compares them with its own pins. */\nexport type ClaimedDevice = DeviceKeys;\n\nexport interface ClaimedTurn {\n /** The thread id; every chat write returns it as `id`, which becomes its sync tag. */\n readonly id: ThreadId;\n readonly turnId: TurnId;\n readonly agent: AgentRef;\n /** The client the prompt came from; the turn token binds `ui_*` to it. */\n readonly clientId: string;\n readonly prompt: LoggedItem<\"prompt\">;\n readonly device: ClaimedDevice | undefined;\n /** The `<parlor-context>` block for a fresh agent session. */\n readonly context: string;\n readonly token: Delegation;\n readonly leaseUntil: number;\n}\n\nexport interface TurnSignals {\n readonly turnId: TurnId;\n readonly items: readonly LoggedItem<Exclude<UserItemKind, \"prompt\">>[];\n /** The keys of each device that answered, as the account lists them; revoked ones are left out. */\n readonly devices?: readonly DeviceKeys[];\n}\n\n/** What a device signs for a prompt; the host rebuilds the same statement from the item. */\nexport interface PromptToSign {\n readonly threadId: ThreadId;\n readonly turnId: TurnId;\n readonly agent: AgentRef;\n readonly text: string;\n}\n\nexport interface AnswerToSign {\n readonly threadId: ThreadId;\n readonly askId: ItemId;\n readonly choice: string;\n readonly values?: ChatItemBody<\"answer\">[\"values\"];\n}\n"]}
|
package/dist/protocol.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ItemId, type ThreadId, type TurnId } from "@parlor/core";
|
|
2
|
-
import type { AgentInfo, OpenItem } from "./model.js";
|
|
2
|
+
import type { AgentInfo, ClaimedTurn, OpenItem } from "./model.js";
|
|
3
3
|
export declare const CHAT_CHANNEL = "chat";
|
|
4
4
|
/** The plugin name, so its routes live under `/_parlor/chat/`. */
|
|
5
5
|
export declare const CHAT_PLUGIN = "chat";
|
|
@@ -41,8 +41,20 @@ export interface HostStreamBatch {
|
|
|
41
41
|
/**
|
|
42
42
|
* The versioned contract between an app's backend and Parlor Host: host actions, item
|
|
43
43
|
* kinds, frames and cursor rules. Bumped on any change an older peer could misread.
|
|
44
|
+
* 3: the server may claim a turn for the computer and push it on the `chat` channel.
|
|
44
45
|
*/
|
|
45
|
-
export declare const HOST_PROTOCOL =
|
|
46
|
+
export declare const HOST_PROTOCOL = 3;
|
|
47
|
+
/** The first protocol whose computers take a turn pushed to them. */
|
|
48
|
+
export declare const PUSHED_TURNS_PROTOCOL = 3;
|
|
49
|
+
/**
|
|
50
|
+
* Server to one computer, on the `chat` channel: a turn claimed for it, as `hostClaim` would
|
|
51
|
+
* answer. The computer confirms it by calling about the turn; one it never confirms goes
|
|
52
|
+
* back to the queue, for `hostClaim`.
|
|
53
|
+
*/
|
|
54
|
+
export interface PushedTurn {
|
|
55
|
+
readonly type: "claimed";
|
|
56
|
+
readonly turn: ClaimedTurn;
|
|
57
|
+
}
|
|
46
58
|
export interface ProtocolRange {
|
|
47
59
|
readonly min: number;
|
|
48
60
|
readonly max: number;
|
package/dist/protocol.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,MAAM,EACZ,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,MAAM,EACZ,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEnE,eAAO,MAAM,YAAY,SAAS,CAAC;AACnC,kEAAkE;AAClE,eAAO,MAAM,WAAW,SAAS,CAAC;AAElC,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,WAAW,CAAC;AAElD;;;;GAIG;AACH,MAAM,MAAM,SAAS,GACjB;IACE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAA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AC;CACtB;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;IAClC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC;CACvC;AAED,MAAM,MAAM,WAAW,GACnB;IACE,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC;CAC9B,GACD;IACE,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,aAAa,CAAC;IAChD,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;CACnC,CAAC;AAwCN,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CA8BlE"}
|
package/dist/protocol.js
CHANGED
|
@@ -5,8 +5,11 @@ export const CHAT_PLUGIN = "chat";
|
|
|
5
5
|
/**
|
|
6
6
|
* The versioned contract between an app's backend and Parlor Host: host actions, item
|
|
7
7
|
* kinds, frames and cursor rules. Bumped on any change an older peer could misread.
|
|
8
|
+
* 3: the server may claim a turn for the computer and push it on the `chat` channel.
|
|
8
9
|
*/
|
|
9
|
-
export const HOST_PROTOCOL =
|
|
10
|
+
export const HOST_PROTOCOL = 3;
|
|
11
|
+
/** The first protocol whose computers take a turn pushed to them. */
|
|
12
|
+
export const PUSHED_TURNS_PROTOCOL = 3;
|
|
10
13
|
function isFields(value) {
|
|
11
14
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
12
15
|
}
|
package/dist/protocol.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,GAML,MAAM,cAAc,CAAC;AAKtB,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC;AACnC,kEAAkE;AAClE,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC;AAwClC
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,GAML,MAAM,cAAc,CAAC;AAKtB,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC;AACnC,kEAAkE;AAClE,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC;AAwClC;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC;AAE/B,qEAAqE;AACrE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAyCvC,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,KAAK,CAAmB,MAAoB,EAAE,KAAc;IACnE,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,KAAK,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,IAAI,CAAmB,IAAO,EAAE,KAAc;IACrD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACvF,CAAC;AAED,SAAS,UAAU,CACjB,KAAc;IAEd,IAAI,CAAC,QAAQ,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AAK,QAAQ;gBAAE,OAAO,SAAS,CAAC;YACnE,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC;gBACvE,OAAO,SAAS,CAAC;YACnB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QACzE,CAAC;QACD;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC","sourcesContent":["import {\n asId,\n type Id,\n type IdKind,\n type ItemId,\n type ThreadId,\n type TurnId,\n} from \"@parlor/core\";\n\nimport type { ChatItemBody } from \"./items.js\";\nimport type { AgentInfo, ClaimedTurn, OpenItem } from \"./model.js\";\n\nexport const CHAT_CHANNEL = \"chat\";\n/** The plugin name, so its routes live under `/_parlor/chat/`. */\nexport const CHAT_PLUGIN = \"chat\";\n\nexport type StreamingKind = \"reply\" | \"reasoning\";\n\n/**\n * Server to browser on the `chat` channel; never persisted. `offset` makes a duplicate\n * delta skippable and a gap detectable, after which the client waits for the durable\n * item. `settled` drops a turn's open items: durable now, or gone.\n */\nexport type ChatFrame =\n | {\n readonly type: \"delta\";\n readonly threadId: ThreadId;\n readonly turnId: TurnId;\n readonly itemId: ItemId;\n readonly kind: StreamingKind;\n readonly offset: number;\n readonly text: string;\n }\n | {\n readonly type: \"item\";\n readonly threadId: ThreadId;\n readonly turnId: TurnId;\n readonly item: Extract<OpenItem, { kind: \"tool\" | \"plan\" }>;\n }\n | { readonly type: \"settled\"; readonly threadId: ThreadId; readonly turnId: TurnId };\n\n/** Host to server: the same frames minus what the batch's turn implies. Only the server settles. */\nexport type HostFrame = ChatFrame extends infer F\n ? F extends { readonly type: \"delta\" | \"item\" }\n ? Omit<F, \"threadId\" | \"turnId\">\n : never\n : never;\n\n/** `POST /_parlor/chat/stream` */\nexport interface HostStreamBatch {\n readonly turnId: TurnId;\n readonly frames: readonly HostFrame[];\n}\n\n/**\n * The versioned contract between an app's backend and Parlor Host: host actions, item\n * kinds, frames and cursor rules. Bumped on any change an older peer could misread.\n * 3: the server may claim a turn for the computer and push it on the `chat` channel.\n */\nexport const HOST_PROTOCOL = 3;\n\n/** The first protocol whose computers take a turn pushed to them. */\nexport const PUSHED_TURNS_PROTOCOL = 3;\n\n/**\n * Server to one computer, on the `chat` channel: a turn claimed for it, as `hostClaim` would\n * answer. The computer confirms it by calling about the turn; one it never confirms goes\n * back to the queue, for `hostClaim`.\n */\nexport interface PushedTurn {\n readonly type: \"claimed\";\n readonly turn: ClaimedTurn;\n}\n\nexport interface ProtocolRange {\n readonly min: number;\n readonly max: number;\n}\n\nexport interface HostHello {\n readonly protocols: ProtocolRange;\n readonly hostVersion: string;\n readonly name: string;\n readonly platform: string;\n readonly agents: readonly AgentInfo[];\n}\n\nexport type HostWelcome =\n | {\n readonly accepted: true;\n readonly protocol: number;\n readonly leaseMs: number;\n readonly heartbeatMs: number;\n readonly userActivity?: true;\n }\n | {\n readonly accepted: false;\n readonly reason: \"host_too_old\" | \"app_too_old\";\n readonly protocols: ProtocolRange;\n };\n\ntype Fields = Readonly<Record<string, unknown>>;\n\nfunction isFields(value: unknown): value is Fields {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction oneOf<T extends string>(values: readonly T[], value: unknown): T | undefined {\n return values.find((candidate) => candidate === value);\n}\n\nfunction idOf<K extends IdKind>(kind: K, value: unknown): Id<K> | undefined {\n return typeof value === \"string\" && value.length > 0 ? asId(kind, value) : undefined;\n}\n\nfunction openItemOf(\n value: unknown,\n): Extract<OpenItem, { kind: \"tool\" | \"plan\" }> | undefined {\n if (!isFields(value)) return undefined;\n const id = idOf(\"item\", value.id);\n if (!id) return undefined;\n if (value.kind === \"tool\") {\n const status = oneOf([\"pending\", \"running\"], value.status);\n if (typeof value.title !== \"string\" || !status) return undefined;\n return { id, kind: \"tool\", title: value.title, status };\n }\n if (value.kind === \"plan\" && Array.isArray(value.entries)) {\n const entries: ChatItemBody<\"plan\">[\"entries\"][number][] = [];\n for (const entry of value.entries as unknown[]) {\n if (!isFields(entry) || typeof entry.content !== \"string\") return undefined;\n const status = oneOf([\"pending\", \"in_progress\", \"completed\"], entry.status);\n if (!status) return undefined;\n entries.push({ content: entry.content, status });\n }\n return { id, kind: \"plan\", entries };\n }\n return undefined;\n}\n\nexport function parseChatFrame(data: string): ChatFrame | undefined {\n let value: unknown;\n try {\n value = JSON.parse(data);\n } catch {\n return undefined;\n }\n if (!isFields(value)) return undefined;\n const threadId = idOf(\"thread\", value.threadId);\n const turnId = idOf(\"turn\", value.turnId);\n if (!threadId || !turnId) return undefined;\n switch (value.type) {\n case \"settled\":\n return { type: \"settled\", threadId, turnId };\n case \"item\": {\n const item = openItemOf(value.item);\n return item ? { type: \"item\", threadId, turnId, item } : undefined;\n }\n case \"delta\": {\n const itemId = idOf(\"item\", value.itemId);\n const kind = oneOf([\"reply\", \"reasoning\"], value.kind);\n const { offset, text } = value;\n if (!itemId || !kind || typeof text !== \"string\") return undefined;\n if (typeof offset !== \"number\" || !Number.isInteger(offset) || offset < 0)\n return undefined;\n return { type: \"delta\", threadId, turnId, itemId, kind, offset, text };\n }\n default:\n return undefined;\n }\n}\n"]}
|
package/dist/server/actions.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type HostId, type ThreadId, type TurnId } from "@parlor/core";
|
|
2
2
|
import { type ActionsOf } from "@parlor/core/registry";
|
|
3
|
-
import { type AuthProvider, HOST_GRANTS_TAG } from "@parlor/server";
|
|
3
|
+
import { type AuthProvider, type Delegation, HOST_GRANTS_TAG } from "@parlor/server";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { idSchema } from "../id-schemas.js";
|
|
6
6
|
import { type LoggedItem } from "../items.js";
|
|
7
|
-
import type { ChatOwner, ChatSnapshot, ThreadHistory, ThreadList, ClaimedTurn, HostSummary, TurnSignals } from "../model.js";
|
|
7
|
+
import type { AgentInfo, ChatOwner, ChatSnapshot, ThreadHistory, ThreadList, ClaimedTurn, HostSummary, TurnSignals } from "../model.js";
|
|
8
8
|
import { type HostWelcome } from "../protocol.js";
|
|
9
9
|
import { CHAT_ACTIVITY_TAG, CHAT_TAG, HOSTS_TAG } from "../tags.js";
|
|
10
10
|
import type { LiveRelay } from "./live.js";
|
|
11
|
-
import { type
|
|
11
|
+
import { type ChatHost } from "./party.js";
|
|
12
|
+
import type { TurnPush } from "./push.js";
|
|
13
|
+
import { type ChatDb, type ChatStore, type StoredHost } from "./store.js";
|
|
12
14
|
export { CHAT_ACTIVITY_TAG, CHAT_TAG, HOSTS_TAG, HOST_GRANTS_TAG };
|
|
13
15
|
export interface Written<T> {
|
|
14
16
|
readonly result: T;
|
|
@@ -35,7 +37,9 @@ export interface ChatActionDeps {
|
|
|
35
37
|
readonly maxQueued: number;
|
|
36
38
|
readonly instructions: string | undefined;
|
|
37
39
|
readonly appName: string;
|
|
38
|
-
readonly appOrigin: (
|
|
40
|
+
readonly appOrigin: () => string;
|
|
41
|
+
/** Hands a queued turn straight to its computer; without it computers only claim. */
|
|
42
|
+
readonly pushed?: TurnPush | undefined;
|
|
39
43
|
}
|
|
40
44
|
export declare function userChatActions(deps: ChatActionDeps): {
|
|
41
45
|
open: import("@parlor/core").ActionDefinition<z.ZodObject<{
|
|
@@ -89,6 +93,7 @@ export declare function userChatActions(deps: ChatActionDeps): {
|
|
|
89
93
|
}, z.core.$strip>;
|
|
90
94
|
pairing: z.ZodOptional<z.ZodString>;
|
|
91
95
|
}, z.core.$strip>>;
|
|
96
|
+
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
92
97
|
}, z.core.$strip>;
|
|
93
98
|
}, z.core.$strip>, {
|
|
94
99
|
readonly id: string;
|
|
@@ -136,8 +141,28 @@ export declare function userChatActions(deps: ChatActionDeps): {
|
|
|
136
141
|
readonly ok: true;
|
|
137
142
|
}>;
|
|
138
143
|
};
|
|
144
|
+
/**
|
|
145
|
+
* What the server keeps about the computers it serves: which said hello, their agents'
|
|
146
|
+
* names, and how a turn is claimed for one, by `hostClaim` or pushed to it.
|
|
147
|
+
*/
|
|
148
|
+
export declare function hostSession(deps: ChatActionDeps): {
|
|
149
|
+
welcome: (host: ChatHost, db: ChatDb) => Promise<StoredHost>;
|
|
150
|
+
requireWelcome: (host: ChatHost, db: ChatDb) => Promise<void>;
|
|
151
|
+
learnAgents: (hostId: HostId, agents: readonly AgentInfo[]) => void;
|
|
152
|
+
agentNameOf: (host: ChatHost, db: ChatDb, agentId: string) => Promise<string>;
|
|
153
|
+
mint: (host: ChatHost, db: ChatDb, turn: {
|
|
154
|
+
threadId: ThreadId;
|
|
155
|
+
turnId: TurnId;
|
|
156
|
+
clientId: string;
|
|
157
|
+
agentId: string;
|
|
158
|
+
}) => Promise<Delegation>;
|
|
159
|
+
claim: (host: ChatHost, db: ChatDb) => Promise<ClaimedTurn | undefined>;
|
|
160
|
+
release: (host: ChatHost, thread: ThreadId, turn: TurnId) => Promise<boolean>;
|
|
161
|
+
welcomed: Set<HostId>;
|
|
162
|
+
};
|
|
163
|
+
export type HostSession = ReturnType<typeof hostSession>;
|
|
139
164
|
/** What the user's computers call; `hostHello` first on every link. */
|
|
140
|
-
export declare function hostChatActions(deps: ChatActionDeps): {
|
|
165
|
+
export declare function hostChatActions(deps: ChatActionDeps, session?: HostSession): {
|
|
141
166
|
hostHello: import("@parlor/core").ActionDefinition<z.ZodObject<{
|
|
142
167
|
protocols: z.ZodObject<{
|
|
143
168
|
min: z.ZodNumber;
|
|
@@ -152,6 +177,27 @@ export declare function hostChatActions(deps: ChatActionDeps): {
|
|
|
152
177
|
version: z.ZodOptional<z.ZodString>;
|
|
153
178
|
ready: z.ZodBoolean;
|
|
154
179
|
problem: z.ZodOptional<z.ZodString>;
|
|
180
|
+
options: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
181
|
+
id: z.ZodString;
|
|
182
|
+
name: z.ZodString;
|
|
183
|
+
category: z.ZodOptional<z.ZodString>;
|
|
184
|
+
current: z.ZodString;
|
|
185
|
+
values: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
186
|
+
id: z.ZodString;
|
|
187
|
+
name: z.ZodString;
|
|
188
|
+
description: z.ZodOptional<z.ZodString>;
|
|
189
|
+
}, z.core.$strip>>>;
|
|
190
|
+
}, z.core.$strip>>>>;
|
|
191
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
192
|
+
windows: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
193
|
+
id: z.ZodString;
|
|
194
|
+
minutes: z.ZodNumber;
|
|
195
|
+
used: z.ZodNumber;
|
|
196
|
+
resetsAt: z.ZodOptional<z.ZodNumber>;
|
|
197
|
+
}, z.core.$strip>>>;
|
|
198
|
+
at: z.ZodNumber;
|
|
199
|
+
}, z.core.$strip>>;
|
|
200
|
+
outsideName: z.ZodOptional<z.ZodString>;
|
|
155
201
|
}, z.core.$strip>>;
|
|
156
202
|
devices: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
157
203
|
presenceDue: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
@@ -166,6 +212,27 @@ export declare function hostChatActions(deps: ChatActionDeps): {
|
|
|
166
212
|
version: z.ZodOptional<z.ZodString>;
|
|
167
213
|
ready: z.ZodBoolean;
|
|
168
214
|
problem: z.ZodOptional<z.ZodString>;
|
|
215
|
+
options: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
216
|
+
id: z.ZodString;
|
|
217
|
+
name: z.ZodString;
|
|
218
|
+
category: z.ZodOptional<z.ZodString>;
|
|
219
|
+
current: z.ZodString;
|
|
220
|
+
values: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
221
|
+
id: z.ZodString;
|
|
222
|
+
name: z.ZodString;
|
|
223
|
+
description: z.ZodOptional<z.ZodString>;
|
|
224
|
+
}, z.core.$strip>>>;
|
|
225
|
+
}, z.core.$strip>>>>;
|
|
226
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
227
|
+
windows: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
228
|
+
id: z.ZodString;
|
|
229
|
+
minutes: z.ZodNumber;
|
|
230
|
+
used: z.ZodNumber;
|
|
231
|
+
resetsAt: z.ZodOptional<z.ZodNumber>;
|
|
232
|
+
}, z.core.$strip>>>;
|
|
233
|
+
at: z.ZodNumber;
|
|
234
|
+
}, z.core.$strip>>;
|
|
235
|
+
outsideName: z.ZodOptional<z.ZodString>;
|
|
169
236
|
}, z.core.$strip>>;
|
|
170
237
|
devices: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
171
238
|
presenceDue: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
@@ -173,6 +240,9 @@ export declare function hostChatActions(deps: ChatActionDeps): {
|
|
|
173
240
|
readonly id: string;
|
|
174
241
|
readonly onlineUntil: number;
|
|
175
242
|
}>;
|
|
243
|
+
hostAgentToken: import("@parlor/core").ActionDefinition<z.ZodObject<{
|
|
244
|
+
agent: z.ZodString;
|
|
245
|
+
}, z.core.$strip>, Delegation>;
|
|
176
246
|
hostClaim: import("@parlor/core").ActionDefinition<z.ZodObject<{}, z.core.$strip>, ClaimedTurn>;
|
|
177
247
|
hostSignals: import("@parlor/core").ActionDefinition<z.ZodObject<{
|
|
178
248
|
turns: z.ZodArray<z.ZodObject<{
|
|
@@ -245,6 +315,7 @@ export declare function hostChatActions(deps: ChatActionDeps): {
|
|
|
245
315
|
form: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
246
316
|
approval: z.ZodOptional<z.ZodEnum<{
|
|
247
317
|
computer: "computer";
|
|
318
|
+
device: "device";
|
|
248
319
|
presence: "presence";
|
|
249
320
|
}>>;
|
|
250
321
|
}, z.core.$strip>;
|
|
@@ -299,7 +370,7 @@ export declare function hostChatActions(deps: ChatActionDeps): {
|
|
|
299
370
|
* The chat's actions at `/_parlor/chat/actions/<name>`: plugin actions, so never on MCP
|
|
300
371
|
* and never callable by an agent. Writes return the thread or host id as `id`.
|
|
301
372
|
*/
|
|
302
|
-
export declare function chatActions(deps: ChatActionDeps): import("@parlor/core/registry").ActionRegistry<{
|
|
373
|
+
export declare function chatActions(deps: ChatActionDeps, session?: HostSession): import("@parlor/core/registry").ActionRegistry<{
|
|
303
374
|
open: import("@parlor/core").ActionDefinition<z.ZodObject<{
|
|
304
375
|
threadId: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("@parlor/core").Id<"thread">, string>>>;
|
|
305
376
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
@@ -351,6 +422,7 @@ export declare function chatActions(deps: ChatActionDeps): import("@parlor/core/
|
|
|
351
422
|
}, z.core.$strip>;
|
|
352
423
|
pairing: z.ZodOptional<z.ZodString>;
|
|
353
424
|
}, z.core.$strip>>;
|
|
425
|
+
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
354
426
|
}, z.core.$strip>;
|
|
355
427
|
}, z.core.$strip>, {
|
|
356
428
|
readonly id: string;
|
|
@@ -411,6 +483,27 @@ export declare function chatActions(deps: ChatActionDeps): import("@parlor/core/
|
|
|
411
483
|
version: z.ZodOptional<z.ZodString>;
|
|
412
484
|
ready: z.ZodBoolean;
|
|
413
485
|
problem: z.ZodOptional<z.ZodString>;
|
|
486
|
+
options: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
487
|
+
id: z.ZodString;
|
|
488
|
+
name: z.ZodString;
|
|
489
|
+
category: z.ZodOptional<z.ZodString>;
|
|
490
|
+
current: z.ZodString;
|
|
491
|
+
values: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
492
|
+
id: z.ZodString;
|
|
493
|
+
name: z.ZodString;
|
|
494
|
+
description: z.ZodOptional<z.ZodString>;
|
|
495
|
+
}, z.core.$strip>>>;
|
|
496
|
+
}, z.core.$strip>>>>;
|
|
497
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
498
|
+
windows: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
499
|
+
id: z.ZodString;
|
|
500
|
+
minutes: z.ZodNumber;
|
|
501
|
+
used: z.ZodNumber;
|
|
502
|
+
resetsAt: z.ZodOptional<z.ZodNumber>;
|
|
503
|
+
}, z.core.$strip>>>;
|
|
504
|
+
at: z.ZodNumber;
|
|
505
|
+
}, z.core.$strip>>;
|
|
506
|
+
outsideName: z.ZodOptional<z.ZodString>;
|
|
414
507
|
}, z.core.$strip>>;
|
|
415
508
|
devices: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
416
509
|
presenceDue: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
@@ -425,6 +518,27 @@ export declare function chatActions(deps: ChatActionDeps): import("@parlor/core/
|
|
|
425
518
|
version: z.ZodOptional<z.ZodString>;
|
|
426
519
|
ready: z.ZodBoolean;
|
|
427
520
|
problem: z.ZodOptional<z.ZodString>;
|
|
521
|
+
options: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
522
|
+
id: z.ZodString;
|
|
523
|
+
name: z.ZodString;
|
|
524
|
+
category: z.ZodOptional<z.ZodString>;
|
|
525
|
+
current: z.ZodString;
|
|
526
|
+
values: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
527
|
+
id: z.ZodString;
|
|
528
|
+
name: z.ZodString;
|
|
529
|
+
description: z.ZodOptional<z.ZodString>;
|
|
530
|
+
}, z.core.$strip>>>;
|
|
531
|
+
}, z.core.$strip>>>>;
|
|
532
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
533
|
+
windows: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
534
|
+
id: z.ZodString;
|
|
535
|
+
minutes: z.ZodNumber;
|
|
536
|
+
used: z.ZodNumber;
|
|
537
|
+
resetsAt: z.ZodOptional<z.ZodNumber>;
|
|
538
|
+
}, z.core.$strip>>>;
|
|
539
|
+
at: z.ZodNumber;
|
|
540
|
+
}, z.core.$strip>>;
|
|
541
|
+
outsideName: z.ZodOptional<z.ZodString>;
|
|
428
542
|
}, z.core.$strip>>;
|
|
429
543
|
devices: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
430
544
|
presenceDue: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
@@ -432,6 +546,9 @@ export declare function chatActions(deps: ChatActionDeps): import("@parlor/core/
|
|
|
432
546
|
readonly id: string;
|
|
433
547
|
readonly onlineUntil: number;
|
|
434
548
|
}>;
|
|
549
|
+
hostAgentToken: import("@parlor/core").ActionDefinition<z.ZodObject<{
|
|
550
|
+
agent: z.ZodString;
|
|
551
|
+
}, z.core.$strip>, Delegation>;
|
|
435
552
|
hostClaim: import("@parlor/core").ActionDefinition<z.ZodObject<{}, z.core.$strip>, ClaimedTurn>;
|
|
436
553
|
hostSignals: import("@parlor/core").ActionDefinition<z.ZodObject<{
|
|
437
554
|
turns: z.ZodArray<z.ZodObject<{
|
|
@@ -504,6 +621,7 @@ export declare function chatActions(deps: ChatActionDeps): import("@parlor/core/
|
|
|
504
621
|
form: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
505
622
|
approval: z.ZodOptional<z.ZodEnum<{
|
|
506
623
|
computer: "computer";
|
|
624
|
+
device: "device";
|
|
507
625
|
presence: "presence";
|
|
508
626
|
}>>;
|
|
509
627
|
}, z.core.$strip>;
|