@owlmeans/viable-common 0.0.4
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 +68 -0
- package/agent-meta/manifest.json +16 -0
- package/agent-meta/skills/viable-common/SKILL.md +179 -0
- package/build/agent/index.d.ts +4 -0
- package/build/agent/index.d.ts.map +1 -0
- package/build/agent/index.js +3 -0
- package/build/agent/index.js.map +1 -0
- package/build/agent/memory.d.ts +12 -0
- package/build/agent/memory.d.ts.map +1 -0
- package/build/agent/memory.js +11 -0
- package/build/agent/memory.js.map +1 -0
- package/build/agent/spectator/consts.d.ts +9 -0
- package/build/agent/spectator/consts.d.ts.map +1 -0
- package/build/agent/spectator/consts.js +10 -0
- package/build/agent/spectator/consts.js.map +1 -0
- package/build/agent/spectator/index.d.ts +3 -0
- package/build/agent/spectator/index.d.ts.map +1 -0
- package/build/agent/spectator/index.js +2 -0
- package/build/agent/spectator/index.js.map +1 -0
- package/build/agent/spectator/types.d.ts +13 -0
- package/build/agent/spectator/types.d.ts.map +1 -0
- package/build/agent/spectator/types.js +2 -0
- package/build/agent/spectator/types.js.map +1 -0
- package/build/agent/types.d.ts +10 -0
- package/build/agent/types.d.ts.map +1 -0
- package/build/agent/types.js +2 -0
- package/build/agent/types.js.map +1 -0
- package/build/areas/consts.d.ts +88 -0
- package/build/areas/consts.d.ts.map +1 -0
- package/build/areas/consts.js +106 -0
- package/build/areas/consts.js.map +1 -0
- package/build/areas/index.d.ts +3 -0
- package/build/areas/index.d.ts.map +1 -0
- package/build/areas/index.js +2 -0
- package/build/areas/index.js.map +1 -0
- package/build/areas/types.d.ts +28 -0
- package/build/areas/types.d.ts.map +1 -0
- package/build/areas/types.js +2 -0
- package/build/areas/types.js.map +1 -0
- package/build/ba/consts.d.ts +38 -0
- package/build/ba/consts.d.ts.map +1 -0
- package/build/ba/consts.js +41 -0
- package/build/ba/consts.js.map +1 -0
- package/build/ba/helpers.d.ts +41 -0
- package/build/ba/helpers.d.ts.map +1 -0
- package/build/ba/helpers.js +79 -0
- package/build/ba/helpers.js.map +1 -0
- package/build/ba/index.d.ts +5 -0
- package/build/ba/index.d.ts.map +1 -0
- package/build/ba/index.js +4 -0
- package/build/ba/index.js.map +1 -0
- package/build/ba/schemas.d.ts +13 -0
- package/build/ba/schemas.d.ts.map +1 -0
- package/build/ba/schemas.js +181 -0
- package/build/ba/schemas.js.map +1 -0
- package/build/ba/types.d.ts +113 -0
- package/build/ba/types.d.ts.map +1 -0
- package/build/ba/types.js +2 -0
- package/build/ba/types.js.map +1 -0
- package/build/blueprint/case.d.ts +73 -0
- package/build/blueprint/case.d.ts.map +1 -0
- package/build/blueprint/case.js +244 -0
- package/build/blueprint/case.js.map +1 -0
- package/build/blueprint/consts.d.ts +11 -0
- package/build/blueprint/consts.d.ts.map +1 -0
- package/build/blueprint/consts.js +11 -0
- package/build/blueprint/consts.js.map +1 -0
- package/build/blueprint/index.d.ts +6 -0
- package/build/blueprint/index.d.ts.map +1 -0
- package/build/blueprint/index.js +6 -0
- package/build/blueprint/index.js.map +1 -0
- package/build/blueprint/resolve.d.ts +51 -0
- package/build/blueprint/resolve.d.ts.map +1 -0
- package/build/blueprint/resolve.js +108 -0
- package/build/blueprint/resolve.js.map +1 -0
- package/build/blueprint/schemas.d.ts +41 -0
- package/build/blueprint/schemas.d.ts.map +1 -0
- package/build/blueprint/schemas.js +27 -0
- package/build/blueprint/schemas.js.map +1 -0
- package/build/blueprint/types.d.ts +186 -0
- package/build/blueprint/types.d.ts.map +1 -0
- package/build/blueprint/types.js +32 -0
- package/build/blueprint/types.js.map +1 -0
- package/build/branding.d.ts +19 -0
- package/build/branding.d.ts.map +1 -0
- package/build/branding.js +32 -0
- package/build/branding.js.map +1 -0
- package/build/connect/consts.d.ts +378 -0
- package/build/connect/consts.d.ts.map +1 -0
- package/build/connect/consts.js +425 -0
- package/build/connect/consts.js.map +1 -0
- package/build/connect/entrypoints.d.ts +41 -0
- package/build/connect/entrypoints.d.ts.map +1 -0
- package/build/connect/entrypoints.js +141 -0
- package/build/connect/entrypoints.js.map +1 -0
- package/build/connect/errors.d.ts +50 -0
- package/build/connect/errors.d.ts.map +1 -0
- package/build/connect/errors.js +77 -0
- package/build/connect/errors.js.map +1 -0
- package/build/connect/index.d.ts +8 -0
- package/build/connect/index.d.ts.map +1 -0
- package/build/connect/index.js +6 -0
- package/build/connect/index.js.map +1 -0
- package/build/connect/ops.d.ts +192 -0
- package/build/connect/ops.d.ts.map +1 -0
- package/build/connect/ops.js +2 -0
- package/build/connect/ops.js.map +1 -0
- package/build/connect/references.d.ts +194 -0
- package/build/connect/references.d.ts.map +1 -0
- package/build/connect/references.js +62 -0
- package/build/connect/references.js.map +1 -0
- package/build/connect/schemas.d.ts +59 -0
- package/build/connect/schemas.d.ts.map +1 -0
- package/build/connect/schemas.js +346 -0
- package/build/connect/schemas.js.map +1 -0
- package/build/connect/types.d.ts +428 -0
- package/build/connect/types.d.ts.map +1 -0
- package/build/connect/types.js +2 -0
- package/build/connect/types.js.map +1 -0
- package/build/consts.d.ts +9 -0
- package/build/consts.d.ts.map +1 -0
- package/build/consts.js +31 -0
- package/build/consts.js.map +1 -0
- package/build/convert/consts.d.ts +539 -0
- package/build/convert/consts.d.ts.map +1 -0
- package/build/convert/consts.js +630 -0
- package/build/convert/consts.js.map +1 -0
- package/build/convert/helpers.d.ts +91 -0
- package/build/convert/helpers.d.ts.map +1 -0
- package/build/convert/helpers.js +301 -0
- package/build/convert/helpers.js.map +1 -0
- package/build/convert/index.d.ts +11 -0
- package/build/convert/index.d.ts.map +1 -0
- package/build/convert/index.js +4 -0
- package/build/convert/index.js.map +1 -0
- package/build/convert/schemas.d.ts +62 -0
- package/build/convert/schemas.d.ts.map +1 -0
- package/build/convert/schemas.js +626 -0
- package/build/convert/schemas.js.map +1 -0
- package/build/convert/types.d.ts +683 -0
- package/build/convert/types.d.ts.map +1 -0
- package/build/convert/types.js +2 -0
- package/build/convert/types.js.map +1 -0
- package/build/design/consts.d.ts +25 -0
- package/build/design/consts.d.ts.map +1 -0
- package/build/design/consts.js +26 -0
- package/build/design/consts.js.map +1 -0
- package/build/design/helpers.d.ts +60 -0
- package/build/design/helpers.d.ts.map +1 -0
- package/build/design/helpers.js +221 -0
- package/build/design/helpers.js.map +1 -0
- package/build/design/index.d.ts +6 -0
- package/build/design/index.d.ts.map +1 -0
- package/build/design/index.js +5 -0
- package/build/design/index.js.map +1 -0
- package/build/design/runtime.d.ts +126 -0
- package/build/design/runtime.d.ts.map +1 -0
- package/build/design/runtime.js +65 -0
- package/build/design/runtime.js.map +1 -0
- package/build/design/schemas.d.ts +21 -0
- package/build/design/schemas.d.ts.map +1 -0
- package/build/design/schemas.js +369 -0
- package/build/design/schemas.js.map +1 -0
- package/build/design/types.d.ts +199 -0
- package/build/design/types.d.ts.map +1 -0
- package/build/design/types.js +2 -0
- package/build/design/types.js.map +1 -0
- package/build/dev/consts.d.ts +32 -0
- package/build/dev/consts.d.ts.map +1 -0
- package/build/dev/consts.js +33 -0
- package/build/dev/consts.js.map +1 -0
- package/build/dev/index.d.ts +4 -0
- package/build/dev/index.d.ts.map +1 -0
- package/build/dev/index.js +3 -0
- package/build/dev/index.js.map +1 -0
- package/build/dev/schemas.d.ts +15 -0
- package/build/dev/schemas.d.ts.map +1 -0
- package/build/dev/schemas.js +116 -0
- package/build/dev/schemas.js.map +1 -0
- package/build/dev/types.d.ts +42 -0
- package/build/dev/types.d.ts.map +1 -0
- package/build/dev/types.js +2 -0
- package/build/dev/types.js.map +1 -0
- package/build/execution/consts.d.ts +36 -0
- package/build/execution/consts.d.ts.map +1 -0
- package/build/execution/consts.js +37 -0
- package/build/execution/consts.js.map +1 -0
- package/build/execution/index.d.ts +3 -0
- package/build/execution/index.d.ts.map +1 -0
- package/build/execution/index.js +2 -0
- package/build/execution/index.js.map +1 -0
- package/build/execution/types.d.ts +50 -0
- package/build/execution/types.d.ts.map +1 -0
- package/build/execution/types.js +2 -0
- package/build/execution/types.js.map +1 -0
- package/build/index.d.ts +22 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +21 -0
- package/build/index.js.map +1 -0
- package/build/integrity/consts.d.ts +226 -0
- package/build/integrity/consts.d.ts.map +1 -0
- package/build/integrity/consts.js +401 -0
- package/build/integrity/consts.js.map +1 -0
- package/build/integrity/index.d.ts +4 -0
- package/build/integrity/index.d.ts.map +1 -0
- package/build/integrity/index.js +3 -0
- package/build/integrity/index.js.map +1 -0
- package/build/integrity/types.d.ts +35 -0
- package/build/integrity/types.d.ts.map +1 -0
- package/build/integrity/types.js +2 -0
- package/build/integrity/types.js.map +1 -0
- package/build/integrity/verify.d.ts +23 -0
- package/build/integrity/verify.d.ts.map +1 -0
- package/build/integrity/verify.js +198 -0
- package/build/integrity/verify.js.map +1 -0
- package/build/metadata/consts.d.ts +101 -0
- package/build/metadata/consts.d.ts.map +1 -0
- package/build/metadata/consts.js +104 -0
- package/build/metadata/consts.js.map +1 -0
- package/build/metadata/index.d.ts +3 -0
- package/build/metadata/index.d.ts.map +1 -0
- package/build/metadata/index.js +3 -0
- package/build/metadata/index.js.map +1 -0
- package/build/metadata/types.d.ts +286 -0
- package/build/metadata/types.d.ts.map +1 -0
- package/build/metadata/types.js +39 -0
- package/build/metadata/types.js.map +1 -0
- package/build/moderation/consts.d.ts +58 -0
- package/build/moderation/consts.d.ts.map +1 -0
- package/build/moderation/consts.js +60 -0
- package/build/moderation/consts.js.map +1 -0
- package/build/moderation/index.d.ts +5 -0
- package/build/moderation/index.d.ts.map +1 -0
- package/build/moderation/index.js +4 -0
- package/build/moderation/index.js.map +1 -0
- package/build/moderation/schemas.d.ts +19 -0
- package/build/moderation/schemas.d.ts.map +1 -0
- package/build/moderation/schemas.js +26 -0
- package/build/moderation/schemas.js.map +1 -0
- package/build/moderation/types.d.ts +64 -0
- package/build/moderation/types.d.ts.map +1 -0
- package/build/moderation/types.js +2 -0
- package/build/moderation/types.js.map +1 -0
- package/build/moderation/utils.d.ts +21 -0
- package/build/moderation/utils.d.ts.map +1 -0
- package/build/moderation/utils.js +31 -0
- package/build/moderation/utils.js.map +1 -0
- package/build/preview/consts.d.ts +10 -0
- package/build/preview/consts.d.ts.map +1 -0
- package/build/preview/consts.js +11 -0
- package/build/preview/consts.js.map +1 -0
- package/build/preview/index.d.ts +3 -0
- package/build/preview/index.d.ts.map +1 -0
- package/build/preview/index.js +2 -0
- package/build/preview/index.js.map +1 -0
- package/build/preview/types.d.ts +60 -0
- package/build/preview/types.d.ts.map +1 -0
- package/build/preview/types.js +2 -0
- package/build/preview/types.js.map +1 -0
- package/build/scaffold/consts.d.ts +25 -0
- package/build/scaffold/consts.d.ts.map +1 -0
- package/build/scaffold/consts.js +26 -0
- package/build/scaffold/consts.js.map +1 -0
- package/build/scaffold/helpers.d.ts +35 -0
- package/build/scaffold/helpers.d.ts.map +1 -0
- package/build/scaffold/helpers.js +54 -0
- package/build/scaffold/helpers.js.map +1 -0
- package/build/scaffold/index.d.ts +5 -0
- package/build/scaffold/index.d.ts.map +1 -0
- package/build/scaffold/index.js +4 -0
- package/build/scaffold/index.js.map +1 -0
- package/build/scaffold/schemas.d.ts +5 -0
- package/build/scaffold/schemas.d.ts.map +1 -0
- package/build/scaffold/schemas.js +273 -0
- package/build/scaffold/schemas.js.map +1 -0
- package/build/scaffold/types.d.ts +144 -0
- package/build/scaffold/types.d.ts.map +1 -0
- package/build/scaffold/types.js +2 -0
- package/build/scaffold/types.js.map +1 -0
- package/build/skills/catalogue.d.ts +47 -0
- package/build/skills/catalogue.d.ts.map +1 -0
- package/build/skills/catalogue.js +1566 -0
- package/build/skills/catalogue.js.map +1 -0
- package/build/skills/consts.d.ts +104 -0
- package/build/skills/consts.d.ts.map +1 -0
- package/build/skills/consts.js +170 -0
- package/build/skills/consts.js.map +1 -0
- package/build/skills/index.d.ts +4 -0
- package/build/skills/index.d.ts.map +1 -0
- package/build/skills/index.js +4 -0
- package/build/skills/index.js.map +1 -0
- package/build/skills/roles.d.ts +52 -0
- package/build/skills/roles.d.ts.map +1 -0
- package/build/skills/roles.js +256 -0
- package/build/skills/roles.js.map +1 -0
- package/build/slot/consts.d.ts +305 -0
- package/build/slot/consts.d.ts.map +1 -0
- package/build/slot/consts.js +376 -0
- package/build/slot/consts.js.map +1 -0
- package/build/slot/helpers.d.ts +25 -0
- package/build/slot/helpers.d.ts.map +1 -0
- package/build/slot/helpers.js +27 -0
- package/build/slot/helpers.js.map +1 -0
- package/build/slot/index.d.ts +6 -0
- package/build/slot/index.d.ts.map +1 -0
- package/build/slot/index.js +5 -0
- package/build/slot/index.js.map +1 -0
- package/build/slot/layout.d.ts +72 -0
- package/build/slot/layout.d.ts.map +1 -0
- package/build/slot/layout.js +82 -0
- package/build/slot/layout.js.map +1 -0
- package/build/slot/schemas.d.ts +12 -0
- package/build/slot/schemas.d.ts.map +1 -0
- package/build/slot/schemas.js +43 -0
- package/build/slot/schemas.js.map +1 -0
- package/build/slot/types.d.ts +147 -0
- package/build/slot/types.d.ts.map +1 -0
- package/build/slot/types.js +2 -0
- package/build/slot/types.js.map +1 -0
- package/build/topology/card.d.ts +23 -0
- package/build/topology/card.d.ts.map +1 -0
- package/build/topology/card.js +95 -0
- package/build/topology/card.js.map +1 -0
- package/build/topology/consts.d.ts +32 -0
- package/build/topology/consts.d.ts.map +1 -0
- package/build/topology/consts.js +55 -0
- package/build/topology/consts.js.map +1 -0
- package/build/topology/helpers.d.ts +44 -0
- package/build/topology/helpers.d.ts.map +1 -0
- package/build/topology/helpers.js +112 -0
- package/build/topology/helpers.js.map +1 -0
- package/build/topology/index.d.ts +5 -0
- package/build/topology/index.d.ts.map +1 -0
- package/build/topology/index.js +4 -0
- package/build/topology/index.js.map +1 -0
- package/build/topology/types.d.ts +83 -0
- package/build/topology/types.d.ts.map +1 -0
- package/build/topology/types.js +2 -0
- package/build/topology/types.js.map +1 -0
- package/build/types.d.ts +88 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +2 -0
- package/build/types.js.map +1 -0
- package/build/ux/consts.d.ts +5 -0
- package/build/ux/consts.d.ts.map +1 -0
- package/build/ux/consts.js +6 -0
- package/build/ux/consts.js.map +1 -0
- package/build/ux/index.d.ts +4 -0
- package/build/ux/index.d.ts.map +1 -0
- package/build/ux/index.js +3 -0
- package/build/ux/index.js.map +1 -0
- package/build/ux/schemas.d.ts +8 -0
- package/build/ux/schemas.d.ts.map +1 -0
- package/build/ux/schemas.js +91 -0
- package/build/ux/schemas.js.map +1 -0
- package/build/ux/types.d.ts +21 -0
- package/build/ux/types.d.ts.map +1 -0
- package/build/ux/types.js +2 -0
- package/build/ux/types.js.map +1 -0
- package/package.json +71 -0
- package/src/agent/index.ts +4 -0
- package/src/agent/memory.ts +16 -0
- package/src/agent/spectator/consts.ts +10 -0
- package/src/agent/spectator/index.ts +3 -0
- package/src/agent/spectator/types.ts +14 -0
- package/src/agent/types.ts +10 -0
- package/src/areas/consts.ts +112 -0
- package/src/areas/index.ts +3 -0
- package/src/areas/types.ts +29 -0
- package/src/ba/consts.ts +40 -0
- package/src/ba/helpers.ts +93 -0
- package/src/ba/index.ts +5 -0
- package/src/ba/schemas.ts +196 -0
- package/src/ba/types.ts +125 -0
- package/src/blueprint/case.ts +272 -0
- package/src/blueprint/consts.ts +11 -0
- package/src/blueprint/index.ts +6 -0
- package/src/blueprint/resolve.ts +133 -0
- package/src/blueprint/schemas.ts +44 -0
- package/src/blueprint/types.ts +204 -0
- package/src/branding.ts +34 -0
- package/src/connect/consts.ts +441 -0
- package/src/connect/entrypoints.ts +291 -0
- package/src/connect/errors.ts +91 -0
- package/src/connect/index.ts +7 -0
- package/src/connect/ops.ts +208 -0
- package/src/connect/references.ts +89 -0
- package/src/connect/schemas.ts +384 -0
- package/src/connect/types.ts +456 -0
- package/src/consts.ts +34 -0
- package/src/convert/consts.ts +672 -0
- package/src/convert/helpers.ts +340 -0
- package/src/convert/index.ts +10 -0
- package/src/convert/schemas.ts +663 -0
- package/src/convert/types.ts +741 -0
- package/src/design/consts.ts +26 -0
- package/src/design/helpers.ts +255 -0
- package/src/design/index.ts +5 -0
- package/src/design/runtime.ts +142 -0
- package/src/design/schemas.ts +384 -0
- package/src/design/types.ts +191 -0
- package/src/dev/consts.ts +35 -0
- package/src/dev/index.ts +4 -0
- package/src/dev/schemas.ts +124 -0
- package/src/dev/types.ts +47 -0
- package/src/execution/consts.ts +37 -0
- package/src/execution/index.ts +3 -0
- package/src/execution/types.ts +55 -0
- package/src/index.ts +22 -0
- package/src/integrity/consts.ts +477 -0
- package/src/integrity/index.ts +3 -0
- package/src/integrity/types.ts +37 -0
- package/src/integrity/verify.ts +221 -0
- package/src/metadata/consts.ts +118 -0
- package/src/metadata/index.ts +3 -0
- package/src/metadata/types.ts +310 -0
- package/src/moderation/consts.ts +59 -0
- package/src/moderation/index.ts +4 -0
- package/src/moderation/schemas.ts +28 -0
- package/src/moderation/types.ts +68 -0
- package/src/moderation/utils.ts +35 -0
- package/src/preview/consts.ts +9 -0
- package/src/preview/index.ts +3 -0
- package/src/preview/types.ts +79 -0
- package/src/scaffold/consts.ts +26 -0
- package/src/scaffold/helpers.ts +84 -0
- package/src/scaffold/index.ts +4 -0
- package/src/scaffold/schemas.ts +283 -0
- package/src/scaffold/types.ts +118 -0
- package/src/skills/catalogue.ts +1617 -0
- package/src/skills/consts.ts +183 -0
- package/src/skills/index.ts +4 -0
- package/src/skills/roles.ts +299 -0
- package/src/slot/consts.ts +393 -0
- package/src/slot/helpers.ts +34 -0
- package/src/slot/index.ts +5 -0
- package/src/slot/layout.ts +141 -0
- package/src/slot/schemas.ts +46 -0
- package/src/slot/types.ts +164 -0
- package/src/topology/card.ts +106 -0
- package/src/topology/consts.ts +59 -0
- package/src/topology/helpers.ts +138 -0
- package/src/topology/index.ts +5 -0
- package/src/topology/types.ts +86 -0
- package/src/types.ts +104 -0
- package/src/ux/consts.ts +5 -0
- package/src/ux/index.ts +4 -0
- package/src/ux/schemas.ts +97 -0
- package/src/ux/types.ts +25 -0
- package/tests/connect-convert.spec.ts +161 -0
- package/tests/convert.spec.ts +318 -0
- package/tests/design.spec.ts +136 -0
- package/tsconfig.json +16 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* What the moderation gate refuses, and nothing more.
|
|
4
|
+
*
|
|
5
|
+
* The set is deliberately about the SHAPE of what is being built, never its sector: a product
|
|
6
|
+
* that handles money, credentials or medical data is ordinary, and a platform that refuses
|
|
7
|
+
* those refuses most of its own market. What is not ordinary is a product whose purpose is to
|
|
8
|
+
* collect someone else's credentials, to be mistaken for someone who did not ask to be
|
|
9
|
+
* represented, or to push messages at people who never asked for them.
|
|
10
|
+
*
|
|
11
|
+
* Every generated app has a sign-in screen of its own — that is what an application is — so a
|
|
12
|
+
* login is never evidence of anything here.
|
|
13
|
+
*
|
|
14
|
+
* The set is CLOSED. A new refusal shape belongs inside one of these four, phrased into the
|
|
15
|
+
* policy prompt: each value is a wire contract with user-facing wording in seven languages
|
|
16
|
+
* behind it, and a fifth one silently renders as the generic refusal until every one of those
|
|
17
|
+
* catches up.
|
|
18
|
+
*/
|
|
19
|
+
export enum ModerationCategory {
|
|
20
|
+
/** Captures credentials, OTPs, card numbers or recovery phrases for a service the requester does not run. */
|
|
21
|
+
CredentialHarvesting = 'credential-harvesting',
|
|
22
|
+
/** Presents itself as a named third party — an organization OR a real person — rather than as its own product. */
|
|
23
|
+
BrandImpersonation = 'brand-impersonation',
|
|
24
|
+
/** Collects payment details on behalf of a merchant that is not the requester. */
|
|
25
|
+
PaymentCapture = 'payment-capture',
|
|
26
|
+
/** Tooling whose purpose is abuse: credential stuffers, phishing-kit builders, bulk-spam senders. */
|
|
27
|
+
AbuseTooling = 'abuse-tooling',
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* What is being classified. Carried into the trace so a refusal can be attributed.
|
|
32
|
+
*
|
|
33
|
+
* Each value has a framing sentence behind it that tells the classifier whose words it is
|
|
34
|
+
* reading — the same text means different things as a customer's request, as our own generated
|
|
35
|
+
* specification, and as a file already sitting inside an approved project.
|
|
36
|
+
*/
|
|
37
|
+
export enum ModerationSubject {
|
|
38
|
+
Prompt = 'prompt',
|
|
39
|
+
Specification = 'specification',
|
|
40
|
+
Story = 'story',
|
|
41
|
+
/**
|
|
42
|
+
* A file a human wrote through the project's own editor.
|
|
43
|
+
*
|
|
44
|
+
* Deliberately separate from the three above: this is code inside an already-approved
|
|
45
|
+
* product, so the framing has to stop the classifier from refusing ordinary application
|
|
46
|
+
* source that happens to contain the word "password" or a payment form.
|
|
47
|
+
*/
|
|
48
|
+
Source = 'source',
|
|
49
|
+
/**
|
|
50
|
+
* What a project is CALLED — and, through its slug, what it is reachable at.
|
|
51
|
+
*
|
|
52
|
+
* The only subject that judges an identifier rather than a product, and the only one whose
|
|
53
|
+
* answer may disagree with {@link ModerationSubject.Specification} about the same brand. A
|
|
54
|
+
* consumer turns a project's name into a hostname on a domain all of its customers share, so
|
|
55
|
+
* "a dashboard for our Shopify store" is an ordinary thing to build while `shopify-dashboard`
|
|
56
|
+
* is not a name it may be reachable at. Descriptions may name a brand; identifiers may not.
|
|
57
|
+
*/
|
|
58
|
+
Name = 'name',
|
|
59
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { JSONSchemaType } from 'ajv'
|
|
2
|
+
import type { ModerationVerdict } from './types.js'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* What the classifier must answer with.
|
|
6
|
+
*
|
|
7
|
+
* Kept minimal on purpose: a schema the model must satisfy is also a schema it will try to
|
|
8
|
+
* fill, and every extra field is another thing it can hallucinate a reason into. The decision
|
|
9
|
+
* is one boolean; the category exists so the browser can phrase the refusal; the evidence
|
|
10
|
+
* exists so a human reviewing the trace can see what the model actually reacted to.
|
|
11
|
+
*
|
|
12
|
+
* `category` is a free string here even though only `ModerationCategory` values mean anything,
|
|
13
|
+
* and that is deliberate. Constrained to the enum it made **every** call fail: with nothing to
|
|
14
|
+
* categorise, a model that allows still fills the field — `"none"`, `""`, `"n/a"` — the
|
|
15
|
+
* response fails validation, the retry budget runs out, and the gate fails open on every
|
|
16
|
+
* request while looking like it is working. The value is narrowed in code instead
|
|
17
|
+
* (`normalizeCategory`), where an unrecognized one is simply absent.
|
|
18
|
+
*/
|
|
19
|
+
export const ModerationVerdictSchema: JSONSchemaType<ModerationVerdict> = {
|
|
20
|
+
type: 'object',
|
|
21
|
+
properties: {
|
|
22
|
+
allowed: { type: 'boolean' },
|
|
23
|
+
category: { type: 'string', maxLength: 64, nullable: true },
|
|
24
|
+
evidence: { type: 'string', maxLength: 500, nullable: true },
|
|
25
|
+
},
|
|
26
|
+
required: ['allowed'],
|
|
27
|
+
additionalProperties: false,
|
|
28
|
+
} as unknown as JSONSchemaType<ModerationVerdict>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { ModerationCategory, ModerationSubject } from './consts.js'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* What the moderation classifier returns.
|
|
5
|
+
*
|
|
6
|
+
* `evidence` is diagnostic only — it reaches the trace and the logs, never the user. What the
|
|
7
|
+
* user is told derives from `category` in the browser, so a refusal reads the same in all
|
|
8
|
+
* seven languages and the model never gets to write UI copy.
|
|
9
|
+
*/
|
|
10
|
+
export interface ModerationVerdict {
|
|
11
|
+
allowed: boolean
|
|
12
|
+
/**
|
|
13
|
+
* Free string on the wire, narrowed to {@link ModerationCategory} by `normalizeCategory`.
|
|
14
|
+
* A model that is allowing has nothing to categorise and will still put something here.
|
|
15
|
+
*/
|
|
16
|
+
category?: string
|
|
17
|
+
evidence?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The three outcomes, separated from the IO so the policy can be read and tested on its own.
|
|
22
|
+
*
|
|
23
|
+
* `shadow` means the verdict was negative and is being recorded but not acted on.
|
|
24
|
+
*/
|
|
25
|
+
export type ModerationAction = 'allow' | 'refuse' | 'shadow'
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The two operational levers on the gate.
|
|
29
|
+
*
|
|
30
|
+
* Both exist because a blocking classifier will eventually be wrong about a real customer, and
|
|
31
|
+
* at that moment the fix has to be faster than a deploy. `enforce: false` keeps the verdicts
|
|
32
|
+
* flowing into the traces while refusing nothing, which is also how a change to the policy
|
|
33
|
+
* prompt should be evaluated before it is trusted.
|
|
34
|
+
*/
|
|
35
|
+
export interface ModerationPolicy {
|
|
36
|
+
/** Defaults to ON. Set false to compute and trace verdicts without acting on them. */
|
|
37
|
+
enforce?: boolean
|
|
38
|
+
/** Entity ids released from the gate entirely. */
|
|
39
|
+
bypassEntities?: string[]
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** What a caller needs in order to refuse: never the model's own words. */
|
|
43
|
+
export interface ModerationOutcome {
|
|
44
|
+
action: ModerationAction
|
|
45
|
+
/**
|
|
46
|
+
* Always present when `action` is not `allow`.
|
|
47
|
+
*
|
|
48
|
+
* A refusal has to tell the user something specific, so an unrecognized category from the
|
|
49
|
+
* model is replaced rather than dropped — see `normalizeCategory`.
|
|
50
|
+
*/
|
|
51
|
+
category?: ModerationCategory
|
|
52
|
+
/** Diagnostic only. Logged and traced, never rendered. */
|
|
53
|
+
evidence?: string
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** One classification request. */
|
|
57
|
+
export interface ModerationInput {
|
|
58
|
+
subject: ModerationSubject
|
|
59
|
+
/** One text, or several judged together — several is one call, not several. */
|
|
60
|
+
text: string | string[]
|
|
61
|
+
/** Whose request this is — the one thing a bypass can be keyed on. */
|
|
62
|
+
entityId?: string
|
|
63
|
+
/**
|
|
64
|
+
* Extra framing appended to the subject's own, for a subject whose meaning depends on where
|
|
65
|
+
* the text came from — a file's path, for instance.
|
|
66
|
+
*/
|
|
67
|
+
context?: string
|
|
68
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ModerationCategory } from './consts.js'
|
|
2
|
+
import type { ModerationAction, ModerationPolicy, ModerationVerdict } from './types.js'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Narrow whatever the model put in `category` to a real one, or to nothing.
|
|
6
|
+
*
|
|
7
|
+
* The wire field is a free string on purpose — see {@link ModerationVerdictSchema}. A model
|
|
8
|
+
* that is allowing has nothing to categorise and still fills the field, so anything
|
|
9
|
+
* unrecognized is treated as absent rather than as a failure.
|
|
10
|
+
*/
|
|
11
|
+
export const normalizeCategory = (category?: string): ModerationCategory | undefined => {
|
|
12
|
+
const values = Object.values(ModerationCategory) as string[]
|
|
13
|
+
|
|
14
|
+
return category != null && values.includes(category)
|
|
15
|
+
? category as ModerationCategory
|
|
16
|
+
: undefined
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* What to do about a verdict.
|
|
21
|
+
*
|
|
22
|
+
* Pure, because this is the part with the operational levers on it and the part most likely
|
|
23
|
+
* to be wrong in a hurry: `enforce` turns the whole gate into an observer without a deploy,
|
|
24
|
+
* and `bypassEntities` releases one entity when a real customer is wrongly refused.
|
|
25
|
+
*/
|
|
26
|
+
export const decideModeration = (
|
|
27
|
+
verdict: ModerationVerdict, policy: ModerationPolicy & { entityId?: string } = {}
|
|
28
|
+
): ModerationAction => {
|
|
29
|
+
if (verdict.allowed) return 'allow'
|
|
30
|
+
if (policy.entityId != null && policy.bypassEntities?.includes(policy.entityId) === true) return 'allow'
|
|
31
|
+
|
|
32
|
+
// Defaults to ON: a gate that has to be switched on is a gate that is off in every
|
|
33
|
+
// environment nobody remembered to configure.
|
|
34
|
+
return policy.enforce !== false ? 'refuse' : 'shadow'
|
|
35
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum for OwlMeans preview integration event types
|
|
3
|
+
*/
|
|
4
|
+
export enum PreviewEventType {
|
|
5
|
+
Error = 'OWLMEANS_PREVIEW_ERROR',
|
|
6
|
+
CaughtError = 'OWLMEANS_PREVIEW_CONSOLE_ERROR',
|
|
7
|
+
PromiseRejection = 'OWLMEANS_PREVIEW_PROMISE_REJECTION',
|
|
8
|
+
FetchError = 'OWLMEANS_PREVIEW_FETCH_ERROR',
|
|
9
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { PreviewEventType } from './consts.js'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Base interface for all OwlMeans preview messages
|
|
5
|
+
*/
|
|
6
|
+
export interface OwlMeansPreviewMessage<T extends OwlMenasPreviewPayloads = OwlMenasPreviewPayloads> {
|
|
7
|
+
type: PreviewEventType
|
|
8
|
+
payload: T
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface OwlMeansCaughtErrorPayload {
|
|
12
|
+
message: string
|
|
13
|
+
stack?: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Payload for global error events
|
|
18
|
+
*/
|
|
19
|
+
export interface OwlMeansErrorPayload {
|
|
20
|
+
message: string
|
|
21
|
+
source: string
|
|
22
|
+
line: number
|
|
23
|
+
col: number
|
|
24
|
+
stack?: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Payload for unhandled promise rejection events
|
|
29
|
+
*/
|
|
30
|
+
export interface OwlMeansPromiseRejectionPayload {
|
|
31
|
+
reason: unknown
|
|
32
|
+
stack?: string
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Payload for fetch error events
|
|
37
|
+
*/
|
|
38
|
+
export interface OwlMeansFetchErrorPayload {
|
|
39
|
+
url: string | URL | Request
|
|
40
|
+
options?: RequestInit
|
|
41
|
+
status: number
|
|
42
|
+
statusText: string
|
|
43
|
+
body: string
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Specific message types for each event kind
|
|
48
|
+
*/
|
|
49
|
+
export interface OwlMeansErrorMessage extends OwlMeansPreviewMessage<OwlMeansErrorPayload> {
|
|
50
|
+
type: PreviewEventType.Error
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface OwlMeansPromiseRejectionMessage extends OwlMeansPreviewMessage<OwlMeansPromiseRejectionPayload> {
|
|
54
|
+
type: PreviewEventType.PromiseRejection
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface OwlMeansFetchErrorMessage extends OwlMeansPreviewMessage<OwlMeansFetchErrorPayload> {
|
|
58
|
+
type: PreviewEventType.FetchError
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface OwlMeansCaughtErrorMessage extends OwlMeansPreviewMessage<OwlMeansCaughtErrorPayload> {
|
|
62
|
+
type: PreviewEventType.CaughtError
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Union type for all possible OwlMeans preview messages
|
|
67
|
+
*/
|
|
68
|
+
export type OwlMeansPreviewMessages =
|
|
69
|
+
| OwlMeansErrorMessage
|
|
70
|
+
| OwlMeansPromiseRejectionMessage
|
|
71
|
+
| OwlMeansFetchErrorMessage
|
|
72
|
+
| OwlMeansCaughtErrorMessage
|
|
73
|
+
|
|
74
|
+
export type OwlMenasPreviewPayloads =
|
|
75
|
+
| OwlMeansErrorPayload
|
|
76
|
+
| OwlMeansPromiseRejectionPayload
|
|
77
|
+
| OwlMeansFetchErrorPayload
|
|
78
|
+
| OwlMeansCaughtErrorPayload
|
|
79
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shapes a drawn widget can take.
|
|
3
|
+
*
|
|
4
|
+
* A CLOSED set, and deliberately small: each value maps to one pre-built sketch primitive in the
|
|
5
|
+
* target's template, so a value nothing can draw is a value that produces a blank card. A story
|
|
6
|
+
* whose shape is none of these is a list — the commonest thing a screen is, and the safest
|
|
7
|
+
* placeholder for anything unrecognised.
|
|
8
|
+
*/
|
|
9
|
+
export enum WidgetKind {
|
|
10
|
+
/** A queue, an index, a feed — records one after another. */
|
|
11
|
+
List = 'list',
|
|
12
|
+
/** Records in columns, the shape a back office mostly takes. */
|
|
13
|
+
Table = 'table',
|
|
14
|
+
/** The actor SUBMITS something. */
|
|
15
|
+
Form = 'form',
|
|
16
|
+
/** A trend or a comparison over time. */
|
|
17
|
+
Chart = 'chart',
|
|
18
|
+
/** Headline figures — a summary, a tracker, a status board. */
|
|
19
|
+
Stat = 'stat',
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** How many of an area's widgets may be adapted onto its home screen. */
|
|
23
|
+
export const AREA_HOME_WIDGET_CAP = 3
|
|
24
|
+
|
|
25
|
+
/** Sections per area beyond which a top menu stops being navigable. */
|
|
26
|
+
export const AREA_SECTION_CAP = 6
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { ScaffoldPlan, ScaffoldStoryPlan } from './types.js'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ONE reading of who owns a drawn artifact, so no consumer has to interpret the plan itself.
|
|
5
|
+
*
|
|
6
|
+
* The plan carries `sharesWidgetWith` / `sharesScreenWith` as untrusted hints — a model may drop
|
|
7
|
+
* them, invent a code, point forwards, or build a cycle. These resolve all of that away, and
|
|
8
|
+
* every one is TOTAL: a code the plan does not hold answers itself, which is the unshared
|
|
9
|
+
* behaviour and therefore exactly today's drawn tree.
|
|
10
|
+
*
|
|
11
|
+
* Pure and IO-free. `fillScaffoldPlan` normalises a plan through them before anything is stamped,
|
|
12
|
+
* so the stampers and the scaffold loop can read a plan that is already sane.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** Which field the arrow is being followed along. */
|
|
16
|
+
export type ShareKind = 'widget' | 'screen'
|
|
17
|
+
|
|
18
|
+
const pointerOf = (story: ScaffoldStoryPlan, kind: ShareKind): string | undefined =>
|
|
19
|
+
kind === 'widget' ? story.sharesWidgetWith : story.sharesScreenWith
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The code whose artifact this story renders — itself when it owns one.
|
|
23
|
+
*
|
|
24
|
+
* Backward-only and bounded: an arrow is followed only to a story EARLIER in plan order, which
|
|
25
|
+
* makes a cycle unrepresentable rather than merely unlikely, and makes the owner the earliest
|
|
26
|
+
* member of its group. That is what keeps `widgetDefinition(owner)` stable — the name is a
|
|
27
|
+
* function of one code, never of the group, so adding a member renames nothing.
|
|
28
|
+
*/
|
|
29
|
+
export const shareOwner = (
|
|
30
|
+
plan: Pick<ScaffoldPlan, 'stories'>, code: string, kind: ShareKind = 'widget'
|
|
31
|
+
): string => {
|
|
32
|
+
const order = new Map(plan.stories.map((story, index) => [story.code, index]))
|
|
33
|
+
const byCode = new Map(plan.stories.map(story => [story.code, story]))
|
|
34
|
+
|
|
35
|
+
let current = code
|
|
36
|
+
// Bounded by the list length: every hop strictly decreases the plan index, so it terminates.
|
|
37
|
+
for (let hop = 0; hop <= plan.stories.length; hop++) {
|
|
38
|
+
const story = byCode.get(current)
|
|
39
|
+
const target = story != null ? pointerOf(story, kind) : undefined
|
|
40
|
+
if (story == null || target == null || target === '' || target === current) {
|
|
41
|
+
return current
|
|
42
|
+
}
|
|
43
|
+
const here = order.get(current)
|
|
44
|
+
const there = order.get(target)
|
|
45
|
+
// Unknown, forward or self-referential — none of them is a group, so the story owns its own.
|
|
46
|
+
if (here == null || there == null || there >= here) {
|
|
47
|
+
return current
|
|
48
|
+
}
|
|
49
|
+
current = target
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return current
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Owner code → every member, owner first, in plan order.
|
|
57
|
+
*
|
|
58
|
+
* The shape the stampers need: one artifact per entry, and the full member list for the notice
|
|
59
|
+
* that names them.
|
|
60
|
+
*/
|
|
61
|
+
export const shareGroups = (
|
|
62
|
+
plan: Pick<ScaffoldPlan, 'stories'>, kind: ShareKind = 'widget'
|
|
63
|
+
): Map<string, string[]> => {
|
|
64
|
+
const groups = new Map<string, string[]>()
|
|
65
|
+
for (const story of plan.stories) {
|
|
66
|
+
const owner = shareOwner(plan, story.code, kind)
|
|
67
|
+
const members = groups.get(owner) ?? []
|
|
68
|
+
if (!members.includes(owner)) members.push(owner)
|
|
69
|
+
if (!members.includes(story.code)) members.push(story.code)
|
|
70
|
+
groups.set(owner, members)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return groups
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Every story that renders this owner's artifact, owner first. Total: an owner alone answers `[code]`. */
|
|
77
|
+
export const shareMembers = (
|
|
78
|
+
plan: Pick<ScaffoldPlan, 'stories'>, owner: string, kind: ShareKind = 'widget'
|
|
79
|
+
): string[] => shareGroups(plan, kind).get(owner) ?? [owner]
|
|
80
|
+
|
|
81
|
+
/** Whether this story draws the artifact, as opposed to rendering somebody else's. */
|
|
82
|
+
export const ownsShare = (
|
|
83
|
+
plan: Pick<ScaffoldPlan, 'stories'>, code: string, kind: ShareKind = 'widget'
|
|
84
|
+
): boolean => shareOwner(plan, code, kind) === code
|