create-windy 0.3.17 → 0.3.19

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 (58) hide show
  1. package/README.md +14 -36
  2. package/dist/cli.js +1534 -3079
  3. package/package.json +1 -1
  4. package/template/.windy-template.json +2 -2
  5. package/template/AGENTS.md +6 -0
  6. package/template/README.md +5 -10
  7. package/template/apps/agent-server/Dockerfile +2 -1
  8. package/template/apps/agent-server/README.md +13 -5
  9. package/template/apps/agent-server/adk_web_agents/canonical_debug/__init__.py +1 -0
  10. package/template/apps/agent-server/adk_web_agents/canonical_debug/agent.py +125 -0
  11. package/template/apps/agent-server/project/adk-web-debug.json +4 -0
  12. package/template/apps/agent-server/src/southwind_agent_server/adk_debug.py +348 -0
  13. package/template/apps/agent-server/tests/test_adk_debug_result_polling.py +139 -0
  14. package/template/apps/agent-server/tests/test_adk_web_canonical_debug.py +235 -0
  15. package/template/apps/server/src/agent/run-debug-authorization.ts +27 -0
  16. package/template/apps/server/src/agent/run-facade-adk-debug.test.ts +56 -0
  17. package/template/apps/server/src/agent/run-facade.test-support.ts +235 -0
  18. package/template/apps/server/src/agent/run-facade.test.ts +8 -244
  19. package/template/apps/server/src/agent/run-facade.ts +23 -48
  20. package/template/apps/server/src/agent/run-operation-registry.ts +51 -0
  21. package/template/apps/server/src/agent/runtime-bootstrap.ts +5 -2
  22. package/template/apps/server/src/agent/tool-audit.ts +3 -0
  23. package/template/apps/server/src/agent/tool-registry.test.ts +29 -0
  24. package/template/apps/server/src/application-services.ts +83 -15
  25. package/template/apps/server/src/guards.ts +16 -0
  26. package/template/apps/server/src/index.ts +23 -20
  27. package/template/apps/server/src/jobs/legacy-adapter.integration.test.ts +0 -1
  28. package/template/apps/server/src/jobs/legacy-adapter.test.ts +6 -0
  29. package/template/apps/server/src/jobs/legacy-service-runtime.ts +18 -0
  30. package/template/apps/server/src/module-host/durable-context-unavailable.test.ts +84 -0
  31. package/template/apps/server/src/module-host/durable-context.test.ts +14 -0
  32. package/template/apps/server/src/module-host/durable-context.ts +17 -15
  33. package/template/apps/server/src/module-host/request-context.test.ts +30 -1
  34. package/template/apps/server/src/module-host/request-context.ts +15 -2
  35. package/template/apps/server/src/module-host/storage-port.ts +1 -1
  36. package/template/apps/server/src/platform-bootstrap.ts +16 -0
  37. package/template/apps/server/src/runtime-adk-debug.test.ts +246 -0
  38. package/template/apps/server/src/runtime-adk-debug.ts +158 -0
  39. package/template/apps/server/src/runtime-request-actor.test.ts +55 -0
  40. package/template/apps/server/src/runtime-request-actor.ts +22 -0
  41. package/template/apps/server/src/runtime.test.ts +3 -0
  42. package/template/apps/server/src/runtime.ts +36 -3
  43. package/template/apps/server/src/scheduler/definitions.test.ts +16 -0
  44. package/template/docker-compose.agent-debug.yml +56 -0
  45. package/template/docker-compose.yml +1 -39
  46. package/template/docs/architecture/ai-runtime.md +14 -5
  47. package/template/docs/architecture/module-manifest-composition.md +14 -0
  48. package/template/docs/development/custom-login-page.md +2 -16
  49. package/template/docs/platform/agent-runtime.md +59 -16
  50. package/template/docs/platform/agent-tool-sandbox.md +4 -3
  51. package/template/docs/platform/platform-authentication.md +9 -1
  52. package/template/package.json +1 -1
  53. package/template/packages/database/drizzle/0043_activate_agent_dependencies.sql +196 -0
  54. package/template/packages/database/drizzle/meta/0043_snapshot.json +8335 -0
  55. package/template/packages/database/drizzle/meta/_journal.json +7 -0
  56. package/template/packages/database/src/schema-notification-delivery.test.ts +15 -6
  57. package/template/packages/database/src/schema-workflow-notification.test.ts +44 -29
  58. package/template/scripts/dev-adk-web.ts +107 -0
@@ -0,0 +1,196 @@
1
+ DO $windy$
2
+ BEGIN
3
+ IF to_regclass('public.workflow_work_items') IS NULL THEN
4
+ CREATE TABLE "workflow_work_items" (
5
+ "id" varchar(64) PRIMARY KEY NOT NULL,
6
+ "title" varchar(160) NOT NULL,
7
+ "status" varchar(32) NOT NULL,
8
+ "requester_id" varchar(64) NOT NULL,
9
+ "candidate_roles" jsonb NOT NULL,
10
+ "assignee_id" varchar(64),
11
+ "assignee_name" varchar(120),
12
+ "assignee_role_codes" jsonb DEFAULT '[]'::jsonb NOT NULL,
13
+ "due_at" timestamp with time zone NOT NULL,
14
+ "target" jsonb NOT NULL,
15
+ "created_idempotency_key" varchar(160) NOT NULL,
16
+ "created_at" timestamp with time zone NOT NULL,
17
+ "updated_at" timestamp with time zone NOT NULL,
18
+ "version" integer NOT NULL,
19
+ CONSTRAINT "ck_workflow_work_items_version" CHECK ("version" > 0)
20
+ );
21
+
22
+ CREATE TABLE "workflow_transitions" (
23
+ "id" varchar(64) PRIMARY KEY NOT NULL,
24
+ "work_item_id" varchar(64) NOT NULL,
25
+ "command" varchar(32) NOT NULL,
26
+ "before_status" varchar(32) NOT NULL,
27
+ "after_status" varchar(32) NOT NULL,
28
+ "actor_id" varchar(64) NOT NULL,
29
+ "idempotency_key" varchar(160) NOT NULL,
30
+ "decision" varchar(32),
31
+ "reason" text,
32
+ "previous_assignee_id" varchar(64),
33
+ "assignee_id" varchar(64),
34
+ "target" jsonb NOT NULL,
35
+ "result_snapshot" jsonb NOT NULL,
36
+ "occurred_at" timestamp with time zone NOT NULL,
37
+ CONSTRAINT "workflow_transitions_work_item_id_workflow_work_items_id_fk"
38
+ FOREIGN KEY ("work_item_id")
39
+ REFERENCES "public"."workflow_work_items"("id")
40
+ ON DELETE restrict ON UPDATE no action
41
+ );
42
+
43
+ CREATE UNIQUE INDEX "uk_workflow_work_items_create_request"
44
+ ON "workflow_work_items" USING btree ("requester_id", "created_idempotency_key");
45
+ CREATE INDEX "idx_workflow_work_items_candidate"
46
+ ON "workflow_work_items" USING gin ("candidate_roles");
47
+ CREATE INDEX "idx_workflow_work_items_assignee"
48
+ ON "workflow_work_items" USING btree ("assignee_id", "status");
49
+ CREATE INDEX "idx_workflow_work_items_due"
50
+ ON "workflow_work_items" USING btree ("status", "due_at");
51
+ CREATE UNIQUE INDEX "uk_workflow_transitions_request"
52
+ ON "workflow_transitions" USING btree ("actor_id", "idempotency_key");
53
+ CREATE INDEX "idx_workflow_transitions_item"
54
+ ON "workflow_transitions" USING btree ("work_item_id", "occurred_at");
55
+ END IF;
56
+ END
57
+ $windy$;
58
+ --> statement-breakpoint
59
+ DO $windy$
60
+ BEGIN
61
+ IF to_regclass('public.platform_notifications') IS NULL THEN
62
+ CREATE TABLE "platform_notifications" (
63
+ "id" varchar(64) PRIMARY KEY NOT NULL,
64
+ "title" varchar(120) NOT NULL,
65
+ "summary" varchar(240) NOT NULL,
66
+ "content" text NOT NULL,
67
+ "category" varchar(40) NOT NULL,
68
+ "status" varchar(32) NOT NULL,
69
+ "published_at" timestamp with time zone NOT NULL,
70
+ "scheduled_for" timestamp with time zone,
71
+ "archived_at" timestamp with time zone,
72
+ "archived_by" varchar(64),
73
+ "target" jsonb,
74
+ "recipient_user_id" varchar(64),
75
+ "recipient_user_ids" jsonb DEFAULT '[]'::jsonb NOT NULL,
76
+ "recipient_role_codes" jsonb DEFAULT '[]'::jsonb NOT NULL,
77
+ "recipient_department_ids" jsonb DEFAULT '[]'::jsonb NOT NULL,
78
+ "include_child_departments" boolean DEFAULT false NOT NULL,
79
+ "delivery_channels" jsonb DEFAULT '[]'::jsonb NOT NULL,
80
+ "source_key" varchar(180),
81
+ "revision" integer DEFAULT 1 NOT NULL,
82
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
83
+ "created_by" varchar(64) NOT NULL,
84
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
85
+ "updated_by" varchar(64) NOT NULL,
86
+ "deleted_at" timestamp with time zone,
87
+ "deleted_by" varchar(64)
88
+ );
89
+
90
+ CREATE TABLE "notification_reads" (
91
+ "notification_id" varchar(64) NOT NULL,
92
+ "user_id" varchar(64) NOT NULL,
93
+ "read_at" timestamp with time zone DEFAULT now() NOT NULL,
94
+ CONSTRAINT "notification_reads_notification_id_user_id_pk"
95
+ PRIMARY KEY ("notification_id", "user_id"),
96
+ CONSTRAINT "notification_reads_notification_id_platform_notifications_id_fk"
97
+ FOREIGN KEY ("notification_id")
98
+ REFERENCES "public"."platform_notifications"("id")
99
+ ON DELETE restrict ON UPDATE no action,
100
+ CONSTRAINT "notification_reads_user_id_users_id_fk"
101
+ FOREIGN KEY ("user_id")
102
+ REFERENCES "public"."users"("id")
103
+ ON DELETE restrict ON UPDATE no action
104
+ );
105
+
106
+ CREATE TABLE "notification_favorites" (
107
+ "notification_id" varchar(64) NOT NULL,
108
+ "user_id" varchar(64) NOT NULL,
109
+ "favorited_at" timestamp with time zone DEFAULT now() NOT NULL,
110
+ CONSTRAINT "notification_favorites_notification_id_user_id_pk"
111
+ PRIMARY KEY ("notification_id", "user_id"),
112
+ CONSTRAINT "notification_favorites_notification_id_platform_notifications_id_fk"
113
+ FOREIGN KEY ("notification_id")
114
+ REFERENCES "public"."platform_notifications"("id")
115
+ ON DELETE restrict ON UPDATE no action,
116
+ CONSTRAINT "notification_favorites_user_id_users_id_fk"
117
+ FOREIGN KEY ("user_id")
118
+ REFERENCES "public"."users"("id")
119
+ ON DELETE restrict ON UPDATE no action
120
+ );
121
+
122
+ CREATE TABLE "notification_revisions" (
123
+ "notification_id" varchar(64) NOT NULL,
124
+ "revision" integer NOT NULL,
125
+ "title" varchar(120) NOT NULL,
126
+ "summary" varchar(240) NOT NULL,
127
+ "content" text NOT NULL,
128
+ "category" varchar(40) NOT NULL,
129
+ "edited_at" timestamp with time zone NOT NULL,
130
+ "edited_by" varchar(64) NOT NULL,
131
+ CONSTRAINT "notification_revisions_notification_id_revision_pk"
132
+ PRIMARY KEY ("notification_id", "revision"),
133
+ CONSTRAINT "notification_revisions_notification_id_platform_notifications_id_fk"
134
+ FOREIGN KEY ("notification_id")
135
+ REFERENCES "public"."platform_notifications"("id")
136
+ ON DELETE restrict ON UPDATE no action
137
+ );
138
+
139
+ CREATE TABLE "notification_preferences" (
140
+ "user_id" varchar(64) PRIMARY KEY NOT NULL,
141
+ "enabled_channels" jsonb DEFAULT '[]'::jsonb NOT NULL,
142
+ "disabled_categories" jsonb DEFAULT '[]'::jsonb NOT NULL,
143
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
144
+ "updated_by" varchar(64) NOT NULL,
145
+ CONSTRAINT "notification_preferences_user_id_users_id_fk"
146
+ FOREIGN KEY ("user_id")
147
+ REFERENCES "public"."users"("id")
148
+ ON DELETE restrict ON UPDATE no action
149
+ );
150
+
151
+ CREATE TABLE "notification_delivery_outbox" (
152
+ "id" varchar(64) PRIMARY KEY NOT NULL,
153
+ "notification_id" varchar(64) NOT NULL,
154
+ "user_id" varchar(64) NOT NULL,
155
+ "channel" varchar(16) NOT NULL,
156
+ "status" varchar(16) NOT NULL,
157
+ "subject" varchar(120) NOT NULL,
158
+ "content" text NOT NULL,
159
+ "attempt_count" integer DEFAULT 0 NOT NULL,
160
+ "next_attempt_at" timestamp with time zone DEFAULT now() NOT NULL,
161
+ "lease_token" varchar(64),
162
+ "lease_expires_at" timestamp with time zone,
163
+ "delivered_at" timestamp with time zone,
164
+ "provider_message_id" varchar(180),
165
+ "last_error_code" varchar(64),
166
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
167
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
168
+ CONSTRAINT "notification_delivery_outbox_notification_id_platform_notifications_id_fk"
169
+ FOREIGN KEY ("notification_id")
170
+ REFERENCES "public"."platform_notifications"("id")
171
+ ON DELETE restrict ON UPDATE no action,
172
+ CONSTRAINT "notification_delivery_outbox_user_id_users_id_fk"
173
+ FOREIGN KEY ("user_id")
174
+ REFERENCES "public"."users"("id")
175
+ ON DELETE restrict ON UPDATE no action
176
+ );
177
+
178
+ CREATE INDEX "idx_platform_notifications_status_published"
179
+ ON "platform_notifications" USING btree ("status", "published_at");
180
+ CREATE UNIQUE INDEX "uk_platform_notifications_source_key"
181
+ ON "platform_notifications" USING btree ("source_key");
182
+ CREATE INDEX "idx_notification_reads_user"
183
+ ON "notification_reads" USING btree ("user_id", "read_at");
184
+ CREATE INDEX "idx_notification_favorites_user"
185
+ ON "notification_favorites" USING btree ("user_id", "favorited_at");
186
+ CREATE INDEX "idx_notification_revisions_time"
187
+ ON "notification_revisions" USING btree ("notification_id", "edited_at");
188
+ CREATE UNIQUE INDEX "uk_notification_delivery_target"
189
+ ON "notification_delivery_outbox" USING btree ("notification_id", "user_id", "channel");
190
+ CREATE INDEX "idx_notification_delivery_claim"
191
+ ON "notification_delivery_outbox" USING btree ("status", "next_attempt_at", "lease_expires_at");
192
+ CREATE INDEX "idx_notification_delivery_notification"
193
+ ON "notification_delivery_outbox" USING btree ("notification_id");
194
+ END IF;
195
+ END
196
+ $windy$;