@kaelen-ai/cli 0.1.16 → 0.1.17
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/dist/index.js +32 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1231,11 +1231,14 @@ function validateToolCapability(appName, resourceName, tool, errors, seenCapabil
|
|
|
1231
1231
|
errors.push(`tool "${expected}" capability mode does not match the tool mode`);
|
|
1232
1232
|
}
|
|
1233
1233
|
const audit = stringField2(capability, "audit");
|
|
1234
|
-
if (
|
|
1235
|
-
errors.push(`
|
|
1234
|
+
if (audit !== "finish_only" && audit !== "pre_call") {
|
|
1235
|
+
errors.push(`tool "${expected}" capability audit must be finish_only or pre_call`);
|
|
1236
1236
|
}
|
|
1237
|
-
if (mode === "
|
|
1238
|
-
errors.push(`
|
|
1237
|
+
if (mode === "write" && audit !== "pre_call") {
|
|
1238
|
+
errors.push(`write tool "${expected}" must use pre_call audit`);
|
|
1239
|
+
}
|
|
1240
|
+
if (mode === "read" && audit !== "finish_only") {
|
|
1241
|
+
errors.push(`read tool "${expected}" must use finish_only audit`);
|
|
1239
1242
|
}
|
|
1240
1243
|
const exposure = stringField2(capability, "credential_exposure");
|
|
1241
1244
|
if (exposure !== "none" && exposure !== "stdlib") {
|
|
@@ -2510,7 +2513,7 @@ function canonicalize(value) {
|
|
|
2510
2513
|
}
|
|
2511
2514
|
|
|
2512
2515
|
// src/build/catalog.ts
|
|
2513
|
-
var CATALOG_CONTRACT_VERSION = "io.
|
|
2516
|
+
var CATALOG_CONTRACT_VERSION = "io.catalog.v1";
|
|
2514
2517
|
var CATALOG_SNAPSHOT_VERSION = "io_runtime.snapshot.v2";
|
|
2515
2518
|
var WEBHOOK_RESOURCE_KIND = "webhook";
|
|
2516
2519
|
var PLATFORM_TOOL_KINDS = /* @__PURE__ */ new Set(["email", "calendar", "contacts"]);
|
|
@@ -4127,7 +4130,7 @@ function isPlainObject(value) {
|
|
|
4127
4130
|
}
|
|
4128
4131
|
function isCatalogShape(value) {
|
|
4129
4132
|
if (!isPlainObject(value)) return false;
|
|
4130
|
-
return value.contract_version === "io.
|
|
4133
|
+
return value.contract_version === "io.catalog.v1" && value.snapshot_version === "io_runtime.snapshot.v2" && typeof value.catalog_hash === "string" && isPlainObject(value.resources) && isPlainObject(value.signals) && isPlainObject(value.tools) && isPlainObject(value.schemas);
|
|
4131
4134
|
}
|
|
4132
4135
|
function isManifestShape(value) {
|
|
4133
4136
|
if (!isPlainObject(value)) return false;
|
|
@@ -4144,7 +4147,7 @@ function parseRemoteCatalog(catalogJson) {
|
|
|
4144
4147
|
}
|
|
4145
4148
|
if (!isCatalogShape(parsed)) {
|
|
4146
4149
|
throw new ConfigError(
|
|
4147
|
-
"Remote deployment catalog does not match the io.
|
|
4150
|
+
"Remote deployment catalog does not match the io.catalog.v1 catalog shape."
|
|
4148
4151
|
);
|
|
4149
4152
|
}
|
|
4150
4153
|
return parsed;
|
|
@@ -4192,6 +4195,15 @@ async function executeGraphQLUnauth(apiUrl, query, variables, headers = {}) {
|
|
|
4192
4195
|
}
|
|
4193
4196
|
return payload.data;
|
|
4194
4197
|
}
|
|
4198
|
+
function serializePrincipalInput(input) {
|
|
4199
|
+
return {
|
|
4200
|
+
...input.externalId !== void 0 ? { externalId: input.externalId } : {},
|
|
4201
|
+
...input.state !== void 0 ? {
|
|
4202
|
+
state: input.state.toUpperCase()
|
|
4203
|
+
} : {},
|
|
4204
|
+
...input.metadata !== void 0 ? { metadata: input.metadata } : {}
|
|
4205
|
+
};
|
|
4206
|
+
}
|
|
4195
4207
|
async function refreshAndSave(apiUrl, refreshToken) {
|
|
4196
4208
|
let data;
|
|
4197
4209
|
try {
|
|
@@ -4441,7 +4453,10 @@ function createClient(config) {
|
|
|
4441
4453
|
}
|
|
4442
4454
|
}
|
|
4443
4455
|
`,
|
|
4444
|
-
{
|
|
4456
|
+
{
|
|
4457
|
+
projectId: projectIdValue,
|
|
4458
|
+
input: serializePrincipalInput(input)
|
|
4459
|
+
}
|
|
4445
4460
|
);
|
|
4446
4461
|
return data.createPrincipal;
|
|
4447
4462
|
}
|
|
@@ -4460,7 +4475,11 @@ function createClient(config) {
|
|
|
4460
4475
|
}
|
|
4461
4476
|
}
|
|
4462
4477
|
`,
|
|
4463
|
-
{
|
|
4478
|
+
{
|
|
4479
|
+
projectId: projectIdValue,
|
|
4480
|
+
id,
|
|
4481
|
+
input: serializePrincipalInput(input)
|
|
4482
|
+
}
|
|
4464
4483
|
);
|
|
4465
4484
|
return data.updatePrincipal ?? null;
|
|
4466
4485
|
}
|
|
@@ -4644,7 +4663,6 @@ function createClient(config) {
|
|
|
4644
4663
|
eventName,
|
|
4645
4664
|
payloadJson: JSON.stringify(input.payload ?? {}),
|
|
4646
4665
|
metadataJson: JSON.stringify(input.metadata ?? {}),
|
|
4647
|
-
correlationId: input.correlationId,
|
|
4648
4666
|
causationId: input.causationId,
|
|
4649
4667
|
idempotencyKey: input.idempotencyKey,
|
|
4650
4668
|
sourceName: input.sourceName
|
|
@@ -6387,7 +6405,6 @@ async function signalEmitCommand(name, options) {
|
|
|
6387
6405
|
principalId: options.principalId,
|
|
6388
6406
|
payload,
|
|
6389
6407
|
metadata,
|
|
6390
|
-
correlationId: options.correlationId,
|
|
6391
6408
|
causationId: options.causationId,
|
|
6392
6409
|
idempotencyKey: options.idempotencyKey,
|
|
6393
6410
|
sourceName: options.sourceName
|
|
@@ -6516,7 +6533,7 @@ function isRecord4(value) {
|
|
|
6516
6533
|
}
|
|
6517
6534
|
function isCatalogShape2(value) {
|
|
6518
6535
|
if (!isRecord4(value)) return false;
|
|
6519
|
-
return value.contract_version === "io.
|
|
6536
|
+
return value.contract_version === "io.catalog.v1" && value.snapshot_version === "io_runtime.snapshot.v2" && typeof value.catalog_hash === "string" && isRecord4(value.resources) && isRecord4(value.signals) && isRecord4(value.tools) && isRecord4(value.schemas);
|
|
6520
6537
|
}
|
|
6521
6538
|
async function readLocalCatalog(buildDir) {
|
|
6522
6539
|
const path = resolve(process.cwd(), buildDir, "catalog.json");
|
|
@@ -6543,7 +6560,7 @@ async function readLocalCatalog(buildDir) {
|
|
|
6543
6560
|
}
|
|
6544
6561
|
if (!isCatalogShape2(parsed)) {
|
|
6545
6562
|
throw new CliError(
|
|
6546
|
-
`Local catalog at ${path} does not match the io.
|
|
6563
|
+
`Local catalog at ${path} does not match the io.catalog.v1 catalog shape.`,
|
|
6547
6564
|
"CATALOG_SHAPE_MISMATCH"
|
|
6548
6565
|
);
|
|
6549
6566
|
}
|
|
@@ -6664,7 +6681,7 @@ async function catalogShowCommand(options) {
|
|
|
6664
6681
|
|
|
6665
6682
|
// src/index.ts
|
|
6666
6683
|
var program = new Command();
|
|
6667
|
-
program.name("io").description("IO CLI \u2014 build and deploy behaviors").version("0.1.
|
|
6684
|
+
program.name("io").description("IO CLI \u2014 build and deploy behaviors").version("0.1.17");
|
|
6668
6685
|
program.command("init").description("Initialize io.config.json for the current project").option("--yes", "Overwrite existing config without prompting").action(initCommand);
|
|
6669
6686
|
program.command("build").description("Build behaviors from the io/ directory").option("--dir <path>", "Source directory", "io").option("--minify", "Minify bundles", false).action(buildCommand);
|
|
6670
6687
|
program.command("deploy").description("Build and package for deployment").option("--dir <path>", "Source directory", "io").option("--no-minify", "Skip minification").option("--yes", "Skip confirmation prompt").option("--watch", "Tail deployment status until it reaches a terminal state").action(deployCommand);
|
|
@@ -6685,7 +6702,7 @@ principals.command("create <external-id>").description("Create a principal in th
|
|
|
6685
6702
|
principals.command("update <id>").description("Update a principal").option("--project-id <id>", "Override the configured project ID").option("--external-id <external-id>", "Replace the external ID").option("--state <state>", "Principal state: active, inactive, or archived").option("--metadata <json>", "Replace principal metadata with a JSON object").action(principalsUpdateCommand);
|
|
6686
6703
|
principals.command("delete <id>").description("Delete a principal").option("--project-id <id>", "Override the configured project ID").action(principalsDeleteCommand);
|
|
6687
6704
|
var signals = program.command("signals").description("Emit runtime signals");
|
|
6688
|
-
signals.command("emit <name>").description("Emit a signal into the active project's event stream").option("--payload <json>", "Signal payload as a JSON object", "{}").option("--metadata <json>", "Signal metadata as a JSON object", "{}").option("--project-id <id>", "Override the configured project ID").requiredOption("--principal-id <id>", "Project principal ID for the emitted signal").option("--
|
|
6705
|
+
signals.command("emit <name>").description("Emit a signal into the active project's event stream").option("--payload <json>", "Signal payload as a JSON object", "{}").option("--metadata <json>", "Signal metadata as a JSON object", "{}").option("--project-id <id>", "Override the configured project ID").requiredOption("--principal-id <id>", "Project principal ID for the emitted signal").option("--causation-id <id>", "Causation ID to attach to the signal").option("--idempotency-key <key>", "Optional idempotency key").option("--source-name <name>", "Optional source name for the emitted signal").option("--json", "Print the raw emitted event as JSON", false).action(signalEmitCommand);
|
|
6689
6706
|
program.command("quota").description("Show current quota usage for the active organization").action(quotaCommand);
|
|
6690
6707
|
program.command("logs").description("Show recent activity events").option("--limit <count>", "Number of events to show", "50").option("--type <types...>", "Filter by event types").option("--since <duration>", "Show events since (e.g. 15m, 1h, 7d)").option("--follow", "Tail events in real-time").action(logsCommand);
|
|
6691
6708
|
program.command("reconcile").description("Force runtime to reconcile resources for the active project").option("--project-id <id>", "Override the configured project ID").option("--watch", "Tail activity events after the reconcile request").action(reconcileCommand);
|