@shipfox/api-integration-core 2.0.0
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/.turbo/turbo-build.log +2 -0
- package/.turbo/turbo-type$colon$emit.log +1 -0
- package/.turbo/turbo-type.log +1 -0
- package/CHANGELOG.md +264 -0
- package/LICENSE +21 -0
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +29 -0
- package/dist/config.js.map +1 -0
- package/dist/core/agent-tool-selection.d.ts +15 -0
- package/dist/core/agent-tool-selection.d.ts.map +1 -0
- package/dist/core/agent-tool-selection.js +48 -0
- package/dist/core/agent-tool-selection.js.map +1 -0
- package/dist/core/entities/connection.d.ts +2 -0
- package/dist/core/entities/connection.d.ts.map +1 -0
- package/dist/core/entities/connection.js +3 -0
- package/dist/core/entities/connection.js.map +1 -0
- package/dist/core/entities/provider.d.ts +6 -0
- package/dist/core/entities/provider.d.ts.map +1 -0
- package/dist/core/entities/provider.js +3 -0
- package/dist/core/entities/provider.js.map +1 -0
- package/dist/core/errors.d.ts +29 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +40 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/providers/agent-tools.d.ts +2 -0
- package/dist/core/providers/agent-tools.d.ts.map +1 -0
- package/dist/core/providers/agent-tools.js +3 -0
- package/dist/core/providers/agent-tools.js.map +1 -0
- package/dist/core/providers/redact-checkout-spec.d.ts +9 -0
- package/dist/core/providers/redact-checkout-spec.d.ts.map +1 -0
- package/dist/core/providers/redact-checkout-spec.js +25 -0
- package/dist/core/providers/redact-checkout-spec.js.map +1 -0
- package/dist/core/providers/registry.d.ts +9 -0
- package/dist/core/providers/registry.d.ts.map +1 -0
- package/dist/core/providers/registry.js +52 -0
- package/dist/core/providers/registry.js.map +1 -0
- package/dist/core/providers/source-control.d.ts +2 -0
- package/dist/core/providers/source-control.d.ts.map +1 -0
- package/dist/core/providers/source-control.js +3 -0
- package/dist/core/providers/source-control.js.map +1 -0
- package/dist/core/source-control-service.d.ts +46 -0
- package/dist/core/source-control-service.d.ts.map +1 -0
- package/dist/core/source-control-service.js +84 -0
- package/dist/core/source-control-service.js.map +1 -0
- package/dist/db/connections.d.ts +67 -0
- package/dist/db/connections.d.ts.map +1 -0
- package/dist/db/connections.js +130 -0
- package/dist/db/connections.js.map +1 -0
- package/dist/db/db.d.ts +865 -0
- package/dist/db/db.d.ts.map +1 -0
- package/dist/db/db.js +22 -0
- package/dist/db/db.js.map +1 -0
- package/dist/db/migrations.d.ts +2 -0
- package/dist/db/migrations.d.ts.map +1 -0
- package/dist/db/migrations.js +5 -0
- package/dist/db/migrations.js.map +1 -0
- package/dist/db/schema/common.d.ts +2 -0
- package/dist/db/schema/common.d.ts.map +1 -0
- package/dist/db/schema/common.js +4 -0
- package/dist/db/schema/common.js.map +1 -0
- package/dist/db/schema/connections.d.ts +165 -0
- package/dist/db/schema/connections.d.ts.map +1 -0
- package/dist/db/schema/connections.js +37 -0
- package/dist/db/schema/connections.js.map +1 -0
- package/dist/db/schema/outbox.d.ts +195 -0
- package/dist/db/schema/outbox.d.ts.map +1 -0
- package/dist/db/schema/outbox.js +5 -0
- package/dist/db/schema/outbox.js.map +1 -0
- package/dist/db/schema/webhook-deliveries.d.ts +76 -0
- package/dist/db/schema/webhook-deliveries.d.ts.map +1 -0
- package/dist/db/schema/webhook-deliveries.js +22 -0
- package/dist/db/schema/webhook-deliveries.js.map +1 -0
- package/dist/db/webhook-deliveries.d.ts +55 -0
- package/dist/db/webhook-deliveries.d.ts.map +1 -0
- package/dist/db/webhook-deliveries.js +132 -0
- package/dist/db/webhook-deliveries.js.map +1 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +105 -0
- package/dist/index.js.map +1 -0
- package/dist/metrics/index.d.ts +2 -0
- package/dist/metrics/index.d.ts.map +1 -0
- package/dist/metrics/index.js +3 -0
- package/dist/metrics/index.js.map +1 -0
- package/dist/metrics/instance.d.ts +8 -0
- package/dist/metrics/instance.d.ts.map +1 -0
- package/dist/metrics/instance.js +17 -0
- package/dist/metrics/instance.js.map +1 -0
- package/dist/presentation/dto/integrations.d.ts +36 -0
- package/dist/presentation/dto/integrations.d.ts.map +1 -0
- package/dist/presentation/dto/integrations.js +26 -0
- package/dist/presentation/dto/integrations.js.map +1 -0
- package/dist/presentation/routes/agent-tools-gateway/audit.d.ts +24 -0
- package/dist/presentation/routes/agent-tools-gateway/audit.d.ts.map +1 -0
- package/dist/presentation/routes/agent-tools-gateway/audit.js +52 -0
- package/dist/presentation/routes/agent-tools-gateway/audit.js.map +1 -0
- package/dist/presentation/routes/agent-tools-gateway/dispatch.d.ts +7 -0
- package/dist/presentation/routes/agent-tools-gateway/dispatch.d.ts.map +1 -0
- package/dist/presentation/routes/agent-tools-gateway/dispatch.js +108 -0
- package/dist/presentation/routes/agent-tools-gateway/dispatch.js.map +1 -0
- package/dist/presentation/routes/agent-tools-gateway/index.d.ts +12 -0
- package/dist/presentation/routes/agent-tools-gateway/index.d.ts.map +1 -0
- package/dist/presentation/routes/agent-tools-gateway/index.js +46 -0
- package/dist/presentation/routes/agent-tools-gateway/index.js.map +1 -0
- package/dist/presentation/routes/agent-tools-gateway/mcp-server.d.ts +17 -0
- package/dist/presentation/routes/agent-tools-gateway/mcp-server.d.ts.map +1 -0
- package/dist/presentation/routes/agent-tools-gateway/mcp-server.js +126 -0
- package/dist/presentation/routes/agent-tools-gateway/mcp-server.js.map +1 -0
- package/dist/presentation/routes/agent-tools-gateway/resolve-authorized-tools.d.ts +37 -0
- package/dist/presentation/routes/agent-tools-gateway/resolve-authorized-tools.d.ts.map +1 -0
- package/dist/presentation/routes/agent-tools-gateway/resolve-authorized-tools.js +145 -0
- package/dist/presentation/routes/agent-tools-gateway/resolve-authorized-tools.js.map +1 -0
- package/dist/presentation/routes/errors.d.ts +2 -0
- package/dist/presentation/routes/errors.d.ts.map +1 -0
- package/dist/presentation/routes/errors.js +53 -0
- package/dist/presentation/routes/errors.js.map +1 -0
- package/dist/presentation/routes/index.d.ts +14 -0
- package/dist/presentation/routes/index.d.ts.map +1 -0
- package/dist/presentation/routes/index.js +26 -0
- package/dist/presentation/routes/index.js.map +1 -0
- package/dist/presentation/routes/list-connections.d.ts +3 -0
- package/dist/presentation/routes/list-connections.d.ts.map +1 -0
- package/dist/presentation/routes/list-connections.js +58 -0
- package/dist/presentation/routes/list-connections.js.map +1 -0
- package/dist/presentation/routes/list-providers.d.ts +3 -0
- package/dist/presentation/routes/list-providers.d.ts.map +1 -0
- package/dist/presentation/routes/list-providers.js +27 -0
- package/dist/presentation/routes/list-providers.js.map +1 -0
- package/dist/presentation/routes/list-repositories.d.ts +3 -0
- package/dist/presentation/routes/list-repositories.d.ts.map +1 -0
- package/dist/presentation/routes/list-repositories.js +41 -0
- package/dist/presentation/routes/list-repositories.js.map +1 -0
- package/dist/presentation/routes/manage-connections.d.ts +4 -0
- package/dist/presentation/routes/manage-connections.d.ts.map +1 -0
- package/dist/presentation/routes/manage-connections.js +81 -0
- package/dist/presentation/routes/manage-connections.js.map +1 -0
- package/dist/providers/connection-slug.d.ts +2 -0
- package/dist/providers/connection-slug.d.ts.map +1 -0
- package/dist/providers/connection-slug.js +19 -0
- package/dist/providers/connection-slug.js.map +1 -0
- package/dist/providers/cron.d.ts +3 -0
- package/dist/providers/cron.d.ts.map +1 -0
- package/dist/providers/cron.js +13 -0
- package/dist/providers/cron.js.map +1 -0
- package/dist/providers/gitea.d.ts +3 -0
- package/dist/providers/gitea.d.ts.map +1 -0
- package/dist/providers/gitea.js +75 -0
- package/dist/providers/gitea.js.map +1 -0
- package/dist/providers/github.d.ts +3 -0
- package/dist/providers/github.d.ts.map +1 -0
- package/dist/providers/github.js +109 -0
- package/dist/providers/github.js.map +1 -0
- package/dist/providers/linear.d.ts +3 -0
- package/dist/providers/linear.d.ts.map +1 -0
- package/dist/providers/linear.js +134 -0
- package/dist/providers/linear.js.map +1 -0
- package/dist/providers/modules.d.ts +3 -0
- package/dist/providers/modules.d.ts.map +1 -0
- package/dist/providers/modules.js +26 -0
- package/dist/providers/modules.js.map +1 -0
- package/dist/providers/sentry.d.ts +3 -0
- package/dist/providers/sentry.d.ts.map +1 -0
- package/dist/providers/sentry.js +83 -0
- package/dist/providers/sentry.js.map +1 -0
- package/dist/providers/types.d.ts +58 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +3 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/providers/webhook.d.ts +3 -0
- package/dist/providers/webhook.d.ts.map +1 -0
- package/dist/providers/webhook.js +24 -0
- package/dist/providers/webhook.js.map +1 -0
- package/dist/temporal/activities/index.d.ts +5 -0
- package/dist/temporal/activities/index.d.ts.map +1 -0
- package/dist/temporal/activities/index.js +8 -0
- package/dist/temporal/activities/index.js.map +1 -0
- package/dist/temporal/activities/prune-webhook-deliveries.d.ts +4 -0
- package/dist/temporal/activities/prune-webhook-deliveries.d.ts.map +1 -0
- package/dist/temporal/activities/prune-webhook-deliveries.js +11 -0
- package/dist/temporal/activities/prune-webhook-deliveries.js.map +1 -0
- package/dist/temporal/constants.d.ts +3 -0
- package/dist/temporal/constants.d.ts.map +1 -0
- package/dist/temporal/constants.js +4 -0
- package/dist/temporal/constants.js.map +1 -0
- package/dist/temporal/workflows/index.d.ts +2 -0
- package/dist/temporal/workflows/index.d.ts.map +1 -0
- package/dist/temporal/workflows/index.js +3 -0
- package/dist/temporal/workflows/index.js.map +1 -0
- package/dist/temporal/workflows/prune-webhook-deliveries-cron.d.ts +2 -0
- package/dist/temporal/workflows/prune-webhook-deliveries-cron.d.ts.map +1 -0
- package/dist/temporal/workflows/prune-webhook-deliveries-cron.js +14 -0
- package/dist/temporal/workflows/prune-webhook-deliveries-cron.js.map +1 -0
- package/dist/tsconfig.test.tsbuildinfo +1 -0
- package/drizzle/0000_initial.sql +41 -0
- package/drizzle/meta/0001_snapshot.json +341 -0
- package/drizzle/meta/_journal.json +13 -0
- package/drizzle.config.ts +7 -0
- package/package.json +85 -0
- package/src/config.test.ts +32 -0
- package/src/config.ts +28 -0
- package/src/core/agent-tool-selection.test.ts +137 -0
- package/src/core/agent-tool-selection.ts +80 -0
- package/src/core/entities/connection.ts +4 -0
- package/src/core/entities/provider.ts +21 -0
- package/src/core/errors.ts +55 -0
- package/src/core/providers/agent-tools.ts +10 -0
- package/src/core/providers/redact-checkout-spec.test.ts +78 -0
- package/src/core/providers/redact-checkout-spec.ts +20 -0
- package/src/core/providers/registry.test.ts +138 -0
- package/src/core/providers/registry.ts +90 -0
- package/src/core/providers/source-control.ts +17 -0
- package/src/core/source-control-service.test.ts +230 -0
- package/src/core/source-control-service.ts +161 -0
- package/src/db/connections.test.ts +296 -0
- package/src/db/connections.ts +262 -0
- package/src/db/db.ts +22 -0
- package/src/db/migrations.ts +4 -0
- package/src/db/schema/common.ts +3 -0
- package/src/db/schema/connections.ts +49 -0
- package/src/db/schema/outbox.ts +4 -0
- package/src/db/schema/webhook-deliveries.ts +19 -0
- package/src/db/webhook-deliveries.test.ts +267 -0
- package/src/db/webhook-deliveries.ts +207 -0
- package/src/index.ts +212 -0
- package/src/metrics/index.ts +1 -0
- package/src/metrics/instance.ts +35 -0
- package/src/presentation/dto/integrations.ts +39 -0
- package/src/presentation/routes/agent-tools-gateway/agent-tools-gateway.route.test.ts +371 -0
- package/src/presentation/routes/agent-tools-gateway/audit.test.ts +86 -0
- package/src/presentation/routes/agent-tools-gateway/audit.ts +90 -0
- package/src/presentation/routes/agent-tools-gateway/dispatch.ts +139 -0
- package/src/presentation/routes/agent-tools-gateway/index.ts +62 -0
- package/src/presentation/routes/agent-tools-gateway/mcp-server.test.ts +308 -0
- package/src/presentation/routes/agent-tools-gateway/mcp-server.ts +155 -0
- package/src/presentation/routes/agent-tools-gateway/resolve-authorized-tools.test.ts +181 -0
- package/src/presentation/routes/agent-tools-gateway/resolve-authorized-tools.ts +245 -0
- package/src/presentation/routes/errors.ts +63 -0
- package/src/presentation/routes/index.ts +53 -0
- package/src/presentation/routes/list-connections.test.ts +227 -0
- package/src/presentation/routes/list-connections.ts +56 -0
- package/src/presentation/routes/list-providers.test.ts +113 -0
- package/src/presentation/routes/list-providers.ts +28 -0
- package/src/presentation/routes/list-repositories.test.ts +150 -0
- package/src/presentation/routes/list-repositories.ts +47 -0
- package/src/presentation/routes/manage-connections.test.ts +125 -0
- package/src/presentation/routes/manage-connections.ts +77 -0
- package/src/providers/connection-slug.ts +19 -0
- package/src/providers/cron.ts +13 -0
- package/src/providers/gitea.ts +103 -0
- package/src/providers/github.ts +150 -0
- package/src/providers/linear.ts +179 -0
- package/src/providers/modules.test.ts +40 -0
- package/src/providers/modules.ts +32 -0
- package/src/providers/sentry.ts +113 -0
- package/src/providers/types.ts +52 -0
- package/src/providers/webhook.ts +30 -0
- package/src/temporal/activities/index.ts +7 -0
- package/src/temporal/activities/prune-webhook-deliveries.test.ts +39 -0
- package/src/temporal/activities/prune-webhook-deliveries.ts +9 -0
- package/src/temporal/constants.ts +3 -0
- package/src/temporal/workflows/index.ts +1 -0
- package/src/temporal/workflows/prune-webhook-deliveries-cron.ts +15 -0
- package/test/agent-tools-gateway-helpers.ts +210 -0
- package/test/env.ts +23 -0
- package/test/factories/connection.ts +21 -0
- package/test/globalSetup.ts +22 -0
- package/test/index.ts +1 -0
- package/test/route-utils.ts +104 -0
- package/test/setup.ts +19 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- package/tsconfig.test.json +8 -0
- package/vitest.config.ts +13 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
CREATE TABLE "integrations_connections" (
|
|
2
|
+
"id" uuid PRIMARY KEY DEFAULT uuidv7() NOT NULL,
|
|
3
|
+
"workspace_id" uuid NOT NULL,
|
|
4
|
+
"provider" text NOT NULL,
|
|
5
|
+
"external_account_id" text NOT NULL,
|
|
6
|
+
"slug" text NOT NULL,
|
|
7
|
+
"display_name" text NOT NULL,
|
|
8
|
+
"lifecycle_status" text DEFAULT 'active' NOT NULL,
|
|
9
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
10
|
+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL
|
|
11
|
+
);
|
|
12
|
+
--> statement-breakpoint
|
|
13
|
+
CREATE TABLE "integrations_outbox" (
|
|
14
|
+
"id" uuid PRIMARY KEY DEFAULT uuidv7() NOT NULL,
|
|
15
|
+
"event_type" text NOT NULL,
|
|
16
|
+
"ordering_key" text,
|
|
17
|
+
"payload" jsonb NOT NULL,
|
|
18
|
+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
19
|
+
"dispatched_at" timestamp with time zone,
|
|
20
|
+
"dispatch_attempts" integer DEFAULT 0 NOT NULL,
|
|
21
|
+
"next_dispatch_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
22
|
+
"last_dispatch_error" jsonb,
|
|
23
|
+
"last_dispatch_failed_at" timestamp with time zone,
|
|
24
|
+
"dead_lettered_at" timestamp with time zone
|
|
25
|
+
);
|
|
26
|
+
--> statement-breakpoint
|
|
27
|
+
CREATE TABLE "integrations_webhook_deliveries" (
|
|
28
|
+
"provider" text NOT NULL,
|
|
29
|
+
"dedup_scope" text NOT NULL,
|
|
30
|
+
"delivery_id" text NOT NULL,
|
|
31
|
+
"received_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
32
|
+
CONSTRAINT "integrations_webhook_deliveries_dedup_pk" PRIMARY KEY("provider","dedup_scope","delivery_id")
|
|
33
|
+
);
|
|
34
|
+
--> statement-breakpoint
|
|
35
|
+
CREATE UNIQUE INDEX "integrations_connections_workspace_external_unique" ON "integrations_connections" USING btree ("workspace_id","provider","external_account_id");--> statement-breakpoint
|
|
36
|
+
CREATE UNIQUE INDEX "integrations_connections_workspace_slug_unique" ON "integrations_connections" USING btree ("workspace_id","slug");--> statement-breakpoint
|
|
37
|
+
CREATE INDEX "integrations_connections_workspace_id_idx" ON "integrations_connections" USING btree ("workspace_id");--> statement-breakpoint
|
|
38
|
+
CREATE INDEX "integrations_outbox_pending_idx" ON "integrations_outbox" USING btree ("next_dispatch_at","created_at") WHERE "dispatched_at" IS NULL AND "dead_lettered_at" IS NULL;
|
|
39
|
+
--> statement-breakpoint
|
|
40
|
+
CREATE INDEX "integrations_outbox_dispatched_retention_idx" ON "integrations_outbox" USING btree ("dispatched_at","id") WHERE "dispatched_at" IS NOT NULL;--> statement-breakpoint
|
|
41
|
+
CREATE INDEX "integrations_webhook_deliveries_received_at_idx" ON "integrations_webhook_deliveries" USING btree ("received_at");
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "a808bfbe-960e-418d-a72a-d88ddca95096",
|
|
3
|
+
"prevId": "e3544ba8-0307-4ffd-a646-3851b89bcbfb",
|
|
4
|
+
"version": "7",
|
|
5
|
+
"dialect": "postgresql",
|
|
6
|
+
"tables": {
|
|
7
|
+
"public.integrations_connections": {
|
|
8
|
+
"name": "integrations_connections",
|
|
9
|
+
"schema": "",
|
|
10
|
+
"columns": {
|
|
11
|
+
"id": {
|
|
12
|
+
"name": "id",
|
|
13
|
+
"type": "uuid",
|
|
14
|
+
"primaryKey": true,
|
|
15
|
+
"notNull": true,
|
|
16
|
+
"default": "uuidv7()"
|
|
17
|
+
},
|
|
18
|
+
"workspace_id": {
|
|
19
|
+
"name": "workspace_id",
|
|
20
|
+
"type": "uuid",
|
|
21
|
+
"primaryKey": false,
|
|
22
|
+
"notNull": true
|
|
23
|
+
},
|
|
24
|
+
"provider": {
|
|
25
|
+
"name": "provider",
|
|
26
|
+
"type": "text",
|
|
27
|
+
"primaryKey": false,
|
|
28
|
+
"notNull": true
|
|
29
|
+
},
|
|
30
|
+
"external_account_id": {
|
|
31
|
+
"name": "external_account_id",
|
|
32
|
+
"type": "text",
|
|
33
|
+
"primaryKey": false,
|
|
34
|
+
"notNull": true
|
|
35
|
+
},
|
|
36
|
+
"slug": {
|
|
37
|
+
"name": "slug",
|
|
38
|
+
"type": "text",
|
|
39
|
+
"primaryKey": false,
|
|
40
|
+
"notNull": true
|
|
41
|
+
},
|
|
42
|
+
"display_name": {
|
|
43
|
+
"name": "display_name",
|
|
44
|
+
"type": "text",
|
|
45
|
+
"primaryKey": false,
|
|
46
|
+
"notNull": true
|
|
47
|
+
},
|
|
48
|
+
"lifecycle_status": {
|
|
49
|
+
"name": "lifecycle_status",
|
|
50
|
+
"type": "text",
|
|
51
|
+
"primaryKey": false,
|
|
52
|
+
"notNull": true,
|
|
53
|
+
"default": "'active'"
|
|
54
|
+
},
|
|
55
|
+
"created_at": {
|
|
56
|
+
"name": "created_at",
|
|
57
|
+
"type": "timestamp with time zone",
|
|
58
|
+
"primaryKey": false,
|
|
59
|
+
"notNull": true,
|
|
60
|
+
"default": "now()"
|
|
61
|
+
},
|
|
62
|
+
"updated_at": {
|
|
63
|
+
"name": "updated_at",
|
|
64
|
+
"type": "timestamp with time zone",
|
|
65
|
+
"primaryKey": false,
|
|
66
|
+
"notNull": true,
|
|
67
|
+
"default": "now()"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"indexes": {
|
|
71
|
+
"integrations_connections_workspace_external_unique": {
|
|
72
|
+
"name": "integrations_connections_workspace_external_unique",
|
|
73
|
+
"columns": [
|
|
74
|
+
{
|
|
75
|
+
"expression": "workspace_id",
|
|
76
|
+
"isExpression": false,
|
|
77
|
+
"asc": true,
|
|
78
|
+
"nulls": "last"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"expression": "provider",
|
|
82
|
+
"isExpression": false,
|
|
83
|
+
"asc": true,
|
|
84
|
+
"nulls": "last"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"expression": "external_account_id",
|
|
88
|
+
"isExpression": false,
|
|
89
|
+
"asc": true,
|
|
90
|
+
"nulls": "last"
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
"isUnique": true,
|
|
94
|
+
"concurrently": false,
|
|
95
|
+
"method": "btree",
|
|
96
|
+
"with": {}
|
|
97
|
+
},
|
|
98
|
+
"integrations_connections_workspace_slug_unique": {
|
|
99
|
+
"name": "integrations_connections_workspace_slug_unique",
|
|
100
|
+
"columns": [
|
|
101
|
+
{
|
|
102
|
+
"expression": "workspace_id",
|
|
103
|
+
"isExpression": false,
|
|
104
|
+
"asc": true,
|
|
105
|
+
"nulls": "last"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"expression": "slug",
|
|
109
|
+
"isExpression": false,
|
|
110
|
+
"asc": true,
|
|
111
|
+
"nulls": "last"
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"isUnique": true,
|
|
115
|
+
"concurrently": false,
|
|
116
|
+
"method": "btree",
|
|
117
|
+
"with": {}
|
|
118
|
+
},
|
|
119
|
+
"integrations_connections_workspace_id_idx": {
|
|
120
|
+
"name": "integrations_connections_workspace_id_idx",
|
|
121
|
+
"columns": [
|
|
122
|
+
{
|
|
123
|
+
"expression": "workspace_id",
|
|
124
|
+
"isExpression": false,
|
|
125
|
+
"asc": true,
|
|
126
|
+
"nulls": "last"
|
|
127
|
+
}
|
|
128
|
+
],
|
|
129
|
+
"isUnique": false,
|
|
130
|
+
"concurrently": false,
|
|
131
|
+
"method": "btree",
|
|
132
|
+
"with": {}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"foreignKeys": {},
|
|
136
|
+
"compositePrimaryKeys": {},
|
|
137
|
+
"uniqueConstraints": {},
|
|
138
|
+
"policies": {},
|
|
139
|
+
"checkConstraints": {},
|
|
140
|
+
"isRLSEnabled": false
|
|
141
|
+
},
|
|
142
|
+
"public.integrations_outbox": {
|
|
143
|
+
"name": "integrations_outbox",
|
|
144
|
+
"schema": "",
|
|
145
|
+
"columns": {
|
|
146
|
+
"id": {
|
|
147
|
+
"name": "id",
|
|
148
|
+
"type": "uuid",
|
|
149
|
+
"primaryKey": true,
|
|
150
|
+
"notNull": true,
|
|
151
|
+
"default": "uuidv7()"
|
|
152
|
+
},
|
|
153
|
+
"event_type": {
|
|
154
|
+
"name": "event_type",
|
|
155
|
+
"type": "text",
|
|
156
|
+
"primaryKey": false,
|
|
157
|
+
"notNull": true
|
|
158
|
+
},
|
|
159
|
+
"ordering_key": {
|
|
160
|
+
"name": "ordering_key",
|
|
161
|
+
"type": "text",
|
|
162
|
+
"primaryKey": false,
|
|
163
|
+
"notNull": false
|
|
164
|
+
},
|
|
165
|
+
"payload": {
|
|
166
|
+
"name": "payload",
|
|
167
|
+
"type": "jsonb",
|
|
168
|
+
"primaryKey": false,
|
|
169
|
+
"notNull": true
|
|
170
|
+
},
|
|
171
|
+
"created_at": {
|
|
172
|
+
"name": "created_at",
|
|
173
|
+
"type": "timestamp with time zone",
|
|
174
|
+
"primaryKey": false,
|
|
175
|
+
"notNull": true,
|
|
176
|
+
"default": "now()"
|
|
177
|
+
},
|
|
178
|
+
"dispatched_at": {
|
|
179
|
+
"name": "dispatched_at",
|
|
180
|
+
"type": "timestamp with time zone",
|
|
181
|
+
"primaryKey": false,
|
|
182
|
+
"notNull": false
|
|
183
|
+
},
|
|
184
|
+
"dispatch_attempts": {
|
|
185
|
+
"name": "dispatch_attempts",
|
|
186
|
+
"type": "integer",
|
|
187
|
+
"primaryKey": false,
|
|
188
|
+
"notNull": true,
|
|
189
|
+
"default": 0
|
|
190
|
+
},
|
|
191
|
+
"next_dispatch_at": {
|
|
192
|
+
"name": "next_dispatch_at",
|
|
193
|
+
"type": "timestamp with time zone",
|
|
194
|
+
"primaryKey": false,
|
|
195
|
+
"notNull": true,
|
|
196
|
+
"default": "now()"
|
|
197
|
+
},
|
|
198
|
+
"last_dispatch_error": {
|
|
199
|
+
"name": "last_dispatch_error",
|
|
200
|
+
"type": "jsonb",
|
|
201
|
+
"primaryKey": false,
|
|
202
|
+
"notNull": false
|
|
203
|
+
},
|
|
204
|
+
"last_dispatch_failed_at": {
|
|
205
|
+
"name": "last_dispatch_failed_at",
|
|
206
|
+
"type": "timestamp with time zone",
|
|
207
|
+
"primaryKey": false,
|
|
208
|
+
"notNull": false
|
|
209
|
+
},
|
|
210
|
+
"dead_lettered_at": {
|
|
211
|
+
"name": "dead_lettered_at",
|
|
212
|
+
"type": "timestamp with time zone",
|
|
213
|
+
"primaryKey": false,
|
|
214
|
+
"notNull": false
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
"indexes": {
|
|
218
|
+
"integrations_outbox_pending_idx": {
|
|
219
|
+
"name": "integrations_outbox_pending_idx",
|
|
220
|
+
"columns": [
|
|
221
|
+
{
|
|
222
|
+
"expression": "next_dispatch_at",
|
|
223
|
+
"isExpression": false,
|
|
224
|
+
"asc": true,
|
|
225
|
+
"nulls": "last"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"expression": "created_at",
|
|
229
|
+
"isExpression": false,
|
|
230
|
+
"asc": true,
|
|
231
|
+
"nulls": "last"
|
|
232
|
+
}
|
|
233
|
+
],
|
|
234
|
+
"isUnique": false,
|
|
235
|
+
"where": "\"dispatched_at\" IS NULL AND \"dead_lettered_at\" IS NULL",
|
|
236
|
+
"concurrently": false,
|
|
237
|
+
"method": "btree",
|
|
238
|
+
"with": {}
|
|
239
|
+
},
|
|
240
|
+
"integrations_outbox_dispatched_retention_idx": {
|
|
241
|
+
"name": "integrations_outbox_dispatched_retention_idx",
|
|
242
|
+
"columns": [
|
|
243
|
+
{
|
|
244
|
+
"expression": "dispatched_at",
|
|
245
|
+
"isExpression": false,
|
|
246
|
+
"asc": true,
|
|
247
|
+
"nulls": "last"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"expression": "id",
|
|
251
|
+
"isExpression": false,
|
|
252
|
+
"asc": true,
|
|
253
|
+
"nulls": "last"
|
|
254
|
+
}
|
|
255
|
+
],
|
|
256
|
+
"isUnique": false,
|
|
257
|
+
"where": "\"dispatched_at\" IS NOT NULL",
|
|
258
|
+
"concurrently": false,
|
|
259
|
+
"method": "btree",
|
|
260
|
+
"with": {}
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
"foreignKeys": {},
|
|
264
|
+
"compositePrimaryKeys": {},
|
|
265
|
+
"uniqueConstraints": {},
|
|
266
|
+
"policies": {},
|
|
267
|
+
"checkConstraints": {},
|
|
268
|
+
"isRLSEnabled": false
|
|
269
|
+
},
|
|
270
|
+
"public.integrations_webhook_deliveries": {
|
|
271
|
+
"name": "integrations_webhook_deliveries",
|
|
272
|
+
"schema": "",
|
|
273
|
+
"columns": {
|
|
274
|
+
"provider": {
|
|
275
|
+
"name": "provider",
|
|
276
|
+
"type": "text",
|
|
277
|
+
"primaryKey": false,
|
|
278
|
+
"notNull": true
|
|
279
|
+
},
|
|
280
|
+
"dedup_scope": {
|
|
281
|
+
"name": "dedup_scope",
|
|
282
|
+
"type": "text",
|
|
283
|
+
"primaryKey": false,
|
|
284
|
+
"notNull": true
|
|
285
|
+
},
|
|
286
|
+
"delivery_id": {
|
|
287
|
+
"name": "delivery_id",
|
|
288
|
+
"type": "text",
|
|
289
|
+
"primaryKey": false,
|
|
290
|
+
"notNull": true
|
|
291
|
+
},
|
|
292
|
+
"received_at": {
|
|
293
|
+
"name": "received_at",
|
|
294
|
+
"type": "timestamp with time zone",
|
|
295
|
+
"primaryKey": false,
|
|
296
|
+
"notNull": true,
|
|
297
|
+
"default": "now()"
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
"indexes": {
|
|
301
|
+
"integrations_webhook_deliveries_received_at_idx": {
|
|
302
|
+
"name": "integrations_webhook_deliveries_received_at_idx",
|
|
303
|
+
"columns": [
|
|
304
|
+
{
|
|
305
|
+
"expression": "received_at",
|
|
306
|
+
"isExpression": false,
|
|
307
|
+
"asc": true,
|
|
308
|
+
"nulls": "last"
|
|
309
|
+
}
|
|
310
|
+
],
|
|
311
|
+
"isUnique": false,
|
|
312
|
+
"concurrently": false,
|
|
313
|
+
"method": "btree",
|
|
314
|
+
"with": {}
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
"foreignKeys": {},
|
|
318
|
+
"compositePrimaryKeys": {
|
|
319
|
+
"integrations_webhook_deliveries_dedup_pk": {
|
|
320
|
+
"name": "integrations_webhook_deliveries_dedup_pk",
|
|
321
|
+
"columns": ["provider", "dedup_scope", "delivery_id"]
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
"uniqueConstraints": {},
|
|
325
|
+
"policies": {},
|
|
326
|
+
"checkConstraints": {},
|
|
327
|
+
"isRLSEnabled": false
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
"enums": {},
|
|
331
|
+
"schemas": {},
|
|
332
|
+
"sequences": {},
|
|
333
|
+
"roles": {},
|
|
334
|
+
"policies": {},
|
|
335
|
+
"views": {},
|
|
336
|
+
"_meta": {
|
|
337
|
+
"columns": {},
|
|
338
|
+
"schemas": {},
|
|
339
|
+
"tables": {}
|
|
340
|
+
}
|
|
341
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@shipfox/api-integration-core",
|
|
3
|
+
"license": "MIT",
|
|
4
|
+
"version": "2.0.0",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/ShipfoxHQ/shipfox.git",
|
|
8
|
+
"directory": "libs/api/integration/core"
|
|
9
|
+
},
|
|
10
|
+
"private": false,
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "dist/index.js",
|
|
13
|
+
"types": "dist/index.d.ts",
|
|
14
|
+
"imports": {
|
|
15
|
+
"#test/*": "./test/*",
|
|
16
|
+
"#*": {
|
|
17
|
+
"workspace-source": "./src/*",
|
|
18
|
+
"development": "./src/*",
|
|
19
|
+
"default": "./dist/*"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"development": {
|
|
25
|
+
"types": "./src/index.ts",
|
|
26
|
+
"default": "./src/index.ts"
|
|
27
|
+
},
|
|
28
|
+
"default": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"default": "./dist/index.js"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@modelcontextprotocol/sdk": "1.29.0",
|
|
36
|
+
"@temporalio/workflow": "^1.16.1",
|
|
37
|
+
"ajv": "^8.20.0",
|
|
38
|
+
"drizzle-orm": "^0.45.2",
|
|
39
|
+
"zod": "^4.4.3",
|
|
40
|
+
"@shipfox/api-agent-dto": "2.0.0",
|
|
41
|
+
"@shipfox/api-integration-core-dto": "2.0.0",
|
|
42
|
+
"@shipfox/api-auth-context": "2.0.0",
|
|
43
|
+
"@shipfox/api-integration-sentry": "2.0.0",
|
|
44
|
+
"@shipfox/api-integration-gitea": "2.0.0",
|
|
45
|
+
"@shipfox/config": "1.2.1",
|
|
46
|
+
"@shipfox/node-drizzle": "0.2.1",
|
|
47
|
+
"@shipfox/node-module": "0.2.0",
|
|
48
|
+
"@shipfox/node-outbox": "0.2.1",
|
|
49
|
+
"@shipfox/node-temporal": "0.2.0",
|
|
50
|
+
"@shipfox/node-postgres": "0.4.1",
|
|
51
|
+
"@shipfox/node-fastify": "0.2.1",
|
|
52
|
+
"@shipfox/node-opentelemetry": "0.5.0",
|
|
53
|
+
"@shipfox/regex": "0.2.1",
|
|
54
|
+
"@shipfox/api-integration-github": "2.0.0",
|
|
55
|
+
"@shipfox/api-integration-linear": "2.0.0",
|
|
56
|
+
"@shipfox/api-integration-webhook": "2.0.0",
|
|
57
|
+
"@shipfox/redact": "0.2.1"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@temporalio/activity": "^1.16.1",
|
|
61
|
+
"@temporalio/client": "^1.16.1",
|
|
62
|
+
"@temporalio/common": "^1.16.1",
|
|
63
|
+
"@temporalio/testing": "^1.16.1",
|
|
64
|
+
"@temporalio/worker": "^1.16.1",
|
|
65
|
+
"@types/pg": "^8.15.5",
|
|
66
|
+
"drizzle-kit": "^0.31.10",
|
|
67
|
+
"fastify": "^5.3.3",
|
|
68
|
+
"fastify-type-provider-zod": "^6.0.0",
|
|
69
|
+
"fishery": "^2.2.2",
|
|
70
|
+
"@shipfox/biome": "1.8.1",
|
|
71
|
+
"@shipfox/ts-config": "1.3.8",
|
|
72
|
+
"@shipfox/typescript": "1.1.6",
|
|
73
|
+
"@shipfox/swc": "1.2.5",
|
|
74
|
+
"@shipfox/vitest": "1.2.2"
|
|
75
|
+
},
|
|
76
|
+
"scripts": {
|
|
77
|
+
"build": "shipfox-swc",
|
|
78
|
+
"check": "shipfox-biome-check",
|
|
79
|
+
"check:fix": "shipfox-biome-check --write",
|
|
80
|
+
"test": "shipfox-vitest-run",
|
|
81
|
+
"test:watch": "shipfox-vitest-watch",
|
|
82
|
+
"type": "shipfox-tsc-check",
|
|
83
|
+
"type:emit": "shipfox-tsc-emit"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
describe('integration provider config', () => {
|
|
2
|
+
afterEach(() => {
|
|
3
|
+
vi.unstubAllEnvs();
|
|
4
|
+
vi.resetModules();
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
it('enables built-in providers by default', async () => {
|
|
8
|
+
vi.resetModules();
|
|
9
|
+
|
|
10
|
+
const {config} = await import('#config.js');
|
|
11
|
+
|
|
12
|
+
expect(config.INTEGRATIONS_ENABLE_CRON_PROVIDER).toBe(true);
|
|
13
|
+
expect(config.INTEGRATIONS_ENABLE_WEBHOOK_PROVIDER).toBe(true);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('disables the Linear provider by default', async () => {
|
|
17
|
+
vi.resetModules();
|
|
18
|
+
|
|
19
|
+
const {config} = await import('#config.js');
|
|
20
|
+
|
|
21
|
+
expect(config.INTEGRATIONS_ENABLE_LINEAR_PROVIDER).toBe(false);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('allows disabling the built-in cron provider', async () => {
|
|
25
|
+
vi.stubEnv('INTEGRATIONS_ENABLE_CRON_PROVIDER', 'false');
|
|
26
|
+
vi.resetModules();
|
|
27
|
+
|
|
28
|
+
const {config} = await import('#config.js');
|
|
29
|
+
|
|
30
|
+
expect(config.INTEGRATIONS_ENABLE_CRON_PROVIDER).toBe(false);
|
|
31
|
+
});
|
|
32
|
+
});
|
package/src/config.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {bool, createConfig} from '@shipfox/config';
|
|
2
|
+
|
|
3
|
+
export const config = createConfig({
|
|
4
|
+
INTEGRATIONS_ENABLE_CRON_PROVIDER: bool({
|
|
5
|
+
desc: 'Enables the cron integration provider so workflow schedules can use the built-in cron source. It is enabled by default because it does not require provider setup.',
|
|
6
|
+
default: true,
|
|
7
|
+
}),
|
|
8
|
+
INTEGRATIONS_ENABLE_GITEA_PROVIDER: bool({
|
|
9
|
+
desc: 'Enables the Gitea integration provider so users can connect a Gitea instance.',
|
|
10
|
+
default: false,
|
|
11
|
+
}),
|
|
12
|
+
INTEGRATIONS_ENABLE_GITHUB_PROVIDER: bool({
|
|
13
|
+
desc: 'Enables the GitHub integration provider so users can connect GitHub.',
|
|
14
|
+
default: false,
|
|
15
|
+
}),
|
|
16
|
+
INTEGRATIONS_ENABLE_LINEAR_PROVIDER: bool({
|
|
17
|
+
desc: 'Enables the Linear integration provider so users can connect Linear workspaces.',
|
|
18
|
+
default: false,
|
|
19
|
+
}),
|
|
20
|
+
INTEGRATIONS_ENABLE_SENTRY_PROVIDER: bool({
|
|
21
|
+
desc: 'Enables the Sentry integration provider so users can connect Sentry.',
|
|
22
|
+
default: false,
|
|
23
|
+
}),
|
|
24
|
+
INTEGRATIONS_ENABLE_WEBHOOK_PROVIDER: bool({
|
|
25
|
+
desc: 'Enables the generic webhook integration provider so users can create inbound webhook URLs. It is enabled by default because it does not require provider setup.',
|
|
26
|
+
default: true,
|
|
27
|
+
}),
|
|
28
|
+
});
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import {integrationConnectionFactory} from '#test/factories/connection.js';
|
|
2
|
+
import {
|
|
3
|
+
buildAgentToolSelectionCatalogs,
|
|
4
|
+
createWorkspaceConnectionSnapshotLoader,
|
|
5
|
+
} from './agent-tool-selection.js';
|
|
6
|
+
import {createIntegrationProviderRegistry} from './providers/registry.js';
|
|
7
|
+
|
|
8
|
+
describe('buildAgentToolSelectionCatalogs', () => {
|
|
9
|
+
it('builds a catalog map from registered agent tool adapters', async () => {
|
|
10
|
+
const selectionCatalog = {
|
|
11
|
+
selectors: [
|
|
12
|
+
{
|
|
13
|
+
token: 'issue_read',
|
|
14
|
+
kind: 'family' as const,
|
|
15
|
+
sensitivity: 'read' as const,
|
|
16
|
+
sensitive: false,
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
};
|
|
20
|
+
const registry = createIntegrationProviderRegistry([
|
|
21
|
+
{
|
|
22
|
+
provider: 'github',
|
|
23
|
+
displayName: 'GitHub',
|
|
24
|
+
adapters: {
|
|
25
|
+
agent_tools: {
|
|
26
|
+
catalog: () => [],
|
|
27
|
+
selectionCatalog: () => selectionCatalog,
|
|
28
|
+
openSession: async () => {
|
|
29
|
+
await Promise.resolve();
|
|
30
|
+
return {
|
|
31
|
+
call: async () => {
|
|
32
|
+
await Promise.resolve();
|
|
33
|
+
return {};
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
]);
|
|
41
|
+
|
|
42
|
+
const result = await buildAgentToolSelectionCatalogs(registry);
|
|
43
|
+
|
|
44
|
+
expect(result.get('github')).toBe(selectionCatalog);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
describe('createWorkspaceConnectionSnapshotLoader', () => {
|
|
49
|
+
it('returns workspace-scoped connection capability snapshots', async () => {
|
|
50
|
+
const workspaceId = crypto.randomUUID();
|
|
51
|
+
const otherWorkspaceId = crypto.randomUUID();
|
|
52
|
+
const registry = createIntegrationProviderRegistry([
|
|
53
|
+
sourceProvider('gitea'),
|
|
54
|
+
agentToolsProvider('github'),
|
|
55
|
+
]);
|
|
56
|
+
const loader = createWorkspaceConnectionSnapshotLoader(registry);
|
|
57
|
+
const giteaConnection = await integrationConnectionFactory.create({
|
|
58
|
+
workspaceId,
|
|
59
|
+
provider: 'gitea',
|
|
60
|
+
slug: 'gitea_main',
|
|
61
|
+
});
|
|
62
|
+
const githubConnection = await integrationConnectionFactory.create({
|
|
63
|
+
workspaceId,
|
|
64
|
+
provider: 'github',
|
|
65
|
+
slug: 'github_main',
|
|
66
|
+
});
|
|
67
|
+
await integrationConnectionFactory.create({
|
|
68
|
+
workspaceId: otherWorkspaceId,
|
|
69
|
+
provider: 'github',
|
|
70
|
+
slug: 'other_github',
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const snapshot = await loader(workspaceId);
|
|
74
|
+
|
|
75
|
+
expect(snapshot).toEqual(
|
|
76
|
+
new Map([
|
|
77
|
+
[
|
|
78
|
+
'gitea_main',
|
|
79
|
+
{id: giteaConnection.id, provider: 'gitea', capabilities: ['source_control']},
|
|
80
|
+
],
|
|
81
|
+
[
|
|
82
|
+
'github_main',
|
|
83
|
+
{id: githubConnection.id, provider: 'github', capabilities: ['agent_tools']},
|
|
84
|
+
],
|
|
85
|
+
]),
|
|
86
|
+
);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
function sourceProvider(provider: string) {
|
|
91
|
+
return {
|
|
92
|
+
provider,
|
|
93
|
+
displayName: provider,
|
|
94
|
+
adapters: {
|
|
95
|
+
source_control: {
|
|
96
|
+
listRepositories: async () => {
|
|
97
|
+
await Promise.resolve();
|
|
98
|
+
return {repositories: [], nextCursor: null};
|
|
99
|
+
},
|
|
100
|
+
resolveRepository: async () => {
|
|
101
|
+
await Promise.resolve();
|
|
102
|
+
throw new Error('not used');
|
|
103
|
+
},
|
|
104
|
+
listFiles: async () => {
|
|
105
|
+
await Promise.resolve();
|
|
106
|
+
return {files: [], nextCursor: null};
|
|
107
|
+
},
|
|
108
|
+
fetchFile: async () => {
|
|
109
|
+
await Promise.resolve();
|
|
110
|
+
throw new Error('not used');
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function agentToolsProvider(provider: string) {
|
|
118
|
+
return {
|
|
119
|
+
provider,
|
|
120
|
+
displayName: provider,
|
|
121
|
+
adapters: {
|
|
122
|
+
agent_tools: {
|
|
123
|
+
catalog: () => [],
|
|
124
|
+
selectionCatalog: () => ({selectors: []}),
|
|
125
|
+
openSession: async () => {
|
|
126
|
+
await Promise.resolve();
|
|
127
|
+
return {
|
|
128
|
+
call: async () => {
|
|
129
|
+
await Promise.resolve();
|
|
130
|
+
return {};
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
}
|