@pstdio/pocketcoder-cli 0.6.0 → 0.6.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.
@@ -0,0 +1,99 @@
1
+ CREATE TABLE "workspace_checkpoints" (
2
+ "id" uuid PRIMARY KEY,
3
+ "workspace_id" uuid NOT NULL,
4
+ "principal_id" uuid NOT NULL,
5
+ "storage_id" uuid NOT NULL,
6
+ "parent_checkpoint_id" uuid,
7
+ "state" text NOT NULL,
8
+ "reason_code" text,
9
+ "provider_kind" text NOT NULL,
10
+ "provider_ref" jsonb,
11
+ "template_snapshot" jsonb NOT NULL,
12
+ "template_digest" text NOT NULL,
13
+ "source_provenance" jsonb,
14
+ "manifest" jsonb,
15
+ "manifest_digest" text,
16
+ "logical_bytes" bigint,
17
+ "stored_bytes" bigint,
18
+ "file_count" bigint,
19
+ "conversation_restore" text NOT NULL,
20
+ "label" text,
21
+ "created_at" timestamp with time zone NOT NULL,
22
+ "updated_at" timestamp with time zone NOT NULL,
23
+ "ready_at" timestamp with time zone,
24
+ "expires_at" timestamp with time zone,
25
+ "deleted_at" timestamp with time zone
26
+ );
27
+ --> statement-breakpoint
28
+ CREATE TABLE "workspace_operations" (
29
+ "id" uuid PRIMARY KEY,
30
+ "principal_id" uuid NOT NULL,
31
+ "kind" text NOT NULL,
32
+ "state" text NOT NULL,
33
+ "idempotency_key" text NOT NULL,
34
+ "request_digest" text NOT NULL,
35
+ "workspace_id" uuid,
36
+ "checkpoint_id" uuid,
37
+ "result_workspace_id" uuid,
38
+ "reason_code" text,
39
+ "attempt_count" integer DEFAULT 0 NOT NULL,
40
+ "created_at" timestamp with time zone NOT NULL,
41
+ "updated_at" timestamp with time zone NOT NULL,
42
+ "completed_at" timestamp with time zone,
43
+ CONSTRAINT "workspace_operations_principal_id_kind_idempotency_key_unique" UNIQUE("principal_id","kind","idempotency_key")
44
+ );
45
+ --> statement-breakpoint
46
+ CREATE TABLE "workspace_outputs" (
47
+ "workspace_id" uuid,
48
+ "seq" bigint,
49
+ "name" text NOT NULL,
50
+ "value" jsonb NOT NULL,
51
+ "occurred_at" timestamp with time zone NOT NULL,
52
+ CONSTRAINT "workspace_outputs_pkey" PRIMARY KEY("workspace_id","seq")
53
+ );
54
+ --> statement-breakpoint
55
+ CREATE TABLE "workspace_storage" (
56
+ "id" uuid PRIMARY KEY,
57
+ "workspace_id" uuid NOT NULL,
58
+ "principal_id" uuid NOT NULL,
59
+ "provider_kind" text NOT NULL,
60
+ "provider_ref" jsonb NOT NULL,
61
+ "state" text NOT NULL,
62
+ "mount_manifest" jsonb NOT NULL,
63
+ "logical_bytes" bigint,
64
+ "file_count" bigint,
65
+ "retained_until" timestamp with time zone,
66
+ "created_at" timestamp with time zone NOT NULL,
67
+ "updated_at" timestamp with time zone NOT NULL,
68
+ "deleted_at" timestamp with time zone,
69
+ "last_error_code" text
70
+ );
71
+ --> statement-breakpoint
72
+ ALTER TABLE "workspaces" ADD COLUMN "origin_workspace_id" uuid;--> statement-breakpoint
73
+ ALTER TABLE "workspaces" ADD COLUMN "restored_from_checkpoint_id" uuid;--> statement-breakpoint
74
+ ALTER TABLE "workspaces" ADD COLUMN "source_descriptor" jsonb;--> statement-breakpoint
75
+ ALTER TABLE "workspaces" ADD COLUMN "resolved_source" jsonb;--> statement-breakpoint
76
+ ALTER TABLE "workspaces" ADD COLUMN "persistence_capability" text DEFAULT 'filesystem_only' NOT NULL;--> statement-breakpoint
77
+ ALTER TABLE "workspaces" ADD COLUMN "latest_checkpoint_id" uuid;--> statement-breakpoint
78
+ ALTER TABLE "workspaces" ADD COLUMN "launch_mode" text DEFAULT 'create' NOT NULL;--> statement-breakpoint
79
+ ALTER TABLE "workspaces" ADD COLUMN "outputs" jsonb DEFAULT '{}' NOT NULL;--> statement-breakpoint
80
+ DROP INDEX "workspaces_principal_external_active";--> statement-breakpoint
81
+ CREATE UNIQUE INDEX "workspaces_principal_external_active" ON "workspaces" ("principal_id","external_id") WHERE "state" NOT IN ('succeeded', 'failed', 'canceled', 'expired', 'preserved');--> statement-breakpoint
82
+ DROP INDEX "workspaces_deadline";--> statement-breakpoint
83
+ CREATE INDEX "workspaces_deadline" ON "workspaces" ("deadline_at") WHERE "state" NOT IN ('succeeded', 'failed', 'canceled', 'expired', 'preserved');--> statement-breakpoint
84
+ CREATE INDEX "workspace_checkpoints_principal_state" ON "workspace_checkpoints" ("principal_id","state","created_at");--> statement-breakpoint
85
+ CREATE INDEX "workspace_checkpoints_gc" ON "workspace_checkpoints" ("state","expires_at");--> statement-breakpoint
86
+ CREATE INDEX "workspace_operations_due" ON "workspace_operations" ("state","updated_at");--> statement-breakpoint
87
+ CREATE UNIQUE INDEX "workspace_storage_one_live" ON "workspace_storage" ("workspace_id") WHERE "state" NOT IN ('deleted', 'lost', 'quarantined');--> statement-breakpoint
88
+ CREATE INDEX "workspace_storage_gc" ON "workspace_storage" ("state","retained_until");--> statement-breakpoint
89
+ CREATE INDEX "workspace_storage_principal" ON "workspace_storage" ("principal_id");--> statement-breakpoint
90
+ ALTER TABLE "workspace_checkpoints" ADD CONSTRAINT "workspace_checkpoints_workspace_id_workspaces_id_fkey" FOREIGN KEY ("workspace_id") REFERENCES "workspaces"("id");--> statement-breakpoint
91
+ ALTER TABLE "workspace_checkpoints" ADD CONSTRAINT "workspace_checkpoints_principal_id_principals_id_fkey" FOREIGN KEY ("principal_id") REFERENCES "principals"("id");--> statement-breakpoint
92
+ ALTER TABLE "workspace_checkpoints" ADD CONSTRAINT "workspace_checkpoints_storage_id_workspace_storage_id_fkey" FOREIGN KEY ("storage_id") REFERENCES "workspace_storage"("id");--> statement-breakpoint
93
+ ALTER TABLE "workspace_operations" ADD CONSTRAINT "workspace_operations_principal_id_principals_id_fkey" FOREIGN KEY ("principal_id") REFERENCES "principals"("id");--> statement-breakpoint
94
+ ALTER TABLE "workspace_operations" ADD CONSTRAINT "workspace_operations_workspace_id_workspaces_id_fkey" FOREIGN KEY ("workspace_id") REFERENCES "workspaces"("id");--> statement-breakpoint
95
+ ALTER TABLE "workspace_operations" ADD CONSTRAINT "workspace_operations_fBJ1lkBRI011_fkey" FOREIGN KEY ("checkpoint_id") REFERENCES "workspace_checkpoints"("id");--> statement-breakpoint
96
+ ALTER TABLE "workspace_operations" ADD CONSTRAINT "workspace_operations_result_workspace_id_workspaces_id_fkey" FOREIGN KEY ("result_workspace_id") REFERENCES "workspaces"("id");--> statement-breakpoint
97
+ ALTER TABLE "workspace_outputs" ADD CONSTRAINT "workspace_outputs_workspace_id_workspaces_id_fkey" FOREIGN KEY ("workspace_id") REFERENCES "workspaces"("id");--> statement-breakpoint
98
+ ALTER TABLE "workspace_storage" ADD CONSTRAINT "workspace_storage_workspace_id_workspaces_id_fkey" FOREIGN KEY ("workspace_id") REFERENCES "workspaces"("id");--> statement-breakpoint
99
+ ALTER TABLE "workspace_storage" ADD CONSTRAINT "workspace_storage_principal_id_principals_id_fkey" FOREIGN KEY ("principal_id") REFERENCES "principals"("id");