@postplus/cli 0.1.38 → 0.1.40

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.
@@ -0,0 +1,106 @@
1
+ // Single typed reader over the generated hosted execution manifest (the SSOT
2
+ // projected from apps/web + public-skill-metadata). The CLI verb/flag grammar,
3
+ // the schema report, and the per-endpoint `--help` all index the manifest through
4
+ // this module so the discovery surface never hand-maintains a mirror of enum sets,
5
+ // defaults, or the intent/default/runner-managed field classification.
6
+ import { HOSTED_EXECUTION_MANIFESTS } from './generated/hosted-execution-manifest.generated.js';
7
+ const HOSTED_EXECUTION_MANIFEST_INDEX = HOSTED_EXECUTION_MANIFESTS;
8
+ export function allManifestEntries() {
9
+ return Object.values(HOSTED_EXECUTION_MANIFEST_INDEX).flat();
10
+ }
11
+ // Verb -> targetKey -> resolved target for one domain. media indexes endpoints
12
+ // (and the video-analysis model under its own verb); research indexes
13
+ // collections under `collect` and sources under `scrape`.
14
+ export function buildVerbTargetIndex(domain) {
15
+ const index = new Map();
16
+ for (const entry of allManifestEntries()) {
17
+ if (entry.domain !== domain) {
18
+ continue;
19
+ }
20
+ let targets = index.get(entry.verb);
21
+ if (!targets) {
22
+ targets = new Map();
23
+ index.set(entry.verb, targets);
24
+ }
25
+ const base = {
26
+ skill: entry.skill,
27
+ capability: entry.capability,
28
+ surface: entry.surface,
29
+ };
30
+ if (entry.capability === 'video-analysis') {
31
+ for (const model of entry.models ?? []) {
32
+ targets.set(model.modelKey, { ...base, model });
33
+ }
34
+ continue;
35
+ }
36
+ if (entry.capability === 'hosted-collection') {
37
+ for (const collection of entry.collections ?? []) {
38
+ targets.set(collection.collectionKey, { ...base, collection });
39
+ }
40
+ continue;
41
+ }
42
+ if (entry.capability === 'public-content-collection') {
43
+ for (const source of entry.sources ?? []) {
44
+ targets.set(source.sourceKey, { ...base, source });
45
+ }
46
+ continue;
47
+ }
48
+ if (entry.capability === 'social-publishing') {
49
+ for (const { operation } of entry.operations ?? []) {
50
+ targets.set(operation, { ...base, operation });
51
+ }
52
+ continue;
53
+ }
54
+ for (const endpoint of entry.endpoints ?? []) {
55
+ targets.set(endpoint.endpointKey, { ...base, endpoint });
56
+ }
57
+ }
58
+ return index;
59
+ }
60
+ // Sorted unique target keys for one domain, optionally narrowed to a capability.
61
+ // Used by the schema report to publish the FULL enum set of selectable targets
62
+ // (every endpointKey / modelKey / collectionKey / sourceKey / operation) instead
63
+ // of a single example, and by the JSON schema to constrain the selector to an enum.
64
+ export function manifestTargetKeys(domain, capability) {
65
+ const keys = new Set();
66
+ for (const entry of allManifestEntries()) {
67
+ if (entry.domain !== domain) {
68
+ continue;
69
+ }
70
+ if (capability && entry.capability !== capability) {
71
+ continue;
72
+ }
73
+ for (const endpoint of entry.endpoints ?? []) {
74
+ keys.add(endpoint.endpointKey);
75
+ }
76
+ for (const model of entry.models ?? []) {
77
+ keys.add(model.modelKey);
78
+ }
79
+ for (const collection of entry.collections ?? []) {
80
+ keys.add(collection.collectionKey);
81
+ }
82
+ for (const source of entry.sources ?? []) {
83
+ keys.add(source.sourceKey);
84
+ }
85
+ for (const operation of entry.operations ?? []) {
86
+ keys.add(operation.operation);
87
+ }
88
+ }
89
+ return [...keys].sort();
90
+ }
91
+ // Resolves the endpoint contract for a media-generation endpointKey, or null when
92
+ // the key is not a modelled media-generation endpoint. Used by the schema report
93
+ // and per-endpoint `--help` to read the field-level contract.
94
+ export function findMediaEndpoint(endpointKey) {
95
+ for (const entry of allManifestEntries()) {
96
+ if (entry.domain !== 'media' || entry.capability !== 'media-generation') {
97
+ continue;
98
+ }
99
+ for (const endpoint of entry.endpoints ?? []) {
100
+ if (endpoint.endpointKey === endpointKey) {
101
+ return endpoint;
102
+ }
103
+ }
104
+ }
105
+ return null;
106
+ }