Add dashboard, attach view, list and tmux commands
This commit is contained in:
1 parent
c93244e7f4
commit
3b7ed56e16
15 files changed
+1056
-50
No files matched your search
@@ -1,25 +0,0 @@
|
||||
import { ORCHESTRATION_V2_WS_METHODS } from "@t3tools/contracts";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Stream from "effect/Stream";
|
||||
import { connect } from "../src/client/rpc.ts";
|
||||
|
||||
const program = Effect.gen(function* () {
|
||||
const { rpc, target } = yield* connect;
|
||||
console.log("connected to", target.httpBaseUrl);
|
||||
yield* rpc[ORCHESTRATION_V2_WS_METHODS.subscribeShell]({ omitIdleSubagents: true, omitOlderSettled: true }).pipe(
|
||||
Stream.take(3),
|
||||
Stream.runForEach((item) =>
|
||||
Effect.sync(() => {
|
||||
if (item.kind === "snapshot") {
|
||||
const s = item.snapshot as any;
|
||||
console.log("snapshot keys:", Object.keys(s));
|
||||
console.log("projects:", s.projects?.length, "threads:", s.threads?.length);
|
||||
for (const t of (s.threads ?? []).slice(0, 8)) console.log(" -", t.status, t.activityRunStatus, t.pendingRuntimeRequest ? "[NEEDS YOU]" : "", t.title);
|
||||
} else console.log("item:", item.kind);
|
||||
}),
|
||||
),
|
||||
Effect.timeout("10 seconds"),
|
||||
);
|
||||
});
|
||||
await Effect.runPromise(Effect.scoped(program)).catch((e) => { console.error("FAILED:", e); process.exit(1); });
|
||||
process.exit(0);
|
||||
@@ -1,25 +0,0 @@
|
||||
import { T3Session } from "../src/client/session.ts";
|
||||
const s = new T3Session();
|
||||
await s.start();
|
||||
await new Promise<void>((r) => { const off = s.onShell((st) => { if (st.status.type !== "connecting" && st.snapshot) { off(); r(); } }); });
|
||||
const shell = s.getShell();
|
||||
console.log("status", shell.status, "threads", shell.snapshot?.threads.length);
|
||||
const counts: Record<string, number> = {};
|
||||
for (const t of shell.snapshot!.threads) counts[t.status] = (counts[t.status] ?? 0) + 1;
|
||||
console.log(counts);
|
||||
const t = shell.snapshot!.threads.find((t) => t.status === "running") ?? shell.snapshot!.threads[0]!;
|
||||
console.log("watching", t.title, t.status);
|
||||
let events = 0;
|
||||
const off = s.watchThread(t.id, (st) => {
|
||||
events++;
|
||||
if (st.projection && events < 4) {
|
||||
const items = st.projection.visibleTurnItems;
|
||||
console.log(st.status, "items", items.length, "types", [...new Set(items.map((i) => i.item.type))].join(","));
|
||||
const last = items.at(-1)?.item as any;
|
||||
console.log("last:", last?.type, String(last?.text ?? last?.input ?? "").slice(0, 120));
|
||||
}
|
||||
if (st.error) console.log("ERR", st.error);
|
||||
});
|
||||
await Bun.sleep(5000);
|
||||
console.log("updates received", events);
|
||||
off(); await s.stop(); process.exit(0);
|
||||
Reference in new issue
Block a user