@snowyroad/arp 0.5.0 → 0.5.1
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/cli.js +13 -13
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -781,14 +781,14 @@ ${fence("peer roster", joinUntrusted(lines, "\n"))}`;
|
|
|
781
781
|
}
|
|
782
782
|
|
|
783
783
|
// src/channelContext.ts
|
|
784
|
-
var
|
|
784
|
+
var MAX_INJECTED_INSTRUCTIONS_CHARS = 8e3;
|
|
785
785
|
var MAX_INJECTED_SOURCE_CHARS = 8e3;
|
|
786
786
|
var MAX_INJECTED_SOURCES_TOTAL_CHARS = 24e3;
|
|
787
787
|
function buildChannelContext(input) {
|
|
788
788
|
let out = "";
|
|
789
|
-
if (!isBlankText(input.
|
|
790
|
-
const raw = rawUntrusted(input.
|
|
791
|
-
const bounded = raw.length >
|
|
789
|
+
if (!isBlankText(input.instructions)) {
|
|
790
|
+
const raw = rawUntrusted(input.instructions);
|
|
791
|
+
const bounded = raw.length > MAX_INJECTED_INSTRUCTIONS_CHARS ? untrusted(raw.slice(0, MAX_INJECTED_INSTRUCTIONS_CHARS) + "\n[...truncated]") : input.instructions;
|
|
792
792
|
out += `## Channel Instructions (standing guidance for this channel)
|
|
793
793
|
${fence("channel instructions", bounded)}
|
|
794
794
|
---
|
|
@@ -1505,21 +1505,21 @@ var RelayClient = class {
|
|
|
1505
1505
|
console.warn("[arp-bridge] flow post failed:", sanitizeForTty(String(err)));
|
|
1506
1506
|
}
|
|
1507
1507
|
}
|
|
1508
|
-
/** Channel
|
|
1509
|
-
async
|
|
1508
|
+
/** Channel instructions text (empty if none or on error — never throws). Branded (H2-4). */
|
|
1509
|
+
async fetchChannelInstructions(channelId) {
|
|
1510
1510
|
const ch = this.pathId(channelId, "channelId");
|
|
1511
1511
|
if (!ch) return untrusted("");
|
|
1512
|
-
const url = `${this.cfg.relayHttpUrl}/channels/${ch}/
|
|
1512
|
+
const url = `${this.cfg.relayHttpUrl}/channels/${ch}/instructions`;
|
|
1513
1513
|
try {
|
|
1514
1514
|
const res = await this.deps.fetchFn(url, { headers: { Authorization: `Bearer ${this.cfg.token}` } });
|
|
1515
1515
|
if (!res.ok) {
|
|
1516
|
-
console.warn("[arp-bridge]
|
|
1516
|
+
console.warn("[arp-bridge] instructions HTTP", res.status);
|
|
1517
1517
|
return untrusted("");
|
|
1518
1518
|
}
|
|
1519
1519
|
const data = await res.json();
|
|
1520
1520
|
return untrusted(typeof data?.content === "string" ? data.content : "");
|
|
1521
1521
|
} catch (err) {
|
|
1522
|
-
console.warn("[arp-bridge]
|
|
1522
|
+
console.warn("[arp-bridge] instructions fetch failed:", sanitizeForTty(String(err)));
|
|
1523
1523
|
return untrusted("");
|
|
1524
1524
|
}
|
|
1525
1525
|
}
|
|
@@ -1604,18 +1604,18 @@ var RelayClient = class {
|
|
|
1604
1604
|
return null;
|
|
1605
1605
|
}
|
|
1606
1606
|
}
|
|
1607
|
-
/** Assemble the situational channel-context block (
|
|
1607
|
+
/** Assemble the situational channel-context block (instructions + sources + topics) for a
|
|
1608
1608
|
* passive message. Parallel fetch with per-source graceful degradation (each fetcher
|
|
1609
1609
|
* swallows its own errors). Returns "" when there is nothing to inject.
|
|
1610
1610
|
* The fetchers return raw structured data; untrusted-data fencing happens ONCE, in
|
|
1611
1611
|
* buildChannelContext (the single-layer rule, see untrusted.ts). Do not fence here. */
|
|
1612
1612
|
async fetchChannelContext(channelId) {
|
|
1613
|
-
const [
|
|
1614
|
-
this.
|
|
1613
|
+
const [instructions, topics, pins] = await Promise.all([
|
|
1614
|
+
this.fetchChannelInstructions(channelId),
|
|
1615
1615
|
this.fetchChannelTopics(channelId),
|
|
1616
1616
|
this.fetchSourcesContext(channelId)
|
|
1617
1617
|
]);
|
|
1618
|
-
return buildChannelContext({
|
|
1618
|
+
return buildChannelContext({ instructions, topics, pins });
|
|
1619
1619
|
}
|
|
1620
1620
|
/** Fetch a flow's transcript (used to backfill a minimal turn_notification). [] on error. */
|
|
1621
1621
|
async fetchFlowMessages(channelId, flowId) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snowyroad/arp",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Connect your own coding agent (Claude Code, Codex, Gemini, Grok) to an Agent Relay Protocol channel and collaborate with other agents and humans.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "SnowyRoad",
|