@agentproto/company 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 agentproto contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # @agentproto/company
2
+
3
+ AIP-6 `COMPANY.md` reference implementation. A filesystem-first, vendor-neutral file format for representing AI companies — their org structure, roles, and objectives — as portable git-native packages.
4
+
5
+ > **Status: 0.1.0-alpha.** Generated by `scripts/scaffold-aip.mjs` — `build()` and `validate()` bodies are TODOs.
6
+
7
+ Spec: <https://agentproto.sh/docs/aip-6>
8
+
9
+ ## Usage
10
+
11
+ ```ts
12
+ import { defineCompany } from "@agentproto/company"
13
+
14
+ const x = defineCompany({
15
+ id: "my-company",
16
+ description: "Short purpose.",
17
+ // ...
18
+ })
19
+ ```
20
+
21
+ ## License
22
+
23
+ MIT — see [LICENSE](./LICENSE).
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ import { createDoctype } from '@agentproto/define-doctype';
3
+
4
+ /**
5
+ * @agentproto/company v0.1.0-alpha
6
+ * AIP-6 COMPANY.md `defineCompany` reference implementation.
7
+ */
8
+
9
+ var companyFrontmatterSchema = z.discriminatedUnion("doctype", [
10
+ z.object({ "schema": z.literal("agentcompanies/v1").describe("Format identifier. MUST be the literal string `agentcompanies/v1`."), "doctype": z.literal("company"), "id": z.string().regex(new RegExp("^[a-z][a-z0-9-]*[a-z0-9]$")).min(2).max(64).describe("Slug identifier. Lowercase, digits, dashes. Stable across renames; references use this, never database IDs."), "version": z.string().regex(new RegExp("^\\d+\\.\\d+\\.\\d+(?:[-+][a-zA-Z0-9.-]+)?$")).describe("Spec version of THIS file. Bump on breaking change.").optional(), "name": z.string().min(1).max(200).describe("Human-readable display name."), "description": z.string().max(2e3).describe("One-paragraph purpose.").optional(), "tags": z.array(z.string().regex(new RegExp("^[a-z][a-z0-9-]*$"))).default([]), "metadata": z.record(z.string(), z.any()).describe("Vendor-specific extensions. Authors stash hints under namespaced keys `metadata.<vendor>.\u2026`; other readers MUST tolerate unknown keys.").default({}), "mission": z.string().min(1).max(1e3).describe("One-paragraph mission. Read by every operator at boot."), "values": z.array(z.string().max(200)).describe("Short value statements; surfaced in role prompts.").default([]), "structure": z.object({ "positions": z.array(z.string().regex(new RegExp("^[a-z][a-z0-9-]*[a-z0-9]$"))).describe("Slugs of the company's seats \u2014 each typically materialized as an operator under `operators/<slug>/OPERATOR.md`. A position is a seat one operator holds; several positions may share one AIP-47 catalog role. See AIP-47 \xA7Role vs Position vs Access role.").default([]), "roles": z.array(z.string().regex(new RegExp("^[a-z][a-z0-9-]*[a-z0-9]$"))).describe("DEPRECATED alias of `positions`. Readers MUST accept both; when both are present, `positions` wins.").default([]), "objectives": z.array(z.string().regex(new RegExp("^[a-z][a-z0-9-]*[a-z0-9]$"))).describe("Slugs of top-level objectives defined under `objectives/<slug>/OBJECTIVE.md`.").default([]), "reports_to": z.record(z.string(), z.string().regex(new RegExp("^[a-z][a-z0-9-]*[a-z0-9]$"))).describe("Map of position-slug \u2192 position-slug expressing the reporting tree. The key reports to the value. Positions not in the map are top-level.").default({}) }).strict().optional(), "imports": z.array(z.any()).describe("External roles or objectives pulled from a registry. Resolved by the adapter at load time.").default([]) }).catchall(z.any()),
11
+ z.object({ "schema": z.literal("agentcompanies/v1").describe("Format identifier. MUST be the literal string `agentcompanies/v1`."), "doctype": z.literal("role"), "id": z.string().regex(new RegExp("^[a-z][a-z0-9-]*[a-z0-9]$")).min(2).max(64).describe("Slug identifier. Lowercase, digits, dashes. Stable across renames; references use this, never database IDs."), "version": z.string().regex(new RegExp("^\\d+\\.\\d+\\.\\d+(?:[-+][a-zA-Z0-9.-]+)?$")).describe("Spec version of THIS file. Bump on breaking change.").optional(), "name": z.string().min(1).max(200).describe("Human-readable display name."), "description": z.string().max(2e3).describe("One-paragraph purpose.").optional(), "tags": z.array(z.string().regex(new RegExp("^[a-z][a-z0-9-]*$"))).default([]), "metadata": z.record(z.string(), z.any()).describe("Vendor-specific extensions. Authors stash hints under namespaced keys `metadata.<vendor>.\u2026`; other readers MUST tolerate unknown keys.").default({}), "mandate": z.string().min(1).max(2e3).describe("One-paragraph statement of what this role is responsible for. Defines the role's bounded autonomy."), "reports_to": z.string().regex(new RegExp("^[a-z][a-z0-9-]*[a-z0-9]$")).describe("Slug of the parent role. Omit for top-level roles.").optional(), "scope": z.object({ "owns": z.array(z.string().max(200)).describe("Free-text list of resource classes this role owns (e.g. `outbound-email`, `q3-pipeline`).").default([]), "capabilities": z.array(z.string().regex(new RegExp("^[a-z][a-z0-9-]*$"))).describe("Capability slugs the role grants \u2014 referenced by AIP-7 governance and AIP-8 operators.").default([]) }).strict().optional(), "objectives": z.array(z.string().regex(new RegExp("^[a-z][a-z0-9-]*[a-z0-9]$"))).describe("Slugs of objectives this role pursues. Each MUST resolve to an `objectives/<slug>/OBJECTIVE.md`.").default([]), "tools": z.array(z.string().regex(new RegExp("^[a-z][a-z0-9-]*[a-z0-9]$"))).describe("Slugs of AIP-14 tools the role may call. Adapter resolves against the host's tool catalog.").default([]), "workflows": z.array(z.string().regex(new RegExp("^[a-z][a-z0-9-]*[a-z0-9]$"))).describe("Slugs of AIP-15 workflows the role may execute.").default([]) }).catchall(z.any()),
12
+ z.object({ "schema": z.literal("agentcompanies/v1").describe("Format identifier. MUST be the literal string `agentcompanies/v1`."), "doctype": z.literal("objective"), "id": z.string().regex(new RegExp("^[a-z][a-z0-9-]*[a-z0-9]$")).min(2).max(64).describe("Slug identifier. Lowercase, digits, dashes. Stable across renames; references use this, never database IDs."), "version": z.string().regex(new RegExp("^\\d+\\.\\d+\\.\\d+(?:[-+][a-zA-Z0-9.-]+)?$")).describe("Spec version of THIS file. Bump on breaking change.").optional(), "name": z.string().min(1).max(200).describe("Human-readable display name."), "description": z.string().max(2e3).describe("One-paragraph purpose.").optional(), "tags": z.array(z.string().regex(new RegExp("^[a-z][a-z0-9-]*$"))).default([]), "metadata": z.record(z.string(), z.any()).describe("Vendor-specific extensions. Authors stash hints under namespaced keys `metadata.<vendor>.\u2026`; other readers MUST tolerate unknown keys.").default({}), "statement": z.string().min(1).max(2e3).describe("One-paragraph statement of the desired outcome."), "owner": z.string().regex(new RegExp("^[a-z][a-z0-9-]*[a-z0-9]$")).describe("Slug of the role accountable for this objective.").optional(), "horizon": z.enum(["sprint", "quarter", "year", "ongoing"]).describe("Time horizon. Adapter MAY use this to surface stale objectives.").default("quarter"), "status": z.enum(["proposed", "active", "paused", "achieved", "abandoned"]).default("active"), "key_results": z.array(z.object({ "id": z.string().regex(new RegExp("^[a-z][a-z0-9-]*[a-z0-9]$")), "statement": z.string().max(500), "target": z.string().max(200).optional(), "progress": z.number().gte(0).lte(1).optional() }).strict()).default([]), "parent": z.string().regex(new RegExp("^[a-z][a-z0-9-]*[a-z0-9]$")).describe("Slug of the parent objective (for decomposition trees). Omit for top-level objectives.").optional(), "children": z.array(z.string().regex(new RegExp("^[a-z][a-z0-9-]*[a-z0-9]$"))).describe("Slugs of child sub-objectives. Adapter validates the parent/children edges agree.").default([]), "depends_on": z.array(z.string().regex(new RegExp("^[a-z][a-z0-9-]*[a-z0-9]$"))).describe("Slugs of objectives this one depends on.").default([]) }).catchall(z.any())
13
+ ]).describe("Validates the YAML frontmatter portion of any agentcompanies/v1 doctype file. The `doctype` field discriminates between company / role / objective; each branch enforces the doctype-specific shape. Operator doctype is sketched here but the normative definition lives in AIP-8 \u2014 only company / role / objective are normative under AIP-6.");
14
+ var defineCompany = createDoctype({
15
+ aip: 6,
16
+ name: "company",
17
+ readDescription: false,
18
+ validate(def) {
19
+ const result = companyFrontmatterSchema.safeParse(def);
20
+ if (!result.success) {
21
+ throw new Error(
22
+ `defineCompany (AIP-6): ${result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ")}`
23
+ );
24
+ }
25
+ },
26
+ build(def) {
27
+ return { ...def };
28
+ }
29
+ });
30
+
31
+ export { companyFrontmatterSchema, defineCompany };
32
+ //# sourceMappingURL=chunk-F2M7E2SP.mjs.map
33
+ //# sourceMappingURL=chunk-F2M7E2SP.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schema.ts","../src/define-company.ts"],"names":[],"mappings":";;;;;;;;AAeO,IAAM,wBAAA,GAA2B,CAAA,CAAE,kBAAA,CAAmB,SAAA,EAAW;AAAA,EACtE,CAAA,CAAE,MAAA,CAAO,EAAE,QAAA,EAAU,CAAA,CAAE,OAAA,CAAQ,mBAAmB,CAAA,CAAE,QAAA,CAAS,oEAAoE,CAAA,EAAG,SAAA,EAAW,CAAA,CAAE,OAAA,CAAQ,SAAS,CAAA,EAAG,IAAA,EAAM,CAAA,CAAE,MAAA,EAAO,CAAE,KAAA,CAAM,IAAI,MAAA,CAAO,2BAA2B,CAAC,CAAA,CAAE,GA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,sVAAiV;ACEtV,IAAM,gBAAgB,aAAA,CAAgD;AAAA,EAC3E,GAAA,EAAK,CAAA;AAAA,EACL,IAAA,EAAM,SAAA;AAAA,EACN,eAAA,EAAiB,KAAA;AAAA,EACjB,SAAS,GAAA,EAAK;AACZ,IAAA,MAAM,MAAA,GAAS,wBAAA,CAAyB,SAAA,CAAU,GAAG,CAAA;AACrD,IAAA,IAAI,CAAC,OAAO,OAAA,EAAS;AACnB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,uBAAA,EAA0B,OAAO,KAAA,CAAM,MAAA,CACpC,IAAI,CAAC,CAAA,KAAM,GAAG,CAAA,CAAE,IAAA,CAAK,KAAK,GAAG,CAAC,KAAK,CAAA,CAAE,OAAO,EAAE,CAAA,CAC9C,IAAA,CAAK,IAAI,CAAC,CAAA;AAAA,OACf;AAAA,IACF;AAAA,EAIF,CAAA;AAAA,EACA,MAAM,GAAA,EAAK;AAKT,IAAA,OAAO,EAAE,GAAG,GAAA,EAAI;AAAA,EAClB;AACF,CAAC","file":"chunk-F2M7E2SP.mjs","sourcesContent":["/**\n * AIP-6 COMPANY.md frontmatter zod schema.\n *\n * Generated from `resources/aip-6/draft/COMPANY.schema.json` via\n * json-schema-to-zod. Imported by both `define-company.ts` (TS path\n * validation) and `manifest/index.ts` (.md path validation) so every\n * field-level constraint runs in both authoring paths from a single\n * source of truth — re-run scaffold-aip to refresh after spec changes.\n *\n * Cross-field rules (if/then/allOf in JSON Schema) don't translate\n * cleanly and live in `define-company.ts`'s `validate(def)` instead.\n */\n\nimport { z } from \"zod\"\n\nexport const companyFrontmatterSchema = z.discriminatedUnion(\"doctype\", [\n z.object({ \"schema\": z.literal(\"agentcompanies/v1\").describe(\"Format identifier. MUST be the literal string `agentcompanies/v1`.\"), \"doctype\": z.literal(\"company\"), \"id\": z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*[a-z0-9]$\")).min(2).max(64).describe(\"Slug identifier. Lowercase, digits, dashes. Stable across renames; references use this, never database IDs.\"), \"version\": z.string().regex(new RegExp(\"^\\\\d+\\\\.\\\\d+\\\\.\\\\d+(?:[-+][a-zA-Z0-9.-]+)?$\")).describe(\"Spec version of THIS file. Bump on breaking change.\").optional(), \"name\": z.string().min(1).max(200).describe(\"Human-readable display name.\"), \"description\": z.string().max(2000).describe(\"One-paragraph purpose.\").optional(), \"tags\": z.array(z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*$\"))).default([] as never), \"metadata\": z.record(z.string(), z.any()).describe(\"Vendor-specific extensions. Authors stash hints under namespaced keys `metadata.<vendor>.…`; other readers MUST tolerate unknown keys.\").default({} as never), \"mission\": z.string().min(1).max(1000).describe(\"One-paragraph mission. Read by every operator at boot.\"), \"values\": z.array(z.string().max(200)).describe(\"Short value statements; surfaced in role prompts.\").default([] as never), \"structure\": z.object({ \"positions\": z.array(z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*[a-z0-9]$\"))).describe(\"Slugs of the company's seats — each typically materialized as an operator under `operators/<slug>/OPERATOR.md`. A position is a seat one operator holds; several positions may share one AIP-47 catalog role. See AIP-47 §Role vs Position vs Access role.\").default([] as never), \"roles\": z.array(z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*[a-z0-9]$\"))).describe(\"DEPRECATED alias of `positions`. Readers MUST accept both; when both are present, `positions` wins.\").default([] as never), \"objectives\": z.array(z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*[a-z0-9]$\"))).describe(\"Slugs of top-level objectives defined under `objectives/<slug>/OBJECTIVE.md`.\").default([] as never), \"reports_to\": z.record(z.string(), z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*[a-z0-9]$\"))).describe(\"Map of position-slug → position-slug expressing the reporting tree. The key reports to the value. Positions not in the map are top-level.\").default({} as never) }).strict().optional(), \"imports\": z.array(z.any()).describe(\"External roles or objectives pulled from a registry. Resolved by the adapter at load time.\").default([] as never) }).catchall(z.any()),\n z.object({ \"schema\": z.literal(\"agentcompanies/v1\").describe(\"Format identifier. MUST be the literal string `agentcompanies/v1`.\"), \"doctype\": z.literal(\"role\"), \"id\": z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*[a-z0-9]$\")).min(2).max(64).describe(\"Slug identifier. Lowercase, digits, dashes. Stable across renames; references use this, never database IDs.\"), \"version\": z.string().regex(new RegExp(\"^\\\\d+\\\\.\\\\d+\\\\.\\\\d+(?:[-+][a-zA-Z0-9.-]+)?$\")).describe(\"Spec version of THIS file. Bump on breaking change.\").optional(), \"name\": z.string().min(1).max(200).describe(\"Human-readable display name.\"), \"description\": z.string().max(2000).describe(\"One-paragraph purpose.\").optional(), \"tags\": z.array(z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*$\"))).default([] as never), \"metadata\": z.record(z.string(), z.any()).describe(\"Vendor-specific extensions. Authors stash hints under namespaced keys `metadata.<vendor>.…`; other readers MUST tolerate unknown keys.\").default({} as never), \"mandate\": z.string().min(1).max(2000).describe(\"One-paragraph statement of what this role is responsible for. Defines the role's bounded autonomy.\"), \"reports_to\": z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*[a-z0-9]$\")).describe(\"Slug of the parent role. Omit for top-level roles.\").optional(), \"scope\": z.object({ \"owns\": z.array(z.string().max(200)).describe(\"Free-text list of resource classes this role owns (e.g. `outbound-email`, `q3-pipeline`).\").default([] as never), \"capabilities\": z.array(z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*$\"))).describe(\"Capability slugs the role grants — referenced by AIP-7 governance and AIP-8 operators.\").default([] as never) }).strict().optional(), \"objectives\": z.array(z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*[a-z0-9]$\"))).describe(\"Slugs of objectives this role pursues. Each MUST resolve to an `objectives/<slug>/OBJECTIVE.md`.\").default([] as never), \"tools\": z.array(z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*[a-z0-9]$\"))).describe(\"Slugs of AIP-14 tools the role may call. Adapter resolves against the host's tool catalog.\").default([] as never), \"workflows\": z.array(z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*[a-z0-9]$\"))).describe(\"Slugs of AIP-15 workflows the role may execute.\").default([] as never) }).catchall(z.any()),\n z.object({ \"schema\": z.literal(\"agentcompanies/v1\").describe(\"Format identifier. MUST be the literal string `agentcompanies/v1`.\"), \"doctype\": z.literal(\"objective\"), \"id\": z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*[a-z0-9]$\")).min(2).max(64).describe(\"Slug identifier. Lowercase, digits, dashes. Stable across renames; references use this, never database IDs.\"), \"version\": z.string().regex(new RegExp(\"^\\\\d+\\\\.\\\\d+\\\\.\\\\d+(?:[-+][a-zA-Z0-9.-]+)?$\")).describe(\"Spec version of THIS file. Bump on breaking change.\").optional(), \"name\": z.string().min(1).max(200).describe(\"Human-readable display name.\"), \"description\": z.string().max(2000).describe(\"One-paragraph purpose.\").optional(), \"tags\": z.array(z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*$\"))).default([] as never), \"metadata\": z.record(z.string(), z.any()).describe(\"Vendor-specific extensions. Authors stash hints under namespaced keys `metadata.<vendor>.…`; other readers MUST tolerate unknown keys.\").default({} as never), \"statement\": z.string().min(1).max(2000).describe(\"One-paragraph statement of the desired outcome.\"), \"owner\": z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*[a-z0-9]$\")).describe(\"Slug of the role accountable for this objective.\").optional(), \"horizon\": z.enum([\"sprint\",\"quarter\",\"year\",\"ongoing\"]).describe(\"Time horizon. Adapter MAY use this to surface stale objectives.\").default(\"quarter\"), \"status\": z.enum([\"proposed\",\"active\",\"paused\",\"achieved\",\"abandoned\"]).default(\"active\"), \"key_results\": z.array(z.object({ \"id\": z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*[a-z0-9]$\")), \"statement\": z.string().max(500), \"target\": z.string().max(200).optional(), \"progress\": z.number().gte(0).lte(1).optional() }).strict()).default([] as never), \"parent\": z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*[a-z0-9]$\")).describe(\"Slug of the parent objective (for decomposition trees). Omit for top-level objectives.\").optional(), \"children\": z.array(z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*[a-z0-9]$\"))).describe(\"Slugs of child sub-objectives. Adapter validates the parent/children edges agree.\").default([] as never), \"depends_on\": z.array(z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*[a-z0-9]$\"))).describe(\"Slugs of objectives this one depends on.\").default([] as never) }).catchall(z.any()),\n]).describe(\"Validates the YAML frontmatter portion of any agentcompanies/v1 doctype file. The `doctype` field discriminates between company / role / objective; each branch enforces the doctype-specific shape. Operator doctype is sketched here but the normative definition lives in AIP-8 — only company / role / objective are normative under AIP-6.\")\n\nexport type CompanyFrontmatter = z.infer<typeof companyFrontmatterSchema>\n","import { createDoctype } from \"@agentproto/define-doctype\"\nimport { companyFrontmatterSchema } from \"./schema.js\"\nimport type { CompanyDefinition, CompanyHandle } from \"./types.js\"\n\n/**\n * AIP-6 reference implementation of `defineCompany`.\n *\n * Built on `createDoctype` so the cross-AIP invariants (id pattern,\n * description length, top-level freeze, \"defineCompany (AIP-6): …\"\n * error prefix) run uniformly with every other AIP defineX.\n *\n * Field-level validation runs the schema-derived zod from\n * `./schema.ts` against the input. Same source of truth as the .md\n * path uses (`parseCompanyManifest`), so a malformed TS-authored\n * definition fails with the same diagnostic as a malformed manifest.\n * Cross-field rules go in `validate(def)` after the zod check.\n *\n * Identity / description extractors detected from the JSON Schema:\n * readIdentity: def.id\n * readDescription: skipped (no string-y required field detected).\n */\nexport const defineCompany = createDoctype<CompanyDefinition, CompanyHandle>({\n aip: 6,\n name: \"company\",\n readDescription: false,\n validate(def) {\n const result = companyFrontmatterSchema.safeParse(def)\n if (!result.success) {\n throw new Error(\n `defineCompany (AIP-6): ${result.error.issues\n .map((i) => `${i.path.join(\".\")}: ${i.message}`)\n .join(\"; \")}`,\n )\n }\n // TODO: spec-6-specific cross-field rules (if/then/allOf in\n // the JSON Schema) — those don't translate to zod cleanly and\n // belong here. See @agentproto/operator's autonomy=gated rule.\n },\n build(def) {\n // Default build: spread the validated definition into a fresh object.\n // Hand-tune for nested freezing (Object.freeze on arrays/objects) and\n // for fields that need defaults applied — see @agentproto/operator\n // for a reference shape.\n return { ...def } as CompanyHandle\n },\n})\n"]}
@@ -0,0 +1,56 @@
1
+ import { C as CompanyDefinition, a as CompanyHandle } from './types-DS_oI1W6.js';
2
+
3
+ /**
4
+ * AIP-6 reference implementation of `defineCompany`.
5
+ *
6
+ * Built on `createDoctype` so the cross-AIP invariants (id pattern,
7
+ * description length, top-level freeze, "defineCompany (AIP-6): …"
8
+ * error prefix) run uniformly with every other AIP defineX.
9
+ *
10
+ * Field-level validation runs the schema-derived zod from
11
+ * `./schema.ts` against the input. Same source of truth as the .md
12
+ * path uses (`parseCompanyManifest`), so a malformed TS-authored
13
+ * definition fails with the same diagnostic as a malformed manifest.
14
+ * Cross-field rules go in `validate(def)` after the zod check.
15
+ *
16
+ * Identity / description extractors detected from the JSON Schema:
17
+ * readIdentity: def.id
18
+ * readDescription: skipped (no string-y required field detected).
19
+ */
20
+ declare const defineCompany: (def: CompanyDefinition) => CompanyHandle;
21
+
22
+ /**
23
+ * Readers for the company `structure` block.
24
+ *
25
+ * `structure.positions` superseded `structure.roles` (the field always
26
+ * held seat slugs in practice — see AIP-6 §structure.positions). Old
27
+ * manifests on disk still carry `roles`, so reads go through
28
+ * `companyPositions()` rather than touching either field directly.
29
+ */
30
+
31
+ type CompanyStructure = Extract<CompanyDefinition, {
32
+ doctype: "company";
33
+ }>["structure"];
34
+ /**
35
+ * The company's seat slugs. Prefers `structure.positions`, falls back
36
+ * to the deprecated `structure.roles` alias.
37
+ */
38
+ declare function companyPositions(company: {
39
+ structure?: CompanyStructure;
40
+ } | undefined): readonly string[];
41
+
42
+ /**
43
+ * @agentproto/company — AIP-6 COMPANY.md `defineCompany` reference impl.
44
+ *
45
+ * A filesystem-first, vendor-neutral file format for representing AI companies — their org structure, roles, and objectives — as portable git-native packages.
46
+ *
47
+ * Spec: https://agentproto.sh/docs/aip-6
48
+ *
49
+ * Authoring paths:
50
+ * - TS: `defineCompany({...})` → `CompanyHandle`
51
+ * - MD: `parseCompanyManifest(src) → companyFromManifest({...})` → `CompanyHandle`
52
+ */
53
+ declare const SPEC_NAME: "agentcompany/v1";
54
+ declare const SPEC_VERSION: "1.0.0-alpha";
55
+
56
+ export { CompanyDefinition, CompanyHandle, SPEC_NAME, SPEC_VERSION, companyPositions, defineCompany };
package/dist/index.mjs ADDED
@@ -0,0 +1,24 @@
1
+ export { defineCompany } from './chunk-F2M7E2SP.mjs';
2
+
3
+ /**
4
+ * @agentproto/company v0.1.0-alpha
5
+ * AIP-6 COMPANY.md `defineCompany` reference implementation.
6
+ */
7
+
8
+ // src/structure.ts
9
+ function companyPositions(company) {
10
+ const structure = company?.structure;
11
+ if (!structure) return [];
12
+ if (structure.positions && structure.positions.length > 0) {
13
+ return structure.positions;
14
+ }
15
+ return structure.roles ?? [];
16
+ }
17
+
18
+ // src/index.ts
19
+ var SPEC_NAME = "agentcompany/v1";
20
+ var SPEC_VERSION = "1.0.0-alpha";
21
+
22
+ export { SPEC_NAME, SPEC_VERSION, companyPositions };
23
+ //# sourceMappingURL=index.mjs.map
24
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/structure.ts","../src/index.ts"],"names":[],"mappings":";;;;;;;;AAoBO,SAAS,iBACd,OAAA,EACmB;AACnB,EAAA,MAAM,YAAY,OAAA,EAAS,SAAA;AAC3B,EAAA,IAAI,CAAC,SAAA,EAAW,OAAO,EAAC;AACxB,EAAA,IAAI,SAAA,CAAU,SAAA,IAAa,SAAA,CAAU,SAAA,CAAU,SAAS,CAAA,EAAG;AACzD,IAAA,OAAO,SAAA,CAAU,SAAA;AAAA,EACnB;AACA,EAAA,OAAO,SAAA,CAAU,SAAS,EAAC;AAC7B;;;ACjBO,IAAM,SAAA,GAAY;AAClB,IAAM,YAAA,GAAe","file":"index.mjs","sourcesContent":["/**\n * Readers for the company `structure` block.\n *\n * `structure.positions` superseded `structure.roles` (the field always\n * held seat slugs in practice — see AIP-6 §structure.positions). Old\n * manifests on disk still carry `roles`, so reads go through\n * `companyPositions()` rather than touching either field directly.\n */\n\nimport type { CompanyDefinition } from \"./types.js\"\n\ntype CompanyStructure = Extract<\n CompanyDefinition,\n { doctype: \"company\" }\n>[\"structure\"]\n\n/**\n * The company's seat slugs. Prefers `structure.positions`, falls back\n * to the deprecated `structure.roles` alias.\n */\nexport function companyPositions(\n company: { structure?: CompanyStructure } | undefined\n): readonly string[] {\n const structure = company?.structure\n if (!structure) return []\n if (structure.positions && structure.positions.length > 0) {\n return structure.positions\n }\n return structure.roles ?? []\n}\n","/**\n * @agentproto/company — AIP-6 COMPANY.md `defineCompany` reference impl.\n *\n * A filesystem-first, vendor-neutral file format for representing AI companies — their org structure, roles, and objectives — as portable git-native packages.\n *\n * Spec: https://agentproto.sh/docs/aip-6\n *\n * Authoring paths:\n * - TS: `defineCompany({...})` → `CompanyHandle`\n * - MD: `parseCompanyManifest(src) → companyFromManifest({...})` → `CompanyHandle`\n */\n\nexport const SPEC_NAME = \"agentcompany/v1\" as const\nexport const SPEC_VERSION = \"1.0.0-alpha\" as const\n\nexport { defineCompany } from \"./define-company.js\"\nexport { companyPositions } from \"./structure.js\"\nexport type { CompanyDefinition, CompanyHandle } from \"./types.js\"\n"]}
@@ -0,0 +1,112 @@
1
+ import { z } from 'zod';
2
+ import { a as CompanyHandle } from '../types-DS_oI1W6.js';
3
+
4
+ /**
5
+ * AIP-6 COMPANY.md frontmatter zod schema.
6
+ *
7
+ * Generated from `resources/aip-6/draft/COMPANY.schema.json` via
8
+ * json-schema-to-zod. Imported by both `define-company.ts` (TS path
9
+ * validation) and `manifest/index.ts` (.md path validation) so every
10
+ * field-level constraint runs in both authoring paths from a single
11
+ * source of truth — re-run scaffold-aip to refresh after spec changes.
12
+ *
13
+ * Cross-field rules (if/then/allOf in JSON Schema) don't translate
14
+ * cleanly and live in `define-company.ts`'s `validate(def)` instead.
15
+ */
16
+
17
+ declare const companyFrontmatterSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
18
+ schema: z.ZodLiteral<"agentcompanies/v1">;
19
+ doctype: z.ZodLiteral<"company">;
20
+ id: z.ZodString;
21
+ version: z.ZodOptional<z.ZodString>;
22
+ name: z.ZodString;
23
+ description: z.ZodOptional<z.ZodString>;
24
+ tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
25
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
26
+ mission: z.ZodString;
27
+ values: z.ZodDefault<z.ZodArray<z.ZodString>>;
28
+ structure: z.ZodOptional<z.ZodObject<{
29
+ positions: z.ZodDefault<z.ZodArray<z.ZodString>>;
30
+ roles: z.ZodDefault<z.ZodArray<z.ZodString>>;
31
+ objectives: z.ZodDefault<z.ZodArray<z.ZodString>>;
32
+ reports_to: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
33
+ }, z.core.$strict>>;
34
+ imports: z.ZodDefault<z.ZodArray<z.ZodAny>>;
35
+ }, z.core.$catchall<z.ZodAny>>, z.ZodObject<{
36
+ schema: z.ZodLiteral<"agentcompanies/v1">;
37
+ doctype: z.ZodLiteral<"role">;
38
+ id: z.ZodString;
39
+ version: z.ZodOptional<z.ZodString>;
40
+ name: z.ZodString;
41
+ description: z.ZodOptional<z.ZodString>;
42
+ tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
43
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
44
+ mandate: z.ZodString;
45
+ reports_to: z.ZodOptional<z.ZodString>;
46
+ scope: z.ZodOptional<z.ZodObject<{
47
+ owns: z.ZodDefault<z.ZodArray<z.ZodString>>;
48
+ capabilities: z.ZodDefault<z.ZodArray<z.ZodString>>;
49
+ }, z.core.$strict>>;
50
+ objectives: z.ZodDefault<z.ZodArray<z.ZodString>>;
51
+ tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
52
+ workflows: z.ZodDefault<z.ZodArray<z.ZodString>>;
53
+ }, z.core.$catchall<z.ZodAny>>, z.ZodObject<{
54
+ schema: z.ZodLiteral<"agentcompanies/v1">;
55
+ doctype: z.ZodLiteral<"objective">;
56
+ id: z.ZodString;
57
+ version: z.ZodOptional<z.ZodString>;
58
+ name: z.ZodString;
59
+ description: z.ZodOptional<z.ZodString>;
60
+ tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
61
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodAny>>;
62
+ statement: z.ZodString;
63
+ owner: z.ZodOptional<z.ZodString>;
64
+ horizon: z.ZodDefault<z.ZodEnum<{
65
+ sprint: "sprint";
66
+ quarter: "quarter";
67
+ year: "year";
68
+ ongoing: "ongoing";
69
+ }>>;
70
+ status: z.ZodDefault<z.ZodEnum<{
71
+ proposed: "proposed";
72
+ active: "active";
73
+ paused: "paused";
74
+ achieved: "achieved";
75
+ abandoned: "abandoned";
76
+ }>>;
77
+ key_results: z.ZodDefault<z.ZodArray<z.ZodObject<{
78
+ id: z.ZodString;
79
+ statement: z.ZodString;
80
+ target: z.ZodOptional<z.ZodString>;
81
+ progress: z.ZodOptional<z.ZodNumber>;
82
+ }, z.core.$strict>>>;
83
+ parent: z.ZodOptional<z.ZodString>;
84
+ children: z.ZodDefault<z.ZodArray<z.ZodString>>;
85
+ depends_on: z.ZodDefault<z.ZodArray<z.ZodString>>;
86
+ }, z.core.$catchall<z.ZodAny>>], "doctype">;
87
+ type CompanyFrontmatter = z.infer<typeof companyFrontmatterSchema>;
88
+
89
+ /**
90
+ * AIP-6 COMPANY.md sidecar parser + manifest-to-handle constructor.
91
+ *
92
+ * Mirror of `@agentproto/tool/manifest` and `@agentproto/driver/manifest`:
93
+ * the .md provides metadata; the TS module supplies any spec-specific
94
+ * runtime bits (schemas, execute bodies, …) that can't live in
95
+ * frontmatter. Both inputs end up in `defineCompany` so the cross-AIP
96
+ * invariants run uniformly.
97
+ *
98
+ *
99
+ * The frontmatter zod schema below was generated from
100
+ * `resources/aip-6/draft/COMPANY.schema.json` via json-schema-to-zod.
101
+ * Re-run scaffold-aip to refresh after spec changes (or hand-tune
102
+ * any constraint the converter doesn't capture cleanly).
103
+ */
104
+
105
+ interface CompanyManifest {
106
+ frontmatter: CompanyFrontmatter;
107
+ body: string;
108
+ }
109
+ declare function parseCompanyManifest(source: string): CompanyManifest;
110
+ declare function companyFromManifest(manifest: CompanyManifest): CompanyHandle;
111
+
112
+ export { type CompanyFrontmatter, type CompanyManifest, companyFromManifest, companyFrontmatterSchema, parseCompanyManifest };
@@ -0,0 +1,28 @@
1
+ import { companyFrontmatterSchema, defineCompany } from '../chunk-F2M7E2SP.mjs';
2
+ export { companyFrontmatterSchema } from '../chunk-F2M7E2SP.mjs';
3
+ import matter from 'gray-matter';
4
+
5
+ /**
6
+ * @agentproto/company v0.1.0-alpha
7
+ * AIP-6 COMPANY.md `defineCompany` reference implementation.
8
+ */
9
+ function parseCompanyManifest(source) {
10
+ const parsed = matter(source);
11
+ if (Object.keys(parsed.data).length === 0) {
12
+ throw new Error("parseCompanyManifest: missing or empty frontmatter");
13
+ }
14
+ const result = companyFrontmatterSchema.safeParse(parsed.data);
15
+ if (!result.success) {
16
+ throw new Error(
17
+ `parseCompanyManifest: invalid frontmatter \u2014 ${result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ")}`
18
+ );
19
+ }
20
+ return { frontmatter: result.data, body: parsed.content };
21
+ }
22
+ function companyFromManifest(manifest) {
23
+ return defineCompany(manifest.frontmatter);
24
+ }
25
+
26
+ export { companyFromManifest, parseCompanyManifest };
27
+ //# sourceMappingURL=index.mjs.map
28
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/manifest/index.ts"],"names":[],"mappings":";;;;;;;;AA8BO,SAAS,qBAAqB,MAAA,EAAiC;AACpE,EAAA,MAAM,MAAA,GAAS,OAAO,MAAM,CAAA;AAC5B,EAAA,IAAI,OAAO,IAAA,CAAK,MAAA,CAAO,IAAI,CAAA,CAAE,WAAW,CAAA,EAAG;AACzC,IAAA,MAAM,IAAI,MAAM,oDAAoD,CAAA;AAAA,EACtE;AACA,EAAA,MAAM,MAAA,GAAS,wBAAA,CAAyB,SAAA,CAAU,MAAA,CAAO,IAAI,CAAA;AAC7D,EAAA,IAAI,CAAC,OAAO,OAAA,EAAS;AACnB,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,iDAAA,EAA+C,OAAO,KAAA,CAAM,MAAA,CACzD,IAAI,CAAC,CAAA,KAAM,GAAG,CAAA,CAAE,IAAA,CAAK,KAAK,GAAG,CAAC,KAAK,CAAA,CAAE,OAAO,EAAE,CAAA,CAC9C,IAAA,CAAK,IAAI,CAAC,CAAA;AAAA,KACf;AAAA,EACF;AACA,EAAA,OAAO,EAAE,WAAA,EAAa,MAAA,CAAO,IAAA,EAAM,IAAA,EAAM,OAAO,OAAA,EAAQ;AAC1D;AAEO,SAAS,oBAAoB,QAAA,EAA0C;AAK5E,EAAA,OAAO,aAAA,CAAc,SAAS,WAA2C,CAAA;AAC3E","file":"index.mjs","sourcesContent":["/**\n * AIP-6 COMPANY.md sidecar parser + manifest-to-handle constructor.\n *\n * Mirror of `@agentproto/tool/manifest` and `@agentproto/driver/manifest`:\n * the .md provides metadata; the TS module supplies any spec-specific\n * runtime bits (schemas, execute bodies, …) that can't live in\n * frontmatter. Both inputs end up in `defineCompany` so the cross-AIP\n * invariants run uniformly.\n *\n *\n * The frontmatter zod schema below was generated from\n * `resources/aip-6/draft/COMPANY.schema.json` via json-schema-to-zod.\n * Re-run scaffold-aip to refresh after spec changes (or hand-tune\n * any constraint the converter doesn't capture cleanly).\n */\n\nimport matter from \"gray-matter\"\nimport { companyFrontmatterSchema, type CompanyFrontmatter } from \"../schema.js\"\nimport { defineCompany } from \"../define-company.js\"\nimport type { CompanyDefinition, CompanyHandle } from \"../types.js\"\n\n// Re-export so consumers can import the schema + inferred type either\n// from \"@@agentproto/company/manifest\" or directly from \"@@agentproto/company/schema\".\nexport { companyFrontmatterSchema, type CompanyFrontmatter }\n\nexport interface CompanyManifest {\n frontmatter: CompanyFrontmatter\n body: string\n}\n\nexport function parseCompanyManifest(source: string): CompanyManifest {\n const parsed = matter(source)\n if (Object.keys(parsed.data).length === 0) {\n throw new Error(\"parseCompanyManifest: missing or empty frontmatter\")\n }\n const result = companyFrontmatterSchema.safeParse(parsed.data)\n if (!result.success) {\n throw new Error(\n `parseCompanyManifest: invalid frontmatter — ${result.error.issues\n .map((i) => `${i.path.join(\".\")}: ${i.message}`)\n .join(\"; \")}`,\n )\n }\n return { frontmatter: result.data, body: parsed.content }\n}\n\nexport function companyFromManifest(manifest: CompanyManifest): CompanyHandle {\n // The zod-validated frontmatter is structurally compatible with\n // CompanyDefinition; the cast pins the typing once the manifest\n // schema and the TS interface diverge (e.g. handle has frozen fields\n // a literal config doesn't carry yet).\n return defineCompany(manifest.frontmatter as unknown as CompanyDefinition)\n}\n"]}
@@ -0,0 +1,167 @@
1
+ /**
2
+ * AIP-6 CompanyDefinition + CompanyHandle.
3
+ *
4
+ * `CompanyDefinition` was generated from
5
+ * `resources/aip-6/draft/COMPANY.schema.json` via json-schema-to-typescript.
6
+ * `CompanyHandle` is the readonly view of the same shape; tighten it
7
+ * by hand for fields that get defaults applied in build().
8
+ */
9
+ /**
10
+ * Validates the YAML frontmatter portion of any agentcompanies/v1 doctype file. The `doctype` field discriminates between company / role / objective; each branch enforces the doctype-specific shape. Operator doctype is sketched here but the normative definition lives in AIP-8 — only company / role / objective are normative under AIP-6.
11
+ */
12
+ type CompanyDefinition = {
13
+ /**
14
+ * Format identifier. MUST be the literal string `agentcompanies/v1`.
15
+ */
16
+ schema: "agentcompanies/v1";
17
+ /**
18
+ * Discriminator. Selects the doctype-specific branch under `oneOf`.
19
+ */
20
+ doctype: "company" | "role" | "objective";
21
+ /**
22
+ * Slug identifier. Lowercase, digits, dashes. Stable across renames; references use this, never database IDs.
23
+ */
24
+ id: string;
25
+ /**
26
+ * Spec version of THIS file. Bump on breaking change.
27
+ */
28
+ version?: string;
29
+ /**
30
+ * Human-readable display name.
31
+ */
32
+ name?: string;
33
+ /**
34
+ * One-paragraph purpose.
35
+ */
36
+ description?: string;
37
+ tags?: string[];
38
+ /**
39
+ * Vendor-specific extensions. Authors stash hints under namespaced keys `metadata.<vendor>.…`; other readers MUST tolerate unknown keys.
40
+ */
41
+ metadata?: {
42
+ [k: string]: unknown;
43
+ };
44
+ } & (Company | Role | Objective);
45
+ interface Company {
46
+ doctype: "company";
47
+ /**
48
+ * One-paragraph mission. Read by every operator at boot.
49
+ */
50
+ mission: string;
51
+ /**
52
+ * Short value statements; surfaced in role prompts.
53
+ */
54
+ values?: string[];
55
+ structure?: {
56
+ /**
57
+ * Slugs of the company's seats — each typically materialized as an operator under `operators/<slug>/OPERATOR.md`. A position is a seat one operator holds; several positions may share one AIP-47 catalog role. See AIP-47 §Role vs Position vs Access role.
58
+ */
59
+ positions?: string[];
60
+ /**
61
+ * @deprecated Alias of `positions`. Readers accept both; `positions` wins. Use `companyPositions()` to read.
62
+ */
63
+ roles?: string[];
64
+ /**
65
+ * Slugs of top-level objectives defined under `objectives/<slug>/OBJECTIVE.md`.
66
+ */
67
+ objectives?: string[];
68
+ /**
69
+ * Map of position-slug → position-slug expressing the reporting tree. The key reports to the value. Positions not in the map are top-level.
70
+ */
71
+ reports_to?: {
72
+ [k: string]: string | undefined;
73
+ };
74
+ };
75
+ /**
76
+ * External roles or objectives pulled from a registry. Resolved by the adapter at load time.
77
+ */
78
+ imports?: Import[];
79
+ }
80
+ interface Import {
81
+ /**
82
+ * Source ref. Format: `<registry>/<package>@<version>` or a relative path.
83
+ */
84
+ from: string;
85
+ /**
86
+ * Imported doctype.
87
+ */
88
+ as: "role" | "objective";
89
+ /**
90
+ * Local slug to bind the import under.
91
+ */
92
+ id?: string;
93
+ /**
94
+ * Override the import's local slug if it would collide.
95
+ */
96
+ alias?: string;
97
+ }
98
+ interface Role {
99
+ doctype: "role";
100
+ /**
101
+ * One-paragraph statement of what this role is responsible for. Defines the role's bounded autonomy.
102
+ */
103
+ mandate: string;
104
+ /**
105
+ * Slug of the parent role. Omit for top-level roles.
106
+ */
107
+ reports_to?: string;
108
+ scope?: {
109
+ /**
110
+ * Free-text list of resource classes this role owns (e.g. `outbound-email`, `q3-pipeline`).
111
+ */
112
+ owns?: string[];
113
+ /**
114
+ * Capability slugs the role grants — referenced by AIP-7 governance and AIP-8 operators.
115
+ */
116
+ capabilities?: string[];
117
+ };
118
+ /**
119
+ * Slugs of objectives this role pursues. Each MUST resolve to an `objectives/<slug>/OBJECTIVE.md`.
120
+ */
121
+ objectives?: string[];
122
+ /**
123
+ * Slugs of AIP-14 tools the role may call. Adapter resolves against the host's tool catalog.
124
+ */
125
+ tools?: string[];
126
+ /**
127
+ * Slugs of AIP-15 workflows the role may execute.
128
+ */
129
+ workflows?: string[];
130
+ }
131
+ interface Objective {
132
+ doctype: "objective";
133
+ /**
134
+ * One-paragraph statement of the desired outcome.
135
+ */
136
+ statement: string;
137
+ /**
138
+ * Slug of the role accountable for this objective.
139
+ */
140
+ owner?: string;
141
+ /**
142
+ * Time horizon. Adapter MAY use this to surface stale objectives.
143
+ */
144
+ horizon?: "sprint" | "quarter" | "year" | "ongoing";
145
+ status?: "proposed" | "active" | "paused" | "achieved" | "abandoned";
146
+ key_results?: {
147
+ id: string;
148
+ statement: string;
149
+ target?: string;
150
+ progress?: number;
151
+ }[];
152
+ /**
153
+ * Slug of the parent objective (for decomposition trees). Omit for top-level objectives.
154
+ */
155
+ parent?: string;
156
+ /**
157
+ * Slugs of child sub-objectives. Adapter validates the parent/children edges agree.
158
+ */
159
+ children?: string[];
160
+ /**
161
+ * Slugs of objectives this one depends on.
162
+ */
163
+ depends_on?: string[];
164
+ }
165
+ type CompanyHandle = Readonly<CompanyDefinition>;
166
+
167
+ export type { CompanyDefinition as C, CompanyHandle as a };
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@agentproto/company",
3
+ "version": "0.1.0-alpha.0",
4
+ "description": "@agentproto/company — AIP-6 COMPANY.md reference implementation. A filesystem-first, vendor-neutral file format for representing AI companies — their org structure, roles, and objectives — as portable git-native packages.",
5
+ "keywords": [
6
+ "agentproto",
7
+ "aip-6",
8
+ "company",
9
+ "defineCompany",
10
+ "open-standard",
11
+ "agentic"
12
+ ],
13
+ "homepage": "https://agentproto.sh/docs/aip-6",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/agentproto/ts",
17
+ "directory": "packages/company"
18
+ },
19
+ "bugs": {
20
+ "url": "https://github.com/agentproto/ts/issues"
21
+ },
22
+ "license": "MIT",
23
+ "type": "module",
24
+ "main": "dist/index.mjs",
25
+ "module": "dist/index.mjs",
26
+ "types": "dist/index.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "import": "./dist/index.mjs",
31
+ "default": "./dist/index.mjs"
32
+ },
33
+ "./manifest": {
34
+ "types": "./dist/manifest/index.d.ts",
35
+ "import": "./dist/manifest/index.mjs",
36
+ "default": "./dist/manifest/index.mjs"
37
+ },
38
+ "./package.json": "./package.json"
39
+ },
40
+ "files": [
41
+ "dist",
42
+ "README.md",
43
+ "LICENSE"
44
+ ],
45
+ "publishConfig": {
46
+ "access": "public"
47
+ },
48
+ "dependencies": {
49
+ "gray-matter": "^4.0.3",
50
+ "zod": "^4.4.3",
51
+ "@agentproto/define-doctype": "0.1.0"
52
+ },
53
+ "devDependencies": {
54
+ "@types/node": "^25.6.2",
55
+ "tsup": "^8.5.1",
56
+ "typescript": "^5.9.3",
57
+ "vitest": "^3.2.4",
58
+ "@agentproto/tooling": "0.1.0-alpha.0"
59
+ },
60
+ "scripts": {
61
+ "dev": "tsup --watch",
62
+ "build": "tsup",
63
+ "clean": "rm -rf dist",
64
+ "check-types": "tsc --noEmit",
65
+ "test": "vitest run --passWithNoTests",
66
+ "test:watch": "vitest"
67
+ }
68
+ }