@parall/parall 1.52.1 → 1.53.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.
@@ -51509,6 +51509,8 @@ var ENDPOINTS = {
51509
51509
  SLACK_HISTORY: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/slack/history`,
51510
51510
  SLACK_MEMBERS: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/slack/members`,
51511
51511
  SLACK_STATUS: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/slack/status`,
51512
+ // WeChat tier-B read verb (agent-only; internal research preview).
51513
+ WECHAT_CONTACTS: (orgId) => `${API_BASE}/orgs/${orgId}/agents/me/wechat/contacts`,
51512
51514
  // Invitations (org-scoped, admin)
51513
51515
  ORG_INVITATIONS: (orgId) => `${API_BASE}/orgs/${orgId}/invitations`,
51514
51516
  ORG_INVITATION: (orgId, invId) => `${API_BASE}/orgs/${orgId}/invitations/${invId}`,
@@ -51670,8 +51672,6 @@ var ENDPOINTS = {
51670
51672
  // Live viewer command — on api-server (API_BASE), not clip-service: it rides
51671
51673
  // the machine control-plane request/reply bridge that lives in api-server.
51672
51674
  BROWSER_PROFILE_VIEWER_COMMAND: (orgId, profileId) => `${API_BASE}/orgs/${orgId}/browser-profiles/${profileId}/viewer/command`,
51673
- // Clip registry (global, served by clip-service → Pinix Hub proxy)
51674
- CLIP_REGISTRY: () => `${CLIP_BASE}/registry/clips`,
51675
51675
  // Edge device endpoints
51676
51676
  ORG_EDGE: (orgId) => `/api/v1/orgs/${orgId}/edge`,
51677
51677
  ORG_EDGE_DEVICES: (orgId) => `/api/v1/orgs/${orgId}/edge/devices`,
@@ -51688,15 +51688,20 @@ var ENDPOINTS = {
51688
51688
  ORG_EDGE_VIEWER_COMMAND: (orgId, edgeId) => `/api/v1/orgs/${orgId}/edge/${edgeId}/viewer/command`,
51689
51689
  CLIP_CONNECTIONS: (orgId, clipId) => `/api/v1/orgs/${orgId}/clip-registry/${clipId}/connections`,
51690
51690
  CLIP_CONNECTION: (orgId, connId) => `/api/v1/orgs/${orgId}/clip-connections/${connId}`,
51691
- // Clip registry (v3, org-scoped, served by api-server — `crg_` entries; the
51692
- // Pinix Hub catalog proxy above is a different, id-less surface)
51691
+ // Clip registry (v3, org-scoped, served by api-server — `crg_` entries)
51693
51692
  ORG_CLIP_REGISTRY: (orgId) => `/api/v1/orgs/${orgId}/clip-registry`,
51693
+ ORG_CLIP_REGISTRY_CLIP: (orgId, clipId) => `/api/v1/orgs/${orgId}/clip-registry/${clipId}`,
51694
+ ORG_CLIP_REGISTRY_PUBLISH: (orgId) => `/api/v1/orgs/${orgId}/clip-registry/publish`,
51694
51695
  ORG_CLIP_INSTALL: (orgId) => `/api/v1/orgs/${orgId}/clips/install`,
51695
51696
  ORG_CLIPS_INSTALLED: (orgId) => `/api/v1/orgs/${orgId}/clips/installed`,
51697
+ ORG_CLIP_UNINSTALL: (orgId, clipId) => `/api/v1/orgs/${orgId}/clips/${clipId}/uninstall`,
51698
+ // Per-org agent exec access for one clip (default all agents; PUT human-only)
51699
+ ORG_CLIP_EXEC_ACCESS: (orgId, clipId) => `/api/v1/orgs/${orgId}/clips/${clipId}/exec-access`,
51696
51700
  // MCP clip server config (cap:clip-mcp; publisher-org only — cross-org gets
51697
51701
  // 403 MCP_CROSS_ORG_DISABLED on the whole family, reads included)
51698
51702
  ORG_CLIP_MCP_CONFIG: (orgId, clipId) => `/api/v1/orgs/${orgId}/clip-registry/${clipId}/mcp-config`,
51699
- ORG_CLIP_MCP_TOOLS_REFRESH: (orgId, clipId) => `/api/v1/orgs/${orgId}/clip-registry/${clipId}/mcp-config/tools/refresh`
51703
+ ORG_CLIP_MCP_TOOLS_REFRESH: (orgId, clipId) => `/api/v1/orgs/${orgId}/clip-registry/${clipId}/mcp-config/tools/refresh`,
51704
+ ORG_CLIP_MCP_OAUTH_DISCONNECT: (orgId, clipId) => `/api/v1/orgs/${orgId}/clip-registry/${clipId}/mcp-config/oauth/disconnect`
51700
51705
  };
51701
51706
  var WS_EVENTS = {
51702
51707
  // Client -> Server
@@ -53192,6 +53197,14 @@ var ParallClient = class _ParallClient {
53192
53197
  async setSlackStatus(orgId, input) {
53193
53198
  await this.request("POST", ENDPOINTS.SLACK_STATUS(orgId), input);
53194
53199
  }
53200
+ /**
53201
+ * WeChat tier-B read verb (agent-only; internal research preview): the
53202
+ * account's address book — friend wxids, saved group room ids, followed
53203
+ * official accounts. Same live gate as the send verb.
53204
+ */
53205
+ async listWechatContacts(orgId) {
53206
+ return this.request("GET", ENDPOINTS.WECHAT_CONTACTS(orgId));
53207
+ }
53195
53208
  async listChannelConversations(orgId, connectionId) {
53196
53209
  return this.request("GET", ENDPOINTS.CHANNEL_CONNECTION_CONVERSATIONS(orgId, connectionId));
53197
53210
  }
@@ -53730,17 +53743,11 @@ var ParallClient = class _ParallClient {
53730
53743
  async revokeBrowserProfileConsent(orgId, profileId, clipId) {
53731
53744
  await this.request("DELETE", ENDPOINTS.BROWSER_PROFILE_CONSENT(orgId, profileId, clipId));
53732
53745
  }
53733
- async listRegistryClips(q) {
53734
- const url = ENDPOINTS.CLIP_REGISTRY() + (q ? `?q=${encodeURIComponent(q)}` : "");
53735
- const resp = await this.request("GET", url);
53736
- return resp.data;
53737
- }
53738
53746
  // ---- Clip registry (v3, api-server org registry — `crg_` entries) ----
53739
53747
  /**
53740
53748
  * List registry clips visible to the org: its own plus public+approved
53741
53749
  * cross-org entries. This is the surface `installRegistryClip` and clip
53742
- * connections operate on — NOT the Pinix catalog proxy
53743
- * ({@link listRegistryClips}), whose entries carry no `crg_` id.
53750
+ * connections operate on.
53744
53751
  */
53745
53752
  async listOrgRegistryClips(orgId) {
53746
53753
  const resp = await this.request("GET", `${ENDPOINTS.ORG_CLIP_REGISTRY(orgId)}?limit=100`);
@@ -53755,11 +53762,58 @@ var ParallClient = class _ParallClient {
53755
53762
  async installRegistryClip(orgId, clipId) {
53756
53763
  return this.request("POST", ENDPOINTS.ORG_CLIP_INSTALL(orgId), { clip_id: clipId });
53757
53764
  }
53765
+ /**
53766
+ * Remove an org's install of a registry clip. Keyed by the REGISTRY id
53767
+ * (`crg_`), the same id {@link installRegistryClip} takes — the v2
53768
+ * `deleteClip` operates on a different table and cannot reach these.
53769
+ */
53770
+ async uninstallRegistryClip(orgId, clipId) {
53771
+ await this.request("DELETE", ENDPOINTS.ORG_CLIP_UNINSTALL(orgId, clipId));
53772
+ }
53758
53773
  /** List the org's installed registry clips (full entries). */
53759
53774
  async listInstalledRegistryClips(orgId) {
53760
53775
  const resp = await this.request("GET", ENDPOINTS.ORG_CLIPS_INSTALLED(orgId));
53761
53776
  return resp ?? [];
53762
53777
  }
53778
+ /**
53779
+ * Fetch one registry clip by its `crg_` id. For a clip OWNED by the calling
53780
+ * org the entry additionally carries `review_status`/`review_note` — the
53781
+ * state of the latest submitted version and the reviewer's rejection
53782
+ * feedback. This is the polling surface for "did platform review approve my
53783
+ * public publish yet"; cross-org callers see only public+approved entries
53784
+ * and never any review-state fields.
53785
+ */
53786
+ async getRegistryClip(orgId, clipId) {
53787
+ return this.request("GET", ENDPOINTS.ORG_CLIP_REGISTRY_CLIP(orgId, clipId));
53788
+ }
53789
+ /**
53790
+ * Publish (create, or author-only update) a clip in the org registry,
53791
+ * replacing its whole file set. See {@link PublishRegistryClipRequest} for
53792
+ * the visibility/review semantics; the returned entry carries
53793
+ * `review_status` when a public publish queued a review submission — poll
53794
+ * {@link getRegistryClip} for the outcome.
53795
+ */
53796
+ async publishRegistryClip(orgId, req) {
53797
+ return this.request("POST", ENDPOINTS.ORG_CLIP_REGISTRY_PUBLISH(orgId), req, void 0, false, {
53798
+ timeoutMs: 6e4
53799
+ });
53800
+ }
53801
+ /**
53802
+ * Read a clip's per-org agent exec access. Org-member readable (agents
53803
+ * included, so a denied agent can learn why exec answered
53804
+ * `CLIP_AGENT_NOT_ALLOWED`).
53805
+ */
53806
+ async getClipAgentExecAccess(orgId, clipId) {
53807
+ return this.request("GET", ENDPOINTS.ORG_CLIP_EXEC_ACCESS(orgId, clipId));
53808
+ }
53809
+ /**
53810
+ * Replace a clip's per-org agent exec access. Human-only (agent principals
53811
+ * get 403); under `all_agents` the `agent_ids` must be empty. Every granted
53812
+ * id must be an active agent of this org (else `400 INVALID_INPUT`).
53813
+ */
53814
+ async putClipAgentExecAccess(orgId, clipId, access) {
53815
+ return this.request("PUT", ENDPOINTS.ORG_CLIP_EXEC_ACCESS(orgId, clipId), access);
53816
+ }
53763
53817
  // ---- Edge devices ----
53764
53818
  async listEdgeDevices(orgId) {
53765
53819
  return this.request("GET", ENDPOINTS.ORG_EDGE_DEVICES(orgId));
@@ -54509,10 +54563,16 @@ function buildSendMessageHint(event) {
54509
54563
  const replyTo = event.channelExternalMessageId ? ` --reply-to "${event.channelExternalMessageId}"` : "";
54510
54564
  return `
54511
54565
  <system-reminder>To reply, use the platform verb: \`parall slack send${channelArg}${replyTo} --text <your reply>\`. In channels --reply-to is REQUIRED (the reply lands in that message's thread); in DMs it is optional (DMs are linear). \`parall slack send\` is the ONLY outbound path \u2014 your plain text output is NOT delivered to the external conversation.</system-reminder>`;
54566
+ }
54567
+ if (event.channelProvider === "wechat") {
54568
+ const toArg = event.channelExternalConversationId ? ` --to "${event.channelExternalConversationId}"` : " --to <wxid from this event>";
54569
+ const atArg = event.channelConversationType === "group" ? event.senderId && event.senderId !== "external" ? ` --at "${event.senderId}"` : " --at <wxid of the person you are answering>" : "";
54570
+ return `
54571
+ <system-reminder>To reply, use the platform verb: \`parall wechat send${toArg}${atArg} --text <your reply>\`. In group chats, --at @-mentions the person you are answering. \`parall wechat send\` is the ONLY outbound path \u2014 your plain text output is NOT delivered to the external conversation.</system-reminder>`;
54512
54572
  }
54513
54573
  if (!event.channelProvider) {
54514
54574
  return `
54515
- <system-reminder>To reply, use the channel capability granted in your system prompt \u2014 for Feishu conversations that is \`lark-cli im\`, for Slack it is \`parall slack send\` (pass the message id from this event as --reply-to). That capability is the ONLY outbound path \u2014 your plain text output is NOT delivered to the external conversation.</system-reminder>`;
54575
+ <system-reminder>To reply, use the channel capability granted in your system prompt \u2014 for Feishu conversations that is \`lark-cli im\`, for Slack it is \`parall slack send\` (pass the message id from this event as --reply-to), for WeChat it is \`parall wechat send\`. That capability is the ONLY outbound path \u2014 your plain text output is NOT delivered to the external conversation.</system-reminder>`;
54516
54576
  }
54517
54577
  const convRef = event.channelExternalConversationId ? `chat_id "${event.channelExternalConversationId}"` : "the conversation id named in this event";
54518
54578
  const threadAlt = event.channelExternalMessageId ? ` To reply threaded to this specific message, reference message_id "${event.channelExternalMessageId}".` : "";
@@ -54991,13 +55051,33 @@ var LaneLedger = class {
54991
55051
  };
54992
55052
 
54993
55053
  // ../agent-core/dist/gateway-lane-flow.js
55054
+ function shiftMainBufferGroup(host, groupKey, preserveInjectedFrameBoundary) {
55055
+ const events = [];
55056
+ while (host.dispatchState.mainBuffer[0] && host.dispatchGroupKey(host.dispatchState.mainBuffer[0]) === groupKey && (!preserveInjectedFrameBoundary || events.length === 0)) {
55057
+ events.push(host.dispatchState.mainBuffer.shift());
55058
+ }
55059
+ return events;
55060
+ }
55061
+ function hasUninjectedSameLaneEventAhead(host, event) {
55062
+ const eventIndex = host.dispatchState.mainBuffer.lastIndexOf(event);
55063
+ if (eventIndex <= 0)
55064
+ return false;
55065
+ const groupKey = host.dispatchGroupKey(event);
55066
+ return host.dispatchState.mainBuffer.slice(0, eventIndex).some((buffered) => host.dispatchGroupKey(buffered) === groupKey && !host.injectedMainBufferEvents.has(buffered));
55067
+ }
54994
55068
  async function steerLaneMessage(host, event) {
54995
55069
  const { laneLedger: ledger, opts } = host;
54996
55070
  const adapter = opts.dispatchAdapter;
54997
55071
  if (!ledger || !adapter.enqueueDuringDispatch)
54998
55072
  return;
55073
+ if (hasUninjectedSameLaneEventAhead(host, event))
55074
+ return;
54999
55075
  const folded = await ledger.steerLive(event);
55000
- if (folded && await adapter.enqueueDuringDispatch(opts.runtimeKey, buildEventBody(event), folded.inputLifecycle)) {
55076
+ if (!folded)
55077
+ return;
55078
+ const injected = await adapter.enqueueDuringDispatch(opts.runtimeKey, buildEventBody(event), folded.inputLifecycle);
55079
+ if (injected) {
55080
+ host.injectedMainBufferEvents.add(event);
55001
55081
  opts.log?.info(`steer folded+injected for ${event.messageId} (will drain for bookkeeping)`);
55002
55082
  }
55003
55083
  }
@@ -55874,9 +55954,12 @@ import * as path2 from "node:path";
55874
55954
  import { fileURLToPath } from "node:url";
55875
55955
  var CAPABILITY_FEISHU_CLI = "feishu-cli";
55876
55956
  var CAPABILITY_SLACK_SEND = "slack-send";
55957
+ var CAPABILITY_WECHAT_SEND = "wechat-send";
55877
55958
  function channelCapabilityKeyFor(provider) {
55878
55959
  if (provider === "slack")
55879
55960
  return CAPABILITY_SLACK_SEND;
55961
+ if (provider === "wechat")
55962
+ return CAPABILITY_WECHAT_SEND;
55880
55963
  return `${provider}-cli`;
55881
55964
  }
55882
55965
  var CHANNEL_POINTER_MAGIC = "parall channel capability pointer";
@@ -57059,6 +57142,7 @@ var ParallAgentGateway = class {
57059
57142
  // (stable mapping; avoids one connection fetch per inbound message).
57060
57143
  channelConnectionProviders = /* @__PURE__ */ new Map();
57061
57144
  dispatchedMessages = /* @__PURE__ */ new Set();
57145
+ injectedMainBufferEvents = /* @__PURE__ */ new WeakSet();
57062
57146
  // Per-WorkItem failure backoff for typed dispatch consumption — see
57063
57147
  // LaneFlowHost.typedRedriveBackoff in gateway-lane-flow.ts.
57064
57148
  typedRedriveBackoff = /* @__PURE__ */ new Map();
@@ -58271,13 +58355,10 @@ var ParallAgentGateway = class {
58271
58355
  break;
58272
58356
  }
58273
58357
  const groupKey = this.dispatchGroupKey(this.dispatchState.mainBuffer[0]);
58274
- const events = [];
58275
- while (this.dispatchState.mainBuffer[0] && this.dispatchGroupKey(this.dispatchState.mainBuffer[0]) === groupKey) {
58276
- events.push(this.dispatchState.mainBuffer.shift());
58277
- }
58358
+ const hasPendingInjections = this.opts.dispatchAdapter.hasPendingInjections?.(this.opts.runtimeKey) ?? false;
58359
+ const events = shiftMainBufferGroup(this.laneFlowHost(), groupKey, hasPendingInjections && this.opts.dispatchAdapter.inputLifecycleMode === "explicit");
58278
58360
  const event = events[events.length - 1];
58279
58361
  const earlier = events.slice(0, -1);
58280
- const hasPendingInjections = this.opts.dispatchAdapter.hasPendingInjections?.(this.opts.runtimeKey) ?? false;
58281
58362
  const pendingFork = hasPendingInjections ? [] : this.dispatchState.pendingForkResults.splice(0);
58282
58363
  const forkPrefix = buildForkResultPrefix(pendingFork);
58283
58364
  this.dispatchState.mainCurrentTargetId = event.targetId;
@@ -58990,7 +59071,7 @@ var ParallAgentGateway = class {
58990
59071
  }
58991
59072
  }
58992
59073
  const keys = this.opts.getCapabilityKeys?.() ?? [];
58993
- const cliCapable = provider ? keys.includes(channelCapabilityKeyFor(provider)) : keys.some((k) => k.endsWith("-cli") || k === CAPABILITY_SLACK_SEND);
59074
+ const cliCapable = provider ? keys.includes(channelCapabilityKeyFor(provider)) : keys.some((k) => k.endsWith("-cli") || k === CAPABILITY_SLACK_SEND || k === CAPABILITY_WECHAT_SEND);
58994
59075
  const event = {
58995
59076
  type: "channel_message",
58996
59077
  targetId: conv.id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parall/parall",
3
- "version": "1.52.1",
3
+ "version": "1.53.0",
4
4
  "description": "OpenClaw channel plugin for Parall IM",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -16,8 +16,8 @@
16
16
  "openclaw.plugin.json"
17
17
  ],
18
18
  "dependencies": {
19
- "@parall/sdk": "1.52.1",
20
- "@parall/agent-core": "1.52.1"
19
+ "@parall/sdk": "1.53.0",
20
+ "@parall/agent-core": "1.53.0"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/node": "^22.0.0",
@@ -0,0 +1,264 @@
1
+ ---
2
+ name: parall-clip-authoring
3
+ description: "Authoring a v3 registry clip: write manifest.json + command .js files + _helpers, drive the browser/tab runtime API, publish the directory to the org registry with `parall clip publish` — or declare a manifest-only MCP clip pointing at a remote tool server. Use when: user asks to write/create/build a new clip, author a clip command, package a browser automation as a clip, declare an MCP clip, or publish a clip. For CALLING clips that already exist, use parall-clips instead."
4
+ ---
5
+
6
+ # Authoring a Parall Clip (v3)
7
+
8
+ Write a **registry (v3) clip**. This skill is for CREATING clips; to DISCOVER
9
+ and CALL clips that are already installed, use the Parall Clips skill instead.
10
+
11
+ Two kinds of clip exist, and this document covers authoring both:
12
+
13
+ - A **browser clip** — the main subject here — is a folder of named commands
14
+ that run on an Edge (a member's desktop or an org-shared cloud profile) and
15
+ drive a real browser session: one manifest (`manifest.json` or `site.json`,
16
+ either name works) + one `.js` file per command + optional `_`-prefixed
17
+ helpers. The Edge runs each command's JS in a sandbox with a browser handle
18
+ bound to the target profile.
19
+ - An **MCP clip** is a manifest-ONLY declaration pointing at a remote MCP tool
20
+ server — no `.js` files; its tools come live from that server's own
21
+ `tools/list`, never from the manifest. See "MCP clips" below.
22
+
23
+ ## Project layout
24
+
25
+ ```
26
+ my-clip/
27
+ ├── manifest.json # name, description, version, command params
28
+ ├── _helpers.js # OPTIONAL — any _-prefixed file is auto-injected into every command
29
+ ├── search.js # one command = one file; filename (minus .js) IS the command name
30
+ └── profile.js # another command
31
+ ```
32
+
33
+ ## manifest.json
34
+
35
+ ```json
36
+ {
37
+ "name": "twitter",
38
+ "description": "Twitter / X",
39
+ "version": "1.0.0",
40
+ "commands": {
41
+ "search": {
42
+ "description": "Search tweets",
43
+ "params": {
44
+ "query": { "type": "string", "required": true },
45
+ "count": { "type": "number", "required": false }
46
+ }
47
+ },
48
+ "profile": {
49
+ "description": "Fetch a user profile",
50
+ "params": { "handle": { "type": "string", "required": true } }
51
+ }
52
+ }
53
+ }
54
+ ```
55
+
56
+ - `commands` keys MUST match the `.js` filenames (`search` ↔ `search.js`).
57
+ - `params` is the input contract the caller sees in `clip info`; validate them in code too.
58
+ - **No top-level `"type"` needed for a browser clip** — omitting it means
59
+ browser. The only accepted values are `"browser"` and `"mcp"` (for the
60
+ latter, see "MCP clips" below). **`"type": "clip"` is the legacy Pinix v2
61
+ package value and is refused at publish** — don't copy it in from an older
62
+ clip.
63
+
64
+ ## A command file
65
+
66
+ ```js
67
+ // search.js — a command is a single async function of (args).
68
+ // The code does NOT know or pick the profile; the Edge binds it per invocation.
69
+ //
70
+ // SHAPE, not a runnable Twitter client: the "..." parts (the GraphQL path,
71
+ // parseTweets' body) are what you fill in per target site. Deliberately not
72
+ // pinned to a real X endpoint — a site's internal API paths rotate, and a
73
+ // stale one baked into this skill would teach a URL that 404s.
74
+ module.exports = async function (args) {
75
+ if (!args.query) return { error: "Missing argument: query" };
76
+
77
+ const tab = await browser.open("https://x.com");
78
+ // Everything after open() goes in try/finally: an early return or a thrown
79
+ // fetch would otherwise leak the tab, and the Edge is long-lived.
80
+ try {
81
+ const ct0 = await tab.cookie("ct0");
82
+ if (!ct0) return { error: "Not logged in" };
83
+
84
+ const data = await tab.fetch("/i/api/graphql/.../SearchTimeline?...", {
85
+ headers: twitterHeaders(ct0), // from _helpers.js, auto-injected
86
+ });
87
+ return { query: args.query, tweets: parseTweets(data) };
88
+ } finally {
89
+ await tab.close();
90
+ }
91
+ };
92
+ ```
93
+
94
+ Return a plain JSON-serializable object. A thrown error surfaces to the caller as
95
+ `SCRIPT_ERROR`; a returned `{ error: "..." }` is your own typed failure — prefer it
96
+ for expected cases (not logged in, missing arg).
97
+
98
+ ## Helpers (`_`-prefixed)
99
+
100
+ Any file whose name starts with `_` is NOT a command. Its top-level functions are
101
+ injected into every command's scope — no import/require needed:
102
+
103
+ ```js
104
+ // _helpers.js
105
+ function twitterHeaders(ct0) {
106
+ return { "X-Csrf-Token": ct0, "X-Twitter-Auth-Type": "OAuth2Session" };
107
+ }
108
+ function parseTweets(data) { /* ... */ }
109
+ ```
110
+
111
+ ## Runtime API (globals available in every command)
112
+
113
+ - `browser.open(url)` → tab handle · `browser.tabs()` → open tabs
114
+ - `tab.cookie(name)` · `tab.fetch(url, opts)` (in-browser fetch, carries the session)
115
+ - `tab.eval(expr)` (escape hatch) · `tab.click(sel)` · `tab.fill(sel, text)` · `tab.navigate(url)`
116
+ - `tab.waitForSelector(sel)` · `tab.getTitle()` · `tab.getURL()` · `tab.screenshot()` · `tab.close()`
117
+ - `fetch` — runtime-side HTTP, does NOT go through the browser (no session)
118
+ - `console` — logs · `args` — the invocation input
119
+
120
+ **Prefer `tab.fetch` over `tab.eval`**: fetch reuses the logged-in session and
121
+ returns structured data; eval is the last resort. Always `tab.close()` what you
122
+ open, and do it in a `finally` — an early return or a thrown fetch is exactly
123
+ when the tab leaks.
124
+
125
+ ## Develop → publish → iterate
126
+
127
+ Use the platform `parall clip` subcommands — they reuse the credentials you
128
+ already have (`PRLL_API_KEY` / `PRLL_ORG_ID`), so there is nothing to install
129
+ or configure.
130
+
131
+ > A separate **standalone `parall-clip`** binary also exists (the Edge-side
132
+ > authoring tool). It takes the SAME operations but a DIFFERENT argument shape —
133
+ > `parall-clip exec <clip> <cmd> --query "AI" --count 10` passes one flag per
134
+ > param, while `parall clip exec` takes a single JSON blob. Do not mix the two
135
+ > forms; everything below is the platform CLI.
136
+
137
+ 1. **Publish** the clip directory to the org registry. Publishing is not a
138
+ release step here — it is the edit loop's SAVE button, because exec only
139
+ ever sees published files:
140
+
141
+ ```sh
142
+ parall clip publish ./my-clip/
143
+ ```
144
+
145
+ It packages the directory (the manifest plus the directory's top-level
146
+ `.js` files; an MCP clip is manifest-only) and POSTs it for you (5 MB cap).
147
+ `name` is the org-wide upsert key — manifest fields win, else the directory
148
+ name / `0.0.1` / `private` fill the gaps. Re-publishing an existing name is
149
+ **author-only** and REPLACES the file set. Publishing into YOUR org makes it
150
+ usable there immediately (same-org self-reference, no review);
151
+ `"visibility": "public"` additionally submits the version for platform
152
+ review before it can spread cross-org.
153
+
154
+ Programmatic equivalent (what `publish` calls under the hood — use only if
155
+ you can't run the CLI). Send it verbatim-shaped: `visibility` is exactly
156
+ one of `"private"` / `"public"`, and `files` maps each filename to its
157
+ source as a string:
158
+
159
+ ```
160
+ POST /api/v1/orgs/{orgId}/clip-registry/publish
161
+ {
162
+ "name": "twitter",
163
+ "description": "Twitter / X",
164
+ "version": "1.0.0",
165
+ "visibility": "private",
166
+ "manifest": {
167
+ "name": "twitter",
168
+ "version": "1.0.0",
169
+ "commands": { "search": { "description": "Search tweets" } }
170
+ },
171
+ "files": { "search.js": "module.exports = async function (args) { return {}; };" }
172
+ }
173
+ ```
174
+
175
+ 2. **Exec** a command against a real target. Args are ONE argument — a JSON
176
+ string (or plain text for a single-value command), not per-param flags:
177
+
178
+ ```sh
179
+ parall clip exec <clip> <command> '{"query":"AI","count":10}' --connection <ccn_id|alias>
180
+ # or route to a desktop (BYOC) device you own: --edge <edge-id>
181
+ # --connection and --edge are mutually exclusive; --timeout <ms> defaults to 30000
182
+ ```
183
+
184
+ A **cloud (hosted) profile is reachable ONLY via `--connection`** — the
185
+ binding its maintainer created IS the authorization. With neither flag the
186
+ server resolves only your own online desktop device, never a cloud profile.
187
+ Discover the bindings with `parall clip connections <clip>`.
188
+
189
+ 3. **Iterate**: edit locally → `parall clip publish` again → re-exec. Exec
190
+ resolves the file set from the REGISTRY, server-side — your own org always
191
+ runs the live working copy, i.e. the latest publish. It NEVER reads your
192
+ local directory: an edit you did not re-publish silently runs the previous
193
+ version.
194
+
195
+ ## Install model & self-development (v3)
196
+
197
+ - Installing a clip is a **reference**, not a copy — the JS lives once in the Market DB.
198
+ - **Your own org** always executes its **live working copy** (latest published files),
199
+ so re-publishing is your edit loop.
200
+ - **Other orgs** installing your `public` clip execute only the **approved snapshot**
201
+ (`approved_version_id`); unreviewed public edits are invisible/unexecutable cross-org.
202
+ - To customize someone else's public clip: install → **fetch its effective
203
+ file set** → modify → **publish into your OWN org** (a derived private
204
+ entry). You cannot edit a published clip in place. The CLI has no files
205
+ subcommand (`clip info` returns only the manifest) — read the source via
206
+ the API:
207
+
208
+ ```
209
+ GET /api/v1/orgs/{orgId}/clip-registry/{clipId}/files
210
+ ```
211
+
212
+ It returns exactly what you may read and execute: your own clip → the live
213
+ working copy; an installed public clip → the approved snapshot.
214
+
215
+ ## MCP clips (manifest-only)
216
+
217
+ An MCP clip declares a remote MCP tool server. There is nothing to code: no
218
+ `.js` files (the no-scripts refusal at publish applies to browser clips only),
219
+ and the folder is just a manifest:
220
+
221
+ ```json
222
+ {
223
+ "name": "linear",
224
+ "description": "Linear (MCP)",
225
+ "version": "1.0.0",
226
+ "type": "mcp",
227
+ "mcp": { "server_url": "https://mcp.linear.app/mcp", "auth": "oauth" }
228
+ }
229
+ ```
230
+
231
+ - The `mcp` block takes ONLY `server_url` and `auth` (`"none" | "bearer" |
232
+ "api_key" | "oauth"`). Any other key is refused at publish — a credential
233
+ belongs to the installing org's own configuration, NEVER to the clip
234
+ definition.
235
+ - `server_url` must be an absolute **https** URL with no embedded credentials,
236
+ query, or fragment. It is review material, frozen with the approved version.
237
+ - Do NOT put the server in the top-level `server` / `auth` manifest keys —
238
+ those are legacy Edge-manifest fields nothing reads. Only the `mcp` block
239
+ declares the server.
240
+ - Both fields are optional, but what you declare is LOCKED: the installing
241
+ org's config must match it, and changing the URL or auth mode means
242
+ republishing.
243
+ - Entering the credential / completing OAuth is a HUMAN step in the Clip
244
+ Console (the config-write endpoints are session-only — an API key cannot
245
+ call them). Once configured, discover the live tool schemas with
246
+ `parall clip tools <clip>` and exec like any other clip.
247
+ - Publish is the same command: `parall clip publish ./my-clip/`.
248
+
249
+ ## Cloud (hosted) vs desktop (BYOC) Edge
250
+
251
+ The same command JS runs on either. Hosted profiles are org-shared cloud browsers
252
+ reachable ONLY via an explicit `--connection`; cloud state lives in S3 and is
253
+ hydrated per pod. Your code never touches this — it just gets a `browser`/`tab`
254
+ bound to whatever profile the connection selected.
255
+
256
+ ## Constraints
257
+
258
+ - Browser clips: one command = one file; keep a command's work self-contained
259
+ (open what you need, close it, return). The Edge is stateless about your code
260
+ between calls.
261
+ - Never embed credentials in the clip source — rely on the profile's logged-in
262
+ session (`tab.cookie` / `tab.fetch`). Published source is visible to installers.
263
+ - Exec has a timeout (default 30s, caller-set up to 120s). Long scrapes should page,
264
+ not block.
@@ -1,46 +1,60 @@
1
1
  ---
2
2
  name: parall-clips
3
- description: "Parall clip operations: list installed clips, invoke clip commands, inspect clip details. Use when: the task requires external capabilities (GitHub, web search, etc.), user asks about available tools/clips, or you need to call a clip command."
3
+ description: "Parall clip operations: list installed clips and their connections, inspect clip commands/tools, execute clip commands on an explicit connection. Use when: the task requires external capabilities (GitHub, web search, etc.), user asks about available tools/clips, or you need to call a clip command. For WRITING a new clip, use parall-clip-authoring instead."
4
4
  ---
5
5
 
6
6
  # Parall Clips
7
7
 
8
8
  Clips are packaged capabilities that let agents operate external systems —
9
- APIs and websites — through named commands installed in the org.
9
+ APIs, websites, remote tools — through named commands installed in the org.
10
10
 
11
11
  ## Discover
12
12
 
13
13
  ```bash
14
- parall clip list # clips installed in this org
15
- parall clip info <alias> # commands, params, version
14
+ parall clip list # installed clips + each clip's connections
15
+ parall clip info <clip> # commands + per-command params (manifest)
16
+ parall clip connections <clip> # one clip's connections, full rows
17
+ parall clip tools <clip> # MCP clips only: live tool schemas
16
18
  ```
17
19
 
18
- ## Invoke
20
+ `clip list` answers both discovery questions at once: WHICH clip (name,
21
+ description, version) and WHERE it can run — every connection with its
22
+ `ccn_…` id, alias, and target kind:
19
23
 
20
- ```bash
21
- parall clip invoke <alias> <command> [input] [--timeout <ms>] # timeout default 30s
22
- # input: JSON string or plain text, per the command's params in `info`
23
- parall clip invoke github-tools list-repos '{"org":"acme"}'
24
- ```
25
-
26
- Results are JSON on stdout; failures print an error.
24
+ - `cloud` — an org-shared cloud profile (a maintainer's signed-in browser)
25
+ - `desktop` a member's own device (only its owner can exec through it)
26
+ - `mcp` a remote MCP tool server
27
+ - `device` a device whose placement could not be resolved just now (the
28
+ device list was unavailable); don't guess which kind it is — re-run
29
+ discovery, and treat a persistent `device` like an unverified target
30
+ - `orphaned` the target device is gone; the connection is unusable
27
31
 
28
- ## Execute on an Edge device (registry clips)
32
+ Pick the connection whose alias names the account/device the task needs
33
+ (e.g. `ins-nyc` vs `ins-boston`). A row without an alias can only be
34
+ referenced by `ccn_` id — when aliases are missing and several connections
35
+ could match, ask a human to name them in the Clip Console rather than
36
+ guessing which signed-in account you are about to act through.
29
37
 
30
- Registry clips run on an Edge — a member's desktop, or an org-shared cloud
31
- profile. **Name the target explicitly.** A cloud profile has NO implicit
32
- route; omitting the target entirely is a desktop-only legacy form that
33
- reaches just YOUR OWN online desktop device — never a shared cloud profile.
38
+ ## Execute
34
39
 
35
40
  ```bash
36
- parall clip exec <clip> <command> [args] --connection <id|alias> # the normal form
41
+ parall clip exec <clip> <command> [args] --connection <ccn_|alias> # the normal form
37
42
  parall clip exec browser-tools screenshot '{"url":"…"}' --connection cloud-main
38
43
  ```
39
44
 
45
+ Build `args` as JSON per the command's params from `clip info` (or the
46
+ tool's `inputSchema` from `clip tools` for MCP clips — tool names are NOT
47
+ frozen in the manifest, so never guess a tool name or its argument shape).
48
+ Results are JSON on stdout; failures print a typed error.
49
+
50
+ **Name the target explicitly.** A cloud profile has NO implicit route;
51
+ omitting the target entirely is a desktop-only legacy form that reaches just
52
+ YOUR OWN online desktop device — never a shared cloud profile.
53
+
40
54
  - A cloud (hosted) profile is reachable ONLY via `--connection` — the clip
41
- connection its maintainer bound (`ccn_…` id or alias). That binding IS your
42
- authorization; without one the server answers `HOSTED_CONNECTION_REQUIRED`
43
- and the fix is to ask an owner/admin to bind the clip, never to retry.
55
+ connection its maintainer bound. That binding IS your authorization;
56
+ without one the server answers `HOSTED_CONNECTION_REQUIRED` and the fix
57
+ is to ask an owner/admin to bind the clip, never to retry.
44
58
  - `--edge <edgeId>` targets only a desktop device YOU own.
45
59
  - Waiting on a cloud profile is handled by the CLI: `EDGE_ACTIVATING` (cold
46
60
  start), `EDGE_BUSY` (another exec is running) and
@@ -52,19 +66,10 @@ parall clip exec browser-tools screenshot '{"url":"…"}' --connection cloud-mai
52
66
 
53
67
  ## MCP clips (remote tool servers)
54
68
 
55
- Some registry clips are backed by a remote MCP server instead of an Edge
56
- device. The command is an MCP tool name and the args are that tool's JSON
57
- arguments — but **MCP tool names are NOT frozen in `clip info`, so discover
58
- them first; never guess a tool name or its argument shape**. Before invoking,
59
- find the connection AND the tool schemas:
60
-
61
- ```bash
62
- parall clip connections <alias> # the ccn_ id / alias to pass to --connection
63
- parall clip tools <alias> # tool names + descriptions + inputSchema (JSON)
64
- ```
65
-
66
- Read each tool's `inputSchema` from `clip tools` to build valid args, then
67
- exec against that explicit target — same form as an Edge clip:
69
+ A connection with target `mcp` routes to a remote MCP server; the command
70
+ is an MCP tool name and the args are that tool's JSON arguments. Read each
71
+ tool's `inputSchema` from `clip tools` first, then exec against the
72
+ explicit target the same form as any other clip:
68
73
 
69
74
  ```bash
70
75
  parall clip exec <clip> <tool> [json-args] --connection <ccn_|alias>
@@ -82,13 +87,11 @@ parall clip exec <clip> <tool> [json-args] --connection <ccn_|alias>
82
87
 
83
88
  ## Behavior rules
84
89
 
85
- - An authorization error (clip not bound to you) is a fail-fast: ask the
86
- clip's owner or an admin to bind it do not retry or work around it.
87
- - If the executing runtime is offline or the call times out, report that
90
+ - An authorization error (`HOSTED_CONNECTION_REQUIRED`, `FORBIDDEN`) is a
91
+ fail-fast: ask the clip's maintainer or an org admin to bind the clip or
92
+ grant the connection do not retry or work around it.
93
+ - If the target device is offline or the call times out, report that
88
94
  plainly; do not queue, and never fabricate a result for a run that errored.
89
- - Hosted browser activation is handled by the CLI: it waits (bounded) while a
90
- cold hosted browser starts, so if the invoke still fails, report the error —
91
- do not blind-retry in a loop.
92
95
  - **`OUTCOME_UNKNOWN` is never retryable.** It means the command was
93
96
  dispatched and MAY HAVE EXECUTED even though no result came back. Retrying
94
97
  could post, order or delete twice. Verify the effect through the system you
@@ -104,5 +107,7 @@ parall clip exec <clip> <tool> [json-args] --connection <ccn_|alias>
104
107
  - A clip may act through a person's real logged-in account — outward,
105
108
  irreversible, or spending actions (post, order, delete, pay) get the same
106
109
  caution as any shared-state change: confirm when intent isn't explicit.
110
+ The connection's alias/target tells you WHICH account you are acting as —
111
+ if that is ambiguous, resolve it with a human before acting, not after.
107
112
  - Reach for `parall clip list` whenever a task needs capabilities beyond
108
113
  built-in tools.