@cargo-ai/cdk 1.0.5 → 1.0.6
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/README.md +55 -8
- package/build/src/cli/commands/types.js +11 -35
- package/build/src/core.d.ts +1 -1
- package/build/src/core.d.ts.map +1 -1
- package/build/src/deploy/apply.d.ts +6 -0
- package/build/src/deploy/apply.d.ts.map +1 -1
- package/build/src/deploy/apply.js +4 -0
- package/build/src/deploy/destroy.d.ts.map +1 -1
- package/build/src/deploy/destroy.js +33 -0
- package/build/src/deploy/executors.live.d.ts.map +1 -1
- package/build/src/deploy/executors.live.js +157 -1
- package/build/src/deploy/readers.live.d.ts.map +1 -1
- package/build/src/deploy/readers.live.js +34 -1
- package/build/src/index.d.ts +9 -5
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +4 -2
- package/build/src/refs.d.ts +22 -0
- package/build/src/refs.d.ts.map +1 -1
- package/build/src/refs.js +11 -2
- package/build/src/resources/actions.d.ts +39 -19
- package/build/src/resources/actions.d.ts.map +1 -1
- package/build/src/resources/actions.js +60 -33
- package/build/src/resources/agent.d.ts +10 -23
- package/build/src/resources/agent.d.ts.map +1 -1
- package/build/src/resources/agent.js +8 -25
- package/build/src/resources/app.d.ts +3 -1
- package/build/src/resources/app.d.ts.map +1 -1
- package/build/src/resources/app.js +2 -1
- package/build/src/resources/connector.d.ts +10 -0
- package/build/src/resources/connector.d.ts.map +1 -1
- package/build/src/resources/connector.js +18 -1
- package/build/src/resources/customIntegration.d.ts +12 -0
- package/build/src/resources/customIntegration.d.ts.map +1 -0
- package/build/src/resources/customIntegration.js +18 -0
- package/build/src/resources/mcpServer.d.ts +8 -10
- package/build/src/resources/mcpServer.d.ts.map +1 -1
- package/build/src/resources/mcpServer.js +4 -7
- package/build/src/resources/model.d.ts +36 -1
- package/build/src/resources/model.d.ts.map +1 -1
- package/build/src/resources/model.js +38 -1
- package/build/src/resources/relationship.d.ts +21 -0
- package/build/src/resources/relationship.d.ts.map +1 -0
- package/build/src/resources/relationship.js +39 -0
- package/build/src/resources/worker.d.ts +13 -1
- package/build/src/resources/worker.d.ts.map +1 -1
- package/build/src/resources/worker.js +3 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/templates/blank/cargo.ts +17 -22
- package/templates/full/README.md +7 -4
- package/templates/full/agents/sdr.ts +12 -8
- package/templates/full/connectors/hunter.ts +10 -0
- package/templates/full/mcp/crm.ts +9 -6
- package/templates/full/tools/enrich.ts +28 -9
package/build/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { ActionOptions, AgentHandle, AgentSpec, AgentUse,
|
|
1
|
+
export type { ActionOptions, AgentHandle, AgentSpec, AgentUse, ConnectorActionOptions, ModelOptions, } from "./resources/agent.js";
|
|
2
2
|
export { defineAgent } from "./resources/agent.js";
|
|
3
3
|
export type { AppHandle, AppSpec } from "./resources/app.js";
|
|
4
4
|
export { defineApp } from "./resources/app.js";
|
|
@@ -8,16 +8,20 @@ export type { ConnectorConfigs, ConnectorHandle, ConnectorSpec, } from "./resour
|
|
|
8
8
|
export { defineConnector } from "./resources/connector.js";
|
|
9
9
|
export type { ContextHandle, ContextSpec } from "./resources/context.js";
|
|
10
10
|
export { defineContext } from "./resources/context.js";
|
|
11
|
+
export type { CustomIntegrationHandle, CustomIntegrationSpec, } from "./resources/customIntegration.js";
|
|
12
|
+
export { defineCustomIntegration } from "./resources/customIntegration.js";
|
|
11
13
|
export type { FileHandle, FileSpec } from "./resources/file.js";
|
|
12
14
|
export { defineFile } from "./resources/file.js";
|
|
13
15
|
export type { FolderHandle, FolderKind, FolderSpec, } from "./resources/folder.js";
|
|
14
16
|
export { defineFolder } from "./resources/folder.js";
|
|
15
17
|
export type { McpServerHandle, McpServerSpec } from "./resources/mcpServer.js";
|
|
16
18
|
export { defineMcpServer } from "./resources/mcpServer.js";
|
|
17
|
-
export type { ExtractorConfigs, ModelHandle, ModelSpec, } from "./resources/model.js";
|
|
19
|
+
export type { ExtractorConfigs, ModelHandle, ModelSpec, UnificationColumnSpec, UnificationParentSpec, UnificationSpec, } from "./resources/model.js";
|
|
18
20
|
export { defineModel } from "./resources/model.js";
|
|
19
21
|
export type { PlayHandle, PlaySpec } from "./resources/play.js";
|
|
20
22
|
export { definePlay } from "./resources/play.js";
|
|
23
|
+
export type { RelationshipEndpointSpec, RelationshipHandle, RelationshipRelation, RelationshipSpec, } from "./resources/relationship.js";
|
|
24
|
+
export { defineRelationship } from "./resources/relationship.js";
|
|
21
25
|
export type { SegmentHandle, SegmentSpec } from "./resources/segment.js";
|
|
22
26
|
export { defineSegment } from "./resources/segment.js";
|
|
23
27
|
export type { TerritoryColor, TerritoryHandle, TerritoryMemberSpec, TerritorySpec, } from "./resources/territory.js";
|
|
@@ -27,10 +31,10 @@ export { defineTool } from "./resources/tool.js";
|
|
|
27
31
|
export type { WorkerHandle, WorkerSpec } from "./resources/worker.js";
|
|
28
32
|
export { defineWorker } from "./resources/worker.js";
|
|
29
33
|
export { createWorker, OpenAPIRoute } from "@cargo-ai/worker-sdk";
|
|
30
|
-
export { agentRef, defineWorkflow, toolRef, type WorkflowResourceRef, } from "@cargo-ai/workflow-sdk";
|
|
34
|
+
export { agentRef, defineWorkflow, defineWorkflowFromNodes, toolRef, type WorkflowFromNodes, type WorkflowResourceRef, } from "@cargo-ai/workflow-sdk";
|
|
31
35
|
export type { EncryptionRef, ResourceKind, ResourceNode, SecretRef, Token, } from "./core.js";
|
|
32
36
|
export { env, isSecret, isToken, resolveSecrets, secret, token, } from "./core.js";
|
|
33
|
-
export type { AgentRef, ConnectorRef, DatasetRef, FolderRef, MemberRef, ModelRef, PlayRef, ResourceRef, SegmentRef, ToolRef, } from "./refs.js";
|
|
34
|
-
export { connectorRef, datasetRef, folderRef, memberRef, modelRef, playRef, refUuid, segmentRef, } from "./refs.js";
|
|
37
|
+
export type { AgentRef, ConnectorActionRef, ConnectorRef, DatasetRef, FolderRef, MemberRef, ModelRef, PlayRef, ResourceRef, SegmentRef, ToolRef, } from "./refs.js";
|
|
38
|
+
export { connectorActionRef, connectorRef, datasetRef, folderRef, memberRef, modelRef, playRef, refUuid, segmentRef, } from "./refs.js";
|
|
35
39
|
export * from "./deploy/index.js";
|
|
36
40
|
//# sourceMappingURL=index.d.ts.map
|
package/build/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAUA,YAAY,EACV,aAAa,EACb,WAAW,EACX,SAAS,EACT,QAAQ,EACR,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAUA,YAAY,EACV,aAAa,EACb,WAAW,EACX,SAAS,EACT,QAAQ,EACR,sBAAsB,EACtB,YAAY,GACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,YAAY,EACV,0BAA0B,EAC1B,aAAa,EACb,cAAc,EACd,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,aAAa,GACd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EACV,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC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AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAMlE,OAAO,EACL,QAAQ,EACR,cAAc,EACd,uBAAuB,EACvB,OAAO,EACP,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,GACzB,MAAM,wBAAwB,CAAC;AAGhC,YAAY,EACV,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,KAAK,GACN,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,GAAG,EACH,QAAQ,EACR,OAAO,EACP,cAAc,EACd,MAAM,EACN,KAAK,GACN,MAAM,WAAW,CAAC;AAGnB,YAAY,EACV,QAAQ,EACR,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,SAAS,EACT,SAAS,EACT,QAAQ,EACR,OAAO,EACP,WAAW,EACX,UAAU,EACV,OAAO,GACR,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,SAAS,EACT,SAAS,EACT,QAAQ,EACR,OAAO,EACP,OAAO,EACP,UAAU,GACX,MAAM,WAAW,CAAC;AAGnB,cAAc,mBAAmB,CAAC"}
|
package/build/src/index.js
CHANGED
|
@@ -11,11 +11,13 @@ export { defineApp } from "./resources/app.js";
|
|
|
11
11
|
export { defineCapacity } from "./resources/capacity.js";
|
|
12
12
|
export { defineConnector } from "./resources/connector.js";
|
|
13
13
|
export { defineContext } from "./resources/context.js";
|
|
14
|
+
export { defineCustomIntegration } from "./resources/customIntegration.js";
|
|
14
15
|
export { defineFile } from "./resources/file.js";
|
|
15
16
|
export { defineFolder } from "./resources/folder.js";
|
|
16
17
|
export { defineMcpServer } from "./resources/mcpServer.js";
|
|
17
18
|
export { defineModel } from "./resources/model.js";
|
|
18
19
|
export { definePlay } from "./resources/play.js";
|
|
20
|
+
export { defineRelationship } from "./resources/relationship.js";
|
|
19
21
|
export { defineSegment } from "./resources/segment.js";
|
|
20
22
|
export { defineTerritory } from "./resources/territory.js";
|
|
21
23
|
export { defineTool } from "./resources/tool.js";
|
|
@@ -26,8 +28,8 @@ export { createWorker, OpenAPIRoute } from "@cargo-ai/worker-sdk";
|
|
|
26
28
|
// `agentRef` (+ their `WorkflowResourceRef` type) to reference a tool or agent by
|
|
27
29
|
// literal uuid inside a body's `uses` map. The lower-level wire-format/codegen
|
|
28
30
|
// types stay in `@cargo-ai/workflow-sdk`.
|
|
29
|
-
export { agentRef, defineWorkflow, toolRef, } from "@cargo-ai/workflow-sdk";
|
|
31
|
+
export { agentRef, defineWorkflow, defineWorkflowFromNodes, toolRef, } from "@cargo-ai/workflow-sdk";
|
|
30
32
|
export { env, isSecret, isToken, resolveSecrets, secret, token, } from "./core.js";
|
|
31
|
-
export { connectorRef, datasetRef, folderRef, memberRef, modelRef, playRef, refUuid, segmentRef, } from "./refs.js";
|
|
33
|
+
export { connectorActionRef, connectorRef, datasetRef, folderRef, memberRef, modelRef, playRef, refUuid, segmentRef, } from "./refs.js";
|
|
32
34
|
// ── deployment: plan + apply ─────────────────────────────────────────────────
|
|
33
35
|
export * from "./deploy/index.js";
|
package/build/src/refs.d.ts
CHANGED
|
@@ -27,6 +27,28 @@ export declare const playRef: (uuid: string) => PlayRef;
|
|
|
27
27
|
export declare const memberRef: (uuid: string) => MemberRef;
|
|
28
28
|
/** Reference a segment by uuid. */
|
|
29
29
|
export declare const segmentRef: (uuid: string) => SegmentRef;
|
|
30
|
+
/**
|
|
31
|
+
* A reference to one action of a connector (e.g. an enrichment endpoint), for an
|
|
32
|
+
* agent's / MCP server's `uses`. Produced by accessing the action off a connector
|
|
33
|
+
* handle — `hunter.actions.emailFinder` — or with `connectorActionRef(connector, slug)`.
|
|
34
|
+
* Unlike a `ResourceRef`, it carries the integration + action slug alongside the
|
|
35
|
+
* connector's uuid (the action itself isn't a `define*` resource).
|
|
36
|
+
*/
|
|
37
|
+
export type ConnectorActionRef = {
|
|
38
|
+
readonly resource: "connectorAction";
|
|
39
|
+
readonly connectorUuid: Token | string;
|
|
40
|
+
readonly integration: string;
|
|
41
|
+
readonly actionSlug: string;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Reference a connector action by an explicit connector + action slug — the
|
|
45
|
+
* escape hatch when you don't have a typed connector handle (`connector.actions.<slug>`
|
|
46
|
+
* is the typed way).
|
|
47
|
+
*/
|
|
48
|
+
export declare const connectorActionRef: (connector: {
|
|
49
|
+
uuid: Token | string;
|
|
50
|
+
integrationSlug?: string;
|
|
51
|
+
}, actionSlug: string, integration?: string) => ConnectorActionRef;
|
|
30
52
|
/** Extract the uuid from a handle or ref (both carry `uuid`). */
|
|
31
53
|
export declare const refUuid: (ref: {
|
|
32
54
|
uuid: Token | string;
|
package/build/src/refs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../../src/refs.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC,MAAM,MAAM,eAAe,GACvB,WAAW,GACX,SAAS,GACT,OAAO,GACP,QAAQ,GACR,MAAM,GACN,MAAM,GACN,OAAO,GACP,QAAQ,GACR,SAAS,CAAC;AAEd,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,IAAI;IACrE,QAAQ,CAAC,IAAI,EAAE,KAAK,GAAG,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC;AACpD,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;AAChD,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;AAC5C,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;AAC9C,MAAM,MAAM,OA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E,iBAAiB,CAAC;IACrC,QAAQ,CAAC,aAAa,EAAE,KAAK,GAAG,MAAM,CAAC;IACvC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,cAClB;IAAE,IAAI,EAAE,KAAK,GAAG,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,CAAA;CAAE,cACjD,MAAM,gBACJ,MAAM,KACnB,kBAKD,CAAC;AAEH,iEAAiE;AACjE,eAAO,MAAM,OAAO,QAAS;IAAE,IAAI,EAAE,KAAK,GAAG,MAAM,CAAA;CAAE,KAAG,KAAK,GAAG,MACtD,CAAC"}
|
package/build/src/refs.js
CHANGED
|
@@ -38,7 +38,16 @@ export const segmentRef = (uuid) => ({
|
|
|
38
38
|
uuid,
|
|
39
39
|
resource: "segment",
|
|
40
40
|
});
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Reference a connector action by an explicit connector + action slug — the
|
|
43
|
+
* escape hatch when you don't have a typed connector handle (`connector.actions.<slug>`
|
|
44
|
+
* is the typed way).
|
|
45
|
+
*/
|
|
46
|
+
export const connectorActionRef = (connector, actionSlug, integration) => ({
|
|
47
|
+
resource: "connectorAction",
|
|
48
|
+
connectorUuid: connector.uuid,
|
|
49
|
+
integration: integration ?? connector.integrationSlug ?? "",
|
|
50
|
+
actionSlug,
|
|
51
|
+
});
|
|
43
52
|
/** Extract the uuid from a handle or ref (both carry `uuid`). */
|
|
44
53
|
export const refUuid = (ref) => ref.uuid;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
1
|
+
import { type ConnectorActionRef, type ResourceRef } from "../refs.js";
|
|
2
|
+
import type { ModelHandle } from "./model.js";
|
|
3
|
+
/** Options shared by every action a use exposes (tool / agent / connector action). */
|
|
3
4
|
export type ActionOptions = {
|
|
4
5
|
/** Override the action's display name. */
|
|
5
6
|
readonly name?: string;
|
|
@@ -9,23 +10,42 @@ export type ActionOptions = {
|
|
|
9
10
|
/** Block until the action finishes before continuing. Defaults to true. */
|
|
10
11
|
readonly waitUntilFinished?: boolean;
|
|
11
12
|
};
|
|
12
|
-
/**
|
|
13
|
-
export type
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
/** Extra option only a connector action takes, on top of `ActionOptions`. */
|
|
14
|
+
export type ConnectorActionOptions = ActionOptions & {
|
|
15
|
+
/** Lock input fields to fixed values; the agent decides the rest. */
|
|
16
|
+
readonly config?: Record<string, unknown>;
|
|
17
|
+
};
|
|
18
|
+
/** Per-model options when a use exposes a data model. */
|
|
19
|
+
export type ModelOptions = {
|
|
20
|
+
readonly readOnly?: boolean;
|
|
21
|
+
readonly columns?: string[];
|
|
22
|
+
readonly prompt?: string;
|
|
23
|
+
};
|
|
24
|
+
/** The data-model references (become the agent's release resources). */
|
|
25
|
+
type ModelUseRef = ModelHandle | ResourceRef<"model">;
|
|
26
|
+
/**
|
|
27
|
+
* One entry in an agent's / MCP server's `uses` — referenced by handle, bare or
|
|
28
|
+
* `{ ref, …options }`:
|
|
29
|
+
* - a `defineTool` / `defineAgent` handle (or `toolRef` / `agentRef`) — options
|
|
30
|
+
* `name` / `description` / `isBulkAllowed` / `waitUntilFinished`;
|
|
31
|
+
* - a connector action — `connector.<actionSlug>` (or `connectorActionRef(...)`)
|
|
32
|
+
* — same action options plus `config` to fix input fields;
|
|
33
|
+
* - a `defineModel` handle (or `modelRef`) — options `readOnly` / `columns` / `prompt`.
|
|
34
|
+
* The kind is read from each ref's `resource`, so order doesn't matter.
|
|
35
|
+
*/
|
|
36
|
+
export type AgentUse = ResourceRef<"tool"> | ResourceRef<"agent"> | ConnectorActionRef | ModelUseRef | (ActionOptions & {
|
|
37
|
+
readonly ref: ResourceRef<"tool"> | ResourceRef<"agent">;
|
|
38
|
+
}) | (ConnectorActionOptions & {
|
|
39
|
+
readonly ref: ConnectorActionRef;
|
|
40
|
+
}) | (ModelOptions & {
|
|
41
|
+
readonly ref: ModelUseRef;
|
|
19
42
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
connector?: ConnectorRef;
|
|
26
|
-
config?: Record<string, unknown>;
|
|
43
|
+
export type NormalizedUses = {
|
|
44
|
+
models: unknown[];
|
|
45
|
+
tools: unknown[];
|
|
46
|
+
subAgents: unknown[];
|
|
47
|
+
connectorActions: unknown[];
|
|
27
48
|
};
|
|
28
|
-
export declare function
|
|
29
|
-
export
|
|
30
|
-
export declare function normalizeConnectorActions(refs: readonly ConnectorActionSpec[] | undefined): unknown[];
|
|
49
|
+
export declare function normalizeUses(uses: readonly AgentUse[] | undefined): NormalizedUses;
|
|
50
|
+
export {};
|
|
31
51
|
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/resources/actions.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/resources/actions.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,kBAAkB,EAAW,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,sFAAsF;AACtF,MAAM,MAAM,aAAa,GAAG;IAC1B,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,0DAA0D;IAC1D,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC,2EAA2E;IAC3E,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CACtC,CAAC;AAE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
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
1
|
+
// The unified `uses` surface shared by `defineAgent` and `defineMcpServer`: one
|
|
2
|
+
// array of references — tools, agents, data models, and connector actions — each
|
|
3
|
+
// a bare handle/ref or `{ ref, …options }`. `normalizeUses` splits it into the
|
|
4
|
+
// four release buckets the executor reads (models / tools / subAgents /
|
|
5
|
+
// connectorActions), so the stored spec — and the content hash — is identical
|
|
6
|
+
// regardless of the order entries were written in.
|
|
6
7
|
import { refUuid } from "../refs.js";
|
|
7
8
|
function normalizeOptions(opts) {
|
|
8
9
|
return {
|
|
@@ -12,33 +13,59 @@ function normalizeOptions(opts) {
|
|
|
12
13
|
waitUntilFinished: opts.waitUntilFinished === undefined ? true : opts.waitUntilFinished,
|
|
13
14
|
};
|
|
14
15
|
}
|
|
15
|
-
// Split
|
|
16
|
-
// `
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
// Split the `uses` array into the four release buckets, keyed off each ref's
|
|
17
|
+
// `resource` discriminator.
|
|
18
|
+
export function normalizeUses(uses) {
|
|
19
|
+
const models = [];
|
|
20
|
+
const tools = [];
|
|
21
|
+
const subAgents = [];
|
|
22
|
+
const connectorActions = [];
|
|
23
|
+
for (const use of uses ?? []) {
|
|
24
|
+
const wrapped = "ref" in use;
|
|
25
|
+
const ref = wrapped ? use.ref : use;
|
|
26
|
+
const opts = wrapped ? use : {};
|
|
27
|
+
switch (ref.resource) {
|
|
28
|
+
case "model":
|
|
29
|
+
models.push({
|
|
30
|
+
uuid: refUuid(ref),
|
|
31
|
+
readOnly: opts.readOnly === undefined
|
|
32
|
+
? true
|
|
33
|
+
: opts.readOnly,
|
|
34
|
+
columns: opts.columns === undefined
|
|
35
|
+
? null
|
|
36
|
+
: opts.columns,
|
|
37
|
+
prompt: opts.prompt === undefined
|
|
38
|
+
? null
|
|
39
|
+
: opts.prompt,
|
|
40
|
+
});
|
|
41
|
+
break;
|
|
42
|
+
case "tool":
|
|
43
|
+
tools.push({
|
|
44
|
+
uuid: refUuid(ref),
|
|
45
|
+
...normalizeOptions(opts),
|
|
46
|
+
});
|
|
47
|
+
break;
|
|
48
|
+
case "agent":
|
|
49
|
+
subAgents.push({
|
|
50
|
+
uuid: refUuid(ref),
|
|
51
|
+
...normalizeOptions(opts),
|
|
52
|
+
});
|
|
53
|
+
break;
|
|
54
|
+
case "connectorAction":
|
|
55
|
+
connectorActions.push({
|
|
56
|
+
integration: ref.integration,
|
|
57
|
+
actionSlug: ref.actionSlug,
|
|
58
|
+
connectorUuid: ref.connectorUuid,
|
|
59
|
+
config: opts.config === undefined
|
|
60
|
+
? {}
|
|
61
|
+
: opts.config,
|
|
62
|
+
...normalizeOptions(opts),
|
|
63
|
+
});
|
|
64
|
+
break;
|
|
65
|
+
default:
|
|
66
|
+
throw new Error(`uses: unsupported entry with resource "${String(ref.resource)}" — expected a tool, agent, data model, or connector action ` +
|
|
67
|
+
`(a connector action is \`connector.<actionSlug>\`).`);
|
|
68
|
+
}
|
|
21
69
|
}
|
|
22
|
-
return {
|
|
23
|
-
}
|
|
24
|
-
export function normalizeTools(uses) {
|
|
25
|
-
return (uses === undefined ? [] : uses).map((t) => {
|
|
26
|
-
const { uuid, options } = splitUse(t);
|
|
27
|
-
return { uuid, ...normalizeOptions(options) };
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
export function normalizeSubAgents(uses) {
|
|
31
|
-
return (uses === undefined ? [] : uses).map((s) => {
|
|
32
|
-
const { uuid, options } = splitUse(s);
|
|
33
|
-
return { uuid, ...normalizeOptions(options) };
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
export function normalizeConnectorActions(refs) {
|
|
37
|
-
return (refs === undefined ? [] : refs).map((c) => ({
|
|
38
|
-
integration: c.integration,
|
|
39
|
-
actionSlug: c.actionSlug,
|
|
40
|
-
connectorUuid: c.connector === undefined ? undefined : refUuid(c.connector),
|
|
41
|
-
config: c.config === undefined ? {} : c.config,
|
|
42
|
-
...normalizeOptions(c),
|
|
43
|
-
}));
|
|
70
|
+
return { models, tools, subAgents, connectorActions };
|
|
44
71
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { AiTypes } from "@cargo-ai/types";
|
|
2
2
|
import { type Token } from "../core.js";
|
|
3
|
-
import { type ConnectorRef, type FolderRef
|
|
4
|
-
import { type AgentUse
|
|
3
|
+
import { type ConnectorRef, type FolderRef } from "../refs.js";
|
|
4
|
+
import { type AgentUse } from "./actions.js";
|
|
5
5
|
import type { ConnectorHandle } from "./connector.js";
|
|
6
6
|
import type { FolderHandle } from "./folder.js";
|
|
7
|
-
|
|
8
|
-
export type { ActionOptions, AgentUse, ConnectorActionSpec, ToolUse, } from "./actions.js";
|
|
7
|
+
export type { ActionOptions, AgentUse, ConnectorActionOptions, ModelOptions, } from "./actions.js";
|
|
9
8
|
export type CapabilitySpec = AiTypes.Capability["slug"] | AiTypes.Capability;
|
|
10
9
|
export type TriggerSpec = {
|
|
11
10
|
type: "cron";
|
|
@@ -20,16 +19,6 @@ export type TriggerSpec = {
|
|
|
20
19
|
config?: Record<string, unknown>;
|
|
21
20
|
name?: string;
|
|
22
21
|
};
|
|
23
|
-
/** Per-model options when an agent/MCP server exposes a data model. */
|
|
24
|
-
export type ModelOptions = {
|
|
25
|
-
readonly readOnly?: boolean;
|
|
26
|
-
readonly columns?: string[];
|
|
27
|
-
readonly prompt?: string;
|
|
28
|
-
};
|
|
29
|
-
/** A data model to expose — the handle / `modelRef(uuid)`, bare or `{ ref, …options }`. */
|
|
30
|
-
export type ModelUse = ModelHandle | ModelRef | (ModelOptions & {
|
|
31
|
-
readonly ref: ModelHandle | ModelRef;
|
|
32
|
-
});
|
|
33
22
|
export type AgentSpec = {
|
|
34
23
|
name?: string;
|
|
35
24
|
description?: string;
|
|
@@ -45,14 +34,13 @@ export type AgentSpec = {
|
|
|
45
34
|
withReasoning?: boolean;
|
|
46
35
|
capabilities?: CapabilitySpec[];
|
|
47
36
|
triggers?: TriggerSpec[];
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
subAgents?: AgentUse[];
|
|
37
|
+
/**
|
|
38
|
+
* Everything the agent can call or read, in one array — tools, sub-agents,
|
|
39
|
+
* connector actions, and data models. Each entry is a handle (bare or
|
|
40
|
+
* `{ ref, …options }`): a `defineTool` / `defineAgent` / `defineModel` handle,
|
|
41
|
+
* or a connector action `connector.<actionSlug>`. See `AgentUse`.
|
|
42
|
+
*/
|
|
43
|
+
uses?: AgentUse[];
|
|
56
44
|
mcpClients?: AiTypes.McpClient[];
|
|
57
45
|
suggestedActions?: AiTypes.SuggestedAction[];
|
|
58
46
|
output?: AiTypes.Output;
|
|
@@ -60,7 +48,6 @@ export type AgentSpec = {
|
|
|
60
48
|
evaluator?: AiTypes.Evaluator;
|
|
61
49
|
folder?: FolderHandle | FolderRef;
|
|
62
50
|
};
|
|
63
|
-
export declare function normalizeModels(uses: readonly ModelUse[] | undefined, defaultReadOnly: boolean): unknown[];
|
|
64
51
|
export type AgentHandle = {
|
|
65
52
|
readonly slug: string;
|
|
66
53
|
readonly uuid: Token;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/resources/agent.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAwB,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;AACrE,OAAO,
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/resources/agent.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAwB,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAW,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AAE,cAAc,EAAE,CAAC;IAChC,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC;IACjC,gBAAgB,CAAC,EAAE,OAAO,CAAC,eAAe,EAAE,CAAC;IAC7C,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC;IAC9B,MAAM,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;CACnC,CAAC;AAmBF,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B,CAAC;AASF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,WAAW,CAiDtE"}
|
|
@@ -1,26 +1,11 @@
|
|
|
1
1
|
// defineAgent — the typed builder over a Release + Agent. References dependencies
|
|
2
2
|
// by handle (or `xxRef(uuid)`): `connector` is the LLM connector (its integration
|
|
3
|
-
// slug is resolved at deploy)
|
|
4
|
-
//
|
|
5
|
-
// CreateAgentPayload + DeployDraftReleasePayload once tokens resolve.
|
|
3
|
+
// slug is resolved at deploy); everything the agent can call or read — tools,
|
|
4
|
+
// sub-agents, connector actions, and data models — is one `uses` array. Compiles
|
|
5
|
+
// to a CreateAgentPayload + DeployDraftReleasePayload once tokens resolve.
|
|
6
6
|
import { register, resourceId, token } from "../core.js";
|
|
7
|
-
import { refUuid
|
|
8
|
-
import {
|
|
9
|
-
// Normalize the `models` list (shared with `defineMcpServer`) — each entry is a
|
|
10
|
-
// bare handle/ref or `{ ref, …options }`.
|
|
11
|
-
export function normalizeModels(uses, defaultReadOnly) {
|
|
12
|
-
return (uses === undefined ? [] : uses).map((m) => {
|
|
13
|
-
const hasOptions = "ref" in m;
|
|
14
|
-
const ref = hasOptions ? m.ref : m;
|
|
15
|
-
const opts = hasOptions ? m : {};
|
|
16
|
-
return {
|
|
17
|
-
uuid: refUuid(ref),
|
|
18
|
-
readOnly: opts.readOnly === undefined ? defaultReadOnly : opts.readOnly,
|
|
19
|
-
columns: opts.columns === undefined ? null : opts.columns,
|
|
20
|
-
prompt: opts.prompt === undefined ? null : opts.prompt,
|
|
21
|
-
};
|
|
22
|
-
});
|
|
23
|
-
}
|
|
7
|
+
import { refUuid } from "../refs.js";
|
|
8
|
+
import { normalizeUses } from "./actions.js";
|
|
24
9
|
// Lower triggers to their wire form — a connector trigger references its
|
|
25
10
|
// connector by handle/ref, which becomes `connectorUuid`.
|
|
26
11
|
function normalizeTriggers(triggers) {
|
|
@@ -79,11 +64,9 @@ export function defineAgent(slug, spec) {
|
|
|
79
64
|
heartbeat: spec.heartbeat === undefined ? null : spec.heartbeat,
|
|
80
65
|
evaluator: spec.evaluator === undefined ? null : spec.evaluator,
|
|
81
66
|
triggers: normalizeTriggers(spec.triggers),
|
|
82
|
-
//
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
subAgents: normalizeSubAgents(spec.subAgents),
|
|
86
|
-
connectorActions: normalizeConnectorActions(spec.connectorActions),
|
|
67
|
+
// `uses` splits into the four buckets the executor resolves →
|
|
68
|
+
// ModelResource[] / Action[]. Spread keeps the stored spec shape stable.
|
|
69
|
+
...normalizeUses(spec.uses),
|
|
87
70
|
},
|
|
88
71
|
});
|
|
89
72
|
return { slug, uuid: token(id, "uuid"), resource: "agent" };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Token } from "../core.js";
|
|
1
|
+
import { type SecretRef, type Token } from "../core.js";
|
|
2
2
|
import { type FolderRef } from "../refs.js";
|
|
3
3
|
import type { FolderHandle } from "./folder.js";
|
|
4
4
|
export type AppSpec = {
|
|
@@ -7,6 +7,8 @@ export type AppSpec = {
|
|
|
7
7
|
name?: string;
|
|
8
8
|
description?: string;
|
|
9
9
|
folder?: FolderHandle | FolderRef;
|
|
10
|
+
/** Env vars baked into the build (`VITE_`-prefixed). Use `secret("NAME")` for secret values. */
|
|
11
|
+
env?: Record<string, string | SecretRef>;
|
|
10
12
|
};
|
|
11
13
|
export type AppHandle = {
|
|
12
14
|
readonly slug: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/resources/app.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/resources/app.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,KAAK,EAEX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,SAAS,EAAW,MAAM,YAAY,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAMhD,MAAM,MAAM,OAAO,GAAG;IACpB,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;IAClC,gGAAgG;IAChG,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,wDAAwD;IACxD,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC;CACrB,CAAC;AAEF,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,SAAS,CAkBhE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// defineApp — a hosted Cargo app (the resource), deployed from a code directory
|
|
2
2
|
// (a Vite app). On deploy the reconciler creates the app slot, uploads the
|
|
3
3
|
// bundle, and promotes it (the backend runs the build).
|
|
4
|
-
import { register, resourceId, token } from "../core.js";
|
|
4
|
+
import { register, resourceId, token, } from "../core.js";
|
|
5
5
|
import { refUuid } from "../refs.js";
|
|
6
6
|
import { assertBundleFiles, bundleHash } from "./bundle.js";
|
|
7
7
|
// Files the hosting app build requires at the bundle root: an npm-ci'able project
|
|
@@ -21,6 +21,7 @@ export function defineApp(slug, spec) {
|
|
|
21
21
|
path: spec.path,
|
|
22
22
|
contentHash: bundleHash(spec.path),
|
|
23
23
|
folderUuid: spec.folder === undefined ? undefined : refUuid(spec.folder),
|
|
24
|
+
env: spec.env === undefined ? {} : spec.env,
|
|
24
25
|
},
|
|
25
26
|
});
|
|
26
27
|
return { slug, uuid: token(id, "uuid"), url: token(id, "url") };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { Integrations } from "@cargo-ai/workflow-sdk";
|
|
1
2
|
import { type Token } from "../core.js";
|
|
3
|
+
import type { ConnectorActionRef } from "../refs.js";
|
|
2
4
|
export type RateLimitSpec = {
|
|
3
5
|
unit: "day" | "hour" | "minute" | "second";
|
|
4
6
|
max: number;
|
|
@@ -15,6 +17,11 @@ export type ConnectorSpec<S extends string = string> = {
|
|
|
15
17
|
cacheTtlMilliseconds?: number;
|
|
16
18
|
adopt?: boolean;
|
|
17
19
|
};
|
|
20
|
+
type ConnectorActions<S extends string> = S extends keyof Integrations ? {
|
|
21
|
+
readonly [A in keyof Integrations[S] & string]: ConnectorActionRef;
|
|
22
|
+
} : {
|
|
23
|
+
readonly [actionSlug: string]: ConnectorActionRef;
|
|
24
|
+
};
|
|
18
25
|
export type ConnectorHandle<S extends string = string> = {
|
|
19
26
|
readonly slug: string;
|
|
20
27
|
readonly integrationSlug: S;
|
|
@@ -24,6 +31,9 @@ export type ConnectorHandle<S extends string = string> = {
|
|
|
24
31
|
* dataset, via `defineModel`) is referenced. Carries the integration slug `S`
|
|
25
32
|
* so `defineModel({ dataset })` can type extractor config. */
|
|
26
33
|
readonly resource: "connector";
|
|
34
|
+
/** This connector's actions — `connector.actions.<actionSlug>` — for an
|
|
35
|
+
* agent's / MCP server's `uses`. */
|
|
36
|
+
readonly actions: ConnectorActions<S>;
|
|
27
37
|
};
|
|
28
38
|
export declare function defineConnector<S extends string>(slug: string, spec: ConnectorSpec<S>): ConnectorHandle<S>;
|
|
29
39
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../../../src/resources/connector.ts"],"names":[],"mappings":"AAYA,OAAO,EAAwB,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../../../src/resources/connector.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAwB,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC;CAC9B,CAAC;AAQF,MAAM,WAAW,gBAAgB;CAAG;AAEpC,KAAK,kBAAkB,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,MAAM,gBAAgB,GACxE,gBAAgB,CAAC,CAAC,CAAC,GACnB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5B,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI;IACrD,WAAW,EAAE,CAAC,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAC/B,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAOF,KAAK,gBAAgB,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,MAAM,YAAY,GAClE;IAAE,QAAQ,EAAE,CAAC,IAAI,MAAM,YAAY,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,kBAAkB;CAAE,GACtE;IAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,GAAG,kBAAkB,CAAA;CAAE,CAAC;AAE1D,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI;IACvD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,eAAe,EAAE,CAAC,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC;IAC5B;;mEAE+D;IAC/D,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B;yCACqC;IACrC,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC;CACvC,CAAC;AAEF,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,EAC9C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GACrB,eAAe,CAAC,CAAC,CAAC,CAuCpB"}
|
|
@@ -26,12 +26,29 @@ export function defineConnector(slug, spec) {
|
|
|
26
26
|
adopt: spec.adopt === undefined ? false : spec.adopt,
|
|
27
27
|
},
|
|
28
28
|
});
|
|
29
|
+
const uuid = token(id, "uuid");
|
|
30
|
+
// A small Proxy: `connector.actions.<slug>` → a `ConnectorActionRef` pinned to
|
|
31
|
+
// this connector. The handle itself stays a plain object; only this dedicated
|
|
32
|
+
// `actions` namespace is proxied (symbols and `then` pass through as undefined).
|
|
33
|
+
const actions = new Proxy({}, {
|
|
34
|
+
get(_target, prop) {
|
|
35
|
+
if (typeof prop !== "string" || prop === "then")
|
|
36
|
+
return undefined;
|
|
37
|
+
return {
|
|
38
|
+
resource: "connectorAction",
|
|
39
|
+
connectorUuid: uuid,
|
|
40
|
+
integration: spec.integration,
|
|
41
|
+
actionSlug: prop,
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
});
|
|
29
45
|
return {
|
|
30
46
|
slug,
|
|
31
47
|
integrationSlug: spec.integration,
|
|
32
|
-
uuid
|
|
48
|
+
uuid,
|
|
33
49
|
datasetUuid: token(id, "datasetUuid"),
|
|
34
50
|
resource: "connector",
|
|
51
|
+
actions,
|
|
35
52
|
};
|
|
36
53
|
}
|
|
37
54
|
function toTitle(slug) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Token } from "../core.js";
|
|
2
|
+
import type { WorkerHandle } from "./worker.js";
|
|
3
|
+
export type CustomIntegrationSpec = {
|
|
4
|
+
/** The worker serving the Custom Integration HTTP contract. */
|
|
5
|
+
worker: WorkerHandle;
|
|
6
|
+
};
|
|
7
|
+
export type CustomIntegrationHandle = {
|
|
8
|
+
readonly slug: string;
|
|
9
|
+
readonly uuid: Token;
|
|
10
|
+
};
|
|
11
|
+
export declare function defineCustomIntegration(slug: string, spec: CustomIntegrationSpec): CustomIntegrationHandle;
|
|
12
|
+
//# sourceMappingURL=customIntegration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customIntegration.d.ts","sourceRoot":"","sources":["../../../src/resources/customIntegration.ts"],"names":[],"mappings":"AAKA,OAAO,EAAwB,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;AAErE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,MAAM,qBAAqB,GAAG;IAClC,+DAA+D;IAC/D,MAAM,EAAE,YAAY,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;CACtB,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,qBAAqB,GAC1B,uBAAuB,CAWzB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// defineCustomIntegration — registers a worker-backed custom integration in
|
|
2
|
+
// the workspace's connector catalog. The worker serves the Custom Integration
|
|
3
|
+
// HTTP contract (`createCustomIntegration` from @cargo-ai/worker-sdk); Cargo
|
|
4
|
+
// reads its `GET /manifest` once the worker is deployed and promoted.
|
|
5
|
+
import { register, resourceId, token } from "../core.js";
|
|
6
|
+
import { refUuid } from "../refs.js";
|
|
7
|
+
export function defineCustomIntegration(slug, spec) {
|
|
8
|
+
const id = resourceId("customIntegration", slug);
|
|
9
|
+
register({
|
|
10
|
+
id,
|
|
11
|
+
kind: "customIntegration",
|
|
12
|
+
slug,
|
|
13
|
+
spec: {
|
|
14
|
+
workerUuid: refUuid(spec.worker),
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
return { slug, uuid: token(id, "uuid") };
|
|
18
|
+
}
|