@lightcone-ai/daemon 0.15.73 → 0.15.74
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 +1 -1
- package/src/chat-bridge.js +36 -1
package/package.json
CHANGED
package/src/chat-bridge.js
CHANGED
|
@@ -1521,6 +1521,41 @@ server.tool('register_data_source',
|
|
|
1521
1521
|
}
|
|
1522
1522
|
);
|
|
1523
1523
|
|
|
1524
|
+
// ── list_publish_accounts ─────────────────────────────────────────────────────
|
|
1525
|
+
server.tool('list_publish_accounts',
|
|
1526
|
+
'List the platform accounts bound to a workspace and the selectors you can pass as credential_id when publishing via request_approval (the account display name, a role alias like 主号/矩阵号/测试号, or the account UUID). Call this before publishing whenever the workspace might have more than one account on the target platform — do NOT guess account names or ask the user to re-type one you can look up here.',
|
|
1527
|
+
{
|
|
1528
|
+
workspace: z.string().optional().describe('Target #workspace-name. Defaults to the current workspace.'),
|
|
1529
|
+
platform: z.string().optional().describe('Optional platform filter, e.g. "xhs", "kuaishou", "douyin", "bilibili".'),
|
|
1530
|
+
},
|
|
1531
|
+
async ({ workspace, platform }) => {
|
|
1532
|
+
const targetWorkspace = String(workspace ?? currentWorkspaceId ?? WORKSPACE_ID ?? '').trim();
|
|
1533
|
+
if (!targetWorkspace) {
|
|
1534
|
+
return { isError: true, content: [{ type: 'text', text: 'workspace is required (no current workspace context).' }] };
|
|
1535
|
+
}
|
|
1536
|
+
try {
|
|
1537
|
+
const params = new URLSearchParams({ workspace: targetWorkspace });
|
|
1538
|
+
if (platform && String(platform).trim()) params.set('platform', String(platform).trim());
|
|
1539
|
+
const data = await api('GET', `/workspace-accounts?${params}`);
|
|
1540
|
+
const accounts = Array.isArray(data.accounts) ? data.accounts : [];
|
|
1541
|
+
if (accounts.length === 0) {
|
|
1542
|
+
return { content: [{ type: 'text', text: platform ? `No ${platform} account is bound to this workspace.` : 'No platform accounts are bound to this workspace.' }] };
|
|
1543
|
+
}
|
|
1544
|
+
const text = accounts.map((a) => {
|
|
1545
|
+
const name = a.display_name ?? a.account_id ?? 'unknown';
|
|
1546
|
+
const role = a.account_role ? ` [${a.account_role}]` : '';
|
|
1547
|
+
const sels = Array.isArray(a.selectors) && a.selectors.length
|
|
1548
|
+
? ` — credential_id can be: ${a.selectors.join(' / ')}`
|
|
1549
|
+
: '';
|
|
1550
|
+
return `- ${a.platform ?? '?'} / ${name}${role}${sels}`;
|
|
1551
|
+
}).join('\n');
|
|
1552
|
+
return { content: [{ type: 'text', text }] };
|
|
1553
|
+
} catch (err) {
|
|
1554
|
+
return { isError: true, content: [{ type: 'text', text: `Error: ${err.message}` }] };
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
);
|
|
1558
|
+
|
|
1524
1559
|
// ── request_approval ──────────────────────────────────────────────────────────
|
|
1525
1560
|
server.tool('request_approval',
|
|
1526
1561
|
'Request human approval before executing a sensitive platform action (posting, sending, publishing). Returns an action_id. After the human approves, call execute_approved_action with that ID.',
|
|
@@ -1529,7 +1564,7 @@ server.tool('request_approval',
|
|
|
1529
1564
|
platform: z.string().describe('Target platform, e.g. "x", "xhs", "email"'),
|
|
1530
1565
|
description: z.string().describe('Human-readable summary of what will happen if approved'),
|
|
1531
1566
|
payload: z.record(z.any()).describe('Full action parameters (content, media_urls, etc.)'),
|
|
1532
|
-
credential_id: z.string().optional().describe('Which account/credential to use. Accepts a workspace account_id, a real credential UUID, the account display name, or a role alias (主号/main/primary, 矩阵号/matrix/secondary, 测试号/test/incubator) — any value works as long as it uniquely matches one workspace account on the target platform. If publishing fails with publish_account_selection_required/ambiguous, pick a value from the returned candidates\' "selectors" list yourself instead of asking the user to re-type an account name.'),
|
|
1567
|
+
credential_id: z.string().optional().describe('Which account/credential to use. Accepts a workspace account_id, a real credential UUID, the account display name, or a role alias (主号/main/primary, 矩阵号/matrix/secondary, 测试号/test/incubator) — any value works as long as it uniquely matches one workspace account on the target platform. When the workspace may have several accounts on the platform, call list_publish_accounts first and pass one of the returned "selectors". If publishing still fails with publish_account_selection_required/ambiguous, pick a value from the returned candidates\' "selectors" list yourself instead of asking the user to re-type an account name.'),
|
|
1533
1568
|
},
|
|
1534
1569
|
async ({ action_type, platform, description, payload, credential_id }) => {
|
|
1535
1570
|
try {
|