@kevin5251984/guild 0.2.12 → 0.2.13
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/package.json +10 -8
- package/src/catalog/subagents.ts +1 -2
- package/src/chat-parts.ts +1 -6
- package/src/generate.ts +27 -55
- package/src/handlers.ts +6 -183
- package/src/harness.ts +8 -21
- package/src/image-gen.ts +1 -2
- package/src/llm.ts +7 -14
- package/src/mention.ts +12 -63
- package/src/oauth.ts +27 -131
- package/src/public/chat.css +7 -102
- package/src/public/chat.html +48 -190
- package/src/public/i18n.js +6 -18
- package/src/public/index.html +46 -1
- package/src/public/settings.html +1 -2
- package/src/public/skills-add.html +0 -8
- package/src/public/studio.html +117 -171
- package/src/public/style.css +77 -249
- package/src/public/subagents-add.html +0 -8
- package/src/router.ts +0 -11
- package/src/store.ts +0 -14
- package/src/subagent.ts +6 -203
- package/src/tools.ts +18 -117
- package/src/trajectory.ts +5 -51
- package/src/usage.ts +0 -10
- package/vendor/protocol/src/index.ts +1 -4
- package/src/public/buddy.js +0 -432
package/src/oauth.ts
CHANGED
|
@@ -1057,73 +1057,6 @@ function thinkingText(message: AssistantMessage | undefined): string {
|
|
|
1057
1057
|
.trim();
|
|
1058
1058
|
}
|
|
1059
1059
|
|
|
1060
|
-
/**
|
|
1061
|
-
* Codex `DEFAULT_STREAM_IDLE_TIMEOUT_MS`. No tokens on the stream — not a
|
|
1062
|
-
* wall clock on the whole turn. Do not pass this as Pi `timeoutMs` for xAI:
|
|
1063
|
-
* OpenAI-completions maps that to the SDK request timeout and kills thinking.
|
|
1064
|
-
*/
|
|
1065
|
-
export const STREAM_IDLE_TIMEOUT_MS = 300_000;
|
|
1066
|
-
|
|
1067
|
-
export class StreamIdleError extends Error {
|
|
1068
|
-
readonly idleMs: number;
|
|
1069
|
-
constructor(idleMs: number) {
|
|
1070
|
-
super(
|
|
1071
|
-
`stream idle: no tokens for ${Math.round(idleMs / 1000)}s (Codex-style; not a turn wall clock). Resend or switch models.`,
|
|
1072
|
-
);
|
|
1073
|
-
this.name = "StreamIdleError";
|
|
1074
|
-
this.idleMs = idleMs;
|
|
1075
|
-
}
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
export function startStreamIdle(
|
|
1079
|
-
idleMs: number,
|
|
1080
|
-
parent?: AbortSignal,
|
|
1081
|
-
): {
|
|
1082
|
-
signal: AbortSignal;
|
|
1083
|
-
bump: () => void;
|
|
1084
|
-
dispose: () => void;
|
|
1085
|
-
timedOut: () => boolean;
|
|
1086
|
-
} {
|
|
1087
|
-
const ctrl = new AbortController();
|
|
1088
|
-
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
1089
|
-
let timedOut = false;
|
|
1090
|
-
const fire = () => {
|
|
1091
|
-
if (timedOut || ctrl.signal.aborted) return;
|
|
1092
|
-
timedOut = true;
|
|
1093
|
-
ctrl.abort();
|
|
1094
|
-
};
|
|
1095
|
-
const bump = () => {
|
|
1096
|
-
if (timedOut || parent?.aborted) return;
|
|
1097
|
-
if (timer) clearTimeout(timer);
|
|
1098
|
-
timer = setTimeout(fire, idleMs);
|
|
1099
|
-
};
|
|
1100
|
-
const onParent = () => {
|
|
1101
|
-
if (timer) clearTimeout(timer);
|
|
1102
|
-
ctrl.abort();
|
|
1103
|
-
};
|
|
1104
|
-
if (parent?.aborted) {
|
|
1105
|
-
ctrl.abort();
|
|
1106
|
-
} else {
|
|
1107
|
-
parent?.addEventListener("abort", onParent, { once: true });
|
|
1108
|
-
}
|
|
1109
|
-
bump();
|
|
1110
|
-
return {
|
|
1111
|
-
signal: ctrl.signal,
|
|
1112
|
-
bump,
|
|
1113
|
-
dispose: () => {
|
|
1114
|
-
if (timer) clearTimeout(timer);
|
|
1115
|
-
parent?.removeEventListener("abort", onParent);
|
|
1116
|
-
},
|
|
1117
|
-
timedOut: () => timedOut,
|
|
1118
|
-
};
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1121
|
-
function userAborted(signal?: AbortSignal): Error {
|
|
1122
|
-
const err = new Error("aborted");
|
|
1123
|
-
err.name = "AbortError";
|
|
1124
|
-
return err;
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
1060
|
/** Pi streamSimple: Think chips only from thinking_delta, not a planted placeholder. */
|
|
1128
1061
|
async function streamOAuthMessage(
|
|
1129
1062
|
models: MutableModels,
|
|
@@ -1133,11 +1066,7 @@ async function streamOAuthMessage(
|
|
|
1133
1066
|
toolCtx: ToolContext,
|
|
1134
1067
|
traces: ToolTrace[],
|
|
1135
1068
|
): Promise<AssistantMessage> {
|
|
1136
|
-
const
|
|
1137
|
-
const stream = models.streamSimple(model, context, {
|
|
1138
|
-
...options,
|
|
1139
|
-
signal: idle.signal,
|
|
1140
|
-
});
|
|
1069
|
+
const stream = models.streamSimple(model, context, options);
|
|
1141
1070
|
let lastEmit = 0;
|
|
1142
1071
|
const flush = (partial: AssistantMessage | undefined, force: boolean) => {
|
|
1143
1072
|
const think = thinkingText(partial);
|
|
@@ -1147,40 +1076,19 @@ async function streamOAuthMessage(
|
|
|
1147
1076
|
lastEmit = now;
|
|
1148
1077
|
emitProgress(toolCtx, traces, think);
|
|
1149
1078
|
};
|
|
1150
|
-
const
|
|
1151
|
-
if (
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
flush(event.partial, true);
|
|
1161
|
-
} else if (event.type === "done") {
|
|
1162
|
-
flush(event.message, true);
|
|
1163
|
-
return event.message;
|
|
1164
|
-
} else if (event.type === "error") {
|
|
1165
|
-
if (idle.timedOut() || options?.signal?.aborted) failIfIdle();
|
|
1166
|
-
return event.error;
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
if (idle.timedOut() || options?.signal?.aborted) failIfIdle();
|
|
1170
|
-
return stream.result();
|
|
1171
|
-
} catch (err) {
|
|
1172
|
-
if (err instanceof StreamIdleError) throw err;
|
|
1173
|
-
if (err instanceof Error && err.name === "AbortError") {
|
|
1174
|
-
if (options?.signal?.aborted) throw err;
|
|
1175
|
-
if (idle.timedOut()) throw new StreamIdleError(STREAM_IDLE_TIMEOUT_MS);
|
|
1079
|
+
for await (const event of stream) {
|
|
1080
|
+
if (event.type === "thinking_start" || event.type === "thinking_delta") {
|
|
1081
|
+
flush(event.partial, event.type === "thinking_start");
|
|
1082
|
+
} else if (event.type === "thinking_end") {
|
|
1083
|
+
flush(event.partial, true);
|
|
1084
|
+
} else if (event.type === "done") {
|
|
1085
|
+
flush(event.message, true);
|
|
1086
|
+
return event.message;
|
|
1087
|
+
} else if (event.type === "error") {
|
|
1088
|
+
return event.error;
|
|
1176
1089
|
}
|
|
1177
|
-
if (idle.timedOut() && !(options?.signal?.aborted)) {
|
|
1178
|
-
throw new StreamIdleError(STREAM_IDLE_TIMEOUT_MS);
|
|
1179
|
-
}
|
|
1180
|
-
throw err;
|
|
1181
|
-
} finally {
|
|
1182
|
-
idle.dispose();
|
|
1183
1090
|
}
|
|
1091
|
+
return stream.result();
|
|
1184
1092
|
}
|
|
1185
1093
|
|
|
1186
1094
|
function abortWhen(signal?: AbortSignal): Promise<never> {
|
|
@@ -1344,33 +1252,21 @@ export async function completeOAuth(input: {
|
|
|
1344
1252
|
if (fitted.length < transcript.length) {
|
|
1345
1253
|
transcript.splice(0, transcript.length, ...fitted);
|
|
1346
1254
|
}
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
abortWhen(options.signal),
|
|
1363
|
-
]);
|
|
1364
|
-
} catch (err) {
|
|
1365
|
-
if (err instanceof StreamIdleError) {
|
|
1366
|
-
return {
|
|
1367
|
-
calls: [],
|
|
1368
|
-
text: err.message,
|
|
1369
|
-
thinking: thinkingChunks.join("\n\n"),
|
|
1370
|
-
};
|
|
1371
|
-
}
|
|
1372
|
-
throw err;
|
|
1373
|
-
}
|
|
1255
|
+
const result = await Promise.race([
|
|
1256
|
+
streamOAuthMessage(
|
|
1257
|
+
models,
|
|
1258
|
+
model,
|
|
1259
|
+
{
|
|
1260
|
+
systemPrompt: input.system,
|
|
1261
|
+
messages: transcript,
|
|
1262
|
+
...(useTools ? { tools } : {}),
|
|
1263
|
+
},
|
|
1264
|
+
options,
|
|
1265
|
+
toolCtx,
|
|
1266
|
+
traces,
|
|
1267
|
+
),
|
|
1268
|
+
abortWhen(options.signal),
|
|
1269
|
+
]);
|
|
1374
1270
|
if (result.stopReason === "aborted" || toolCtx.signal?.aborted || options.signal?.aborted) {
|
|
1375
1271
|
const err = new Error("aborted");
|
|
1376
1272
|
err.name = "AbortError";
|
package/src/public/chat.css
CHANGED
|
@@ -252,26 +252,6 @@ body.resizing-sidebar iframe { pointer-events: none; }
|
|
|
252
252
|
padding: 0;
|
|
253
253
|
box-shadow: 0 0 0 1px color-mix(in srgb, var(--steel) 38%, transparent);
|
|
254
254
|
}
|
|
255
|
-
.avatar img,
|
|
256
|
-
.queue-av img,
|
|
257
|
-
.traj-av img,
|
|
258
|
-
.bot-card-av img,
|
|
259
|
-
.mention-glyph img {
|
|
260
|
-
width: 100%;
|
|
261
|
-
height: 100%;
|
|
262
|
-
object-fit: cover;
|
|
263
|
-
object-position: center 18%;
|
|
264
|
-
display: block;
|
|
265
|
-
pointer-events: none;
|
|
266
|
-
}
|
|
267
|
-
.avatar.has-photo,
|
|
268
|
-
.queue-av.has-photo,
|
|
269
|
-
.traj-av.has-photo,
|
|
270
|
-
.bot-card-av.has-photo,
|
|
271
|
-
.mention-glyph.has-photo {
|
|
272
|
-
color: transparent;
|
|
273
|
-
font-size: 0;
|
|
274
|
-
}
|
|
275
255
|
.nav-av .avatar { font-size: 15px; letter-spacing: 0; }
|
|
276
256
|
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
|
|
277
257
|
a.avatar { text-decoration: none; color: #fff; }
|
|
@@ -326,7 +306,6 @@ a.avatar { text-decoration: none; color: #fff; }
|
|
|
326
306
|
font-size: 1.35rem;
|
|
327
307
|
font-weight: 700;
|
|
328
308
|
margin-bottom: 12px;
|
|
329
|
-
overflow: hidden;
|
|
330
309
|
}
|
|
331
310
|
.bot-card-name {
|
|
332
311
|
font-size: 1.15rem;
|
|
@@ -917,7 +896,7 @@ a.invite-btn:hover { text-decoration: none; }
|
|
|
917
896
|
.prompt-rail {
|
|
918
897
|
position: absolute;
|
|
919
898
|
top: 8px;
|
|
920
|
-
|
|
899
|
+
right: 3px;
|
|
921
900
|
bottom: 8px;
|
|
922
901
|
z-index: 5;
|
|
923
902
|
width: 16px;
|
|
@@ -928,14 +907,14 @@ a.invite-btn:hover { text-decoration: none; }
|
|
|
928
907
|
content: "";
|
|
929
908
|
position: absolute;
|
|
930
909
|
top: 0;
|
|
931
|
-
|
|
910
|
+
right: 7px;
|
|
932
911
|
bottom: 0;
|
|
933
912
|
width: 1px;
|
|
934
913
|
background: color-mix(in srgb, var(--steel) 22%, transparent);
|
|
935
914
|
}
|
|
936
915
|
.prompt-tick {
|
|
937
916
|
position: absolute;
|
|
938
|
-
|
|
917
|
+
right: 0;
|
|
939
918
|
width: 16px;
|
|
940
919
|
height: 12px;
|
|
941
920
|
margin: 0;
|
|
@@ -950,7 +929,7 @@ a.invite-btn:hover { text-decoration: none; }
|
|
|
950
929
|
content: "";
|
|
951
930
|
position: absolute;
|
|
952
931
|
top: 50%;
|
|
953
|
-
|
|
932
|
+
right: 3px;
|
|
954
933
|
width: 8px;
|
|
955
934
|
height: 2px;
|
|
956
935
|
border-radius: 1px;
|
|
@@ -965,7 +944,7 @@ a.invite-btn:hover { text-decoration: none; }
|
|
|
965
944
|
.prompt-tick[data-preview]:hover::before {
|
|
966
945
|
content: attr(data-preview);
|
|
967
946
|
position: absolute;
|
|
968
|
-
|
|
947
|
+
right: 18px;
|
|
969
948
|
top: 50%;
|
|
970
949
|
z-index: 8;
|
|
971
950
|
max-width: min(52vw, 280px);
|
|
@@ -1835,48 +1814,6 @@ body.grok .turn-actions .turn-steer { color: #c4b090; }
|
|
|
1835
1814
|
padding: 4rem 1rem;
|
|
1836
1815
|
font-size: 0.9rem;
|
|
1837
1816
|
}
|
|
1838
|
-
.empty-thread.setup-thread {
|
|
1839
|
-
text-align: left;
|
|
1840
|
-
max-width: 28rem;
|
|
1841
|
-
margin: 3rem auto;
|
|
1842
|
-
padding: 1.15rem 1.1rem 1.2rem;
|
|
1843
|
-
border: 1px solid var(--line);
|
|
1844
|
-
background: var(--panel);
|
|
1845
|
-
color: var(--text);
|
|
1846
|
-
}
|
|
1847
|
-
.setup-kicker {
|
|
1848
|
-
margin: 0 0 6px;
|
|
1849
|
-
font-size: 10px;
|
|
1850
|
-
letter-spacing: 0.08em;
|
|
1851
|
-
text-transform: uppercase;
|
|
1852
|
-
color: var(--muted);
|
|
1853
|
-
}
|
|
1854
|
-
.setup-title {
|
|
1855
|
-
margin: 0 0 8px;
|
|
1856
|
-
font-weight: 650;
|
|
1857
|
-
}
|
|
1858
|
-
.setup-body {
|
|
1859
|
-
margin: 0 0 14px;
|
|
1860
|
-
color: var(--muted);
|
|
1861
|
-
font-size: 0.9rem;
|
|
1862
|
-
}
|
|
1863
|
-
.setup-acts {
|
|
1864
|
-
display: flex;
|
|
1865
|
-
flex-wrap: wrap;
|
|
1866
|
-
gap: 8px;
|
|
1867
|
-
margin: 0;
|
|
1868
|
-
}
|
|
1869
|
-
.setup-acts a {
|
|
1870
|
-
display: inline-block;
|
|
1871
|
-
padding: 6px 10px;
|
|
1872
|
-
border: 1px solid var(--line);
|
|
1873
|
-
color: inherit;
|
|
1874
|
-
text-decoration: none;
|
|
1875
|
-
font-size: 13px;
|
|
1876
|
-
}
|
|
1877
|
-
.setup-acts a:hover {
|
|
1878
|
-
border-color: var(--text);
|
|
1879
|
-
}
|
|
1880
1817
|
|
|
1881
1818
|
.composer {
|
|
1882
1819
|
position: sticky;
|
|
@@ -2047,7 +1984,6 @@ body.grok .composer.drop-on .composer-card::after {
|
|
|
2047
1984
|
color: #cfcfcf;
|
|
2048
1985
|
font-size: 0.78rem;
|
|
2049
1986
|
flex: none;
|
|
2050
|
-
overflow: hidden;
|
|
2051
1987
|
}
|
|
2052
1988
|
.composer-scroll { max-height: 336px; overflow-y: auto; }
|
|
2053
1989
|
.composer textarea {
|
|
@@ -2195,7 +2131,6 @@ body.grok .composer.drop-on .composer-card::after {
|
|
|
2195
2131
|
font-weight: 700;
|
|
2196
2132
|
line-height: 1;
|
|
2197
2133
|
margin-left: -5px;
|
|
2198
|
-
overflow: hidden;
|
|
2199
2134
|
box-shadow: 0 0 0 1px var(--bg);
|
|
2200
2135
|
}
|
|
2201
2136
|
.queue-avs .queue-av:first-child { margin-left: 0; }
|
|
@@ -2776,7 +2711,7 @@ dialog p { margin: 0 0 0.8rem; color: var(--muted); font-size: 0.9rem; }
|
|
|
2776
2711
|
grid-column: 1;
|
|
2777
2712
|
grid-row: 1 / -1;
|
|
2778
2713
|
display: grid;
|
|
2779
|
-
grid-template-rows: auto
|
|
2714
|
+
grid-template-rows: auto 1fr;
|
|
2780
2715
|
background: #0c0c0e;
|
|
2781
2716
|
}
|
|
2782
2717
|
.traj[hidden] { display: none !important; }
|
|
@@ -2812,36 +2747,6 @@ dialog p { margin: 0 0 0.8rem; color: var(--muted); font-size: 0.9rem; }
|
|
|
2812
2747
|
font-size: 1.2rem;
|
|
2813
2748
|
cursor: pointer;
|
|
2814
2749
|
}
|
|
2815
|
-
.traj-kinds {
|
|
2816
|
-
display: flex;
|
|
2817
|
-
flex-wrap: wrap;
|
|
2818
|
-
gap: 0.35rem;
|
|
2819
|
-
padding: 0.4rem 1rem 0.5rem;
|
|
2820
|
-
border-bottom: 1px solid #222;
|
|
2821
|
-
}
|
|
2822
|
-
.traj-filter {
|
|
2823
|
-
margin: 0;
|
|
2824
|
-
padding: 0.18rem 0.5rem;
|
|
2825
|
-
border: 1px solid #333;
|
|
2826
|
-
border-radius: 4px;
|
|
2827
|
-
background: #141416;
|
|
2828
|
-
color: #bdbdbd;
|
|
2829
|
-
font: inherit;
|
|
2830
|
-
font-size: 0.72rem;
|
|
2831
|
-
font-weight: 650;
|
|
2832
|
-
cursor: pointer;
|
|
2833
|
-
}
|
|
2834
|
-
.traj-filter:hover { color: var(--text); border-color: #555; }
|
|
2835
|
-
.traj-filter.on {
|
|
2836
|
-
background: #1c1c20;
|
|
2837
|
-
color: var(--text);
|
|
2838
|
-
border-color: #555;
|
|
2839
|
-
}
|
|
2840
|
-
.traj-filter.spawn { color: var(--signal); border-color: #4a3d22; }
|
|
2841
|
-
.traj-filter.spawn.on {
|
|
2842
|
-
background: #2a2418;
|
|
2843
|
-
color: var(--signal);
|
|
2844
|
-
}
|
|
2845
2750
|
.traj-main {
|
|
2846
2751
|
display: grid;
|
|
2847
2752
|
grid-template-columns: minmax(280px, 1.1fr) minmax(240px, 0.9fr);
|
|
@@ -2854,7 +2759,7 @@ dialog p { margin: 0 0 0.8rem; color: var(--muted); font-size: 0.9rem; }
|
|
|
2854
2759
|
}
|
|
2855
2760
|
.traj-row {
|
|
2856
2761
|
display: grid;
|
|
2857
|
-
grid-template-columns: 20px 6.2rem
|
|
2762
|
+
grid-template-columns: 20px 6.2rem 5.6rem minmax(0, 1fr);
|
|
2858
2763
|
gap: 0.4rem;
|
|
2859
2764
|
align-items: center;
|
|
2860
2765
|
width: 100%;
|