@cargo-ai/cdk 1.0.1 → 1.0.2
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 +6 -5
- 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 +6 -0
- package/build/src/deploy/executors.live.d.ts.map +1 -1
- package/build/src/deploy/executors.live.js +66 -0
- package/build/src/deploy/readers.live.d.ts.map +1 -1
- package/build/src/deploy/readers.live.js +29 -0
- package/build/src/index.d.ts +6 -2
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +3 -1
- package/build/src/refs.d.ts +4 -1
- package/build/src/refs.d.ts.map +1 -1
- package/build/src/refs.js +5 -0
- package/build/src/resources/capacity.d.ts +31 -0
- package/build/src/resources/capacity.d.ts.map +1 -0
- package/build/src/resources/capacity.js +36 -0
- package/build/src/resources/territory.d.ts +26 -0
- package/build/src/resources/territory.d.ts.map +1 -0
- package/build/src/resources/territory.js +33 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# Cargo CDK
|
|
2
2
|
|
|
3
3
|
Define your entire Cargo workspace in code — connectors, models, plays, tools,
|
|
4
|
-
agents, MCP servers, context, folders, files, workers
|
|
5
|
-
declaratively, the same way you'd manage cloud
|
|
6
|
-
AWS CDK. For a complete overview, see the
|
|
4
|
+
agents, MCP servers, context, capacities, territories, folders, files, workers
|
|
5
|
+
and apps — and deploy it declaratively, the same way you'd manage cloud
|
|
6
|
+
infrastructure with Pulumi or the AWS CDK. For a complete overview, see the
|
|
7
|
+
[Cargo CDK docs](https://docs.getcargo.ai/cdk/overview).
|
|
7
8
|
|
|
8
9
|
## Requirements
|
|
9
10
|
|
|
@@ -119,8 +120,8 @@ export const sdr = defineAgent("sdr", {
|
|
|
119
120
|
```
|
|
120
121
|
|
|
121
122
|
See [Defining Resources](https://docs.getcargo.ai/cdk/resources) for every
|
|
122
|
-
builder (connectors, models, plays, tools, agents, MCP servers, context,
|
|
123
|
-
files, workers, apps) and the slug rules.
|
|
123
|
+
builder (connectors, models, plays, tools, agents, MCP servers, context,
|
|
124
|
+
capacities, territories, folders, files, workers, apps) and the slug rules.
|
|
124
125
|
|
|
125
126
|
### Context
|
|
126
127
|
|
package/build/src/core.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type Token = {
|
|
|
5
5
|
};
|
|
6
6
|
export declare function token(resourceId: string, field: string): Token;
|
|
7
7
|
export declare function isToken(value: unknown): value is Token;
|
|
8
|
-
export type ResourceKind = "connector" | "model" | "agent" | "play" | "tool" | "mcpServer" | "folder" | "file" | "worker" | "app" | "context";
|
|
8
|
+
export type ResourceKind = "connector" | "model" | "agent" | "play" | "tool" | "mcpServer" | "folder" | "file" | "worker" | "app" | "context" | "capacity" | "territory";
|
|
9
9
|
export type ResourceNode = {
|
|
10
10
|
readonly id: string;
|
|
11
11
|
readonly kind: ResourceKind;
|
package/build/src/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,wBAAgB,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,CAE9D;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,CAMtD;AAGD,MAAM,MAAM,YAAY,GACpB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EpC;AAgCD,gFAAgF;AAChF,wBAAgB,UAAU,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAMnE;AAGD,gFAAgF;AAChF,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,GAAG,GAAE,GAAG,CAAC,MAAM,CAAa,GAC3B,GAAG,CAAC,MAAM,CAAC,CAcb;AAED,oFAAoF;AACpF,wBAAgB,aAAa,CAC3B,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAC3C,OAAO,CAoBT;AAGD;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGxC;AAED;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAE9C;AAED;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GACrB,SAAS,GACT;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,WAAW,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAM3D;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAmBtD"}
|
|
@@ -38,6 +38,12 @@ export type Executors = {
|
|
|
38
38
|
context(spec: Record<string, unknown>, prior: StateEntry | undefined): Promise<Outputs & {
|
|
39
39
|
uuid: string;
|
|
40
40
|
}>;
|
|
41
|
+
capacity(spec: Record<string, unknown>, prior: StateEntry | undefined): Promise<Outputs & {
|
|
42
|
+
uuid: string;
|
|
43
|
+
}>;
|
|
44
|
+
territory(spec: Record<string, unknown>, prior: StateEntry | undefined): Promise<Outputs & {
|
|
45
|
+
uuid: string;
|
|
46
|
+
}>;
|
|
41
47
|
};
|
|
42
48
|
export type ApplyResult = {
|
|
43
49
|
state: State;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../../src/deploy/apply.ts"],"names":[],"mappings":"AAgBA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,KAAK,EACV,KAAK,UAAU,EAChB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAK7C,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,CACP,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,KAAK,EAAE,UAAU,GAAG,SAAS,GAC5B,OAAO,CAAC,OAAO,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5D,KAAK,CACH,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,KAAK,EAAE,UAAU,GAAG,SAAS,GAC5B,OAAO,CAAC,OAAO,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACvC,KAAK,CACH,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,KAAK,EAAE,UAAU,GAAG,SAAS,GAC5B,OAAO,CAAC,OAAO,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACvC,IAAI,CACF,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,KAAK,EAAE,UAAU,GAAG,SAAS,GAC5B,OAA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AE,SAAS,EAAE,CAAC;IACrB,OAAO,EAAE,SAAS,EAAE,CAAC;CACtB,CAAC;AAMF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAwBF,wBAAsB,KAAK,CACzB,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,EAChC,OAAO,CAAC,EAAE,WAAW,EACrB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,GAC1C,OAAO,CAAC,WAAW,CAAC,CA6HtB"}
|
|
@@ -215,5 +215,9 @@ function runExecutor(node, resolved, prior, executors) {
|
|
|
215
215
|
return executors.app(resolved, prior);
|
|
216
216
|
case "context":
|
|
217
217
|
return executors.context(resolved, prior);
|
|
218
|
+
case "capacity":
|
|
219
|
+
return executors.capacity(resolved, prior);
|
|
220
|
+
case "territory":
|
|
221
|
+
return executors.territory(resolved, prior);
|
|
218
222
|
}
|
|
219
223
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"destroy.d.ts","sourceRoot":"","sources":["../../../src/deploy/destroy.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAMzC,MAAM,MAAM,aAAa,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"destroy.d.ts","sourceRoot":"","sources":["../../../src/deploy/destroy.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAMzC,MAAM,MAAM,aAAa,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAwGtE;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,MAAM,EAAE,GACZ,OAAO,CAAC,aAAa,CAAC,CA4BxB;AAED;;;GAGG;AACH,wBAAsB,OAAO,CAC3B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,GAAG,EACR,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GAC7B,OAAO,CAAC,aAAa,CAAC,CA4BxB"}
|
|
@@ -10,6 +10,8 @@ import { readState, writeState } from "./state.js";
|
|
|
10
10
|
// before per-resource deps were tracked.
|
|
11
11
|
const REMOVE_ORDER = [
|
|
12
12
|
"context",
|
|
13
|
+
"capacity",
|
|
14
|
+
"territory",
|
|
13
15
|
"play",
|
|
14
16
|
"agent",
|
|
15
17
|
"mcpServer",
|
|
@@ -89,6 +91,10 @@ async function remove(api, kind, uuid) {
|
|
|
89
91
|
// (and `defineContext` is additive) — destroy just drops it from state,
|
|
90
92
|
// never deleting repo files.
|
|
91
93
|
return;
|
|
94
|
+
case "capacity":
|
|
95
|
+
return api.revenueOrganization.capacity.remove(uuid);
|
|
96
|
+
case "territory":
|
|
97
|
+
return api.revenueOrganization.territory.remove(uuid);
|
|
92
98
|
}
|
|
93
99
|
}
|
|
94
100
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executors.live.d.ts","sourceRoot":"","sources":["../../../src/deploy/executors.live.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAIzC,OAAO,KAAK,EAAE,SAAS,EAAW,MAAM,YAAY,CAAC;AA4BrD,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"executors.live.d.ts","sourceRoot":"","sources":["../../../src/deploy/executors.live.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAIzC,OAAO,KAAK,EAAE,SAAS,EAAW,MAAM,YAAY,CAAC;AA4BrD,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,SAAS,CA2nBjD"}
|
|
@@ -515,8 +515,74 @@ export function liveExecutors(api) {
|
|
|
515
515
|
}
|
|
516
516
|
return { uuid: repository.uuid };
|
|
517
517
|
},
|
|
518
|
+
// A revenue-org capacity (allocation pool over a model). No slug → identity
|
|
519
|
+
// is prior.uuid; otherwise adopt an existing capacity by name.
|
|
520
|
+
async capacity(spec, prior) {
|
|
521
|
+
const name = str(spec["name"]);
|
|
522
|
+
const base = {
|
|
523
|
+
name,
|
|
524
|
+
color: spec["color"],
|
|
525
|
+
description: optStr(spec["description"]),
|
|
526
|
+
modelUuid: optStr(spec["modelUuid"]),
|
|
527
|
+
idColumnSlug: optStr(spec["idColumnSlug"]),
|
|
528
|
+
timeColumnSlug: optStr(spec["timeColumnSlug"]),
|
|
529
|
+
memberCapacity: (spec["memberCapacity"] ?? undefined),
|
|
530
|
+
allocationExpirationPolicy: (spec["allocationExpirationPolicy"] ??
|
|
531
|
+
undefined),
|
|
532
|
+
filter: (spec["filter"] ?? undefined),
|
|
533
|
+
};
|
|
534
|
+
if (prior !== undefined) {
|
|
535
|
+
await api.revenueOrganization.capacity.update({
|
|
536
|
+
uuid: prior.uuid,
|
|
537
|
+
...base,
|
|
538
|
+
filter: (spec["filter"] ?? null),
|
|
539
|
+
});
|
|
540
|
+
return carryAdopted({ uuid: prior.uuid }, prior);
|
|
541
|
+
}
|
|
542
|
+
const { capacities } = await api.revenueOrganization.capacity.all();
|
|
543
|
+
const found = capacities.find((c) => c.name === name);
|
|
544
|
+
if (found !== undefined) {
|
|
545
|
+
return { uuid: found.uuid, adopted: "true" };
|
|
546
|
+
}
|
|
547
|
+
const created = await api.revenueOrganization.capacity.create(base);
|
|
548
|
+
return { uuid: created.capacity.uuid };
|
|
549
|
+
},
|
|
550
|
+
// A revenue-org territory (member group). No slug → identity is prior.uuid;
|
|
551
|
+
// otherwise adopt an existing territory by label.
|
|
552
|
+
async territory(spec, prior) {
|
|
553
|
+
const label = str(spec["label"]);
|
|
554
|
+
const base = {
|
|
555
|
+
label,
|
|
556
|
+
color: spec["color"],
|
|
557
|
+
description: optStr(spec["description"]),
|
|
558
|
+
members: (spec["members"] ?? []),
|
|
559
|
+
fallbackMemberUuid: optStr(spec["fallbackMemberUuid"]),
|
|
560
|
+
};
|
|
561
|
+
if (prior !== undefined) {
|
|
562
|
+
await api.revenueOrganization.territory.update({
|
|
563
|
+
uuid: prior.uuid,
|
|
564
|
+
...base,
|
|
565
|
+
});
|
|
566
|
+
return carryAdopted({ uuid: prior.uuid }, prior);
|
|
567
|
+
}
|
|
568
|
+
const { territories } = await api.revenueOrganization.territory.all();
|
|
569
|
+
const found = territories.find((t) => t.label === label);
|
|
570
|
+
if (found !== undefined) {
|
|
571
|
+
return { uuid: found.uuid, adopted: "true" };
|
|
572
|
+
}
|
|
573
|
+
const created = await api.revenueOrganization.territory.create(base);
|
|
574
|
+
return { uuid: created.territory.uuid };
|
|
575
|
+
},
|
|
518
576
|
};
|
|
519
577
|
}
|
|
578
|
+
// Carry the "adopted" marker forward across an update so destroy keeps releasing
|
|
579
|
+
// (not deleting) a resource the CDK linked but didn't create.
|
|
580
|
+
function carryAdopted(out, prior) {
|
|
581
|
+
if (prior.outputs["adopted"] !== undefined) {
|
|
582
|
+
out["adopted"] = prior.outputs["adopted"];
|
|
583
|
+
}
|
|
584
|
+
return out;
|
|
585
|
+
}
|
|
520
586
|
// Tolerate a missing field (older/partial spec) by treating it as an empty list.
|
|
521
587
|
function arr(value) {
|
|
522
588
|
return value === undefined || value === null ? [] : value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readers.live.d.ts","sourceRoot":"","sources":["../../../src/deploy/readers.live.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAA8B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAoD5E,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"readers.live.d.ts","sourceRoot":"","sources":["../../../src/deploy/readers.live.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAA8B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAoD5E,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,WAAW,CAuQjD"}
|
|
@@ -269,5 +269,34 @@ export function liveReaders(api) {
|
|
|
269
269
|
async context(_entry) {
|
|
270
270
|
return present({});
|
|
271
271
|
},
|
|
272
|
+
async capacity(entry) {
|
|
273
|
+
try {
|
|
274
|
+
const { capacity } = await api.revenueOrganization.capacity.get(entry.uuid);
|
|
275
|
+
return present(pick(capacity, [
|
|
276
|
+
"name",
|
|
277
|
+
"color",
|
|
278
|
+
"description",
|
|
279
|
+
"modelUuid",
|
|
280
|
+
"memberCapacity",
|
|
281
|
+
]));
|
|
282
|
+
}
|
|
283
|
+
catch (error) {
|
|
284
|
+
return goneOrThrow(error);
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
async territory(entry) {
|
|
288
|
+
try {
|
|
289
|
+
const { territory } = await api.revenueOrganization.territory.get(entry.uuid);
|
|
290
|
+
return present(pick(territory, [
|
|
291
|
+
"label",
|
|
292
|
+
"color",
|
|
293
|
+
"description",
|
|
294
|
+
"fallbackMemberUuid",
|
|
295
|
+
]));
|
|
296
|
+
}
|
|
297
|
+
catch (error) {
|
|
298
|
+
return goneOrThrow(error);
|
|
299
|
+
}
|
|
300
|
+
},
|
|
272
301
|
};
|
|
273
302
|
}
|
package/build/src/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ export type { ActionOptions, AgentHandle, AgentSpec, AgentUse, ConnectorActionSp
|
|
|
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";
|
|
5
|
+
export type { AllocationExpirationPolicy, CapacityColor, CapacityHandle, CapacitySpec, } from "./resources/capacity.js";
|
|
6
|
+
export { defineCapacity } from "./resources/capacity.js";
|
|
5
7
|
export type { ConnectorConfigs, ConnectorHandle, ConnectorSpec, } from "./resources/connector.js";
|
|
6
8
|
export { defineConnector } from "./resources/connector.js";
|
|
7
9
|
export type { ContextHandle, ContextSpec } from "./resources/context.js";
|
|
@@ -16,6 +18,8 @@ export type { ExtractorConfigs, ModelHandle, ModelSpec, } from "./resources/mode
|
|
|
16
18
|
export { defineModel } from "./resources/model.js";
|
|
17
19
|
export type { PlayHandle, PlaySpec } from "./resources/play.js";
|
|
18
20
|
export { definePlay } from "./resources/play.js";
|
|
21
|
+
export type { TerritoryColor, TerritoryHandle, TerritoryMemberSpec, TerritorySpec, } from "./resources/territory.js";
|
|
22
|
+
export { defineTerritory } from "./resources/territory.js";
|
|
19
23
|
export type { ToolHandle, ToolSpec, ToolTriggerSpec, WorkflowDefinition, } from "./resources/tool.js";
|
|
20
24
|
export { defineTool } from "./resources/tool.js";
|
|
21
25
|
export type { WorkerHandle, WorkerSpec } from "./resources/worker.js";
|
|
@@ -24,7 +28,7 @@ export { createWorker, OpenAPIRoute } from "@cargo-ai/worker-sdk";
|
|
|
24
28
|
export { agentRef, defineWorkflow, toolRef, type WorkflowResourceRef, } from "@cargo-ai/workflow-sdk";
|
|
25
29
|
export type { EncryptionRef, ResourceKind, ResourceNode, SecretRef, Token, } from "./core.js";
|
|
26
30
|
export { env, isSecret, isToken, resolveSecrets, secret, token, } from "./core.js";
|
|
27
|
-
export type { AgentRef, ConnectorRef, DatasetRef, FolderRef, ModelRef, PlayRef, ResourceRef, ToolRef, } from "./refs.js";
|
|
28
|
-
export { connectorRef, datasetRef, folderRef, modelRef, playRef, refUuid, } from "./refs.js";
|
|
31
|
+
export type { AgentRef, ConnectorRef, DatasetRef, FolderRef, MemberRef, ModelRef, PlayRef, ResourceRef, ToolRef, } from "./refs.js";
|
|
32
|
+
export { connectorRef, datasetRef, folderRef, memberRef, modelRef, playRef, refUuid, } from "./refs.js";
|
|
29
33
|
export * from "./deploy/index.js";
|
|
30
34
|
//# 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,mBAAmB,EACnB,YAAY,EACZ,QAAQ,EACR,OAAO,GACR,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,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,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,YAAY,EACV,YAAY,EACZ,UAAU,EACV,UAAU,GACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,uBA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,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,YAAY,EACV,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,aAAa,GACd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,YAAY,EACV,UAAU,EACV,QAAQ,EACR,eAAe,EACf,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;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,OAAO,EACP,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,YAAY,EACZ,UAAU,EACV,SAAS,EACT,SAAS,EACT,QAAQ,EACR,OAAO,EACP,WAAW,EACX,OAAO,GACR,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,YAAY,EACZ,UAAU,EACV,SAAS,EACT,SAAS,EACT,QAAQ,EACR,OAAO,EACP,OAAO,GACR,MAAM,WAAW,CAAC;AAGnB,cAAc,mBAAmB,CAAC"}
|
package/build/src/index.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
// SDKs are re-exported so they're reachable from the same import.
|
|
9
9
|
export { defineAgent } from "./resources/agent.js";
|
|
10
10
|
export { defineApp } from "./resources/app.js";
|
|
11
|
+
export { defineCapacity } from "./resources/capacity.js";
|
|
11
12
|
export { defineConnector } from "./resources/connector.js";
|
|
12
13
|
export { defineContext } from "./resources/context.js";
|
|
13
14
|
export { defineFile } from "./resources/file.js";
|
|
@@ -15,6 +16,7 @@ export { defineFolder } from "./resources/folder.js";
|
|
|
15
16
|
export { defineMcpServer } from "./resources/mcpServer.js";
|
|
16
17
|
export { defineModel } from "./resources/model.js";
|
|
17
18
|
export { definePlay } from "./resources/play.js";
|
|
19
|
+
export { defineTerritory } from "./resources/territory.js";
|
|
18
20
|
export { defineTool } from "./resources/tool.js";
|
|
19
21
|
export { defineWorker } from "./resources/worker.js";
|
|
20
22
|
export { createWorker, OpenAPIRoute } from "@cargo-ai/worker-sdk";
|
|
@@ -25,6 +27,6 @@ export { createWorker, OpenAPIRoute } from "@cargo-ai/worker-sdk";
|
|
|
25
27
|
// types stay in `@cargo-ai/workflow-sdk`.
|
|
26
28
|
export { agentRef, defineWorkflow, toolRef, } from "@cargo-ai/workflow-sdk";
|
|
27
29
|
export { env, isSecret, isToken, resolveSecrets, secret, token, } from "./core.js";
|
|
28
|
-
export { connectorRef, datasetRef, folderRef, modelRef, playRef, refUuid, } from "./refs.js";
|
|
30
|
+
export { connectorRef, datasetRef, folderRef, memberRef, modelRef, playRef, refUuid, } from "./refs.js";
|
|
29
31
|
// ── deployment: plan + apply ─────────────────────────────────────────────────
|
|
30
32
|
export * from "./deploy/index.js";
|
package/build/src/refs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Token } from "./core.js";
|
|
2
|
-
export type ResourceKindRef = "connector" | "dataset" | "model" | "folder" | "play" | "tool" | "agent";
|
|
2
|
+
export type ResourceKindRef = "connector" | "dataset" | "model" | "folder" | "play" | "tool" | "agent" | "member";
|
|
3
3
|
export type ResourceRef<K extends ResourceKindRef = ResourceKindRef> = {
|
|
4
4
|
readonly uuid: Token | string;
|
|
5
5
|
readonly resource: K;
|
|
@@ -11,6 +11,7 @@ export type FolderRef = ResourceRef<"folder">;
|
|
|
11
11
|
export type PlayRef = ResourceRef<"play">;
|
|
12
12
|
export type ToolRef = ResourceRef<"tool">;
|
|
13
13
|
export type AgentRef = ResourceRef<"agent">;
|
|
14
|
+
export type MemberRef = ResourceRef<"member">;
|
|
14
15
|
/** Reference a connector by uuid (e.g. an adopted OAuth connector). */
|
|
15
16
|
export declare const connectorRef: (uuid: string) => ConnectorRef;
|
|
16
17
|
/** Reference a connector's auto-created dataset by uuid, for `defineModel`. */
|
|
@@ -21,6 +22,8 @@ export declare const modelRef: (uuid: string) => ModelRef;
|
|
|
21
22
|
export declare const folderRef: (uuid: string) => FolderRef;
|
|
22
23
|
/** Reference a play by uuid (e.g. a `dependency` schedule's upstream play). */
|
|
23
24
|
export declare const playRef: (uuid: string) => PlayRef;
|
|
25
|
+
/** Reference a workspace member (user) by uuid — for territories/capacities. */
|
|
26
|
+
export declare const memberRef: (uuid: string) => MemberRef;
|
|
24
27
|
/** Extract the uuid from a handle or ref (both carry `uuid`). */
|
|
25
28
|
export declare const refUuid: (ref: {
|
|
26
29
|
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,CAAC;
|
|
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,GAC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,GAAG,MACtD,CAAC"}
|
package/build/src/refs.js
CHANGED
|
@@ -28,6 +28,11 @@ export const folderRef = (uuid) => ({
|
|
|
28
28
|
});
|
|
29
29
|
/** Reference a play by uuid (e.g. a `dependency` schedule's upstream play). */
|
|
30
30
|
export const playRef = (uuid) => ({ uuid, resource: "play" });
|
|
31
|
+
/** Reference a workspace member (user) by uuid — for territories/capacities. */
|
|
32
|
+
export const memberRef = (uuid) => ({
|
|
33
|
+
uuid,
|
|
34
|
+
resource: "member",
|
|
35
|
+
});
|
|
31
36
|
// `toolRef` / `agentRef` are re-exported from `@cargo-ai/workflow-sdk` — their
|
|
32
37
|
// `WorkflowResourceRef` is structurally a `ResourceRef<"tool" | "agent">`.
|
|
33
38
|
/** Extract the uuid from a handle or ref (both carry `uuid`). */
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { RevenueOrganizationTypes, SegmentationTypes } from "@cargo-ai/types";
|
|
2
|
+
import { type Token } from "../core.js";
|
|
3
|
+
import { type ModelRef } from "../refs.js";
|
|
4
|
+
import type { ModelHandle } from "./model.js";
|
|
5
|
+
export type CapacityColor = RevenueOrganizationTypes.CapacityColor;
|
|
6
|
+
export type AllocationExpirationPolicy = RevenueOrganizationTypes.AllocationExpirationPolicy;
|
|
7
|
+
export type CapacitySpec = {
|
|
8
|
+
name?: string;
|
|
9
|
+
/** Icon colour. Defaults to "grey". */
|
|
10
|
+
color?: CapacityColor;
|
|
11
|
+
description?: string;
|
|
12
|
+
/** The data model this capacity allocates over — a model handle or `modelRef`. */
|
|
13
|
+
model?: ModelHandle | ModelRef;
|
|
14
|
+
/** Column identifying each record (its stable id). */
|
|
15
|
+
idColumnSlug?: string;
|
|
16
|
+
/** Column the allocation is timed against. */
|
|
17
|
+
timeColumnSlug?: string;
|
|
18
|
+
/** Max concurrent allocations per member. */
|
|
19
|
+
memberCapacity?: number;
|
|
20
|
+
/** When an allocation expires and returns to the pool. */
|
|
21
|
+
allocationExpirationPolicy?: AllocationExpirationPolicy;
|
|
22
|
+
/** Which records are eligible. */
|
|
23
|
+
filter?: SegmentationTypes.Filter;
|
|
24
|
+
};
|
|
25
|
+
export type CapacityHandle = {
|
|
26
|
+
readonly slug: string;
|
|
27
|
+
readonly uuid: Token;
|
|
28
|
+
readonly resource: "capacity";
|
|
29
|
+
};
|
|
30
|
+
export declare function defineCapacity(slug: string, spec: CapacitySpec): CapacityHandle;
|
|
31
|
+
//# sourceMappingURL=capacity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capacity.d.ts","sourceRoot":"","sources":["../../../src/resources/capacity.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,wBAAwB,EACxB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAwB,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,KAAK,QAAQ,EAAW,MAAM,YAAY,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,MAAM,aAAa,GAAG,wBAAwB,CAAC,aAAa,CAAC;AACnE,MAAM,MAAM,0BAA0B,GACpC,wBAAwB,CAAC,0BAA0B,CAAC;AAEtD,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kFAAkF;IAClF,KAAK,CAAC,EAAE,WAAW,GAAG,QAAQ,CAAC;IAC/B,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8CAA8C;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,6CAA6C;IAC7C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,0DAA0D;IAC1D,0BAA0B,CAAC,EAAE,0BAA0B,CAAC;IACxD,kCAAkC;IAClC,MAAM,CAAC,EAAE,iBAAiB,CAAC,MAAM,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;CAC/B,CAAC;AAEF,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,YAAY,GACjB,cAAc,CAyBhB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// defineCapacity — a revenue-organization capacity: a workload-allocation pool
|
|
2
|
+
// over a data model (round-robins records across members, subject to per-member
|
|
3
|
+
// limits and an expiration policy). References its `model` by handle. Uuid-only
|
|
4
|
+
// identity (no slug) — state-tracked, adopted by name. Compiles to the
|
|
5
|
+
// revenue-organization `CreateCapacityPayload`.
|
|
6
|
+
import { register, resourceId, token } from "../core.js";
|
|
7
|
+
import { refUuid } from "../refs.js";
|
|
8
|
+
export function defineCapacity(slug, spec) {
|
|
9
|
+
const id = resourceId("capacity", slug);
|
|
10
|
+
register({
|
|
11
|
+
id,
|
|
12
|
+
kind: "capacity",
|
|
13
|
+
slug,
|
|
14
|
+
spec: {
|
|
15
|
+
slug,
|
|
16
|
+
name: spec.name === undefined ? toTitle(slug) : spec.name,
|
|
17
|
+
color: spec.color === undefined ? "grey" : spec.color,
|
|
18
|
+
description: spec.description === undefined ? null : spec.description,
|
|
19
|
+
modelUuid: spec.model === undefined ? null : refUuid(spec.model),
|
|
20
|
+
idColumnSlug: spec.idColumnSlug === undefined ? null : spec.idColumnSlug,
|
|
21
|
+
timeColumnSlug: spec.timeColumnSlug === undefined ? null : spec.timeColumnSlug,
|
|
22
|
+
memberCapacity: spec.memberCapacity === undefined ? null : spec.memberCapacity,
|
|
23
|
+
allocationExpirationPolicy: spec.allocationExpirationPolicy === undefined
|
|
24
|
+
? null
|
|
25
|
+
: spec.allocationExpirationPolicy,
|
|
26
|
+
filter: spec.filter === undefined ? null : spec.filter,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
return { slug, uuid: token(id, "uuid"), resource: "capacity" };
|
|
30
|
+
}
|
|
31
|
+
function toTitle(slug) {
|
|
32
|
+
return slug
|
|
33
|
+
.split(/[-_]/)
|
|
34
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
35
|
+
.join(" ");
|
|
36
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { RevenueOrganizationTypes } from "@cargo-ai/types";
|
|
2
|
+
import { type Token } from "../core.js";
|
|
3
|
+
import { type MemberRef } from "../refs.js";
|
|
4
|
+
export type TerritoryColor = RevenueOrganizationTypes.TerritoryColor;
|
|
5
|
+
/** A member of a territory — referenced by `memberRef(uuid)`, with a routing weight. */
|
|
6
|
+
export type TerritoryMemberSpec = {
|
|
7
|
+
ref: MemberRef;
|
|
8
|
+
/** Routing weight (relative share of assignments). */
|
|
9
|
+
weight?: number;
|
|
10
|
+
};
|
|
11
|
+
export type TerritorySpec = {
|
|
12
|
+
label?: string;
|
|
13
|
+
/** Icon colour. Defaults to "grey". */
|
|
14
|
+
color?: TerritoryColor;
|
|
15
|
+
description?: string;
|
|
16
|
+
members?: TerritoryMemberSpec[];
|
|
17
|
+
/** Member assignments fall back to when no other rule matches. */
|
|
18
|
+
fallback?: MemberRef;
|
|
19
|
+
};
|
|
20
|
+
export type TerritoryHandle = {
|
|
21
|
+
readonly slug: string;
|
|
22
|
+
readonly uuid: Token;
|
|
23
|
+
readonly resource: "territory";
|
|
24
|
+
};
|
|
25
|
+
export declare function defineTerritory(slug: string, spec: TerritorySpec): TerritoryHandle;
|
|
26
|
+
//# sourceMappingURL=territory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"territory.d.ts","sourceRoot":"","sources":["../../../src/resources/territory.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EAAwB,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,KAAK,SAAS,EAAW,MAAM,YAAY,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG,wBAAwB,CAAC,cAAc,CAAC;AAErE,wFAAwF;AACxF,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,EAAE,SAAS,CAAC;IACf,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAChC,kEAAkE;IAClE,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;CAChC,CAAC;AAEF,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,aAAa,GAClB,eAAe,CAoBjB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// defineTerritory — a revenue-organization territory: a named group of members
|
|
2
|
+
// (with routing weights) plus an optional fallback member. Members are workspace
|
|
3
|
+
// users, not CDK resources, so they're referenced by `memberRef(uuid)`. Uuid-only
|
|
4
|
+
// identity (no slug) — state-tracked, adopted by label. Compiles to the
|
|
5
|
+
// revenue-organization `CreateTerritoryPayload`.
|
|
6
|
+
import { register, resourceId, token } from "../core.js";
|
|
7
|
+
import { refUuid } from "../refs.js";
|
|
8
|
+
export function defineTerritory(slug, spec) {
|
|
9
|
+
const id = resourceId("territory", slug);
|
|
10
|
+
register({
|
|
11
|
+
id,
|
|
12
|
+
kind: "territory",
|
|
13
|
+
slug,
|
|
14
|
+
spec: {
|
|
15
|
+
slug,
|
|
16
|
+
label: spec.label === undefined ? toTitle(slug) : spec.label,
|
|
17
|
+
color: spec.color === undefined ? "grey" : spec.color,
|
|
18
|
+
description: spec.description === undefined ? null : spec.description,
|
|
19
|
+
members: (spec.members === undefined ? [] : spec.members).map((m) => ({
|
|
20
|
+
uuid: refUuid(m.ref),
|
|
21
|
+
weight: m.weight === undefined ? null : m.weight,
|
|
22
|
+
})),
|
|
23
|
+
fallbackMemberUuid: spec.fallback === undefined ? null : refUuid(spec.fallback),
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
return { slug, uuid: token(id, "uuid"), resource: "territory" };
|
|
27
|
+
}
|
|
28
|
+
function toTitle(slug) {
|
|
29
|
+
return slug
|
|
30
|
+
.split(/[-_]/)
|
|
31
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
32
|
+
.join(" ");
|
|
33
|
+
}
|