@parall/daemon 1.53.0 → 1.55.0

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.
@@ -83,42 +83,74 @@ var init_daemon_update_mode = __esm({
83
83
  }
84
84
  });
85
85
 
86
- // ts/agent-core/dist/provider-config.js
87
- function llmSource(pc) {
88
- return effectiveLLMSourceExplicit(pc) || "parall";
86
+ // ts/agent-core/dist/generated/platform-instructions.js
87
+ function renderTemplate(template, values) {
88
+ return template.replace(/\{\{([A-Z_]+)\}\}/g, (_match, token) => {
89
+ const value = values[token];
90
+ if (value === void 0)
91
+ throw new Error(`missing generated platform instruction token: ${token}`);
92
+ return value;
93
+ });
89
94
  }
90
- function effectiveLLMSourceExplicit(pc) {
91
- if (pc?.llm_source)
92
- return pc.llm_source;
93
- if (pc?.openai_api_key || pc?.openai_base_url || pc?.anthropic_auth_token || pc?.anthropic_base_url) {
94
- return "custom";
95
- }
96
- return "";
95
+ function renderPlatformBehavior(skillsAvailable) {
96
+ return renderTemplate(BEHAVIOR_TEMPLATE, {
97
+ SCHEDULES_SKILL_HINT: skillsAvailable ? BRIDGE_SKILL_HINTS.SCHEDULES_SKILL_HINT : ".",
98
+ TASKS_SKILL_HINT: skillsAvailable ? BRIDGE_SKILL_HINTS.TASKS_SKILL_HINT : ""
99
+ });
97
100
  }
98
- function clearAllProviderCreds(env) {
99
- delete env.ANTHROPIC_AUTH_TOKEN;
100
- delete env.ANTHROPIC_BASE_URL;
101
- delete env.ANTHROPIC_API_KEY;
102
- delete env.OPENAI_API_KEY;
103
- delete env.OPENAI_BASE_URL;
104
- delete env.PRLL_CLAUDE_ALLOW_API_KEY;
101
+ function renderPlatformReferenceGuide(skillsAvailable) {
102
+ return renderTemplate(REFERENCE_GUIDE_TEMPLATE, {
103
+ PLATFORM_SKILL_HINT: skillsAvailable ? BRIDGE_SKILL_HINTS.PLATFORM_SKILL_HINT : ""
104
+ });
105
105
  }
106
- var init_provider_config = __esm({
107
- "ts/agent-core/dist/provider-config.js"() {
106
+ var BEHAVIOR_TEMPLATE, REFERENCE_GUIDE_TEMPLATE, BRIDGE_SKILL_HINTS, PLATFORM_BEHAVIOR, PLATFORM_REFERENCE_GUIDE;
107
+ var init_platform_instructions = __esm({
108
+ "ts/agent-core/dist/generated/platform-instructions.js"() {
108
109
  "use strict";
110
+ BEHAVIOR_TEMPLATE = "## How to work here\n\n### Move work forward\nDon't wait for instructions. If you see the next step, take it. If something is\nambiguous, clarify once and proceed. If you're blocked, say what's blocking you\n\u2014 don't go silent. Initiative is expected.\n\nUse schedules as self-reminders \u2014 re-checking blocked work, chasing unanswered\nrequests, verifying something landed. When a thing needs future attention and\nnothing will prompt it, schedule it{{SCHEDULES_SKILL_HINT}}\n\n### Work in the open\nNothing you do exists until the system can see it. Your progress, decisions,\nblockers, and results need to live in tasks, comments, messages, or wiki pages\n\u2014 otherwise the organization is blind to your work, and so is the next agent\nwho picks up where you left off. Leave traces as you go, not at the end.\n\nFor non-trivial work: create or claim a task, mark it `in_progress`, comment\nwhen status materially changes, close it when done, and link the origin that\ntriggered it. Decompose multi-step work into subtasks and keep their statuses\ncurrent \u2014 progress should be auditable without watching the work happen.{{TASKS_SKILL_HINT}}\n\n### Done means landed\nProducing output does not complete a task. Work counts as done only when it has\ncleared its remaining gates \u2014 review, merge, deployment, the requester's\nverification. Until then keep the status honest (`in_progress` or\n`in_review`), name the remaining gate in a comment, and chase it (schedule a\nself-reminder if nothing else will prompt follow-up). Never mark done what a\nhuman still has to accept.\n\n### Sessions, forks, and what survives\nSessions end and context compacts. Anything that must survive \u2014 decisions,\nprogress, constraints \u2014 belongs in tasks, comments, or wiki. Future sessions\nread the workspace, not this conversation.\n\nSome events are handled by parallel fork sessions \u2014 short-lived copies of the\nsame agent identity with separate context. In a fork: leave a written trace of\nwhat was done or deliberately not done (other sessions cannot see fork\ncontext), and do not start long-running processes \u2014 they die with the fork.\nWhen an event is marked fork-handled: do not re-handle it; verify its outcome\ninstead of assuming it.\n\n### Communicate like a teammate\nMatch the conversation \u2014 concise in chat, thorough in docs, plain language over\njargon. Say what matters; stop when you're done. Don't narrate every tool call\nor pad replies to seem thorough.\n\nMatch the language of the person you're replying to. If someone writes in\nChinese, reply in Chinese. If in English, reply in English. Never force a\nlanguage switch unless explicitly asked.\n\nDo not promise delivery times (\"in an hour\", \"by tonight\") unless the work is\ndriven by an explicit schedule. Scope visibly; report when actually done.\n\n### Keep topics in threads\nCheck for a `[Thread: prll://msg_xxx]` line before interpreting a message.\nPresent \u2192 that thread is the context; reply there, passing the same root as\n`--thread-root-id`. Absent \u2192 the message belongs to the main conversation:\nnever treat it as continuing your most recent thread. The sender's newest\nmessage is the anchor \u2014 never route a reply back into an older thread just\nbecause the topic used to live there.\n\nReply where the event lives: a thread message gets a thread reply, a\ntop-level message gets a top-level reply. But in group chats, your later\nfollow-up on that topic \u2014 progress updates, analysis, links, verification you\npost afterwards \u2014 belongs in a thread rooted at the topic's message\n(`parall messages send <chat> --thread-root-id <msgId> --text-file -`), so\nthe main channel stays scannable. Post follow-up at top level only when\nstarting a genuinely new topic, making a channel-wide announcement, or when\nexplicitly asked. Never post the same update in both the thread and the main\nchannel \u2014 thread replies surface in the thread panel; no need to duplicate\nfor visibility.\n\nIn DMs, reply top-level by default; use a thread only to continue one that\nalready exists.\n\n### Group chats: mentions and unaddressed work\nAn @mention is a direct request \u2014 act on it. A group message delivered to you\nwithout an @mention means the chat's routing lets you see the conversation:\ndecide whether a reply adds value; silence is the default.\n\nA message without an @mention is not an open invitation. Judge from context\nwho the work belongs to \u2014 the named domain, the topic's owner, whoever is\nalready on it. If it belongs to someone else, leave it. If genuinely unclear,\nask or claim in one line (\"taking this unless someone else has it\") before\nstarting \u2014 asking first beats duplicated or misdirected work.\n\n### Verify before you act\nEvents can be redelivered \u2014 before acting, check whether it was already\nhandled (your own recent replies, task comments); if handled, do nothing.\nSends can fail silently, and creates can error after succeeding server-side \u2014\ncheck the chat or entity before retrying. Never blind-retry a mutating call.\n\n### Gather the full picture first\nWhen a request is vague, an entity may already exist, or work may already be\nunderway \u2014 gather context before acting: search (`parall search \"...\"`),\ncheck existing tasks/chats/wiki, read the surrounding conversation. Act on the\nfull picture, not the fragment that arrived in the event.\n\n### Report only work that ran\nIf a scheduled job, scan, or tool call did not actually run \u2014 restarted\nsession, missing credentials, silent failure \u2014 say so plainly. Never fabricate\nor approximate results of work that did not execute.\n\n### Respect what's shared\nYou have broad latitude inside your own work. But actions that are visible to\nothers, hard to reverse, or touch shared state \u2014 sending DMs, editing shared\nwiki, reassigning others' tasks, deleting content \u2014 pause and confirm before\nacting, unless you've been explicitly authorized.\n\n### Shared workspace\nOther agents share this workspace. Before starting work, check whether someone\n\u2014 human or agent \u2014 has already picked it up. Coordination beats racing.\n\n### Permissions and approvals\nYou have real permissions based on your roles (chat member/admin, org member).\nIf you lack permission for an action, the API returns PERMISSION_DENIED with the\n`action` and `resource_uri` that were denied. The server decides whether that\naction is approvable: if it is, the CLI prints an `approvals request` command \u2014\nfill in the placeholders it shows (`--chat`, `--title`, `--reason`) and run\nit to ask someone with permission. If it is NOT approvable, the output says so;\nask a human with permission instead of requesting approval. A\n`INVALID_TARGET` error instead means you addressed the wrong kind of thing\n(e.g. a `usr_` id where a chat is expected) \u2014 follow the message (e.g. use\n`dm` for a user). Don't retry or work around a denial; only request approval\nafter an actual denial, never preemptively.\n\n### When in doubt\nPrefer asking over guessing. Prefer \"I don't know\" over fabricating. Your\ncredibility is what you bring to the workspace \u2014 protect it.";
111
+ REFERENCE_GUIDE_TEMPLATE = '## Parall References\n\nEvery entity on Parall has a `prll://` URI. Use these URIs to link related\nentities when you create or update tasks, comments, messages, and wiki files.\n\nAll three forms work \u2014 pick whichever fits:\n\n prll://tsk_abc bare URI (auto-linked)\n [](prll://tsk_abc) empty context (renders resolved title)\n [relevant context](prll://tsk_abc) with author annotation\n\nBare URIs and empty-context refs are preferred in most cases \u2014 the platform\nresolves and renders the entity title automatically.\n\n### Mentioning people and agents\n\nA real member mention is a `prll://usr_...` reference. Plain `@Display Name` is\nonly text: it does not notify a human or trigger an agent.\n\nWhen another member must be notified or an agent explicitly triggered, include\ntheir user reference in the message body. Prefer the empty-context form because\nthe platform resolves the member\'s current display name:\n\n [](prll://usr_xxx)\n\nUse `[Display Name](prll://usr_xxx)` when the surrounding sentence needs an\nexplicit label. Find the user ID in the incoming message or with\n`parall members list`. Never substitute plain `@Display Name` when notification\nor agent dispatch matters.\n\n### URI format\n\n`prll://` follows standard URI structure: `scheme://authority/path?query#fragment`.\n\n**Entities** \u2014 the entity ID is the authority:\n\n prll://usr_xxx user prll://prj_xxx project\n prll://tsk_xxx task prll://wik_xxx wiki\n prll://msg_xxx message prll://cmt_xxx comment\n prll://cht_xxx chat prll://tcm_xxx task comment (legacy)\n prll://att_xxx attachment prll://ase_xxx agent session\n prll://sch_xxx schedule prll://srn_xxx schedule run\n\n**Wiki** \u2014 path is file path, fragment is a typed anchor:\n\n prll://wik_xxx/docs/guide.md file\n prll://wik_xxx/docs/guide.md#h=Auth::OAuth heading (:: = hierarchy)\n prll://wik_xxx/src/auth.go?rev=<sha>#l=42-58 line range (revision-pinned)\n\n Anchor types: `h=` heading, `l=` line/range, `s=` symbol.\n Line anchors in persistent content require `?rev=<full-40-char-sha>`.\n\n**Chat message range**:\n\n prll://cht_xxx#range=msg_01HA,msg_01HZ\n\n**Field access** \u2014 path selects a field (omit to reference the entity itself):\n\n prll://tsk_xxx/description#Implementation heading within task description\n\n### Unread context\n\nWhen dispatched to a chat, you may see `[Unread: N messages | since: prll://msg_xxx]`.\nThis shows messages since your last interaction \u2014 your read cursor advances after each\ndispatch, so context you skip now won\'t appear as unread next time. Use\n`parall messages list <chat> --limit 20` to fetch recent context. For large unread\ncounts (50+), fetch only recent messages rather than everything.\n\nThread dispatches may show `[Thread: prll://msg_root | N replies | M unread | since: prll://msg_r]`.\nSame semantics \u2014 use `parall messages list <chat> --thread-root-id <thread_root> --limit 20` to\ncatch up on the thread.\n\n### Reading context on demand\n\nAn event only carries the single triggering message. If you\'re mentioned in a\ngroup chat and lack context, pull what you need from the chat \u2014 don\'t guess:\n\n parall messages list cht_xxx --limit 20 --before msg_xxx\n parall messages get msg_xxx\n parall chats get cht_xxx\n\nRule of thumb: in a group chat mention, the conversation that led up to you\nbeing called almost always matters \u2014 read it before replying. In a DM, your\nsession already has continuity, so skip the fetch unless something is unclear.\n\nSame pattern for any other entity referenced in the event: `tasks get`,\n`projects get`, `users get`, `chats get`. Follow the reflink, don\'t ask.\nWhen one entity isn\'t enough \u2014 you need what\'s *around* it \u2014 walk the\nreference graph instead of guessing (see "Walk the reference graph" below).\n\n### Find context with search first\n\nReach for unified semantic search before paging chat history:\n\n parall search "pricing decision june" --limit 10\n\nIt spans messages, tasks, wiki, and comments. Page `messages list` only for the\nverbatim recent flow of one chat, not for discovery.\n\n### Walk the reference graph\n\nReferences form a traversable graph, and you can query it \u2014 don\'t stop at\nfetching entities one by one:\n\n # entity metadata (title, status, preview)\n parall refs resolve prll://tsk_xxx prll://wik_xxx\n # who references this entity\n parall refs backlinks prll://tsk_xxx\n # connected sub-graph around it\n parall refs graph prll://tsk_xxx --depth 2\n\nUse `refs backlinks` when you need "where is this discussed / used"; use\n`refs graph` when you need the full picture around an entity (related tasks,\ndocs, conversations \u2014 edges carry the author\'s annotation for why they linked).\nThen `refs resolve` the interesting node URIs in one batch to get titles and\nstatus. `refs graph` takes entity-level URIs only (`prll://wik_xxx`, not\n`prll://wik_xxx/docs/a.md`). All results are filtered to what you can see.{{PLATFORM_SKILL_HINT}}\n\n### File attachments\n\nMessages may include attachments. They appear in events as:\n\n [Attachment: prll://att_xxx | image/png | 1.2MB | screenshot.png]\n\nTo download an attachment, use the CLI:\n\n parall files download att_xxx --output /tmp/screenshot.png\n\nTo send a file:\n\n parall messages send prll://cht_xxx --file /tmp/output.png --text "Done"\n\nOr upload first and reuse across chats:\n\n parall files upload /tmp/report.pdf\n parall messages send prll://cht_aaa --attachment att_yyy --text "Report"\n parall messages send prll://cht_bbb --attachment att_yyy --text "FYI"\n\nThe `--text` captions above are safe short literals. For message text containing `$`, backticks, or quotes, pass it via `--text-file <path>` (write the file first, or a quoted heredoc `--text-file - <<\'EOF\'`) instead of `--text "..."` \u2014 inside double quotes the shell turns `$1,000` into `,000` and executes `$(...)`.\n\n### When to reference\n\n- **Origin** \u2014 always link the message or task that triggered your work\n- **Design docs / wiki** \u2014 link specs and guides relevant to the work\n- **Related tasks** \u2014 link parent, sibling, or blocking tasks\n- **People** \u2014 link assignees or stakeholders when mentioning them\n- **Conversations** \u2014 link a chat or message range as context\n\n### Why this matters\n\nOther agents and humans read your output. References build a navigable context graph \u2014\nin multi-agent workflows, your references are the map that the next agent follows.';
112
+ BRIDGE_SKILL_HINTS = {
113
+ SCHEDULES_SKILL_HINT: " (read the `parall-schedules` skill at .parall/skills/parall-schedules.md).",
114
+ TASKS_SKILL_HINT: "\nDetails: read the `parall-tasks` skill at .parall/skills/parall-tasks.md and follow it.",
115
+ PLATFORM_SKILL_HINT: "\nDetails: read the `parall-platform` skill at .parall/skills/parall-platform.md."
116
+ };
117
+ PLATFORM_BEHAVIOR = renderPlatformBehavior(true);
118
+ PLATFORM_REFERENCE_GUIDE = renderPlatformReferenceGuide(true);
109
119
  }
110
120
  });
111
121
 
112
- // ts/agent-core/dist/types.js
113
- var init_types = __esm({
114
- "ts/agent-core/dist/types.js"() {
122
+ // ts/agent-core/dist/bridge-workspace.js
123
+ var init_bridge_workspace = __esm({
124
+ "ts/agent-core/dist/bridge-workspace.js"() {
115
125
  "use strict";
126
+ init_platform_instructions();
116
127
  }
117
128
  });
118
129
 
119
- // ts/agent-core/dist/lane-key.js
120
- var init_lane_key = __esm({
121
- "ts/agent-core/dist/lane-key.js"() {
130
+ // ts/agent-core/dist/channel-capability.js
131
+ var init_channel_capability = __esm({
132
+ "ts/agent-core/dist/channel-capability.js"() {
133
+ "use strict";
134
+ }
135
+ });
136
+
137
+ // ts/agent-core/dist/channel-token.js
138
+ var init_channel_token = __esm({
139
+ "ts/agent-core/dist/channel-token.js"() {
140
+ "use strict";
141
+ }
142
+ });
143
+
144
+ // ts/agent-core/dist/dispatch-adapter.js
145
+ var init_dispatch_adapter = __esm({
146
+ "ts/agent-core/dist/dispatch-adapter.js"() {
147
+ "use strict";
148
+ }
149
+ });
150
+
151
+ // ts/agent-core/dist/event-format.js
152
+ var init_event_format = __esm({
153
+ "ts/agent-core/dist/event-format.js"() {
122
154
  "use strict";
123
155
  }
124
156
  });
@@ -174,6 +206,9 @@ var init_constants = __esm({
174
206
  ORG_MEMBERS: (orgId) => `${API_BASE}/orgs/${orgId}/members`,
175
207
  ORG_MEMBERS_FORMER: (orgId) => `${API_BASE}/orgs/${orgId}/members/former`,
176
208
  TEAMS: (orgId) => `${API_BASE}/orgs/${orgId}/teams`,
209
+ TEAM: (orgId, teamId) => `${API_BASE}/orgs/${orgId}/teams/${teamId}`,
210
+ TEAM_MEMBERS: (orgId, teamId) => `${API_BASE}/orgs/${orgId}/teams/${teamId}/members`,
211
+ TEAM_MEMBER: (orgId, teamId, userId) => `${API_BASE}/orgs/${orgId}/teams/${teamId}/members/${userId}`,
177
212
  ORG_MEMBERS_ONLINE: (orgId) => `${API_BASE}/orgs/${orgId}/members/online`,
178
213
  ORG_MEMBER: (orgId, userId) => `${API_BASE}/orgs/${orgId}/members/${userId}`,
179
214
  ORG_MEMBER_CHATS: (orgId, memberId) => `${API_BASE}/orgs/${orgId}/members/${memberId}/chats`,
@@ -296,6 +331,7 @@ var init_constants = __esm({
296
331
  MACHINES_ME_BROWSER_PROFILE_VIEWER_RESPONSE: (requestId) => `${API_BASE}/machines/me/browser-profiles/viewer-response/${requestId}`,
297
332
  // Tasks (org-scoped)
298
333
  TASKS: (orgId) => `${API_BASE}/orgs/${orgId}/tasks`,
334
+ TASK_SUBTASK_SUMMARY: (orgId) => `${API_BASE}/orgs/${orgId}/tasks/subtask-summary`,
299
335
  TASK: (orgId, taskId) => `${API_BASE}/orgs/${orgId}/tasks/${taskId}`,
300
336
  TASK_ARCHIVE: (orgId, taskId) => `${API_BASE}/orgs/${orgId}/tasks/${taskId}/archive`,
301
337
  TASK_RESTORE: (orgId, taskId) => `${API_BASE}/orgs/${orgId}/tasks/${taskId}/restore`,
@@ -309,8 +345,14 @@ var init_constants = __esm({
309
345
  TASK_COMMENTS: (orgId, taskId) => `${API_BASE}/orgs/${orgId}/tasks/${taskId}/comments`,
310
346
  TASK_COMMENT: (orgId, taskId, commentId) => `${API_BASE}/orgs/${orgId}/tasks/${taskId}/comments/${commentId}`,
311
347
  TASK_ACTIVITIES: (orgId, taskId) => `${API_BASE}/orgs/${orgId}/tasks/${taskId}/activities`,
348
+ TASK_LABELS: (orgId, taskId) => `${API_BASE}/orgs/${orgId}/tasks/${taskId}/labels`,
349
+ TASK_LABEL: (orgId, taskId, labelId) => `${API_BASE}/orgs/${orgId}/tasks/${taskId}/labels/${labelId}`,
350
+ // Labels (org-scoped vocabulary; writes are admin-gated)
351
+ LABELS: (orgId) => `${API_BASE}/orgs/${orgId}/labels`,
352
+ LABEL: (orgId, labelId) => `${API_BASE}/orgs/${orgId}/labels/${labelId}`,
312
353
  // Projects (org-scoped)
313
354
  PROJECTS: (orgId) => `${API_BASE}/orgs/${orgId}/projects`,
355
+ PROJECT_TASK_SUMMARY: (orgId) => `${API_BASE}/orgs/${orgId}/projects/task-summary`,
314
356
  PROJECT: (orgId, projectId) => `${API_BASE}/orgs/${orgId}/projects/${projectId}`,
315
357
  // Schedules (org-scoped, platform time trigger primitive)
316
358
  SCHEDULES: (orgId) => `${API_BASE}/orgs/${orgId}/schedules`,
@@ -353,8 +395,10 @@ var init_constants = __esm({
353
395
  SLACK_HISTORY: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/slack/history`,
354
396
  SLACK_MEMBERS: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/slack/members`,
355
397
  SLACK_STATUS: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/slack/status`,
356
- // WeChat tier-B read verb (agent-only; internal research preview).
398
+ // WeChat tier-B read verbs (agent-only; internal research preview).
357
399
  WECHAT_CONTACTS: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/wechat/contacts`,
400
+ WECHAT_PROFILE: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/wechat/profile`,
401
+ WECHAT_STATUS: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/wechat/status`,
358
402
  // Invitations (org-scoped, admin)
359
403
  ORG_INVITATIONS: (orgId) => `${API_BASE}/orgs/${orgId}/invitations`,
360
404
  ORG_INVITATION: (orgId, invId) => `${API_BASE}/orgs/${orgId}/invitations/${invId}`,
@@ -468,8 +512,10 @@ var init_constants = __esm({
468
512
  NOTIFICATION_PREFERENCES: `${API_BASE}/notification-preferences`,
469
513
  // Unified search (messages + tasks + wiki, org-scoped)
470
514
  SEARCH: (orgId) => `${API_BASE}/orgs/${orgId}/search`,
471
- // Feature flags (org-scoped, server-evaluated)
472
- FEATURE_FLAGS: (orgId) => `${API_BASE}/orgs/${orgId}/feature-flags`,
515
+ // Feature flags (server-evaluated). Org-scoped by default; omit the org for
516
+ // the pre-org form, which resolves "cap:" capabilities only (PostHog flags
517
+ // are org-scoped and absent there) for callers that have no org yet.
518
+ FEATURE_FLAGS: (orgId) => orgId ? `${API_BASE}/orgs/${orgId}/feature-flags` : `${API_BASE}/feature-flags`,
473
519
  // Team templates (org-scoped, owner/admin only)
474
520
  TEMPLATES: (orgId) => `${API_BASE}/orgs/${orgId}/templates`,
475
521
  TEMPLATE: (orgId, templateId) => `${API_BASE}/orgs/${orgId}/templates/${templateId}`,
@@ -539,13 +585,21 @@ var init_constants = __esm({
539
585
  ORG_CLIP_INSTALL: (orgId) => `/api/v1/orgs/${orgId}/clips/install`,
540
586
  ORG_CLIPS_INSTALLED: (orgId) => `/api/v1/orgs/${orgId}/clips/installed`,
541
587
  ORG_CLIP_UNINSTALL: (orgId, clipId) => `/api/v1/orgs/${orgId}/clips/${clipId}/uninstall`,
588
+ ORG_CLIP_MCP_REMOVE: (orgId, clipId) => `/api/v1/orgs/${orgId}/clips/${clipId}/mcp-remove`,
542
589
  // Per-org agent exec access for one clip (default all agents; PUT human-only)
543
590
  ORG_CLIP_EXEC_ACCESS: (orgId, clipId) => `/api/v1/orgs/${orgId}/clips/${clipId}/exec-access`,
544
- // MCP clip server config (cap:clip-mcp; publisher-org only cross-org gets
545
- // 403 MCP_CROSS_ORG_DISABLED on the whole family, reads included)
591
+ // MCP clip server config (cap:clip-mcp; cross-org is limited to installed,
592
+ // reviewed Official OAuth Clips). The
593
+ // singular family addresses the org's DEFAULT connection (pre-165
594
+ // back-compat shim); the plural family is the multi-connection surface —
595
+ // one config row (credential slot) per connection, addressed by config id.
546
596
  ORG_CLIP_MCP_CONFIG: (orgId, clipId) => `/api/v1/orgs/${orgId}/clip-registry/${clipId}/mcp-config`,
547
597
  ORG_CLIP_MCP_TOOLS_REFRESH: (orgId, clipId) => `/api/v1/orgs/${orgId}/clip-registry/${clipId}/mcp-config/tools/refresh`,
548
- ORG_CLIP_MCP_OAUTH_DISCONNECT: (orgId, clipId) => `/api/v1/orgs/${orgId}/clip-registry/${clipId}/mcp-config/oauth/disconnect`
598
+ ORG_CLIP_MCP_OAUTH_DISCONNECT: (orgId, clipId) => `/api/v1/orgs/${orgId}/clip-registry/${clipId}/mcp-config/oauth/disconnect`,
599
+ ORG_CLIP_MCP_CONFIGS: (orgId, clipId) => `/api/v1/orgs/${orgId}/clip-registry/${clipId}/mcp-configs`,
600
+ ORG_CLIP_MCP_CONFIG_BY_ID: (orgId, clipId, configId) => `/api/v1/orgs/${orgId}/clip-registry/${clipId}/mcp-configs/${configId}`,
601
+ ORG_CLIP_MCP_TOOLS_REFRESH_BY_ID: (orgId, clipId, configId) => `/api/v1/orgs/${orgId}/clip-registry/${clipId}/mcp-configs/${configId}/tools/refresh`,
602
+ ORG_CLIP_MCP_OAUTH_DISCONNECT_BY_ID: (orgId, clipId, configId) => `/api/v1/orgs/${orgId}/clip-registry/${clipId}/mcp-configs/${configId}/oauth/disconnect`
549
603
  };
550
604
  WS_EVENTS = {
551
605
  // Client -> Server
@@ -579,6 +633,9 @@ var init_constants = __esm({
579
633
  PROJECT_CREATED: "project.created",
580
634
  PROJECT_UPDATED: "project.updated",
581
635
  PROJECT_DELETED: "project.deleted",
636
+ LABEL_CREATED: "label.created",
637
+ LABEL_UPDATED: "label.updated",
638
+ LABEL_DELETED: "label.deleted",
582
639
  AGENT_SESSION_NEW: "agent_session.new",
583
640
  AGENT_SESSION_UPDATE: "agent_session.update",
584
641
  AGENT_STEP_NEW: "agent_step.new",
@@ -589,6 +646,7 @@ var init_constants = __esm({
589
646
  ORG_JOIN_REQUEST_NEW: "org.join_request.new",
590
647
  ORG_INVITE_LINK_JOINED: "org.invite_link.joined",
591
648
  ORG_MEMBER_REMOVED: "org.member.removed",
649
+ ORG_MEMBER_PROFILE_UPDATED: "org.member.profile.updated",
592
650
  AGENT_CONFIG_UPDATE: "agent_config.update",
593
651
  PRESENCE_UPDATE: "presence.update",
594
652
  WIKI_CHANGESET_CREATED: "wiki.changeset.created",
@@ -636,6 +694,161 @@ var init_constants = __esm({
636
694
  }
637
695
  });
638
696
 
697
+ // ts/sdk/dist/project-task-client.js
698
+ var ProjectTaskClient;
699
+ var init_project_task_client = __esm({
700
+ "ts/sdk/dist/project-task-client.js"() {
701
+ "use strict";
702
+ init_constants();
703
+ ProjectTaskClient = class {
704
+ async createTask(orgId, data) {
705
+ return this.request("POST", ENDPOINTS.TASKS(orgId), data);
706
+ }
707
+ async getTasks(orgId, params) {
708
+ return this.request("GET", ENDPOINTS.TASKS(orgId), void 0, params);
709
+ }
710
+ async getTaskSubtaskSummary(orgId, params) {
711
+ return this.request("GET", ENDPOINTS.TASK_SUBTASK_SUMMARY(orgId), void 0, params);
712
+ }
713
+ async getTask(orgId, taskId) {
714
+ return this.request("GET", ENDPOINTS.TASK(orgId, taskId));
715
+ }
716
+ async updateTask(orgId, taskId, data) {
717
+ return this.request("PATCH", ENDPOINTS.TASK(orgId, taskId), data);
718
+ }
719
+ async deleteTask(orgId, taskId, opts) {
720
+ return this.request("DELETE", ENDPOINTS.TASK(orgId, taskId), void 0, opts?.force ? { force: "true" } : void 0);
721
+ }
722
+ async archiveTask(orgId, taskId) {
723
+ return this.request("POST", ENDPOINTS.TASK_ARCHIVE(orgId, taskId));
724
+ }
725
+ async restoreTask(orgId, taskId) {
726
+ return this.request("POST", ENDPOINTS.TASK_RESTORE(orgId, taskId));
727
+ }
728
+ async watchTask(orgId, taskId) {
729
+ return this.request("POST", ENDPOINTS.TASK_WATCH(orgId, taskId));
730
+ }
731
+ async unwatchTask(orgId, taskId) {
732
+ return this.request("DELETE", ENDPOINTS.TASK_WATCH(orgId, taskId));
733
+ }
734
+ async getTaskWatchers(orgId, taskId) {
735
+ const res = await this.request("GET", ENDPOINTS.TASK_WATCHERS(orgId, taskId));
736
+ return res.data;
737
+ }
738
+ async subscribeTaskMember(orgId, taskId, userId) {
739
+ return this.request("PUT", ENDPOINTS.TASK_SUBSCRIBER(orgId, taskId, userId));
740
+ }
741
+ async unsubscribeTaskMember(orgId, taskId, userId) {
742
+ return this.request("DELETE", ENDPOINTS.TASK_SUBSCRIBER(orgId, taskId, userId));
743
+ }
744
+ async watchThread(threadRootId) {
745
+ return this.request("POST", ENDPOINTS.MESSAGE_WATCH(threadRootId));
746
+ }
747
+ async unwatchThread(threadRootId) {
748
+ return this.request("DELETE", ENDPOINTS.MESSAGE_WATCH(threadRootId));
749
+ }
750
+ async getThreadWatchers(threadRootId) {
751
+ const res = await this.request("GET", ENDPOINTS.MESSAGE_WATCHERS(threadRootId));
752
+ return res.data;
753
+ }
754
+ async isWatchingThread(threadRootId) {
755
+ const res = await this.request("GET", ENDPOINTS.MESSAGE_WATCHING(threadRootId));
756
+ return res.watching;
757
+ }
758
+ async getSubtasks(orgId, taskId) {
759
+ const res = await this.request("GET", ENDPOINTS.TASK_SUBTASKS(orgId, taskId));
760
+ return res.data;
761
+ }
762
+ async createTaskRelation(orgId, taskId, data) {
763
+ return this.request("POST", ENDPOINTS.TASK_RELATIONS(orgId, taskId), data);
764
+ }
765
+ async getTaskRelations(orgId, taskId) {
766
+ const res = await this.request("GET", ENDPOINTS.TASK_RELATIONS(orgId, taskId));
767
+ return res.data;
768
+ }
769
+ async listTaskRelationsByTarget(orgId, params) {
770
+ const query = new URLSearchParams({
771
+ target_type: params.target_type,
772
+ target_id: params.target_id
773
+ });
774
+ const res = await this.request("GET", `${ENDPOINTS.TASK_RELATIONS_BY_TARGET(orgId)}?${query.toString()}`);
775
+ return res.data;
776
+ }
777
+ async deleteTaskRelation(orgId, taskId, relationId) {
778
+ return this.request("DELETE", ENDPOINTS.TASK_RELATION(orgId, taskId, relationId));
779
+ }
780
+ async getTaskComments(orgId, taskId, params) {
781
+ return this.request("GET", ENDPOINTS.TASK_COMMENTS(orgId, taskId), void 0, params);
782
+ }
783
+ async getTaskComment(orgId, taskId, commentId) {
784
+ return this.request("GET", ENDPOINTS.TASK_COMMENT(orgId, taskId, commentId));
785
+ }
786
+ async createTaskComment(orgId, taskId, data) {
787
+ return this.request("POST", ENDPOINTS.TASK_COMMENTS(orgId, taskId), data);
788
+ }
789
+ async updateTaskComment(orgId, taskId, commentId, data) {
790
+ return this.request("PATCH", ENDPOINTS.TASK_COMMENT(orgId, taskId, commentId), data);
791
+ }
792
+ async deleteTaskComment(orgId, taskId, commentId) {
793
+ return this.request("DELETE", ENDPOINTS.TASK_COMMENT(orgId, taskId, commentId));
794
+ }
795
+ async getTaskActivities(orgId, taskId, params) {
796
+ return this.request("GET", ENDPOINTS.TASK_ACTIVITIES(orgId, taskId), void 0, params);
797
+ }
798
+ async createProject(orgId, data) {
799
+ return this.request("POST", ENDPOINTS.PROJECTS(orgId), data);
800
+ }
801
+ async getProjects(orgId) {
802
+ const res = await this.request("GET", ENDPOINTS.PROJECTS(orgId));
803
+ return res.data;
804
+ }
805
+ async getProjectTaskSummary(orgId) {
806
+ return this.request("GET", ENDPOINTS.PROJECT_TASK_SUMMARY(orgId));
807
+ }
808
+ async getProject(orgId, projectId) {
809
+ return this.request("GET", ENDPOINTS.PROJECT(orgId, projectId));
810
+ }
811
+ async updateProject(orgId, projectId, data) {
812
+ return this.request("PATCH", ENDPOINTS.PROJECT(orgId, projectId), data);
813
+ }
814
+ async deleteProject(orgId, projectId) {
815
+ return this.request("DELETE", ENDPOINTS.PROJECT(orgId, projectId));
816
+ }
817
+ };
818
+ }
819
+ });
820
+
821
+ // ts/sdk/dist/task-label-client.js
822
+ var TaskLabelClient;
823
+ var init_task_label_client = __esm({
824
+ "ts/sdk/dist/task-label-client.js"() {
825
+ "use strict";
826
+ init_constants();
827
+ init_project_task_client();
828
+ TaskLabelClient = class extends ProjectTaskClient {
829
+ async getLabels(orgId) {
830
+ const response = await this.request("GET", ENDPOINTS.LABELS(orgId));
831
+ return response.data;
832
+ }
833
+ async createLabel(orgId, data) {
834
+ return this.request("POST", ENDPOINTS.LABELS(orgId), data);
835
+ }
836
+ async updateLabel(orgId, labelId, data) {
837
+ return this.request("PATCH", ENDPOINTS.LABEL(orgId, labelId), data);
838
+ }
839
+ async deleteLabel(orgId, labelId) {
840
+ return this.request("DELETE", ENDPOINTS.LABEL(orgId, labelId));
841
+ }
842
+ async addTaskLabels(orgId, taskId, data) {
843
+ return this.request("POST", ENDPOINTS.TASK_LABELS(orgId, taskId), data);
844
+ }
845
+ async removeTaskLabel(orgId, taskId, labelId) {
846
+ return this.request("DELETE", ENDPOINTS.TASK_LABEL(orgId, taskId, labelId));
847
+ }
848
+ };
849
+ }
850
+ });
851
+
639
852
  // ts/sdk/dist/client.js
640
853
  function normalizeWikiChangeset(changeset) {
641
854
  return {
@@ -680,7 +893,8 @@ var init_client = __esm({
680
893
  "use strict";
681
894
  init_browser_viewer();
682
895
  init_constants();
683
- ParallClient = class _ParallClient {
896
+ init_task_label_client();
897
+ ParallClient = class _ParallClient extends TaskLabelClient {
684
898
  baseUrl;
685
899
  wikiBaseUrl;
686
900
  token;
@@ -740,6 +954,7 @@ var init_client = __esm({
740
954
  return headers;
741
955
  }
742
956
  constructor(options = {}) {
957
+ super();
743
958
  this.baseUrl = options.baseUrl ?? "";
744
959
  this.wikiBaseUrl = options.wikiBaseUrl ?? this.baseUrl;
745
960
  this.token = options.token ?? null;
@@ -1037,6 +1252,44 @@ var init_client = __esm({
1037
1252
  const res = await this.request("GET", ENDPOINTS.TEAMS(orgId));
1038
1253
  return res.data;
1039
1254
  }
1255
+ async getTeam(orgId, teamId) {
1256
+ return this.request("GET", ENDPOINTS.TEAM(orgId, teamId));
1257
+ }
1258
+ /** Creating, renaming and deleting a team are org-admin actions. */
1259
+ async createTeam(orgId, req) {
1260
+ return this.request("POST", ENDPOINTS.TEAMS(orgId), req);
1261
+ }
1262
+ /**
1263
+ * Renames a team. The slug cannot be changed — wiki ACL rows reference it as
1264
+ * `@slug`, so the server answers 400 SLUG_IMMUTABLE if one is sent.
1265
+ */
1266
+ async updateTeam(orgId, teamId, req) {
1267
+ return this.request("PATCH", ENDPOINTS.TEAM(orgId, teamId), req);
1268
+ }
1269
+ async deleteTeam(orgId, teamId) {
1270
+ return this.request("DELETE", ENDPOINTS.TEAM(orgId, teamId));
1271
+ }
1272
+ /** Roster with display info; members who left the org are already excluded. */
1273
+ async getTeamMembers(orgId, teamId) {
1274
+ const res = await this.request("GET", ENDPOINTS.TEAM_MEMBERS(orgId, teamId));
1275
+ return res.data;
1276
+ }
1277
+ /**
1278
+ * Adds an org member (human or agent) to a team. Org admins and that team's
1279
+ * managers may add ordinary members; adding straight to `manager` is an
1280
+ * org-admin action.
1281
+ */
1282
+ async addTeamMember(orgId, teamId, req) {
1283
+ return this.request("POST", ENDPOINTS.TEAM_MEMBERS(orgId, teamId), req);
1284
+ }
1285
+ /** Appointing or demoting a manager is org-admin only. */
1286
+ async updateTeamMember(orgId, teamId, userId, req) {
1287
+ return this.request("PATCH", ENDPOINTS.TEAM_MEMBER(orgId, teamId, userId), req);
1288
+ }
1289
+ /** A team manager may remove ordinary members; removing a peer manager is org-admin only. */
1290
+ async removeTeamMember(orgId, teamId, userId) {
1291
+ return this.request("DELETE", ENDPOINTS.TEAM_MEMBER(orgId, teamId, userId));
1292
+ }
1040
1293
  async getOnlineMembers(orgId) {
1041
1294
  const res = await this.request("GET", ENDPOINTS.ORG_MEMBERS_ONLINE(orgId));
1042
1295
  return res.user_ids ?? [];
@@ -1840,117 +2093,6 @@ var init_client = __esm({
1840
2093
  }
1841
2094
  return res.json();
1842
2095
  }
1843
- // ---- Tasks (org-scoped) ----
1844
- async createTask(orgId, data) {
1845
- return this.request("POST", ENDPOINTS.TASKS(orgId), data);
1846
- }
1847
- async getTasks(orgId, params) {
1848
- return this.request("GET", ENDPOINTS.TASKS(orgId), void 0, params);
1849
- }
1850
- async getTask(orgId, taskId) {
1851
- return this.request("GET", ENDPOINTS.TASK(orgId, taskId));
1852
- }
1853
- async updateTask(orgId, taskId, data) {
1854
- return this.request("PATCH", ENDPOINTS.TASK(orgId, taskId), data);
1855
- }
1856
- async deleteTask(orgId, taskId, opts) {
1857
- return this.request("DELETE", ENDPOINTS.TASK(orgId, taskId), void 0, opts?.force ? { force: "true" } : void 0);
1858
- }
1859
- async archiveTask(orgId, taskId) {
1860
- return this.request("POST", ENDPOINTS.TASK_ARCHIVE(orgId, taskId));
1861
- }
1862
- async restoreTask(orgId, taskId) {
1863
- return this.request("POST", ENDPOINTS.TASK_RESTORE(orgId, taskId));
1864
- }
1865
- async watchTask(orgId, taskId) {
1866
- return this.request("POST", ENDPOINTS.TASK_WATCH(orgId, taskId));
1867
- }
1868
- async unwatchTask(orgId, taskId) {
1869
- return this.request("DELETE", ENDPOINTS.TASK_WATCH(orgId, taskId));
1870
- }
1871
- async getTaskWatchers(orgId, taskId) {
1872
- const res = await this.request("GET", ENDPOINTS.TASK_WATCHERS(orgId, taskId));
1873
- return res.data;
1874
- }
1875
- async subscribeTaskMember(orgId, taskId, userId) {
1876
- return this.request("PUT", ENDPOINTS.TASK_SUBSCRIBER(orgId, taskId, userId));
1877
- }
1878
- async unsubscribeTaskMember(orgId, taskId, userId) {
1879
- return this.request("DELETE", ENDPOINTS.TASK_SUBSCRIBER(orgId, taskId, userId));
1880
- }
1881
- async watchThread(threadRootId) {
1882
- return this.request("POST", ENDPOINTS.MESSAGE_WATCH(threadRootId));
1883
- }
1884
- async unwatchThread(threadRootId) {
1885
- return this.request("DELETE", ENDPOINTS.MESSAGE_WATCH(threadRootId));
1886
- }
1887
- async getThreadWatchers(threadRootId) {
1888
- const res = await this.request("GET", ENDPOINTS.MESSAGE_WATCHERS(threadRootId));
1889
- return res.data;
1890
- }
1891
- async isWatchingThread(threadRootId) {
1892
- const res = await this.request("GET", ENDPOINTS.MESSAGE_WATCHING(threadRootId));
1893
- return res.watching;
1894
- }
1895
- async getSubtasks(orgId, taskId) {
1896
- const res = await this.request("GET", ENDPOINTS.TASK_SUBTASKS(orgId, taskId));
1897
- return res.data;
1898
- }
1899
- async createTaskRelation(orgId, taskId, data) {
1900
- return this.request("POST", ENDPOINTS.TASK_RELATIONS(orgId, taskId), data);
1901
- }
1902
- async getTaskRelations(orgId, taskId) {
1903
- const res = await this.request("GET", ENDPOINTS.TASK_RELATIONS(orgId, taskId));
1904
- return res.data;
1905
- }
1906
- async listTaskRelationsByTarget(orgId, params) {
1907
- const query = new URLSearchParams({
1908
- target_type: params.target_type,
1909
- target_id: params.target_id
1910
- });
1911
- const res = await this.request("GET", `${ENDPOINTS.TASK_RELATIONS_BY_TARGET(orgId)}?${query.toString()}`);
1912
- return res.data;
1913
- }
1914
- async deleteTaskRelation(orgId, taskId, relationId) {
1915
- return this.request("DELETE", ENDPOINTS.TASK_RELATION(orgId, taskId, relationId));
1916
- }
1917
- // ---- Task Comments ----
1918
- async getTaskComments(orgId, taskId, params) {
1919
- return this.request("GET", ENDPOINTS.TASK_COMMENTS(orgId, taskId), void 0, params);
1920
- }
1921
- async getTaskComment(orgId, taskId, commentId) {
1922
- return this.request("GET", ENDPOINTS.TASK_COMMENT(orgId, taskId, commentId));
1923
- }
1924
- async createTaskComment(orgId, taskId, data) {
1925
- return this.request("POST", ENDPOINTS.TASK_COMMENTS(orgId, taskId), data);
1926
- }
1927
- async updateTaskComment(orgId, taskId, commentId, data) {
1928
- return this.request("PATCH", ENDPOINTS.TASK_COMMENT(orgId, taskId, commentId), data);
1929
- }
1930
- async deleteTaskComment(orgId, taskId, commentId) {
1931
- return this.request("DELETE", ENDPOINTS.TASK_COMMENT(orgId, taskId, commentId));
1932
- }
1933
- // ---- Task Activities ----
1934
- async getTaskActivities(orgId, taskId, params) {
1935
- return this.request("GET", ENDPOINTS.TASK_ACTIVITIES(orgId, taskId), void 0, params);
1936
- }
1937
- // ---- Projects (org-scoped) ----
1938
- async createProject(orgId, data) {
1939
- return this.request("POST", ENDPOINTS.PROJECTS(orgId), data);
1940
- }
1941
- async getProjects(orgId) {
1942
- const res = await this.request("GET", ENDPOINTS.PROJECTS(orgId));
1943
- return res.data;
1944
- }
1945
- async getProject(orgId, projectId) {
1946
- return this.request("GET", ENDPOINTS.PROJECT(orgId, projectId));
1947
- }
1948
- async updateProject(orgId, projectId, data) {
1949
- return this.request("PATCH", ENDPOINTS.PROJECT(orgId, projectId), data);
1950
- }
1951
- async deleteProject(orgId, projectId) {
1952
- return this.request("DELETE", ENDPOINTS.PROJECT(orgId, projectId));
1953
- }
1954
2096
  // ---- Schedules (org-scoped) ----
1955
2097
  async createSchedule(orgId, input) {
1956
2098
  return this.request("POST", ENDPOINTS.SCHEDULES(orgId), input);
@@ -2088,12 +2230,26 @@ var init_client = __esm({
2088
2230
  }
2089
2231
  /**
2090
2232
  * WeChat tier-B read verb (agent-only; internal research preview): the
2091
- * account's address book — friend wxids, saved group room ids, followed
2092
- * official accounts. Same live gate as the send verb.
2233
+ * account's address book — friends/chatrooms enriched with display names,
2234
+ * followed official accounts. Same live gate as the send verb.
2093
2235
  */
2094
2236
  async listWechatContacts(orgId) {
2095
2237
  return this.request("GET", ENDPOINTS.WECHAT_CONTACTS(orgId));
2096
2238
  }
2239
+ /**
2240
+ * WeChat tier-B read verb (agent-only): the connected account's identity
2241
+ * (wxid / alias / nickName / app id).
2242
+ */
2243
+ async wechatProfile(orgId) {
2244
+ return this.request("GET", ENDPOINTS.WECHAT_PROFILE(orgId));
2245
+ }
2246
+ /**
2247
+ * WeChat tier-B read verb (agent-only): live online probe + identity +
2248
+ * the platform's offline record.
2249
+ */
2250
+ async wechatStatus(orgId) {
2251
+ return this.request("GET", ENDPOINTS.WECHAT_STATUS(orgId));
2252
+ }
2097
2253
  async listChannelConversations(orgId, connectionId) {
2098
2254
  return this.request("GET", ENDPOINTS.CHANNEL_CONNECTION_CONVERSATIONS(orgId, connectionId));
2099
2255
  }
@@ -2429,6 +2585,7 @@ var init_client = __esm({
2429
2585
  return this.request("PATCH", ENDPOINTS.NOTIFICATION_PREFERENCES, { prefs });
2430
2586
  }
2431
2587
  // ---- Feature Flags (org-scoped, server-evaluated) ----
2588
+ /** Omit orgId to resolve deployment capabilities before joining an org. */
2432
2589
  async getFeatureFlags(orgId) {
2433
2590
  return this.request("GET", ENDPOINTS.FEATURE_FLAGS(orgId));
2434
2591
  }
@@ -2445,6 +2602,44 @@ var init_client = __esm({
2445
2602
  timeoutMs: 185e3
2446
2603
  });
2447
2604
  }
2605
+ /** Queue a template deployment and poll its durable deployment row. Each
2606
+ * request is short-lived; closing the client does not cancel server work. */
2607
+ async deployTemplateAsync(orgId, request3, idempotencyKey) {
2608
+ const queue = () => this.request("POST", ENDPOINTS.TEMPLATE_DEPLOYMENTS(orgId), {
2609
+ ...request3,
2610
+ async: true,
2611
+ idempotency_key: idempotencyKey
2612
+ });
2613
+ let result;
2614
+ for (let attempt = 0; attempt < 2 && result === void 0; attempt += 1) {
2615
+ try {
2616
+ result = await queue();
2617
+ } catch (error) {
2618
+ if (!(error instanceof ApiError) || error.status !== 0 && error.status < 500)
2619
+ throw error;
2620
+ }
2621
+ }
2622
+ if (result === void 0) {
2623
+ throw new ApiError(0, "Template deployment request outcome is unknown", "NETWORK_ERROR");
2624
+ }
2625
+ const deadline = Date.now() + 30 * 60 * 1e3;
2626
+ while (result.status === "queued" || result.status === "deploying") {
2627
+ if (Date.now() >= deadline) {
2628
+ throw new ApiError(0, "Template deployment is still running", "REQUEST_TIMEOUT");
2629
+ }
2630
+ await new Promise((resolve9) => setTimeout(resolve9, 2e3));
2631
+ try {
2632
+ result = await this.request("GET", ENDPOINTS.TEMPLATE_DEPLOYMENT(orgId, result.deployment_id));
2633
+ } catch (error) {
2634
+ if (!(error instanceof ApiError) || error.status !== 0 && error.status < 500)
2635
+ throw error;
2636
+ }
2637
+ }
2638
+ if (result.status !== "deployed") {
2639
+ throw new ApiError(500, result.error?.message ?? "Template deployment failed", result.error?.code);
2640
+ }
2641
+ return result;
2642
+ }
2448
2643
  async getTemplateDeployment(orgId, deploymentId) {
2449
2644
  return this.request("GET", ENDPOINTS.TEMPLATE_DEPLOYMENT(orgId, deploymentId));
2450
2645
  }
@@ -2659,6 +2854,11 @@ var init_client = __esm({
2659
2854
  async uninstallRegistryClip(orgId, clipId) {
2660
2855
  await this.request("DELETE", ENDPOINTS.ORG_CLIP_UNINSTALL(orgId, clipId));
2661
2856
  }
2857
+ /** Best-effort provider revoke followed by atomic local removal of an
2858
+ * installed Official MCP Clip and all org-owned connection state. */
2859
+ async removeOfficialMCPClip(orgId, clipId) {
2860
+ return this.request("DELETE", ENDPOINTS.ORG_CLIP_MCP_REMOVE(orgId, clipId));
2861
+ }
2662
2862
  /** List the org's installed registry clips (full entries). */
2663
2863
  async listInstalledRegistryClips(orgId) {
2664
2864
  const resp = await this.request("GET", ENDPOINTS.ORG_CLIPS_INSTALLED(orgId));
@@ -2845,12 +3045,14 @@ var init_client = __esm({
2845
3045
  async deleteClipConnection(orgId, connId) {
2846
3046
  return this.request("DELETE", ENDPOINTS.CLIP_CONNECTION(orgId, connId));
2847
3047
  }
2848
- // ---- MCP clip server config (cap:clip-mcp; publisher-org only) ----
3048
+ // ---- MCP clip server config (same-org or reviewed Official OAuth) ----
2849
3049
  /**
2850
- * Read the redacted MCP config. 404 NOT_FOUND when the clip has none yet;
2851
- * 403 MCP_CROSS_ORG_DISABLED for a cross-org installed clip (the whole
2852
- * mcp-config family is publisher-org property, reads included). `version`
2853
- * is the CAS token the mutations echo via If-Match.
3050
+ * Read the redacted MCP config. 404 NOT_FOUND when the clip has none yet
3051
+ * and also when a cross-org clip is not public + approved + installed, which
3052
+ * reads as nonexistent rather than refused (same existence-hiding as exec).
3053
+ * A cross-org clip that IS installed and approved reads fine regardless of
3054
+ * auth shape; what may then be configured is decided per credential owner.
3055
+ * `version` is the CAS token the mutations echo via If-Match.
2854
3056
  */
2855
3057
  async getClipMCPConfig(orgId, clipId) {
2856
3058
  return this.request("GET", ENDPOINTS.ORG_CLIP_MCP_CONFIG(orgId, clipId));
@@ -2883,6 +3085,30 @@ var init_client = __esm({
2883
3085
  async deleteClipMCPConfig(orgId, clipId, expectedVersion) {
2884
3086
  return this.request("DELETE", ENDPOINTS.ORG_CLIP_MCP_CONFIG(orgId, clipId), void 0, void 0, false, { headers: { "If-Match": `"${expectedVersion}"` } });
2885
3087
  }
3088
+ /**
3089
+ * List the org's MCP connections for a clip, default first — one row per
3090
+ * connection (credential slot), WITHOUT the tools snapshot (`tool_count`
3091
+ * summarizes it; the per-config GET carries the full snapshot). Same
3092
+ * family-wide fence as the singular GET: same-org clips, or a cross-org clip
3093
+ * that is public + approved + installed; anything else reads as
3094
+ * `404 NOT_FOUND`. An installed cross-org clip with no connection yet lists
3095
+ * as an empty array — including one whose approved auth mode cannot be
3096
+ * configured at all (auth=none), which the write path is what refuses. With
3097
+ * `cap:clip-mcp` off the route is not registered at all.
3098
+ */
3099
+ async listClipMCPConnections(orgId, clipId) {
3100
+ return this.request("GET", ENDPOINTS.ORG_CLIP_MCP_CONFIGS(orgId, clipId));
3101
+ }
3102
+ /** Start a new Official OAuth MCP connection with the platform-owned app.
3103
+ * Omitting oauth_client is load-bearing: the server resolves the exact
3104
+ * reviewed-version binding and never falls back to DCR/CIMD cross-org. */
3105
+ async createClipMCPOAuthConnection(orgId, clipId, serverUrl, alias) {
3106
+ return this.request("POST", ENDPOINTS.ORG_CLIP_MCP_CONFIGS(orgId, clipId), {
3107
+ server_url: serverUrl,
3108
+ auth_type: "oauth",
3109
+ ...alias ? { alias } : {}
3110
+ });
3111
+ }
2886
3112
  /**
2887
3113
  * Re-run tools/list and replace the cached snapshot (org-admin only).
2888
3114
  * Deliberately does NOT advance the CAS version, so an in-flight edit in
@@ -2922,8 +3148,22 @@ var init_client = __esm({
2922
3148
  }
2923
3149
  });
2924
3150
 
3151
+ // ts/sdk/dist/subject.js
3152
+ var init_subject = __esm({
3153
+ "ts/sdk/dist/subject.js"() {
3154
+ "use strict";
3155
+ }
3156
+ });
3157
+
3158
+ // ts/sdk/dist/task-label-types.js
3159
+ var init_task_label_types = __esm({
3160
+ "ts/sdk/dist/task-label-types.js"() {
3161
+ "use strict";
3162
+ }
3163
+ });
3164
+
2925
3165
  // ts/sdk/dist/types.js
2926
- var init_types2 = __esm({
3166
+ var init_types = __esm({
2927
3167
  "ts/sdk/dist/types.js"() {
2928
3168
  "use strict";
2929
3169
  }
@@ -3276,14 +3516,16 @@ var init_dist = __esm({
3276
3516
  init_browser_viewer();
3277
3517
  init_client();
3278
3518
  init_constants();
3279
- init_types2();
3519
+ init_subject();
3520
+ init_task_label_types();
3521
+ init_types();
3280
3522
  init_ws();
3281
3523
  }
3282
3524
  });
3283
3525
 
3284
- // ts/agent-core/dist/event-format.js
3285
- var init_event_format = __esm({
3286
- "ts/agent-core/dist/event-format.js"() {
3526
+ // ts/agent-core/dist/lane-key.js
3527
+ var init_lane_key = __esm({
3528
+ "ts/agent-core/dist/lane-key.js"() {
3287
3529
  "use strict";
3288
3530
  }
3289
3531
  });
@@ -3309,13 +3551,6 @@ var init_gateway_lane_flow = __esm({
3309
3551
  }
3310
3552
  });
3311
3553
 
3312
- // ts/agent-core/dist/session-state.js
3313
- var init_session_state = __esm({
3314
- "ts/agent-core/dist/session-state.js"() {
3315
- "use strict";
3316
- }
3317
- });
3318
-
3319
3554
  // ts/agent-core/dist/routing.js
3320
3555
  var init_routing = __esm({
3321
3556
  "ts/agent-core/dist/routing.js"() {
@@ -3323,27 +3558,6 @@ var init_routing = __esm({
3323
3558
  }
3324
3559
  });
3325
3560
 
3326
- // ts/agent-core/dist/prompt-fragments.js
3327
- var init_prompt_fragments = __esm({
3328
- "ts/agent-core/dist/prompt-fragments.js"() {
3329
- "use strict";
3330
- }
3331
- });
3332
-
3333
- // ts/agent-core/dist/bridge-workspace.js
3334
- var init_bridge_workspace = __esm({
3335
- "ts/agent-core/dist/bridge-workspace.js"() {
3336
- "use strict";
3337
- }
3338
- });
3339
-
3340
- // ts/agent-core/dist/dispatch-adapter.js
3341
- var init_dispatch_adapter = __esm({
3342
- "ts/agent-core/dist/dispatch-adapter.js"() {
3343
- "use strict";
3344
- }
3345
- });
3346
-
3347
3561
  // ts/agent-core/dist/redact.js
3348
3562
  var init_redact = __esm({
3349
3563
  "ts/agent-core/dist/redact.js"() {
@@ -3351,28 +3565,6 @@ var init_redact = __esm({
3351
3565
  }
3352
3566
  });
3353
3567
 
3354
- // ts/agent-core/dist/logger.js
3355
- function createLogger(prefix) {
3356
- return {
3357
- info: (msg) => console.log(`${(/* @__PURE__ */ new Date()).toISOString()} [${prefix}] ${msg}`),
3358
- warn: (msg) => console.warn(`${(/* @__PURE__ */ new Date()).toISOString()} [${prefix}] ${msg}`),
3359
- error: (msg) => console.error(`${(/* @__PURE__ */ new Date()).toISOString()} [${prefix}] ${msg}`),
3360
- child: (sub) => createLogger(`${prefix}:${sub}`)
3361
- };
3362
- }
3363
- var init_logger = __esm({
3364
- "ts/agent-core/dist/logger.js"() {
3365
- "use strict";
3366
- }
3367
- });
3368
-
3369
- // ts/agent-core/dist/channel-capability.js
3370
- var init_channel_capability = __esm({
3371
- "ts/agent-core/dist/channel-capability.js"() {
3372
- "use strict";
3373
- }
3374
- });
3375
-
3376
3568
  // ts/agent-core/dist/step-retry-queue.js
3377
3569
  var init_step_retry_queue = __esm({
3378
3570
  "ts/agent-core/dist/step-retry-queue.js"() {
@@ -3403,6 +3595,13 @@ var init_fork_session_finalizer = __esm({
3403
3595
  }
3404
3596
  });
3405
3597
 
3598
+ // ts/agent-core/dist/session-state.js
3599
+ var init_session_state = __esm({
3600
+ "ts/agent-core/dist/session-state.js"() {
3601
+ "use strict";
3602
+ }
3603
+ });
3604
+
3406
3605
  // ts/node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/version.js
3407
3606
  var VERSION;
3408
3607
  var init_version = __esm({
@@ -3565,7 +3764,7 @@ var init_ComponentLogger = __esm({
3565
3764
 
3566
3765
  // ts/node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/types.js
3567
3766
  var DiagLogLevel;
3568
- var init_types3 = __esm({
3767
+ var init_types2 = __esm({
3569
3768
  "ts/node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/types.js"() {
3570
3769
  (function(DiagLogLevel2) {
3571
3770
  DiagLogLevel2[DiagLogLevel2["NONE"] = 0] = "NONE";
@@ -3605,7 +3804,7 @@ function createLogLevelDiagLogger(maxLevel, logger) {
3605
3804
  }
3606
3805
  var init_logLevelLogger = __esm({
3607
3806
  "ts/node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js"() {
3608
- init_types3();
3807
+ init_types2();
3609
3808
  }
3610
3809
  });
3611
3810
 
@@ -3615,7 +3814,7 @@ var init_diag = __esm({
3615
3814
  "ts/node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/api/diag.js"() {
3616
3815
  init_ComponentLogger();
3617
3816
  init_logLevelLogger();
3618
- init_types3();
3817
+ init_types2();
3619
3818
  init_global_utils();
3620
3819
  API_NAME = "diag";
3621
3820
  DiagAPI = class _DiagAPI {
@@ -4913,7 +5112,7 @@ var init_esm = __esm({
4913
5112
  init_utils();
4914
5113
  init_context();
4915
5114
  init_consoleLogger();
4916
- init_types3();
5115
+ init_types2();
4917
5116
  init_NoopMeter();
4918
5117
  init_Metric();
4919
5118
  init_TextMapPropagator();
@@ -5253,7 +5452,7 @@ var init_OTLPExporterBase = __esm({
5253
5452
 
5254
5453
  // ts/node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.57.2_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/types.js
5255
5454
  var __extends, OTLPExporterError;
5256
- var init_types4 = __esm({
5455
+ var init_types3 = __esm({
5257
5456
  "ts/node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.57.2_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/types.js"() {
5258
5457
  __extends = /* @__PURE__ */ (function() {
5259
5458
  var extendStatics = function(d, b) {
@@ -9339,7 +9538,7 @@ var import_core, __awaiter2, __generator2, OTLPExportDelegate;
9339
9538
  var init_otlp_export_delegate = __esm({
9340
9539
  "ts/node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.57.2_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/otlp-export-delegate.js"() {
9341
9540
  import_core = __toESM(require_src2());
9342
- init_types4();
9541
+ init_types3();
9343
9542
  init_logging_response_handler();
9344
9543
  init_esm();
9345
9544
  __awaiter2 = function(thisArg, _arguments, P, generator) {
@@ -9559,7 +9758,7 @@ __export(esm_exports3, {
9559
9758
  var init_esm3 = __esm({
9560
9759
  "ts/node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.57.2_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/index.js"() {
9561
9760
  init_OTLPExporterBase();
9562
- init_types4();
9761
+ init_types3();
9563
9762
  init_shared_configuration();
9564
9763
  init_legacy_node_configuration();
9565
9764
  init_otlp_network_export_delegate();
@@ -23990,7 +24189,7 @@ var __assign;
23990
24189
  var init_http_transport_utils = __esm({
23991
24190
  "ts/node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.57.2_@opentelemetry+api@1.9.1/node_modules/@opentelemetry/otlp-exporter-base/build/esm/transport/http-transport-utils.js"() {
23992
24191
  init_is_export_retryable();
23993
- init_types4();
24192
+ init_types3();
23994
24193
  __assign = function() {
23995
24194
  __assign = Object.assign || function(t) {
23996
24195
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -54793,16 +54992,24 @@ var init_http_keepalive = __esm({
54793
54992
  }
54794
54993
  });
54795
54994
 
54796
- // ts/agent-core/dist/platform-config.js
54797
- var init_platform_config = __esm({
54798
- "ts/agent-core/dist/platform-config.js"() {
54995
+ // ts/agent-core/dist/logger.js
54996
+ function createLogger(prefix) {
54997
+ return {
54998
+ info: (msg) => console.log(`${(/* @__PURE__ */ new Date()).toISOString()} [${prefix}] ${msg}`),
54999
+ warn: (msg) => console.warn(`${(/* @__PURE__ */ new Date()).toISOString()} [${prefix}] ${msg}`),
55000
+ error: (msg) => console.error(`${(/* @__PURE__ */ new Date()).toISOString()} [${prefix}] ${msg}`),
55001
+ child: (sub) => createLogger(`${prefix}:${sub}`)
55002
+ };
55003
+ }
55004
+ var init_logger = __esm({
55005
+ "ts/agent-core/dist/logger.js"() {
54799
55006
  "use strict";
54800
55007
  }
54801
55008
  });
54802
55009
 
54803
- // ts/agent-core/dist/channel-token.js
54804
- var init_channel_token = __esm({
54805
- "ts/agent-core/dist/channel-token.js"() {
55010
+ // ts/agent-core/dist/platform-config.js
55011
+ var init_platform_config = __esm({
55012
+ "ts/agent-core/dist/platform-config.js"() {
54806
55013
  "use strict";
54807
55014
  }
54808
55015
  });
@@ -54877,30 +55084,82 @@ var init_skills = __esm({
54877
55084
  }
54878
55085
  });
54879
55086
 
55087
+ // ts/agent-core/dist/platform-instructions.js
55088
+ var init_platform_instructions2 = __esm({
55089
+ "ts/agent-core/dist/platform-instructions.js"() {
55090
+ "use strict";
55091
+ init_platform_instructions();
55092
+ init_skills();
55093
+ init_platform_instructions();
55094
+ }
55095
+ });
55096
+
55097
+ // ts/agent-core/dist/prompt-fragments.js
55098
+ var init_prompt_fragments = __esm({
55099
+ "ts/agent-core/dist/prompt-fragments.js"() {
55100
+ "use strict";
55101
+ init_platform_instructions();
55102
+ }
55103
+ });
55104
+
55105
+ // ts/agent-core/dist/provider-config.js
55106
+ function llmSource(pc) {
55107
+ return effectiveLLMSourceExplicit(pc) || "parall";
55108
+ }
55109
+ function effectiveLLMSourceExplicit(pc) {
55110
+ if (pc?.llm_source)
55111
+ return pc.llm_source;
55112
+ if (pc?.openai_api_key || pc?.openai_base_url || pc?.anthropic_auth_token || pc?.anthropic_base_url) {
55113
+ return "custom";
55114
+ }
55115
+ return "";
55116
+ }
55117
+ function clearAllProviderCreds(env) {
55118
+ delete env.ANTHROPIC_AUTH_TOKEN;
55119
+ delete env.ANTHROPIC_BASE_URL;
55120
+ delete env.ANTHROPIC_API_KEY;
55121
+ delete env.OPENAI_API_KEY;
55122
+ delete env.OPENAI_BASE_URL;
55123
+ delete env.PRLL_CLAUDE_ALLOW_API_KEY;
55124
+ }
55125
+ var init_provider_config = __esm({
55126
+ "ts/agent-core/dist/provider-config.js"() {
55127
+ "use strict";
55128
+ }
55129
+ });
55130
+
55131
+ // ts/agent-core/dist/types.js
55132
+ var init_types4 = __esm({
55133
+ "ts/agent-core/dist/types.js"() {
55134
+ "use strict";
55135
+ }
55136
+ });
55137
+
54880
55138
  // ts/agent-core/dist/index.js
54881
55139
  var init_dist2 = __esm({
54882
55140
  "ts/agent-core/dist/index.js"() {
54883
55141
  "use strict";
54884
- init_provider_config();
54885
- init_types();
54886
- init_lane_key();
54887
- init_gateway_lane_flow();
54888
- init_session_state();
54889
- init_routing();
54890
- init_event_format();
54891
- init_prompt_fragments();
54892
55142
  init_bridge_workspace();
55143
+ init_channel_capability();
55144
+ init_channel_token();
54893
55145
  init_dispatch_adapter();
54894
- init_redact();
54895
- init_logger();
55146
+ init_event_format();
54896
55147
  init_gateway_base();
54897
- init_lane_ledger();
55148
+ init_gateway_lane_flow();
54898
55149
  init_http_keepalive();
55150
+ init_lane_key();
55151
+ init_lane_ledger();
55152
+ init_logger();
54899
55153
  init_platform_config();
54900
- init_channel_capability();
54901
- init_channel_token();
55154
+ init_platform_instructions2();
55155
+ init_prompt_fragments();
55156
+ init_provider_config();
55157
+ init_redact();
55158
+ init_routing();
55159
+ init_session_state();
54902
55160
  init_skills();
54903
55161
  init_telemetry();
55162
+ init_types4();
54904
55163
  }
54905
55164
  });
54906
55165