@apotech-os/cli 7.0.0 → 7.2.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/README.md CHANGED
@@ -93,7 +93,7 @@ apotech-os data list _core/shopify-order --filter '{"name":{"contains":"1001"}}'
93
93
 
94
94
  `--filter` / `--search` / `--sort` are the server's own JSON grammar, passed
95
95
  through untouched; operators are `eq neq contains ncontains gt lt gte lte empty
96
- nempty`. `--limit` is a total row count (default 50, max 1000) — the command
96
+ nempty in` (`in` takes an array of at most 500 values). `--limit` is a total row count (default 50, max 1000) — the command
97
97
  pages for you. `--json` prints the raw `{items, nextCursor}` envelope, which is
98
98
  what a script or an agent should read.
99
99
 
package/dist/index.js CHANGED
@@ -7382,11 +7382,11 @@ function createPattern(matcher) {
7382
7382
  if (matcher.path === string4)
7383
7383
  return true;
7384
7384
  if (matcher.recursive) {
7385
- const relative3 = sysPath2.relative(matcher.path, string4);
7386
- if (!relative3) {
7385
+ const relative4 = sysPath2.relative(matcher.path, string4);
7386
+ if (!relative4) {
7387
7387
  return false;
7388
7388
  }
7389
- return !relative3.startsWith("..") && !sysPath2.isAbsolute(relative3);
7389
+ return !relative4.startsWith("..") && !sysPath2.isAbsolute(relative4);
7390
7390
  }
7391
7391
  return false;
7392
7392
  };
@@ -22671,7 +22671,8 @@ var VIEW_FILTER_OPS = [
22671
22671
  "gte",
22672
22672
  "lte",
22673
22673
  "empty",
22674
- "nempty"
22674
+ "nempty",
22675
+ "in"
22675
22676
  ];
22676
22677
  var ViewFilterSchema = external_exports.object({
22677
22678
  field: external_exports.string(),
@@ -22827,6 +22828,21 @@ var FunctionTriggerSchema = external_exports.discriminatedUnion("type", [
22827
22828
  * treated as exposing the function to no other app.
22828
22829
  */
22829
22830
  exposedToApps: external_exports.array(external_exports.string()).optional()
22831
+ }),
22832
+ /**
22833
+ * A read-only tool the OS exposes over its MCP server. Never wired to an
22834
+ * Inngest event, cron or HTTP route: it is invoked synchronously, by the OS
22835
+ * only, with a derived token (no writes, capabilities, integrations, prompts
22836
+ * or variables). Its exposed name is the function name with `-` replaced by `_`.
22837
+ */
22838
+ external_exports.object({
22839
+ type: external_exports.literal("mcpTool"),
22840
+ /** What the MCP client shows to the model and the user. */
22841
+ description: external_exports.string().min(1),
22842
+ /** Mandatory literal in v1; documents the intent, the platform enforces it. */
22843
+ readOnly: external_exports.literal(true),
22844
+ /** `false` marks an internal tool only the OS calls (never listed over MCP). */
22845
+ exposed: external_exports.boolean().optional()
22830
22846
  })
22831
22847
  ]);
22832
22848
  var FunctionDefFieldsSchema = external_exports.object({
@@ -22872,12 +22888,13 @@ var FunctionDefFieldsSchema = external_exports.object({
22872
22888
  severity: external_exports.enum(["info", "warning", "critical"]).optional()
22873
22889
  }).optional(),
22874
22890
  /**
22875
- * Lot 4 — Optional input schema for the two triggers whose payload is caller-
22876
- * controlled rather than platform-shaped: `uiInvoke` (a browser session) and
22877
- * `httpRoute` (an external HTTP caller). Reuses the same `FieldDef` vocabulary
22878
- * as `records[].fields` and `settings.fields` — a deliberate decision to keep
22879
- * one field vocabulary across the whole contract instead of adding a second,
22880
- * more expressive free-form JSON Schema surface (see spec "Décisions prises").
22891
+ * Lot 4 — Optional input schema for the triggers whose payload is caller-
22892
+ * controlled rather than platform-shaped: `uiInvoke` (a browser session),
22893
+ * `httpRoute` (an external HTTP caller) and `mcpTool` (an MCP client). Reuses
22894
+ * the same `FieldDef` vocabulary as `records[].fields` and `settings.fields` —
22895
+ * a deliberate decision to keep one field vocabulary across the whole contract
22896
+ * instead of adding a second, more expressive free-form JSON Schema surface
22897
+ * (see spec "Décisions prises").
22881
22898
  *
22882
22899
  * Validated server-side with the existing `fieldDefsToZod` before the handler
22883
22900
  * runs; a violating payload is rejected `422 INVALID_INPUT` and the handler is
@@ -22906,12 +22923,17 @@ var FunctionDefFieldsSchema = external_exports.object({
22906
22923
  description: external_exports.string().min(1)
22907
22924
  }).optional()
22908
22925
  });
22926
+ var TRIGGERS_ACCEPTING_INPUT = /* @__PURE__ */ new Set([
22927
+ "uiInvoke",
22928
+ "httpRoute",
22929
+ "mcpTool"
22930
+ ]);
22909
22931
  var FunctionDefSchema = FunctionDefFieldsSchema.superRefine((fn, ctx) => {
22910
- if (fn.input && fn.trigger.type !== "uiInvoke" && fn.trigger.type !== "httpRoute") {
22932
+ if (fn.input && !TRIGGERS_ACCEPTING_INPUT.has(fn.trigger.type)) {
22911
22933
  ctx.addIssue({
22912
22934
  code: "custom",
22913
22935
  path: ["input"],
22914
- message: `"input" is only allowed on uiInvoke and httpRoute triggers, not "${fn.trigger.type}"`
22936
+ message: `"input" is only allowed on uiInvoke, httpRoute and mcpTool triggers, not "${fn.trigger.type}"`
22915
22937
  });
22916
22938
  }
22917
22939
  if (fn.trigger.type === "httpRoute" && fn.trigger.isAuthRequired === false && fn.trigger.minRole !== void 0) {
@@ -24186,6 +24208,13 @@ var INTEGRATION_CATALOG = {
24186
24208
  requiresApproval: false,
24187
24209
  scopes: ["write_tickets"]
24188
24210
  },
24211
+ replyOnChannel: {
24212
+ description: "Post an outbound reply on the ticket's own channel (Instagram DM, Facebook Messenger) \u2014 addressed by channel ids, not an email. Dispatches immediately \u2014 app-only.",
24213
+ destructive: true,
24214
+ agentExposable: false,
24215
+ requiresApproval: false,
24216
+ scopes: ["write_tickets"]
24217
+ },
24189
24218
  upsertHttpIntegration: {
24190
24219
  description: "Create or update the Gorgias HTTP integration that calls back into this Wopilo instance. Idempotent on `name`. The callback `url` MUST point under PUBLIC_BASE_URL. Not agent-exposable: reachable only by an app whose manifest role lists this action.",
24191
24220
  destructive: true,
@@ -29796,6 +29825,29 @@ var INTEGRATION_ACTION_SCHEMAS = {
29796
29825
  additionalProperties: false
29797
29826
  }
29798
29827
  },
29828
+ replyOnChannel: {
29829
+ input: {
29830
+ $schema: "http://json-schema.org/draft-07/schema#",
29831
+ type: "object",
29832
+ properties: {
29833
+ ticketId: { type: "string" },
29834
+ channel: { type: "string", minLength: 1 },
29835
+ bodyHtml: { type: "string", minLength: 1 },
29836
+ bodyText: { type: "string", minLength: 1 },
29837
+ toAddress: { type: "string", minLength: 1 },
29838
+ fromAddress: { type: "string", minLength: 1 },
29839
+ receiverName: { type: "string" }
29840
+ },
29841
+ required: ["ticketId", "channel", "bodyHtml", "bodyText", "toAddress", "fromAddress"]
29842
+ },
29843
+ output: {
29844
+ $schema: "http://json-schema.org/draft-07/schema#",
29845
+ type: "object",
29846
+ properties: { messageId: { type: "string" } },
29847
+ required: ["messageId"],
29848
+ additionalProperties: false
29849
+ }
29850
+ },
29799
29851
  upsertHttpIntegration: {
29800
29852
  input: {
29801
29853
  $schema: "http://json-schema.org/draft-07/schema#",
@@ -38320,7 +38372,7 @@ function findUndeclaredScopeCalls(manifest, projectRoot) {
38320
38372
  const missing = required2.filter((scope) => !granted.has(scope));
38321
38373
  if (missing.length === 0) continue;
38322
38374
  findings.push({
38323
- file: file2.slice(projectRoot.length + 1),
38375
+ file: (0, import_path.relative)(projectRoot, file2).split(import_path.sep).join("/"),
38324
38376
  line: contents.slice(0, match.index ?? 0).split("\n").length,
38325
38377
  provider,
38326
38378
  action,
@@ -39971,7 +40023,7 @@ function failTriggerGate(appSlug, candidates, message) {
39971
40023
  fail(3, message, formatTriggerableList(appSlug, candidates));
39972
40024
  }
39973
40025
  function notTriggerableMessage(appSlug, functionName) {
39974
- return `Error: no triggerable function "${functionName}" in app "${appSlug}" \u2014 it may not exist, or it may be a uiInvoke function (those run inline in the app UI; the CLI cannot start them in v1).`;
40026
+ return `Error: no triggerable function "${functionName}" in app "${appSlug}" \u2014 it may not exist, or it may be a uiInvoke or mcpTool function (those run inline, for the app UI or an MCP client; the CLI cannot start them).`;
39975
40027
  }
39976
40028
  async function resolveFunction(baseUrl, apiKey, appSlug, functionName) {
39977
40029
  const { jobs } = await fetchJobs({ baseUrl, apiKey });