@agentproto/role-catalog 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 +21 -0
- package/dist/index.d.ts +139 -0
- package/dist/index.mjs +1002 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jeremy André and 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/dist/index.d.ts
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { BuiltinRoleEntry, BuiltinRoleSource } from '@agentproto/role';
|
|
2
|
+
import { PolicyHandle } from '@agentproto/policy';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* AIP-47 builtin role catalogue.
|
|
6
|
+
*
|
|
7
|
+
* Twenty starter role manifests covering common positions across the
|
|
8
|
+
* nine recommended departments. Each entry pairs a validated
|
|
9
|
+
* `RoleHandle` (per AIP-47 ROLE.schema.json) with a body markdown
|
|
10
|
+
* (background / working principles / escalation rules).
|
|
11
|
+
*
|
|
12
|
+
* Doctype-agnostic: a role describes a job, not who holds it. Any
|
|
13
|
+
* AIP-9 OPERATOR or human member can wear any role in this catalogue.
|
|
14
|
+
* Consumers wanting to bias their UI toward common patterns
|
|
15
|
+
* (e.g. surfacing manager-level roles before C-suite in a "hire AI
|
|
16
|
+
* worker" flow) do that through curation / tags / sort order, not
|
|
17
|
+
* through a typed `audience` field on the manifest.
|
|
18
|
+
*
|
|
19
|
+
* Consumers compose this catalogue into a resolver chain through
|
|
20
|
+
* `builtinRoleSource()` (re-exported from the package index).
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
declare const BUILTIN_ROLE_ENTRIES: readonly BuiltinRoleEntry[];
|
|
24
|
+
/** Slugs of every builtin shipped in this catalogue, in display order. */
|
|
25
|
+
declare const BUILTIN_ROLE_SLUGS: readonly string[];
|
|
26
|
+
/**
|
|
27
|
+
* Mapping from Guilde's legacy `OperatorRole` enum to a builtin slug
|
|
28
|
+
* in this catalogue. Used by migration scripts to backfill
|
|
29
|
+
* `operators.role_slug` from the existing `operators.role` text.
|
|
30
|
+
*
|
|
31
|
+
* Renames per Prakash 2026-05-11 — no CXO branding for AI workers
|
|
32
|
+
* (those titles are reserved for the human executive).
|
|
33
|
+
*/
|
|
34
|
+
declare const LEGACY_GUILDE_ROLE_MAP: Readonly<Record<string, string>>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Companion baseline policies for builtin roles (AIP-38).
|
|
38
|
+
*
|
|
39
|
+
* A role's `defaultPolicy` is ADVISORY per AIP-47 — the runtime MUST NOT
|
|
40
|
+
* auto-apply it without the operator's own `policy:` field or a
|
|
41
|
+
* governance signature attesting the binding. These manifests are the
|
|
42
|
+
* portable declaration of intent that travels with the role; binding
|
|
43
|
+
* them to an operator (and compiling grants into a host's enforcement
|
|
44
|
+
* surface) is a governed, host-side step.
|
|
45
|
+
*
|
|
46
|
+
* Authored as validated TS `definePolicy` objects — same shipping shape
|
|
47
|
+
* as the role seeds — so every field-level constraint runs at module
|
|
48
|
+
* load and the policy is bundleable alongside the catalogue.
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Baseline policy for `talent-acquisition-specialist`.
|
|
53
|
+
*
|
|
54
|
+
* `default: deny` — the operator may only perform the recruiting actions
|
|
55
|
+
* explicitly granted (sourcing, screening, candidate messaging, document
|
|
56
|
+
* generation, scheduling, KPI computation). The hire DECISION actions
|
|
57
|
+
* (`hiring:extend-offer`, `hiring:reject-candidate`) are gated behind a
|
|
58
|
+
* human approval requirement rather than granted — the hiring manager
|
|
59
|
+
* decides. Finance / payroll and sensitive-data actions are never granted,
|
|
60
|
+
* so `default: deny` denies them.
|
|
61
|
+
*/
|
|
62
|
+
declare const talentAcquisitionBaselinePolicy: PolicyHandle;
|
|
63
|
+
/** Baseline policies shipped alongside the builtin role catalogue. */
|
|
64
|
+
declare const BUILTIN_POLICY_HANDLES: readonly PolicyHandle[];
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @agentproto/role-catalog — AIP-47 reference catalogue of builtin roles.
|
|
68
|
+
*
|
|
69
|
+
* Ships twenty starter ROLE.md manifests spanning the nine recommended
|
|
70
|
+
* departments. Each entry is a validated `RoleHandle` (per
|
|
71
|
+
* `@agentproto/role`'s `ROLE.schema.json`) paired with body markdown
|
|
72
|
+
* covering background, working principles, and escalation.
|
|
73
|
+
*
|
|
74
|
+
* Roles are **doctype-agnostic**: any AIP-9 OPERATOR or human member
|
|
75
|
+
* can wear any of these manifests. Curation / sort order / soft tags
|
|
76
|
+
* in consumer UIs handle positioning concerns (e.g. "manager-level
|
|
77
|
+
* roles are more typical for AI workers than C-suite ones in 2026"),
|
|
78
|
+
* not a typed `audience` field on the manifest.
|
|
79
|
+
*
|
|
80
|
+
* Process-wide singleton — `builtinRoleSource()` returns the SAME
|
|
81
|
+
* `BuiltinRoleSource` on every call (backed by an AIP-43 registry).
|
|
82
|
+
* Downstream apps may extend the catalogue via `registerBuiltinRoles`
|
|
83
|
+
* without forking the OSS package:
|
|
84
|
+
*
|
|
85
|
+
* import { registerBuiltinRoles } from "@agentproto/role-catalog"
|
|
86
|
+
* registerBuiltinRoles([
|
|
87
|
+
* { slug: "guild-admin", handle: {...}, body: "..." },
|
|
88
|
+
* ])
|
|
89
|
+
*
|
|
90
|
+
* Composing the catalogue into a resolver chain:
|
|
91
|
+
*
|
|
92
|
+
* import { resolveRole } from "@agentproto/role"
|
|
93
|
+
* import { builtinRoleSource } from "@agentproto/role-catalog"
|
|
94
|
+
*
|
|
95
|
+
* const result = await resolveRole("marketing-manager", {
|
|
96
|
+
* sources: [builtinRoleSource()],
|
|
97
|
+
* })
|
|
98
|
+
*
|
|
99
|
+
* Spec: https://agentproto.sh/docs/aip-47
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Return the process-wide singleton `BuiltinRoleSource`. Wraps the
|
|
104
|
+
* OSS catalogue (20 starters) plus any entries registered through
|
|
105
|
+
* `registerBuiltinRoles`. Safe to call from any module at any time —
|
|
106
|
+
* the registry is lazily bootstrapped on first access.
|
|
107
|
+
*/
|
|
108
|
+
declare function builtinRoleSource(): BuiltinRoleSource;
|
|
109
|
+
/**
|
|
110
|
+
* Register additional builtin roles into the process-wide registry.
|
|
111
|
+
* Use this when a downstream package (a vendor runtime, a host app)
|
|
112
|
+
* ships its own builtin roles ALONGSIDE the OSS catalogue without
|
|
113
|
+
* forking `@agentproto/role-catalog`.
|
|
114
|
+
*
|
|
115
|
+
* Throws `RegistryDuplicateError` from `@agentproto/registry` if a
|
|
116
|
+
* slug already exists — the catalogue is intended to be additive,
|
|
117
|
+
* not overwriting. Call `replaceBuiltinRole(entry)` if a slug rev
|
|
118
|
+
* needs to swap atomically.
|
|
119
|
+
*
|
|
120
|
+
* Boot-time call site is the right pattern — every consumer of
|
|
121
|
+
* `builtinRoleSource()` after `registerBuiltinRoles` sees the
|
|
122
|
+
* additions.
|
|
123
|
+
*/
|
|
124
|
+
declare function registerBuiltinRoles(entries: Iterable<BuiltinRoleEntry>): void;
|
|
125
|
+
/**
|
|
126
|
+
* Replace an existing builtin role with a new version of the same
|
|
127
|
+
* slug. Throws `RegistryNotFoundError` if no entry exists at the
|
|
128
|
+
* slug — use `registerBuiltinRoles` for new slugs.
|
|
129
|
+
*/
|
|
130
|
+
declare function replaceBuiltinRole(entry: BuiltinRoleEntry): void;
|
|
131
|
+
/**
|
|
132
|
+
* Remove a builtin role from the registry. Returns true if the slug
|
|
133
|
+
* was present. Use sparingly — the registry is intended to be
|
|
134
|
+
* boot-time-stable; mid-flight unregister of an OSS starter risks
|
|
135
|
+
* resolver fall-through to file/db sources mid-conversation.
|
|
136
|
+
*/
|
|
137
|
+
declare function unregisterBuiltinRole(slug: string): boolean;
|
|
138
|
+
|
|
139
|
+
export { BUILTIN_POLICY_HANDLES, BUILTIN_ROLE_ENTRIES, BUILTIN_ROLE_SLUGS, LEGACY_GUILDE_ROLE_MAP, builtinRoleSource, registerBuiltinRoles, replaceBuiltinRole, talentAcquisitionBaselinePolicy, unregisterBuiltinRole };
|