@spinabot/brigade 1.14.0 → 1.15.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/convex/logs.d.ts CHANGED
@@ -2,14 +2,14 @@ export declare const appendSessionEvent: import("convex/server").RegisteredMutat
2
2
  toolName?: string | undefined;
3
3
  role?: string | undefined;
4
4
  content?: ArrayBuffer | undefined;
5
+ toolCallId?: string | undefined;
6
+ isError?: boolean | undefined;
5
7
  args?: ArrayBuffer | undefined;
6
8
  aborted?: boolean | undefined;
7
9
  inner?: string | undefined;
8
10
  delta?: string | undefined;
9
11
  stopReason?: string | undefined;
10
12
  errorMessage?: string | undefined;
11
- toolCallId?: string | undefined;
12
- isError?: boolean | undefined;
13
13
  result?: ArrayBuffer | undefined;
14
14
  attempt?: number | undefined;
15
15
  maxAttempts?: number | undefined;
@@ -35,14 +35,14 @@ export declare const readSessionEventTail: import("convex/server").RegisteredQue
35
35
  toolName?: string | undefined;
36
36
  role?: string | undefined;
37
37
  content?: ArrayBuffer | undefined;
38
+ toolCallId?: string | undefined;
39
+ isError?: boolean | undefined;
38
40
  args?: ArrayBuffer | undefined;
39
41
  aborted?: boolean | undefined;
40
42
  inner?: string | undefined;
41
43
  delta?: string | undefined;
42
44
  stopReason?: string | undefined;
43
45
  errorMessage?: string | undefined;
44
- toolCallId?: string | undefined;
45
- isError?: boolean | undefined;
46
46
  result?: ArrayBuffer | undefined;
47
47
  attempt?: number | undefined;
48
48
  maxAttempts?: number | undefined;
@@ -67,14 +67,14 @@ export declare const findLastError: import("convex/server").RegisteredQuery<"pub
67
67
  toolName?: string | undefined;
68
68
  role?: string | undefined;
69
69
  content?: ArrayBuffer | undefined;
70
+ toolCallId?: string | undefined;
71
+ isError?: boolean | undefined;
70
72
  args?: ArrayBuffer | undefined;
71
73
  aborted?: boolean | undefined;
72
74
  inner?: string | undefined;
73
75
  delta?: string | undefined;
74
76
  stopReason?: string | undefined;
75
77
  errorMessage?: string | undefined;
76
- toolCallId?: string | undefined;
77
- isError?: boolean | undefined;
78
78
  result?: ArrayBuffer | undefined;
79
79
  attempt?: number | undefined;
80
80
  maxAttempts?: number | undefined;
@@ -373,14 +373,14 @@ declare const _default: import("convex/server").SchemaDefinition<{
373
373
  toolName?: string | undefined;
374
374
  role?: string | undefined;
375
375
  content?: ArrayBuffer | undefined;
376
+ toolCallId?: string | undefined;
377
+ isError?: boolean | undefined;
376
378
  args?: ArrayBuffer | undefined;
377
379
  aborted?: boolean | undefined;
378
380
  inner?: string | undefined;
379
381
  delta?: string | undefined;
380
382
  stopReason?: string | undefined;
381
383
  errorMessage?: string | undefined;
382
- toolCallId?: string | undefined;
383
- isError?: boolean | undefined;
384
384
  result?: ArrayBuffer | undefined;
385
385
  attempt?: number | undefined;
386
386
  maxAttempts?: number | undefined;
@@ -421,7 +421,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
421
421
  messageCount: import("convex/values").VFloat64<number | undefined, "optional">;
422
422
  success: import("convex/values").VBoolean<boolean | undefined, "optional">;
423
423
  finalError: import("convex/values").VString<string | undefined, "optional">;
424
- }, "required", "type" | "agentId" | "sessionKey" | "toolName" | "role" | "content" | "ts" | "args" | "aborted" | "inner" | "delta" | "stopReason" | "errorMessage" | "toolCallId" | "isError" | "result" | "attempt" | "maxAttempts" | "delayMs" | "success" | "finalError" | "willRetry" | "messageCount" | "day" | "ownerId">, {
424
+ }, "required", "type" | "agentId" | "sessionKey" | "toolName" | "role" | "content" | "toolCallId" | "isError" | "ts" | "args" | "aborted" | "inner" | "delta" | "stopReason" | "errorMessage" | "result" | "attempt" | "maxAttempts" | "delayMs" | "success" | "finalError" | "willRetry" | "messageCount" | "day" | "ownerId">, {
425
425
  by_owner_day: ["ownerId", "day", "_creationTime"];
426
426
  by_owner_session: ["ownerId", "sessionKey", "ts", "_creationTime"];
427
427
  by_owner_error: ["ownerId", "isError", "ts", "_creationTime"];
@@ -1 +1 @@
1
- {"builtAt":1782494628001,"head":"0bb31be61f20c7c0a1de17024a71ea185306c42a","version":"1.14.0"}
1
+ {"builtAt":1782589728035,"head":"fa0363051abf78ec6be90b5a66212385c1558a78","version":"1.15.0"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Pure transcript-projection helpers for the connect TUI's reliable-streaming
3
+ * renderer. Extracted from `connect.ts` so the identity-key + message-text
4
+ * logic is unit-testable without driving Pi-TUI (the suite convention — see
5
+ * `connect.test.ts`, which exercises pure helpers directly).
6
+ *
7
+ * No brand / chalk / widget coupling: these return raw keys + strings; the
8
+ * caller wraps them in Pi-TUI widgets and colour, and applies the terminal
9
+ * escape scrub (`scrubRenderable`) between joining and clipping tool output.
10
+ */
11
+ /**
12
+ * Identity key for an assistant message's render block: `${depth}:${timestamp}`.
13
+ *
14
+ * Pi stamps each assistant message with a stable `timestamp` at creation that
15
+ * is constant across all of its `message_update`s and its `message_end`, and a
16
+ * NEW message (e.g. the continuation after a tool call) gets a NEW timestamp.
17
+ * So one logical message owns exactly one block — a block lands where its
18
+ * message belongs in the stream (never above a tool it came after), a
19
+ * late/duplicate update resolves to its own block instead of spawning a copy,
20
+ * and re-applying a message on `resume` is idempotent. `depth` keeps sub-agent
21
+ * (≥1) streams from colliding with the top-level (0) stream. Falls back to
22
+ * `"live"` only if a message somehow lacks a timestamp (shouldn't happen — the
23
+ * field is required on Pi messages).
24
+ */
25
+ export declare function asstKey(depth: number, msg: {
26
+ timestamp?: number;
27
+ } | null | undefined): string;
28
+ /** Plain text of a user message (string content, or the text blocks of an
29
+ * array content). Returns "" for anything else. */
30
+ export declare function extractUserText(msg: {
31
+ content?: unknown;
32
+ } | null | undefined): string;
33
+ /** Concatenate the text blocks of a toolResult message's content into one raw
34
+ * string (string content passes through). Caller scrubs + clips. */
35
+ export declare function joinToolResultText(content: unknown): string;
36
+ /** Collapse whitespace, trim, and clip to `maxLen` with an ellipsis — for the
37
+ * one-line tool-result preview shown next to the ✓/✗ indicator. */
38
+ export declare function clipOneLine(text: string, maxLen?: number): string;
39
+ //# sourceMappingURL=connect-transcript.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connect-transcript.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/connect-transcript.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAE7F;AAED;oDACoD;AACpD,wBAAgB,eAAe,CAAC,GAAG,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAUrF;AAED;qEACqE;AACrE,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAQ3D;AAED;oEACoE;AACpE,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,SAAK,GAAG,MAAM,CAG7D"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Pure transcript-projection helpers for the connect TUI's reliable-streaming
3
+ * renderer. Extracted from `connect.ts` so the identity-key + message-text
4
+ * logic is unit-testable without driving Pi-TUI (the suite convention — see
5
+ * `connect.test.ts`, which exercises pure helpers directly).
6
+ *
7
+ * No brand / chalk / widget coupling: these return raw keys + strings; the
8
+ * caller wraps them in Pi-TUI widgets and colour, and applies the terminal
9
+ * escape scrub (`scrubRenderable`) between joining and clipping tool output.
10
+ */
11
+ /**
12
+ * Identity key for an assistant message's render block: `${depth}:${timestamp}`.
13
+ *
14
+ * Pi stamps each assistant message with a stable `timestamp` at creation that
15
+ * is constant across all of its `message_update`s and its `message_end`, and a
16
+ * NEW message (e.g. the continuation after a tool call) gets a NEW timestamp.
17
+ * So one logical message owns exactly one block — a block lands where its
18
+ * message belongs in the stream (never above a tool it came after), a
19
+ * late/duplicate update resolves to its own block instead of spawning a copy,
20
+ * and re-applying a message on `resume` is idempotent. `depth` keeps sub-agent
21
+ * (≥1) streams from colliding with the top-level (0) stream. Falls back to
22
+ * `"live"` only if a message somehow lacks a timestamp (shouldn't happen — the
23
+ * field is required on Pi messages).
24
+ */
25
+ export function asstKey(depth, msg) {
26
+ return `${depth}:${typeof msg?.timestamp === "number" ? msg.timestamp : "live"}`;
27
+ }
28
+ /** Plain text of a user message (string content, or the text blocks of an
29
+ * array content). Returns "" for anything else. */
30
+ export function extractUserText(msg) {
31
+ if (!msg)
32
+ return "";
33
+ if (typeof msg.content === "string")
34
+ return msg.content;
35
+ if (Array.isArray(msg.content)) {
36
+ return msg.content
37
+ .filter((b) => b?.type === "text" && typeof b.text === "string")
38
+ .map((b) => b.text)
39
+ .join("");
40
+ }
41
+ return "";
42
+ }
43
+ /** Concatenate the text blocks of a toolResult message's content into one raw
44
+ * string (string content passes through). Caller scrubs + clips. */
45
+ export function joinToolResultText(content) {
46
+ if (Array.isArray(content)) {
47
+ return content
48
+ .filter((b) => b?.type === "text" && typeof b.text === "string")
49
+ .map((b) => b.text)
50
+ .join(" ");
51
+ }
52
+ return typeof content === "string" ? content : "";
53
+ }
54
+ /** Collapse whitespace, trim, and clip to `maxLen` with an ellipsis — for the
55
+ * one-line tool-result preview shown next to the ✓/✗ indicator. */
56
+ export function clipOneLine(text, maxLen = 80) {
57
+ const oneLine = (text ?? "").replace(/\s+/g, " ").trim();
58
+ return oneLine.length > maxLen ? `${oneLine.slice(0, maxLen)}…` : oneLine;
59
+ }
60
+ //# sourceMappingURL=connect-transcript.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connect-transcript.js","sourceRoot":"","sources":["../../../src/cli/commands/connect-transcript.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,OAAO,CAAC,KAAa,EAAE,GAA8C;IACpF,OAAO,GAAG,KAAK,IAAI,OAAO,GAAG,EAAE,SAAS,KAAK,QAAQ,CAAC,CAA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