@apotech-os/cli 2.4.0 → 2.6.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/dist/index.js CHANGED
@@ -22978,7 +22978,16 @@ var AppRoleSchema = external_exports.object({
22978
22978
  * '*' grants access to all agents (wildcard). Requires role.capabilities to
22979
22979
  * include 'agents' — checked by `checkManifestSemantics`, not by this schema.
22980
22980
  */
22981
- agents: external_exports.array(external_exports.string()).optional()
22981
+ agents: external_exports.array(external_exports.string()).optional(),
22982
+ /**
22983
+ * S3 — glob allowlist for ctx.api.prompts, checked on every call (read and
22984
+ * write alike) by `isPromptAllowed`. Absent or empty means deny-all: unlike
22985
+ * `capabilities`, there is no way to hold the 'prompts' capability without
22986
+ * also naming at least one prompt it covers — `checkManifestSemantics`
22987
+ * enforces that pairing at authoring time.
22988
+ * Example: ['triage', 'escalation', 'agent/*', 'shared/*'].
22989
+ */
22990
+ prompts: external_exports.array(external_exports.string()).optional()
22982
22991
  });
22983
22992
  var UI_ENTRY_REGEX = /^dist\/ui\/[A-Za-z0-9_-]+\.js$/;
22984
22993
  var PageDefSchema = external_exports.object({
@@ -23023,6 +23032,18 @@ var PromptDefSchema = external_exports.object({
23023
23032
  template: external_exports.string(),
23024
23033
  labels: external_exports.array(external_exports.string()).optional()
23025
23034
  });
23035
+ var AgentDeclarationSchema = external_exports.object({
23036
+ /** Stable per platform; becomes the Langfuse prompt name `agent.platform.<slug>`. */
23037
+ slug: external_exports.string().regex(/^[a-z][a-z0-9-]*$/),
23038
+ name: external_exports.string().min(1),
23039
+ description: external_exports.string().optional(),
23040
+ /** Immutable once created — the server never updates it. */
23041
+ type: external_exports.enum(["chat", "classifier"]).optional(),
23042
+ provider: external_exports.enum(["openai", "anthropic"]).optional(),
23043
+ model: external_exports.string().optional(),
23044
+ /** System prompt: seeded as Langfuse v1, re-versioned when the app changes it. */
23045
+ prompt: external_exports.string().min(1)
23046
+ });
23026
23047
  var AppManifestFieldsSchema = external_exports.object({
23027
23048
  universalIdentifier: external_exports.string().uuid(),
23028
23049
  slug: external_exports.string().regex(/^[a-z][a-z0-9-]*$/),
@@ -23097,6 +23118,10 @@ var AppManifestFieldsSchema = external_exports.object({
23097
23118
  // Phase 6: declarative views
23098
23119
  role: AppRoleSchema.optional(),
23099
23120
  // Phase 6: scoped app token role
23121
+ /** Agents this app ships. Orthogonal to `role.agents`, which is the
23122
+ * allowlist of agents the app may INVOKE — an app can declare an agent
23123
+ * for a human to chat with without ever calling it itself. */
23124
+ agents: external_exports.array(AgentDeclarationSchema).optional(),
23100
23125
  navigation: external_exports.array(NavItemSchema),
23101
23126
  /** Default RBAC role granted to any member with no explicit grant on this app.
23102
23127
  * ADMIN is intentionally excluded — an app cannot self-elevate to admin.
@@ -23559,8 +23584,33 @@ function checkManifestSemantics(manifest) {
23559
23584
  if (hasAgentsCapability && !hasAgentsAllowlist) {
23560
23585
  errors.push("role.capabilities includes 'agents' but role.agents is empty");
23561
23586
  }
23587
+ const agentSlugs = /* @__PURE__ */ new Set();
23588
+ for (const agent of manifest.agents ?? []) {
23589
+ if (agentSlugs.has(agent.slug)) {
23590
+ errors.push(`agents: duplicate slug '${agent.slug}' \u2014 each declared agent needs its own`);
23591
+ }
23592
+ agentSlugs.add(agent.slug);
23593
+ }
23594
+ errors.push(...checkPromptsCapabilityPairing(manifest));
23562
23595
  return errors;
23563
23596
  }
23597
+ function checkPromptsCapabilityPairing(manifest) {
23598
+ const role = manifest.role;
23599
+ if (!role) return [];
23600
+ const hasCapability = (role.capabilities ?? []).includes("prompts");
23601
+ const hasAllowlist = (role.prompts ?? []).length > 0;
23602
+ if (hasCapability && !hasAllowlist) {
23603
+ return [
23604
+ 'role.capabilities includes "prompts" but role.prompts is empty. Declare at least one glob (e.g. role.prompts: ["triage", "shared/*"]) naming which prompts this app may access \u2014 an absent or empty role.prompts denies every prompt.'
23605
+ ];
23606
+ }
23607
+ if (!hasCapability && hasAllowlist) {
23608
+ return [
23609
+ 'role.prompts is declared but role.capabilities does not include "prompts". Add "prompts" to role.capabilities, or remove role.prompts.'
23610
+ ];
23611
+ }
23612
+ return [];
23613
+ }
23564
23614
 
23565
23615
  // src/manifest-build.ts
23566
23616
  var ManifestBuildError = class extends Error {