@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.
- package/dist/bridge-workspace.d.ts +1 -1
- package/dist/bridge-workspace.d.ts.map +1 -1
- package/dist/bridge-workspace.js +22 -5
- package/dist/event-format.d.ts.map +1 -1
- package/dist/event-format.js +2 -0
- package/dist/gateway-base.d.ts.map +1 -1
- package/dist/gateway-base.js +4 -3
- package/dist/internal/attachment-input.d.ts +53 -0
- package/dist/internal/attachment-input.d.ts.map +1 -0
- package/dist/internal/attachment-input.js +687 -0
- package/dist/prompt-fragments.d.ts +15 -2
- package/dist/prompt-fragments.d.ts.map +1 -1
- package/dist/prompt-fragments.js +50 -9
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -2
- package/src/bridge-workspace.ts +22 -5
- package/src/event-format.ts +1 -0
- package/src/gateway-base.ts +10 -3
- package/src/internal/attachment-input.ts +791 -0
- package/src/prompt-fragments.ts +68 -9
- package/src/types.ts +1 -0
|
@@ -17,6 +17,19 @@ export interface AgentIdentity {
|
|
|
17
17
|
export declare function buildIdentity(agent?: AgentIdentity): string;
|
|
18
18
|
/** @deprecated Use buildIdentity() instead. Kept for backward compat during migration. */
|
|
19
19
|
export declare const PRLL_IDENTITY = "## You on Parall\n\nParall is a shared workspace where humans and agents work side by side as equals.\nYou are a participant here, not a service. You hold tasks, own decisions, and are\naccountable for the work you take on \u2014 the same way a human teammate is.\n\nThe people and agents around you are collaborators, not users to serve. Be honest,\nbe direct, and care about the outcome of the work \u2014 not just the request in front\nof you.";
|
|
20
|
-
export declare const PRLL_BEHAVIOR = "## 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\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. Details: load the `parall-tasks` skill.\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\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### 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.";
|
|
21
|
-
export declare const PRLL_REFERENCE_GUIDE = "## 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### 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://tcm_xxx task comment\n prll://cht_xxx chat prll://ase_xxx agent session\n prll://att_xxx attachment prll://sch_xxx schedule\n 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### 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
|
|
20
|
+
export declare const PRLL_BEHAVIOR = "## 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\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. Details: load the `parall-tasks` skill.\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\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. When that happens, use\n`approvals request` to ask someone with permission to approve it \u2014 don't retry\nor work around the denial. Only request approval after an actual denial, never\npreemptively.\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.";
|
|
21
|
+
export declare const PRLL_REFERENCE_GUIDE = "## 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### 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://tcm_xxx task comment\n prll://cht_xxx chat prll://ase_xxx agent session\n prll://att_xxx attachment prll://sch_xxx schedule\n 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### 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.\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\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.";
|
|
22
|
+
export type PreparedLocalImage = {
|
|
23
|
+
attachmentId: string;
|
|
24
|
+
fileName: string;
|
|
25
|
+
mimeType: string;
|
|
26
|
+
fileSize: number;
|
|
27
|
+
localPath: string;
|
|
28
|
+
};
|
|
29
|
+
export type LocalAttachmentResult = {
|
|
30
|
+
images: PreparedLocalImage[];
|
|
31
|
+
notes: string[];
|
|
32
|
+
};
|
|
33
|
+
export declare function renderLocalAttachmentSection(section: LocalAttachmentResult): string;
|
|
34
|
+
export declare function formatBytes(bytes: number): string;
|
|
22
35
|
//# sourceMappingURL=prompt-fragments.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-fragments.d.ts","sourceRoot":"","sources":["../src/prompt-fragments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"prompt-fragments.d.ts","sourceRoot":"","sources":["../src/prompt-fragments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAoBD,wBAAgB,aAAa,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,MAAM,CAgB3D;AAED,0FAA0F;AAC1F,eAAO,MAAM,aAAa,mcAAqB,CAAC;AAEhD,eAAO,MAAM,aAAa,ynEA0CmC,CAAC;AAE9D,eAAO,MAAM,oBAAoB,wuHA2FkD,CAAC;AAEpF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAEF,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM,CAmBnF;AAMD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIjD"}
|
package/dist/prompt-fragments.js
CHANGED
|
@@ -21,6 +21,9 @@ of you.`;
|
|
|
21
21
|
function sanitizeProfileField(value) {
|
|
22
22
|
return value.replace(/[\r\n]+/g, " ").replace(/`/g, "'").trim();
|
|
23
23
|
}
|
|
24
|
+
function sanitizeProfileBlock(value) {
|
|
25
|
+
return value.replace(/\r\n?/g, "\n").trim();
|
|
26
|
+
}
|
|
24
27
|
export function buildIdentity(agent) {
|
|
25
28
|
if (!agent)
|
|
26
29
|
return PRLL_IDENTITY_BASE;
|
|
@@ -28,7 +31,10 @@ export function buildIdentity(agent) {
|
|
|
28
31
|
const lines = [PRLL_IDENTITY_BASE, "", "### Your Parall Identity", ""];
|
|
29
32
|
lines.push(`You are **${name}** (\`prll://${agent.userId}\`).`);
|
|
30
33
|
if (agent.description) {
|
|
31
|
-
|
|
34
|
+
const description = sanitizeProfileBlock(agent.description);
|
|
35
|
+
if (description) {
|
|
36
|
+
lines.push("", "### Your Agent Profile", "", description);
|
|
37
|
+
}
|
|
32
38
|
}
|
|
33
39
|
lines.push("", `When you see \`${agent.userId}\` or \`prll://${agent.userId}\` in messages, mentions, or events — that's you.`);
|
|
34
40
|
return lines.join("\n");
|
|
@@ -67,6 +73,14 @@ acting, unless you've been explicitly authorized.
|
|
|
67
73
|
Other agents share this workspace. Before starting work, check whether someone
|
|
68
74
|
— human or agent — has already picked it up. Coordination beats racing.
|
|
69
75
|
|
|
76
|
+
### Permissions and approvals
|
|
77
|
+
You have real permissions based on your roles (chat member/admin, org member).
|
|
78
|
+
If you lack permission for an action, the API returns PERMISSION_DENIED with the
|
|
79
|
+
\`action\` and \`resource_uri\` that were denied. When that happens, use
|
|
80
|
+
\`approvals request\` to ask someone with permission to approve it — don't retry
|
|
81
|
+
or work around the denial. Only request approval after an actual denial, never
|
|
82
|
+
preemptively.
|
|
83
|
+
|
|
70
84
|
### When in doubt
|
|
71
85
|
Prefer asking over guessing. Prefer "I don't know" over fabricating. Your
|
|
72
86
|
credibility is what you bring to the workspace — protect it.`;
|
|
@@ -119,9 +133,9 @@ resolves and renders the entity title automatically.
|
|
|
119
133
|
An event only carries the single triggering message. If you're mentioned in a
|
|
120
134
|
group chat and lack context, pull what you need from the chat — don't guess:
|
|
121
135
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
136
|
+
parall messages list cht_xxx --limit 20 --before msg_xxx
|
|
137
|
+
parall messages get msg_xxx
|
|
138
|
+
parall chats get cht_xxx
|
|
125
139
|
|
|
126
140
|
Rule of thumb: in a group chat mention, the conversation that led up to you
|
|
127
141
|
being called almost always matters — read it before replying. In a DM, your
|
|
@@ -138,17 +152,17 @@ Messages may include attachments. They appear in events as:
|
|
|
138
152
|
|
|
139
153
|
To download an attachment, use the CLI:
|
|
140
154
|
|
|
141
|
-
|
|
155
|
+
parall files download att_xxx --output /tmp/screenshot.png
|
|
142
156
|
|
|
143
157
|
To send a file:
|
|
144
158
|
|
|
145
|
-
|
|
159
|
+
parall messages send prll://cht_xxx --file /tmp/output.png --text "Done"
|
|
146
160
|
|
|
147
161
|
Or upload first and reuse across chats:
|
|
148
162
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
163
|
+
parall files upload /tmp/report.pdf
|
|
164
|
+
parall messages send prll://cht_aaa --attachment att_yyy --text "Report"
|
|
165
|
+
parall messages send prll://cht_bbb --attachment att_yyy --text "FYI"
|
|
152
166
|
|
|
153
167
|
### When to reference
|
|
154
168
|
|
|
@@ -162,3 +176,30 @@ Or upload first and reuse across chats:
|
|
|
162
176
|
|
|
163
177
|
Other agents and humans read your output. References build a navigable context graph —
|
|
164
178
|
in multi-agent workflows, your references are the map that the next agent follows.`;
|
|
179
|
+
export function renderLocalAttachmentSection(section) {
|
|
180
|
+
if (section.images.length === 0 && section.notes.length === 0)
|
|
181
|
+
return "";
|
|
182
|
+
// Each image renders as a metadata header line plus the absolute path on
|
|
183
|
+
// its own line. The path stands alone (no quoting / escaping) so file-
|
|
184
|
+
// reading tools can consume it verbatim — paths inside the attachment root
|
|
185
|
+
// are sanitized to ASCII-safe segments, and the workspace dir comes from
|
|
186
|
+
// the bridge operator. A pathological workspace dir with embedded newlines
|
|
187
|
+
// would split across lines; that's exotic enough not to warrant scrubbing
|
|
188
|
+
// every consumer's path through escape rules.
|
|
189
|
+
const lines = ["[Local attachment files]"];
|
|
190
|
+
for (const image of section.images) {
|
|
191
|
+
lines.push(`- prll://${image.attachmentId} (${sanitizePromptMeta(image.mimeType)}, ${formatBytes(image.fileSize)}, ${sanitizePromptMeta(image.fileName)})`, ` ${image.localPath}`);
|
|
192
|
+
}
|
|
193
|
+
lines.push(...section.notes);
|
|
194
|
+
return lines.join("\n");
|
|
195
|
+
}
|
|
196
|
+
function sanitizePromptMeta(value) {
|
|
197
|
+
return value.replace(/[\r\n]+/g, " ").replace(/[()]/g, " ").trim();
|
|
198
|
+
}
|
|
199
|
+
export function formatBytes(bytes) {
|
|
200
|
+
if (bytes >= 1048576)
|
|
201
|
+
return `${(bytes / 1048576).toFixed(1)}MB`;
|
|
202
|
+
if (bytes >= 1024)
|
|
203
|
+
return `${Math.round(bytes / 1024)}KB`;
|
|
204
|
+
return `${bytes}B`;
|
|
205
|
+
}
|
package/dist/types.d.ts
CHANGED
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,MAAM,MAAM,UAAU,GAAG;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACjE,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,2DAA2D;AAC3D,MAAM,MAAM,aAAa,GAAG;IAC1B,eAAe,EAAE,OAAO,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,kBAAkB,EAAE,UAAU,EAAE,CAAC;IACjC,UAAU,EAAE,WAAW,EAAE,CAAC;CAC3B,CAAC;AAEF,4CAA4C;AAC5C,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,cAAc,GAAG,UAAU,CAAC;IACvD,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,KAAK,CAAC;QAClB,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;IACH,8DAA8D;IAC9D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,SAAS,GAAG,eAAe,GAAG,SAAS,GAAG,cAAc,CAAC;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,MAAM,MAAM,UAAU,GAAG;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACjE,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,2DAA2D;AAC3D,MAAM,MAAM,aAAa,GAAG;IAC1B,eAAe,EAAE,OAAO,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,kBAAkB,EAAE,UAAU,EAAE,CAAC;IACjC,UAAU,EAAE,WAAW,EAAE,CAAC;CAC3B,CAAC;AAEF,4CAA4C;AAC5C,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,cAAc,GAAG,UAAU,CAAC;IACvD,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,KAAK,CAAC;QAClB,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;IACH,8DAA8D;IAC9D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,SAAS,GAAG,eAAe,GAAG,SAAS,GAAG,cAAc,CAAC;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parall/agent-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.0",
|
|
4
4
|
"description": "Shared agent runtime orchestration helpers for Parall",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
".": {
|
|
16
16
|
"types": "./dist/index.d.ts",
|
|
17
17
|
"import": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./internal/attachment-input": {
|
|
20
|
+
"types": "./dist/internal/attachment-input.d.ts",
|
|
21
|
+
"import": "./dist/internal/attachment-input.js"
|
|
18
22
|
}
|
|
19
23
|
},
|
|
20
24
|
"files": [
|
|
@@ -22,7 +26,7 @@
|
|
|
22
26
|
"src"
|
|
23
27
|
],
|
|
24
28
|
"dependencies": {
|
|
25
|
-
"@parall/sdk": "1.
|
|
29
|
+
"@parall/sdk": "1.24.0"
|
|
26
30
|
},
|
|
27
31
|
"devDependencies": {
|
|
28
32
|
"@types/node": "^22.0.0",
|
package/src/bridge-workspace.ts
CHANGED
|
@@ -22,15 +22,21 @@ To say something in a chat, you **must** invoke the Parall CLI via your shell/ex
|
|
|
22
22
|
|
|
23
23
|
## Parall CLI
|
|
24
24
|
|
|
25
|
-
All outbound interactions go through
|
|
25
|
+
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.
|
|
26
26
|
|
|
27
|
-
- \`
|
|
28
|
-
- \`
|
|
29
|
-
- \`
|
|
30
|
-
- \`
|
|
27
|
+
- \`parall messages send prll://cht_xxx --text "..."\` — reply into the triggering chat
|
|
28
|
+
- \`parall dm prll://usr_xxx --text "..." [--no-reply]\` — direct message another user
|
|
29
|
+
- \`parall tasks update prll://tsk_xxx --status in_progress\` — task state
|
|
30
|
+
- \`parall no-reply [--reason "..."]\` — explicitly declare this turn silent (audit signal; not required for silence, just clarifies intent)
|
|
31
31
|
|
|
32
32
|
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.
|
|
33
33
|
|
|
34
|
+
## Attachments
|
|
35
|
+
|
|
36
|
+
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.
|
|
37
|
+
|
|
38
|
+
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 ...\`.
|
|
39
|
+
|
|
34
40
|
## Guardrails
|
|
35
41
|
|
|
36
42
|
- 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.
|
|
@@ -39,6 +45,17 @@ The bridge injects Parall context via environment variables. The static credenti
|
|
|
39
45
|
- Keep CLI replies concise and task-focused.
|
|
40
46
|
|
|
41
47
|
See \`docs/engineering-design/agent-dm-loop-prevention.md\` § Layer 0 for why plain text is never auto-projected.
|
|
48
|
+
|
|
49
|
+
## Approval Flow
|
|
50
|
+
|
|
51
|
+
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:
|
|
52
|
+
|
|
53
|
+
1. The error includes a \`PERMISSION_DENIED\` code — use the action and resource from your original command in the approval request
|
|
54
|
+
2. Request approval: \`parall approvals request --action chat.archive --resource prll://cht_123 --chat prll://cht_456 --title "Archive #old-project" --reason "Channel inactive"\`
|
|
55
|
+
3. A card will appear in the specified chat for someone with permission to approve
|
|
56
|
+
4. Check the result later with \`parall approvals list\`
|
|
57
|
+
|
|
58
|
+
Only request approval when you've actually been denied permission. Don't request approval preemptively.
|
|
42
59
|
`;
|
|
43
60
|
|
|
44
61
|
/** Extracts the `command` string from a shell/bash tool call's input payload. */
|
package/src/event-format.ts
CHANGED
|
@@ -31,6 +31,7 @@ export function buildEventBody(event: ParallEvent): string {
|
|
|
31
31
|
? `${event.targetName} (prll://${event.targetId})`
|
|
32
32
|
: `prll://${event.targetId}`;
|
|
33
33
|
lines.push(`[Task: ${taskLabel}]`);
|
|
34
|
+
if (event.deliveryReason) lines.push(`[Delivery: ${sanitizeMeta(event.deliveryReason)}]`);
|
|
34
35
|
lines.push(`[From: ${event.senderName} (prll://${event.senderId})]`);
|
|
35
36
|
lines.push(`[Comment ID: prll://${event.messageId}]`);
|
|
36
37
|
lines.push("", event.body);
|
package/src/gateway-base.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
Chat,
|
|
9
9
|
ChatUpdateData,
|
|
10
10
|
Comment,
|
|
11
|
+
DispatchDeliveryReason,
|
|
11
12
|
DispatchNewData,
|
|
12
13
|
HelloData,
|
|
13
14
|
MessageNewData,
|
|
@@ -264,7 +265,7 @@ export class ParallAgentGateway {
|
|
|
264
265
|
if (data.event_type === "task_comment") {
|
|
265
266
|
if (!data.source_id || !data.task_id) return;
|
|
266
267
|
try {
|
|
267
|
-
const dispatched = await this.handleTaskComment(data.source_id, data.task_id, data.actor_id);
|
|
268
|
+
const dispatched = await this.handleTaskComment(data.source_id, data.task_id, data.actor_id, data.delivery_reason);
|
|
268
269
|
if (dispatched) {
|
|
269
270
|
this.opts.client.ackDispatchByID(this.opts.config.org_id, data.id).catch(() => {});
|
|
270
271
|
}
|
|
@@ -958,7 +959,12 @@ export class ParallAgentGateway {
|
|
|
958
959
|
return dispatched;
|
|
959
960
|
}
|
|
960
961
|
|
|
961
|
-
private async handleTaskComment(
|
|
962
|
+
private async handleTaskComment(
|
|
963
|
+
commentId: string,
|
|
964
|
+
taskId: string,
|
|
965
|
+
actorId: string | null,
|
|
966
|
+
deliveryReason?: DispatchDeliveryReason | null,
|
|
967
|
+
): Promise<boolean> {
|
|
962
968
|
if (this.shuttingDown) return false; // drain window — let server requeue via catch-up
|
|
963
969
|
const dedupeKey = `comment:${commentId}`;
|
|
964
970
|
if (this.dispatchedTasks.has(dedupeKey)) return false;
|
|
@@ -1015,6 +1021,7 @@ export class ParallAgentGateway {
|
|
|
1015
1021
|
senderName: comment.author?.display_name ?? actorId ?? "unknown",
|
|
1016
1022
|
messageId: commentId,
|
|
1017
1023
|
body: parts.join("\n"),
|
|
1024
|
+
deliveryReason: deliveryReason ?? undefined,
|
|
1018
1025
|
ackSourceType: "comment",
|
|
1019
1026
|
ackSourceId: commentId,
|
|
1020
1027
|
};
|
|
@@ -1152,7 +1159,7 @@ export class ParallAgentGateway {
|
|
|
1152
1159
|
dispatched = true;
|
|
1153
1160
|
}
|
|
1154
1161
|
} else if (item.event_type === "task_comment" && item.source_id && item.task_id) {
|
|
1155
|
-
dispatched = await this.handleTaskComment(item.source_id, item.task_id, item.actor_id);
|
|
1162
|
+
dispatched = await this.handleTaskComment(item.source_id, item.task_id, item.actor_id, item.delivery_reason);
|
|
1156
1163
|
} else if (item.event_type === "schedule.fire" && item.source_id) {
|
|
1157
1164
|
dispatched = await this.fetchAndHandleScheduleFire(item.source_id, item.actor_id);
|
|
1158
1165
|
} else if (item.event_type === "message" && item.source_id && item.chat_id) {
|