@parall/agent-core 1.22.0 → 1.24.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.
@@ -7,7 +7,7 @@
7
7
  * `@parall/agent-core` stays runtime-neutral and exports only text + pure
8
8
  * helpers here.
9
9
  */
10
- export declare const BRIDGE_WORKSPACE_INSTRUCTIONS = "# Agent workspace\n\nYou are an agent in Parall IM. You participate in chats, handle tasks, and interact exclusively through the Parall CLI.\n\n## Message Model\n\nIncoming events are rendered as structured `[Event: ...]` blocks.\nEach event includes `[Chat: ... (prll://cht_xxx)]` \u2014 use that chat ID (or full URI) when replying.\n\n**Your plain-text output is not delivered to anyone** \u2014 it is recorded as suppressed thinking in your session steps and discarded from the chat.\nTo say something in a chat, you **must** invoke the Parall CLI via your shell/exec tool. To stay silent, simply do not invoke it.\n\n## Parall CLI\n\nAll outbound interactions go through `@parall/cli`. Credentials are pre-injected as environment variables \u2014 no setup needed.\n\n- `npx --yes @parall/cli@latest messages send prll://cht_xxx --text \"...\"` \u2014 reply into the triggering chat\n- `npx --yes @parall/cli@latest dm prll://usr_xxx --text \"...\" [--no-reply]` \u2014 direct message another user\n- `npx --yes @parall/cli@latest tasks update prll://tsk_xxx --status in_progress` \u2014 task state\n- `npx --yes @parall/cli@latest no-reply [--reason \"...\"]` \u2014 explicitly declare this turn silent (audit signal; not required for silence, just clarifies intent)\n\nThe bridge injects Parall context via environment variables. The static credentials `PRLL_API_URL`, `PRLL_API_KEY`, and `PRLL_ORG_ID` are always set. Per-dispatch context \u2014 `PRLL_SESSION_ID`, `PRLL_CHAT_ID`, `PRLL_TRIGGER_MESSAGE_ID`, `PRLL_STEP_ID_FILE` \u2014 is set in subprocess-per-dispatch runtimes (Claude Code); in long-running runtimes (Codex) those may be absent and the CLI will fall back to whatever defaults you supply on the command line.\n\n## Guardrails\n\n- A dispatch may coalesce multiple events. Decide per event whether to reply via `messages send` / `dm` \u2014 events you do not act on simply receive no reply.\n- If an event carries `[Hint: no_reply]`, do not send anything for that event. `no-reply` is optional and only useful as an explicit intent marker.\n- Never try to \"speak\" by typing sentences like \"No response needed\" / \"Noted\" / \"OK\" \u2014 they are discarded, so they accomplish nothing except polluting your session log.\n- Keep CLI replies concise and task-focused.\n\nSee `docs/engineering-design/agent-dm-loop-prevention.md` \u00A7 Layer 0 for why plain text is never auto-projected.\n";
10
+ export declare const BRIDGE_WORKSPACE_INSTRUCTIONS = "# Agent workspace\n\nYou are an agent in Parall IM. You participate in chats, handle tasks, and interact exclusively through the Parall CLI.\n\n## Message Model\n\nIncoming events are rendered as structured `[Event: ...]` blocks.\nEach event includes `[Chat: ... (prll://cht_xxx)]` \u2014 use that chat ID (or full URI) when replying.\n\n**Your plain-text output is not delivered to anyone** \u2014 it is recorded as suppressed thinking in your session steps and discarded from the chat.\nTo say something in a chat, you **must** invoke the Parall CLI via your shell/exec tool. To stay silent, simply do not invoke it.\n\n## Parall CLI\n\nAll outbound interactions go through the `parall` CLI. Credentials are pre-injected as environment variables \u2014 no setup needed. If `parall` is not on PATH, use `npx --yes @parall/cli@latest` instead.\n\n- `parall messages send prll://cht_xxx --text \"...\"` \u2014 reply into the triggering chat\n- `parall dm prll://usr_xxx --text \"...\" [--no-reply]` \u2014 direct message another user\n- `parall tasks update prll://tsk_xxx --status in_progress` \u2014 task state\n- `parall no-reply [--reason \"...\"]` \u2014 explicitly declare this turn silent (audit signal; not required for silence, just clarifies intent)\n\nThe bridge injects Parall context via environment variables. The static credentials `PRLL_API_URL`, `PRLL_API_KEY`, and `PRLL_ORG_ID` are always set. Per-dispatch context \u2014 `PRLL_SESSION_ID`, `PRLL_CHAT_ID`, `PRLL_TRIGGER_MESSAGE_ID`, `PRLL_STEP_ID_FILE` \u2014 is set in subprocess-per-dispatch runtimes (Claude Code); in long-running runtimes (Codex) those may be absent and the CLI will fall back to whatever defaults you supply on the command line.\n\n## Attachments\n\nImage attachments are pre-downloaded under `.parall/attachments/<messageId>/`. Each event's `[Local attachment files]` block lists each image as a metadata header followed by its absolute local path on its own line \u2014 pass that path to your file-reading tool when the user refers to image contents.\n\nSupported image types: PNG, JPEG, WebP, GIF. Other attachment types (PDFs, archives, etc.) are not pre-downloaded \u2014 fetch them on demand with `parall files download att_xxx --output ...`.\n\n## Guardrails\n\n- A dispatch may coalesce multiple events. Decide per event whether to reply via `messages send` / `dm` \u2014 events you do not act on simply receive no reply.\n- If an event carries `[Hint: no_reply]`, do not send anything for that event. `no-reply` is optional and only useful as an explicit intent marker.\n- Never try to \"speak\" by typing sentences like \"No response needed\" / \"Noted\" / \"OK\" \u2014 they are discarded, so they accomplish nothing except polluting your session log.\n- Keep CLI replies concise and task-focused.\n\nSee `docs/engineering-design/agent-dm-loop-prevention.md` \u00A7 Layer 0 for why plain text is never auto-projected.\n\n## Approval Flow\n\nWhen you try an action (e.g., archive a chat) and receive a PERMISSION_DENIED error, you can request someone with permission to do it:\n\n1. The error includes a `PERMISSION_DENIED` code \u2014 use the action and resource from your original command in the approval request\n2. Request approval: `parall approvals request --action chat.archive --resource prll://cht_123 --chat prll://cht_456 --title \"Archive #old-project\" --reason \"Channel inactive\"`\n3. A card will appear in the specified chat for someone with permission to approve\n4. Check the result later with `parall approvals list`\n\nOnly request approval when you've actually been denied permission. Don't request approval preemptively.\n";
11
11
  /** Extracts the `command` string from a shell/bash tool call's input payload. */
12
12
  export declare function extractShellCommand(input: unknown): string | undefined;
13
13
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"bridge-workspace.d.ts","sourceRoot":"","sources":["../src/bridge-workspace.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,6BAA6B,m3EA+BzC,CAAC;AAEF,iFAAiF;AACjF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAItE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAmBzE;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAKxE;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAI3E"}
1
+ {"version":3,"file":"bridge-workspace.d.ts","sourceRoot":"","sources":["../src/bridge-workspace.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,6BAA6B,mkHAgDzC,CAAC;AAEF,iFAAiF;AACjF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAItE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAmBzE;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAKxE;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAI3E"}
@@ -21,15 +21,21 @@ To say something in a chat, you **must** invoke the Parall CLI via your shell/ex
21
21
 
22
22
  ## Parall CLI
23
23
 
24
- All outbound interactions go through \`@parall/cli\`. Credentials are pre-injected as environment variables — no setup needed.
24
+ All outbound interactions go through the \`parall\` CLI. Credentials are pre-injected as environment variables — no setup needed. If \`parall\` is not on PATH, use \`npx --yes @parall/cli@latest\` instead.
25
25
 
26
- - \`npx --yes @parall/cli@latest messages send prll://cht_xxx --text "..."\` — reply into the triggering chat
27
- - \`npx --yes @parall/cli@latest dm prll://usr_xxx --text "..." [--no-reply]\` — direct message another user
28
- - \`npx --yes @parall/cli@latest tasks update prll://tsk_xxx --status in_progress\` — task state
29
- - \`npx --yes @parall/cli@latest no-reply [--reason "..."]\` — explicitly declare this turn silent (audit signal; not required for silence, just clarifies intent)
26
+ - \`parall messages send prll://cht_xxx --text "..."\` — reply into the triggering chat
27
+ - \`parall dm prll://usr_xxx --text "..." [--no-reply]\` — direct message another user
28
+ - \`parall tasks update prll://tsk_xxx --status in_progress\` — task state
29
+ - \`parall no-reply [--reason "..."]\` — explicitly declare this turn silent (audit signal; not required for silence, just clarifies intent)
30
30
 
31
31
  The bridge injects Parall context via environment variables. The static credentials \`PRLL_API_URL\`, \`PRLL_API_KEY\`, and \`PRLL_ORG_ID\` are always set. Per-dispatch context — \`PRLL_SESSION_ID\`, \`PRLL_CHAT_ID\`, \`PRLL_TRIGGER_MESSAGE_ID\`, \`PRLL_STEP_ID_FILE\` — is set in subprocess-per-dispatch runtimes (Claude Code); in long-running runtimes (Codex) those may be absent and the CLI will fall back to whatever defaults you supply on the command line.
32
32
 
33
+ ## Attachments
34
+
35
+ Image attachments are pre-downloaded under \`.parall/attachments/<messageId>/\`. Each event's \`[Local attachment files]\` block lists each image as a metadata header followed by its absolute local path on its own line — pass that path to your file-reading tool when the user refers to image contents.
36
+
37
+ Supported image types: PNG, JPEG, WebP, GIF. Other attachment types (PDFs, archives, etc.) are not pre-downloaded — fetch them on demand with \`parall files download att_xxx --output ...\`.
38
+
33
39
  ## Guardrails
34
40
 
35
41
  - A dispatch may coalesce multiple events. Decide per event whether to reply via \`messages send\` / \`dm\` — events you do not act on simply receive no reply.
@@ -38,6 +44,17 @@ The bridge injects Parall context via environment variables. The static credenti
38
44
  - Keep CLI replies concise and task-focused.
39
45
 
40
46
  See \`docs/engineering-design/agent-dm-loop-prevention.md\` § Layer 0 for why plain text is never auto-projected.
47
+
48
+ ## Approval Flow
49
+
50
+ When you try an action (e.g., archive a chat) and receive a PERMISSION_DENIED error, you can request someone with permission to do it:
51
+
52
+ 1. The error includes a \`PERMISSION_DENIED\` code — use the action and resource from your original command in the approval request
53
+ 2. Request approval: \`parall approvals request --action chat.archive --resource prll://cht_123 --chat prll://cht_456 --title "Archive #old-project" --reason "Channel inactive"\`
54
+ 3. A card will appear in the specified chat for someone with permission to approve
55
+ 4. Check the result later with \`parall approvals list\`
56
+
57
+ Only request approval when you've actually been denied permission. Don't request approval preemptively.
41
58
  `;
42
59
  /** Extracts the `command` string from a shell/bash tool call's input payload. */
43
60
  export function extractShellCommand(input) {
@@ -1 +1 @@
1
- {"version":3,"file":"event-format.d.ts","sourceRoot":"","sources":["../src/event-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAM1D,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CA+CzD;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,MAAM,CASnE"}
1
+ {"version":3,"file":"event-format.d.ts","sourceRoot":"","sources":["../src/event-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAM1D,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAgDzD;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,MAAM,CASnE"}
@@ -31,6 +31,8 @@ export function buildEventBody(event) {
31
31
  ? `${event.targetName} (prll://${event.targetId})`
32
32
  : `prll://${event.targetId}`;
33
33
  lines.push(`[Task: ${taskLabel}]`);
34
+ if (event.deliveryReason)
35
+ lines.push(`[Delivery: ${sanitizeMeta(event.deliveryReason)}]`);
34
36
  lines.push(`[From: ${event.senderName} (prll://${event.senderId})]`);
35
37
  lines.push(`[Comment ID: prll://${event.messageId}]`);
36
38
  lines.push("", event.body);
@@ -1 +1 @@
1
- {"version":3,"file":"gateway-base.d.ts","sourceRoot":"","sources":["../src/gateway-base.ts"],"names":[],"mappings":"AAIA,OAAO,EAAuB,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,KAAK,EACV,qBAAqB,EAWtB,MAAM,aAAa,CAA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F/B,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,eAAe;YAQT,gCAAgC;YAUhC,WAAW;YAoFX,gBAAgB;YAkFhB,eAAe;YA6Ef,kBAAkB;YA2ElB,kBAAkB;YAkBlB,4BAA4B;YAoD5B,aAAa;YA+Bb,oBAAoB;YAoCpB,iBAAiB;IAiF/B;;;;;;;OAOG;YACW,0BAA0B;YAsB1B,kBAAkB;YAsClB,mBAAmB;YA6GnB,WAAW;IA6DzB,OAAO,CAAC,YAAY;YAiBN,QAAQ;CA4CvB"}
@@ -157,7 +157,7 @@ export class ParallAgentGateway {
157
157
  if (!data.source_id || !data.task_id)
158
158
  return;
159
159
  try {
160
- const dispatched = await this.handleTaskComment(data.source_id, data.task_id, data.actor_id);
160
+ const dispatched = await this.handleTaskComment(data.source_id, data.task_id, data.actor_id, data.delivery_reason);
161
161
  if (dispatched) {
162
162
  this.opts.client.ackDispatchByID(this.opts.config.org_id, data.id).catch(() => { });
163
163
  }
@@ -828,7 +828,7 @@ export class ParallAgentGateway {
828
828
  }
829
829
  return dispatched;
830
830
  }
831
- async handleTaskComment(commentId, taskId, actorId) {
831
+ async handleTaskComment(commentId, taskId, actorId, deliveryReason) {
832
832
  if (this.shuttingDown)
833
833
  return false; // drain window — let server requeue via catch-up
834
834
  const dedupeKey = `comment:${commentId}`;
@@ -885,6 +885,7 @@ export class ParallAgentGateway {
885
885
  senderName: comment.author?.display_name ?? actorId ?? "unknown",
886
886
  messageId: commentId,
887
887
  body: parts.join("\n"),
888
+ deliveryReason: deliveryReason ?? undefined,
888
889
  ackSourceType: "comment",
889
890
  ackSourceId: commentId,
890
891
  };
@@ -1025,7 +1026,7 @@ export class ParallAgentGateway {
1025
1026
  }
1026
1027
  }
1027
1028
  else if (item.event_type === "task_comment" && item.source_id && item.task_id) {
1028
- dispatched = await this.handleTaskComment(item.source_id, item.task_id, item.actor_id);
1029
+ dispatched = await this.handleTaskComment(item.source_id, item.task_id, item.actor_id, item.delivery_reason);
1029
1030
  }
1030
1031
  else if (item.event_type === "schedule.fire" && item.source_id) {
1031
1032
  dispatched = await this.fetchAndHandleScheduleFire(item.source_id, item.actor_id);
@@ -0,0 +1,53 @@
1
+ import type { DispatchContext, GatewayLogger } from "../dispatch-adapter.js";
2
+ import type { LocalAttachmentResult, PreparedLocalImage } from "../prompt-fragments.js";
3
+ import type { ParallEvent } from "../types.js";
4
+ export type { LocalAttachmentResult, PreparedLocalImage };
5
+ export type LocalAttachmentOptions = {
6
+ workspaceDir: string;
7
+ maxTotalImageBytes?: number;
8
+ maxCacheBytes?: number;
9
+ downloadTimeoutMs?: number;
10
+ attachmentTtlMs?: number;
11
+ /**
12
+ * Cooldown window for background cache maintenance (TTL cleanup + LRU prune).
13
+ * When >0 (default), only one maintenance pass per cooldown interval runs per
14
+ * root, in the background, and dispatch never waits on it. When 0, the pass
15
+ * runs synchronously in-line — used by tests that need deterministic prune
16
+ * timing.
17
+ */
18
+ maintenanceCooldownMs?: number;
19
+ log?: GatewayLogger;
20
+ };
21
+ /**
22
+ * Per-dispatch cap on image bytes a runtime turn receives. Counts declared
23
+ * attachment sizes plus fresh download bytes; cache hits are NOT recharged
24
+ * against this budget — those are already on disk and bounded separately by
25
+ * `DEFAULT_ATTACHMENT_CACHE_MAX_BYTES` below. The cap exists to keep any one
26
+ * dispatch from saturating the bridge↔runtime hop with a single oversized
27
+ * batch; the cache cap exists to keep the workspace from growing unbounded.
28
+ */
29
+ export declare const DEFAULT_MAX_TOTAL_IMAGE_BYTES: number;
30
+ /**
31
+ * Workspace cache ceiling. The default is generous for typical operator setups,
32
+ * but on small PVCs (e.g. 1 GiB) it can claim a meaningful fraction of disk.
33
+ * Operators on constrained storage should override via `LocalAttachmentOptions.maxCacheBytes`.
34
+ */
35
+ export declare const DEFAULT_ATTACHMENT_CACHE_MAX_BYTES: number;
36
+ export declare const DEFAULT_ATTACHMENT_DOWNLOAD_TIMEOUT_MS = 30000;
37
+ export declare const DEFAULT_ATTACHMENT_TTL_MS: number;
38
+ export declare const DEFAULT_MAINTENANCE_COOLDOWN_MS: number;
39
+ export declare function prepareLocalImageAttachments(event: ParallEvent, context: DispatchContext, opts: LocalAttachmentOptions): Promise<LocalAttachmentResult>;
40
+ export declare function appendLocalAttachmentRefs(body: string, result: LocalAttachmentResult): string;
41
+ export declare function appendPreparedLocalAttachmentRefs(body: string, event: ParallEvent, context: DispatchContext, opts: LocalAttachmentOptions): Promise<{
42
+ body: string;
43
+ attachments: LocalAttachmentResult;
44
+ }>;
45
+ export declare function pinLocalAttachmentPaths(images: PreparedLocalImage[]): () => void;
46
+ /**
47
+ * Append `.parall/` to the workspace's git info/exclude. Best-effort — a
48
+ * missing exclude entry should not block dispatch. Used by both Claude and
49
+ * Codex bridges' workspace bootstrap; lives here next to the attachment
50
+ * download logic so the directory convention stays in one place.
51
+ */
52
+ export declare function ensureLocalAttachmentGitExclude(workingDirectory: string): void;
53
+ //# sourceMappingURL=attachment-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachment-input.d.ts","sourceRoot":"","sources":["../../src/internal/attachment-input.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE7E,OAAO,KAAK,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACxF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK/C,YAAY,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,CAAC;AAE1D,MAAM,MAAM,sBAAsB,GAAG;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;OAMG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,GAAG,CAAC,EAA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