agent-canvas 0.9.0-dev.13 → 0.9.0-dev.15

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.
Files changed (65) hide show
  1. package/README.md +28 -0
  2. package/bin/agent-canvas.ts +8 -1
  3. package/bin/lib/cli-auth.ts +31 -0
  4. package/bin/lib/commands/daemon.ts +2 -1
  5. package/bin/lib/commands/exec.ts +5 -4
  6. package/bin/lib/commands/fetch.ts +4 -4
  7. package/bin/lib/commands/push.ts +3 -2
  8. package/bin/lib/commands/reply.ts +45 -0
  9. package/bin/lib/commands/review.ts +4 -2
  10. package/bin/lib/commands/watch.ts +100 -5
  11. package/bin/lib/helpers.ts +121 -43
  12. package/bin/lib/instructions/component-download.md +28 -0
  13. package/bin/lib/instructions/component-filedrop.md +50 -0
  14. package/bin/lib/instructions/overview.md +41 -1
  15. package/bin/lib/instructions/template-dashboard.md +177 -0
  16. package/bin/lib/instructions/template-slides.md +196 -0
  17. package/bin/lib/instructions/theming.md +25 -0
  18. package/daemon/client/App.tsx +17 -5
  19. package/daemon/client/clientApi.ts +64 -5
  20. package/daemon/client/components/Download.tsx +28 -0
  21. package/daemon/client/components/FileDrop.tsx +164 -0
  22. package/daemon/client/components/index.ts +3 -1
  23. package/daemon/client/threadStore.ts +70 -0
  24. package/daemon/dist/annotations-runtime.js +1 -1
  25. package/daemon/dist/client.css +2 -2
  26. package/daemon/dist/client.js +74 -73
  27. package/daemon/dist/components.js +62 -59
  28. package/daemon/dist/preact-compat.js +1 -1
  29. package/daemon/dist/review.js +3 -3
  30. package/daemon/dist/runtime.js +1 -1
  31. package/daemon/src/admission.ts +102 -0
  32. package/daemon/src/assets.ts +16 -0
  33. package/daemon/src/components.ts +6 -1
  34. package/daemon/src/handlers/api.ts +7 -4
  35. package/daemon/src/handlers/assets.ts +126 -0
  36. package/daemon/src/handlers/files.ts +124 -19
  37. package/daemon/src/handlers/static.ts +65 -1
  38. package/daemon/src/handlers/theme.ts +150 -0
  39. package/daemon/src/handlers/threads.ts +93 -0
  40. package/daemon/src/review/server.ts +1 -1
  41. package/daemon/src/server.ts +81 -47
  42. package/daemon/src/threads.ts +132 -0
  43. package/package.json +4 -4
  44. package/skills/canvas/SKILL.md +5 -0
  45. package/types/bin/lib/cli-auth.d.ts +9 -0
  46. package/types/bin/lib/commands/reply.d.ts +2 -0
  47. package/types/bin/lib/commands/watch.d.ts +3 -1
  48. package/types/bin/lib/helpers.d.ts +102 -0
  49. package/types/daemon/client/clientApi.d.ts +14 -1
  50. package/types/daemon/client/components/Download.d.ts +9 -0
  51. package/types/daemon/client/components/FileDrop.d.ts +12 -0
  52. package/types/daemon/client/components/index.d.ts +2 -0
  53. package/types/daemon/client/threadStore.d.ts +15 -0
  54. package/types/daemon/src/admission.d.ts +24 -0
  55. package/types/daemon/src/assets.d.ts +23 -0
  56. package/types/daemon/src/components.d.ts +3 -1
  57. package/types/daemon/src/handlers/assets.d.ts +14 -0
  58. package/types/daemon/src/handlers/files.d.ts +8 -2
  59. package/types/daemon/src/handlers/static.d.ts +16 -0
  60. package/types/daemon/src/handlers/theme.d.ts +18 -0
  61. package/types/daemon/src/handlers/threads.d.ts +19 -0
  62. package/types/daemon/src/review/model.d.ts +24 -24
  63. package/types/daemon/src/review/remote.d.ts +8 -8
  64. package/types/daemon/src/review/server.d.ts +2 -0
  65. package/types/daemon/src/threads.d.ts +109 -0
@@ -0,0 +1,109 @@
1
+ import type { SessionManager } from '@fabrika/canvas-kernel/server';
2
+ import { z } from 'zod';
3
+ /**
4
+ * Threads on a canvas session's submitted annotations. The agent opens one by answering an annotation; the user
5
+ * answers back from the sidebar. The lifecycle is review mode's (`review/threads.ts`); a thread's id is the
6
+ * annotation's, and it lives at session level so it outlives the revision it was submitted on.
7
+ */
8
+ export declare const canvasThreadSchema: z.ZodObject<{
9
+ id: z.ZodString;
10
+ state: z.ZodEnum<["open", "queued", "working", "resolved"]>;
11
+ revision: z.ZodNumber;
12
+ snippet: z.ZodString;
13
+ canvasFile: z.ZodOptional<z.ZodString>;
14
+ filePath: z.ZodOptional<z.ZodString>;
15
+ comments: z.ZodArray<z.ZodObject<{
16
+ id: z.ZodString;
17
+ author: z.ZodEnum<["user", "agent"]>;
18
+ body: z.ZodString;
19
+ createdAt: z.ZodString;
20
+ }, "strip", z.ZodTypeAny, {
21
+ id: string;
22
+ author: "user" | "agent";
23
+ body: string;
24
+ createdAt: string;
25
+ }, {
26
+ id: string;
27
+ author: "user" | "agent";
28
+ body: string;
29
+ createdAt: string;
30
+ }>, "many">;
31
+ createdAt: z.ZodString;
32
+ updatedAt: z.ZodString;
33
+ }, "strip", z.ZodTypeAny, {
34
+ revision: number;
35
+ id: string;
36
+ state: "open" | "resolved" | "queued" | "working";
37
+ createdAt: string;
38
+ comments: {
39
+ id: string;
40
+ author: "user" | "agent";
41
+ body: string;
42
+ createdAt: string;
43
+ }[];
44
+ updatedAt: string;
45
+ snippet: string;
46
+ filePath?: string | undefined;
47
+ canvasFile?: string | undefined;
48
+ }, {
49
+ revision: number;
50
+ id: string;
51
+ state: "open" | "resolved" | "queued" | "working";
52
+ createdAt: string;
53
+ comments: {
54
+ id: string;
55
+ author: "user" | "agent";
56
+ body: string;
57
+ createdAt: string;
58
+ }[];
59
+ updatedAt: string;
60
+ snippet: string;
61
+ filePath?: string | undefined;
62
+ canvasFile?: string | undefined;
63
+ }>;
64
+ export type CanvasThread = z.infer<typeof canvasThreadSchema>;
65
+ export declare const agentReplyBodySchema: z.ZodObject<{
66
+ body: z.ZodString;
67
+ resolve: z.ZodBoolean;
68
+ }, "strip", z.ZodTypeAny, {
69
+ resolve: boolean;
70
+ body: string;
71
+ }, {
72
+ resolve: boolean;
73
+ body: string;
74
+ }>;
75
+ export declare const userReplyBodySchema: z.ZodObject<{
76
+ body: z.ZodString;
77
+ }, "strip", z.ZodTypeAny, {
78
+ body: string;
79
+ }, {
80
+ body: string;
81
+ }>;
82
+ export declare const resolvedBodySchema: z.ZodObject<{
83
+ resolved: z.ZodBoolean;
84
+ }, "strip", z.ZodTypeAny, {
85
+ resolved: boolean;
86
+ }, {
87
+ resolved: boolean;
88
+ }>;
89
+ export declare class CanvasThreadStore {
90
+ private readonly sessions;
91
+ private readonly now;
92
+ constructor(sessions: SessionManager, now?: () => Date);
93
+ list(sessionId: string): readonly CanvasThread[];
94
+ /** The agent's answer, which opens the thread on its first reply. Without `resolve` it goes back to the user. */
95
+ agentReply(sessionId: string, annotationId: string, body: string, resolve: boolean): CanvasThread;
96
+ /** The user's answer goes to the agent and reopens a resolved thread. */
97
+ userReply(sessionId: string, threadId: string, body: string): CanvasThread;
98
+ setResolved(sessionId: string, threadId: string, resolved: boolean): CanvasThread;
99
+ /** Hands every thread the user answered to the agent, once. A session the daemon does not know has none. */
100
+ claimQueued(sessionId: string): readonly CanvasThread[];
101
+ private opened;
102
+ private update;
103
+ private save;
104
+ private requireSession;
105
+ private comment;
106
+ private timestamp;
107
+ }
108
+ /** Threads the user answered, as the agent reads them: the annotation, the conversation, and how to reply. */
109
+ export declare function threadRepliesMarkdown(threads: readonly CanvasThread[]): string;