@contenthero/mcp 0.4.1 → 0.4.3
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/dist/format.d.ts +42 -9
- package/dist/format.d.ts.map +1 -1
- package/dist/format.js +91 -27
- package/dist/format.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +198 -68
- package/dist/server.js.map +1 -1
- package/package.json +2 -2
package/dist/format.d.ts
CHANGED
|
@@ -4,12 +4,21 @@
|
|
|
4
4
|
* a readable message instead of a transport failure.
|
|
5
5
|
*/
|
|
6
6
|
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
-
import type { Avatar, AvatarSummary, Balance, BrandKit, BrandKitSummary, BrandKitSectionRecord, BrandKnowledgeItem, BrandKnowledgeDetail, BrandKnowledgeListResult, BrandKnowledgeMatch, ConnectedAccount, CostEstimate, Element, Generation, GenerateResult, EditAudioResult, MediaItem, MediaSummary, SearchMediaResult, Folder, DerivedFolder, FolderItem, MediaBatchResult, CreateMediaUploadResult, ImportedMedia, UploadedMedia, ModelInfo, PlatformSummary, PlatformSchema, Stage, Space, CardAsset, Post, CardDetail, CardListResult, CardSummary, Tag,
|
|
7
|
+
import type { Avatar, AvatarSummary, Balance, BrandKit, BrandKitSummary, BrandKitSectionRecord, BrandKnowledgeItem, BrandKnowledgeDetail, BrandKnowledgeListResult, BrandKnowledgeMatch, ConnectedAccount, CostEstimate, CreateAvatarResult, Element, Generation, GenerateResult, EditAudioResult, MediaItem, MediaSummary, SearchMediaResult, Folder, DerivedFolder, FolderItem, MediaBatchResult, CreateMediaUploadResult, ImportedMedia, UploadedMedia, ModelInfo, PlatformSummary, PlatformSchema, Stage, Space, CardAsset, Post, CardDetail, CardListResult, CardSummary, Tag, PublishResult, TrackedAccount, ContentDetail, ContentListResult, AccountDetail, Transcription, Voice, VoiceSummary, ApplyEditorOpsResult, ProjectSummary, ProjectDetail, LiveContextResult, LayerTypeCatalog, TimelineTypeCatalog, TranscriptResult, ExportJob, ExportFormatCatalog, ExtractionOutcome } from '@contenthero/sdk';
|
|
8
8
|
export declare function text(body: string, isError?: boolean): CallToolResult;
|
|
9
9
|
/** A finished image/video generation: list the asset URLs, plus the placement outcome when placed on a project. */
|
|
10
10
|
export declare function completedResult(gen: Generation): CallToolResult;
|
|
11
11
|
/** Suggested seconds to wait before re-polling a job, by content type. */
|
|
12
12
|
export declare function pollAfterSecondsFor(contentType: string): number;
|
|
13
|
+
/**
|
|
14
|
+
* How to call `get_generation_status`, written as the call itself.
|
|
15
|
+
*
|
|
16
|
+
* ⚠️ THE ARGUMENT IS `outputIds` AND IT IS AN ARRAY, ALWAYS, even for one job. Every handoff here used to
|
|
17
|
+
* say "call get_generation_status with this outputId", which names a parameter that does not exist: an agent
|
|
18
|
+
* following the sentence literally sends `{ outputId }` and the schema rejects it. Naming the shape in prose
|
|
19
|
+
* is what drifted, so these messages now print the call instead, and every site shares this one function.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getStatusCall(outputIds: readonly string[]): string;
|
|
13
22
|
/** A slow job that did not finish within the smart-wait window. */
|
|
14
23
|
export declare function pendingResult(outputId: string, pollAfterSeconds?: number): CallToolResult;
|
|
15
24
|
/** Synchronous audio result (already complete on submit). */
|
|
@@ -24,7 +33,19 @@ export declare function audioResult(result: GenerateResult | EditAudioResult): C
|
|
|
24
33
|
export declare function enhanceClipsResult(result: EditAudioResult): CallToolResult;
|
|
25
34
|
/** Result of a get_cost preflight: the estimate, with nothing generated or charged. */
|
|
26
35
|
export declare function costResult(est: CostEstimate): CallToolResult;
|
|
27
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* One generation's status. Used directly for a single id, and per-row by the batch form below.
|
|
38
|
+
*
|
|
39
|
+
* ⭐ A STILL-RUNNING GENERATION REPORTS THE URLS IT ALREADY HAS. `outputUrls` fills in slot by slot,
|
|
40
|
+
* so a 4-image batch can have three finished assets while `status` is still 'processing'. Reporting
|
|
41
|
+
* only "still processing" threw those away and made every caller block on the SLOWEST slot, even
|
|
42
|
+
* though the finished ones are already visible in the app's own grid. The caller can start reviewing
|
|
43
|
+
* immediately and re-poll only for the remainder.
|
|
44
|
+
*
|
|
45
|
+
* ⚠️ THE PARTIAL LIST IS NOT A FINAL ONE, so it never uses `completedResult`'s "Done." header. A
|
|
46
|
+
* caller that stopped at a partial result believing it was complete would silently lose images,
|
|
47
|
+
* which is the failure this is meant to prevent, not cause.
|
|
48
|
+
*/
|
|
28
49
|
export declare function generationStatusResult(gen: Generation): CallToolResult;
|
|
29
50
|
/** One or more generations (snapshot or post-wait). Falls through to the single form for one id. */
|
|
30
51
|
export declare function generationBatchResult(gens: Generation[]): CallToolResult;
|
|
@@ -34,6 +55,18 @@ export declare function transcriptResult(t: Transcription): CallToolResult;
|
|
|
34
55
|
export declare function avatarListResult(avatars: AvatarSummary[]): CallToolResult;
|
|
35
56
|
/** One avatar's full detail, including its looks. */
|
|
36
57
|
export declare function avatarResult(a: Avatar): CallToolResult;
|
|
58
|
+
/**
|
|
59
|
+
* A just-created avatar, which is NOT READY.
|
|
60
|
+
*
|
|
61
|
+
* ⚠️ THE POINT OF A SEPARATE FORMATTER IS THE WAIT. `avatarResult` describes a finished avatar, and
|
|
62
|
+
* using it here would show an avatar with `image: none` and no looks, which reads as "created, and
|
|
63
|
+
* empty" rather than "created, and still generating". A model that reads it that way goes on to
|
|
64
|
+
* generate a look into an avatar whose own first look is still in flight, or reports success to the
|
|
65
|
+
* user for something they cannot yet see.
|
|
66
|
+
*
|
|
67
|
+
* Says the poll call explicitly, the same way `pendingResult` does for a generation.
|
|
68
|
+
*/
|
|
69
|
+
export declare function avatarPendingResult(created: CreateAvatarResult): CallToolResult;
|
|
37
70
|
/** List of saved voices. */
|
|
38
71
|
export declare function voiceListResult(voices: VoiceSummary[]): CallToolResult;
|
|
39
72
|
/** One voice's full detail. */
|
|
@@ -128,7 +161,7 @@ export declare function platformResult(p: PlatformSchema): CallToolResult;
|
|
|
128
161
|
export declare function cardListResult(result: CardListResult): CallToolResult;
|
|
129
162
|
/** A single post summary line (create / update / schedule / archive results). */
|
|
130
163
|
export declare function postSummaryResult(p: CardSummary, prefix?: string): CallToolResult;
|
|
131
|
-
/** One
|
|
164
|
+
/** One card in full, with its posts and assets. */
|
|
132
165
|
export declare function cardResult(p: CardDetail): CallToolResult;
|
|
133
166
|
/** List of stages (the agent resolves a stage from here before placing a post). */
|
|
134
167
|
/**
|
|
@@ -143,8 +176,8 @@ export declare function spaceDeletedResult(id: string): CallToolResult;
|
|
|
143
176
|
/** One space. */
|
|
144
177
|
export declare function spaceResult(s: Space): CallToolResult;
|
|
145
178
|
export declare function stageListResult(stages: Stage[]): CallToolResult;
|
|
146
|
-
/** A created or updated
|
|
147
|
-
export declare function
|
|
179
|
+
/** A created or updated post. */
|
|
180
|
+
export declare function postResult(d: Post): CallToolResult;
|
|
148
181
|
/** An attached asset. */
|
|
149
182
|
export declare function assetResult(a: CardAsset): CallToolResult;
|
|
150
183
|
/** A post's assets in their (new) order. */
|
|
@@ -153,8 +186,8 @@ export declare function assetOrderResult(assets: CardAsset[]): CallToolResult;
|
|
|
153
186
|
export declare function assetRemovedResult(r: {
|
|
154
187
|
id: string;
|
|
155
188
|
}): CallToolResult;
|
|
156
|
-
/** Confirmation of a detached
|
|
157
|
-
export declare function
|
|
189
|
+
/** Confirmation of a detached post. */
|
|
190
|
+
export declare function postRemovedResult(r: {
|
|
158
191
|
id: string;
|
|
159
192
|
}): CallToolResult;
|
|
160
193
|
/** The account's tags. */
|
|
@@ -165,8 +198,8 @@ export declare function tagResult(t: Tag, verb?: string): CallToolResult;
|
|
|
165
198
|
export declare function tagDeletedResult(r: {
|
|
166
199
|
id: string;
|
|
167
200
|
}): CallToolResult;
|
|
168
|
-
/** The result of publishing a
|
|
169
|
-
export declare function publishResult(r:
|
|
201
|
+
/** The result of publishing a card's posts (one outcome per post). */
|
|
202
|
+
export declare function publishResult(r: PublishResult): CallToolResult;
|
|
170
203
|
/** List of tracked accounts, either kind. */
|
|
171
204
|
export declare function trackedAccountListResult(accounts: TrackedAccount[], noun?: string): CallToolResult;
|
|
172
205
|
/** A page of outliers. */
|
package/dist/format.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AACxE,OAAO,KAAK,EACV,MAAM,EACN,aAAa,EACb,OAAO,EACP,QAAQ,EACR,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,OAAO,EACP,UAAU,EACV,cAAc,EACd,eAAe,EACf,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,MAAM,EACN,aAAa,EACb,UAAU,EACV,gBAAgB,EAEhB,uBAAuB,EACvB,aAAa,EACb,aAAa,EACb,SAAS,EACT,eAAe,EACf,cAAc,EACd,KAAK,EACL,KAAK,EACL,SAAS,EACT,IAAI,EACJ,UAAU,EACV,cAAc,EACd,WAAW,EACX,GAAG,EACH,
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AACxE,OAAO,KAAK,EACV,MAAM,EACN,aAAa,EACb,OAAO,EACP,QAAQ,EACR,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,OAAO,EACP,UAAU,EACV,cAAc,EACd,eAAe,EACf,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,MAAM,EACN,aAAa,EACb,UAAU,EACV,gBAAgB,EAEhB,uBAAu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AgB,GAAG,cAAc,CAa1E;AAED,2DAA2D;AAC3D,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,cAAc,CAgBxD;AAID,mFAAmF;AACnF,wBAAgB,eAAe,CAAC,CAAC,EAAE,oBAAoB,GAAG,cAAc,CAwBvE;AAgDD,2GAA2G;AAC3G,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,aAAa,GAAG,cAAc,CAyBpE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,iBAAiB,EACzB,QAAQ,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GACnD,cAAc,CA4DhB;AAYD,6EAA6E;AAC7E,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,cAAc,CAO5E;AAED,yEAAyE;AACzE,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,aAAa,GAAG,cAAc,CAMrE;AAED,0CAA0C;AAC1C,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,CAEtE;AAED,0FAA0F;AAC1F,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,gBAAgB,GAAG,cAAc,CAStE;AAED,wFAAwF;AACxF,wBAAgB,eAAe,CAAC,GAAG,EAAE,SAAS,GAAG,cAAc,CAW9D;AAED,yDAAyD;AACzD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,mBAAmB,GAAG,cAAc,CAM5E;AAED,iFAAiF;AACjF,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,gBAAgB,GAAG,cAAc,CA0B1E;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,mBAAmB,GAAG,cAAc,CAU5E"}
|
package/dist/format.js
CHANGED
|
@@ -30,9 +30,20 @@ export function completedResult(gen) {
|
|
|
30
30
|
export function pollAfterSecondsFor(contentType) {
|
|
31
31
|
return contentType === 'image' ? 5 : 15;
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* How to call `get_generation_status`, written as the call itself.
|
|
35
|
+
*
|
|
36
|
+
* ⚠️ THE ARGUMENT IS `outputIds` AND IT IS AN ARRAY, ALWAYS, even for one job. Every handoff here used to
|
|
37
|
+
* say "call get_generation_status with this outputId", which names a parameter that does not exist: an agent
|
|
38
|
+
* following the sentence literally sends `{ outputId }` and the schema rejects it. Naming the shape in prose
|
|
39
|
+
* is what drifted, so these messages now print the call instead, and every site shares this one function.
|
|
40
|
+
*/
|
|
41
|
+
export function getStatusCall(outputIds) {
|
|
42
|
+
return `get_generation_status { outputIds: [${outputIds.map((id) => `"${id}"`).join(', ')}] }`;
|
|
43
|
+
}
|
|
33
44
|
/** A slow job that did not finish within the smart-wait window. */
|
|
34
45
|
export function pendingResult(outputId, pollAfterSeconds = 15) {
|
|
35
|
-
return text(`Still rendering (outputId ${outputId}). This is normal for video. Call
|
|
46
|
+
return text(`Still rendering (outputId ${outputId}). This is normal for video. Call ${getStatusCall([outputId])} in ~${pollAfterSeconds}s [poll_after_seconds: ${pollAfterSeconds}] to get the final URLs.`);
|
|
36
47
|
}
|
|
37
48
|
/** Synchronous audio result (already complete on submit). */
|
|
38
49
|
export function audioResult(result) {
|
|
@@ -54,9 +65,10 @@ export function enhanceClipsResult(result) {
|
|
|
54
65
|
}
|
|
55
66
|
const lines = jobs.map((j, i) => `${i + 1}. outputId ${j.outputId} covers ${j.clipIds.length} clip${j.clipIds.length === 1 ? '' : 's'}` +
|
|
56
67
|
` from one source (${j.windows} window${j.windows === 1 ? '' : 's'})`);
|
|
68
|
+
const poll = `Poll with ${getStatusCall(jobs.map((j) => j.outputId))}`;
|
|
57
69
|
const header = jobs.length === 1
|
|
58
|
-
?
|
|
59
|
-
: `Enhancing ${jobs.length} sources as separate jobs, because a noise profile is estimated per recording.
|
|
70
|
+
? `Enhancing 1 source. ${poll}:`
|
|
71
|
+
: `Enhancing ${jobs.length} sources as separate jobs, because a noise profile is estimated per recording. ${poll} (EVERY id, in one call):`;
|
|
60
72
|
const footer = [
|
|
61
73
|
'The enhanced audio is applied to the clips automatically when each job lands, so no placement call is needed.',
|
|
62
74
|
result.silencedClipsExcluded
|
|
@@ -71,7 +83,19 @@ export function costResult(est) {
|
|
|
71
83
|
const credits = `${est.creditsEstimate} credit${est.creditsEstimate === 1 ? '' : 's'}`;
|
|
72
84
|
return text(`Estimated cost: ${credits} for ${what}. No generation ran and nothing was charged.`);
|
|
73
85
|
}
|
|
74
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* One generation's status. Used directly for a single id, and per-row by the batch form below.
|
|
88
|
+
*
|
|
89
|
+
* ⭐ A STILL-RUNNING GENERATION REPORTS THE URLS IT ALREADY HAS. `outputUrls` fills in slot by slot,
|
|
90
|
+
* so a 4-image batch can have three finished assets while `status` is still 'processing'. Reporting
|
|
91
|
+
* only "still processing" threw those away and made every caller block on the SLOWEST slot, even
|
|
92
|
+
* though the finished ones are already visible in the app's own grid. The caller can start reviewing
|
|
93
|
+
* immediately and re-poll only for the remainder.
|
|
94
|
+
*
|
|
95
|
+
* ⚠️ THE PARTIAL LIST IS NOT A FINAL ONE, so it never uses `completedResult`'s "Done." header. A
|
|
96
|
+
* caller that stopped at a partial result believing it was complete would silently lose images,
|
|
97
|
+
* which is the failure this is meant to prevent, not cause.
|
|
98
|
+
*/
|
|
75
99
|
export function generationStatusResult(gen) {
|
|
76
100
|
if (gen.status === 'completed')
|
|
77
101
|
return completedResult(gen);
|
|
@@ -79,7 +103,17 @@ export function generationStatusResult(gen) {
|
|
|
79
103
|
return text(`Generation ${gen.outputId} failed: ${gen.error ?? 'unknown error'}`, true);
|
|
80
104
|
}
|
|
81
105
|
const secs = pollAfterSecondsFor(gen.contentType);
|
|
82
|
-
|
|
106
|
+
const ready = gen.outputUrls ?? [];
|
|
107
|
+
const poll = `Call get_generation_status again in ~${secs}s [poll_after_seconds: ${secs}]`;
|
|
108
|
+
if (ready.length === 0) {
|
|
109
|
+
return text(`Generation ${gen.outputId} is still ${gen.status}. ${poll}.`);
|
|
110
|
+
}
|
|
111
|
+
const noun = ready.length === 1 ? gen.contentType : `${gen.contentType}s`;
|
|
112
|
+
return text([
|
|
113
|
+
`Partial. ${ready.length} ${noun} ready from ${gen.modelId} (outputId ${gen.outputId}), more still ${gen.status}:`,
|
|
114
|
+
...ready.map((u, i) => `${i + 1}. ${u}`),
|
|
115
|
+
`NOT the full set. ${poll} for the rest.`,
|
|
116
|
+
].join('\n'));
|
|
83
117
|
}
|
|
84
118
|
/** One or more generations (snapshot or post-wait). Falls through to the single form for one id. */
|
|
85
119
|
export function generationBatchResult(gens) {
|
|
@@ -94,6 +128,13 @@ export function generationBatchResult(gens) {
|
|
|
94
128
|
return `- ${gen.outputId}: failed | ${gen.error ?? 'unknown error'}`;
|
|
95
129
|
}
|
|
96
130
|
const secs = pollAfterSecondsFor(gen.contentType);
|
|
131
|
+
// Same rule as the single form: surface the slots that already landed rather than making the
|
|
132
|
+
// caller block on the slowest one. The count says the set is incomplete, so a row can never be
|
|
133
|
+
// mistaken for a finished generation.
|
|
134
|
+
const ready = gen.outputUrls ?? [];
|
|
135
|
+
if (ready.length > 0) {
|
|
136
|
+
return `- ${gen.outputId}: ${gen.status}, ${ready.length} ready so far | ${ready.join(', ')} [poll_after_seconds: ${secs}]`;
|
|
137
|
+
}
|
|
97
138
|
return `- ${gen.outputId}: ${gen.status} [poll_after_seconds: ${secs}]`;
|
|
98
139
|
});
|
|
99
140
|
return text([`${gens.length} generation(s):`, ...rows].join('\n'));
|
|
@@ -131,6 +172,29 @@ export function avatarResult(a) {
|
|
|
131
172
|
...a.looks.map((l) => ` - ${l.name ?? l.lookType ?? 'look'} (id ${l.id})${l.isDefault ? ' [default]' : ''}${l.isFavorited ? ' [favorite]' : ''}${l.isArchived ? ' [archived]' : ''}: ${l.imageUrl ?? 'none'}`),
|
|
132
173
|
]));
|
|
133
174
|
}
|
|
175
|
+
/**
|
|
176
|
+
* A just-created avatar, which is NOT READY.
|
|
177
|
+
*
|
|
178
|
+
* ⚠️ THE POINT OF A SEPARATE FORMATTER IS THE WAIT. `avatarResult` describes a finished avatar, and
|
|
179
|
+
* using it here would show an avatar with `image: none` and no looks, which reads as "created, and
|
|
180
|
+
* empty" rather than "created, and still generating". A model that reads it that way goes on to
|
|
181
|
+
* generate a look into an avatar whose own first look is still in flight, or reports success to the
|
|
182
|
+
* user for something they cannot yet see.
|
|
183
|
+
*
|
|
184
|
+
* Says the poll call explicitly, the same way `pendingResult` does for a generation.
|
|
185
|
+
*/
|
|
186
|
+
export function avatarPendingResult(created) {
|
|
187
|
+
const a = created.avatar;
|
|
188
|
+
return text(lines([
|
|
189
|
+
`Created "${a.name}" (id ${a.id}).`,
|
|
190
|
+
'',
|
|
191
|
+
`⚠️ NOT READY YET: status is ${created.status}. The avatar has no image until its first look`,
|
|
192
|
+
'finishes generating, which is also when its default look and profile photo are set.',
|
|
193
|
+
`Poll with: get_avatar { "avatarId": "${a.id}" } until status is "completed" (usually 1-4 minutes).`,
|
|
194
|
+
'',
|
|
195
|
+
'Credits are charged when that look completes, not now, so a failed generation is not charged.',
|
|
196
|
+
]));
|
|
197
|
+
}
|
|
134
198
|
/** List of saved voices. */
|
|
135
199
|
export function voiceListResult(voices) {
|
|
136
200
|
if (!voices.length)
|
|
@@ -599,7 +663,7 @@ export function platformResult(p) {
|
|
|
599
663
|
`formats: ${p.formats.join(', ')}`,
|
|
600
664
|
`posting modes: ${p.postingModes.join(', ')}`,
|
|
601
665
|
'',
|
|
602
|
-
'Fields by format (set these as platformSettings on
|
|
666
|
+
'Fields by format (set these as platformSettings on a post in update_card):',
|
|
603
667
|
...fmtBlocks,
|
|
604
668
|
enumLines.length ? '' : null,
|
|
605
669
|
enumLines.length ? 'Allowed option values:' : null,
|
|
@@ -608,7 +672,7 @@ export function platformResult(p) {
|
|
|
608
672
|
limitLines.length ? 'Character limits:' : null,
|
|
609
673
|
...limitLines,
|
|
610
674
|
'',
|
|
611
|
-
'Fill platformSettings to this shape, then attach
|
|
675
|
+
'Fill platformSettings to this shape, then attach it as a post with update_card.',
|
|
612
676
|
]));
|
|
613
677
|
}
|
|
614
678
|
/** Render the reference-addressing guidance (how to tag references in the prompt). */
|
|
@@ -628,7 +692,7 @@ function promptReferenceLines(pr) {
|
|
|
628
692
|
}
|
|
629
693
|
// -- posts (content pipeline) -------------------------------------------------
|
|
630
694
|
/** One line summarizing a post. */
|
|
631
|
-
function
|
|
695
|
+
function cardLine(p) {
|
|
632
696
|
const where = p.platforms.length ? p.platforms.join('+') : (p.platform ?? 'general');
|
|
633
697
|
const when = p.publishedAt
|
|
634
698
|
? ` | published ${p.publishedAt}`
|
|
@@ -639,10 +703,10 @@ function postLine(p) {
|
|
|
639
703
|
}
|
|
640
704
|
/** List of posts with pagination context. */
|
|
641
705
|
export function cardListResult(result) {
|
|
642
|
-
if (!result.
|
|
643
|
-
return text('No
|
|
644
|
-
const more = result.hasMore ? ` (showing ${result.
|
|
645
|
-
return text([`${result.total}
|
|
706
|
+
if (!result.cards.length)
|
|
707
|
+
return text('No cards found.');
|
|
708
|
+
const more = result.hasMore ? ` (showing ${result.cards.length} of ${result.total}; raise limit/offset for more)` : '';
|
|
709
|
+
return text([`${result.total} card(s)${more}:`, ...result.cards.map(cardLine)].join('\n'));
|
|
646
710
|
}
|
|
647
711
|
/** A single post summary line (create / update / schedule / archive results). */
|
|
648
712
|
export function postSummaryResult(p, prefix = 'Post') {
|
|
@@ -652,7 +716,7 @@ export function postSummaryResult(p, prefix = 'Post') {
|
|
|
652
716
|
const scheduled = p.scheduledAt ? ` | Scheduled: ${p.scheduledAt}` : '';
|
|
653
717
|
return text(`${prefix}: ${p.title || '(untitled)'} (id ${p.id}) | ${p.status}${stage}${scheduled}`);
|
|
654
718
|
}
|
|
655
|
-
/** One
|
|
719
|
+
/** One card in full, with its posts and assets. */
|
|
656
720
|
export function cardResult(p) {
|
|
657
721
|
return text(lines([
|
|
658
722
|
`${p.title || '(untitled)'} (id ${p.id}) | ${p.status} | platform: ${p.platform ?? 'general'}`,
|
|
@@ -663,8 +727,8 @@ export function cardResult(p) {
|
|
|
663
727
|
p.script ? `script: ${p.script}` : null,
|
|
664
728
|
p.notes ? `notes: ${p.notes}` : null,
|
|
665
729
|
p.tags?.length ? `tags: ${p.tags.join(', ')}` : null,
|
|
666
|
-
`
|
|
667
|
-
...p.
|
|
730
|
+
`posts (${p.posts.length}):`,
|
|
731
|
+
...p.posts.map((d) => {
|
|
668
732
|
const set = settingsKeys(d.platformSettings);
|
|
669
733
|
return ` - ${d.platform} (id ${d.id})${d.format ? ` ${d.format}` : ''} | ${d.status ?? 'draft'}${d.connectedAccountId ? ` | account ${d.connectedAccountId}` : ' | no connected account'}${set ? ` | settings: ${set}` : ''}`;
|
|
670
734
|
}),
|
|
@@ -714,7 +778,7 @@ export function stageListResult(stages) {
|
|
|
714
778
|
const rows = stages.map((s) => `- ${s.name} (id ${s.id}${s.slug ? `, slug ${s.slug}` : ''})${s.isDefault ? ' [default]' : ''}`);
|
|
715
779
|
return text([`${stages.length} stage(s) (in order):`, ...rows].join('\n'));
|
|
716
780
|
}
|
|
717
|
-
/** The non-empty keys of a
|
|
781
|
+
/** The non-empty keys of a post's platformSettings, for a compact summary. */
|
|
718
782
|
function settingsKeys(settings) {
|
|
719
783
|
if (!settings)
|
|
720
784
|
return null;
|
|
@@ -730,10 +794,10 @@ function settingsKeys(settings) {
|
|
|
730
794
|
});
|
|
731
795
|
return keys.length ? keys.join(', ') : null;
|
|
732
796
|
}
|
|
733
|
-
/** A created or updated
|
|
734
|
-
export function
|
|
797
|
+
/** A created or updated post. */
|
|
798
|
+
export function postResult(d) {
|
|
735
799
|
const set = settingsKeys(d.platformSettings);
|
|
736
|
-
return text(`
|
|
800
|
+
return text(`Post: ${d.platform} (id ${d.id})${d.format ? ` ${d.format}` : ''} | ${d.status ?? 'draft'}${d.connectedAccountId ? ` | account ${d.connectedAccountId}` : ' | no connected account (set one before publishing)'}${set ? ` | settings: ${set}` : ' | no settings (set platformSettings to make it publishable)'}.`);
|
|
737
801
|
}
|
|
738
802
|
/** An attached asset. */
|
|
739
803
|
export function assetResult(a) {
|
|
@@ -752,9 +816,9 @@ export function assetOrderResult(assets) {
|
|
|
752
816
|
export function assetRemovedResult(r) {
|
|
753
817
|
return text(`Asset removed (id ${r.id}).`);
|
|
754
818
|
}
|
|
755
|
-
/** Confirmation of a detached
|
|
756
|
-
export function
|
|
757
|
-
return text(`
|
|
819
|
+
/** Confirmation of a detached post. */
|
|
820
|
+
export function postRemovedResult(r) {
|
|
821
|
+
return text(`Post removed (id ${r.id}).`);
|
|
758
822
|
}
|
|
759
823
|
/** The account's tags. */
|
|
760
824
|
export function tagListResult(tags) {
|
|
@@ -770,15 +834,15 @@ export function tagResult(t, verb = 'Tag') {
|
|
|
770
834
|
export function tagDeletedResult(r) {
|
|
771
835
|
return text(`Tag deleted (id ${r.id}). It was removed from all posts.`);
|
|
772
836
|
}
|
|
773
|
-
/** The result of publishing a
|
|
837
|
+
/** The result of publishing a card's posts (one outcome per post). */
|
|
774
838
|
export function publishResult(r) {
|
|
775
839
|
if (!r.results.length) {
|
|
776
|
-
return text('Nothing to publish: this
|
|
840
|
+
return text('Nothing to publish: this card has no posts. Add one with update_card first.', true);
|
|
777
841
|
}
|
|
778
842
|
const rows = r.results.map((d) => d.success
|
|
779
843
|
? `- ${d.platform}: published${d.url ? ` | ${d.url}` : ''}`
|
|
780
844
|
: `- ${d.platform}: FAILED | ${d.error ?? 'unknown error'}`);
|
|
781
|
-
const header = `Published ${r.publishedCount}/${r.results.length}
|
|
845
|
+
const header = `Published ${r.publishedCount}/${r.results.length} post(s)${r.failedCount ? `, ${r.failedCount} failed` : ''}:`;
|
|
782
846
|
return text([header, ...rows].join('\n'), r.publishedCount === 0);
|
|
783
847
|
}
|
|
784
848
|
// -- inspiration / research ---------------------------------------------------
|
|
@@ -897,7 +961,7 @@ export function connectedAccountResult(a) {
|
|
|
897
961
|
a.accountUrl ? `url: ${a.accountUrl}` : null,
|
|
898
962
|
caps.length ? `capabilities: ${caps.join(', ')}` : null,
|
|
899
963
|
a.lastValidatedAt ? `last validated: ${a.lastValidatedAt}` : null,
|
|
900
|
-
`Use this id as connectedAccountId on
|
|
964
|
+
`Use this id as connectedAccountId on a post in update_card to publish here.`,
|
|
901
965
|
]));
|
|
902
966
|
}
|
|
903
967
|
/** Map any thrown error onto a readable isError result. */
|
|
@@ -991,7 +1055,7 @@ const PROJECT_DETAIL_EXPOSURE = {
|
|
|
991
1055
|
favoritedAt: 'omitted: lifecycle state, surfaced by list_projects',
|
|
992
1056
|
createdAt: 'omitted: list metadata',
|
|
993
1057
|
updatedAt: 'omitted: superseded by revision, which is the token that actually matters here',
|
|
994
|
-
|
|
1058
|
+
exportedCardId: 'omitted: publishing workflow, owned by the card tools',
|
|
995
1059
|
exportedUrl: 'omitted: publishing workflow, owned by the post tools',
|
|
996
1060
|
shareId: 'omitted: sharing workflow, no editing effect',
|
|
997
1061
|
};
|