@agentvault/muse-bridge 0.1.37 → 0.1.39
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/README.md +46 -5
- package/dist/bridge.d.ts +40 -7
- package/dist/identity-prompt.d.ts +5 -0
- package/dist/index.js +532 -83
- package/dist/muse-driver.d.ts +9 -0
- package/dist/muse-provider.d.ts +2 -0
- package/dist/muse-session.d.ts +50 -15
- package/dist/turn-failure.d.ts +39 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -62,11 +62,52 @@ the conversation and tool history remain available. The adapter neither edits
|
|
|
62
62
|
Muse journals nor rotates session IDs. It binds only to loopback with a fresh
|
|
63
63
|
secret route and closes at turn end. Diagnostics contain counts and fixed outcomes.
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
## When a reply fails
|
|
66
|
+
|
|
67
|
+
A failed turn is never silent. Here is what happens, step by step:
|
|
68
|
+
|
|
69
|
+
1. **The bridge records it.** It sends one `model_turn` problem to the agent's
|
|
70
|
+
Health page (Recent problems), with a code for the cause and the chat it was
|
|
71
|
+
answering. It also writes one log line:
|
|
72
|
+
`turn_failed code=<code> exit=<exit status or none>`. Meta's status number and
|
|
73
|
+
a short error-type token may follow it. Provider text, request ids and message
|
|
74
|
+
text never go to the log, the chat or Health.
|
|
75
|
+
2. **Then it tells the chat.** If the turn owed a reply (an owner 1:1, or a room
|
|
76
|
+
message addressed to this agent), it posts one short sentence in that chat:
|
|
77
|
+
- In your 1:1, the sentence names the cause, such as an expired Meta sign-in.
|
|
78
|
+
- In a room, it is always the plain "couldn't answer this message" sentence.
|
|
79
|
+
The cause is about your own Meta account, so it stays private on Health.
|
|
80
|
+
The notice waits at most ten seconds before the next queued turn goes ahead.
|
|
81
|
+
|
|
82
|
+
The causes this bridge can tell apart today:
|
|
83
|
+
|
|
84
|
+
| Code | What it means |
|
|
85
|
+
|---|---|
|
|
86
|
+
| `provider_auth_failed` | Meta answered 401: sign in again on the agent's computer. |
|
|
87
|
+
| `provider_billing` | Meta answered 402. |
|
|
88
|
+
| `model_rate_limited` | Meta answered 429. Try again in a few minutes. |
|
|
89
|
+
| `model_unavailable` | Meta answered 404: the model is no longer available. |
|
|
90
|
+
| `provider_unreachable` | Meta answered 5xx, or the bridge could not reach Meta at all. |
|
|
91
|
+
| `ai_tool_unsupported` | The `muse` binary is missing, not executable, or TUI-only. |
|
|
92
|
+
| `model_error` | Anything else, including a turn that timed out. |
|
|
93
|
+
|
|
94
|
+
**A saved session that can't be reopened restarts by itself.** Each lane (your
|
|
95
|
+
own, and the shared one for everyone else) resumes one saved Muse session. When
|
|
96
|
+
Meta says that session's saved reasoning has expired, the turn would fail every
|
|
97
|
+
time. Instead, the bridge starts one new session, gives it that chat's recent
|
|
98
|
+
messages, and answers your message. No notice is sent. The log says
|
|
99
|
+
`turn_recovered code=session_resume_failed lane=<owner|shared>`.
|
|
100
|
+
|
|
101
|
+
- The new id replaces the old one in `muse-session-id` (or
|
|
102
|
+
`muse-owner-session-id`) only after the new session answers.
|
|
103
|
+
- The first id it ever replaced is kept in `<file>.prev`. That file is never
|
|
104
|
+
overwritten.
|
|
105
|
+
- It tries this once per turn. If the new session fails too, you get the notice.
|
|
106
|
+
- Your lane is seeded only from your own 1:1 chat. A full-access room turn is not
|
|
107
|
+
seeded at all, so other members' words never enter your lane. The shared lane
|
|
108
|
+
is seeded only from the room being answered.
|
|
109
|
+
|
|
110
|
+
Tip: to find these in the log, search for `turn_failed` or `turn_recovered`.
|
|
70
111
|
|
|
71
112
|
## Copied-from ledger — REVIEW PERIODICALLY
|
|
72
113
|
|
package/dist/bridge.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* `arming_snapshot` (`=== true` only). Do not copy grok grant-trim.
|
|
3
3
|
* Do not call decideArming, host-trust, or osIsolated. */
|
|
4
4
|
import { type ToolSpanSink } from "@agentvault/agentvault";
|
|
5
|
-
import type
|
|
5
|
+
import { type RoomSession, type TurnFailedReport } from "./muse-session.js";
|
|
6
6
|
import { type RoomContextLimits } from "./room-context.js";
|
|
7
7
|
export declare function workAllowed(): boolean;
|
|
8
8
|
export declare function gatesRemoved(): boolean;
|
|
@@ -15,6 +15,10 @@ export interface RoomMessage {
|
|
|
15
15
|
* `plaintext`. The @ gate reads this; absent on emitters < 0.23.42. */
|
|
16
16
|
caption?: string;
|
|
17
17
|
senderIsAgent?: boolean;
|
|
18
|
+
/** #1574 — SecureChannel: the room's audience, "private_pair" or "group".
|
|
19
|
+
* Passed through to owesRoomReply untyped; anything but "private_pair"
|
|
20
|
+
* (absent on emitters before #1574) reads as a group room. */
|
|
21
|
+
roomAudience?: unknown;
|
|
18
22
|
/** #1459 — SecureChannel: a human in THIS agent's own account. Absent on
|
|
19
23
|
* emitters < 0.23.55, which reads as "not the owner" (fail closed). */
|
|
20
24
|
senderIsOwner?: boolean;
|
|
@@ -27,6 +31,10 @@ export interface RoomMessage {
|
|
|
27
31
|
}
|
|
28
32
|
export interface MessageMeta {
|
|
29
33
|
roomId?: string;
|
|
34
|
+
/** SecureChannel's id for this message; the DR path records history under it. */
|
|
35
|
+
messageId?: string;
|
|
36
|
+
/** The message's send time (`created_at`); history records it as `ts`. */
|
|
37
|
+
timestamp?: string;
|
|
30
38
|
/** #1418 — the 1:1 conversation the message came from. A reply is sent as
|
|
31
39
|
* that conversation's turn, so it reaches that person only. */
|
|
32
40
|
conversationId?: string;
|
|
@@ -66,7 +74,34 @@ export interface RoomChannel {
|
|
|
66
74
|
on(ev: "state", cb: (s: string) => void): unknown;
|
|
67
75
|
sendToRoom(roomId: string, text: string): Promise<void>;
|
|
68
76
|
send(text: string): Promise<void>;
|
|
77
|
+
/** #1560: a room's recent history (SecureChannel). Seeds a fresh session only. */
|
|
78
|
+
getRoomHistory?(roomId: string, max: number): HistoryLine[];
|
|
79
|
+
/** #1560: one person's 1:1 history, scoped by the group the frame decrypted
|
|
80
|
+
* under (SecureChannel). Seeds a fresh owner-lane session only. */
|
|
81
|
+
getConversationHistory?(conversationId: string, max: number, opts?: {
|
|
82
|
+
groupId?: string;
|
|
83
|
+
}): HistoryLine[];
|
|
84
|
+
}
|
|
85
|
+
/** The part of a SecureChannel history entry a seed uses. */
|
|
86
|
+
export interface HistoryLine {
|
|
87
|
+
sender: string;
|
|
88
|
+
text: string;
|
|
89
|
+
id?: string;
|
|
90
|
+
ts?: string;
|
|
91
|
+
}
|
|
92
|
+
/** The message a turn answers, as far as SecureChannel identifies it. */
|
|
93
|
+
export interface CurrentMessage {
|
|
94
|
+
text: string;
|
|
95
|
+
id?: string;
|
|
96
|
+
ts?: string;
|
|
69
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* #1560: recent entries as `sender: text`, oldest first, for a fresh session.
|
|
100
|
+
* The bridge's own failure notices (today's and the old fixed line) are
|
|
101
|
+
* dropped, and so is the message being answered (it is the turn itself; an
|
|
102
|
+
* attachment message is captured as its caption alone). Undefined when empty.
|
|
103
|
+
*/
|
|
104
|
+
export declare function seedFrom(entries: HistoryLine[] | undefined, current?: CurrentMessage): string | undefined;
|
|
70
105
|
export declare class RoomHushState {
|
|
71
106
|
private until;
|
|
72
107
|
set(roomId: string, hushedUntilIso: string | null): void;
|
|
@@ -99,15 +134,13 @@ export interface ReplyChannel {
|
|
|
99
134
|
* conversation it answers — never the text or the error message. Never throws.
|
|
100
135
|
*/
|
|
101
136
|
/**
|
|
102
|
-
* #1467: a Muse turn failed. One `
|
|
103
|
-
*
|
|
104
|
-
*
|
|
137
|
+
* #1467/#1560: a Muse turn failed. One `model_turn` error span through the
|
|
138
|
+
* shared `reportModelTurnFailure`: the turn's code from the closed set, the
|
|
139
|
+
* conversation it was answering, and its duration. Never text. Never throws.
|
|
105
140
|
*/
|
|
106
141
|
export declare function reportTurnFailure(channel: {
|
|
107
142
|
telemetry?: ToolSpanSink | null;
|
|
108
|
-
} | undefined,
|
|
109
|
-
upstreamStatus?: number;
|
|
110
|
-
}): void;
|
|
143
|
+
} | undefined, report: Pick<TurnFailedReport, "code" | "conversation" | "durationMs">): void;
|
|
111
144
|
export declare class ActiveTarget {
|
|
112
145
|
private target;
|
|
113
146
|
setRoom(roomId: string): void;
|
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
* messages stopped running turns: the agent is shown only what @-mentions it,
|
|
6
6
|
* with what it missed arriving as a quoted context block. Telling the model it
|
|
7
7
|
* sees everything would have it treat that block as live conversation.
|
|
8
|
+
*
|
|
9
|
+
* #1574: a private room (one person + this agent) is the exception — every
|
|
10
|
+
* person's message there owes a reply with no name, and the turn itself carries
|
|
11
|
+
* the plugin's PRIVATE_ROOM_TURN_NOTE. Without this sentence the rules above
|
|
12
|
+
* would tell the model it was only shown a message because it was mentioned.
|
|
8
13
|
*/
|
|
9
14
|
export declare function roomRules(sayTool: string): string;
|
|
10
15
|
export declare function identityPrompt(agentName: string, sayTool: string): string;
|