@trillioncore/cli 1.0.0-next.10 → 1.0.0-next.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +42 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3682,6 +3682,14 @@ var INTEGRATION_PROVIDER_DEFINITIONS = {
3682
3682
  modelVisibility: "declared",
3683
3683
  identity: { source: "externalAccountId", kind: "email", prefix: "", unavailable: "Account email unavailable" }
3684
3684
  },
3685
+ slack: {
3686
+ // Slack workspace identity is retained in the Airbyte binding. The visible local account
3687
+ // identifier is deliberately unique so an organization can keep separate connections.
3688
+ description: "Slack channels and messages",
3689
+ nativeRecordKinds: [],
3690
+ modelVisibility: "declared",
3691
+ identity: { source: "unavailable", unavailable: "Slack workspace identity unavailable" }
3692
+ },
3685
3693
  postgres: {
3686
3694
  // Legacy stored projections remain discoverable; tables use approved manifests.
3687
3695
  description: "PostgreSQL tables",
@@ -3711,7 +3719,7 @@ function integrationProviderDefinition(provider) {
3711
3719
  }
3712
3720
 
3713
3721
  // ../../packages/types/dist/agent.js
3714
- var AGENT_SOURCE_TYPES = ["fathom", "fireflies", "harvest", "outlook", "gmail", "postgres", "github", "google_analytics"];
3722
+ var AGENT_SOURCE_TYPES = ["fathom", "fireflies", "harvest", "outlook", "gmail", "slack", "postgres", "github", "google_analytics"];
3715
3723
  var AGENT_SEARCH_FILTER_TYPES = [...AGENT_SOURCE_TYPES, "email"];
3716
3724
  function presentAgentIndex(result, resourceKey) {
3717
3725
  if (resourceKey !== void 0)
@@ -3908,6 +3916,7 @@ function agentHelp(primitive) {
3908
3916
  },
3909
3917
  { name: "create-document", description: "Create a native Markdown/JSON document private to its creator using --organization, --path, --format and --file (UTF8). Requires document read/write opt-in. No integration writes." },
3910
3918
  { name: "update-document", description: "Replace the whole native document text using --ref and --file (UTF8); optional --path/--format/--description. Ref survives path changes. Requires document read/write opt-in." },
3919
+ { name: "act", description: "Perform one provider action on an authorized account, such as sending an email. Syntax: tc act <account-id> <action> --input '<json>' --organization <org-id>. tc index on the account lists its actions and input fields. Requires the connection's actions opt-in (Settings) and the account's admin-granted permission. Actions cannot be undone; confirm with the user before sending to other people." },
3911
3920
  { name: "help", description: "Show supported CLI primitives." }
3912
3921
  ];
3913
3922
  if (!primitive)
@@ -4058,7 +4067,8 @@ async function request(command, path, init, input) {
4058
4067
  }
4059
4068
  if (!response.ok) {
4060
4069
  const authenticationFailure = response.status === 401 || response.status === 403;
4061
- const envelope = authenticationFailure ? null : parseErrorEnvelope(body);
4070
+ const actionMessage = command === "act" && authenticationFailure ? body?.error?.message : void 0;
4071
+ const envelope = typeof actionMessage === "string" ? agentError("forbidden", actionMessage.slice(0, 300)) : authenticationFailure ? null : parseErrorEnvelope(body);
4062
4072
  throw new CliAgentError(
4063
4073
  envelope ?? agentError(
4064
4074
  authenticationFailure ? "forbidden" : response.status === 404 ? "not_found" : "unavailable",
@@ -4246,6 +4256,22 @@ async function writeDocument(command, input) {
4246
4256
  }, input);
4247
4257
  }
4248
4258
  var createDocument = (input) => writeDocument("create-document", input);
4259
+ async function act(input) {
4260
+ let value;
4261
+ try {
4262
+ value = JSON.parse(input.input);
4263
+ } catch {
4264
+ throw new CliAgentError(agentError("invalid_input", "--input must be a JSON object of the action's fields."));
4265
+ }
4266
+ if (!value || typeof value !== "object" || Array.isArray(value)) throw new CliAgentError(agentError("invalid_input", "--input must be a JSON object of the action's fields."));
4267
+ const config = configuration(input);
4268
+ const parameters = new URLSearchParams();
4269
+ if (!config.pinned && input.organization) parameters.set("organizationId", input.organization);
4270
+ return request("act", config.pinned ? "/api/organizations/:organizationId/agent/act" : `/cli/act?${parameters}`, {
4271
+ method: "POST",
4272
+ body: JSON.stringify({ integrationAccountId: input.accountId, action: input.action, input: value })
4273
+ }, input);
4274
+ }
4249
4275
  var updateDocument = (input) => writeDocument("update-document", input);
4250
4276
  function help(primitive) {
4251
4277
  return agentHelp(primitive);
@@ -4320,6 +4346,10 @@ function renderIndex(result) {
4320
4346
  ])
4321
4347
  ];
4322
4348
  }),
4349
+ ...catalog.actions?.length ? [
4350
+ `Actions${catalog.actions.some((action) => !action.available) ? " (turn on actions for this connection in Settings to use)" : ""}: tc act ${accountIdFromPath(catalog.connectionRef) ?? "<account-id>"} <action> --input '<json>'`,
4351
+ ...catalog.actions.flatMap((action) => [` ${action.name}: ${action.description}`, ...Object.entries(action.input).map(([field, type]) => ` ${field}: ${type}`)])
4352
+ ] : [],
4323
4353
  // The catalog's own details line already names this account; add the generic one only without it.
4324
4354
  ...details.length ? details : ["Details: tc index <account-path> --resource-key <key>"],
4325
4355
  'Search every source at once: tc search "<words>" --grouped',
@@ -4564,6 +4594,7 @@ function createProgram(overrides = {}) {
4564
4594
  createDocument,
4565
4595
  updateDocument,
4566
4596
  agentRequestTraces,
4597
+ act,
4567
4598
  organizations,
4568
4599
  index,
4569
4600
  search,
@@ -4696,6 +4727,14 @@ ${AGENT_DISCOVERY_GUIDANCE}`).option("--organization <id>", "Target an approved
4696
4727
  }
4697
4728
  });
4698
4729
  }
4730
+ program2.command("act <account-id> <action>").description("Perform one provider action, such as gmail.send_email; tc index on the account lists its actions. Requires the connection's actions opt-in. Actions cannot be undone.").requiredOption("--input <json>", "JSON object of the action's input fields").option("--organization <id>", "Explicit approved organization; must match any configured pin").option("-j, --json", "Output shared DTO JSON").action(async (accountId, action, options) => {
4731
+ try {
4732
+ const result = await commands.act({ accountId, action, input: options.input, ...options.organization ? { organization: options.organization } : {} });
4733
+ writeResult(result, Boolean(options.json), JSON.stringify(result, null, 2));
4734
+ } catch (error) {
4735
+ writeError(error, Boolean(options.json));
4736
+ }
4737
+ });
4699
4738
  program2.command("help [primitive]").description("Show supported CLI primitives").option("-j, --json", "Output shared DTO JSON").action((primitive, options) => {
4700
4739
  const result = commands.help(primitive);
4701
4740
  if (isAgentError(result)) {
@@ -4710,7 +4749,7 @@ if (process.argv[1] !== void 0 && fileURLToPath(import.meta.url) === realpathSyn
4710
4749
  try {
4711
4750
  const program2 = createProgram();
4712
4751
  program2.hook("preAction", async (_program, command) => {
4713
- if (!["organizations", "index", "search", "get", "sql", "create-document", "update-document", "agent-request-traces"].includes(command.name())) return;
4752
+ if (!["organizations", "index", "search", "get", "sql", "create-document", "update-document", "act", "agent-request-traces"].includes(command.name())) return;
4714
4753
  const effective = await authenticatedEnvironment();
4715
4754
  for (const key of [
4716
4755
  "TRILLIONCORE_CLI_API_URL",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trillioncore/cli",
3
- "version": "1.0.0-next.10",
3
+ "version": "1.0.0-next.11",
4
4
  "description": "Trillioncore v1 CLI: sign in and read your authorized integration records",
5
5
  "type": "module",
6
6
  "license": "MIT",