@primusclaw/personal-agent-runtime 0.11.0 → 0.13.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/index.js +103 -7
- package/dist/types/claw/assistant.d.ts +1 -1
- package/dist/types/claw/remote-agents.d.ts +2 -1
- package/dist/types/metrics/index.d.ts +1 -1
- package/dist/types/metrics/prometheus-metrics.d.ts +10 -0
- package/dist/types/sqlite/assistant-repository.d.ts +2 -2
- package/dist/types/sqlite/remote-repository.d.ts +1 -0
- package/dist/worker.js +13 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -351,10 +351,11 @@ var HttpAssistant = class {
|
|
|
351
351
|
const query = new URLSearchParams({ lang, timezone }).toString();
|
|
352
352
|
return dataOf(await this.http.json({ method: "GET", path: `/v1/assistant/brief?${query}`, key: key2 }), "the brief");
|
|
353
353
|
}
|
|
354
|
-
async decideConfirmation(token, confirmationId, decision) {
|
|
354
|
+
async decideConfirmation(token, confirmationId, decision, choice) {
|
|
355
355
|
requireToken(token, "an answer to a held write");
|
|
356
356
|
const path = `/v1/assistant/confirmations/${segment(confirmationId)}/decision`;
|
|
357
|
-
const
|
|
357
|
+
const body = choice === void 0 ? { decision } : { decision, choice };
|
|
358
|
+
const out = objectOf(await this.http.json({ method: "POST", path, key: token, body }), "a decision");
|
|
358
359
|
return dataOrSelf(out);
|
|
359
360
|
}
|
|
360
361
|
async startReviews(token, request) {
|
|
@@ -555,6 +556,18 @@ var HttpRemoteAgents = class {
|
|
|
555
556
|
async setApprovals(key2, enabled) {
|
|
556
557
|
return enabledOf(await this.#call("PUT", "/approvals", key2, { enabled }));
|
|
557
558
|
}
|
|
559
|
+
async muteTerminal(key2, item2, muted) {
|
|
560
|
+
const data = anyDataOf(await this.#call("PUT", "/approvals/mutes", key2, { item: item2, muted }), "a terminal mute");
|
|
561
|
+
const d = data !== null && typeof data === "object" ? data : {};
|
|
562
|
+
if (typeof d["muted"] !== "boolean" || typeof d["item"] !== "number")
|
|
563
|
+
throw new ClawAnswerInvalid4("a terminal mute has no item or muted");
|
|
564
|
+
return {
|
|
565
|
+
item: d["item"],
|
|
566
|
+
muted: d["muted"],
|
|
567
|
+
machine: typeof d["machine"] === "string" ? d["machine"] : "",
|
|
568
|
+
title: typeof d["title"] === "string" ? d["title"] : ""
|
|
569
|
+
};
|
|
570
|
+
}
|
|
558
571
|
async pair(key2) {
|
|
559
572
|
return read(
|
|
560
573
|
remotePairingSchema,
|
|
@@ -1595,6 +1608,28 @@ var HELP = {
|
|
|
1595
1608
|
"Files a user sent that did not reach Claw, by where they were dropped."
|
|
1596
1609
|
]
|
|
1597
1610
|
};
|
|
1611
|
+
var HELP_CURRENT_ONLY = {
|
|
1612
|
+
personal_agent_probe_total: [
|
|
1613
|
+
"counter",
|
|
1614
|
+
"Delivery probes the worker answered, by outcome: answered (the relay's ack came back) or unanswered."
|
|
1615
|
+
],
|
|
1616
|
+
personal_agent_probe_feedback_ms: [
|
|
1617
|
+
"gauge",
|
|
1618
|
+
"Milliseconds from the last probe's sending (by the ingress) to the worker's answer queued for the relay."
|
|
1619
|
+
],
|
|
1620
|
+
personal_agent_probe_reply_ms: [
|
|
1621
|
+
"gauge",
|
|
1622
|
+
"Milliseconds from the last answered probe's sending to the relay's ack of the answer reaching the worker."
|
|
1623
|
+
],
|
|
1624
|
+
personal_agent_probe_last_answered_seconds: [
|
|
1625
|
+
"gauge",
|
|
1626
|
+
"Unix time of the last answered probe (0: none since the worker started)."
|
|
1627
|
+
],
|
|
1628
|
+
personal_agent_inbound_rearmed_total: [
|
|
1629
|
+
"counter",
|
|
1630
|
+
"Times the inbound receivers' connection was re-opened because a call on the broker hung (once per connection)."
|
|
1631
|
+
]
|
|
1632
|
+
};
|
|
1598
1633
|
function compareTuples(a, b) {
|
|
1599
1634
|
for (let i = 0; i < Math.min(a.length, b.length); i++) {
|
|
1600
1635
|
const x = a[i] ?? "";
|
|
@@ -1624,6 +1659,8 @@ var PrometheusMetrics = class {
|
|
|
1624
1659
|
/** (when, lag): decreasing lags, the sliding-window maximum. */
|
|
1625
1660
|
lags = [];
|
|
1626
1661
|
/** Event type -> (receipt to sent, occurred to sent), each written from the start. */
|
|
1662
|
+
probes = { answered: 0, unanswered: 0, feedbackMs: 0, replyMs: 0, answeredAt: 0 };
|
|
1663
|
+
rearmed = 0;
|
|
1627
1664
|
eventTimes = new Map(
|
|
1628
1665
|
DELIVERED_EVENT_TYPES.map((t) => [t, [new Histogram(EVENT_BUCKETS), new Histogram(EVENT_BUCKETS)]])
|
|
1629
1666
|
);
|
|
@@ -1668,6 +1705,23 @@ var PrometheusMetrics = class {
|
|
|
1668
1705
|
if (current === void 0 || count <= 0) return;
|
|
1669
1706
|
this.dropped.set(path, current + Math.trunc(count));
|
|
1670
1707
|
}
|
|
1708
|
+
probed(feedbackMs, replyMs) {
|
|
1709
|
+
const feedback = Math.max(Math.trunc(feedbackMs), 0);
|
|
1710
|
+
if (replyMs === null) {
|
|
1711
|
+
this.probes = { ...this.probes, unanswered: this.probes.unanswered + 1, feedbackMs: feedback };
|
|
1712
|
+
return;
|
|
1713
|
+
}
|
|
1714
|
+
this.probes = {
|
|
1715
|
+
answered: this.probes.answered + 1,
|
|
1716
|
+
unanswered: this.probes.unanswered,
|
|
1717
|
+
feedbackMs: feedback,
|
|
1718
|
+
replyMs: Math.max(Math.trunc(replyMs), 0),
|
|
1719
|
+
answeredAt: Math.trunc(this.clock.epochMs() / 1e3)
|
|
1720
|
+
};
|
|
1721
|
+
}
|
|
1722
|
+
inboundRearmed() {
|
|
1723
|
+
this.rearmed += 1;
|
|
1724
|
+
}
|
|
1671
1725
|
/** The longest wait of the messages handled in the window, in milliseconds (0: none). */
|
|
1672
1726
|
lagMaxMs() {
|
|
1673
1727
|
this.expire(this.clock.monotonicMs());
|
|
@@ -1682,7 +1736,28 @@ var PrometheusMetrics = class {
|
|
|
1682
1736
|
*/
|
|
1683
1737
|
render() {
|
|
1684
1738
|
const lagMaxMs = this.lagMaxMs();
|
|
1685
|
-
return this.renderAs(METRIC_PREFIX, lagMaxMs) + this.renderAs(LEGACY_METRIC_PREFIX, lagMaxMs);
|
|
1739
|
+
return this.renderAs(METRIC_PREFIX, lagMaxMs) + this.renderAs(LEGACY_METRIC_PREFIX, lagMaxMs) + this.renderCurrentOnly();
|
|
1740
|
+
}
|
|
1741
|
+
renderCurrentOnly() {
|
|
1742
|
+
const lines = [];
|
|
1743
|
+
const head2 = (name) => {
|
|
1744
|
+
const [kind, text3] = own2(HELP_CURRENT_ONLY, name) ?? ["untyped", ""];
|
|
1745
|
+
lines.push(`# HELP ${name} ${text3}`, `# TYPE ${name} ${kind}`);
|
|
1746
|
+
};
|
|
1747
|
+
head2("personal_agent_probe_total");
|
|
1748
|
+
lines.push(`personal_agent_probe_total{outcome="answered"} ${String(this.probes.answered)}`);
|
|
1749
|
+
lines.push(`personal_agent_probe_total{outcome="unanswered"} ${String(this.probes.unanswered)}`);
|
|
1750
|
+
const gauges = [
|
|
1751
|
+
["personal_agent_probe_feedback_ms", this.probes.feedbackMs],
|
|
1752
|
+
["personal_agent_probe_reply_ms", this.probes.replyMs],
|
|
1753
|
+
["personal_agent_probe_last_answered_seconds", this.probes.answeredAt],
|
|
1754
|
+
["personal_agent_inbound_rearmed_total", this.rearmed]
|
|
1755
|
+
];
|
|
1756
|
+
for (const [name, value] of gauges) {
|
|
1757
|
+
head2(name);
|
|
1758
|
+
lines.push(`${name} ${String(value)}`);
|
|
1759
|
+
}
|
|
1760
|
+
return lines.join("\n") + "\n";
|
|
1686
1761
|
}
|
|
1687
1762
|
renderAs(prefix, lagMaxMs) {
|
|
1688
1763
|
const lines = [];
|
|
@@ -2925,6 +3000,14 @@ import {
|
|
|
2925
3000
|
ASSISTANT_MESSAGE_KEEP_SECONDS,
|
|
2926
3001
|
CONFIRM_CARD_KEEP_SECONDS
|
|
2927
3002
|
} from "@primusclaw/personal-agent";
|
|
3003
|
+
function confirmOptions(text3) {
|
|
3004
|
+
return jsonList(text3 || "[]").flatMap((entry) => {
|
|
3005
|
+
if (typeof entry !== "object" || entry === null || Array.isArray(entry)) return [];
|
|
3006
|
+
const { id, label, detail } = entry;
|
|
3007
|
+
if (typeof id !== "string" || !id || typeof label !== "string") return [];
|
|
3008
|
+
return [{ id, label, detail: typeof detail === "string" ? detail : "" }];
|
|
3009
|
+
});
|
|
3010
|
+
}
|
|
2928
3011
|
function moveCard(db, table, cardId, state, options = {}) {
|
|
2929
3012
|
const from = options.onlyFrom;
|
|
2930
3013
|
return from ? db.run(`UPDATE ${table} SET state = ? WHERE card_id = ? AND state = ?`, state, cardId, from) === 1 : db.run(`UPDATE ${table} SET state = ? WHERE card_id = ?`, state, cardId) === 1;
|
|
@@ -3063,24 +3146,25 @@ var SqliteAssistantButtonRepository = class {
|
|
|
3063
3146
|
moveActionCard(cardId, state, options) {
|
|
3064
3147
|
return moveCard(this.ctx.db, "assistant_action_cards", cardId, state, options);
|
|
3065
3148
|
}
|
|
3066
|
-
addConfirmCard(userId, confirmationId, kind, label = "") {
|
|
3149
|
+
addConfirmCard(userId, confirmationId, kind, label = "", options = []) {
|
|
3067
3150
|
const now = this.ctx.now();
|
|
3068
3151
|
this.ctx.db.run("DELETE FROM assistant_confirm_cards WHERE created_at < ?", now - CONFIRM_CARD_KEEP_SECONDS);
|
|
3069
3152
|
const cardId = tokenUrlsafe(this.ctx.random, 12);
|
|
3070
3153
|
this.ctx.db.run(
|
|
3071
|
-
"INSERT INTO assistant_confirm_cards (card_id, aad_id, confirmation_id, kind, label, state, created_at) VALUES (?, ?, ?, ?, ?, 'open', ?)",
|
|
3154
|
+
"INSERT INTO assistant_confirm_cards (card_id, aad_id, confirmation_id, kind, label, state, created_at, options_json) VALUES (?, ?, ?, ?, ?, 'open', ?, ?)",
|
|
3072
3155
|
cardId,
|
|
3073
3156
|
userId,
|
|
3074
3157
|
confirmationId,
|
|
3075
3158
|
kind,
|
|
3076
3159
|
label,
|
|
3077
|
-
now
|
|
3160
|
+
now,
|
|
3161
|
+
JSON.stringify(options.map(({ id, label: shown, detail }) => ({ id, label: shown, detail })))
|
|
3078
3162
|
);
|
|
3079
3163
|
return cardId;
|
|
3080
3164
|
}
|
|
3081
3165
|
getConfirmCard(cardId) {
|
|
3082
3166
|
const row = this.ctx.db.get(
|
|
3083
|
-
"SELECT card_id, aad_id, confirmation_id, kind, label, state, created_at FROM assistant_confirm_cards WHERE card_id = ? AND created_at >= ?",
|
|
3167
|
+
"SELECT card_id, aad_id, confirmation_id, kind, label, options_json, state, created_at FROM assistant_confirm_cards WHERE card_id = ? AND created_at >= ?",
|
|
3084
3168
|
cardId,
|
|
3085
3169
|
this.ctx.now() - CONFIRM_CARD_KEEP_SECONDS
|
|
3086
3170
|
);
|
|
@@ -3091,6 +3175,7 @@ var SqliteAssistantButtonRepository = class {
|
|
|
3091
3175
|
confirmationId: col.str(row, "confirmation_id"),
|
|
3092
3176
|
kind: col.str(row, "kind"),
|
|
3093
3177
|
label: col.str(row, "label"),
|
|
3178
|
+
options: confirmOptions(col.str(row, "options_json")),
|
|
3094
3179
|
state: col.str(row, "state"),
|
|
3095
3180
|
createdAt: col.num(row, "created_at")
|
|
3096
3181
|
};
|
|
@@ -4140,6 +4225,8 @@ var ADDED_COLUMNS = [
|
|
|
4140
4225
|
["render_json", "TEXT NOT NULL DEFAULT ''"]
|
|
4141
4226
|
]
|
|
4142
4227
|
],
|
|
4228
|
+
["assistant_confirm_cards", [["options_json", "TEXT NOT NULL DEFAULT '[]'"]]],
|
|
4229
|
+
// a choice card's places; '[]' none
|
|
4143
4230
|
[
|
|
4144
4231
|
"pending_requests",
|
|
4145
4232
|
[
|
|
@@ -4654,6 +4741,14 @@ var SqliteRemotePermissionRepository = class {
|
|
|
4654
4741
|
p.lang ?? ""
|
|
4655
4742
|
) === 1;
|
|
4656
4743
|
}
|
|
4744
|
+
keepRemotePermission(sessionId, actionId, expiresAt) {
|
|
4745
|
+
return this.ctx.db.run(
|
|
4746
|
+
"UPDATE remote_permissions SET state = 'pending', expires_at = ? WHERE session_id = ? AND action_id = ? AND state IN ('pending', 'expired')",
|
|
4747
|
+
expiresAt,
|
|
4748
|
+
sessionId,
|
|
4749
|
+
actionId
|
|
4750
|
+
) === 1;
|
|
4751
|
+
}
|
|
4657
4752
|
getRemotePermission(sessionId, actionId) {
|
|
4658
4753
|
const row = this.ctx.db.get(
|
|
4659
4754
|
`SELECT ${PERMISSION_COLUMNS} FROM remote_permissions WHERE session_id = ? AND action_id = ?`,
|
|
@@ -6262,6 +6357,7 @@ export {
|
|
|
6262
6357
|
GithubDeviceFlow,
|
|
6263
6358
|
GithubIssueSink,
|
|
6264
6359
|
HELP,
|
|
6360
|
+
HELP_CURRENT_ONLY,
|
|
6265
6361
|
HttpIdentityLookup,
|
|
6266
6362
|
HttpKeyRevoker,
|
|
6267
6363
|
HttpTokenExchange,
|
|
@@ -17,7 +17,7 @@ export declare class HttpAssistant implements ClawAssistantPort {
|
|
|
17
17
|
}>;
|
|
18
18
|
send(key: ClawCredential, sessionId: string, text: string, options?: AssistantMessageOptions): Promise<string | null>;
|
|
19
19
|
brief(key: ClawCredential, lang: string, timezone: string): Promise<JsonObject>;
|
|
20
|
-
decideConfirmation(token: ClawCredential, confirmationId: string, decision: string): Promise<JsonObject>;
|
|
20
|
+
decideConfirmation(token: ClawCredential, confirmationId: string, decision: string, choice?: string): Promise<JsonObject>;
|
|
21
21
|
startReviews(token: ClawCredential, request: StartReviews): Promise<ReviewStart[]>;
|
|
22
22
|
observeScope(key: ClawCredential, scope: string): Promise<JsonObject>;
|
|
23
23
|
observe(key: ClawCredential, scope: string, content: string, messageId: string): Promise<JsonObject>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ClawCredential, type ClawRemoteAgentsPort, type JsonObject, type NewRemoteSession, type RemoteConnector, type RemoteEventRow, type RemoteHidden, type RemotePairing, type RemoteSession, type RemoteSetup, type SseEvent } from "@primusclaw/personal-agent";
|
|
1
|
+
import { type ClawCredential, type ClawRemoteAgentsPort, type JsonObject, type NewRemoteSession, type RemoteConnector, type RemoteEventRow, type RemoteHidden, type RemotePairing, type RemoteSession, type RemoteSetup, type SseEvent, type TerminalMute } from "@primusclaw/personal-agent";
|
|
2
2
|
import { type ClawHttp } from "./http.js";
|
|
3
3
|
/** `ClawRemoteAgentsPort` over Claw's HTTP API; every call names this client (`X-Claw-Client`) in Claw's audit trail. */
|
|
4
4
|
export declare class HttpRemoteAgents implements ClawRemoteAgentsPort {
|
|
@@ -12,6 +12,7 @@ export declare class HttpRemoteAgents implements ClawRemoteAgentsPort {
|
|
|
12
12
|
}): Promise<RemoteConnector[]>;
|
|
13
13
|
approvals(key: ClawCredential): Promise<boolean>;
|
|
14
14
|
setApprovals(key: ClawCredential, enabled: boolean): Promise<boolean>;
|
|
15
|
+
muteTerminal(key: ClawCredential, item: number, muted: boolean): Promise<TerminalMute>;
|
|
15
16
|
pair(key: ClawCredential): Promise<RemotePairing>;
|
|
16
17
|
hide(key: ClawCredential, connectorId: string, refs: readonly string[], hidden: boolean): Promise<RemoteHidden>;
|
|
17
18
|
revoke(key: ClawCredential, connectorId: string): Promise<void>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { formatNumber, pyFloatRepr, round3 } from "./exposition.js";
|
|
2
|
-
export { ALERTED, CONTENT_TYPE, EVENT_BUCKETS, HELP, LAG_WINDOW_MS, LEGACY_METRIC_PREFIX, METRIC_PREFIX, PrometheusMetrics, } from "./prometheus-metrics.js";
|
|
2
|
+
export { ALERTED, CONTENT_TYPE, EVENT_BUCKETS, HELP, HELP_CURRENT_ONLY, LAG_WINDOW_MS, LEGACY_METRIC_PREFIX, METRIC_PREFIX, PrometheusMetrics, } from "./prometheus-metrics.js";
|
|
@@ -22,6 +22,11 @@ type Labels = ReadonlyArray<readonly [string, string]>;
|
|
|
22
22
|
export declare const ALERTED: ReadonlyArray<readonly [string, Labels]>;
|
|
23
23
|
/** Every metric (by its `personal_agent_` name): its type and help text. */
|
|
24
24
|
export declare const HELP: Readonly<Record<string, readonly [string, string]>>;
|
|
25
|
+
/**
|
|
26
|
+
* The series added after the names changed: written under their `personal_agent_` names only (no earlier release wrote
|
|
27
|
+
* them), after both halves above, so that the text an earlier release wrote stays as it was.
|
|
28
|
+
*/
|
|
29
|
+
export declare const HELP_CURRENT_ONLY: Readonly<Record<string, readonly [string, string]>>;
|
|
25
30
|
/** The MetricsPort of a worker, kept in memory and written in the Prometheus text format. */
|
|
26
31
|
export declare class PrometheusMetrics implements MetricsPort {
|
|
27
32
|
private readonly clock;
|
|
@@ -35,6 +40,8 @@ export declare class PrometheusMetrics implements MetricsPort {
|
|
|
35
40
|
/** (when, lag): decreasing lags, the sliding-window maximum. */
|
|
36
41
|
private readonly lags;
|
|
37
42
|
/** Event type -> (receipt to sent, occurred to sent), each written from the start. */
|
|
43
|
+
private probes;
|
|
44
|
+
private rearmed;
|
|
38
45
|
private readonly eventTimes;
|
|
39
46
|
constructor(clock: Clock, lagWindowMs?: number);
|
|
40
47
|
/** Inbound messages handled so far. */
|
|
@@ -44,6 +51,8 @@ export declare class PrometheusMetrics implements MetricsPort {
|
|
|
44
51
|
processed(lagMs: number | null, handleMs: number, ok: boolean): void;
|
|
45
52
|
limited(reason: string): void;
|
|
46
53
|
filesDropped(path: string, count?: number): void;
|
|
54
|
+
probed(feedbackMs: number, replyMs: number | null): void;
|
|
55
|
+
inboundRearmed(): void;
|
|
47
56
|
/** The longest wait of the messages handled in the window, in milliseconds (0: none). */
|
|
48
57
|
lagMaxMs(): number;
|
|
49
58
|
private expire;
|
|
@@ -52,6 +61,7 @@ export declare class PrometheusMetrics implements MetricsPort {
|
|
|
52
61
|
* help, under the deprecated names of an earlier release (that half is the text it wrote, byte for byte).
|
|
53
62
|
*/
|
|
54
63
|
render(): string;
|
|
64
|
+
private renderCurrentOnly;
|
|
55
65
|
private renderAs;
|
|
56
66
|
}
|
|
57
67
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** The assistant's cards and messages on SQLite (tables `assistant_cards`, `auto_replies`, `assistant_action_cards`,
|
|
2
2
|
* `assistant_confirm_cards`, `assistant_choice_cards`, `assistant_messages`). */
|
|
3
|
-
import { type ActionCard, type AssistantButtonRepository, type AssistantCard, type AssistantCardRepository, type AssistantMessage, type AssistantMessageRepository, type CardState, type ChoiceCard, type ConfirmCard, type JsonObject, type MoveOptions, type PlacedCard } from "@primusclaw/personal-agent";
|
|
3
|
+
import { type ActionCard, type AssistantButtonRepository, type AssistantCard, type AssistantCardRepository, type AssistantMessage, type AssistantMessageRepository, type CardState, type ChoiceCard, type ConfirmCard, type ConfirmCardOption, type JsonObject, type MoveOptions, type PlacedCard } from "@primusclaw/personal-agent";
|
|
4
4
|
import { type StoreContext } from "./context.js";
|
|
5
5
|
export declare class SqliteAssistantCardRepository implements AssistantCardRepository {
|
|
6
6
|
private readonly ctx;
|
|
@@ -29,7 +29,7 @@ export declare class SqliteAssistantButtonRepository implements AssistantButtonR
|
|
|
29
29
|
addActionCard(userId: string, channelMessageId: string, name: string, args: string): string;
|
|
30
30
|
getActionCard(cardId: string): ActionCard | null;
|
|
31
31
|
moveActionCard(cardId: string, state: CardState, options?: MoveOptions): boolean;
|
|
32
|
-
addConfirmCard(userId: string, confirmationId: string, kind: string, label?: string): string;
|
|
32
|
+
addConfirmCard(userId: string, confirmationId: string, kind: string, label?: string, options?: readonly ConfirmCardOption[]): string;
|
|
33
33
|
getConfirmCard(cardId: string): ConfirmCard | null;
|
|
34
34
|
moveConfirmCard(cardId: string, state: CardState, options?: MoveOptions): boolean;
|
|
35
35
|
addChoiceCard(userId: string, choice: {
|
|
@@ -14,6 +14,7 @@ export declare class SqliteRemotePermissionRepository implements RemotePermissio
|
|
|
14
14
|
private readonly ctx;
|
|
15
15
|
constructor(ctx: StoreContext);
|
|
16
16
|
saveRemotePermission(p: NewRemotePermission): boolean;
|
|
17
|
+
keepRemotePermission(sessionId: string, actionId: string, expiresAt: number): boolean;
|
|
17
18
|
getRemotePermission(sessionId: string, actionId: string): RemotePermission | null;
|
|
18
19
|
pendingRemotePermissions(userId: string, sessionId: string): RemotePermission[];
|
|
19
20
|
waitingRemoteSessions(userId: string): Set<string>;
|
package/dist/worker.js
CHANGED
|
@@ -99,6 +99,7 @@ import {
|
|
|
99
99
|
channelActions,
|
|
100
100
|
channelContext,
|
|
101
101
|
connectionsText,
|
|
102
|
+
forwardBlock,
|
|
102
103
|
limitsText,
|
|
103
104
|
MessageRateLimiter,
|
|
104
105
|
noteMessage,
|
|
@@ -118,7 +119,11 @@ function isGroup(message) {
|
|
|
118
119
|
var mask = (text) => redactText(text).text;
|
|
119
120
|
function messageTextFor(channelName) {
|
|
120
121
|
return {
|
|
121
|
-
|
|
122
|
+
// (what the person forwarded, then what they quoted: both stand before their own words)
|
|
123
|
+
quoteBlock: (message, group) => [
|
|
124
|
+
forwardBlock(message.forwards ?? [], { group, redact: mask }),
|
|
125
|
+
quoteBlock(message.quotes, { group, redact: mask })
|
|
126
|
+
].filter(Boolean).join("\n\n"),
|
|
122
127
|
withLinks: (text, message) => withLinks(text, message.links, { group: isGroup(message), redact: mask }),
|
|
123
128
|
withQuote,
|
|
124
129
|
unreadable(message) {
|
|
@@ -528,6 +533,7 @@ function remoteAgents(base, inputs) {
|
|
|
528
533
|
sessionNames: store.remoteSessionNames,
|
|
529
534
|
permissions: store.remotePermissions,
|
|
530
535
|
prefs: store.prefs,
|
|
536
|
+
groupLanguage: store.groupLanguage,
|
|
531
537
|
references: store.references,
|
|
532
538
|
conversationFor: conversationFor(base),
|
|
533
539
|
credentialFor: async (person) => {
|
|
@@ -1534,6 +1540,12 @@ function withInboundStats(prometheus, stats) {
|
|
|
1534
1540
|
},
|
|
1535
1541
|
filesDropped: (path, count) => {
|
|
1536
1542
|
prometheus.filesDropped(path, count);
|
|
1543
|
+
},
|
|
1544
|
+
probed: (feedbackMs, replyMs) => {
|
|
1545
|
+
prometheus.probed(feedbackMs, replyMs);
|
|
1546
|
+
},
|
|
1547
|
+
inboundRearmed: () => {
|
|
1548
|
+
prometheus.inboundRearmed();
|
|
1537
1549
|
}
|
|
1538
1550
|
};
|
|
1539
1551
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primusclaw/personal-agent-runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Node adapters for the personal agent's ports (clock, randomness, logging, storage, Claw, metrics, HTTP), and, at @primusclaw/personal-agent-runtime/worker, the worker process on any chat surface.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@primusclaw/personal-agent": "0.
|
|
36
|
+
"@primusclaw/personal-agent": "0.13.0",
|
|
37
37
|
"fastify": "^5.12.8",
|
|
38
38
|
"zod": "^4.6.7"
|
|
39
39
|
}
|