@medicine-wheel/capabilities 0.0.0-stage → 0.21.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/README.md +48 -2
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas.d.ts +137 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +79 -0
- package/dist/schemas.js.map +1 -0
- package/dist/shared.d.ts +19 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +36 -0
- package/dist/shared.js.map +1 -0
- package/dist/statement.d.ts +22 -0
- package/dist/statement.d.ts.map +1 -0
- package/dist/statement.js +37 -0
- package/dist/statement.js.map +1 -0
- package/dist/types.d.ts +96 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +21 -0
- package/dist/types.js.map +1 -0
- package/package.json +49 -4
package/README.md
CHANGED
|
@@ -1,3 +1,49 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @medicine-wheel/capabilities
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The platform-features and capabilities layer of the Medicine Wheel Developer Suite.
|
|
4
|
+
|
|
5
|
+
A capability is something the platform can do for someone: publish a prototype to an
|
|
6
|
+
episode, register a service, follow a wheel's events. It rides a `knowledge` node
|
|
7
|
+
carrying `metadata.kind: "capability"` (direction west, `DEVELOPER_ENTITY_BINDING` in
|
|
8
|
+
`ontology-core`), and this package holds its specifics keyed by node id, the way
|
|
9
|
+
`@medicine-wheel/infra` holds a service's.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @medicine-wheel/capabilities
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Depends on `@medicine-wheel/ontology-core`, `@medicine-wheel/infra` (for `MetisHold`) and `zod`.
|
|
18
|
+
|
|
19
|
+
## What is here
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import {
|
|
23
|
+
CapabilityFacetSchema,
|
|
24
|
+
checkStatement,
|
|
25
|
+
findSharedCapabilities,
|
|
26
|
+
type CapabilityFacet,
|
|
27
|
+
type Attribution,
|
|
28
|
+
} from '@medicine-wheel/capabilities';
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
| Export | What it does |
|
|
32
|
+
|---|---|
|
|
33
|
+
| `CapabilityFacet`, `CapabilityFacetSchema` | One capability: id `capability:<slug>`, name, statement, status, providers, attribution. |
|
|
34
|
+
| `Attribution`, `attributionShape` | Who wrote a row, when, from what evidence (`grounding`, at least one), and its `revision`: `pending`, `revised` or `affirmed`. A revised or affirmed row names who and when. |
|
|
35
|
+
| `StatementStatus` | `clear`, `unclear`, `undefinable`, `needs-resolution`. A clear or unclear row carries its statement. |
|
|
36
|
+
| `STATEMENT_WORD_LIMIT`, `countWords`, `checkStatement`, `StatementSchema` | The 55-word limit. A writer over it records `needs-resolution` without a statement and moves on. |
|
|
37
|
+
| `capabilityClaims`, `findSharedCapabilities` | Which capabilities two or more providers give: a relation to name, not a conflict. |
|
|
38
|
+
|
|
39
|
+
Schemas are strict: in rows written by models, an unknown key is far more often a
|
|
40
|
+
misspelling than a new field.
|
|
41
|
+
|
|
42
|
+
Zero I/O, zero persistence, zero clock.
|
|
43
|
+
|
|
44
|
+
## Used by
|
|
45
|
+
|
|
46
|
+
`@medicine-wheel/developer-repository-mapping`: a feature `realizes` a capability, a
|
|
47
|
+
repository `provides` one, and every mapping row carries this package's attribution.
|
|
48
|
+
|
|
49
|
+
Spec: [`rispecs/developer-suite/repository-mapping/capabilities.spec.md`](https://github.com/jgwill/medicine-wheel/blob/main/rispecs/developer-suite/repository-mapping/capabilities.spec.md).
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @medicine-wheel/capabilities
|
|
3
|
+
*
|
|
4
|
+
* The platform-features and capabilities layer of the Medicine Wheel Developer
|
|
5
|
+
* Suite: what the platform can do for someone, which repositories and services
|
|
6
|
+
* give it, and who said so. A sibling of `@medicine-wheel/infra`, built the
|
|
7
|
+
* same way: a `metadata.kind` discriminator in `ontology-core`
|
|
8
|
+
* (`DEVELOPER_ENTITY_BINDING`), typed facets keyed by node id, Zod schemas at
|
|
9
|
+
* the boundary, pure functions.
|
|
10
|
+
*
|
|
11
|
+
* `@medicine-wheel/developer-repository-mapping` consumes it: a feature
|
|
12
|
+
* observed in a repository `realizes` a capability, and a repository
|
|
13
|
+
* `provides` one.
|
|
14
|
+
*
|
|
15
|
+
* Zero I/O, zero persistence, zero clock.
|
|
16
|
+
*
|
|
17
|
+
* @packageDocumentation
|
|
18
|
+
*/
|
|
19
|
+
export type { NodeId, StatementStatus, RevisionState, Attribution, CapabilityFacet, CapabilityClaim, SharedCapability, } from './types';
|
|
20
|
+
export { STATEMENT_WORD_LIMIT } from './types';
|
|
21
|
+
export { countWords, checkStatement, isSlug, capabilityNodeId } from './statement';
|
|
22
|
+
export type { StatementCheck } from './statement';
|
|
23
|
+
export { StatementStatusSchema, RevisionStateSchema, TimestampSchema, StatementSchema, attributionShape, refineAttribution, refineStatementPresence, CapabilityNodeIdSchema, CapabilityFacetSchema, } from './schemas';
|
|
24
|
+
export type { ValidatedCapabilityFacet } from './schemas';
|
|
25
|
+
export { capabilityClaims, findSharedCapabilities } from './shared';
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,YAAY,EACV,MAAM,EACN,eAAe,EACf,aAAa,EACb,WAAW,EACX,eAAe,EACf,eAAe,EACf,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAG/C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACnF,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,WAAW,CAAC;AAEnB,YAAY,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAG1D,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @medicine-wheel/capabilities
|
|
4
|
+
*
|
|
5
|
+
* The platform-features and capabilities layer of the Medicine Wheel Developer
|
|
6
|
+
* Suite: what the platform can do for someone, which repositories and services
|
|
7
|
+
* give it, and who said so. A sibling of `@medicine-wheel/infra`, built the
|
|
8
|
+
* same way: a `metadata.kind` discriminator in `ontology-core`
|
|
9
|
+
* (`DEVELOPER_ENTITY_BINDING`), typed facets keyed by node id, Zod schemas at
|
|
10
|
+
* the boundary, pure functions.
|
|
11
|
+
*
|
|
12
|
+
* `@medicine-wheel/developer-repository-mapping` consumes it: a feature
|
|
13
|
+
* observed in a repository `realizes` a capability, and a repository
|
|
14
|
+
* `provides` one.
|
|
15
|
+
*
|
|
16
|
+
* Zero I/O, zero persistence, zero clock.
|
|
17
|
+
*
|
|
18
|
+
* @packageDocumentation
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.findSharedCapabilities = exports.capabilityClaims = exports.CapabilityFacetSchema = exports.CapabilityNodeIdSchema = exports.refineStatementPresence = exports.refineAttribution = exports.attributionShape = exports.StatementSchema = exports.TimestampSchema = exports.RevisionStateSchema = exports.StatementStatusSchema = exports.capabilityNodeId = exports.isSlug = exports.checkStatement = exports.countWords = exports.STATEMENT_WORD_LIMIT = void 0;
|
|
22
|
+
var types_1 = require("./types");
|
|
23
|
+
Object.defineProperty(exports, "STATEMENT_WORD_LIMIT", { enumerable: true, get: function () { return types_1.STATEMENT_WORD_LIMIT; } });
|
|
24
|
+
// ── The word limit ──────────────────────────────────────────────────────────
|
|
25
|
+
var statement_1 = require("./statement");
|
|
26
|
+
Object.defineProperty(exports, "countWords", { enumerable: true, get: function () { return statement_1.countWords; } });
|
|
27
|
+
Object.defineProperty(exports, "checkStatement", { enumerable: true, get: function () { return statement_1.checkStatement; } });
|
|
28
|
+
Object.defineProperty(exports, "isSlug", { enumerable: true, get: function () { return statement_1.isSlug; } });
|
|
29
|
+
Object.defineProperty(exports, "capabilityNodeId", { enumerable: true, get: function () { return statement_1.capabilityNodeId; } });
|
|
30
|
+
// ── Zod schemas ─────────────────────────────────────────────────────────────
|
|
31
|
+
var schemas_1 = require("./schemas");
|
|
32
|
+
Object.defineProperty(exports, "StatementStatusSchema", { enumerable: true, get: function () { return schemas_1.StatementStatusSchema; } });
|
|
33
|
+
Object.defineProperty(exports, "RevisionStateSchema", { enumerable: true, get: function () { return schemas_1.RevisionStateSchema; } });
|
|
34
|
+
Object.defineProperty(exports, "TimestampSchema", { enumerable: true, get: function () { return schemas_1.TimestampSchema; } });
|
|
35
|
+
Object.defineProperty(exports, "StatementSchema", { enumerable: true, get: function () { return schemas_1.StatementSchema; } });
|
|
36
|
+
Object.defineProperty(exports, "attributionShape", { enumerable: true, get: function () { return schemas_1.attributionShape; } });
|
|
37
|
+
Object.defineProperty(exports, "refineAttribution", { enumerable: true, get: function () { return schemas_1.refineAttribution; } });
|
|
38
|
+
Object.defineProperty(exports, "refineStatementPresence", { enumerable: true, get: function () { return schemas_1.refineStatementPresence; } });
|
|
39
|
+
Object.defineProperty(exports, "CapabilityNodeIdSchema", { enumerable: true, get: function () { return schemas_1.CapabilityNodeIdSchema; } });
|
|
40
|
+
Object.defineProperty(exports, "CapabilityFacetSchema", { enumerable: true, get: function () { return schemas_1.CapabilityFacetSchema; } });
|
|
41
|
+
// ── Shared capabilities ─────────────────────────────────────────────────────
|
|
42
|
+
var shared_1 = require("./shared");
|
|
43
|
+
Object.defineProperty(exports, "capabilityClaims", { enumerable: true, get: function () { return shared_1.capabilityClaims; } });
|
|
44
|
+
Object.defineProperty(exports, "findSharedCapabilities", { enumerable: true, get: function () { return shared_1.findSharedCapabilities; } });
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAaH,iCAA+C;AAAtC,6GAAA,oBAAoB,OAAA;AAE7B,+EAA+E;AAC/E,yCAAmF;AAA1E,uGAAA,UAAU,OAAA;AAAE,2GAAA,cAAc,OAAA;AAAE,mGAAA,MAAM,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AAG7D,+EAA+E;AAC/E,qCAUmB;AATjB,gHAAA,qBAAqB,OAAA;AACrB,8GAAA,mBAAmB,OAAA;AACnB,0GAAA,eAAe,OAAA;AACf,0GAAA,eAAe,OAAA;AACf,2GAAA,gBAAgB,OAAA;AAChB,4GAAA,iBAAiB,OAAA;AACjB,kHAAA,uBAAuB,OAAA;AACvB,iHAAA,sBAAsB,OAAA;AACtB,gHAAA,qBAAqB,OAAA;AAKvB,+EAA+E;AAC/E,mCAAoE;AAA3D,0GAAA,gBAAgB,OAAA;AAAE,gHAAA,sBAAsB,OAAA"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schemas for capability rows and for the attribution every row carries.
|
|
3
|
+
*
|
|
4
|
+
* These exist for the boundary where a model's reading of a repository becomes
|
|
5
|
+
* a row someone else will trust. The parse is where an over-long statement, a
|
|
6
|
+
* row with no evidence, or an `affirmed` row that names no person gets caught.
|
|
7
|
+
* Objects are strict: in a dataset written by models, an unknown key is far
|
|
8
|
+
* more often a misspelling than a new field.
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
export declare const StatementStatusSchema: z.ZodEnum<["clear", "unclear", "undefinable", "needs-resolution"]>;
|
|
12
|
+
export declare const RevisionStateSchema: z.ZodEnum<["pending", "revised", "affirmed"]>;
|
|
13
|
+
/** ISO 8601 with a zone: '2026-10-18T21:56:00Z', or git's '2026-10-14T22:28:46-04:00'. */
|
|
14
|
+
export declare const TimestampSchema: z.ZodString;
|
|
15
|
+
/** A statement of at least one word and at most {@link STATEMENT_WORD_LIMIT}. */
|
|
16
|
+
export declare const StatementSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
17
|
+
/** The attribution fields, as a shape other row schemas spread into their own. */
|
|
18
|
+
export declare const attributionShape: {
|
|
19
|
+
statedBy: z.ZodString;
|
|
20
|
+
statedAt: z.ZodString;
|
|
21
|
+
grounding: z.ZodArray<z.ZodString, "many">;
|
|
22
|
+
revision: z.ZodEnum<["pending", "revised", "affirmed"]>;
|
|
23
|
+
revisedBy: z.ZodOptional<z.ZodString>;
|
|
24
|
+
revisedAt: z.ZodOptional<z.ZodString>;
|
|
25
|
+
};
|
|
26
|
+
/** A `revised` or `affirmed` row names who revised it and when. */
|
|
27
|
+
export declare function refineAttribution(row: {
|
|
28
|
+
revision: string;
|
|
29
|
+
revisedBy?: string;
|
|
30
|
+
revisedAt?: string;
|
|
31
|
+
}, ctx: z.RefinementCtx): void;
|
|
32
|
+
/** A `clear` or `unclear` row carries its statement; the other two may not have one. */
|
|
33
|
+
export declare function refineStatementPresence(status: string, statement: string | undefined, field: string, ctx: z.RefinementCtx): void;
|
|
34
|
+
export declare const CapabilityNodeIdSchema: z.ZodString;
|
|
35
|
+
export declare const CapabilityFacetSchema: z.ZodEffects<z.ZodObject<{
|
|
36
|
+
statedBy: z.ZodString;
|
|
37
|
+
statedAt: z.ZodString;
|
|
38
|
+
grounding: z.ZodArray<z.ZodString, "many">;
|
|
39
|
+
revision: z.ZodEnum<["pending", "revised", "affirmed"]>;
|
|
40
|
+
revisedBy: z.ZodOptional<z.ZodString>;
|
|
41
|
+
revisedAt: z.ZodOptional<z.ZodString>;
|
|
42
|
+
nodeId: z.ZodString;
|
|
43
|
+
name: z.ZodString;
|
|
44
|
+
statement: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
45
|
+
status: z.ZodEnum<["clear", "unclear", "undefinable", "needs-resolution"]>;
|
|
46
|
+
providedBy: z.ZodArray<z.ZodString, "many">;
|
|
47
|
+
metis: z.ZodOptional<z.ZodObject<{
|
|
48
|
+
exceptions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
49
|
+
invisibleWork: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
50
|
+
notes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
51
|
+
heldBy: z.ZodOptional<z.ZodString>;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
exceptions?: string[] | undefined;
|
|
54
|
+
invisibleWork?: string[] | undefined;
|
|
55
|
+
notes?: string[] | undefined;
|
|
56
|
+
heldBy?: string | undefined;
|
|
57
|
+
}, {
|
|
58
|
+
exceptions?: string[] | undefined;
|
|
59
|
+
invisibleWork?: string[] | undefined;
|
|
60
|
+
notes?: string[] | undefined;
|
|
61
|
+
heldBy?: string | undefined;
|
|
62
|
+
}>>;
|
|
63
|
+
}, "strict", z.ZodTypeAny, {
|
|
64
|
+
status: "clear" | "unclear" | "undefinable" | "needs-resolution";
|
|
65
|
+
nodeId: string;
|
|
66
|
+
name: string;
|
|
67
|
+
providedBy: string[];
|
|
68
|
+
statedBy: string;
|
|
69
|
+
statedAt: string;
|
|
70
|
+
grounding: string[];
|
|
71
|
+
revision: "pending" | "revised" | "affirmed";
|
|
72
|
+
revisedBy?: string | undefined;
|
|
73
|
+
revisedAt?: string | undefined;
|
|
74
|
+
statement?: string | undefined;
|
|
75
|
+
metis?: {
|
|
76
|
+
exceptions?: string[] | undefined;
|
|
77
|
+
invisibleWork?: string[] | undefined;
|
|
78
|
+
notes?: string[] | undefined;
|
|
79
|
+
heldBy?: string | undefined;
|
|
80
|
+
} | undefined;
|
|
81
|
+
}, {
|
|
82
|
+
status: "clear" | "unclear" | "undefinable" | "needs-resolution";
|
|
83
|
+
nodeId: string;
|
|
84
|
+
name: string;
|
|
85
|
+
providedBy: string[];
|
|
86
|
+
statedBy: string;
|
|
87
|
+
statedAt: string;
|
|
88
|
+
grounding: string[];
|
|
89
|
+
revision: "pending" | "revised" | "affirmed";
|
|
90
|
+
revisedBy?: string | undefined;
|
|
91
|
+
revisedAt?: string | undefined;
|
|
92
|
+
statement?: string | undefined;
|
|
93
|
+
metis?: {
|
|
94
|
+
exceptions?: string[] | undefined;
|
|
95
|
+
invisibleWork?: string[] | undefined;
|
|
96
|
+
notes?: string[] | undefined;
|
|
97
|
+
heldBy?: string | undefined;
|
|
98
|
+
} | undefined;
|
|
99
|
+
}>, {
|
|
100
|
+
status: "clear" | "unclear" | "undefinable" | "needs-resolution";
|
|
101
|
+
nodeId: string;
|
|
102
|
+
name: string;
|
|
103
|
+
providedBy: string[];
|
|
104
|
+
statedBy: string;
|
|
105
|
+
statedAt: string;
|
|
106
|
+
grounding: string[];
|
|
107
|
+
revision: "pending" | "revised" | "affirmed";
|
|
108
|
+
revisedBy?: string | undefined;
|
|
109
|
+
revisedAt?: string | undefined;
|
|
110
|
+
statement?: string | undefined;
|
|
111
|
+
metis?: {
|
|
112
|
+
exceptions?: string[] | undefined;
|
|
113
|
+
invisibleWork?: string[] | undefined;
|
|
114
|
+
notes?: string[] | undefined;
|
|
115
|
+
heldBy?: string | undefined;
|
|
116
|
+
} | undefined;
|
|
117
|
+
}, {
|
|
118
|
+
status: "clear" | "unclear" | "undefinable" | "needs-resolution";
|
|
119
|
+
nodeId: string;
|
|
120
|
+
name: string;
|
|
121
|
+
providedBy: string[];
|
|
122
|
+
statedBy: string;
|
|
123
|
+
statedAt: string;
|
|
124
|
+
grounding: string[];
|
|
125
|
+
revision: "pending" | "revised" | "affirmed";
|
|
126
|
+
revisedBy?: string | undefined;
|
|
127
|
+
revisedAt?: string | undefined;
|
|
128
|
+
statement?: string | undefined;
|
|
129
|
+
metis?: {
|
|
130
|
+
exceptions?: string[] | undefined;
|
|
131
|
+
invisibleWork?: string[] | undefined;
|
|
132
|
+
notes?: string[] | undefined;
|
|
133
|
+
heldBy?: string | undefined;
|
|
134
|
+
} | undefined;
|
|
135
|
+
}>;
|
|
136
|
+
export type ValidatedCapabilityFacet = z.infer<typeof CapabilityFacetSchema>;
|
|
137
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,qBAAqB,oEAAkE,CAAC;AAErG,eAAO,MAAM,mBAAmB,+CAA6C,CAAC;AAE9E,0FAA0F;AAC1F,eAAO,MAAM,eAAe,aAAwC,CAAC;AAErE,iFAAiF;AACjF,eAAO,MAAM,eAAe,2CAU1B,CAAC;AAEH,kFAAkF;AAClF,eAAO,MAAM,gBAAgB;;;;;;;CAO5B,CAAC;AAEF,mEAAmE;AACnE,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,EACjE,GAAG,EAAE,CAAC,CAAC,aAAa,GACnB,IAAI,CAQN;AAED,wFAAwF;AACxF,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,CAAC,CAAC,aAAa,GACnB,IAAI,CAIN;AAED,eAAO,MAAM,sBAAsB,aAEiE,CAAC;AAErG,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc9B,CAAC;AAGL,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
package/dist/schemas.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Zod schemas for capability rows and for the attribution every row carries.
|
|
4
|
+
*
|
|
5
|
+
* These exist for the boundary where a model's reading of a repository becomes
|
|
6
|
+
* a row someone else will trust. The parse is where an over-long statement, a
|
|
7
|
+
* row with no evidence, or an `affirmed` row that names no person gets caught.
|
|
8
|
+
* Objects are strict: in a dataset written by models, an unknown key is far
|
|
9
|
+
* more often a misspelling than a new field.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CapabilityFacetSchema = exports.CapabilityNodeIdSchema = exports.attributionShape = exports.StatementSchema = exports.TimestampSchema = exports.RevisionStateSchema = exports.StatementStatusSchema = void 0;
|
|
13
|
+
exports.refineAttribution = refineAttribution;
|
|
14
|
+
exports.refineStatementPresence = refineStatementPresence;
|
|
15
|
+
const zod_1 = require("zod");
|
|
16
|
+
const infra_1 = require("@medicine-wheel/infra");
|
|
17
|
+
const statement_1 = require("./statement");
|
|
18
|
+
const types_1 = require("./types");
|
|
19
|
+
exports.StatementStatusSchema = zod_1.z.enum(['clear', 'unclear', 'undefinable', 'needs-resolution']);
|
|
20
|
+
exports.RevisionStateSchema = zod_1.z.enum(['pending', 'revised', 'affirmed']);
|
|
21
|
+
/** ISO 8601 with a zone: '2026-10-18T21:56:00Z', or git's '2026-10-14T22:28:46-04:00'. */
|
|
22
|
+
exports.TimestampSchema = zod_1.z.string().datetime({ offset: true });
|
|
23
|
+
/** A statement of at least one word and at most {@link STATEMENT_WORD_LIMIT}. */
|
|
24
|
+
exports.StatementSchema = zod_1.z.string().superRefine((text, ctx) => {
|
|
25
|
+
const { words, fits } = (0, statement_1.checkStatement)(text);
|
|
26
|
+
if (fits)
|
|
27
|
+
return;
|
|
28
|
+
ctx.addIssue({
|
|
29
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
30
|
+
message: words === 0
|
|
31
|
+
? 'a statement needs at least one word'
|
|
32
|
+
: `${words} words, the limit is ${types_1.STATEMENT_WORD_LIMIT}: record the row as needs-resolution without a statement and move to the next one`,
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
/** The attribution fields, as a shape other row schemas spread into their own. */
|
|
36
|
+
exports.attributionShape = {
|
|
37
|
+
statedBy: zod_1.z.string().min(1),
|
|
38
|
+
statedAt: exports.TimestampSchema,
|
|
39
|
+
grounding: zod_1.z.array(zod_1.z.string().min(1)).min(1),
|
|
40
|
+
revision: exports.RevisionStateSchema,
|
|
41
|
+
revisedBy: zod_1.z.string().min(1).optional(),
|
|
42
|
+
revisedAt: exports.TimestampSchema.optional(),
|
|
43
|
+
};
|
|
44
|
+
/** A `revised` or `affirmed` row names who revised it and when. */
|
|
45
|
+
function refineAttribution(row, ctx) {
|
|
46
|
+
if (row.revision === 'pending')
|
|
47
|
+
return;
|
|
48
|
+
if (!row.revisedBy) {
|
|
49
|
+
ctx.addIssue({ code: zod_1.z.ZodIssueCode.custom, path: ['revisedBy'], message: `a ${row.revision} row names who revised it` });
|
|
50
|
+
}
|
|
51
|
+
if (!row.revisedAt) {
|
|
52
|
+
ctx.addIssue({ code: zod_1.z.ZodIssueCode.custom, path: ['revisedAt'], message: `a ${row.revision} row says when it was revised` });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** A `clear` or `unclear` row carries its statement; the other two may not have one. */
|
|
56
|
+
function refineStatementPresence(status, statement, field, ctx) {
|
|
57
|
+
if ((status === 'clear' || status === 'unclear') && !statement) {
|
|
58
|
+
ctx.addIssue({ code: zod_1.z.ZodIssueCode.custom, path: [field], message: `a ${status} row carries its ${field}` });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.CapabilityNodeIdSchema = zod_1.z
|
|
62
|
+
.string()
|
|
63
|
+
.regex(/^capability:[a-z0-9]+(?:-[a-z0-9]+)*$/, 'a capability id is capability:<kebab-case-slug>');
|
|
64
|
+
exports.CapabilityFacetSchema = zod_1.z
|
|
65
|
+
.object({
|
|
66
|
+
nodeId: exports.CapabilityNodeIdSchema,
|
|
67
|
+
name: zod_1.z.string().min(1),
|
|
68
|
+
statement: exports.StatementSchema.optional(),
|
|
69
|
+
status: exports.StatementStatusSchema,
|
|
70
|
+
providedBy: zod_1.z.array(zod_1.z.string().min(1)),
|
|
71
|
+
metis: infra_1.MetisHoldSchema.optional(),
|
|
72
|
+
...exports.attributionShape,
|
|
73
|
+
})
|
|
74
|
+
.strict()
|
|
75
|
+
.superRefine((row, ctx) => {
|
|
76
|
+
refineAttribution(row, ctx);
|
|
77
|
+
refineStatementPresence(row.status, row.statement, 'statement', ctx);
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAsCH,8CAWC;AAGD,0DASC;AA3DD,6BAAwB;AACxB,iDAAwD;AACxD,2CAA6C;AAC7C,mCAA+C;AAElC,QAAA,qBAAqB,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAExF,QAAA,mBAAmB,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AAE9E,0FAA0F;AAC7E,QAAA,eAAe,GAAG,OAA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AAe,CAAC,QAAQ,EAAE;IACjC,GAAG,wBAAgB;CACpB,CAAC;KACD,MAAM,EAAE;KACR,WAAW,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IACxB,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC5B,uBAAuB,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,GAAG,CAAC,CAAC;AACvE,CAAC,CAAC,CAAC"}
|
package/dist/shared.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which capabilities more than one provider offers.
|
|
3
|
+
*
|
|
4
|
+
* The counterpart of `infra`'s `detectPortConflicts`, with the opposite
|
|
5
|
+
* reading. Two services cannot both hold a port; two repositories can both
|
|
6
|
+
* give a capability, and when they do there is a relation to name between
|
|
7
|
+
* them — a prototype and the implementation that grew from it, or one intent
|
|
8
|
+
* explored twice by different hands.
|
|
9
|
+
*/
|
|
10
|
+
import type { CapabilityClaim, CapabilityFacet, SharedCapability } from './types';
|
|
11
|
+
/** The claims a set of capabilities make through their own `providedBy`. */
|
|
12
|
+
export declare function capabilityClaims(capabilities: readonly CapabilityFacet[]): CapabilityClaim[];
|
|
13
|
+
/**
|
|
14
|
+
* Every capability claimed by two or more distinct providers, sorted by
|
|
15
|
+
* capability id, providers distinct and sorted. A provider claiming the same
|
|
16
|
+
* capability twice (through two of its features, say) counts once.
|
|
17
|
+
*/
|
|
18
|
+
export declare function findSharedCapabilities(claims: readonly CapabilityClaim[]): SharedCapability[];
|
|
19
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAElF,4EAA4E;AAC5E,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,SAAS,eAAe,EAAE,GAAG,eAAe,EAAE,CAE5F;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,GAAG,gBAAgB,EAAE,CAW7F"}
|
package/dist/shared.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Which capabilities more than one provider offers.
|
|
4
|
+
*
|
|
5
|
+
* The counterpart of `infra`'s `detectPortConflicts`, with the opposite
|
|
6
|
+
* reading. Two services cannot both hold a port; two repositories can both
|
|
7
|
+
* give a capability, and when they do there is a relation to name between
|
|
8
|
+
* them — a prototype and the implementation that grew from it, or one intent
|
|
9
|
+
* explored twice by different hands.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.capabilityClaims = capabilityClaims;
|
|
13
|
+
exports.findSharedCapabilities = findSharedCapabilities;
|
|
14
|
+
/** The claims a set of capabilities make through their own `providedBy`. */
|
|
15
|
+
function capabilityClaims(capabilities) {
|
|
16
|
+
return capabilities.flatMap((c) => c.providedBy.map((provider) => ({ capability: c.nodeId, provider })));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Every capability claimed by two or more distinct providers, sorted by
|
|
20
|
+
* capability id, providers distinct and sorted. A provider claiming the same
|
|
21
|
+
* capability twice (through two of its features, say) counts once.
|
|
22
|
+
*/
|
|
23
|
+
function findSharedCapabilities(claims) {
|
|
24
|
+
const providers = new Map();
|
|
25
|
+
for (const claim of claims) {
|
|
26
|
+
let set = providers.get(claim.capability);
|
|
27
|
+
if (!set)
|
|
28
|
+
providers.set(claim.capability, (set = new Set()));
|
|
29
|
+
set.add(claim.provider);
|
|
30
|
+
}
|
|
31
|
+
return [...providers.entries()]
|
|
32
|
+
.filter(([, set]) => set.size > 1)
|
|
33
|
+
.map(([capability, set]) => ({ capability, providers: [...set].sort() }))
|
|
34
|
+
.sort((a, b) => (a.capability < b.capability ? -1 : a.capability > b.capability ? 1 : 0));
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAKH,4CAEC;AAOD,wDAWC;AArBD,4EAA4E;AAC5E,SAAgB,gBAAgB,CAAC,YAAwC;IACvE,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;AAC3G,CAAC;AAED;;;;GAIG;AACH,SAAgB,sBAAsB,CAAC,MAAkC;IACvE,MAAM,SAAS,GAAG,IAAI,GAAG,EAAuB,CAAC;IACjD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC1C,IAAI,CAAC,GAAG;YAAE,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC;QAC7D,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,CAAC,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC;SAC5B,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC;SACjC,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;SACxE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9F,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The word limit, as a function a writer can ask before it writes.
|
|
3
|
+
*
|
|
4
|
+
* A writer that cannot say what a thing is in 55 words stops there, records
|
|
5
|
+
* the row as `needs-resolution` without a statement, and moves to the next
|
|
6
|
+
* thing. The limit is what keeps a mapping of a hundred repositories readable
|
|
7
|
+
* by a person, and what keeps a model from describing more than it read.
|
|
8
|
+
*/
|
|
9
|
+
/** A word is a whitespace-separated token holding at least one letter or digit. */
|
|
10
|
+
export declare function countWords(text: string): number;
|
|
11
|
+
export interface StatementCheck {
|
|
12
|
+
words: number;
|
|
13
|
+
limit: number;
|
|
14
|
+
/** `true` when the statement has at least one word and no more than `limit`. */
|
|
15
|
+
fits: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function checkStatement(text: string, limit?: number): StatementCheck;
|
|
18
|
+
/** True for a kebab-case slug: 'publish-prototype-to-episode'. */
|
|
19
|
+
export declare function isSlug(value: string): boolean;
|
|
20
|
+
/** `capability:<slug>`. Throws on a slug that is not kebab-case. */
|
|
21
|
+
export declare function capabilityNodeId(slug: string): string;
|
|
22
|
+
//# sourceMappingURL=statement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statement.d.ts","sourceRoot":"","sources":["../src/statement.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,mFAAmF;AACnF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI/C;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,gFAAgF;IAChF,IAAI,EAAE,OAAO,CAAC;CACf;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,MAA6B,GAAG,cAAc,CAGjG;AAID,kEAAkE;AAClE,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE7C;AAED,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGrD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The word limit, as a function a writer can ask before it writes.
|
|
4
|
+
*
|
|
5
|
+
* A writer that cannot say what a thing is in 55 words stops there, records
|
|
6
|
+
* the row as `needs-resolution` without a statement, and moves to the next
|
|
7
|
+
* thing. The limit is what keeps a mapping of a hundred repositories readable
|
|
8
|
+
* by a person, and what keeps a model from describing more than it read.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.countWords = countWords;
|
|
12
|
+
exports.checkStatement = checkStatement;
|
|
13
|
+
exports.isSlug = isSlug;
|
|
14
|
+
exports.capabilityNodeId = capabilityNodeId;
|
|
15
|
+
const types_1 = require("./types");
|
|
16
|
+
/** A word is a whitespace-separated token holding at least one letter or digit. */
|
|
17
|
+
function countWords(text) {
|
|
18
|
+
return text
|
|
19
|
+
.split(/\s+/u)
|
|
20
|
+
.filter((token) => /[\p{L}\p{N}]/u.test(token)).length;
|
|
21
|
+
}
|
|
22
|
+
function checkStatement(text, limit = types_1.STATEMENT_WORD_LIMIT) {
|
|
23
|
+
const words = countWords(text);
|
|
24
|
+
return { words, limit, fits: words > 0 && words <= limit };
|
|
25
|
+
}
|
|
26
|
+
const SLUG = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
27
|
+
/** True for a kebab-case slug: 'publish-prototype-to-episode'. */
|
|
28
|
+
function isSlug(value) {
|
|
29
|
+
return SLUG.test(value);
|
|
30
|
+
}
|
|
31
|
+
/** `capability:<slug>`. Throws on a slug that is not kebab-case. */
|
|
32
|
+
function capabilityNodeId(slug) {
|
|
33
|
+
if (!isSlug(slug))
|
|
34
|
+
throw new Error(`not a kebab-case slug: ${JSON.stringify(slug)}`);
|
|
35
|
+
return `capability:${slug}`;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=statement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statement.js","sourceRoot":"","sources":["../src/statement.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAKH,gCAIC;AASD,wCAGC;AAKD,wBAEC;AAGD,4CAGC;AAhCD,mCAA+C;AAE/C,mFAAmF;AACnF,SAAgB,UAAU,CAAC,IAAY;IACrC,OAAO,IAAI;SACR,KAAK,CAAC,MAAM,CAAC;SACb,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;AAC3D,CAAC;AASD,SAAgB,cAAc,CAAC,IAAY,EAAE,QAAgB,4BAAoB;IAC/E,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,CAAC,IAAI,KAAK,IAAI,KAAK,EAAE,CAAC;AAC7D,CAAC;AAED,MAAM,IAAI,GAAG,4BAA4B,CAAC;AAE1C,kEAAkE;AAClE,SAAgB,MAAM,CAAC,KAAa;IAClC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC;AAED,oEAAoE;AACpE,SAAgB,gBAAgB,CAAC,IAAY;IAC3C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACrF,OAAO,cAAc,IAAI,EAAE,CAAC;AAC9B,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Facet types for @medicine-wheel/capabilities.
|
|
3
|
+
*
|
|
4
|
+
* A capability is something the platform can do for someone — publish a
|
|
5
|
+
* prototype to an episode, register a service, follow a wheel's events. It
|
|
6
|
+
* rides a `knowledge` node carrying `metadata.kind: 'capability'`
|
|
7
|
+
* (`DEVELOPER_ENTITY_BINDING` in `ontology-core`), and this facet holds its
|
|
8
|
+
* specifics keyed by node id, the way `@medicine-wheel/infra` holds a
|
|
9
|
+
* service's.
|
|
10
|
+
*
|
|
11
|
+
* Every statement here was written by someone at some time, and most of them
|
|
12
|
+
* will be written by a model reading repositories. A model's reading is
|
|
13
|
+
* assumed biased until a person has read it, so every row says who wrote it,
|
|
14
|
+
* when, what it read, and whether anyone has revised it since.
|
|
15
|
+
*/
|
|
16
|
+
import type { RelationalNode } from '@medicine-wheel/ontology-core';
|
|
17
|
+
import type { MetisHold } from '@medicine-wheel/infra';
|
|
18
|
+
/** The id of the `RelationalNode` a facet annotates. */
|
|
19
|
+
export type NodeId = RelationalNode['id'];
|
|
20
|
+
/**
|
|
21
|
+
* Whether a statement says what a thing is, in words a reader can act on.
|
|
22
|
+
*
|
|
23
|
+
* - `clear` — the statement fits the word limit and the evidence read supports it.
|
|
24
|
+
* - `unclear` — a statement exists, but the evidence read does not settle it
|
|
25
|
+
* (a README that contradicts the code, a name that promises more than is there).
|
|
26
|
+
* - `undefinable` — what is there cannot be stated as one thing: an empty fork,
|
|
27
|
+
* a scratch folder, a snapshot of someone else's work.
|
|
28
|
+
* - `needs-resolution` — a statement was attempted and did not fit the limit,
|
|
29
|
+
* or two sources disagree and a person has to settle which one holds.
|
|
30
|
+
*/
|
|
31
|
+
export type StatementStatus = 'clear' | 'unclear' | 'undefinable' | 'needs-resolution';
|
|
32
|
+
/**
|
|
33
|
+
* Where a row stands with the people it describes.
|
|
34
|
+
*
|
|
35
|
+
* - `pending` — written, nobody has read it since. Every row a model writes starts here.
|
|
36
|
+
* - `revised` — a later reading corrected it.
|
|
37
|
+
* - `affirmed` — a person read it and stands behind it.
|
|
38
|
+
*/
|
|
39
|
+
export type RevisionState = 'pending' | 'revised' | 'affirmed';
|
|
40
|
+
/**
|
|
41
|
+
* Who wrote a row, when, from what, and who has read it since. Required on
|
|
42
|
+
* every row: a statement with no author and no time is a rumour, the rule
|
|
43
|
+
* `infra`'s `ObservedState` keeps for machine readings.
|
|
44
|
+
*/
|
|
45
|
+
export interface Attribution {
|
|
46
|
+
/** A model id ('claude-opus-5-5'), an agent seat or a person. */
|
|
47
|
+
statedBy: string;
|
|
48
|
+
/** ISO 8601. */
|
|
49
|
+
statedAt: string;
|
|
50
|
+
/** What was read: file paths, commits, URLs, owner/repo#n. At least one. */
|
|
51
|
+
grounding: string[];
|
|
52
|
+
revision: RevisionState;
|
|
53
|
+
/** Required once `revision` is `revised` or `affirmed`. */
|
|
54
|
+
revisedBy?: string;
|
|
55
|
+
/** Required once `revision` is `revised` or `affirmed`. */
|
|
56
|
+
revisedAt?: string;
|
|
57
|
+
}
|
|
58
|
+
/** A platform capability. Annotates a `RelationalNode` of type `'knowledge'`. */
|
|
59
|
+
export interface CapabilityFacet extends Attribution {
|
|
60
|
+
/** → `RelationalNode.id`, `capability:<slug>` */
|
|
61
|
+
nodeId: NodeId;
|
|
62
|
+
/** 'Publish a prototype to an episode' */
|
|
63
|
+
name: string;
|
|
64
|
+
/** At most {@link STATEMENT_WORD_LIMIT} words. Required when `status` is `clear` or `unclear`. */
|
|
65
|
+
statement?: string;
|
|
66
|
+
status: StatementStatus;
|
|
67
|
+
/** Repository or service node ids that offer it. */
|
|
68
|
+
providedBy: NodeId[];
|
|
69
|
+
metis?: MetisHold;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* One provider's claim on a capability. It comes from a capability's own
|
|
73
|
+
* `providedBy`, or from a feature that realizes it (`via` names the feature).
|
|
74
|
+
*/
|
|
75
|
+
export interface CapabilityClaim {
|
|
76
|
+
/** → `CapabilityFacet.nodeId` */
|
|
77
|
+
capability: NodeId;
|
|
78
|
+
/** A repository or service node id. */
|
|
79
|
+
provider: NodeId;
|
|
80
|
+
/** The feature the claim comes from, when it comes from one. */
|
|
81
|
+
via?: NodeId;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A capability that more than one provider offers. Not a conflict: two
|
|
85
|
+
* repositories giving the same capability are kin to name — one may have
|
|
86
|
+
* grown from the other, or both may be the same intent explored twice.
|
|
87
|
+
*/
|
|
88
|
+
export interface SharedCapability {
|
|
89
|
+
/** → `CapabilityFacet.nodeId` */
|
|
90
|
+
capability: NodeId;
|
|
91
|
+
/** Distinct, sorted, at least two. */
|
|
92
|
+
providers: NodeId[];
|
|
93
|
+
}
|
|
94
|
+
/** The word limit for every statement: a capability, a feature, a repository's purpose. */
|
|
95
|
+
export declare const STATEMENT_WORD_LIMIT = 55;
|
|
96
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,wDAAwD;AACxD,MAAM,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;AAE1C;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,SAAS,GAAG,aAAa,GAAG,kBAAkB,CAAC;AAEvF;;;;;;GAMG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something the platform can do for someone — publish a
|
|
6
|
+
* prototype to an episode, register a service, follow a wheel's events. It
|
|
7
|
+
* rides a `knowledge` node carrying `metadata.kind: 'capability'`
|
|
8
|
+
* (`DEVELOPER_ENTITY_BINDING` in `ontology-core`), and this facet holds its
|
|
9
|
+
* specifics keyed by node id, the way `@medicine-wheel/infra` holds a
|
|
10
|
+
* service's.
|
|
11
|
+
*
|
|
12
|
+
* Every statement here was written by someone at some time, and most of them
|
|
13
|
+
* will be written by a model reading repositories. A model's reading is
|
|
14
|
+
* assumed biased until a person has read it, so every row says who wrote it,
|
|
15
|
+
* when, what it read, and whether anyone has revised it since.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.STATEMENT_WORD_LIMIT = void 0;
|
|
19
|
+
/** The word limit for every statement: a capability, a feature, a repository's purpose. */
|
|
20
|
+
exports.STATEMENT_WORD_LIMIT = 55;
|
|
21
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAwFH,2FAA2F;AAC9E,QAAA,oBAAoB,GAAG,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medicine-wheel/capabilities",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.21.0",
|
|
4
|
+
"description": "The platform-features and capabilities layer of the Medicine Wheel Developer Suite — what the platform can do, which repositories and services provide it, who said so and from what, with the 55-word statement limit and shared-capability detection",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"sideEffects": false,
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc",
|
|
22
|
+
"dev": "tsc --watch",
|
|
23
|
+
"lint": "tsc --noEmit",
|
|
24
|
+
"clean": "rm -rf dist",
|
|
25
|
+
"prepublishOnly": "npm run clean && npm run build"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"medicine-wheel",
|
|
29
|
+
"capabilities",
|
|
30
|
+
"platform-features",
|
|
31
|
+
"developer-suite",
|
|
32
|
+
"relational-ontology",
|
|
33
|
+
"inventory"
|
|
34
|
+
],
|
|
35
|
+
"author": "IAIP Collaborative - Shawinigan, QC",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/jgwill/medicine-wheel.git",
|
|
40
|
+
"directory": "src/capabilities"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@medicine-wheel/infra": "^0.21.0",
|
|
44
|
+
"@medicine-wheel/ontology-core": "^0.21.0",
|
|
45
|
+
"zod": "^3.23.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^20.10.0",
|
|
49
|
+
"typescript": "^5.3.0"
|
|
50
|
+
}
|
|
51
|
+
}
|