@relayfx/sdk 0.0.48 → 0.0.50

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 (34) hide show
  1. package/dist/ai.js +2054 -576
  2. package/dist/index.js +2884 -860
  3. package/dist/migrations/20260709214238_faithful_black_widow/migration.sql +53 -0
  4. package/dist/migrations/20260709214238_faithful_black_widow/snapshot.json +5426 -0
  5. package/dist/migrations/20260709220016_fearless_aaron_stack/migration.sql +2 -0
  6. package/dist/migrations/20260709220016_fearless_aaron_stack/snapshot.json +5426 -0
  7. package/dist/migrations/mysql/0002_durable_tool_placement.sql +75 -0
  8. package/dist/migrations/pg/20260709214238_faithful_black_widow/migration.sql +53 -0
  9. package/dist/migrations/pg/20260709214238_faithful_black_widow/snapshot.json +5426 -0
  10. package/dist/migrations/pg/20260709220016_fearless_aaron_stack/migration.sql +2 -0
  11. package/dist/migrations/pg/20260709220016_fearless_aaron_stack/snapshot.json +5426 -0
  12. package/dist/migrations/sqlite/0002_durable_tool_placement.sql +71 -0
  13. package/dist/types/relay/client.d.ts +27 -6
  14. package/dist/types/relay/index.d.ts +1 -0
  15. package/dist/types/relay/operation.d.ts +525 -53
  16. package/dist/types/relay/tool-worker.d.ts +19 -0
  17. package/dist/types/runtime/address/address-resolution-service.d.ts +69 -54
  18. package/dist/types/runtime/agent/relay-compaction.d.ts +1 -0
  19. package/dist/types/runtime/cluster/execution-entity.d.ts +10 -477
  20. package/dist/types/runtime/execution/event-log-service.d.ts +6 -0
  21. package/dist/types/runtime/index.d.ts +1 -0
  22. package/dist/types/runtime/runner/runner-runtime-service.d.ts +18 -15
  23. package/dist/types/runtime/tool/tool-runtime-service.d.ts +17 -1
  24. package/dist/types/runtime/tool/tool-transition-coordinator.d.ts +13 -0
  25. package/dist/types/runtime/workflow/execution-workflow.d.ts +146 -114
  26. package/dist/types/schema/agent-schema.d.ts +431 -320
  27. package/dist/types/schema/execution-schema.d.ts +69 -53
  28. package/dist/types/schema/ids-schema.d.ts +4 -0
  29. package/dist/types/schema/tool-schema.d.ts +29 -0
  30. package/dist/types/store-sql/envelope/envelope-repository.d.ts +6 -0
  31. package/dist/types/store-sql/execution/execution-event-repository.d.ts +6 -0
  32. package/dist/types/store-sql/schema/relay-schema.d.ts +386 -7
  33. package/dist/types/store-sql/tool/tool-call-repository.d.ts +160 -1
  34. package/package.json +3 -3
@@ -0,0 +1,53 @@
1
+ CREATE TABLE "relay_tool_attempts" (
2
+ "tenant_id" text DEFAULT 'system',
3
+ "id" text,
4
+ "tool_call_id" text NOT NULL,
5
+ "attempt_number" integer NOT NULL,
6
+ "state" text NOT NULL,
7
+ "worker_id" text,
8
+ "claim_expires_at" timestamp with time zone,
9
+ "error" text,
10
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
11
+ "completed_at" timestamp with time zone,
12
+ CONSTRAINT "pk_relay_tool_attempts" PRIMARY KEY("tenant_id","id")
13
+ );
14
+ --> statement-breakpoint
15
+ ALTER TABLE "relay_tool_calls" ADD COLUMN "definition_json" jsonb;--> statement-breakpoint
16
+ ALTER TABLE "relay_tool_calls" ADD COLUMN "placement_kind" text DEFAULT 'local' NOT NULL;--> statement-breakpoint
17
+ ALTER TABLE "relay_tool_calls" ADD COLUMN "placement_key" text;--> statement-breakpoint
18
+ ALTER TABLE "relay_tool_calls" ADD COLUMN "state" text DEFAULT 'requested' NOT NULL;--> statement-breakpoint
19
+ ALTER TABLE "relay_tool_calls" ADD COLUMN "wait_id" text;--> statement-breakpoint
20
+ ALTER TABLE "relay_tool_calls" ADD COLUMN "idempotency_key" text;--> statement-breakpoint
21
+ ALTER TABLE "relay_tool_calls" ADD COLUMN "available_at" timestamp with time zone DEFAULT now() NOT NULL;--> statement-breakpoint
22
+ ALTER TABLE "relay_tool_calls" ADD COLUMN "active_attempt_id" text;--> statement-breakpoint
23
+ ALTER TABLE "relay_tool_calls" ADD COLUMN "claim_owner" text;--> statement-breakpoint
24
+ ALTER TABLE "relay_tool_calls" ADD COLUMN "claimed_at" timestamp with time zone;--> statement-breakpoint
25
+ ALTER TABLE "relay_tool_calls" ADD COLUMN "claim_expires_at" timestamp with time zone;--> statement-breakpoint
26
+ ALTER TABLE "relay_tool_calls" ADD COLUMN "external_outcome_json" jsonb;--> statement-breakpoint
27
+ ALTER TABLE "relay_tool_calls" ADD COLUMN "external_outcome_at" timestamp with time zone;--> statement-breakpoint
28
+ ALTER TABLE "relay_tool_calls" ADD COLUMN "updated_at" timestamp with time zone DEFAULT now() NOT NULL;--> statement-breakpoint
29
+ UPDATE "relay_tool_calls"
30
+ SET "idempotency_key" = 'tool:' || char_length("tenant_id") || ':' || "tenant_id" || ':' ||
31
+ char_length("execution_id") || ':' || "execution_id" || ':' || char_length("id") || ':' || "id",
32
+ "available_at" = "created_at",
33
+ "updated_at" = "created_at",
34
+ "state" = CASE
35
+ WHEN EXISTS (
36
+ SELECT 1 FROM "relay_tool_results" result
37
+ WHERE result."tenant_id" = "relay_tool_calls"."tenant_id"
38
+ AND result."tool_call_id" = "relay_tool_calls"."id"
39
+ AND result."error" IS NULL
40
+ ) THEN 'completed'
41
+ WHEN EXISTS (
42
+ SELECT 1 FROM "relay_tool_results" result
43
+ WHERE result."tenant_id" = "relay_tool_calls"."tenant_id"
44
+ AND result."tool_call_id" = "relay_tool_calls"."id"
45
+ ) THEN 'failed'
46
+ ELSE 'requested'
47
+ END;--> statement-breakpoint
48
+ ALTER TABLE "relay_tool_calls" ALTER COLUMN "idempotency_key" SET NOT NULL;--> statement-breakpoint
49
+ CREATE UNIQUE INDEX "uq_relay_tool_attempts_number" ON "relay_tool_attempts" ("tenant_id","tool_call_id","attempt_number");--> statement-breakpoint
50
+ CREATE INDEX "idx_relay_tool_attempts_call" ON "relay_tool_attempts" ("tenant_id","tool_call_id","attempt_number");--> statement-breakpoint
51
+ CREATE INDEX "idx_relay_tool_calls_remote_claim" ON "relay_tool_calls" ("tenant_id","placement_kind","placement_key","state","available_at","created_at","id");--> statement-breakpoint
52
+ CREATE INDEX "idx_relay_tool_calls_stale_claim" ON "relay_tool_calls" ("tenant_id","state","claim_expires_at");--> statement-breakpoint
53
+ CREATE INDEX "idx_relay_tool_calls_client_pending" ON "relay_tool_calls" ("tenant_id","placement_kind","state","created_at","id");