@lightcone-ai/daemon 0.14.14 → 0.14.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightcone-ai/daemon",
3
- "version": "0.14.14",
3
+ "version": "0.14.15",
4
4
  "type": "module",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -17,6 +17,7 @@ import {
17
17
  VIDEO_MIME,
18
18
  writeLocalFileToWorkspace,
19
19
  } from './workspace-file-upload.js';
20
+ import { runSubmitToLibraryTool } from './submit-to-library-tool.js';
20
21
  import { isLeaseInvalidated, clearInvalidatedLease } from './governance-state.js';
21
22
  import { classifyLeaseWindow } from './lease-window.js';
22
23
 
@@ -197,6 +198,7 @@ const DEFAULT_TOOL_CLASSIFICATION = {
197
198
  request_credential_auth: 'mandatory',
198
199
  generate_voiceover: 'mandatory',
199
200
  compose_video: 'mandatory',
201
+ submit_to_library: 'mandatory',
200
202
  register_data_source: 'mandatory',
201
203
  bind_workspace_scenario: 'mandatory',
202
204
  create_workspace: 'mandatory',
@@ -254,6 +256,7 @@ const CACHE_INVALIDATION_TOOLS = new Set([
254
256
  'supersede_goal_field',
255
257
  'request_credential_auth',
256
258
  'register_data_source',
259
+ 'submit_to_library',
257
260
  'bind_workspace_scenario',
258
261
  'create_workspace',
259
262
  'rename_workspace',
@@ -331,6 +334,7 @@ function inferToolForApi(method, apiPath, body) {
331
334
  if (method === 'POST' && cleanPath === '/goal-fields/supersede') return 'supersede_goal_field';
332
335
  if (method === 'POST' && cleanPath === '/credential-auth/request') return 'request_credential_auth';
333
336
  if (method === 'POST' && cleanPath === '/tts/voiceover') return 'generate_voiceover';
337
+ if (method === 'POST' && cleanPath === '/content-library/submit') return 'submit_to_library';
334
338
  if (method === 'POST' && cleanPath === '/api/data-sources') return 'register_data_source';
335
339
  if (method === 'POST' && cleanPath === '/orchestrate/decision') return 'write_governance_decision';
336
340
  if (method === 'POST' && cleanPath === '/orchestrate/correction') return 'write_governance_correction';
@@ -1503,6 +1507,26 @@ server.tool('compose_video',
1503
1507
  }
1504
1508
  );
1505
1509
 
1510
+ // ── submit_to_library ──────────────────────────────────────────────────────────
1511
+ server.tool('submit_to_library',
1512
+ '把已生成的视频成片归档进内容库(content_video_draft entry)。调用前 mp4 必须已经通过 write_workspace_file 落到 workspace 的 artifacts/ 路径。归档后内容库会出现一张新卡片,含视频预览 + 元数据 + 后续支持发布/回采链路。',
1513
+ {
1514
+ video_path: z.string().describe('Workspace-relative video path, e.g. "artifacts/foo.mp4"'),
1515
+ title: z.string().optional().describe('Library card 标题;若省略由系统从 understanding 推导'),
1516
+ summary: z.string().optional().describe('一句话摘要'),
1517
+ source_url: z.string().optional().describe('原始 URL(如有)'),
1518
+ target_platform: z.string().optional().describe('目标发布平台,如 xhs / douyin'),
1519
+ metadata: z.record(z.any()).optional().describe('其它 metadata(brand_voice / persona / account / goal_state 等)'),
1520
+ understanding: z.record(z.any()).optional().describe('analyze_page 输出'),
1521
+ plan: z.record(z.any()).optional().describe('plan_video / detail_sections 输出'),
1522
+ },
1523
+ async (args) => runSubmitToLibraryTool({
1524
+ args,
1525
+ currentWorkspaceId,
1526
+ apiFn: api,
1527
+ })
1528
+ );
1529
+
1506
1530
  // ── register_data_source ───────────────────────────────────────────────────────
1507
1531
  server.tool('register_data_source',
1508
1532
  'Register a workspace data source without binding credential yet. Returns a one-time secure auth URL (10-minute expiry) that should be sent to the user via IM.',
@@ -0,0 +1,39 @@
1
+ function toolText(text) {
2
+ return { content: [{ type: 'text', text }] };
3
+ }
4
+
5
+ function toolError(text) {
6
+ return { isError: true, content: [{ type: 'text', text }] };
7
+ }
8
+
9
+ export function buildSubmitToLibraryBody(args = {}, workspaceId = '') {
10
+ return {
11
+ ...(args ?? {}),
12
+ workspace_id: workspaceId,
13
+ };
14
+ }
15
+
16
+ export async function runSubmitToLibraryTool({
17
+ args = {},
18
+ currentWorkspaceId = '',
19
+ apiFn,
20
+ } = {}) {
21
+ if (!currentWorkspaceId) {
22
+ return toolError('No workspace context.');
23
+ }
24
+ if (typeof apiFn !== 'function') {
25
+ return toolError('Error: submit_to_library apiFn is required.');
26
+ }
27
+ try {
28
+ const data = await apiFn(
29
+ 'POST',
30
+ '/content-library/submit',
31
+ buildSubmitToLibraryBody(args, currentWorkspaceId)
32
+ );
33
+ return toolText(
34
+ `Submitted to content library: itemId=${data.itemId}, version=${data.version}, kind=${data.kind ?? 'content_video_draft'}`
35
+ );
36
+ } catch (err) {
37
+ return toolError(`Error: ${err.message}`);
38
+ }
39
+ }