Skip to content

Commit 36b2120

Browse files
committed
[Types] Upgrade types and include new required model card fields
1 parent 2826d68 commit 36b2120

File tree

4 files changed

+89
-32
lines changed

4 files changed

+89
-32
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Restart the COOP server so it loads the plugin.
6868
This package implements the COOP plugin contract from `@roostorg/types`:
6969

7070
- **Default export:** `CoopIntegrationPlugin` with `manifest` and `createSignals(context)`.
71-
- **Manifest:** `id`, `name`, `version`, `requiresConfig`, `configurationFields`, `signalTypeIds`, `modelCard` (with required sections `modelDetails` and `technicalIntegration`).
71+
- **Manifest:** `id`, `name`, `version`, `requiresConfig`, `configurationFields`, `signalTypeIds`, `modelCard` (must include every section id in `REQUIRED_MODEL_CARD_SECTION_IDS` from `@roostorg/types`; call `assertModelCardHasRequiredSections(modelCard)` when registering).
7272
- **createSignals:** Returns two descriptors:
7373
- `RANDOM_SIGNAL_SELECTION`: `run(input)` uses `context.getCredential(orgId)` for true percentage; returns `{ outputType: { scalarType: 'BOOLEAN' }, score: boolean }`.
7474
- `RANDOM_SCORE`: `run()` returns `{ outputType: { scalarType: 'NUMBER' }, score: number }` in [0, 1]; no config. Threshold is set in the rule (above/below).

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@roostorg/coop-integration-example",
3-
"version": "1.0.0",
3+
"version": "2.0.0",
44
"description": "Example package to show how a custom integration and signal can be used in COOP this is meant to be a reference repository and provide basic determination",
55
"type": "module",
66
"main": "dist/index.js",
@@ -33,10 +33,10 @@
3333
},
3434
"homepage": "https://github.com/roostorg/coop-integration-example#readme",
3535
"peerDependencies": {
36-
"@roostorg/types": ">=1.0.0"
36+
"@roostorg/types": ">=2.0.0"
3737
},
3838
"devDependencies": {
39-
"@roostorg/types": "^1.1.1",
39+
"@roostorg/types": "^2.0.0",
4040
"typescript": "^5.0.0"
4141
},
4242
"engines": {

src/index.ts

Lines changed: 77 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
* 2. Random Score – numeric [0, 1], threshold set in the rule (tests score vs threshold).
55
*/
66

7-
import type {
8-
CoopIntegrationPlugin,
9-
IntegrationManifest,
10-
ModelCard,
11-
PluginSignalContext,
12-
PluginSignalDescriptor,
7+
import {
8+
assertModelCardHasRequiredSections,
9+
type CoopIntegrationPlugin,
10+
type IntegrationManifest,
11+
type ModelCard,
12+
type PluginSignalContext,
13+
type PluginSignalDescriptor,
1314
} from '@roostorg/types';
1415

1516
const SIGNAL_TYPE_RANDOM_SELECTION = 'RANDOM_SIGNAL_SELECTION';
@@ -20,48 +21,104 @@ const DEFAULT_TRUE_PERCENTAGE = 50;
2021
const modelCard: ModelCard = {
2122
modelName: 'COOP Integration Example',
2223
version: '1.0.0',
23-
releaseDate: '2026',
24+
releaseDate: 'March 2026',
2425
sections: [
2526
{
26-
id: 'modelDetails',
27-
title: 'Model Details',
27+
id: 'trainingData',
28+
title: 'Training Data',
2829
fields: [
29-
{ label: 'Model Name', value: 'COOP Integration Example' },
3030
{
31-
label: 'Purpose',
31+
label: 'Overview',
3232
value:
33-
'Example plugin with two signals: one uses org config (boolean), one returns a numeric score so you can set a threshold in the rule (over/under).',
33+
'This reference integration does not use a trained model. Outputs are randomly generated for demonstration and testing of COOP rules, configuration, and UI only.',
3434
},
35+
],
36+
},
37+
{
38+
id: 'policyAndTaxonomy',
39+
title: 'Policy and Taxonomy',
40+
fields: [
41+
{
42+
label: 'Scope',
43+
value:
44+
'Not a content policy engine. Signals are placeholders: boolean “coin flip” with configurable probability and a numeric random score for threshold exercises in rules.',
45+
},
46+
],
47+
},
48+
{
49+
id: 'annotationMethodology',
50+
title: 'Annotation Methodology',
51+
fields: [
52+
{
53+
label: 'Method',
54+
value:
55+
'No human or automated labeling pipeline. Values are produced with Math.random() (or equivalent logic) at evaluation time.',
56+
},
57+
],
58+
},
59+
{
60+
id: 'performanceBenchmarks',
61+
title: 'Performance and Benchmarks',
62+
fields: [
63+
{
64+
label: 'Benchmarks',
65+
value:
66+
'No precision, recall, or latency benchmarks apply. Do not use performance claims from this package in production decisions.',
67+
},
68+
],
69+
},
70+
{
71+
id: 'biasAndLimitations',
72+
title: 'Bias and Limitations',
73+
fields: [
74+
{
75+
label: 'Limitations',
76+
value:
77+
'Outputs are uncorrelated with input content. Unsuitable for safety, compliance, or moderation decisions. For integration testing and developer learning only.',
78+
},
79+
],
80+
},
81+
{
82+
id: 'implementationGuidance',
83+
title: 'Implementation Guidance',
84+
fields: [
3585
{
3686
label: 'Signals',
37-
value: `${SIGNAL_TYPE_RANDOM_SELECTION} (boolean, config-driven) and ${SIGNAL_TYPE_RANDOM_SCORE} (number 0–1, threshold in rule).`,
87+
value: `${SIGNAL_TYPE_RANDOM_SELECTION} (boolean; org config truePercentage 0–100). ${SIGNAL_TYPE_RANDOM_SCORE} (number; set threshold and above/below in the rule).`,
88+
},
89+
{
90+
label: 'Configuration',
91+
value:
92+
'Random Signal Selection requires org integration config (true percentage). Random Score requires no integration config.',
3893
},
3994
],
4095
},
4196
{
42-
id: 'technicalIntegration',
43-
title: 'Technical Integration',
97+
id: 'relevantLinks',
98+
title: 'Relevant Links',
4499
fields: [
45100
{
46-
label: 'Signal types',
47-
value: `${SIGNAL_TYPE_RANDOM_SELECTION}, ${SIGNAL_TYPE_RANDOM_SCORE}`,
101+
label: 'Repository',
102+
value: 'https://github.com/roostorg/coop-integration-example',
48103
},
49104
{
50-
label: 'Config',
51-
value: 'truePercentage (0–100) for Random Signal Selection only; Random Score needs no config.',
105+
label: 'Documentation',
106+
value: 'https://roostorg.github.io/coop/INTEGRATIONS_PLUGIN.html',
52107
},
53108
],
54109
},
55110
],
56111
};
57112

113+
assertModelCardHasRequiredSections(modelCard);
114+
58115
const manifest: IntegrationManifest = {
59116
id: INTEGRATION_ID,
60117
name: 'COOP Integration Example',
61118
version: '1.0.0',
62119
description:
63120
'Example plugin with two signals: config-driven boolean and a numeric score you compare with a threshold in the rule.',
64-
docsUrl: 'https://github.com/roostorg/coop/tree/main/coop-integration-example',
121+
docsUrl: 'https://roostorg.github.io/coop/INTEGRATIONS_PLUGIN.html',
65122
requiresConfig: true,
66123
configurationFields: [
67124
{

0 commit comments

Comments
 (0)