@agentproto/agencies 0.1.0-alpha.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/AGENTAGENCIES.md +39 -0
- package/LICENSE +21 -0
- package/README.md +90 -0
- package/dist/capacity-98VwY285.d.ts +862 -0
- package/dist/chunk-DYQ4A5HV.mjs +649 -0
- package/dist/chunk-DYQ4A5HV.mjs.map +1 -0
- package/dist/chunk-GAJQ5ZC2.mjs +149 -0
- package/dist/chunk-GAJQ5ZC2.mjs.map +1 -0
- package/dist/chunk-SOJ4GQR7.mjs +3 -0
- package/dist/chunk-SOJ4GQR7.mjs.map +1 -0
- package/dist/composition/index.d.ts +61 -0
- package/dist/composition/index.mjs +75 -0
- package/dist/composition/index.mjs.map +1 -0
- package/dist/doctypes/index.d.ts +61 -0
- package/dist/doctypes/index.mjs +4 -0
- package/dist/doctypes/index.mjs.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.mjs +17 -0
- package/dist/index.mjs.map +1 -0
- package/dist/renderers/index.d.ts +288 -0
- package/dist/renderers/index.mjs +321 -0
- package/dist/renderers/index.mjs.map +1 -0
- package/dist/validators/index.d.ts +70 -0
- package/dist/validators/index.mjs +4 -0
- package/dist/validators/index.mjs.map +1 -0
- package/package.json +94 -0
- package/src/spec/canvakit-templates/agency.agency-overview/template.canvakit.html +173 -0
- package/src/spec/canvakit-templates/agency.agency-profile/template.canvakit.html +121 -0
- package/src/spec/canvakit-templates/agency.agreement-signing/template.canvakit.html +164 -0
- package/src/spec/canvakit-templates/agency.deliverable-review/template.canvakit.html +148 -0
- package/src/spec/canvakit-templates/agency.engagement-dashboard/template.canvakit.html +191 -0
- package/src/spec/canvakit-templates/agency.invoice-pdf/template.canvakit.html +142 -0
- package/src/spec/canvakit-templates/agency.procedure-card/template.canvakit.html +93 -0
- package/src/spec/snippets/agency-overview-rollup/procedures/compute-agency-overview/PROCEDURE.md +88 -0
- package/src/spec/snippets/agency-overview-rollup/routines/agency-overview-rollup/ROUTINE.md +58 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/spec/doctypes/_common.ts","../src/spec/doctypes/agency.ts","../src/spec/doctypes/operations.ts","../src/spec/doctypes/service.ts","../src/spec/doctypes/procedure.ts","../src/spec/doctypes/pricing-model.ts","../src/spec/doctypes/counterparty.ts","../src/spec/doctypes/engagement.ts","../src/spec/doctypes/agreement.ts","../src/spec/doctypes/deliverable.ts","../src/spec/doctypes/invoice.ts","../src/spec/doctypes/routine.ts","../src/spec/doctypes/capacity.ts"],"names":["z","requiredSignerSchema","lineItemSchema"],"mappings":";;;;;;;;AAOO,IAAM,WAAA,GAAc;AAGpB,IAAM,eAAA,GAAkB,CAAA,CAAE,MAAA,EAAO,CAAE,MAAM,sBAAA,EAAwB;AAAA,EACtE,OAAA,EACE;AACJ,CAAC;AAGM,IAAM,iBAAA,GAAoB,CAAA,CAAE,MAAA,EAAO,CAAE,OAAO,CAAA,EAAG;AAAA,EACpD,OAAA,EAAS;AACX,CAAC;AAGM,IAAM,gBAAA,GAAmB,CAAA,CAAE,MAAA,EAAO,CAAE,OAAO,CAAA,EAAG;AAAA,EACnD,OAAA,EAAS;AACX,CAAC;AAGM,IAAM,cAAA,GAAiB,CAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC;AAGvC,IAAM,iBAAA,GAAoB,CAAA,CAAE,MAAA,EAAO,CAAE,MAAM,IAAA,EAAM;AAAA,EACtD,OAAA,EAAS;AACX,CAAC;AAMM,IAAM,mBAAA,GAAsB,EAAE,KAAA,CAAM;AAAA,EACzC,CAAA,CAAE,IAAI,IAAA,EAAK;AAAA,EACX,CAAA,CAAE,IAAA,EAAK,CAAE,SAAA,CAAU,CAAA,CAAA,KAAK,CAAA,CAAE,WAAA,EAAY,CAAE,KAAA,CAAM,CAAA,EAAG,EAAE,CAAC;AACtD,CAAC;AAOM,IAAM,uBAAA,GAA0B,EAAE,KAAA,CAAM;AAAA,EAC7C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,EAAE,CAAA;AAAA;AAAA,EAG1D,0BAA0BA,CAAAA,CAAE,MAAA,EAAO,CAAE,QAAA,GAAW,QAAA,EAAS;AAAA;AAAA,EAGzD,yBAAyBA,CAAAA,CAAE,MAAA,EAAO,CAAE,QAAA,GAAW,QAAA,EAAS;AAAA;AAAA,EAGxD,iBAAiBA,CAAAA,CAAE,KAAA,CAAM,eAAe,CAAA,CAAE,OAAA,CAAQ,EAAE,CAAA;AAAA;AAAA,EAGpD,wBAAwBA,CAAAA,CAAE,MAAA,EAAO,CAAE,WAAA,GAAc,QAAA,EAAS;AAAA,EAC1D,8BAA8BA,CAAAA,CAAE,MAAA,EAAO,CAAE,WAAA,GAAc,QAAA,EAAS;AAAA;AAAA,EAGhE,gBAAgBA,CAAAA,CACb,KAAA;AAAA,IACCA,EAAE,MAAA,CAAO;AAAA,MACP,IAAA,EAAM,uBAAA;AAAA,MACN,KAAA,EAAO,uBAAA;AAAA,MACP,MAAA,EAAQA,CAAAA,CAAE,MAAA,EAAO,CAAE,QAAA;AAAS,KAC7B;AAAA,GACH,CACC,OAAA,CAAQ,EAAE;AACf,CAAC;AAQM,IAAM,iBAAA,GAAoB","file":"chunk-DYQ4A5HV.mjs","sourcesContent":["import { z } from \"zod\"\n\n/**\n * Shared zod primitives used across agentagencies/v1 doctypes.\n * Aligned with companies.sh + governance.sh conventions.\n */\n\nexport const SCHEMA_NAME = \"agentagencies/v1\" as const\n\n/** Lowercase slug: `^[a-z0-9][a-z0-9-]*$` */\nexport const kebabSlugSchema = z.string().regex(/^[a-z0-9][a-z0-9-]*$/, {\n message:\n \"Expected kebab-case slug (lowercase, alphanumeric + hyphens, leading alphanumeric)\",\n})\n\n/** ISO 4217 3-letter currency code (e.g., EUR, USD, GBP). */\nexport const currencyIsoSchema = z.string().length(3, {\n message: \"Expected ISO 4217 3-letter currency code\",\n})\n\n/** ISO 3166 2-letter country code (e.g., FR, US, DE). */\nexport const countryIsoSchema = z.string().length(2, {\n message: \"Expected ISO 3166 2-letter country code\",\n})\n\n/** IANA timezone (e.g., Europe/Paris, America/New_York). */\nexport const timezoneSchema = z.string().min(1)\n\n/** ISO-8601 duration: P, PT, P1Y2M3DT4H5M6S, etc. */\nexport const isoDurationSchema = z.string().regex(/^P/, {\n message: \"Expected ISO-8601 duration starting with 'P'\",\n})\n\n/**\n * ISO-8601 date string OR a YAML-parsed Date object (gray-matter / js-yaml\n * auto-parses `YYYY-MM-DD` literals to Date). Normalizes to \"YYYY-MM-DD\" string.\n */\nexport const isoDateOrDateSchema = z.union([\n z.iso.date(),\n z.date().transform(d => d.toISOString().slice(0, 10)),\n])\n\n/**\n * ISO-8601 datetime string OR a YAML-parsed Date. YAML 1.1 auto-parses\n * `YYYY-MM-DDTHH:MM:SS(.fff)?(Z|+/-HH:MM)?` literals to Date — the schema\n * accepts both forms and normalizes to ISO datetime string.\n */\nexport const isoDatetimeOrDateSchema = z.union([\n z.iso.datetime(),\n z.date().transform(d => d.toISOString()),\n])\n\n/** Party reference in canonical \"<kind>:<slug>\" form, with wildcard `*` allowed. */\nexport const partyRefSchema = z\n .string()\n .regex(\n /^(operator|user|counterparty|agent|external|team):([a-z0-9][a-z0-9-]*|\\*)$/,\n { message: \"Expected '<kind>:<slug>' or '<kind>:*'\" }\n )\n\n/** Strict slug-only party ref (no wildcard). */\nexport const partyRefStrictSchema = z\n .string()\n .regex(\n /^(operator|user|counterparty|agent|external|team):[a-z0-9][a-z0-9-]*$/,\n { message: \"Expected '<kind>:<slug>'\" }\n )\n\n/** Workspace-relative path (forward slashes, no leading slash, no `..`). */\nexport const workspacePathSchema = z\n .string()\n .min(1)\n .refine(p => !p.startsWith(\"/\"), {\n message: \"Expected relative path (no leading /)\",\n })\n .refine(p => !p.includes(\"..\"), { message: \"Path must not contain '..'\" })\n\n/** Vendor metadata bag — `metadata.<vendor>.*` for extensions. */\nexport const metadataSchema = z.record(z.string(), z.unknown())\n\n/** SHA-256 hex string (64 chars). */\nexport const sha256HexSchema = z.string().regex(/^[a-f0-9]{64}$/, {\n message: \"Expected lowercase hex SHA-256 (64 chars)\",\n})\n\n/** Common authorship + provenance fields shared across doctypes. */\nexport const authorshipFields = {\n authors: z\n .array(\n z.object({\n name: z.string().min(1),\n email: z.email().optional(),\n url: z.string().optional(),\n })\n )\n .optional(),\n homepage: z.string().optional(),\n tags: z.array(z.string()).optional(),\n}\n\n/** Common doctype envelope — schema + doctype literal + slug + name + description. */\nexport function envelope<DocType extends string>(doctype: DocType) {\n return {\n schema: z.literal(SCHEMA_NAME),\n doctype: z.literal(doctype),\n slug: kebabSlugSchema,\n name: z.string().min(1),\n description: z.string().optional(),\n version: z.string().optional(), // semver, optional per agentcompanies convention\n metadata: metadataSchema.optional(),\n } as const\n}\n","import { z } from \"zod\"\nimport {\n countryIsoSchema,\n currencyIsoSchema,\n envelope,\n isoDateOrDateSchema,\n kebabSlugSchema,\n timezoneSchema,\n} from \"./_common.js\"\n\n/**\n * agentagencies/v1 — `AGENCY.md` doctype.\n *\n * Operational profile of the company when it acts as an agency.\n * Lives at `<workspace-root>/AGENCY.md` alongside (NOT replacing) `COMPANY.md`\n * from agentcompanies/v1. Optional — a workspace is a valid agentagencies\n * package without it as long as the other doctypes are reachable via\n * `COMPANY.md.includes[]` or filesystem convention.\n *\n * Carries operational defaults that would otherwise be sprinkled across\n * services / pricing / policies (verticals, default currency, autonomy posture).\n */\n\nexport const AUTONOMY_POSTURE = [\"full-auto\", \"hybrid\", \"manual\"] as const\nexport const autonomyPostureSchema = z.enum(AUTONOMY_POSTURE)\nexport type AutonomyPosture = z.infer<typeof autonomyPostureSchema>\n\nexport const agencyFrontmatterSchema = z.object({\n ...envelope(\"agency\"),\n\n /** Vertical templates this agency uses (slugs from agencies.sh registry, e.g., \"design-project\"). */\n verticals: z.array(kebabSlugSchema).default([]),\n\n /** Slugs of the primary services this agency offers (refs to services/<slug>/SERVICE.md). */\n primaryServices: z.array(kebabSlugSchema).default([]),\n\n /** Default pricing-model slug applied when a service doesn't specify one. */\n defaultPricingModel: kebabSlugSchema.optional(),\n\n defaultCurrency: currencyIsoSchema.optional(),\n defaultCountry: countryIsoSchema.optional(),\n billingTimezone: timezoneSchema.optional(),\n\n /** ISO date marking the start of the fiscal year (e.g., 2026-01-01). */\n fiscalYearStart: isoDateOrDateSchema.optional(),\n\n autonomyPosture: autonomyPostureSchema.default(\"hybrid\"),\n\n /** External package paths this AGENCY.md pulls in. Mirrors COMPANY.md.includes[]. */\n includes: z.array(z.string()).default([]),\n})\nexport type AgencyFrontmatter = z.infer<typeof agencyFrontmatterSchema>\n\nexport interface Agency {\n frontmatter: AgencyFrontmatter\n body: string\n}\n\nexport const AGENCY_FILENAME = \"AGENCY.md\" as const\n","import { z } from \"zod\"\nimport { authorshipFields, envelope } from \"./_common.js\"\n\n/**\n * agentagencies/v1 — `OPERATIONS.md` doctype.\n *\n * Root file for **external** operations packages — used when ops live in a\n * separate package from the company package, referenced via `includes[]`\n * from `COMPANY.md` or `AGENCY.md`. Analog of `COMPANY.md` (companies.sh)\n * but scoped to operations only.\n *\n * A holding company with multiple agency divisions might have:\n * big-corp/COMPANY.md → includes: [../plumbing-ops, ../design-ops]\n * plumbing-ops/OPERATIONS.md\n * design-ops/OPERATIONS.md\n */\n\nexport const operationsFrontmatterSchema = z.object({\n ...envelope(\"operations\"),\n ...authorshipFields,\n\n /** External package paths or registry shortnames this OPERATIONS.md pulls in. */\n includes: z.array(z.string()).default([]),\n\n /** License (matches agentcompanies/v1 conventions). */\n license: z.string().optional(),\n})\nexport type OperationsFrontmatter = z.infer<typeof operationsFrontmatterSchema>\n\nexport interface Operations {\n frontmatter: OperationsFrontmatter\n body: string\n}\n\nexport const OPERATIONS_FILENAME = \"OPERATIONS.md\" as const\n","import { z } from \"zod\"\nimport { envelope, isoDurationSchema, kebabSlugSchema } from \"./_common.js\"\n\n/**\n * agentagencies/v1 — `SERVICE.md` doctype.\n *\n * Catalog item — what the agency sells. Composes one or more SKILL.md\n * (companies.sh) refs + a default PROCEDURE.md (the playbook to execute when\n * this service is requested) + a default pricing model + scope template.\n */\n\nexport const serviceFrontmatterSchema = z.object({\n ...envelope(\"service\"),\n\n /**\n * Skills required to deliver this service. Refs to companies.sh skills\n * (`SKILL.md` shortnames or paths); resolution per skills.sh / companies.sh rules.\n */\n requiredSkills: z.array(z.string()).default([]),\n\n /** Default procedure slug to execute when this service is invoked. */\n defaultProcedure: kebabSlugSchema.optional(),\n\n /** Default pricing-model slug. */\n defaultPricingModel: kebabSlugSchema.optional(),\n\n /** Estimated duration as ISO-8601 duration (e.g., PT2H, P5D). */\n estimatedDuration: isoDurationSchema.optional(),\n\n /** Free-form prerequisites for the counterparty (info needed before scoping). */\n prerequisites: z.array(z.string()).default([]),\n\n /**\n * Scope template — the structure of the engagement scope when this service\n * is sold. Free-form for v1; templates may add their own conventions.\n */\n scopeTemplate: z.unknown().optional(),\n\n /** Tags for catalog discovery (e.g., [\"plumbing\", \"emergency\"]). */\n tags: z.array(z.string()).default([]),\n\n /** External listing flag — show on agencies.sh registry / public pages. */\n publishable: z.boolean().default(true),\n})\nexport type ServiceFrontmatter = z.infer<typeof serviceFrontmatterSchema>\n\nexport interface Service {\n frontmatter: ServiceFrontmatter\n body: string\n}\n\nexport const SERVICE_FILENAME = \"SERVICE.md\" as const\n","import { z } from \"zod\"\nimport {\n envelope,\n isoDurationSchema,\n kebabSlugSchema,\n partyRefSchema,\n} from \"./_common.js\"\n\n/**\n * agentagencies/v1 — `PROCEDURE.md` doctype.\n *\n * Vendor-neutral playbook. Step-by-step \"how to do X\": triggers, required skills,\n * autonomy policy, branching steps with expected outputs.\n *\n * A Mastra workflow.ts is *one possible implementation* of a PROCEDURE.md;\n * other orchestrators (Temporal, n8n, manual humans) can read and follow the\n * same procedure without our infrastructure.\n *\n * Relationship to ROUTINE.md: ROUTINE.md says \"when\" (cron, triggers); PROCEDURE.md\n * says \"what\" (steps).\n */\n\nexport const procedureTriggerSchema = z.discriminatedUnion(\"kind\", [\n z.object({ kind: z.literal(\"service\"), service: kebabSlugSchema }),\n z.object({ kind: z.literal(\"routine\"), routine: kebabSlugSchema }),\n z.object({ kind: z.literal(\"manual\"), description: z.string().optional() }),\n z.object({ kind: z.literal(\"event\"), eventType: z.string() }),\n])\nexport type ProcedureTrigger = z.infer<typeof procedureTriggerSchema>\n\n/**\n * A step is identified by a unique id within the procedure. Steps run in\n * declared order unless a `branch` redirects.\n */\nconst stepBaseSchema = z.object({\n id: kebabSlugSchema,\n description: z.string().optional(),\n /** Skill required to execute this step (refs companies.sh SKILL.md). */\n requiredSkill: z.string().optional(),\n /** What this step produces (free-form descriptor). */\n output: z.string().optional(),\n})\n\n/** A simple step without branching. */\nexport const procedureSimpleStepSchema = stepBaseSchema.extend({\n branch: z.never().optional(),\n})\n\n/** A branching step — picks which step (by id) to run next based on conditions. */\nexport const procedureBranchStepSchema = stepBaseSchema.extend({\n branch: z\n .array(\n z.object({\n if: z.string().optional(), // condition expression (free-form for v1)\n else: z.boolean().optional(),\n action: z.string(), // \"proceed_repair\", \"requestSignaturesTool\", \"advance_to_step:<id>\", etc.\n })\n )\n .min(1),\n})\n\nexport const procedureStepSchema = z.union([\n procedureSimpleStepSchema,\n procedureBranchStepSchema,\n])\nexport type ProcedureStep = z.infer<typeof procedureStepSchema>\n\nexport const procedureFrontmatterSchema = z.object({\n ...envelope(\"procedure\"),\n\n /** What invokes this procedure. */\n triggers: z.array(procedureTriggerSchema).default([]),\n\n /** Skills required across the whole procedure (union of step requirements). */\n requiredSkills: z.array(z.string()).default([]),\n\n /** Estimated total duration (ISO-8601 duration). */\n estimatedDuration: isoDurationSchema.optional(),\n\n /**\n * Slug of a POLICY.md (agentgovernance/v1) that governs autonomy for this\n * procedure. Steps may individually require signatures via the policy.\n */\n autonomyPolicy: kebabSlugSchema.optional(),\n\n /** Steps in declared order. */\n steps: z.array(procedureStepSchema).min(1),\n\n /**\n * Default approvers when a step gates on signature without an explicit\n * policy override (typically refs governance.requiredSignatures).\n */\n defaultApprovers: z.array(partyRefSchema).default([]),\n})\nexport type ProcedureFrontmatter = z.infer<typeof procedureFrontmatterSchema>\n\nexport interface Procedure {\n frontmatter: ProcedureFrontmatter\n body: string\n}\n\nexport const PROCEDURE_FILENAME = \"PROCEDURE.md\" as const\n","import { z } from \"zod\"\nimport { currencyIsoSchema, envelope, isoDurationSchema } from \"./_common.js\"\n\n/**\n * agentagencies/v1 — `PRICING-MODEL.md` doctype.\n *\n * Pricing rule. Determines how a service is priced + how it gets billed.\n * Six kinds for v1:\n * - fixed — single price for the whole engagement\n * - hourly — billed per hour worked (with optional cap)\n * - retainer — recurring monthly/period fee\n * - milestone — scheduled payments at defined milestones\n * - value — outcome-based (e.g., % of revenue impact)\n * - usage_metered — Stripe-style usage billing\n */\n\nexport const PRICING_KIND = [\n \"fixed\",\n \"hourly\",\n \"retainer\",\n \"milestone\",\n \"value\",\n \"usage_metered\",\n] as const\nexport const pricingKindSchema = z.enum(PRICING_KIND)\nexport type PricingKind = z.infer<typeof pricingKindSchema>\n\nconst fixedPricingSchema = z.object({\n kind: z.literal(\"fixed\"),\n amount: z.number().positive(),\n currency: currencyIsoSchema,\n})\n\nconst hourlyPricingSchema = z.object({\n kind: z.literal(\"hourly\"),\n rate: z.number().positive(),\n currency: currencyIsoSchema,\n /** Optional cap on total hours billable. */\n capHours: z.number().positive().optional(),\n})\n\nconst retainerPricingSchema = z.object({\n kind: z.literal(\"retainer\"),\n amount: z.number().positive(),\n currency: currencyIsoSchema,\n /** ISO duration of one billing period (e.g., P1M for monthly). */\n period: isoDurationSchema,\n /** Minimum commitment as ISO duration (e.g., P12M for 12 months). */\n minCommitment: isoDurationSchema.optional(),\n})\n\nconst milestonePricingSchema = z.object({\n kind: z.literal(\"milestone\"),\n currency: currencyIsoSchema,\n milestones: z\n .array(\n z.object({\n slug: z.string(),\n description: z.string().optional(),\n amount: z.number().positive(),\n /** Optional ISO date or duration relative to engagement start. */\n dueAt: z.string().optional(),\n })\n )\n .min(1),\n})\n\nconst valuePricingSchema = z.object({\n kind: z.literal(\"value\"),\n currency: currencyIsoSchema,\n /** Free-form outcome formula description. */\n formula: z.string(),\n baseFee: z.number().nonnegative().optional(),\n capAmount: z.number().positive().optional(),\n})\n\nconst usageMeteredPricingSchema = z.object({\n kind: z.literal(\"usage_metered\"),\n currency: currencyIsoSchema,\n unit: z.string(), // e.g., \"request\", \"minute\", \"GB\"\n ratePerUnit: z.number().positive(),\n /** Optional included quota before metering kicks in. */\n includedUnits: z.number().nonnegative().optional(),\n /** Stripe-compatible meter id (vendor extension). */\n externalMeterId: z.string().optional(),\n})\n\nexport const pricingDetailsSchema = z.discriminatedUnion(\"kind\", [\n fixedPricingSchema,\n hourlyPricingSchema,\n retainerPricingSchema,\n milestonePricingSchema,\n valuePricingSchema,\n usageMeteredPricingSchema,\n])\nexport type PricingDetails = z.infer<typeof pricingDetailsSchema>\n\nexport const pricingModelFrontmatterSchema = z.object({\n ...envelope(\"pricing-model\"),\n details: pricingDetailsSchema,\n /** Default tax handling (vendor extensions in metadata.<vendor>.tax.*). */\n taxIncluded: z.boolean().optional(),\n})\nexport type PricingModelFrontmatter = z.infer<\n typeof pricingModelFrontmatterSchema\n>\n\nexport interface PricingModel {\n frontmatter: PricingModelFrontmatter\n body: string\n}\n\nexport const PRICING_MODEL_FILENAME = \"PRICING-MODEL.md\" as const\n","import { z } from \"zod\"\nimport {\n countryIsoSchema,\n currencyIsoSchema,\n envelope,\n isoDatetimeOrDateSchema,\n kebabSlugSchema,\n timezoneSchema,\n} from \"./_common.js\"\n\n/**\n * agentagencies/v1 — `COUNTERPARTY.md` doctype.\n *\n * External party (client) — display name, primary channels, country/currency/timezone,\n * references to encrypted PII blob, mergedIntoId for dedup.\n *\n * Counterparties are NOT users / operators / agents. They live outside the\n * platform; all interactions are via channels (email, WhatsApp, SMS).\n */\n\nexport const COUNTERPARTY_KIND = [\"individual\", \"organization\"] as const\nexport const counterpartyKindSchema = z.enum(COUNTERPARTY_KIND)\n\nexport const COUNTERPARTY_SOURCE = [\n \"manual\",\n \"inbound_email\",\n \"imported\",\n \"api\",\n] as const\nexport const counterpartySourceSchema = z.enum(COUNTERPARTY_SOURCE)\n\nconst counterpartyChannelSchema = z.object({\n kind: z.enum([\"email\", \"whatsapp\", \"sms\"]),\n address: z.string(), // normalized: lowercased email / E.164 phone\n isPrimary: z.boolean().default(false),\n verifiedAt: isoDatetimeOrDateSchema.optional(),\n optInAt: isoDatetimeOrDateSchema.optional(),\n optOutAt: isoDatetimeOrDateSchema.optional(),\n optOutReason: z.string().optional(),\n bouncedAt: isoDatetimeOrDateSchema.optional(),\n bounceReason: z.string().optional(),\n})\n\nexport const counterpartyFrontmatterSchema = z.object({\n ...envelope(\"counterparty\"),\n\n kind: counterpartyKindSchema,\n /** Display name (NOT the legal name; legal name lives in encrypted PII). */\n displayName: z.string().min(1),\n /** Pre-resolved primary email (denorm of channels[isPrimary, kind=email]). */\n primaryEmail: z.email().optional(),\n /** Pre-resolved primary phone in E.164 (denorm of channels[isPrimary, kind=whatsapp|sms]). */\n primaryPhone: z.string().optional(),\n\n channels: z.array(counterpartyChannelSchema).default([]),\n\n country: countryIsoSchema.optional(),\n currency: currencyIsoSchema.optional(),\n timezone: timezoneSchema.optional(),\n\n source: counterpartySourceSchema.default(\"manual\"),\n\n /**\n * Path to encrypted PII blob (e.g., legal name, address, taxId, DOB).\n * The blob is encrypted at rest with a workspace-level key; only `displayName`\n * + `primaryEmail` + `primaryPhone` are unencrypted (for inbound channel routing).\n */\n piiBlobRef: z.string().optional(),\n\n /** Self-FK for dedup: this counterparty is merged into another (canonical) one. */\n mergedIntoId: kebabSlugSchema.optional(),\n\n /** Free-form tags for segmentation (e.g., [\"enterprise\", \"newsletter-2026\"]). */\n tags: z.array(z.string()).default([]),\n})\nexport type CounterpartyFrontmatter = z.infer<\n typeof counterpartyFrontmatterSchema\n>\n\nexport interface Counterparty {\n frontmatter: CounterpartyFrontmatter\n body: string\n}\n\nexport const COUNTERPARTY_FILENAME = \"COUNTERPARTY.md\" as const\n","import { z } from \"zod\"\nimport {\n currencyIsoSchema,\n envelope,\n isoDatetimeOrDateSchema,\n kebabSlugSchema,\n partyRefStrictSchema,\n workspacePathSchema,\n} from \"./_common.js\"\n\n/**\n * agentagencies/v1 — `ENGAGEMENT.md` doctype.\n *\n * Commercial instance of a service for a counterparty. Aggregates the work\n * (PROJECT.md), the contract (AGREEMENT.md), the deliverables, the invoices,\n * and the active procedure being executed.\n *\n * Lifecycle = the workflow's current step. ENGAGEMENT.md `status` is a\n * denormalization for filesystem-scan filtering, NOT the source of truth.\n */\n\nexport const ENGAGEMENT_KIND = [\n \"one_shot\",\n \"milestone\",\n \"retainer\",\n \"usage_metered\",\n] as const\nexport const engagementKindSchema = z.enum(ENGAGEMENT_KIND)\nexport type EngagementKind = z.infer<typeof engagementKindSchema>\n\n/**\n * Wide engagement status enum for denormalized filesystem-scan filtering.\n * The authoritative state is the workflow's current step.\n */\nexport const ENGAGEMENT_STATUS = [\n \"scoping\",\n \"quoted\",\n \"signed\",\n \"in_progress\",\n \"review_requested\",\n \"revision\",\n \"validated\",\n \"invoiced\",\n \"paid\",\n \"closed\",\n \"cancelled\",\n \"disputed\",\n] as const\nexport const engagementStatusSchema = z.enum(ENGAGEMENT_STATUS)\nexport type EngagementStatus = z.infer<typeof engagementStatusSchema>\n\nconst engagementPartySchema = z.object({\n /** Role in the engagement (e.g., \"client\", \"primary-contact\", \"executor\"). */\n role: z.string().min(1),\n /** Canonical \"<kind>:<slug>\" — counterparty:..., operator:..., agent:..., etc. */\n party: partyRefStrictSchema,\n /** Optional revenue-share percentage (0-100). Sum across parties may exceed 100 (multi-step splits). */\n share: z.number().min(0).max(100).optional(),\n})\n\nexport const engagementFrontmatterSchema = z.object({\n ...envelope(\"engagement\"),\n\n kind: engagementKindSchema,\n status: engagementStatusSchema,\n\n /** All parties — roles + canonical refs. */\n parties: z.array(engagementPartySchema).min(1),\n\n /** Denormalized: primary counterparty for fast queries. */\n primaryCounterpartyId: kebabSlugSchema,\n\n /** Service slug being delivered. */\n serviceSlug: kebabSlugSchema.optional(),\n\n /** Active procedure being executed (PROCEDURE.md slug). */\n activeProcedure: kebabSlugSchema.optional(),\n /** Active step within the procedure (step id). */\n activeStep: kebabSlugSchema.optional(),\n\n /** Path to the AGREEMENT.md (relative to engagement folder). */\n agreementPath: z.string().default(\"AGREEMENT.md\"),\n\n /** Path to the linked PROJECT.md (companies.sh) — the work. */\n projectPath: workspacePathSchema.optional(),\n\n /** Pricing model in effect for this engagement. */\n pricingModelSlug: kebabSlugSchema.optional(),\n\n totalContractValue: z.number().nonnegative().optional(),\n currency: currencyIsoSchema.optional(),\n\n /** Affiliate referral link (refs core/affiliate domain if present). */\n referredByAffiliateId: kebabSlugSchema.optional(),\n\n // Lifecycle timestamps (denorm of audit-log + workflow state).\n scopedAt: isoDatetimeOrDateSchema.optional(),\n signedAt: isoDatetimeOrDateSchema.optional(),\n startedAt: isoDatetimeOrDateSchema.optional(),\n validatedAt: isoDatetimeOrDateSchema.optional(),\n paidAt: isoDatetimeOrDateSchema.optional(),\n closedAt: isoDatetimeOrDateSchema.optional(),\n})\nexport type EngagementFrontmatter = z.infer<typeof engagementFrontmatterSchema>\n\nexport interface Engagement {\n frontmatter: EngagementFrontmatter\n body: string\n}\n\nexport const ENGAGEMENT_FILENAME = \"ENGAGEMENT.md\" as const\n","import { z } from \"zod\"\nimport {\n currencyIsoSchema,\n envelope,\n isoDatetimeOrDateSchema,\n isoDurationSchema,\n kebabSlugSchema,\n partyRefStrictSchema,\n sha256HexSchema,\n} from \"./_common.js\"\n\n/**\n * agentagencies/v1 — `AGREEMENT.md` doctype.\n *\n * Contract for an engagement. Carries parties, line items, payment terms,\n * deliverable spec, governing law, and a `requiredSignatures` field that\n * defers to agentgovernance/v1.\n *\n * Once `status === \"signed\"`, the artifact is effectively immutable — the\n * runtime layer enforces this via \"create new version, supersede\" semantics.\n */\n\nexport const AGREEMENT_KIND = [\"quote\", \"agreement\"] as const\nexport const agreementKindSchema = z.enum(AGREEMENT_KIND)\nexport type AgreementKind = z.infer<typeof agreementKindSchema>\n\nexport const AGREEMENT_STATUS = [\n \"draft\",\n \"proposed\",\n \"signed\",\n \"superseded\",\n \"expired\",\n \"void\",\n \"cancelled\",\n] as const\nexport const agreementStatusSchema = z.enum(AGREEMENT_STATUS)\nexport type AgreementStatus = z.infer<typeof agreementStatusSchema>\n\nconst agreementPartySchema = z.object({\n role: z.string().min(1),\n party: partyRefStrictSchema,\n share: z.number().min(0).max(100).optional(),\n})\n\nconst lineItemSchema = z.object({\n /** Stable UUID for the line item — survives revisions. */\n lineItemId: z.uuid(),\n description: z.string().min(1),\n quantity: z.number().positive().default(1),\n unitAmount: z.number().nonnegative(),\n currency: currencyIsoSchema,\n /** When this line item triggers payment (used by milestone pricing). */\n paymentTrigger: z.string().optional(),\n})\n\nconst paymentTermsSchema = z.object({\n /** ISO-8601 duration: net payment window after invoice (e.g., PT0H, P15D, P30D). */\n netDuration: isoDurationSchema.default(\"P30D\"),\n /** Schedule kind: at signature, on milestones, monthly retainer, etc. */\n schedule: z\n .enum([\"at_signature\", \"milestone\", \"retainer\", \"on_completion\", \"custom\"])\n .default(\"on_completion\"),\n /** Late fee terms — free-form for v1. */\n latePolicy: z.string().optional(),\n})\n\n/** Required-signatures shape — matches agentgovernance/v1.requiredSignatures. */\nconst requiredSignerSchema = z.object({\n signer: partyRefStrictSchema,\n method: z.enum([\n \"typed_name\",\n \"agent_confirm\",\n \"click_through\",\n \"esign_external\",\n ]),\n weight: z.number().min(0).optional(),\n})\n\nexport const agreementFrontmatterSchema = z.object({\n ...envelope(\"agreement\"),\n\n kind: agreementKindSchema,\n status: agreementStatusSchema.default(\"draft\"),\n\n parties: z.array(agreementPartySchema).min(2),\n /** Denormalized: primary counterparty for fast queries. */\n primaryCounterpartyId: kebabSlugSchema,\n\n lineItems: z.array(lineItemSchema).default([]),\n currency: currencyIsoSchema, // single currency per agreement (multi-currency = separate agreements)\n /** Denormalized total of lineItems[].quantity * unitAmount. */\n totalAmount: z.number().nonnegative().optional(),\n\n paymentTerms: paymentTermsSchema.default({\n netDuration: \"P30D\",\n schedule: \"on_completion\",\n }),\n\n /** Free-form deliverable spec (refers to DELIVERABLE.md slugs or describes inline). */\n deliverableSpec: z.unknown().optional(),\n\n /** Required signatures (defers to agentgovernance/v1 contractual approval framework). */\n requiredSignatures: z.array(requiredSignerSchema).default([]),\n\n /** Legal jurisdiction + governing law. */\n governingLaw: z.string().optional(),\n jurisdiction: z.string().optional(),\n\n /** Hash of the rendered SoW PDF (or canonical bytes if no PDF). Witness for the signature. */\n documentHash: sha256HexSchema.optional(),\n /** Storage ref for the rendered immutable PDF/document. */\n documentBlobRef: z.string().optional(),\n\n /** Versioning chain. */\n version: z.string().default(\"1\"),\n /** Self-ref to the previous version's slug (when this agreement supersedes another). */\n parentAgreement: kebabSlugSchema.optional(),\n\n effectiveAt: isoDatetimeOrDateSchema.optional(),\n expiresAt: isoDatetimeOrDateSchema.optional(),\n signedAt: isoDatetimeOrDateSchema.optional(),\n})\nexport type AgreementFrontmatter = z.infer<typeof agreementFrontmatterSchema>\n\nexport interface Agreement {\n frontmatter: AgreementFrontmatter\n body: string\n}\n\nexport const AGREEMENT_FILENAME = \"AGREEMENT.md\" as const\n","import { z } from \"zod\"\nimport {\n envelope,\n isoDatetimeOrDateSchema,\n kebabSlugSchema,\n partyRefStrictSchema,\n sha256HexSchema,\n workspacePathSchema,\n} from \"./_common.js\"\n\n/**\n * agentagencies/v1 — `DELIVERABLE.md` doctype.\n *\n * Submitted work product. Extends companies.sh `TASK.md` semantics with\n * attachments and deferment to agentgovernance/v1 for client validation\n * (typically `requiredSignatures: [counterparty:<id>]`).\n */\n\nexport const DELIVERABLE_STATUS = [\n \"draft\",\n \"submitted\",\n \"under_review\",\n \"validated\",\n \"rejected\",\n \"revised\",\n \"superseded\",\n] as const\nexport const deliverableStatusSchema = z.enum(DELIVERABLE_STATUS)\nexport type DeliverableStatus = z.infer<typeof deliverableStatusSchema>\n\nconst requiredSignerSchema = z.object({\n signer: partyRefStrictSchema,\n method: z.enum([\n \"typed_name\",\n \"agent_confirm\",\n \"click_through\",\n \"esign_external\",\n ]),\n weight: z.number().min(0).optional(),\n})\n\nexport const deliverableFrontmatterSchema = z.object({\n ...envelope(\"deliverable\"),\n\n status: deliverableStatusSchema.default(\"draft\"),\n\n /** Path to the linked TASK.md (companies.sh) if this deliverable resulted from one. */\n taskPath: workspacePathSchema.optional(),\n\n /**\n * Workspace-relative paths to attached work products (binary or other artifacts).\n * Each MAY be hashed; the hash anchors what was reviewed.\n */\n attachments: z\n .array(\n z.object({\n path: workspacePathSchema,\n contentHash: sha256HexSchema.optional(),\n kind: z.string().optional(), // \"image\", \"pdf\", \"video\", \"document\", \"code\", etc.\n })\n )\n .default([]),\n\n /** Required signatures for client validation (typically `[counterparty:<id>]`). */\n requiredSignatures: z.array(requiredSignerSchema).default([]),\n\n /** Hash of the deliverable.md frontmatter+body — what the signer signs against. */\n documentHash: sha256HexSchema.optional(),\n\n /** Self-ref for revision chain. */\n parentDeliverable: kebabSlugSchema.optional(),\n version: z.string().default(\"1\"),\n\n submittedAt: isoDatetimeOrDateSchema.optional(),\n validatedAt: isoDatetimeOrDateSchema.optional(),\n rejectedAt: isoDatetimeOrDateSchema.optional(),\n rejectionReason: z.string().optional(),\n})\nexport type DeliverableFrontmatter = z.infer<\n typeof deliverableFrontmatterSchema\n>\n\nexport interface Deliverable {\n frontmatter: DeliverableFrontmatter\n body: string\n}\n\nexport const DELIVERABLE_FILENAME = \"DELIVERABLE.md\" as const\n","import { z } from \"zod\"\nimport {\n currencyIsoSchema,\n envelope,\n isoDatetimeOrDateSchema,\n kebabSlugSchema,\n sha256HexSchema,\n} from \"./_common.js\"\n\n/**\n * agentagencies/v1 — `INVOICE.md` doctype.\n *\n * Invoice issued to a counterparty. Carries line items, tax lines, totals,\n * FX (when invoice currency differs from billing-account base), payment status,\n * and `externalRefs.<provider>` for payment provider linkage (Stripe checkout\n * sessions, payment intents, etc.).\n *\n * Invoice numbering is per-tenant gapless (driven by `_state/invoice-sequence.json`\n * file-lock pattern in the runtime layer; format like `INV-YYYY-NNNNN`).\n */\n\nexport const INVOICE_STATUS = [\n \"draft\",\n \"issued\",\n \"paid\",\n \"void\",\n \"uncollectible\",\n] as const\nexport const invoiceStatusSchema = z.enum(INVOICE_STATUS)\nexport type InvoiceStatus = z.infer<typeof invoiceStatusSchema>\n\nconst lineItemSchema = z.object({\n lineItemId: z.uuid(),\n description: z.string().min(1),\n quantity: z.number().positive().default(1),\n unitAmount: z.number().nonnegative(),\n /** Reference to the originating engagement deliverable / agreement line item. */\n sourceRef: z.string().optional(),\n})\n\nconst taxLineSchema = z.object({\n /** Decimal rate (e.g., 0.20 for 20% VAT). */\n rate: z.number().min(0).max(1),\n /** Base amount taxed. */\n base: z.number().nonnegative(),\n /** Computed tax amount. */\n amount: z.number().nonnegative(),\n /** Jurisdiction code (e.g., \"FR-VAT\", \"US-CA-SALES\"). */\n jurisdiction: z.string(),\n})\n\nconst externalRefsSchema = z.record(\n z.string(),\n z.record(z.string(), z.string()).optional()\n)\n\nexport const invoiceFrontmatterSchema = z.object({\n ...envelope(\"invoice\"),\n\n status: invoiceStatusSchema.default(\"draft\"),\n\n /** Per-tenant gapless invoice number (e.g., INV-2026-00042). */\n invoiceNumber: z.string().min(1),\n\n /** Workspace-relative path to the engagement folder. */\n engagementSlug: kebabSlugSchema.optional(),\n agreementSlug: kebabSlugSchema.optional(),\n counterpartyId: kebabSlugSchema,\n billingAccountId: kebabSlugSchema.optional(),\n\n lineItems: z.array(lineItemSchema).min(1),\n taxLines: z.array(taxLineSchema).default([]),\n\n subtotal: z.number().nonnegative(),\n taxTotal: z.number().nonnegative().default(0),\n total: z.number().nonnegative(),\n currency: currencyIsoSchema,\n\n /** FX snapshot — used when invoice currency != billing-account base currency. */\n fxRate: z.number().positive().optional(),\n fxBaseCurrency: currencyIsoSchema.optional(),\n fxAt: isoDatetimeOrDateSchema.optional(),\n\n dueAt: isoDatetimeOrDateSchema.optional(),\n issuedAt: isoDatetimeOrDateSchema.optional(),\n paidAt: isoDatetimeOrDateSchema.optional(),\n voidedAt: isoDatetimeOrDateSchema.optional(),\n voidReason: z.string().optional(),\n\n /** Storage ref for the rendered immutable PDF. */\n pdfBlobRef: z.string().optional(),\n /** SHA-256 of the rendered PDF. */\n pdfHash: sha256HexSchema.optional(),\n\n /** Provider-specific linkage — Stripe payment intent id, paypal capture id, etc. */\n externalRefs: externalRefsSchema.optional(),\n\n /** Public payment link (set after `issueInvoiceCheckoutTool` runs). */\n paymentLinkUrl: z.string().optional(),\n\n /** Dunning state for retainer/late invoices. */\n dunningState: z\n .enum([\"none\", \"reminder_1\", \"reminder_2\", \"final_notice\", \"collections\"])\n .default(\"none\"),\n nextReminderAt: isoDatetimeOrDateSchema.optional(),\n})\nexport type InvoiceFrontmatter = z.infer<typeof invoiceFrontmatterSchema>\n\nexport interface Invoice {\n frontmatter: InvoiceFrontmatter\n body: string\n}\n\nexport const INVOICE_FILENAME = \"INVOICE.md\" as const\n","import { z } from \"zod\"\nimport {\n envelope,\n isoDurationSchema,\n kebabSlugSchema,\n partyRefStrictSchema,\n timezoneSchema,\n} from \"./_common.js\"\n\n/**\n * agentagencies/v1 — `ROUTINE.md` doctype.\n *\n * Schedule **only** — cron, triggers, conditions, escalation. References a\n * PROCEDURE.md by slug for the *what*. (Upgrades agentcompanies/v1's\n * `TASK.recurring: true` boolean with full-fidelity scheduling.)\n *\n * Examples:\n * - prestation-followup → every 48h, if any ENGAGEMENT.md is suspended on\n * a counterparty action longer than threshold, runs `nudge-counterparty` procedure.\n * - monthly-retainer-invoice → 1st of month at 09:00 local; runs\n * `issue-monthly-retainer-invoice` procedure.\n */\n\nconst triggerScheduleSchema = z.object({\n kind: z.literal(\"schedule\"),\n /** Standard 5-field cron (UTC by default unless timezone is set). */\n cronExpression: z.string().min(1),\n timezone: timezoneSchema.optional(),\n})\n\nconst triggerEventSchema = z.object({\n kind: z.literal(\"event\"),\n /** Event type to react to (free-form for v1). */\n eventType: z.string(),\n})\n\nconst triggerWebhookSchema = z.object({\n kind: z.literal(\"webhook\"),\n webhookSlug: z.string(),\n})\n\nexport const routineTriggerSchema = z.discriminatedUnion(\"kind\", [\n triggerScheduleSchema,\n triggerEventSchema,\n triggerWebhookSchema,\n])\nexport type RoutineTrigger = z.infer<typeof routineTriggerSchema>\n\nconst routineConditionSchema = z.object({\n /** Free-form condition expression (e.g., \"engagementStatus == 'pending_signature'\"). */\n expression: z.string().optional(),\n /** Pre-defined condition kinds for common cases. */\n engagementStatus: z.string().optional(),\n /** Maximum runs per period (e.g., max 3 nudges per week). */\n maxPerPeriod: z\n .object({\n count: z.number().positive(),\n period: isoDurationSchema,\n })\n .optional(),\n})\n\nconst routineEscalationSchema = z.object({\n /** ISO duration: how long before deadline to escalate. */\n ifPendingAfter: isoDurationSchema,\n escalateTo: z.array(partyRefStrictSchema).min(1),\n})\n\nexport const routineFrontmatterSchema = z.object({\n ...envelope(\"routine\"),\n\n /** Procedure to run on trigger (PROCEDURE.md slug). */\n runs: kebabSlugSchema,\n\n trigger: routineTriggerSchema,\n\n conditions: z.array(routineConditionSchema).default([]),\n escalation: routineEscalationSchema.optional(),\n\n /** Disabled flag for ad-hoc pausing without deletion. */\n enabled: z.boolean().default(true),\n})\nexport type RoutineFrontmatter = z.infer<typeof routineFrontmatterSchema>\n\nexport interface Routine {\n frontmatter: RoutineFrontmatter\n body: string\n}\n\nexport const ROUTINE_FILENAME = \"ROUTINE.md\" as const\n","import { z } from \"zod\"\nimport {\n envelope,\n isoDatetimeOrDateSchema,\n kebabSlugSchema,\n partyRefStrictSchema,\n} from \"./_common.js\"\n\n/**\n * agentagencies/v1 — `CAPACITY.md` doctype.\n *\n * Operator availability, current load, vertical specialization. Per-agent or\n * per-team. Used by routing logic to pick who gets a new engagement / step.\n */\n\nconst availabilityWindowSchema = z.object({\n /** ISO weekday name or 0-6 (Mon=0..Sun=6). */\n weekday: z.union([\n z.number().min(0).max(6),\n z.enum([\"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\", \"sun\"]),\n ]),\n /** \"HH:MM\" 24h start time (in operator's timezone). */\n start: z.string().regex(/^\\d{2}:\\d{2}$/),\n end: z.string().regex(/^\\d{2}:\\d{2}$/),\n})\n\nexport const capacityFrontmatterSchema = z.object({\n ...envelope(\"capacity\"),\n\n /** The party this capacity describes (operator, agent, or team). */\n for: partyRefStrictSchema,\n\n /** Recurring availability windows (in operator's timezone). */\n availability: z.array(availabilityWindowSchema).default([]),\n\n /** Maximum concurrent engagements. */\n maxConcurrentEngagements: z.number().positive().optional(),\n\n /** Maximum hours per week of billable work. */\n maxBillableHoursPerWeek: z.number().positive().optional(),\n\n /** Vertical specializations (slugs of services or templates). */\n specializations: z.array(kebabSlugSchema).default([]),\n\n /** Current load — denorm of in-flight work (regenerated by runtime). */\n currentEngagementCount: z.number().nonnegative().optional(),\n currentBillableHoursThisWeek: z.number().nonnegative().optional(),\n\n /** Out-of-office / unavailability windows. */\n blockedWindows: z\n .array(\n z.object({\n from: isoDatetimeOrDateSchema,\n until: isoDatetimeOrDateSchema,\n reason: z.string().optional(),\n })\n )\n .default([]),\n})\nexport type CapacityFrontmatter = z.infer<typeof capacityFrontmatterSchema>\n\nexport interface Capacity {\n frontmatter: CapacityFrontmatter\n body: string\n}\n\nexport const CAPACITY_FILENAME = \"CAPACITY.md\" as const\n"]}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { agencyFrontmatterSchema, operationsFrontmatterSchema, serviceFrontmatterSchema, procedureFrontmatterSchema, pricingModelFrontmatterSchema, counterpartyFrontmatterSchema, engagementFrontmatterSchema, agreementFrontmatterSchema, deliverableFrontmatterSchema, invoiceFrontmatterSchema, routineFrontmatterSchema, capacityFrontmatterSchema } from './chunk-DYQ4A5HV.mjs';
|
|
2
|
+
import matter from 'gray-matter';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @agentproto/agencies v0.1.0-alpha
|
|
6
|
+
* agentagencies/v1 — operating layer for entities that exercise agency.
|
|
7
|
+
* Vendor-neutral. Filesystem-first. Extends agentcompanies/v1 + agentgovernance/v1.
|
|
8
|
+
*/
|
|
9
|
+
function fromZodError(err2) {
|
|
10
|
+
return err2.issues.map((issue) => ({
|
|
11
|
+
path: issue.path.map((p) => String(p)),
|
|
12
|
+
message: issue.message,
|
|
13
|
+
code: issue.code
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
function err(message, code, path = []) {
|
|
17
|
+
return [{ path, message, code }];
|
|
18
|
+
}
|
|
19
|
+
function makeFrontmatterValidator(schema) {
|
|
20
|
+
return (markdown) => {
|
|
21
|
+
let parsed;
|
|
22
|
+
try {
|
|
23
|
+
parsed = matter(markdown);
|
|
24
|
+
} catch (e) {
|
|
25
|
+
return {
|
|
26
|
+
ok: false,
|
|
27
|
+
errors: err(
|
|
28
|
+
`Frontmatter parse error: ${e.message}`,
|
|
29
|
+
"parse_error"
|
|
30
|
+
),
|
|
31
|
+
warnings: []
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const result = schema.safeParse(parsed.data);
|
|
35
|
+
if (!result.success) {
|
|
36
|
+
return {
|
|
37
|
+
ok: false,
|
|
38
|
+
errors: fromZodError(result.error).map((e) => ({
|
|
39
|
+
...e,
|
|
40
|
+
path: ["frontmatter", ...e.path]
|
|
41
|
+
})),
|
|
42
|
+
warnings: []
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
ok: true,
|
|
47
|
+
value: { frontmatter: result.data, body: parsed.content },
|
|
48
|
+
warnings: []
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
var validateAgency = makeFrontmatterValidator(agencyFrontmatterSchema);
|
|
53
|
+
var validateOperations = makeFrontmatterValidator(operationsFrontmatterSchema);
|
|
54
|
+
var validateService = makeFrontmatterValidator(serviceFrontmatterSchema);
|
|
55
|
+
var validateProcedure = makeFrontmatterValidator(procedureFrontmatterSchema);
|
|
56
|
+
var validatePricingModel = makeFrontmatterValidator(pricingModelFrontmatterSchema);
|
|
57
|
+
var validateCounterparty = makeFrontmatterValidator(counterpartyFrontmatterSchema);
|
|
58
|
+
var validateEngagement = makeFrontmatterValidator(engagementFrontmatterSchema);
|
|
59
|
+
var validateAgreement = makeFrontmatterValidator(agreementFrontmatterSchema);
|
|
60
|
+
var validateDeliverable = makeFrontmatterValidator(deliverableFrontmatterSchema);
|
|
61
|
+
var validateInvoice = makeFrontmatterValidator(invoiceFrontmatterSchema);
|
|
62
|
+
var validateRoutine = makeFrontmatterValidator(routineFrontmatterSchema);
|
|
63
|
+
var validateCapacity = makeFrontmatterValidator(capacityFrontmatterSchema);
|
|
64
|
+
function checkAgenciesConsistency(ws) {
|
|
65
|
+
const errors = [];
|
|
66
|
+
const has = (m, key) => !!m && m.has(key);
|
|
67
|
+
for (const [slug, svc] of ws.services ?? /* @__PURE__ */ new Map()) {
|
|
68
|
+
const fm = svc.frontmatter;
|
|
69
|
+
if (fm.defaultProcedure && !has(ws.procedures, fm.defaultProcedure)) {
|
|
70
|
+
errors.push({
|
|
71
|
+
path: ["services", slug, "frontmatter", "defaultProcedure"],
|
|
72
|
+
message: `SERVICE.defaultProcedure '${fm.defaultProcedure}' has no matching PROCEDURE.md`,
|
|
73
|
+
code: "dangling_ref"
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (fm.defaultPricingModel && !has(ws.pricingModels, fm.defaultPricingModel)) {
|
|
77
|
+
errors.push({
|
|
78
|
+
path: ["services", slug, "frontmatter", "defaultPricingModel"],
|
|
79
|
+
message: `SERVICE.defaultPricingModel '${fm.defaultPricingModel}' has no matching PRICING-MODEL.md`,
|
|
80
|
+
code: "dangling_ref"
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
for (const [slug, eng] of ws.engagements ?? /* @__PURE__ */ new Map()) {
|
|
85
|
+
const fm = eng.frontmatter;
|
|
86
|
+
if (fm.serviceSlug && !has(ws.services, fm.serviceSlug)) {
|
|
87
|
+
errors.push({
|
|
88
|
+
path: ["engagements", slug, "frontmatter", "serviceSlug"],
|
|
89
|
+
message: `ENGAGEMENT.serviceSlug '${fm.serviceSlug}' has no matching SERVICE.md`,
|
|
90
|
+
code: "dangling_ref"
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
if (fm.activeProcedure && !has(ws.procedures, fm.activeProcedure)) {
|
|
94
|
+
errors.push({
|
|
95
|
+
path: ["engagements", slug, "frontmatter", "activeProcedure"],
|
|
96
|
+
message: `ENGAGEMENT.activeProcedure '${fm.activeProcedure}' has no matching PROCEDURE.md`,
|
|
97
|
+
code: "dangling_ref"
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
if (!has(ws.counterparties, fm.primaryCounterpartyId)) {
|
|
101
|
+
errors.push({
|
|
102
|
+
path: ["engagements", slug, "frontmatter", "primaryCounterpartyId"],
|
|
103
|
+
message: `ENGAGEMENT.primaryCounterpartyId '${fm.primaryCounterpartyId}' has no matching COUNTERPARTY.md`,
|
|
104
|
+
code: "dangling_ref"
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
for (const [slug, agr] of ws.agreements ?? /* @__PURE__ */ new Map()) {
|
|
109
|
+
const fm = agr.frontmatter;
|
|
110
|
+
if (!has(ws.counterparties, fm.primaryCounterpartyId)) {
|
|
111
|
+
errors.push({
|
|
112
|
+
path: ["agreements", slug, "frontmatter", "primaryCounterpartyId"],
|
|
113
|
+
message: `AGREEMENT.primaryCounterpartyId '${fm.primaryCounterpartyId}' has no matching COUNTERPARTY.md`,
|
|
114
|
+
code: "dangling_ref"
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
for (const [slug, inv] of ws.invoices ?? /* @__PURE__ */ new Map()) {
|
|
119
|
+
const fm = inv.frontmatter;
|
|
120
|
+
if (!has(ws.counterparties, fm.counterpartyId)) {
|
|
121
|
+
errors.push({
|
|
122
|
+
path: ["invoices", slug, "frontmatter", "counterpartyId"],
|
|
123
|
+
message: `INVOICE.counterpartyId '${fm.counterpartyId}' has no matching COUNTERPARTY.md`,
|
|
124
|
+
code: "dangling_ref"
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
if (fm.engagementSlug && !has(ws.engagements, fm.engagementSlug)) {
|
|
128
|
+
errors.push({
|
|
129
|
+
path: ["invoices", slug, "frontmatter", "engagementSlug"],
|
|
130
|
+
message: `INVOICE.engagementSlug '${fm.engagementSlug}' has no matching ENGAGEMENT.md`,
|
|
131
|
+
code: "dangling_ref"
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
for (const [slug, r] of ws.routines ?? /* @__PURE__ */ new Map()) {
|
|
136
|
+
if (!has(ws.procedures, r.frontmatter.runs)) {
|
|
137
|
+
errors.push({
|
|
138
|
+
path: ["routines", slug, "frontmatter", "runs"],
|
|
139
|
+
message: `ROUTINE.runs '${r.frontmatter.runs}' has no matching PROCEDURE.md`,
|
|
140
|
+
code: "dangling_ref"
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return errors;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export { checkAgenciesConsistency, validateAgency, validateAgreement, validateCapacity, validateCounterparty, validateDeliverable, validateEngagement, validateInvoice, validateOperations, validatePricingModel, validateProcedure, validateRoutine, validateService };
|
|
148
|
+
//# sourceMappingURL=chunk-GAJQ5ZC2.mjs.map
|
|
149
|
+
//# sourceMappingURL=chunk-GAJQ5ZC2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/spec/validators/index.ts"],"names":["err"],"mappings":";;;;;;;;AA6DA,SAAS,aAAaA,IAAAA,EAAoC;AACxD,EAAA,OAAOA,IAAAA,CAAI,MAAA,CAAO,GAAA,CAAI,CAAA,KAAA,MAAU;AAAA,IAC9B,MAAM,KAAA,CAAM,IAAA,CAA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,IAAA,IAAI,EAAA,CAAG,kBAAkB,CAAC,GAAA,CAAI,GAAG,WAAA,EAAa,EAAA,CAAG,cAAc,CAAA,EAAG;AAChE,MAAA,MAAA,CAAO,IAAA,CAAK;AAAA,QACV,IAAA,EAAM,CAAC,UAAA,EAAY,IAAA,EAAM,eAAe,gBAAgB,CAAA;AAAA,QACxD,OAAA,EAAS,CAAA,wBAAA,EAA2B,EAAA,CAAG,cAAc,CAAA,+BAAA,CAAA;AAAA,QACrD,IAAA,EAAM;AAAA,OACP,CAAA;AAAA,IACH;AAAA,EACF;AAEA,EAAA,KAAA,MAAW,CAAC,MAAM,CAAC,CAAA,IAAK,GAAG,QAAA,oBAAY,IAAI,KAAI,EAAG;AAChD,IAAA,IAAI,CAAC,GAAA,CAAI,EAAA,CAAG,YAAY,CAAA,CAAE,WAAA,CAAY,IAAI,CAAA,EAAG;AAC3C,MAAA,MAAA,CAAO,IAAA,CAAK;AAAA,QACV,IAAA,EAAM,CAAC,UAAA,EAAY,IAAA,EAAM,eAAe,MAAM,CAAA;AAAA,QAC9C,OAAA,EAAS,CAAA,cAAA,EAAiB,CAAA,CAAE,WAAA,CAAY,IAAI,CAAA,8BAAA,CAAA;AAAA,QAC5C,IAAA,EAAM;AAAA,OACP,CAAA;AAAA,IACH;AAAA,EACF;AAEA,EAAA,OAAO,MAAA;AACT","file":"chunk-GAJQ5ZC2.mjs","sourcesContent":["/**\n * agentagencies/v1 validators.\n *\n * Per-doctype validators take file content (markdown string for *.md, JSON\n * string for *.json) and return typed ValidationResult. Cross-doctype\n * consistency checks live alongside.\n *\n * Validators do NOT touch the filesystem — callers pass file contents in.\n * For FS-aware orchestration, see `../../runtime/`.\n */\n\nimport type { z } from \"zod\"\nimport matter from \"gray-matter\"\n\nimport { agencyFrontmatterSchema, type Agency } from \"../doctypes/agency.js\"\nimport {\n operationsFrontmatterSchema,\n type Operations,\n} from \"../doctypes/operations.js\"\nimport { serviceFrontmatterSchema, type Service } from \"../doctypes/service.js\"\nimport {\n procedureFrontmatterSchema,\n type Procedure,\n} from \"../doctypes/procedure.js\"\nimport {\n pricingModelFrontmatterSchema,\n type PricingModel,\n} from \"../doctypes/pricing-model.js\"\nimport {\n counterpartyFrontmatterSchema,\n type Counterparty,\n} from \"../doctypes/counterparty.js\"\nimport {\n engagementFrontmatterSchema,\n type Engagement,\n} from \"../doctypes/engagement.js\"\nimport {\n agreementFrontmatterSchema,\n type Agreement,\n} from \"../doctypes/agreement.js\"\nimport {\n deliverableFrontmatterSchema,\n type Deliverable,\n} from \"../doctypes/deliverable.js\"\nimport { invoiceFrontmatterSchema, type Invoice } from \"../doctypes/invoice.js\"\nimport { routineFrontmatterSchema, type Routine } from \"../doctypes/routine.js\"\nimport {\n capacityFrontmatterSchema,\n type Capacity,\n} from \"../doctypes/capacity.js\"\n\nexport type ValidationResult<T = unknown> =\n | { ok: true; value: T; warnings: string[] }\n | { ok: false; errors: ValidationError[]; warnings: string[] }\n\nexport interface ValidationError {\n path: string[]\n message: string\n code?: string\n}\n\nfunction fromZodError(err: z.ZodError): ValidationError[] {\n return err.issues.map(issue => ({\n path: issue.path.map(p => String(p)),\n message: issue.message,\n code: issue.code,\n }))\n}\n\nfunction err(\n message: string,\n code: string,\n path: string[] = []\n): ValidationError[] {\n return [{ path, message, code }]\n}\n\n// Generic frontmatter-doctype validator factory — DRY across the 12 doctypes.\nfunction makeFrontmatterValidator<\n TFm,\n TDoc extends { frontmatter: TFm; body: string },\n>(schema: z.ZodType<TFm>): (markdown: string) => ValidationResult<TDoc> {\n return (markdown: string) => {\n let parsed: ReturnType<typeof matter>\n try {\n parsed = matter(markdown)\n } catch (e) {\n return {\n ok: false,\n errors: err(\n `Frontmatter parse error: ${(e as Error).message}`,\n \"parse_error\"\n ),\n warnings: [],\n }\n }\n const result = schema.safeParse(parsed.data)\n if (!result.success) {\n return {\n ok: false,\n errors: fromZodError(result.error).map(e => ({\n ...e,\n path: [\"frontmatter\", ...e.path],\n })),\n warnings: [],\n }\n }\n return {\n ok: true,\n value: { frontmatter: result.data, body: parsed.content } as TDoc,\n warnings: [],\n }\n }\n}\n\n// ─── Per-doctype validators (12 of them) ──────────────────────────────\n\nexport const validateAgency = makeFrontmatterValidator<\n typeof agencyFrontmatterSchema._zod.output,\n Agency\n>(agencyFrontmatterSchema)\nexport const validateOperations = makeFrontmatterValidator<\n typeof operationsFrontmatterSchema._zod.output,\n Operations\n>(operationsFrontmatterSchema)\nexport const validateService = makeFrontmatterValidator<\n typeof serviceFrontmatterSchema._zod.output,\n Service\n>(serviceFrontmatterSchema)\nexport const validateProcedure = makeFrontmatterValidator<\n typeof procedureFrontmatterSchema._zod.output,\n Procedure\n>(procedureFrontmatterSchema)\nexport const validatePricingModel = makeFrontmatterValidator<\n typeof pricingModelFrontmatterSchema._zod.output,\n PricingModel\n>(pricingModelFrontmatterSchema)\nexport const validateCounterparty = makeFrontmatterValidator<\n typeof counterpartyFrontmatterSchema._zod.output,\n Counterparty\n>(counterpartyFrontmatterSchema)\nexport const validateEngagement = makeFrontmatterValidator<\n typeof engagementFrontmatterSchema._zod.output,\n Engagement\n>(engagementFrontmatterSchema)\nexport const validateAgreement = makeFrontmatterValidator<\n typeof agreementFrontmatterSchema._zod.output,\n Agreement\n>(agreementFrontmatterSchema)\nexport const validateDeliverable = makeFrontmatterValidator<\n typeof deliverableFrontmatterSchema._zod.output,\n Deliverable\n>(deliverableFrontmatterSchema)\nexport const validateInvoice = makeFrontmatterValidator<\n typeof invoiceFrontmatterSchema._zod.output,\n Invoice\n>(invoiceFrontmatterSchema)\nexport const validateRoutine = makeFrontmatterValidator<\n typeof routineFrontmatterSchema._zod.output,\n Routine\n>(routineFrontmatterSchema)\nexport const validateCapacity = makeFrontmatterValidator<\n typeof capacityFrontmatterSchema._zod.output,\n Capacity\n>(capacityFrontmatterSchema)\n\n// ─── Cross-doctype consistency ────────────────────────────────────────\n\nexport interface AgenciesWorkspaceFiles {\n agency?: Agency\n operations?: Operations\n services?: Map<string, Service>\n procedures?: Map<string, Procedure>\n pricingModels?: Map<string, PricingModel>\n counterparties?: Map<string, Counterparty>\n engagements?: Map<string, Engagement>\n agreements?: Map<string, Agreement>\n deliverables?: Map<string, Deliverable>\n invoices?: Map<string, Invoice>\n routines?: Map<string, Routine>\n capacities?: Map<string, Capacity>\n}\n\n/**\n * Walk a parsed workspace and check cross-doctype consistency:\n * - SERVICE.defaultProcedure refs an existing PROCEDURE.md\n * - SERVICE.defaultPricingModel refs an existing PRICING-MODEL.md\n * - ENGAGEMENT.serviceSlug refs an existing SERVICE.md\n * - ENGAGEMENT.activeProcedure refs an existing PROCEDURE.md\n * - ENGAGEMENT.primaryCounterpartyId refs an existing COUNTERPARTY.md\n * - AGREEMENT.primaryCounterpartyId refs an existing COUNTERPARTY.md\n * - INVOICE.engagementSlug + INVOICE.counterpartyId ref existing entries\n * - ROUTINE.runs refs an existing PROCEDURE.md\n *\n * Returns a list of ValidationError; empty list = consistent.\n */\nexport function checkAgenciesConsistency(\n ws: AgenciesWorkspaceFiles\n): ValidationError[] {\n const errors: ValidationError[] = []\n const has = <K, V>(m: Map<K, V> | undefined, key: K): boolean =>\n !!m && m.has(key)\n\n for (const [slug, svc] of ws.services ?? new Map()) {\n const fm = svc.frontmatter\n if (fm.defaultProcedure && !has(ws.procedures, fm.defaultProcedure)) {\n errors.push({\n path: [\"services\", slug, \"frontmatter\", \"defaultProcedure\"],\n message: `SERVICE.defaultProcedure '${fm.defaultProcedure}' has no matching PROCEDURE.md`,\n code: \"dangling_ref\",\n })\n }\n if (\n fm.defaultPricingModel &&\n !has(ws.pricingModels, fm.defaultPricingModel)\n ) {\n errors.push({\n path: [\"services\", slug, \"frontmatter\", \"defaultPricingModel\"],\n message: `SERVICE.defaultPricingModel '${fm.defaultPricingModel}' has no matching PRICING-MODEL.md`,\n code: \"dangling_ref\",\n })\n }\n }\n\n for (const [slug, eng] of ws.engagements ?? new Map()) {\n const fm = eng.frontmatter\n if (fm.serviceSlug && !has(ws.services, fm.serviceSlug)) {\n errors.push({\n path: [\"engagements\", slug, \"frontmatter\", \"serviceSlug\"],\n message: `ENGAGEMENT.serviceSlug '${fm.serviceSlug}' has no matching SERVICE.md`,\n code: \"dangling_ref\",\n })\n }\n if (fm.activeProcedure && !has(ws.procedures, fm.activeProcedure)) {\n errors.push({\n path: [\"engagements\", slug, \"frontmatter\", \"activeProcedure\"],\n message: `ENGAGEMENT.activeProcedure '${fm.activeProcedure}' has no matching PROCEDURE.md`,\n code: \"dangling_ref\",\n })\n }\n if (!has(ws.counterparties, fm.primaryCounterpartyId)) {\n errors.push({\n path: [\"engagements\", slug, \"frontmatter\", \"primaryCounterpartyId\"],\n message: `ENGAGEMENT.primaryCounterpartyId '${fm.primaryCounterpartyId}' has no matching COUNTERPARTY.md`,\n code: \"dangling_ref\",\n })\n }\n }\n\n for (const [slug, agr] of ws.agreements ?? new Map()) {\n const fm = agr.frontmatter\n if (!has(ws.counterparties, fm.primaryCounterpartyId)) {\n errors.push({\n path: [\"agreements\", slug, \"frontmatter\", \"primaryCounterpartyId\"],\n message: `AGREEMENT.primaryCounterpartyId '${fm.primaryCounterpartyId}' has no matching COUNTERPARTY.md`,\n code: \"dangling_ref\",\n })\n }\n }\n\n for (const [slug, inv] of ws.invoices ?? new Map()) {\n const fm = inv.frontmatter\n if (!has(ws.counterparties, fm.counterpartyId)) {\n errors.push({\n path: [\"invoices\", slug, \"frontmatter\", \"counterpartyId\"],\n message: `INVOICE.counterpartyId '${fm.counterpartyId}' has no matching COUNTERPARTY.md`,\n code: \"dangling_ref\",\n })\n }\n if (fm.engagementSlug && !has(ws.engagements, fm.engagementSlug)) {\n errors.push({\n path: [\"invoices\", slug, \"frontmatter\", \"engagementSlug\"],\n message: `INVOICE.engagementSlug '${fm.engagementSlug}' has no matching ENGAGEMENT.md`,\n code: \"dangling_ref\",\n })\n }\n }\n\n for (const [slug, r] of ws.routines ?? new Map()) {\n if (!has(ws.procedures, r.frontmatter.runs)) {\n errors.push({\n path: [\"routines\", slug, \"frontmatter\", \"runs\"],\n message: `ROUTINE.runs '${r.frontmatter.runs}' has no matching PROCEDURE.md`,\n code: \"dangling_ref\",\n })\n }\n }\n\n return errors\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-SOJ4GQR7.mjs"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agentagencies/v1 composition resolver.
|
|
3
|
+
*
|
|
4
|
+
* Resolves operations doctype references across the four supported patterns
|
|
5
|
+
* (mirroring skills.sh resolution):
|
|
6
|
+
*
|
|
7
|
+
* 1. Embedded — operations doctypes inside the company package
|
|
8
|
+
* (e.g., `services/<slug>/SERVICE.md`)
|
|
9
|
+
*
|
|
10
|
+
* 2. External package — `OPERATIONS.md` root + `includes[]` from
|
|
11
|
+
* `AGENCY.md` / `COMPANY.md`
|
|
12
|
+
*
|
|
13
|
+
* 3. Per-agent — operations attached to a specific `AGENTS.md`
|
|
14
|
+
* (e.g., `agents/<agent>/services/<slug>/SERVICE.md`)
|
|
15
|
+
*
|
|
16
|
+
* 4. Registry-resolved — `agencies.sh` shortname (`design-project-retainer-v2`)
|
|
17
|
+
* → fetched + pinned to commit at install time
|
|
18
|
+
*
|
|
19
|
+
* Resolution order: local → included → registry. Same as skills.sh.
|
|
20
|
+
*
|
|
21
|
+
* v1 implementation covers patterns 1 + 3 fully. Patterns 2 and 4 require
|
|
22
|
+
* filesystem walks across includes[] / registry network calls — surfaces
|
|
23
|
+
* defined here, full implementation in runtime/.
|
|
24
|
+
*/
|
|
25
|
+
type DoctypeKind = "service" | "procedure" | "pricing-model" | "counterparty" | "engagement" | "agreement" | "deliverable" | "invoice" | "routine" | "capacity";
|
|
26
|
+
interface ResolveContext {
|
|
27
|
+
/** Workspace root (absolute path). */
|
|
28
|
+
workspaceRoot: string;
|
|
29
|
+
/** Package roots (workspace itself + any external operations packages via includes[]). */
|
|
30
|
+
includedPackageRoots?: string[];
|
|
31
|
+
/** Per-agent operations search paths (e.g., agents/<agent>/). */
|
|
32
|
+
agentRoots?: string[];
|
|
33
|
+
/** Optional registry resolver (agencies.sh shortname → cached path). */
|
|
34
|
+
resolveFromRegistry?: (shortname: string, kind: DoctypeKind) => Promise<string | null>;
|
|
35
|
+
}
|
|
36
|
+
type ResolvedReference = {
|
|
37
|
+
ok: true;
|
|
38
|
+
absolutePath: string;
|
|
39
|
+
resolvedFrom: ResolveSource;
|
|
40
|
+
} | {
|
|
41
|
+
ok: false;
|
|
42
|
+
tried: string[];
|
|
43
|
+
message: string;
|
|
44
|
+
};
|
|
45
|
+
type ResolveSource = "local" | "agent" | "included" | "registry";
|
|
46
|
+
/**
|
|
47
|
+
* Resolve a doctype reference (slug) to an absolute filesystem path.
|
|
48
|
+
*
|
|
49
|
+
* Order:
|
|
50
|
+
* 1. Local — `<workspaceRoot>/<dir>/<slug>/<FILENAME>`
|
|
51
|
+
* 2. Per-agent — `<agentRoot>/<dir>/<slug>/<FILENAME>` for each agent root
|
|
52
|
+
* 3. Included — `<includedPackageRoot>/<dir>/<slug>/<FILENAME>`
|
|
53
|
+
* 4. Registry — via `resolveFromRegistry` callback (if provided)
|
|
54
|
+
*
|
|
55
|
+
* Returns the first match.
|
|
56
|
+
*/
|
|
57
|
+
declare function resolveDoctypeRef(kind: DoctypeKind, slug: string, ctx: ResolveContext, fileExists: (absPath: string) => Promise<boolean>): Promise<ResolvedReference>;
|
|
58
|
+
/** Helper: build the conventional dir + filename for a doctype. */
|
|
59
|
+
declare function doctypePath(kind: DoctypeKind, slug: string): string;
|
|
60
|
+
|
|
61
|
+
export { type DoctypeKind, type ResolveContext, type ResolveSource, type ResolvedReference, doctypePath, resolveDoctypeRef };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @agentproto/agencies v0.1.0-alpha
|
|
5
|
+
* agentagencies/v1 — operating layer for entities that exercise agency.
|
|
6
|
+
* Vendor-neutral. Filesystem-first. Extends agentcompanies/v1 + agentgovernance/v1.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
var DOCTYPE_DIRNAME = {
|
|
10
|
+
service: "services",
|
|
11
|
+
procedure: "procedures",
|
|
12
|
+
"pricing-model": "pricing-models",
|
|
13
|
+
counterparty: "counterparties",
|
|
14
|
+
engagement: "engagements",
|
|
15
|
+
agreement: "agreements",
|
|
16
|
+
deliverable: "deliverables",
|
|
17
|
+
invoice: "invoices",
|
|
18
|
+
routine: "routines",
|
|
19
|
+
capacity: "capacity"
|
|
20
|
+
};
|
|
21
|
+
var DOCTYPE_FILENAME = {
|
|
22
|
+
service: "SERVICE.md",
|
|
23
|
+
procedure: "PROCEDURE.md",
|
|
24
|
+
"pricing-model": "PRICING-MODEL.md",
|
|
25
|
+
counterparty: "COUNTERPARTY.md",
|
|
26
|
+
engagement: "ENGAGEMENT.md",
|
|
27
|
+
agreement: "AGREEMENT.md",
|
|
28
|
+
deliverable: "DELIVERABLE.md",
|
|
29
|
+
invoice: "INVOICE.md",
|
|
30
|
+
routine: "ROUTINE.md",
|
|
31
|
+
capacity: "CAPACITY.md"
|
|
32
|
+
};
|
|
33
|
+
async function resolveDoctypeRef(kind, slug, ctx, fileExists) {
|
|
34
|
+
const dir = DOCTYPE_DIRNAME[kind];
|
|
35
|
+
const file = DOCTYPE_FILENAME[kind];
|
|
36
|
+
const tried = [];
|
|
37
|
+
const localPath = path.join(ctx.workspaceRoot, dir, slug, file);
|
|
38
|
+
tried.push(localPath);
|
|
39
|
+
if (await fileExists(localPath)) {
|
|
40
|
+
return { ok: true, absolutePath: localPath, resolvedFrom: "local" };
|
|
41
|
+
}
|
|
42
|
+
for (const agentRoot of ctx.agentRoots ?? []) {
|
|
43
|
+
const agentPath = path.join(agentRoot, dir, slug, file);
|
|
44
|
+
tried.push(agentPath);
|
|
45
|
+
if (await fileExists(agentPath)) {
|
|
46
|
+
return { ok: true, absolutePath: agentPath, resolvedFrom: "agent" };
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
for (const pkgRoot of ctx.includedPackageRoots ?? []) {
|
|
50
|
+
const includedPath = path.join(pkgRoot, dir, slug, file);
|
|
51
|
+
tried.push(includedPath);
|
|
52
|
+
if (await fileExists(includedPath)) {
|
|
53
|
+
return { ok: true, absolutePath: includedPath, resolvedFrom: "included" };
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (ctx.resolveFromRegistry) {
|
|
57
|
+
const registryPath = await ctx.resolveFromRegistry(slug, kind);
|
|
58
|
+
if (registryPath && await fileExists(registryPath)) {
|
|
59
|
+
tried.push(registryPath);
|
|
60
|
+
return { ok: true, absolutePath: registryPath, resolvedFrom: "registry" };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
ok: false,
|
|
65
|
+
tried,
|
|
66
|
+
message: `Could not resolve ${kind}:${slug} (tried ${tried.length} paths)`
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function doctypePath(kind, slug) {
|
|
70
|
+
return `${DOCTYPE_DIRNAME[kind]}/${slug}/${DOCTYPE_FILENAME[kind]}`;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { doctypePath, resolveDoctypeRef };
|
|
74
|
+
//# sourceMappingURL=index.mjs.map
|
|
75
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/spec/composition/index.ts"],"names":[],"mappings":";;;;;;;;AAuCA,IAAM,eAAA,GAA+C;AAAA,EACnD,OAAA,EAAS,UAAA;AAAA,EACT,SAAA,EAAW,YAAA;AAAA,EACX,eAAA,EAAiB,gBAAA;AAAA,EACjB,YAAA,EAAc,gBAAA;AAAA,EACd,UAAA,EAAY,aAAA;AAAA,EACZ,SAAA,EAAW,YAAA;AAAA,EACX,WAAA,EAAa,cAAA;AAAA,EACb,OAAA,EAAS,UAAA;AAAA,EACT,OAAA,EAAS,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AAA,EAAQ;AAAA,IACpE;AAAA,EACF;AAGA,EAAA,KAAA,MAAW,OAAA,IAAW,GAAA,CAAI,oBAAA,IAAwB,EAAC,EAAG;AACpD,IAAA,MAAM,YAAA,GAAoB,IAAA,CAAA,IAAA,CAAK,OAAA,EAAS,GAAA,EAAK,MAAM,IAAI,CAAA;AACvD,IAAA,KAAA,CAAM,KAAK,YAAY,CAAA;AACvB,IAAA,IAAI,MAAM,UAAA,CAAW,YAAY,CAAA,EAAG;AAClC,MAAA,OAAO,EAAE,EAAA,EAAI,IAAA,EAAM,YAAA,EAAc,YAAA,EAAc,cAAc,UAAA,EAAW;AAAA,IAC1E;AAAA,EACF;AAGA,EAAA,IAAI,IAAI,mBAAA,EAAqB;AAC3B,IAAA,MAAM,YAAA,GAAe,MAAM,GAAA,CAAI,mBAAA,CAAoB,MAAM,IAAI,CAAA;AAC7D,IAAA,IAAI,YAAA,IAAiB,MAAM,UAAA,CAAW,YAAY,CAAA,EAAI;AACpD,MAAA,KAAA,CAAM,KAAK,YAAY,CAAA;AACvB,MAAA,OAAO,EAAE,EAAA,EAAI,IAAA,EAAM,YAAA,EAAc,YAAA,EAAc,cAAc,UAAA,EAAW;AAAA,IAC1E;AAAA,EACF;AAEA,EAAA,OAAO;AAAA,IACL,EAAA,EAAI,KAAA;AAAA,IACJ,KAAA;AAAA,IACA,SAAS,CAAA,kBAAA,EAAqB,IAAI,IAAI,IAAI,CAAA,QAAA,EAAW,MAAM,MAAM,CAAA,OAAA;AAAA,GACnE;AACF;AAGO,SAAS,WAAA,CAAY,MAAmB,IAAA,EAAsB;AACnE,EAAA,OAAO,CAAA,EAAG,gBAAgB,IAAI,CAAC,IAAI,IAAI,CAAA,CAAA,EAAI,gBAAA,CAAiB,IAAI,CAAC,CAAA,CAAA;AACnE","file":"index.mjs","sourcesContent":["/**\n * agentagencies/v1 composition resolver.\n *\n * Resolves operations doctype references across the four supported patterns\n * (mirroring skills.sh resolution):\n *\n * 1. Embedded — operations doctypes inside the company package\n * (e.g., `services/<slug>/SERVICE.md`)\n *\n * 2. External package — `OPERATIONS.md` root + `includes[]` from\n * `AGENCY.md` / `COMPANY.md`\n *\n * 3. Per-agent — operations attached to a specific `AGENTS.md`\n * (e.g., `agents/<agent>/services/<slug>/SERVICE.md`)\n *\n * 4. Registry-resolved — `agencies.sh` shortname (`design-project-retainer-v2`)\n * → fetched + pinned to commit at install time\n *\n * Resolution order: local → included → registry. Same as skills.sh.\n *\n * v1 implementation covers patterns 1 + 3 fully. Patterns 2 and 4 require\n * filesystem walks across includes[] / registry network calls — surfaces\n * defined here, full implementation in runtime/.\n */\n\nimport * as path from \"node:path\"\n\nexport type DoctypeKind =\n | \"service\"\n | \"procedure\"\n | \"pricing-model\"\n | \"counterparty\"\n | \"engagement\"\n | \"agreement\"\n | \"deliverable\"\n | \"invoice\"\n | \"routine\"\n | \"capacity\"\n\nconst DOCTYPE_DIRNAME: Record<DoctypeKind, string> = {\n service: \"services\",\n procedure: \"procedures\",\n \"pricing-model\": \"pricing-models\",\n counterparty: \"counterparties\",\n engagement: \"engagements\",\n agreement: \"agreements\",\n deliverable: \"deliverables\",\n invoice: \"invoices\",\n routine: \"routines\",\n capacity: \"capacity\",\n}\n\nconst DOCTYPE_FILENAME: Record<DoctypeKind, string> = {\n service: \"SERVICE.md\",\n procedure: \"PROCEDURE.md\",\n \"pricing-model\": \"PRICING-MODEL.md\",\n counterparty: \"COUNTERPARTY.md\",\n engagement: \"ENGAGEMENT.md\",\n agreement: \"AGREEMENT.md\",\n deliverable: \"DELIVERABLE.md\",\n invoice: \"INVOICE.md\",\n routine: \"ROUTINE.md\",\n capacity: \"CAPACITY.md\",\n}\n\nexport interface ResolveContext {\n /** Workspace root (absolute path). */\n workspaceRoot: string\n /** Package roots (workspace itself + any external operations packages via includes[]). */\n includedPackageRoots?: string[]\n /** Per-agent operations search paths (e.g., agents/<agent>/). */\n agentRoots?: string[]\n /** Optional registry resolver (agencies.sh shortname → cached path). */\n resolveFromRegistry?: (\n shortname: string,\n kind: DoctypeKind\n ) => Promise<string | null>\n}\n\nexport type ResolvedReference =\n | { ok: true; absolutePath: string; resolvedFrom: ResolveSource }\n | { ok: false; tried: string[]; message: string }\n\nexport type ResolveSource = \"local\" | \"agent\" | \"included\" | \"registry\"\n\n/**\n * Resolve a doctype reference (slug) to an absolute filesystem path.\n *\n * Order:\n * 1. Local — `<workspaceRoot>/<dir>/<slug>/<FILENAME>`\n * 2. Per-agent — `<agentRoot>/<dir>/<slug>/<FILENAME>` for each agent root\n * 3. Included — `<includedPackageRoot>/<dir>/<slug>/<FILENAME>`\n * 4. Registry — via `resolveFromRegistry` callback (if provided)\n *\n * Returns the first match.\n */\nexport async function resolveDoctypeRef(\n kind: DoctypeKind,\n slug: string,\n ctx: ResolveContext,\n fileExists: (absPath: string) => Promise<boolean>\n): Promise<ResolvedReference> {\n const dir = DOCTYPE_DIRNAME[kind]\n const file = DOCTYPE_FILENAME[kind]\n const tried: string[] = []\n\n // 1. Local\n const localPath = path.join(ctx.workspaceRoot, dir, slug, file)\n tried.push(localPath)\n if (await fileExists(localPath)) {\n return { ok: true, absolutePath: localPath, resolvedFrom: \"local\" }\n }\n\n // 2. Per-agent\n for (const agentRoot of ctx.agentRoots ?? []) {\n const agentPath = path.join(agentRoot, dir, slug, file)\n tried.push(agentPath)\n if (await fileExists(agentPath)) {\n return { ok: true, absolutePath: agentPath, resolvedFrom: \"agent\" }\n }\n }\n\n // 3. Included external packages\n for (const pkgRoot of ctx.includedPackageRoots ?? []) {\n const includedPath = path.join(pkgRoot, dir, slug, file)\n tried.push(includedPath)\n if (await fileExists(includedPath)) {\n return { ok: true, absolutePath: includedPath, resolvedFrom: \"included\" }\n }\n }\n\n // 4. Registry\n if (ctx.resolveFromRegistry) {\n const registryPath = await ctx.resolveFromRegistry(slug, kind)\n if (registryPath && (await fileExists(registryPath))) {\n tried.push(registryPath)\n return { ok: true, absolutePath: registryPath, resolvedFrom: \"registry\" }\n }\n }\n\n return {\n ok: false,\n tried,\n message: `Could not resolve ${kind}:${slug} (tried ${tried.length} paths)`,\n }\n}\n\n/** Helper: build the conventional dir + filename for a doctype. */\nexport function doctypePath(kind: DoctypeKind, slug: string): string {\n return `${DOCTYPE_DIRNAME[kind]}/${slug}/${DOCTYPE_FILENAME[kind]}`\n}\n"]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export { A as AGENCY_FILENAME, a as AGREEMENT_FILENAME, b as AGREEMENT_KIND, c as AGREEMENT_STATUS, d as AUTONOMY_POSTURE, e as Agency, f as AgencyFrontmatter, g as Agreement, h as AgreementFrontmatter, i as AgreementKind, j as AgreementStatus, k as AutonomyPosture, C as CAPACITY_FILENAME, l as COUNTERPARTY_FILENAME, m as COUNTERPARTY_KIND, n as COUNTERPARTY_SOURCE, o as Capacity, p as CapacityFrontmatter, q as Counterparty, r as CounterpartyFrontmatter, D as DELIVERABLE_FILENAME, s as DELIVERABLE_STATUS, t as Deliverable, u as DeliverableFrontmatter, v as DeliverableStatus, E as ENGAGEMENT_FILENAME, w as ENGAGEMENT_KIND, x as ENGAGEMENT_STATUS, y as Engagement, z as EngagementFrontmatter, B as EngagementKind, F as EngagementStatus, I as INVOICE_FILENAME, G as INVOICE_STATUS, H as Invoice, J as InvoiceFrontmatter, K as InvoiceStatus, O as OPERATIONS_FILENAME, L as Operations, M as OperationsFrontmatter, P as PRICING_KIND, N as PRICING_MODEL_FILENAME, Q as PROCEDURE_FILENAME, R as PricingDetails, S as PricingKind, T as PricingModel, U as PricingModelFrontmatter, V as Procedure, W as ProcedureFrontmatter, X as ProcedureStep, Y as ProcedureTrigger, Z as ROUTINE_FILENAME, _ as Routine, $ as RoutineFrontmatter, a0 as RoutineTrigger, a1 as SERVICE_FILENAME, a2 as Service, a3 as ServiceFrontmatter, a4 as agencyFrontmatterSchema, a5 as agreementFrontmatterSchema, a6 as agreementKindSchema, a7 as agreementStatusSchema, a8 as autonomyPostureSchema, a9 as capacityFrontmatterSchema, aa as counterpartyFrontmatterSchema, ab as counterpartyKindSchema, ac as counterpartySourceSchema, ad as deliverableFrontmatterSchema, ae as deliverableStatusSchema, af as engagementFrontmatterSchema, ag as engagementKindSchema, ah as engagementStatusSchema, ai as invoiceFrontmatterSchema, aj as invoiceStatusSchema, ak as operationsFrontmatterSchema, al as pricingDetailsSchema, am as pricingKindSchema, an as pricingModelFrontmatterSchema, ao as procedureBranchStepSchema, ap as procedureFrontmatterSchema, aq as procedureSimpleStepSchema, ar as procedureStepSchema, as as procedureTriggerSchema, at as routineFrontmatterSchema, au as routineTriggerSchema, av as serviceFrontmatterSchema } from '../capacity-98VwY285.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Shared zod primitives used across agentagencies/v1 doctypes.
|
|
6
|
+
* Aligned with companies.sh + governance.sh conventions.
|
|
7
|
+
*/
|
|
8
|
+
declare const SCHEMA_NAME: "agentagencies/v1";
|
|
9
|
+
/** Lowercase slug: `^[a-z0-9][a-z0-9-]*$` */
|
|
10
|
+
declare const kebabSlugSchema: z.ZodString;
|
|
11
|
+
/** ISO 4217 3-letter currency code (e.g., EUR, USD, GBP). */
|
|
12
|
+
declare const currencyIsoSchema: z.ZodString;
|
|
13
|
+
/** ISO 3166 2-letter country code (e.g., FR, US, DE). */
|
|
14
|
+
declare const countryIsoSchema: z.ZodString;
|
|
15
|
+
/** IANA timezone (e.g., Europe/Paris, America/New_York). */
|
|
16
|
+
declare const timezoneSchema: z.ZodString;
|
|
17
|
+
/** ISO-8601 duration: P, PT, P1Y2M3DT4H5M6S, etc. */
|
|
18
|
+
declare const isoDurationSchema: z.ZodString;
|
|
19
|
+
/**
|
|
20
|
+
* ISO-8601 date string OR a YAML-parsed Date object (gray-matter / js-yaml
|
|
21
|
+
* auto-parses `YYYY-MM-DD` literals to Date). Normalizes to "YYYY-MM-DD" string.
|
|
22
|
+
*/
|
|
23
|
+
declare const isoDateOrDateSchema: z.ZodUnion<readonly [z.ZodISODate, z.ZodPipe<z.ZodDate, z.ZodTransform<string, Date>>]>;
|
|
24
|
+
/**
|
|
25
|
+
* ISO-8601 datetime string OR a YAML-parsed Date. YAML 1.1 auto-parses
|
|
26
|
+
* `YYYY-MM-DDTHH:MM:SS(.fff)?(Z|+/-HH:MM)?` literals to Date — the schema
|
|
27
|
+
* accepts both forms and normalizes to ISO datetime string.
|
|
28
|
+
*/
|
|
29
|
+
declare const isoDatetimeOrDateSchema: z.ZodUnion<readonly [z.ZodISODateTime, z.ZodPipe<z.ZodDate, z.ZodTransform<string, Date>>]>;
|
|
30
|
+
/** Party reference in canonical "<kind>:<slug>" form, with wildcard `*` allowed. */
|
|
31
|
+
declare const partyRefSchema: z.ZodString;
|
|
32
|
+
/** Strict slug-only party ref (no wildcard). */
|
|
33
|
+
declare const partyRefStrictSchema: z.ZodString;
|
|
34
|
+
/** Workspace-relative path (forward slashes, no leading slash, no `..`). */
|
|
35
|
+
declare const workspacePathSchema: z.ZodString;
|
|
36
|
+
/** Vendor metadata bag — `metadata.<vendor>.*` for extensions. */
|
|
37
|
+
declare const metadataSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
38
|
+
/** SHA-256 hex string (64 chars). */
|
|
39
|
+
declare const sha256HexSchema: z.ZodString;
|
|
40
|
+
/** Common authorship + provenance fields shared across doctypes. */
|
|
41
|
+
declare const authorshipFields: {
|
|
42
|
+
authors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
43
|
+
name: z.ZodString;
|
|
44
|
+
email: z.ZodOptional<z.ZodEmail>;
|
|
45
|
+
url: z.ZodOptional<z.ZodString>;
|
|
46
|
+
}, z.core.$strip>>>;
|
|
47
|
+
homepage: z.ZodOptional<z.ZodString>;
|
|
48
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
49
|
+
};
|
|
50
|
+
/** Common doctype envelope — schema + doctype literal + slug + name + description. */
|
|
51
|
+
declare function envelope<DocType extends string>(doctype: DocType): {
|
|
52
|
+
readonly schema: z.ZodLiteral<"agentagencies/v1">;
|
|
53
|
+
readonly doctype: z.ZodLiteral<DocType>;
|
|
54
|
+
readonly slug: z.ZodString;
|
|
55
|
+
readonly name: z.ZodString;
|
|
56
|
+
readonly description: z.ZodOptional<z.ZodString>;
|
|
57
|
+
readonly version: z.ZodOptional<z.ZodString>;
|
|
58
|
+
readonly metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export { SCHEMA_NAME, authorshipFields, countryIsoSchema, currencyIsoSchema, envelope, isoDateOrDateSchema, isoDatetimeOrDateSchema, isoDurationSchema, kebabSlugSchema, metadataSchema, partyRefSchema, partyRefStrictSchema, sha256HexSchema, timezoneSchema, workspacePathSchema };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import '../chunk-SOJ4GQR7.mjs';
|
|
2
|
+
export { AGENCY_FILENAME, AGREEMENT_FILENAME, AGREEMENT_KIND, AGREEMENT_STATUS, AUTONOMY_POSTURE, CAPACITY_FILENAME, COUNTERPARTY_FILENAME, COUNTERPARTY_KIND, COUNTERPARTY_SOURCE, DELIVERABLE_FILENAME, DELIVERABLE_STATUS, ENGAGEMENT_FILENAME, ENGAGEMENT_KIND, ENGAGEMENT_STATUS, INVOICE_FILENAME, INVOICE_STATUS, OPERATIONS_FILENAME, PRICING_KIND, PRICING_MODEL_FILENAME, PROCEDURE_FILENAME, ROUTINE_FILENAME, SCHEMA_NAME, SERVICE_FILENAME, agencyFrontmatterSchema, agreementFrontmatterSchema, agreementKindSchema, agreementStatusSchema, authorshipFields, autonomyPostureSchema, capacityFrontmatterSchema, counterpartyFrontmatterSchema, counterpartyKindSchema, counterpartySourceSchema, countryIsoSchema, currencyIsoSchema, deliverableFrontmatterSchema, deliverableStatusSchema, engagementFrontmatterSchema, engagementKindSchema, engagementStatusSchema, envelope, invoiceFrontmatterSchema, invoiceStatusSchema, isoDateOrDateSchema, isoDatetimeOrDateSchema, isoDurationSchema, kebabSlugSchema, metadataSchema, operationsFrontmatterSchema, partyRefSchema, partyRefStrictSchema, pricingDetailsSchema, pricingKindSchema, pricingModelFrontmatterSchema, procedureBranchStepSchema, procedureFrontmatterSchema, procedureSimpleStepSchema, procedureStepSchema, procedureTriggerSchema, routineFrontmatterSchema, routineTriggerSchema, serviceFrontmatterSchema, sha256HexSchema, timezoneSchema, workspacePathSchema } from '../chunk-DYQ4A5HV.mjs';
|
|
3
|
+
//# sourceMappingURL=index.mjs.map
|
|
4
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export { SCHEMA_NAME, authorshipFields, countryIsoSchema, currencyIsoSchema, envelope, isoDateOrDateSchema, isoDatetimeOrDateSchema, isoDurationSchema, kebabSlugSchema, metadataSchema, partyRefSchema, partyRefStrictSchema, sha256HexSchema, timezoneSchema, workspacePathSchema } from './doctypes/index.js';
|
|
2
|
+
export { A as AGENCY_FILENAME, a as AGREEMENT_FILENAME, b as AGREEMENT_KIND, c as AGREEMENT_STATUS, d as AUTONOMY_POSTURE, e as Agency, f as AgencyFrontmatter, g as Agreement, h as AgreementFrontmatter, i as AgreementKind, j as AgreementStatus, k as AutonomyPosture, C as CAPACITY_FILENAME, l as COUNTERPARTY_FILENAME, m as COUNTERPARTY_KIND, n as COUNTERPARTY_SOURCE, o as Capacity, p as CapacityFrontmatter, q as Counterparty, r as CounterpartyFrontmatter, D as DELIVERABLE_FILENAME, s as DELIVERABLE_STATUS, t as Deliverable, u as DeliverableFrontmatter, v as DeliverableStatus, E as ENGAGEMENT_FILENAME, w as ENGAGEMENT_KIND, x as ENGAGEMENT_STATUS, y as Engagement, z as EngagementFrontmatter, B as EngagementKind, F as EngagementStatus, I as INVOICE_FILENAME, G as INVOICE_STATUS, H as Invoice, J as InvoiceFrontmatter, K as InvoiceStatus, O as OPERATIONS_FILENAME, L as Operations, M as OperationsFrontmatter, P as PRICING_KIND, N as PRICING_MODEL_FILENAME, Q as PROCEDURE_FILENAME, R as PricingDetails, S as PricingKind, T as PricingModel, U as PricingModelFrontmatter, V as Procedure, W as ProcedureFrontmatter, X as ProcedureStep, Y as ProcedureTrigger, Z as ROUTINE_FILENAME, _ as Routine, $ as RoutineFrontmatter, a0 as RoutineTrigger, a1 as SERVICE_FILENAME, a2 as Service, a3 as ServiceFrontmatter, a4 as agencyFrontmatterSchema, a5 as agreementFrontmatterSchema, a6 as agreementKindSchema, a7 as agreementStatusSchema, a8 as autonomyPostureSchema, a9 as capacityFrontmatterSchema, aa as counterpartyFrontmatterSchema, ab as counterpartyKindSchema, ac as counterpartySourceSchema, ad as deliverableFrontmatterSchema, ae as deliverableStatusSchema, af as engagementFrontmatterSchema, ag as engagementKindSchema, ah as engagementStatusSchema, ai as invoiceFrontmatterSchema, aj as invoiceStatusSchema, ak as operationsFrontmatterSchema, al as pricingDetailsSchema, am as pricingKindSchema, an as pricingModelFrontmatterSchema, ao as procedureBranchStepSchema, ap as procedureFrontmatterSchema, aq as procedureSimpleStepSchema, ar as procedureStepSchema, as as procedureTriggerSchema, at as routineFrontmatterSchema, au as routineTriggerSchema, av as serviceFrontmatterSchema } from './capacity-98VwY285.js';
|
|
3
|
+
export { AgenciesWorkspaceFiles, ValidationError, ValidationResult, checkAgenciesConsistency, validateAgency, validateAgreement, validateCapacity, validateCounterparty, validateDeliverable, validateEngagement, validateInvoice, validateOperations, validatePricingModel, validateProcedure, validateRoutine, validateService } from './validators/index.js';
|
|
4
|
+
import 'zod';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @agentproto/agencies — agentagencies/v1 spec implementation.
|
|
8
|
+
*
|
|
9
|
+
* Operating layer for entities that exercise *agency* — both in the business
|
|
10
|
+
* sense (service businesses, consultancies, freelancers) and the philosophical
|
|
11
|
+
* sense (any system that acts with intention, autonomy, decision-making).
|
|
12
|
+
*
|
|
13
|
+
* Extends agentcompanies/v1 (org structure) + agentgovernance/v1 (audit + signing)
|
|
14
|
+
* with operations doctypes: AGENCY, OPERATIONS, SERVICE, PROCEDURE, PRICING-MODEL,
|
|
15
|
+
* COUNTERPARTY, ENGAGEMENT, AGREEMENT, DELIVERABLE, INVOICE, ROUTINE, CAPACITY.
|
|
16
|
+
*
|
|
17
|
+
* Subpath exports:
|
|
18
|
+
* - "./doctypes" — zod schemas + inferred types for all operations doctypes
|
|
19
|
+
* - "./validators" — per-doctype + cross-doctype validators
|
|
20
|
+
* - "./composition" — resolver for the 4 composition patterns
|
|
21
|
+
* - "./renderers" — canvakit template ids + variable schemas + bundled HTML
|
|
22
|
+
*
|
|
23
|
+
* Reference runtime (workspace walkers like `computeAgencyOverview`,
|
|
24
|
+
* snapshot index helpers, FS-only orchestrators) lives in the sibling package
|
|
25
|
+
* `@agentproto/agencies-engine`. Spec stays pure: zero I/O, zero filesystem deps.
|
|
26
|
+
*
|
|
27
|
+
* Spec doc: ./AGENTAGENCIES.md (canonical, included in npm publish)
|
|
28
|
+
*/
|
|
29
|
+
declare const SPEC_NAME: "agentagencies/v1";
|
|
30
|
+
declare const SPEC_VERSION: "1.0.0-alpha";
|
|
31
|
+
|
|
32
|
+
export { SPEC_NAME, SPEC_VERSION };
|