@agentproto/identity 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { createDoctype } from '@agentproto/define-doctype';
2
+ import { createDoctype } from '@agentproto/doctype';
3
3
 
4
4
  /**
5
5
  * @agentproto/identity v0.1.0-alpha
@@ -31,5 +31,5 @@ var defineIdentity = createDoctype({
31
31
  });
32
32
 
33
33
  export { defineIdentity, identityFrontmatterSchema };
34
- //# sourceMappingURL=chunk-4ZC5U7ML.mjs.map
35
- //# sourceMappingURL=chunk-4ZC5U7ML.mjs.map
34
+ //# sourceMappingURL=chunk-ZUANMTTC.mjs.map
35
+ //# sourceMappingURL=chunk-ZUANMTTC.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/schema.ts","../src/define-identity.ts"],"names":[],"mappings":";;;;;;;;AAeO,IAAM,4BAA4B,CAAA,CAAE,MAAA,CAAO,EAAE,QAAA,EAAU,CAAA,CAAE,QAAQ,uBAAuB,CAAA,CAAE,QAAA,CAAS,iDAAiD,GAAG,MAAA,EAAQ,CAAA,CAAE,QAAO,CAAE,KAAA,CAAM,IAAI,MAAA,CAAO,2BAA2B,CAAC,CAAA,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,EAAE,CAAA,CAAE,SAAS,wDAAwD,CAAA,EAAG,SAAS,CAAA,CAAE,MAAA,GAAS,GAAA,CAAI,CAAC,EAAE,GAAA,CAAI,GAAG,EAAE,QAAA,CAAS,uCAAuC,CAAA,EAAG,aAAA,EAAe,EAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,GAAI,CAAA,CAAE,SAAS,2FAA2F,CAAA,EAAG,WAAW,CAAA,CAAE,MAAA,GAAS,KAAA,CAAM,IAAI,OAAO,8CAA8C,CAAC,CAAA,CAAE,QAAA,CAAS,oLAAoL,CAAA,EAAG,SAAA,EAAW,EAA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AACA,IAAA,MAAM,MAAA,GAAS,yBAAA,CAA0B,SAAA,CAAU,GAAG,CAAA;AACtD,IAAA,IAAI,CAAC,OAAO,OAAA,EAAS;AACnB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,CAAA,yBAAA,EAA4B,OAAO,KAAA,CAAM,MAAA,CACtC,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,EACF,CAAA;AAAA,EACA,MAAM,GAAA,EAAK;AAKT,IAAA,OAAO,EAAE,GAAG,GAAA,EAAI;AAAA,EAClB;AACF,CAAC","file":"chunk-4ZC5U7ML.mjs","sourcesContent":["/**\n * AIP-23 IDENTITY.md frontmatter zod schema.\n *\n * Generated from `resources/aip-23/draft/IDENTITY.schema.json` via\n * json-schema-to-zod. Imported by both `define-identity.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-identity.ts`'s `validate(def)` instead.\n */\n\nimport { z } from \"zod\"\n\nexport const identityFrontmatterSchema = z.object({ \"schema\": z.literal(\"identity.workspace/v1\").describe(\"Discriminator for the AIP-23 workspace doctype.\"), \"name\": z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*[a-z0-9]$\")).min(2).max(96).describe(\"Stable kebab-case identifier for the identity or view.\"), \"title\": z.string().min(1).max(200).describe(\"Human-readable title of the identity.\"), \"description\": z.string().min(1).max(2000).describe(\"One-paragraph statement of purpose: what this identity captures, who or what it is about.\"), \"version\": z.string().regex(new RegExp(\"^[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-[A-Za-z0-9.-]+)?$\")).describe(\"Semantic version of the WORKSPACE shape. Bump on collection / artifact-tier / binding / lint / defaults changes. Independent of any individual layer item's version (AIP-18-side).\"), \"extends\": z.string().regex(new RegExp(\"^(\\\\.\\\\./|\\\\./)[^\\\\s]+/IDENTITY\\\\.md$\")).min(1).max(512).describe(\"OPTIONAL — relative path to a parent IDENTITY.md. Presence makes the manifest a VIEW; absence makes it a WORKSPACE ROOT. Recursive composition; maximum chain depth is 8.\").optional(), \"appliesTo\": z.array(z.string().regex(new RegExp(\"^(ws://(operators|companies|personas|skills)/[a-z][a-z0-9-]*|\\\\.\\\\./[^\\\\s]+)$\")).describe(\"Either a ws:// ref to an AIP-9 operator, AIP-22 company, AIP-25 persona, or AIP-3 skill, or a relative path to a consumer workspace folder.\")).refine((arr) => arr.every((item, i) => arr.indexOf(item) == i), { message: \"All items must be unique!\" }).describe(\"OPTIONAL — list of consumers this VIEW adapts the identity for. Hosts MUST refuse the view if any binding does not resolve. Not inherited; views declare their own scope.\").optional(), \"executor\": z.string().regex(new RegExp(\"^ws://operators/[a-z][a-z0-9-]*$\")).describe(\"OPTIONAL — AIP-9 operator the identity is *about* or activates against. The host loads this operator when the identity is opened.\").optional(), \"governance\": z.string().min(1).max(512).describe(\"OPTIONAL — AIP-7 policy or audit binding. May be a path to an AIP-7 policy file or a ws:// ref. Identity-level approvals (layer mutations, confidence elevation, persona binding) flow through this ref.\").optional(), \"work\": z.string().regex(new RegExp(\"^ws://workspaces/[a-z][a-z0-9-]*$\")).describe(\"OPTIONAL — AIP-20 work tracker the identity participates in (an operator's task queue, a company's program plan).\").optional(), \"knowledge\": z.string().regex(new RegExp(\"^ws://wikis/[a-z][a-z0-9-]*(/KNOWLEDGE\\\\.md)?$\")).describe(\"OPTIONAL — AIP-10 KNOWLEDGE.md ref. The identity's narrative wiki, dossier, exemplars.\").optional(), \"collections\": z.array(z.any()).describe(\"Layer collections enabled by this identity. Each entry is one AIP-18 collection describing ONE layer kind. Three forms supported: inline (full COLLECTION.md frontmatter), file ref, or registry import. Merge-by-effective-name (alias if set, otherwise the collection's name) across the extends chain.\").default([] as never), \"layers\": z.object({ \"defaultConfidence\": z.number().gte(0).lte(1).describe(\"OPTIONAL — minimum confidence (0..1) the workspace will store. New items below the floor are refused with identity_confidence_below_floor (HARD). Default is 0.0 (no floor). Workspaces with strict identity standards SHOULD set this to 0.5 or higher.\").default(0), \"versioning\": z.enum([\"enabled\",\"disabled\"]).describe(\"Whether layer items carry an incrementing version on update. ONE-WAY SWITCH: once 'enabled' at any ancestor, descendants MUST NOT set 'disabled'. Refusal: identity_versioning_disable (HARD).\").default(\"enabled\"), \"temporal\": z.object({ \"enabled\": z.boolean().describe(\"OPTIONAL — whether temporal-entry companion items are supported for layers marked temporal: true on their own collection.\").default(false), \"field\": z.string().regex(new RegExp(\"^[a-z][a-zA-Z0-9_]*$\")).describe(\"OPTIONAL — field name on temporal-entry items carrying expiry. Hosts walk this field on read to exclude expired entries.\").default(\"validUntil\"), \"sourceVocabulary\": z.array(z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*[a-z0-9]$\"))).refine((arr) => arr.every((item, i) => arr.indexOf(item) == i), { message: \"All items must be unique!\" }).describe(\"Controlled vocabulary for temporal-entry.source. APPEND-ONLY across ancestors: descendants MAY add new values but MUST NOT remove existing ones.\").default([\"configured\",\"observed\",\"inferred\",\"self-reported\"]) }).strict().describe(\"Temporal-layer behaviour at the workspace level.\").optional() }).strict().describe(\"Layer behaviour configuration. Confidence floor, versioning posture, temporal-entry contract.\").optional(), \"artifacts\": z.object({ \"enabled\": z.boolean().describe(\"Whether the host generates compression artifacts for layer items.\").default(false), \"tiers\": z.array(z.object({ \"id\": z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*$\")).describe(\"Stable kebab-case tier id. Conventional values: short, medium, full. Merge key vs parent.\"), \"maxTokens\": z.number().int().gte(1).lte(32768).describe(\"Target maximum tokens for this tier's artifact. Tiers MUST be MONOTONIC: each tier's maxTokens MUST be strictly greater than the previous tier's. The host re-validates monotonicity after merge.\"), \"strategy\": z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*$\")).describe(\"OPTIONAL — compression algorithm id. Conventional values: aaak, bullet-list, markdown, or a host-defined string.\").optional() }).strict()).describe(\"Compression tiers. Merge-by-id vs parent; child tier with same id overrides parent's. Monotonicity (strictly increasing maxTokens) is re-validated after merge.\").default([] as never), \"locales\": z.array(z.string().regex(new RegExp(\"^[a-z]{2}(-[A-Z]{2})?$\"))).refine((arr) => arr.every((item, i) => arr.indexOf(item) == i), { message: \"All items must be unique!\" }).describe(\"Locales for which artifacts are generated. ISO 639-1 (e.g. 'en') with optional ISO 3166-1 region (e.g. 'en-US'). When non-empty, the host produces one artifact per (layer, tier, locale) triple.\").default([] as never), \"refreshPolicy\": z.enum([\"on-write\",\"scheduled\",\"manual\"]).describe(\"When the host regenerates artifacts. on-write = immediately after layer item mutation (correctness); scheduled = host-defined cadence (cheap, eventually consistent); manual = no auto-refresh.\").default(\"on-write\") }).strict().describe(\"Compression artifact policy. AIP-23's first distinctive contribution.\").optional(), \"binding\": z.object({ \"allowedEntities\": z.array(z.enum([\"operator\",\"company\",\"persona\",\"user\",\"skill\"])).refine((arr) => arr.every((item, i) => arr.indexOf(item) == i), { message: \"All items must be unique!\" }).describe(\"Bearer entity kinds allowed to bind layer items. Workspaces narrow to fit their domain (companion-style: [user, persona]; operator-fleet style: [operator, company]). Cross-references: operator → AIP-9, company → AIP-22, persona → AIP-25, skill → AIP-3, user → host-defined.\").default([\"operator\"]), \"exclusivity\": z.literal(\"per-entity-and-layer\").describe(\"Binding exclusivity rule. ONE-WAY SWITCH on relaxation: once 'per-entity-and-layer' (or stricter, when added) at any ancestor, descendants MUST NOT replace with a more permissive value. Refusal: identity_binding_loosen (HARD). Currently only 'per-entity-and-layer' is defined; future values may add stricter forms.\").default(\"per-entity-and-layer\"), \"verifyExistence\": z.boolean().describe(\"Whether the host verifies the bearer entity exists before allowing the binding. ONE-WAY SWITCH on relaxation: once 'true' at any ancestor, descendants MUST NOT set false. Refusal: identity_binding_verify_relax (HARD). Setting false is permitted for ephemeral / sandbox deployments but SHOULD never be used in production.\").default(true) }).strict().describe(\"Junction policy. Which bearer entity kinds may bind layer items as their identity, and how exclusively.\").optional(), \"lints\": z.array(z.object({ \"id\": z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*$\")).describe(\"Stable kebab-case lint id. Merge key when composing with extends parent.\"), \"kind\": z.enum([\"orphan-layer\",\"low-confidence-pinned\",\"stale-temporal\",\"unbound-layer\",\"missing-required-layer\",\"custom\"]).describe(\"Workspace-spanning lint algorithm. AIP-18 per-collection lints (missing-owner, overdue, required-field, etc.) live on COLLECTION.md and are NOT redeclared here. 'custom' delegates to a host-defined check identified by `id`.\"), \"severity\": z.enum([\"error\",\"warn\",\"info\"]).describe(\"Lint severity. Children may soften; governance policies MAY forbid softening below `error`.\"), \"params\": z.record(z.string(), z.any()).describe(\"Kind-specific parameters. e.g. { layers: [soul, personality] } for missing-required-layer; { days: 30 } for stale-temporal; { threshold: 0.5 } for low-confidence-pinned.\").default({} as never) }).strict()).describe(\"Workspace-spanning lints. Merge-by-id vs parent.\").default([] as never), \"defaults\": z.object({ \"approvalClass\": z.string().regex(new RegExp(\"^(auto|always|on-mutate|policy:[A-Za-z0-9_./:-]+)$\")).describe(\"Approval class for layer mutations. 'auto' = no gate; 'always' = every mutation requires approval; 'on-mutate' = approval on field-level mutations; 'policy:<ref>' = delegate to an AIP-7 policy.\").optional(), \"auditMutations\": z.boolean().describe(\"Whether layer mutations are audited. ONE-WAY SWITCH: once true at any ancestor, descendants MUST NOT set false. Refusal: identity_audit_downgrade (HARD).\").default(false) }).strict().describe(\"Default approval and audit posture.\").optional(), \"display\": z.object({ \"homePage\": z.string().regex(new RegExp(\"^[A-Za-z0-9][A-Za-z0-9_:-]*$\")).describe(\"OPTIONAL — id of the layer or item to use as the identity landing page (e.g. SOUL-acme-founder).\").optional(), \"defaultGrouping\": z.enum([\"layer\",\"entity\"]).describe(\"Default grouping for list views. 'layer' = one section per layer kind; 'entity' = one section per bearer entity.\").optional() }).strict().describe(\"Display hints for UIs that render the identity. Runtime-agnostic.\").optional(), \"metadata\": z.record(z.string(), z.any()).describe(\"Vendor-specific extensions, namespaced under <vendor>. Deep-merged across the extends chain. MUST NOT change the meaning of any spec field.\").default({} as never) }).strict().and(z.any().describe(\"A view (any manifest with appliesTo set) MUST extend a parent. A workspace-root manifest has neither field.\")).describe(\"Validates the YAML frontmatter portion of an AIP-23 IDENTITY.md (workspace root or per-context view). The single doctype 'identity.workspace/v1' is used in both modes; the host distinguishes by checking whether `extends` is set. Per-layer-kind schemas are delegated to AIP-18 (COLLECTION.md / ITEM.md). Items in any layer collection MUST carry a `confidence` field in 0..1; that requirement is enforced at item-load time by the host, not by this schema (which validates the workspace manifest only).\")\n\nexport type IdentityFrontmatter = z.infer<typeof identityFrontmatterSchema>\n","import { createDoctype } from \"@agentproto/define-doctype\"\nimport { identityFrontmatterSchema } from \"./schema.js\"\nimport type { IdentityDefinition, IdentityHandle } from \"./types.js\"\n\n/**\n * AIP-23 reference implementation of `defineIdentity`.\n *\n * Built on `createDoctype` so the cross-AIP invariants (id pattern,\n * description length, top-level freeze, \"defineIdentity (AIP-23): …\"\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 (`parseIdentityManifest`), 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.name\n * readDescription: def.description.\n */\nexport const defineIdentity = createDoctype<IdentityDefinition, IdentityHandle>({\n aip: 23,\n name: \"identity\",\n readIdentity: (def) => def.name,\n validate(def) {\n // Cross-field rules run BEFORE field-level zod so structural\n // errors surface before the cascade of \"missing required field\".\n //\n // AIP-23 rule: appliesTo non-empty ⇒ extends required.\n const d = def as { appliesTo?: readonly unknown[]; extends?: unknown }\n if (\n Array.isArray(d.appliesTo) &&\n d.appliesTo.length > 0 &&\n d.extends == null\n ) {\n throw new Error(\n `defineIdentity (AIP-23): appliesTo is non-empty — extends MUST be set`,\n )\n }\n const result = identityFrontmatterSchema.safeParse(def)\n if (!result.success) {\n throw new Error(\n `defineIdentity (AIP-23): ${result.error.issues\n .map((i) => `${i.path.join(\".\")}: ${i.message}`)\n .join(\"; \")}`,\n )\n }\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 IdentityHandle\n },\n})\n"]}
1
+ {"version":3,"sources":["../src/schema.ts","../src/define-identity.ts"],"names":[],"mappings":";;;;;;;;AAeO,IAAM,4BAA4B,CAAA,CAAE,MAAA,CAAO,EAAE,QAAA,EAAU,CAAA,CAAE,QAAQ,uBAAuB,CAAA,CAAE,QAAA,CAAS,iDAAiD,GAAG,MAAA,EAAQ,CAAA,CAAE,QAAO,CAAE,KAAA,CAAM,IAAI,MAAA,CAAO,2BAA2B,CAAC,CAAA,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,EAAE,CAAA,CAAE,SAAS,wDAAwD,CAAA,EAAG,SAAS,CAAA,CAAE,MAAA,GAAS,GAAA,CAAI,CAAC,EAAE,GAAA,CAAI,GAAG,EAAE,QAAA,CAAS,uCAAuC,CAAA,EAAG,aAAA,EAAe,EAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,GAAI,CAAA,CAAE,SAAS,2FAA2F,CAAA,EAAG,WAAW,CAAA,CAAE,MAAA,GAAS,KAAA,CAAM,IAAI,OAAO,8CAA8C,CAAC,CAAA,CAAE,QAAA,CAAS,oLAAoL,CAAA,EAAG,SAAA,EAAW,EAAE,MAAA,EAAO,CAAE,MAAM,IAAI,MAAA,CAAO,uCAAuC,CAAC,CAAA,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,GAAG,CAAA,CAAE,SAAS,gLAA2K,CAAA,CAAE,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QACR,CAAA,yBAAA,EAA4B,OAAO,KAAA,CAAM,MAAA,CACtC,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,EACF,CAAA;AAAA,EACA,MAAM,GAAA,EAAK;AAKT,IAAA,OAAO,EAAE,GAAG,GAAA,EAAI;AAAA,EAClB;AACF,CAAC","file":"chunk-ZUANMTTC.mjs","sourcesContent":["/**\n * AIP-23 IDENTITY.md frontmatter zod schema.\n *\n * Generated from `resources/aip-23/draft/IDENTITY.schema.json` via\n * json-schema-to-zod. Imported by both `define-identity.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-identity.ts`'s `validate(def)` instead.\n */\n\nimport { z } from \"zod\"\n\nexport const identityFrontmatterSchema = z.object({ \"schema\": z.literal(\"identity.workspace/v1\").describe(\"Discriminator for the AIP-23 workspace doctype.\"), \"name\": z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*[a-z0-9]$\")).min(2).max(96).describe(\"Stable kebab-case identifier for the identity or view.\"), \"title\": z.string().min(1).max(200).describe(\"Human-readable title of the identity.\"), \"description\": z.string().min(1).max(2000).describe(\"One-paragraph statement of purpose: what this identity captures, who or what it is about.\"), \"version\": z.string().regex(new RegExp(\"^[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-[A-Za-z0-9.-]+)?$\")).describe(\"Semantic version of the WORKSPACE shape. Bump on collection / artifact-tier / binding / lint / defaults changes. Independent of any individual layer item's version (AIP-18-side).\"), \"extends\": z.string().regex(new RegExp(\"^(\\\\.\\\\./|\\\\./)[^\\\\s]+/IDENTITY\\\\.md$\")).min(1).max(512).describe(\"OPTIONAL — relative path to a parent IDENTITY.md. Presence makes the manifest a VIEW; absence makes it a WORKSPACE ROOT. Recursive composition; maximum chain depth is 8.\").optional(), \"appliesTo\": z.array(z.string().regex(new RegExp(\"^(ws://(operators|companies|personas|skills)/[a-z][a-z0-9-]*|\\\\.\\\\./[^\\\\s]+)$\")).describe(\"Either a ws:// ref to an AIP-9 operator, AIP-22 company, AIP-25 persona, or AIP-3 skill, or a relative path to a consumer workspace folder.\")).refine((arr) => arr.every((item, i) => arr.indexOf(item) == i), { message: \"All items must be unique!\" }).describe(\"OPTIONAL — list of consumers this VIEW adapts the identity for. Hosts MUST refuse the view if any binding does not resolve. Not inherited; views declare their own scope.\").optional(), \"executor\": z.string().regex(new RegExp(\"^ws://operators/[a-z][a-z0-9-]*$\")).describe(\"OPTIONAL — AIP-9 operator the identity is *about* or activates against. The host loads this operator when the identity is opened.\").optional(), \"governance\": z.string().min(1).max(512).describe(\"OPTIONAL — AIP-7 policy or audit binding. May be a path to an AIP-7 policy file or a ws:// ref. Identity-level approvals (layer mutations, confidence elevation, persona binding) flow through this ref.\").optional(), \"work\": z.string().regex(new RegExp(\"^ws://workspaces/[a-z][a-z0-9-]*$\")).describe(\"OPTIONAL — AIP-20 work tracker the identity participates in (an operator's task queue, a company's program plan).\").optional(), \"knowledge\": z.string().regex(new RegExp(\"^ws://wikis/[a-z][a-z0-9-]*(/KNOWLEDGE\\\\.md)?$\")).describe(\"OPTIONAL — AIP-10 KNOWLEDGE.md ref. The identity's narrative wiki, dossier, exemplars.\").optional(), \"collections\": z.array(z.any()).describe(\"Layer collections enabled by this identity. Each entry is one AIP-18 collection describing ONE layer kind. Three forms supported: inline (full COLLECTION.md frontmatter), file ref, or registry import. Merge-by-effective-name (alias if set, otherwise the collection's name) across the extends chain.\").default([] as never), \"layers\": z.object({ \"defaultConfidence\": z.number().gte(0).lte(1).describe(\"OPTIONAL — minimum confidence (0..1) the workspace will store. New items below the floor are refused with identity_confidence_below_floor (HARD). Default is 0.0 (no floor). Workspaces with strict identity standards SHOULD set this to 0.5 or higher.\").default(0), \"versioning\": z.enum([\"enabled\",\"disabled\"]).describe(\"Whether layer items carry an incrementing version on update. ONE-WAY SWITCH: once 'enabled' at any ancestor, descendants MUST NOT set 'disabled'. Refusal: identity_versioning_disable (HARD).\").default(\"enabled\"), \"temporal\": z.object({ \"enabled\": z.boolean().describe(\"OPTIONAL — whether temporal-entry companion items are supported for layers marked temporal: true on their own collection.\").default(false), \"field\": z.string().regex(new RegExp(\"^[a-z][a-zA-Z0-9_]*$\")).describe(\"OPTIONAL — field name on temporal-entry items carrying expiry. Hosts walk this field on read to exclude expired entries.\").default(\"validUntil\"), \"sourceVocabulary\": z.array(z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*[a-z0-9]$\"))).refine((arr) => arr.every((item, i) => arr.indexOf(item) == i), { message: \"All items must be unique!\" }).describe(\"Controlled vocabulary for temporal-entry.source. APPEND-ONLY across ancestors: descendants MAY add new values but MUST NOT remove existing ones.\").default([\"configured\",\"observed\",\"inferred\",\"self-reported\"]) }).strict().describe(\"Temporal-layer behaviour at the workspace level.\").optional() }).strict().describe(\"Layer behaviour configuration. Confidence floor, versioning posture, temporal-entry contract.\").optional(), \"artifacts\": z.object({ \"enabled\": z.boolean().describe(\"Whether the host generates compression artifacts for layer items.\").default(false), \"tiers\": z.array(z.object({ \"id\": z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*$\")).describe(\"Stable kebab-case tier id. Conventional values: short, medium, full. Merge key vs parent.\"), \"maxTokens\": z.number().int().gte(1).lte(32768).describe(\"Target maximum tokens for this tier's artifact. Tiers MUST be MONOTONIC: each tier's maxTokens MUST be strictly greater than the previous tier's. The host re-validates monotonicity after merge.\"), \"strategy\": z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*$\")).describe(\"OPTIONAL — compression algorithm id. Conventional values: aaak, bullet-list, markdown, or a host-defined string.\").optional() }).strict()).describe(\"Compression tiers. Merge-by-id vs parent; child tier with same id overrides parent's. Monotonicity (strictly increasing maxTokens) is re-validated after merge.\").default([] as never), \"locales\": z.array(z.string().regex(new RegExp(\"^[a-z]{2}(-[A-Z]{2})?$\"))).refine((arr) => arr.every((item, i) => arr.indexOf(item) == i), { message: \"All items must be unique!\" }).describe(\"Locales for which artifacts are generated. ISO 639-1 (e.g. 'en') with optional ISO 3166-1 region (e.g. 'en-US'). When non-empty, the host produces one artifact per (layer, tier, locale) triple.\").default([] as never), \"refreshPolicy\": z.enum([\"on-write\",\"scheduled\",\"manual\"]).describe(\"When the host regenerates artifacts. on-write = immediately after layer item mutation (correctness); scheduled = host-defined cadence (cheap, eventually consistent); manual = no auto-refresh.\").default(\"on-write\") }).strict().describe(\"Compression artifact policy. AIP-23's first distinctive contribution.\").optional(), \"binding\": z.object({ \"allowedEntities\": z.array(z.enum([\"operator\",\"company\",\"persona\",\"user\",\"skill\"])).refine((arr) => arr.every((item, i) => arr.indexOf(item) == i), { message: \"All items must be unique!\" }).describe(\"Bearer entity kinds allowed to bind layer items. Workspaces narrow to fit their domain (companion-style: [user, persona]; operator-fleet style: [operator, company]). Cross-references: operator → AIP-9, company → AIP-22, persona → AIP-25, skill → AIP-3, user → host-defined.\").default([\"operator\"]), \"exclusivity\": z.literal(\"per-entity-and-layer\").describe(\"Binding exclusivity rule. ONE-WAY SWITCH on relaxation: once 'per-entity-and-layer' (or stricter, when added) at any ancestor, descendants MUST NOT replace with a more permissive value. Refusal: identity_binding_loosen (HARD). Currently only 'per-entity-and-layer' is defined; future values may add stricter forms.\").default(\"per-entity-and-layer\"), \"verifyExistence\": z.boolean().describe(\"Whether the host verifies the bearer entity exists before allowing the binding. ONE-WAY SWITCH on relaxation: once 'true' at any ancestor, descendants MUST NOT set false. Refusal: identity_binding_verify_relax (HARD). Setting false is permitted for ephemeral / sandbox deployments but SHOULD never be used in production.\").default(true) }).strict().describe(\"Junction policy. Which bearer entity kinds may bind layer items as their identity, and how exclusively.\").optional(), \"lints\": z.array(z.object({ \"id\": z.string().regex(new RegExp(\"^[a-z][a-z0-9-]*$\")).describe(\"Stable kebab-case lint id. Merge key when composing with extends parent.\"), \"kind\": z.enum([\"orphan-layer\",\"low-confidence-pinned\",\"stale-temporal\",\"unbound-layer\",\"missing-required-layer\",\"custom\"]).describe(\"Workspace-spanning lint algorithm. AIP-18 per-collection lints (missing-owner, overdue, required-field, etc.) live on COLLECTION.md and are NOT redeclared here. 'custom' delegates to a host-defined check identified by `id`.\"), \"severity\": z.enum([\"error\",\"warn\",\"info\"]).describe(\"Lint severity. Children may soften; governance policies MAY forbid softening below `error`.\"), \"params\": z.record(z.string(), z.any()).describe(\"Kind-specific parameters. e.g. { layers: [soul, personality] } for missing-required-layer; { days: 30 } for stale-temporal; { threshold: 0.5 } for low-confidence-pinned.\").default({} as never) }).strict()).describe(\"Workspace-spanning lints. Merge-by-id vs parent.\").default([] as never), \"defaults\": z.object({ \"approvalClass\": z.string().regex(new RegExp(\"^(auto|always|on-mutate|policy:[A-Za-z0-9_./:-]+)$\")).describe(\"Approval class for layer mutations. 'auto' = no gate; 'always' = every mutation requires approval; 'on-mutate' = approval on field-level mutations; 'policy:<ref>' = delegate to an AIP-7 policy.\").optional(), \"auditMutations\": z.boolean().describe(\"Whether layer mutations are audited. ONE-WAY SWITCH: once true at any ancestor, descendants MUST NOT set false. Refusal: identity_audit_downgrade (HARD).\").default(false) }).strict().describe(\"Default approval and audit posture.\").optional(), \"display\": z.object({ \"homePage\": z.string().regex(new RegExp(\"^[A-Za-z0-9][A-Za-z0-9_:-]*$\")).describe(\"OPTIONAL — id of the layer or item to use as the identity landing page (e.g. SOUL-acme-founder).\").optional(), \"defaultGrouping\": z.enum([\"layer\",\"entity\"]).describe(\"Default grouping for list views. 'layer' = one section per layer kind; 'entity' = one section per bearer entity.\").optional() }).strict().describe(\"Display hints for UIs that render the identity. Runtime-agnostic.\").optional(), \"metadata\": z.record(z.string(), z.any()).describe(\"Vendor-specific extensions, namespaced under <vendor>. Deep-merged across the extends chain. MUST NOT change the meaning of any spec field.\").default({} as never) }).strict().and(z.any().describe(\"A view (any manifest with appliesTo set) MUST extend a parent. A workspace-root manifest has neither field.\")).describe(\"Validates the YAML frontmatter portion of an AIP-23 IDENTITY.md (workspace root or per-context view). The single doctype 'identity.workspace/v1' is used in both modes; the host distinguishes by checking whether `extends` is set. Per-layer-kind schemas are delegated to AIP-18 (COLLECTION.md / ITEM.md). Items in any layer collection MUST carry a `confidence` field in 0..1; that requirement is enforced at item-load time by the host, not by this schema (which validates the workspace manifest only).\")\n\nexport type IdentityFrontmatter = z.infer<typeof identityFrontmatterSchema>\n","import { createDoctype } from \"@agentproto/doctype\"\nimport { identityFrontmatterSchema } from \"./schema.js\"\nimport type { IdentityDefinition, IdentityHandle } from \"./types.js\"\n\n/**\n * AIP-23 reference implementation of `defineIdentity`.\n *\n * Built on `createDoctype` so the cross-AIP invariants (id pattern,\n * description length, top-level freeze, \"defineIdentity (AIP-23): …\"\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 (`parseIdentityManifest`), 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.name\n * readDescription: def.description.\n */\nexport const defineIdentity = createDoctype<IdentityDefinition, IdentityHandle>({\n aip: 23,\n name: \"identity\",\n readIdentity: (def) => def.name,\n validate(def) {\n // Cross-field rules run BEFORE field-level zod so structural\n // errors surface before the cascade of \"missing required field\".\n //\n // AIP-23 rule: appliesTo non-empty ⇒ extends required.\n const d = def as { appliesTo?: readonly unknown[]; extends?: unknown }\n if (\n Array.isArray(d.appliesTo) &&\n d.appliesTo.length > 0 &&\n d.extends == null\n ) {\n throw new Error(\n `defineIdentity (AIP-23): appliesTo is non-empty — extends MUST be set`,\n )\n }\n const result = identityFrontmatterSchema.safeParse(def)\n if (!result.success) {\n throw new Error(\n `defineIdentity (AIP-23): ${result.error.issues\n .map((i) => `${i.path.join(\".\")}: ${i.message}`)\n .join(\"; \")}`,\n )\n }\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 IdentityHandle\n },\n})\n"]}
package/dist/index.d.ts CHANGED
@@ -31,7 +31,7 @@ declare const defineIdentity: (def: IdentityDefinition) => Readonly<IdentityDefi
31
31
  * - TS: `defineIdentity({...})` → `IdentityHandle`
32
32
  * - MD: `parseIdentityManifest(src) → identityFromManifest({...})` → `IdentityHandle`
33
33
  */
34
- declare const SPEC_NAME: "agentidentity/v1";
34
+ declare const SPEC_NAME: "identity/v1";
35
35
  declare const SPEC_VERSION: "1.0.0-alpha";
36
36
 
37
37
  export { IdentityDefinition, SPEC_NAME, SPEC_VERSION, defineIdentity };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { defineIdentity } from './chunk-4ZC5U7ML.mjs';
1
+ export { defineIdentity } from './chunk-ZUANMTTC.mjs';
2
2
 
3
3
  /**
4
4
  * @agentproto/identity v0.1.0-alpha
@@ -6,7 +6,7 @@ export { defineIdentity } from './chunk-4ZC5U7ML.mjs';
6
6
  */
7
7
 
8
8
  // src/index.ts
9
- var SPEC_NAME = "agentidentity/v1";
9
+ var SPEC_NAME = "identity/v1";
10
10
  var SPEC_VERSION = "1.0.0-alpha";
11
11
 
12
12
  export { SPEC_NAME, SPEC_VERSION };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;AAYO,IAAM,SAAA,GAAY;AAClB,IAAM,YAAA,GAAe","file":"index.mjs","sourcesContent":["/**\n * @agentproto/identity — AIP-23 IDENTITY.md `defineIdentity` reference impl.\n *\n * A workspace AIP that defines layered, composable agent identity — typed layers as AIP-18 collections, confidence-scored items, optional temporal entries, and compression-artifact tiers — owning only the workspace root manifest, layer registry, compression policy, junction rules, and cross-AIP composition.\n *\n * Spec: https://agentproto.sh/docs/aip-23\n *\n * Authoring paths:\n * - TS: `defineIdentity({...})` → `IdentityHandle`\n * - MD: `parseIdentityManifest(src) → identityFromManifest({...})` → `IdentityHandle`\n */\n\nexport const SPEC_NAME = \"agentidentity/v1\" as const\nexport const SPEC_VERSION = \"1.0.0-alpha\" as const\n\nexport { defineIdentity } from \"./define-identity.js\"\nexport type { IdentityDefinition, IdentityHandle } from \"./types.js\"\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;AAYO,IAAM,SAAA,GAAY;AAClB,IAAM,YAAA,GAAe","file":"index.mjs","sourcesContent":["/**\n * @agentproto/identity — AIP-23 IDENTITY.md `defineIdentity` reference impl.\n *\n * A workspace AIP that defines layered, composable agent identity — typed layers as AIP-18 collections, confidence-scored items, optional temporal entries, and compression-artifact tiers — owning only the workspace root manifest, layer registry, compression policy, junction rules, and cross-AIP composition.\n *\n * Spec: https://agentproto.sh/docs/aip-23\n *\n * Authoring paths:\n * - TS: `defineIdentity({...})` → `IdentityHandle`\n * - MD: `parseIdentityManifest(src) → identityFromManifest({...})` → `IdentityHandle`\n */\n\nexport const SPEC_NAME = \"identity/v1\" as const\nexport const SPEC_VERSION = \"1.0.0-alpha\" as const\n\nexport { defineIdentity } from \"./define-identity.js\"\nexport type { IdentityDefinition, IdentityHandle } from \"./types.js\"\n"]}
@@ -1,5 +1,5 @@
1
- import { identityFrontmatterSchema, defineIdentity } from '../chunk-4ZC5U7ML.mjs';
2
- export { identityFrontmatterSchema } from '../chunk-4ZC5U7ML.mjs';
1
+ import { identityFrontmatterSchema, defineIdentity } from '../chunk-ZUANMTTC.mjs';
2
+ export { identityFrontmatterSchema } from '../chunk-ZUANMTTC.mjs';
3
3
  import matter from 'gray-matter';
4
4
 
5
5
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentproto/identity",
3
- "version": "0.1.4",
3
+ "version": "0.2.0",
4
4
  "description": "@agentproto/identity — AIP-23 IDENTITY.md reference implementation. A workspace AIP that defines layered, composable agent identity — typed layers as AIP-18 collections, confidence-scored items, optional temporal entries, and compression-artifact tiers — owning only the workspace root manifest, layer registry, compression policy, junction rules, and cross-AIP composition.",
5
5
  "keywords": [
6
6
  "agentproto",
@@ -47,11 +47,11 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "gray-matter": "^4.0.3",
50
- "zod": "^4.6.5",
51
- "@agentproto/define-doctype": "0.1.3"
50
+ "zod": "^4.6.7",
51
+ "@agentproto/doctype": "0.2.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@types/node": "^25.9.5",
54
+ "@types/node": "^25.9.9",
55
55
  "tsup": "^8.5.1",
56
56
  "typescript": "^5.9.3",
57
57
  "vitest": "^3.2.7",