@owlmeans/viable-common 0.0.12 → 0.0.13

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.
Files changed (102) hide show
  1. package/README.md +68 -1
  2. package/agent-meta/manifest.json +23 -0
  3. package/agent-meta/skills/agent-presentation/SKILL.md +62 -0
  4. package/agent-meta/skills/viable-common/SKILL.md +180 -0
  5. package/build/agent/index.d.ts +1 -0
  6. package/build/agent/index.d.ts.map +1 -1
  7. package/build/agent/index.js +1 -0
  8. package/build/agent/index.js.map +1 -1
  9. package/build/agent/presentation.d.ts +102 -0
  10. package/build/agent/presentation.d.ts.map +1 -0
  11. package/build/agent/presentation.js +303 -0
  12. package/build/agent/presentation.js.map +1 -0
  13. package/build/blueprint/case.js +3 -3
  14. package/build/connect/consts.d.ts +93 -5
  15. package/build/connect/consts.d.ts.map +1 -1
  16. package/build/connect/consts.js +90 -1
  17. package/build/connect/consts.js.map +1 -1
  18. package/build/connect/entrypoints.d.ts +208 -4
  19. package/build/connect/entrypoints.d.ts.map +1 -1
  20. package/build/connect/entrypoints.js +61 -33
  21. package/build/connect/entrypoints.js.map +1 -1
  22. package/build/connect/errors.d.ts +20 -0
  23. package/build/connect/errors.d.ts.map +1 -1
  24. package/build/connect/errors.js +39 -0
  25. package/build/connect/errors.js.map +1 -1
  26. package/build/connect/ops.d.ts +46 -2
  27. package/build/connect/ops.d.ts.map +1 -1
  28. package/build/connect/references.d.ts +60 -1
  29. package/build/connect/references.d.ts.map +1 -1
  30. package/build/connect/references.js +16 -0
  31. package/build/connect/references.js.map +1 -1
  32. package/build/connect/schemas.d.ts +17 -2
  33. package/build/connect/schemas.d.ts.map +1 -1
  34. package/build/connect/schemas.js +91 -7
  35. package/build/connect/schemas.js.map +1 -1
  36. package/build/connect/types.d.ts +125 -1
  37. package/build/connect/types.d.ts.map +1 -1
  38. package/build/convert/consts.d.ts +539 -0
  39. package/build/convert/consts.d.ts.map +1 -0
  40. package/build/convert/consts.js +630 -0
  41. package/build/convert/consts.js.map +1 -0
  42. package/build/convert/helpers.d.ts +91 -0
  43. package/build/convert/helpers.d.ts.map +1 -0
  44. package/build/convert/helpers.js +301 -0
  45. package/build/convert/helpers.js.map +1 -0
  46. package/build/convert/index.d.ts +11 -0
  47. package/build/convert/index.d.ts.map +1 -0
  48. package/build/convert/index.js +4 -0
  49. package/build/convert/index.js.map +1 -0
  50. package/build/convert/schemas.d.ts +62 -0
  51. package/build/convert/schemas.d.ts.map +1 -0
  52. package/build/convert/schemas.js +626 -0
  53. package/build/convert/schemas.js.map +1 -0
  54. package/build/convert/types.d.ts +683 -0
  55. package/build/convert/types.d.ts.map +1 -0
  56. package/build/convert/types.js +2 -0
  57. package/build/convert/types.js.map +1 -0
  58. package/build/index.d.ts +1 -0
  59. package/build/index.d.ts.map +1 -1
  60. package/build/index.js +1 -0
  61. package/build/index.js.map +1 -1
  62. package/build/skills/catalogue.d.ts.map +1 -1
  63. package/build/skills/catalogue.js +76 -34
  64. package/build/skills/catalogue.js.map +1 -1
  65. package/build/slot/consts.d.ts +73 -2
  66. package/build/slot/consts.d.ts.map +1 -1
  67. package/build/slot/consts.js +105 -5
  68. package/build/slot/consts.js.map +1 -1
  69. package/build/slot/schemas.d.ts +9 -1
  70. package/build/slot/schemas.d.ts.map +1 -1
  71. package/build/slot/schemas.js +18 -0
  72. package/build/slot/schemas.js.map +1 -1
  73. package/build/slot/types.d.ts +71 -0
  74. package/build/slot/types.d.ts.map +1 -1
  75. package/package.json +15 -7
  76. package/src/agent/index.ts +1 -0
  77. package/src/agent/presentation.ts +335 -0
  78. package/src/blueprint/case.ts +3 -3
  79. package/src/connect/consts.ts +93 -1
  80. package/src/connect/entrypoints.ts +113 -40
  81. package/src/connect/errors.ts +44 -0
  82. package/src/connect/ops.ts +50 -2
  83. package/src/connect/references.ts +53 -5
  84. package/src/connect/schemas.ts +102 -13
  85. package/src/connect/types.ts +130 -2
  86. package/src/convert/consts.ts +672 -0
  87. package/src/convert/helpers.ts +340 -0
  88. package/src/convert/index.ts +10 -0
  89. package/src/convert/schemas.ts +663 -0
  90. package/src/convert/types.ts +741 -0
  91. package/src/index.ts +1 -0
  92. package/src/skills/catalogue.ts +76 -34
  93. package/src/slot/consts.ts +112 -6
  94. package/src/slot/schemas.ts +20 -1
  95. package/src/slot/types.ts +80 -0
  96. package/tests/connect-convert.spec.ts +162 -0
  97. package/tests/connect-entrypoints.spec.ts +12 -4
  98. package/tests/connect-errors.spec.ts +22 -0
  99. package/tests/convert.spec.ts +318 -0
  100. package/tests/presentation.spec.ts +85 -0
  101. package/tests/skills.spec.ts +47 -0
  102. /package/tests/{design.test.ts → design.spec.ts} +0 -0
package/README.md CHANGED
@@ -1 +1,68 @@
1
- # types
1
+ # @owlmeans/viable-common
2
+
3
+ Runtime-free contracts of the OwlMeans Viable platform.
4
+
5
+ Viable turns a description into a running full-stack application. Four runtimes have to agree
6
+ about every name involved — the manager API, the agent, the publisher that runs inside a project
7
+ slot, and the connector SDK on a developer's machine — so each of those names is declared here
8
+ once and imported by all of them. There is no runtime in this package: no `@langchain/*`, no
9
+ filesystem, no inference SDK. It is safe to import from a browser bundle.
10
+
11
+ ## What is in it
12
+
13
+ | Subpath | Contents |
14
+ |---|---|
15
+ | `.` | The shapes a generated project is described by: user stories and entities, the design and scaffold plans, UX/UI specs, the `docs/` metadata paths, the four user areas, the model roles and personas, moderation categories, slot metadata |
16
+ | `@owlmeans/viable-common/slot` | The slot command vocabulary — file, shell and git commands, the sub-project roles, the target's ports and process markers |
17
+ | `@owlmeans/viable-common/connect` | The connector protocol: sessions, operations, model tasks, questions, jobs, capabilities, the error family, and `connectProtocols()` — the one declaration both the platform and the SDK bind |
18
+ | `@owlmeans/viable-common/convert` | Converting an application that already exists: the stages and their transitions, the origin and stack taxonomy, the census classifiers, and the `docs/conversion/` layout |
19
+ | `@owlmeans/viable-common/integrity` | The target-shape manifest — what a slot is allowed to install, build and run — per target layout |
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ bun add @owlmeans/viable-common@^0.0.13
25
+ ```
26
+
27
+ ## Rules worth knowing before you change something
28
+
29
+ **A schema is written for the reader that will refuse it.** Model-answer schemas are annotated
30
+ `JSONSchemaType<T>` so a drift from the type is caught where it is written; record schemas are
31
+ hand-written and cast, because they are re-applied as a Mongo `$jsonSchema`, which admits no
32
+ `Record<>` maps, no `integer` and no date objects.
33
+
34
+ **`nullable: true` always carries its `type`, and a nullable `enum` lists `null` among its
35
+ values.** Ajv checks `nullable` and `enum` independently, so the pair written apart admits `null`
36
+ by type and then refuses it by enum — the field can only ever be omitted, never sent empty. A
37
+ provider's structured output writes an unset optional as `null`, and a wire body where `null`
38
+ means "inherit" has no other spelling. `tests/convert.spec.ts` walks every exported schema for
39
+ both faults, and for draft-04 tuple `items`.
40
+
41
+ **A field that crosses a version skew carries no `enum`.** A connector is installed with
42
+ `npx -y @owlmeans/viable-mcp@^0.1.18-rc.10` and talks to a separately deployed platform, so an executor kind it
43
+ sends must remain an unused capability on an older platform rather than a refused session.
44
+
45
+ **A ceiling exists once.** The inquiry answer cap here equals `DEFAULT_INQUIRY_ANSWER_CHARS` in
46
+ `@owlmeans/llm-common` and must stay equal; two ceilings mean the larger one truncates silently
47
+ at the smaller.
48
+
49
+ ## Related
50
+
51
+ - `@owlmeans/viable-sdk` — the connector SDK written against these contracts
52
+ - `@owlmeans/viable-mcp` — the npx MCP server built on that SDK
53
+
54
+ <!-- owlmeans:agent-guidance:start -->
55
+ ## Agent guidance
56
+
57
+ This package ships embedded agent skills under `agent-meta/`. After installing your
58
+ `@owlmeans/*` packages, run the OwlMeans agent-skills installer to place them into
59
+ your project's skill store (`.agents/skills/`):
60
+
61
+ ```sh
62
+ npx @owlmeans/agent-skills@^0.1.18-rc.21
63
+ ```
64
+
65
+ The embedded files are version-matched to this package release. Do not edit them
66
+ directly — they are regenerated on each publish. To contribute guidance edits,
67
+ open a PR against the source monorepo.
68
+ <!-- owlmeans:agent-guidance:end -->
@@ -0,0 +1,23 @@
1
+ {
2
+ "schemaVersion": 2,
3
+ "package": "@owlmeans/viable-common",
4
+ "version": "0.0.13",
5
+ "generatedAt": "2026-09-15T12:21:31.931Z",
6
+ "canonicalRepo": "https://github.com/owlmeans/common",
7
+ "entries": [
8
+ {
9
+ "kind": "skill",
10
+ "name": "agent-presentation",
11
+ "category": "package-specific",
12
+ "file": "skills/agent-presentation/SKILL.md",
13
+ "canonicalPath": ".agents/skills/agent-presentation/SKILL.md"
14
+ },
15
+ {
16
+ "kind": "skill",
17
+ "name": "viable-common",
18
+ "category": "package-specific",
19
+ "file": "skills/viable-common/SKILL.md",
20
+ "canonicalPath": ".agents/skills/viable-common/SKILL.md"
21
+ }
22
+ ]
23
+ }
@@ -0,0 +1,62 @@
1
+ ---
2
+ name: agent-presentation
3
+ description: Shared, runtime-free taxonomy for presenting OwlMeans Viable agent output. Use when classifying LLM thinking/history messages, adding semantic structured-output cards, or changing their server-to-browser event contract.
4
+ ---
5
+ <!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
6
+
7
+ # Agent output presentation
8
+
9
+ `@owlmeans/viable-common`'s `agent/presentation.ts` owns the browser-safe vocabulary for agent
10
+ output. Keep the server and every client on `classifyAgentMessage()`; consumers may refine a
11
+ provisional classification as streamed text becomes parseable, but must not invent a competing
12
+ taxonomy.
13
+
14
+ ## Contract
15
+
16
+ - The top-level categories are code, unified diff, structured output, Markdown and plain text.
17
+ Code and diffs carry one of React TSX, CSS, TypeScript, JSON or other; structured output carries
18
+ a semantic kind; Markdown carries a document kind; every presentation carries a specialist role.
19
+ - Classify from the combined source: agent, helper, action, explicit output type, text and parsed
20
+ value. Helper/agent attribution selects the specialist family; content shape alone is not enough.
21
+ - A transport may send `presentation` on thinking start and stop events. It is optional for rolling
22
+ compatibility; the final server hint is based on complete output and the browser refines it while
23
+ it streams. Keep legacy `outputType` intact.
24
+ - Unwrap a single LangChain tool call's `args` before semantic classification
25
+ (`agentToolCallArguments`). Known schemas render as cards; unknown objects and arrays remain
26
+ generic structured output, never raw JSON.
27
+ - `structuredKindOf`'s shape checks are ORDER-SENSITIVE where one payload could match more than
28
+ one: a scaffold plan carries its own `stories` array, so `ScaffoldPlan` (`identity` + `guestHome`
29
+ + `areas` + `stories`) is checked before the bare `StoryPlan` (`stories` alone) check catches it
30
+ first. `RuntimeDecision` matches on `jobs` + `agents` + `kv` alone — NOT `actor`/`worker`, which
31
+ the live model call never sends (those two are added only once a decision is persisted onto a
32
+ `StoryDesign`); requiring them missed every runtime-decision call the model actually makes.
33
+ - `outputType === 'tool_calls'` does not automatically mean `AgentStructuredKind.ToolCalls`: a
34
+ SINGLE pinned-schema call (`choose-files-for-fix`, `plan-scaffold`, …) still renders as its own
35
+ schema card. It reads as `ToolCalls` when any of these holds: more than one call arrived in the
36
+ same turn, the action belongs to an unconstrained tool-calling loop (`agentLoopActions` —
37
+ `coding-agent-ask`, `arbitrary-modification`, `fix-agent`, `architect`, `declaration-lookup`,
38
+ `source-extract`), or the single call's shape only reaches a `Generic*` kind. Without the
39
+ action check, a free-flight `read_sources({ files })` call reads as an `ArtifactSelection` card
40
+ instead of a tool call, because its args happen to shape-match that schema.
41
+ - `isAgentMessageHidden()` owns utility-run suppression. The source extractor's `source-extract`
42
+ range-selection calls are internal context reduction and never render in thinking or history.
43
+
44
+ ## Consumer rules
45
+
46
+ - Treat Markdown as a compact draft, not as a full document. Keep raw HTML disabled.
47
+ - Use one token renderer for code and diff code portions; infer a diff language from its changed path.
48
+ - Plain text remains plain. Empty live output is an activity state, not a fabricated model response.
49
+ - Labels for known structured fields belong to the consuming app's i18n resources. Open model keys
50
+ should be humanized rather than passed through an unbounded translation namespace.
51
+ - This package classifies WHICH kind and category a message is; it says nothing about how a
52
+ consumer renders one. `product-viable`'s manager-web renders every `AgentStructuredKind` as a
53
+ flat typed result card and captures per-tool-call outcomes as a platform-side thinking event
54
+ (`AgentThinkingType.ToolResult`, in `sources/common`, not this package) — see that repo's
55
+ `agent-output-cards` skill before changing either side of this contract.
56
+
57
+ ## External docs
58
+
59
+ - https://github.com/remarkjs/react-markdown/blob/main/readme.md — safe-by-default Markdown with custom React components.
60
+ - https://github.com/remarkjs/remark-gfm — GFM tables, task lists, autolinks and strikethrough plugin.
61
+ - https://github.com/FormidableLabs/prism-react-renderer — React token rendering for compact source views.
62
+ - https://fontsource.org/fonts/jetbrains-mono/install — self-hosted variable JetBrains Mono for Vite apps.
@@ -0,0 +1,180 @@
1
+ ---
2
+ name: viable-common
3
+ description: How to use @owlmeans/viable-common — the runtime-free contract package of the OwlMeans Viable platform. Covers the slot command vocabulary and target layouts, the target-shape integrity manifest, the connector protocol and its entrypoints, the conversion vocabulary, the analysis/design/metadata shapes a generated project is described by, the schema conventions every model answer and stored record here is written to (nullable with its type, a nullable enum carrying null, no Record maps in a record schema), and the version-skew rule a name on the wire obeys. Auto-invoked when importing a slot command, a connector or conversion type, a target-integrity helper, or any *Schema this package exports.
4
+ user-invocable: false
5
+ ---
6
+ <!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
7
+
8
+ # @owlmeans/viable-common
9
+
10
+ **Layer:** Cross-cutting domain (contracts only)
11
+ **Install:** `"@owlmeans/viable-common": "^0.0.13"` in `dependencies`
12
+ **Subpaths:** `.` · `./slot` · `./connect` · `./convert` · `./integrity`
13
+ **Runtime-free:** no `@langchain/*`, no filesystem, no Ajv at run time (a devDependency, for the
14
+ tests that compile the schemas). It depends on `@owlmeans/entrypoint`, `@owlmeans/route`,
15
+ `@owlmeans/error`, `@owlmeans/agent-common` and `@owlmeans/llm-common` and on nothing else.
16
+
17
+ Every name the OwlMeans Viable platform puts on a wire, on a volume or in a prompt is declared
18
+ here once, and the four runtimes that must agree about it — the manager API, the agent, the
19
+ publisher/production runtime, and the connector SDK on somebody's laptop — all read the same
20
+ declaration. A vocabulary copied instead of imported is how one tree gets two totals, one
21
+ refusal two spellings, and one ceiling two values.
22
+
23
+ ## Key Exports
24
+
25
+ | Subpath | What it declares |
26
+ |---|---|
27
+ | `.` (barrel) | `SlotMetadata` and the three metadata vocabularies (`metadataConfigs`, `metadataLists`, `metadataSecrets`); `ProjectArea` / `AREA_PATHS` / `AREA_ACCESS` / `AREA_TIER`; `ModelRole` and the viable `ExecutionState`; `ViableSkill` / `ViablePersona` / `VIABLE_SKILLS`; the BA, dev, UX, design and scaffold shapes and their schemas; `ModerationCategory` / `ModerationSubject` / `decideModeration`; the `docs/` metadata paths; `PreviewEventType` |
28
+ | `./slot` | `SlotCommandType` and the `SlotFileCommand` / `SlotShellCommand` / `SlotGitCommand` sets, `SubProject`, `WorkloadKind`, the target ports and process markers, `slotOrigin` / `targetRedirectUrisForOrigin` |
29
+ | `./connect` | `ConnectTarget`, `ConnectLlm`, `ConnectHarness`, `ConnectExecutor`, `ConnectOpKind`, `ConnectJobKind`/`Status`/`Block`, `ModelTier` + `tierOfRole`/`clampTier`, `ModelTask*`, `InquiryPayload` + `ConnectInquiryKind`, the session/job/status views, the `Connect*` error family, `connectProtocols(opts)` and every `*Schema` behind them |
30
+ | `./convert` | `ConversionStage`/`Status`/`Decision` and the `stageAfter`/`decisionFor`/`canEnter` transitions, `OriginKind`/`Shape`/`State`, `StackId` + `STACK_FAMILY`, `ArchitectureCase`, `ConvertibilityVerdict`/`Reason`, the census classifiers (`fileClassOf`, `sizeClassOf`, `entropyClassOf`, `binaryByExtension`), the `docs/conversion/` paths, `CONVERTED_ORIGIN_DIR`, `SOURCE_LIST_EXCLUSIONS`, `CENSUS_SKIP_DIRS`, `RELOCATE_ALWAYS_KEEP`, and the model-answer schemas the conversion asks with |
31
+ | `./integrity` | `TargetLayout` + `TARGET_LAYOUTS`, `detectTargetLayout`, `verifyTargetShape`, `TARGET_INTEGRITY_FILES`, `TARGET_PROTECTED_FILES`, `isLegacyLayout`, `targetPackageName` |
32
+
33
+ ## A schema here is written for the reader that will refuse it
34
+
35
+ Two populations live side by side and are written differently on purpose. Getting the population
36
+ wrong is not a style error — each reader refuses a different thing, and one of them refuses at
37
+ boot rather than at the call.
38
+
39
+ **Model-answer schemas** are the shape a model's single JSON object must take. Annotate them
40
+ `JSONSchemaType<T>` — checked, not cast — because the answer is parsed straight back into that
41
+ type, and a schema that drifted fails at run time with a message about a document rather than
42
+ about a field.
43
+
44
+ **Record-element schemas** describe what the platform stores and puts on the wire. They are
45
+ hand-written and cast, because they are re-applied as a Mongo `$jsonSchema`, which is stricter
46
+ than Ajv: no `Record<>` maps (an open key space cannot be validated), no `integer` (a stored
47
+ number is a double), dates as ISO strings rather than objects.
48
+
49
+ Three rules hold for both, and `tests/convert.spec.ts` walks **the package barrel** for each —
50
+ not the conversion barrel, although the file is the conversion's, because none of the three
51
+ faults is particular to a conversion and a walk over one directory lets the same shape through
52
+ in a design, a slot or a connector schema:
53
+
54
+ - **`nullable: true` always carries its `type`.** Ajv refuses `nullable` on its own, and a schema
55
+ that fails to compile takes down whatever compiled it — the route registration, the collection
56
+ validator — instead of the one call that would have carried the value.
57
+ - **A nullable ENUM lists `null` among its values**: `enum: [...Object.values(X), null]`.
58
+ `nullable` and `enum` are separate keywords checked independently, so the pair written apart
59
+ widens the type check to admit `null` and then refuses that very value by enum — the field can
60
+ only ever be OMITTED, never sent empty. Nothing fails at compile time and nothing fails for a
61
+ caller that leaves the key out, which is why it survives review; it surfaces as the one caller
62
+ that spells absence as `null`. Both callers exist here: a provider's structured output writes an
63
+ unset optional as `null` (an intake stack call was retried three times and discarded as
64
+ `llm:retry-exceeded`), and a wire body where `null` MEANS something — `llmMode`, "inherit the
65
+ profile's setting" — has no other spelling at all.
66
+ - **`items` is never an array.** A draft-04 tuple is refused wherever the schema reaches a
67
+ provider or a collection validator.
68
+
69
+ **A field that crosses a version skew carries no `enum`.** Users run
70
+ `npx -y @owlmeans/viable-mcp@^0.1.18-rc.10` (the moving prerelease tag) against a separately deployed
71
+ platform, so `ConnectCapabilitiesSchema.executors.items`
72
+ is a bare string: a newer executor kind must stay an unused capability on an older platform, never
73
+ a refused session. Apply the same reasoning to anything else a newer connector may send an older
74
+ platform, and nowhere else — a closed set is worth more than a tolerant one everywhere both ends
75
+ deploy together.
76
+
77
+ ## One immutable protocol tree, bound in each runtime
78
+
79
+ `connectProtocols(opts)` is the connector's whole immutable HTTP and socket tree — aliases, paths,
80
+ methods, contracts and protocol parents. The manager and SDK bind their own local materializations
81
+ from those declarations, so a path or schema cannot differ across a server and client. Only what
82
+ belongs to the DEPLOYMENT is injected: the guard alias, ownership gate, paid local-LLM gate and the
83
+ platform's update-base protocol.
84
+
85
+ Adding a route means adding it here first, then binding that named protocol in every runtime that
86
+ serves or calls it. A route declared on one side alone is a 404 nobody can explain from the failing
87
+ end. Keep raw aliases private to declaration modules; consumers receive protocol objects, and a
88
+ dynamic adapter reads `.alias` only at its string-addressed boundary.
89
+
90
+ ## Closed sets that mean something
91
+
92
+ - **`ProjectArea`** — guest `/`, user `/frontoffice`, admin `/admin`, operator `/backoffice`. A
93
+ generated product's own roles map onto `user` or `operator`; there is no fifth area. `AREA_PATHS`,
94
+ `AREA_ACCESS` and `AREA_TIER` are total over it.
95
+ - **`TargetLayout` + `TARGET_LAYOUTS`** — the integrity manifest is PER LAYOUT. A volume never
96
+ migrates, so a project created before the restructure stays on the legacy tree forever and must
97
+ verify **clean**; `TARGET_INTEGRITY_FILES` is the union over layouts so a caller has both probes
98
+ before it knows which tree it holds, and an absent layout reads as the CURRENT one.
99
+ - **`SubProject`** — a ROLE vocabulary mapped per layout, never joined onto a path. Both
100
+ generations arrive on the wire at once, so the enum must stay total over what any live agent may
101
+ send, and no role but `Common` may resolve to the `common` directory.
102
+ - **`ConversionStage`** — advanced only through `stageAfter` / `canEnter` / `decisionFor`. A stage
103
+ transition computed at a call site is how a conversion re-enters a stage it already paid for.
104
+ - **`ModerationCategory`** — a wire contract with seven languages of wording behind it. A fifth
105
+ shape is PHRASED into one of the four, never added.
106
+
107
+ ## The conversion vocabulary is shared with three executors that walk the same tree
108
+
109
+ The census, listing and relocation commands are one contract with three implementations — the
110
+ SDK's local executor, the publisher's file helper, and the library's in-process helper — so
111
+ anything they could disagree about is a constant HERE rather than a matching local copy:
112
+ `CENSUS_SKIP_DIRS` (`node_modules`, `.git` — and deliberately not `dist`/`build`/`.next`, ordinary
113
+ directory names an origin may keep sources in), `SOURCE_LIST_EXCLUSIONS` (the metadata directories
114
+ plus `CONVERTED_ORIGIN_DIR`), `BINARY_PROBE_BYTES`, `CENSUS_MAX_HEAD_BYTES`, `RELOCATE_ALWAYS_KEEP`.
115
+ The one thing they are allowed to differ about is stated rather than inherited: the platform's two
116
+ keep what a volume it owns must not lose, the SDK's keeps what a DEVELOPER owns (`.viable`, the two
117
+ `.env` files).
118
+
119
+ `docs/conversion/` is likewise addressed only through the exported path builders
120
+ (`CONVERSION_*_FILE`, `conversionStoryDoc`, `conversionSeedDoc`) — a conversion's own artifacts are
121
+ read back by the purge, and a path spelled at a call site is a file the purge leaves behind.
122
+
123
+ ## The inquiry vocabulary is a deliberate COPY, and the ceiling is not
124
+
125
+ `ConnectInquiryKind` / `InquiryPayload` / `InquiryAnswerPayload` mirror `@owlmeans/llm-common`'s
126
+ `Inquiry` family, renamed so both vocabularies can be imported into one file and so `manager-api`,
127
+ which does not depend on the model runtime, stays free of it. Values are byte-identical, so the
128
+ platform's mapper is a widening rather than a translation table, and a test pins that — the same
129
+ arrangement `ModelTask` has with `DelegatedTask`.
130
+
131
+ The CEILING is not copied twice over: `CONNECT_INQUIRY_MAX_TEXT` equals
132
+ `DEFAULT_INQUIRY_ANSWER_CHARS` and must stay equal, and `./convert`'s own
133
+ `INQUIRY_STATE_TEXT_CHARS` — what a pipeline STATE may keep of an answer's prose, the rest going to
134
+ `docs/conversion/inquiries.md` — equals its twin of the same name there. Two ceilings for one value means the layer with the larger one
135
+ truncates silently at the smaller, and the caller records an assumption about an answer the person
136
+ actually gave. Never introduce a local cap; import the one that exists.
137
+
138
+ ## Errors: declared here, phrased where they are read
139
+
140
+ `ConnectError` and its family (`ConnectSessionNotFound`, `ConnectSessionGone`, `ConnectOpTimeout`,
141
+ `ConnectOpRefused`, `LocalSlotUnsupported`, `ConnectOpUnknown`) are `ResilientError` classes with
142
+ markers under `viable-connect:`. `ConnectSessionGone` is registered FATAL on the agent side: a run
143
+ whose executor has gone away must stop at once rather than spend a retry ladder, and the step fails
144
+ as an OUTCOME so the run row records where it stopped and `pipeline.resume` picks it up when a
145
+ connector returns.
146
+
147
+ The platform's own refusals — conversion, moderation, reserved names, integrity — are declared in
148
+ the product repo, not here, so a consumer that cannot `instanceof` them matches by MARKER instead:
149
+ `@owlmeans/viable-sdk`'s `REFUSALS` map and the manager's `useErrorPhrase` read the same substrings,
150
+ which is what stops one refusal being phrased two ways. When a marker changes, both readers change
151
+ with it.
152
+
153
+ ## Tests
154
+
155
+ `bun test ./tests` — offline. `convert.spec.ts` (the three structural walks over the barrel, the
156
+ conversion schemas compiling, a nullable enum accepting `null` under Ajv while still refusing an
157
+ unknown member, the census classifiers and the stage transitions), `connect-convert.spec.ts` (the
158
+ conversion routes at their paths and methods, hanging under the connector base and carrying no paid
159
+ gate; capabilities accepting an executor kind this platform has never heard of; the answer and
160
+ resume bodies), `design.spec.ts` (the design aggregate, staleness ranking, and the design schema
161
+ refusing an undeclared field or an area outside the closed set).
162
+
163
+ ## Depends On
164
+
165
+ - `@owlmeans/entrypoint`, `@owlmeans/route` — the entrypoint declarations
166
+ - `@owlmeans/error` — the `Connect*` error family
167
+ - `@owlmeans/llm-common` — `ExecutionEffort`/`ExecutionLevel`, `PromptPolicy`, `LlmPurpose`, and the
168
+ inquiry ceilings this package's copies are pinned to
169
+ - `@owlmeans/agent-common` — the run and pipeline contracts a conversion's runs are declared against
170
+
171
+ ## Related
172
+
173
+ - [[viable-sdk]] — the connector SDK written entirely against these contracts
174
+ - [[viable-mcp]] — the npx stdio server built on that SDK
175
+ - [[inquiry]] — the primitive `InquiryPayload` mirrors, and the one answer ceiling
176
+ - [[llm-common]] — the contracts half of the model runtime
177
+ - The DOMAIN rules for what these shapes mean — target areas and navigation, the scaffold, target
178
+ integrity, the metadata files, the converter — live in the downstream repos that implement them
179
+ (`target-areas`, `scaffolding`, `workload-integrity`, `viable-metadata`, `converter`). This skill
180
+ owns the CONTRACT: how a name is declared, and what refuses it.
@@ -1,4 +1,5 @@
1
1
  export type * from './types.js';
2
2
  export * from './spectator/index.js';
3
3
  export * from './memory.js';
4
+ export * from './presentation.js';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AACA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AACA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA"}
@@ -1,3 +1,4 @@
1
1
  export * from './spectator/index.js';
2
2
  export * from './memory.js';
3
+ export * from './presentation.js';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAEA,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAEA,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * A compact, runtime-free description of how an agent message should be presented.
3
+ *
4
+ * The server emits this with thinking events and the browser refines it as streaming output
5
+ * becomes parseable. Keeping the vocabulary here prevents the two runtimes from drifting into
6
+ * their own guesses about the same model response.
7
+ */
8
+ export declare enum AgentMessageCategory {
9
+ Code = "code",
10
+ Diff = "diff",
11
+ Structured = "structured",
12
+ Markdown = "markdown",
13
+ Plain = "plain"
14
+ }
15
+ export declare enum AgentCodeLanguage {
16
+ ReactTsx = "react-tsx",
17
+ Css = "css",
18
+ TypeScript = "typescript",
19
+ Json = "json",
20
+ Other = "other"
21
+ }
22
+ /** A semantic shape that the manager can render as a purpose-built card. */
23
+ export declare enum AgentStructuredKind {
24
+ ToolCalls = "tool-calls",
25
+ ArtifactSelection = "artifact-selection",
26
+ EntitySelection = "entity-selection",
27
+ StoryPlan = "story-plan",
28
+ ScreenPlan = "screen-plan",
29
+ ComponentPlan = "component-plan",
30
+ TransitionPlan = "transition-plan",
31
+ EntrypointSelection = "entrypoint-selection",
32
+ AccessPolicy = "access-policy",
33
+ ScaffoldPlan = "scaffold-plan",
34
+ RuntimeDecision = "runtime-decision",
35
+ CandidateRanking = "candidate-ranking",
36
+ Decision = "decision",
37
+ GenericRecord = "generic-record",
38
+ GenericList = "generic-list",
39
+ GenericValue = "generic-value"
40
+ }
41
+ export declare enum AgentMarkdownKind {
42
+ Specification = "specification",
43
+ DesignDocument = "design-document",
44
+ Documentation = "documentation"
45
+ }
46
+ /** The family of specialist that produced an output, not an authorization role. */
47
+ export declare enum AgentMessageRole {
48
+ Technical = "technical",
49
+ Analytical = "analytical",
50
+ Product = "product",
51
+ Ux = "ux",
52
+ VisualDesign = "visual-design",
53
+ Architect = "architect",
54
+ Developer = "developer",
55
+ Repair = "repair",
56
+ Orchestrator = "orchestrator"
57
+ }
58
+ export interface AgentCodePresentation {
59
+ category: AgentMessageCategory.Code | AgentMessageCategory.Diff;
60
+ language: AgentCodeLanguage;
61
+ role: AgentMessageRole;
62
+ }
63
+ export interface AgentStructuredPresentation {
64
+ category: AgentMessageCategory.Structured;
65
+ structure: AgentStructuredKind;
66
+ role: AgentMessageRole;
67
+ }
68
+ export interface AgentMarkdownPresentation {
69
+ category: AgentMessageCategory.Markdown;
70
+ document: AgentMarkdownKind;
71
+ role: AgentMessageRole;
72
+ }
73
+ export interface AgentPlainPresentation {
74
+ category: AgentMessageCategory.Plain;
75
+ role: AgentMessageRole;
76
+ }
77
+ export type AgentMessagePresentation = AgentCodePresentation | AgentStructuredPresentation | AgentMarkdownPresentation | AgentPlainPresentation;
78
+ /** The attribution and content available to either side of a thinking event. */
79
+ export interface AgentMessageClassificationInput {
80
+ agent?: string;
81
+ helper?: string;
82
+ action?: string;
83
+ outputType?: string;
84
+ text?: string;
85
+ value?: unknown;
86
+ }
87
+ /**
88
+ * Source extraction is an internal context-reduction pass. Its terminal tool call contains only
89
+ * line ranges, which are useful to the coder but add no useful information to a person's journal.
90
+ */
91
+ export declare const isAgentMessageHidden: (input: AgentMessageClassificationInput) => boolean;
92
+ /** Maps the attribution that reached the event boundary to the visual specialist family. */
93
+ export declare const agentMessageRoleOf: (input: AgentMessageClassificationInput) => AgentMessageRole;
94
+ /** Pulls a schema argument out of LangChain's serialised tool-call shape. */
95
+ export declare const agentToolCallArguments: (value: unknown) => unknown;
96
+ /** Finds the language of a unified diff from its destination (or source) file path. */
97
+ export declare const agentDiffLanguageOf: (text: string) => AgentCodeLanguage;
98
+ /** Conservative code detection; prose with one identifier remains plain text. */
99
+ export declare const agentCodeLanguageOf: (text: string) => AgentCodeLanguage;
100
+ export declare const isUnifiedDiff: (text: string) => boolean;
101
+ export declare const classifyAgentMessage: (input: AgentMessageClassificationInput) => AgentMessagePresentation;
102
+ //# sourceMappingURL=presentation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentation.d.ts","sourceRoot":"","sources":["../../src/agent/presentation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,oBAAY,oBAAoB;IAC9B,IAAI,SAAS;IACb,IAAI,SAAS;IACb,UAAU,eAAe;IACzB,QAAQ,aAAa;IACrB,KAAK,UAAU;CAChB;AAED,oBAAY,iBAAiB;IAC3B,QAAQ,cAAc;IACtB,GAAG,QAAQ;IACX,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAED,4EAA4E;AAC5E,oBAA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