@maiaos/cli 0.1.0-canary.54 → 0.1.0-canary.56
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 +4 -3
- package/dist/bin/maia.cdx.json +19 -19
- package/dist/bin/maia.mjs +1 -1
- package/dist/command-line/emit/index.d.ts +1 -1
- package/dist/command-line/emit/index.js +1 -1
- package/dist/command-line/emit/rows.d.ts +1 -0
- package/dist/command-line/emit/rows.js +5 -0
- package/dist/command-line/index.d.ts +2 -2
- package/dist/command-line/index.js +2 -2
- package/dist/command-line/input/index.d.ts +1 -0
- package/dist/command-line/input/index.js +1 -0
- package/dist/command-line/input/manager-options.d.ts +10 -0
- package/dist/command-line/input/manager-options.js +38 -0
- package/dist/events/commands.js +4 -3
- package/dist/import/batch.js +196 -0
- package/dist/import/client.d.ts +3 -3
- package/dist/import/client.js +1 -1
- package/dist/import/commands.d.ts +1 -0
- package/dist/import/commands.js +82 -8
- package/dist/import/index.d.ts +1 -1
- package/dist/import/index.js +1 -1
- package/dist/import/input.js +16 -2
- package/dist/import/manifest.js +107 -0
- package/dist/import/output.js +44 -2
- package/dist/session/approval/commands.d.ts +1 -0
- package/dist/session/approval/commands.js +75 -9
- package/dist/session/approval/index.d.ts +1 -1
- package/dist/session/approval/index.js +1 -1
- package/dist/session/coding-client.d.ts +2 -0
- package/dist/session/coding-client.js +1 -2
- package/dist/session/coding-commands.js +24 -7
- package/dist/session/commands.js +36 -39
- package/dist/session/output/human.js +14 -3
- package/dist/session/output/tasks.js +25 -11
- package/dist/session/tree/tree.js +31 -9
- package/package.json +5 -5
- package/dist/address-space/address-space.d.ts +0 -38
- package/dist/address-space/index.d.ts +0 -2
- package/dist/agents/input.d.ts +0 -132
- package/dist/agents/output/format.d.ts +0 -8
- package/dist/agents/output/index.d.ts +0 -2
- package/dist/agents/tree/index.d.ts +0 -2
- package/dist/agents/tree/tree.d.ts +0 -3
- package/dist/bootstrap/exit.d.ts +0 -14
- package/dist/bootstrap/exit.js +0 -42
- package/dist/bootstrap/index.d.ts +0 -3
- package/dist/bootstrap/index.js +0 -3
- package/dist/bootstrap/process.d.ts +0 -5
- package/dist/bootstrap/process.js +0 -23
- package/dist/bootstrap/run.d.ts +0 -25
- package/dist/bootstrap/run.js +0 -98
- package/dist/bootstrap/stdio.d.ts +0 -4
- package/dist/bootstrap/stdio.js +0 -9
- package/dist/cli/environment.d.ts +0 -8
- package/dist/cli/services.d.ts +0 -4
- package/dist/command-line/emit/json-decoder.d.ts +0 -3
- package/dist/command-line/input/stdin-stream.d.ts +0 -4
- package/dist/command-receipt/command.d.ts +0 -4
- package/dist/command-receipt/compact-list.d.ts +0 -20
- package/dist/command-receipt/index.d.ts +0 -3
- package/dist/command-tree/completion.d.ts +0 -6
- package/dist/command-tree/local.d.ts +0 -3
- package/dist/command-tree/row.js +0 -2
- package/dist/connection/access/format.d.ts +0 -8
- package/dist/connection/access/input.d.ts +0 -53
- package/dist/connection/input.d.ts +0 -50
- package/dist/connection/signin.d.ts +0 -4
- package/dist/connection/tree/index.d.ts +0 -2
- package/dist/connection/tree/tree.d.ts +0 -3
- package/dist/container/output/format.d.ts +0 -11
- package/dist/container/output/index.d.ts +0 -2
- package/dist/context/client.d.ts +0 -7
- package/dist/context/commands.d.ts +0 -3
- package/dist/context/index.d.ts +0 -3
- package/dist/dashboard/cockpit-client.d.ts +0 -6
- package/dist/dashboard/cockpit-client.js +0 -27
- package/dist/dashboard/cockpits.d.ts +0 -29
- package/dist/dashboard/cockpits.js +0 -65
- package/dist/dashboard/dashboard.d.ts +0 -7
- package/dist/dashboard/draw.d.ts +0 -15
- package/dist/dashboard/frame.d.ts +0 -4
- package/dist/dashboard/index.d.ts +0 -2
- package/dist/dashboard/modes.d.ts +0 -5
- package/dist/dashboard/node-connection.d.ts +0 -15
- package/dist/dashboard/node-connection.js +0 -51
- package/dist/dashboard/pi-tui.d.ts +0 -6
- package/dist/dashboard/status-bar.d.ts +0 -4
- package/dist/dashboard/terminal.d.ts +0 -53
- package/dist/dashboard/tree-model.d.ts +0 -28
- package/dist/dashboard/tree.d.ts +0 -10
- package/dist/development/cli.d.ts +0 -3
- package/dist/development/cli.js +0 -44
- package/dist/events/commands.d.ts +0 -11
- package/dist/events/index.d.ts +0 -2
- package/dist/events/tree/index.d.ts +0 -2
- package/dist/events/tree/tree.d.ts +0 -10
- package/dist/execution/tree/index.d.ts +0 -2
- package/dist/execution/tree/tree.d.ts +0 -3
- package/dist/hold/output/format.d.ts +0 -11
- package/dist/hold/output/index.d.ts +0 -2
- package/dist/hold/tree/index.d.ts +0 -2
- package/dist/hold/tree/tree.d.ts +0 -3
- package/dist/import/input.d.ts +0 -19
- package/dist/import/output.d.ts +0 -6
- package/dist/integration/output.d.ts +0 -22
- package/dist/login/failure.d.ts +0 -3
- package/dist/login/gateway.d.ts +0 -12
- package/dist/login/menu.d.ts +0 -4
- package/dist/login/output/format.d.ts +0 -16
- package/dist/login/output/index.d.ts +0 -2
- package/dist/login/vendor-account.d.ts +0 -95
- package/dist/login/vendor-input.d.ts +0 -14
- package/dist/mcp/calls.d.ts +0 -8
- package/dist/orchestration/output/compact-aggregate.d.ts +0 -121
- package/dist/orchestration/output/compact-run-list.d.ts +0 -20
- package/dist/orchestration/output/human.d.ts +0 -80
- package/dist/orchestration/output/index.d.ts +0 -4
- package/dist/orchestration/tree/index.d.ts +0 -2
- package/dist/orchestration/tree/tree.d.ts +0 -3
- package/dist/port-lease/input.d.ts +0 -65
- package/dist/port-lease/output/format.d.ts +0 -11
- package/dist/port-lease/output/index.d.ts +0 -2
- package/dist/presentation/output/format.d.ts +0 -11
- package/dist/presentation/output/index.d.ts +0 -3
- package/dist/project-guard/input.d.ts +0 -21
- package/dist/project-guard/output/format.d.ts +0 -11
- package/dist/project-guard/output/index.d.ts +0 -2
- package/dist/project-workspace/output/human.d.ts +0 -139
- package/dist/project-workspace/output/index.d.ts +0 -3
- package/dist/project-workspace/output/metadata.d.ts +0 -11
- package/dist/project-workspace/tree/index.d.ts +0 -2
- package/dist/project-workspace/tree/tree.d.ts +0 -3
- package/dist/provider/client.d.ts +0 -6
- package/dist/provider/commands.d.ts +0 -3
- package/dist/provider/index.d.ts +0 -3
- package/dist/reference/commands.d.ts +0 -3
- package/dist/reference/index.d.ts +0 -3
- package/dist/reference/resolve.d.ts +0 -31
- package/dist/reference/tree/index.d.ts +0 -2
- package/dist/reference/tree/tree.d.ts +0 -3
- package/dist/remote-node/reachability.d.ts +0 -64
- package/dist/remote-node/text.d.ts +0 -10
- package/dist/remote-node/tree/index.d.ts +0 -2
- package/dist/remote-node/tree/tree.d.ts +0 -3
- package/dist/routine/input.d.ts +0 -28
- package/dist/routine/output/format.d.ts +0 -23
- package/dist/routine/output/index.d.ts +0 -2
- package/dist/routine/tree/index.d.ts +0 -2
- package/dist/routine/tree/tree.d.ts +0 -3
- package/dist/run-ledger/input.d.ts +0 -42
- package/dist/run-ledger/output/format.d.ts +0 -11
- package/dist/run-ledger/output/index.d.ts +0 -2
- package/dist/session/approval/output/format.d.ts +0 -23
- package/dist/session/approval/output/index.d.ts +0 -2
- package/dist/session/attach-render.d.ts +0 -16
- package/dist/session/create-tasks.d.ts +0 -20
- package/dist/session/interaction/input.d.ts +0 -15
- package/dist/session/interaction/output/format.d.ts +0 -11
- package/dist/session/interaction/output/index.d.ts +0 -2
- package/dist/session/output/diff.d.ts +0 -3
- package/dist/session/output/failure.d.ts +0 -11
- package/dist/session/output/human.d.ts +0 -115
- package/dist/session/output/index.d.ts +0 -6
- package/dist/session/output/observe.d.ts +0 -4
- package/dist/session/output/tasks.d.ts +0 -36
- package/dist/session/task-file.d.ts +0 -5
- package/dist/session/tree/index.d.ts +0 -2
- package/dist/session/tree/tree.d.ts +0 -3
- package/dist/team-workspace/ceremony.d.ts +0 -19
- package/dist/team-workspace/confirmation.d.ts +0 -4
- package/dist/team-workspace/dependencies.js +0 -2
- package/dist/team-workspace/output.d.ts +0 -15
- package/dist/terminal/arguments.d.ts +0 -13
- package/dist/terminal/keys.d.ts +0 -12
- package/dist/terminal/output/compact-list.d.ts +0 -149
- package/dist/terminal/output/human.d.ts +0 -42
- package/dist/terminal/output/index.d.ts +0 -3
- package/dist/terminal/tree/index.d.ts +0 -2
- package/dist/terminal/tree/tree.d.ts +0 -3
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import * as NodeFileSystem from "@effect/platform-node-shared/NodeFileSystem";
|
|
2
|
+
import { sessionAdoptPreviewParametersSchema } from "@maiaos/sdk";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as FileSystem from "effect/FileSystem";
|
|
5
|
+
import * as Schema from "effect/Schema";
|
|
6
|
+
import { CliArgumentError } from "../command-line/input/index.js";
|
|
7
|
+
export const MAX_IMPORT_ENTRIES = 64;
|
|
8
|
+
export const MAX_IMPORT_BYTES = 64 * 1024;
|
|
9
|
+
const ENTRY_KEYS = new Set([
|
|
10
|
+
"attestEnded",
|
|
11
|
+
"harness",
|
|
12
|
+
"hostAuthority",
|
|
13
|
+
"labels",
|
|
14
|
+
"nativeId",
|
|
15
|
+
"role",
|
|
16
|
+
"title",
|
|
17
|
+
"workspaceId",
|
|
18
|
+
]);
|
|
19
|
+
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20
|
+
const invalid = (message) => new CliArgumentError(message);
|
|
21
|
+
const unreadable = () => invalid("Option '--from' must name a readable JSON file.");
|
|
22
|
+
export const readManifestFile = (path) => Effect.gen(function* () {
|
|
23
|
+
const fs = yield* FileSystem.FileSystem;
|
|
24
|
+
const info = yield* fs.stat(path);
|
|
25
|
+
if (info.type !== "File")
|
|
26
|
+
return yield* unreadable();
|
|
27
|
+
if (Number(info.size) > MAX_IMPORT_BYTES)
|
|
28
|
+
return yield* invalid(`The import file must be at most ${String(MAX_IMPORT_BYTES)} bytes.`);
|
|
29
|
+
const bytes = yield* fs.readFile(path);
|
|
30
|
+
return yield* Effect.try({
|
|
31
|
+
catch: () => invalid("The import file must be UTF-8 text."),
|
|
32
|
+
try: () => new TextDecoder("utf-8", { fatal: true }).decode(bytes),
|
|
33
|
+
});
|
|
34
|
+
}).pipe(Effect.catchTag("PlatformError", () => Effect.fail(unreadable())), Effect.provide(NodeFileSystem.layer));
|
|
35
|
+
const hostFields = (value, where) => {
|
|
36
|
+
if (value === undefined)
|
|
37
|
+
return {};
|
|
38
|
+
if (!isRecord(value) ||
|
|
39
|
+
Object.keys(value).some((key) => key !== "permission"))
|
|
40
|
+
throw invalid(`${where}: 'hostAuthority' must be an object with an optional 'permission'.`);
|
|
41
|
+
const { permission } = value;
|
|
42
|
+
return {
|
|
43
|
+
hostAuthority: true,
|
|
44
|
+
...(permission === undefined ? {} : { permission }),
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
const readHarness = (value, where) => {
|
|
48
|
+
const unknown = Object.keys(value).filter((key) => !ENTRY_KEYS.has(key));
|
|
49
|
+
if (unknown.length > 0)
|
|
50
|
+
throw invalid(`${where} has unknown fields: ${unknown.join(", ")}.`);
|
|
51
|
+
const { harness } = value;
|
|
52
|
+
if (harness !== "claude-code" && harness !== "codex-cli")
|
|
53
|
+
throw invalid(`${where}: 'harness' must be claude-code or codex-cli.`);
|
|
54
|
+
return harness;
|
|
55
|
+
};
|
|
56
|
+
const parseEntry = (value, index) => {
|
|
57
|
+
const where = `Entry ${String(index)}`;
|
|
58
|
+
if (!isRecord(value))
|
|
59
|
+
throw invalid(`${where} must be an object.`);
|
|
60
|
+
const harness = readHarness(value, where);
|
|
61
|
+
const { attestEnded, hostAuthority, labels, nativeId, role, title } = value;
|
|
62
|
+
const { workspaceId } = value;
|
|
63
|
+
const parsed = sessionAdoptPreviewParametersSchema.safeParse({
|
|
64
|
+
...(attestEnded === undefined ? {} : { attestEnded }),
|
|
65
|
+
commandId: "command_manifest_check",
|
|
66
|
+
executor: harness,
|
|
67
|
+
...hostFields(hostAuthority, where),
|
|
68
|
+
nativeId,
|
|
69
|
+
...(labels === undefined ? {} : { labels }),
|
|
70
|
+
...(role === undefined ? {} : { role }),
|
|
71
|
+
...(title === undefined ? {} : { title }),
|
|
72
|
+
workspaceId,
|
|
73
|
+
});
|
|
74
|
+
if (!parsed.success)
|
|
75
|
+
throw invalid(`${where}: 'nativeId', 'workspaceId', 'attestEnded', 'hostAuthority', 'title', 'labels' or 'role' is invalid.`);
|
|
76
|
+
const { commandId: _commandId, ...request } = parsed.data;
|
|
77
|
+
return { harness, index, nativeId: request.nativeId, request };
|
|
78
|
+
};
|
|
79
|
+
const requireEntries = (document) => {
|
|
80
|
+
const entries = isRecord(document) ? document.entries : undefined;
|
|
81
|
+
if (!Array.isArray(entries) || entries.length === 0)
|
|
82
|
+
throw invalid('The import file must be { "entries": [ ... ] } with at least one entry.');
|
|
83
|
+
if (entries.length > MAX_IMPORT_ENTRIES)
|
|
84
|
+
throw invalid(`An import takes at most ${String(MAX_IMPORT_ENTRIES)} entries; split the file.`);
|
|
85
|
+
return entries;
|
|
86
|
+
};
|
|
87
|
+
const requireDistinct = (entries) => {
|
|
88
|
+
const seen = new Set();
|
|
89
|
+
entries.forEach((entry) => {
|
|
90
|
+
const key = `${entry.harness}:${entry.nativeId}`;
|
|
91
|
+
if (seen.has(key))
|
|
92
|
+
throw invalid(`Entry ${String(entry.index)} repeats ${key}.`);
|
|
93
|
+
seen.add(key);
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
const decodeDocument = Schema.decodeUnknownEffect(Schema.fromJsonString(Schema.Unknown));
|
|
97
|
+
export const parseManifest = (text) => decodeDocument(text).pipe(Effect.mapError(() => invalid("The import file is not valid JSON.")), Effect.flatMap((document) => Effect.try({
|
|
98
|
+
catch: (error) => error instanceof CliArgumentError
|
|
99
|
+
? error
|
|
100
|
+
: invalid("The import file is invalid."),
|
|
101
|
+
try: () => {
|
|
102
|
+
const parsed = requireEntries(document).map(parseEntry);
|
|
103
|
+
requireDistinct(parsed);
|
|
104
|
+
return parsed;
|
|
105
|
+
},
|
|
106
|
+
})));
|
|
107
|
+
//# sourceMappingURL=manifest.js.map
|
package/dist/import/output.js
CHANGED
|
@@ -2,15 +2,17 @@ import { cell } from "../command-line/index.js";
|
|
|
2
2
|
const line = (...cells) => `${cells.map(cell).join("\t")}\n`;
|
|
3
3
|
const nativeName = (session) => `${session.executor === "claude-code" ? "claude" : "codex"}:${session.nativeId}`;
|
|
4
4
|
const groupLine = (group) => line(group.kind, group.repository?.rootPath ?? group.cwd ?? "", `${String(group.sessionCount)} sessions`, group.registeredProjectId ?? "unregistered");
|
|
5
|
-
const sessionLine = (session) => line(nativeName(session), `${session.liveness}/${session.livenessEvidence}`, session.lastActivityAt, session.cwd, session.sources.join(","), session.adoptedSessionId === undefined
|
|
5
|
+
const sessionLine = (session) => line(nativeName(session), `${session.liveness}/${session.livenessEvidence}`, session.observed ?? "", session.lastActivityAt, session.cwd, session.sources.join(","), session.adoptedSessionId === undefined
|
|
6
6
|
? ""
|
|
7
7
|
: `adopted:${session.adoptedSessionId}`, session.content?.title ?? session.content?.firstPrompt ?? "");
|
|
8
|
+
const truncatedLines = (result) => (result.truncatedSources ?? []).map((source) => line("truncated", source, "this page ends where the listing stopped; the next page continues from the cursor"));
|
|
8
9
|
export const formatScan = (result) => {
|
|
9
10
|
const { bySource, excluded, orphaned, total } = result.summary;
|
|
10
11
|
return [
|
|
11
12
|
line(`${String(total)} sessions since ${result.since}`, `claude ${String(bySource.claude)}, codex ${String(bySource.codex)}`, `orphaned ${String(orphaned)}`),
|
|
12
13
|
line("excluded", `maia ${String(excluded.maiaOwned)}`, `workers ${String(excluded.subagent)}`, `outside-roots ${String(excluded.outsideRoots)}`),
|
|
13
14
|
...result.sourceErrors.map((error) => line("source-error", error.source, error.code, error.message)),
|
|
15
|
+
...truncatedLines(result),
|
|
14
16
|
...result.groups.map(groupLine),
|
|
15
17
|
...result.items.map(sessionLine),
|
|
16
18
|
result.nextCursor === undefined
|
|
@@ -18,10 +20,21 @@ export const formatScan = (result) => {
|
|
|
18
20
|
: line("next", `--cursor ${result.nextCursor}`),
|
|
19
21
|
].join("");
|
|
20
22
|
};
|
|
23
|
+
const managerParts = ({ labels, role, title, }) => [
|
|
24
|
+
...(role === undefined ? [] : [`role ${role}`]),
|
|
25
|
+
...(labels === undefined
|
|
26
|
+
? []
|
|
27
|
+
: [
|
|
28
|
+
`labels ${Object.entries(labels)
|
|
29
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
30
|
+
.join(",")}`,
|
|
31
|
+
]),
|
|
32
|
+
...(title === undefined ? [] : [`title ${title}`]),
|
|
33
|
+
];
|
|
21
34
|
export const formatAdoptPreview = (preview) => [
|
|
22
35
|
line(`adopt ${nativeName(preview)}`, `workspace ${preview.workspaceId}`, `${preview.workingDirectory} (${preview.workingDirectoryOrigin})`, `account ${preview.connectionId}`, `${preview.liveness}/${preview.livenessEvidence}`, ...(preview.hostAuthority === true
|
|
23
36
|
? ["containment none (host authority)"]
|
|
24
|
-
: [])),
|
|
37
|
+
: []), ...managerParts(preview)),
|
|
25
38
|
line("confirm", `printf '{"previewId":"${preview.previewId}"}' | maia session adopt --confirm-stdin`, `expires ${preview.expiresAt}`),
|
|
26
39
|
].join("");
|
|
27
40
|
export const formatAdoptConfirm = (result) => [
|
|
@@ -36,4 +49,33 @@ export const formatHistory = (result) => [
|
|
|
36
49
|
? ""
|
|
37
50
|
: line("next", `--offset ${String(result.nextOffset)}`),
|
|
38
51
|
].join("");
|
|
52
|
+
const adoptDetail = (entry) => "workspaceId" in entry
|
|
53
|
+
? [
|
|
54
|
+
`workspace ${entry.workspaceId}`,
|
|
55
|
+
`account ${entry.connectionId}`,
|
|
56
|
+
entry.workingDirectory,
|
|
57
|
+
entry.hostAuthority === true
|
|
58
|
+
? `host authority${entry.permission === undefined ? "" : ` ${entry.permission}`}`
|
|
59
|
+
: "contained",
|
|
60
|
+
...managerParts(entry),
|
|
61
|
+
]
|
|
62
|
+
: [];
|
|
63
|
+
const importLine = (entry) => {
|
|
64
|
+
const name = `${entry.harness === "claude-code" ? "claude" : "codex"}:${entry.nativeId}`;
|
|
65
|
+
const detail = [
|
|
66
|
+
...adoptDetail(entry),
|
|
67
|
+
"sessionId" in entry ? entry.sessionId : undefined,
|
|
68
|
+
"reason" in entry ? entry.reason : undefined,
|
|
69
|
+
"previewId" in entry ? `preview ${entry.previewId}` : undefined,
|
|
70
|
+
"commandId" in entry && !("previewId" in entry)
|
|
71
|
+
? `command ${entry.commandId}`
|
|
72
|
+
: undefined,
|
|
73
|
+
].filter((part) => part !== undefined);
|
|
74
|
+
return line(`#${String(entry.index)}`, entry.outcome, name, ...detail);
|
|
75
|
+
};
|
|
76
|
+
export const formatImportPreview = (plan) => [
|
|
77
|
+
...plan.entries.map(importLine),
|
|
78
|
+
line("confirm", "maia --json session import --from <file> --dry-run | maia session import --confirm-stdin"),
|
|
79
|
+
].join("");
|
|
80
|
+
export const formatImportResult = (result) => result.entries.map(importLine).join("");
|
|
39
81
|
//# sourceMappingURL=output.js.map
|
|
@@ -4,4 +4,5 @@ export declare const runApprovalShow: (tokens: readonly string[], context: Comma
|
|
|
4
4
|
export declare const runApprovalApprove: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
5
5
|
export declare const runApprovalDeny: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
6
6
|
export declare const runApprovalAnswer: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
7
|
+
export declare const runSessionAnswer: (tokens: readonly string[], context: CommandContext) => CommandEffect;
|
|
7
8
|
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -109,7 +109,20 @@ const notConfirmed = (context) => reportError({
|
|
|
109
109
|
message: "Nothing approved; the worker still waits until the request expires.",
|
|
110
110
|
retryable: false,
|
|
111
111
|
}, context);
|
|
112
|
-
const
|
|
112
|
+
const respond = (context, { approvalId, asCoordinator, commandId }, { approval, decision }) => Effect.gen(function* () {
|
|
113
|
+
const { respondToApproval } = context.dependencies;
|
|
114
|
+
if (respondToApproval === undefined)
|
|
115
|
+
return yield* missing("decision");
|
|
116
|
+
const id = yield* commandIdentifier(commandId);
|
|
117
|
+
return write(context)(yield* respondToApproval({
|
|
118
|
+
...decision,
|
|
119
|
+
approvalId,
|
|
120
|
+
commandId: id,
|
|
121
|
+
requestDigest: approval.requestDigest,
|
|
122
|
+
}, asCoordinator));
|
|
123
|
+
});
|
|
124
|
+
const decide = (context, input) => {
|
|
125
|
+
const { approvalId, asCoordinator, requested } = input;
|
|
113
126
|
const { respondToApproval, showApproval } = context.dependencies;
|
|
114
127
|
if (respondToApproval === undefined || showApproval === undefined)
|
|
115
128
|
return missing("decision");
|
|
@@ -118,17 +131,11 @@ const decide = (context, { approvalId, asCoordinator, commandId, requested }) =>
|
|
|
118
131
|
if (!shown.ok)
|
|
119
132
|
return write(context)(shown);
|
|
120
133
|
const { approval } = shown.value;
|
|
121
|
-
const decision = resolveAnswer(approval, requested);
|
|
134
|
+
const decision = resolveAnswer(approval, typeof requested === "function" ? requested(approval) : requested);
|
|
122
135
|
const reading = { approval, asCoordinator, decision };
|
|
123
136
|
if (!(yield* confirmed(context, reading)))
|
|
124
137
|
return notConfirmed(context);
|
|
125
|
-
|
|
126
|
-
return write(context)(yield* respondToApproval({
|
|
127
|
-
...decision,
|
|
128
|
-
approvalId,
|
|
129
|
-
commandId: id,
|
|
130
|
-
requestDigest: approval.requestDigest,
|
|
131
|
-
}, asCoordinator));
|
|
138
|
+
return yield* respond(context, input, reading);
|
|
132
139
|
});
|
|
133
140
|
};
|
|
134
141
|
const runDecision = (verb, tokens, context) => Effect.gen(function* () {
|
|
@@ -152,4 +159,63 @@ const parseDecision = (verb, tokens, context) => {
|
|
|
152
159
|
export const runApprovalApprove = (tokens, context) => runDecision("approve", tokens, context);
|
|
153
160
|
export const runApprovalDeny = (tokens, context) => runDecision("deny", tokens, context);
|
|
154
161
|
export const runApprovalAnswer = (tokens, context) => runDecision("answer", tokens, context);
|
|
162
|
+
const answerDecision = (approval, text) => {
|
|
163
|
+
if (approval.kind === "question")
|
|
164
|
+
return { answer: text, decision: "answer" };
|
|
165
|
+
const word = text.trim().toLowerCase();
|
|
166
|
+
if (word === "approve" || word === "deny")
|
|
167
|
+
return { decision: word };
|
|
168
|
+
throw new CliArgumentError(`This ${approval.kind} request takes 'approve' or 'deny', not an answer.`);
|
|
169
|
+
};
|
|
170
|
+
const decisionFor = (context, approval, { asCoordinator, credential, sessionId, text }) => {
|
|
171
|
+
if (approval.sessionId !== sessionId)
|
|
172
|
+
throw new CliArgumentError(`Prompt '${approval.approvalId}' belongs to ${approval.sessionId}, not ${sessionId}.`);
|
|
173
|
+
const decision = answerDecision(approval, text);
|
|
174
|
+
const verb = decision.decision;
|
|
175
|
+
if (!asCoordinator && !(credential && verb === "answer"))
|
|
176
|
+
requirePerson(context, verb);
|
|
177
|
+
return decision;
|
|
178
|
+
};
|
|
179
|
+
const statusUnreadable = (context) => reportError({
|
|
180
|
+
code: "invalid_argument",
|
|
181
|
+
message: "The Session's status is unknown; no answer was sent.",
|
|
182
|
+
retryable: false,
|
|
183
|
+
}, context);
|
|
184
|
+
const parseAnswer = (tokens) => {
|
|
185
|
+
const parsed = parseOptions(tokens, new Set(["--command-id", "--prompt"]), new Set(["--as-coordinator"]));
|
|
186
|
+
requirePositionals(parsed.positionals, 2);
|
|
187
|
+
const [sessionId = "", text = ""] = parsed.positionals;
|
|
188
|
+
const approvalId = parsed.options.get("--prompt");
|
|
189
|
+
if (approvalId === undefined)
|
|
190
|
+
throw new CliArgumentError("Option '--prompt' is required: name the prompt that 'session show' printed.");
|
|
191
|
+
const commandId = parsed.options.get("--command-id");
|
|
192
|
+
return {
|
|
193
|
+
approvalId,
|
|
194
|
+
asCoordinator: parsed.flags.has("--as-coordinator"),
|
|
195
|
+
...(commandId === undefined ? {} : { commandId }),
|
|
196
|
+
sessionId,
|
|
197
|
+
text,
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
export const runSessionAnswer = (tokens, context) => {
|
|
201
|
+
const { sessionId, text, ...input } = parseAnswer(tokens);
|
|
202
|
+
return Effect.gen(function* () {
|
|
203
|
+
const credential = yield* holdsSessionCredential;
|
|
204
|
+
const shown = yield* context.dependencies.showSession(sessionId);
|
|
205
|
+
if (!shown.ok)
|
|
206
|
+
return reportError(shown.error, context);
|
|
207
|
+
if (shown.value.session.status === "unknown")
|
|
208
|
+
return statusUnreadable(context);
|
|
209
|
+
const { asCoordinator } = input;
|
|
210
|
+
return yield* decide(context, {
|
|
211
|
+
...input,
|
|
212
|
+
requested: (approval) => decisionFor(context, approval, {
|
|
213
|
+
asCoordinator,
|
|
214
|
+
credential,
|
|
215
|
+
sessionId,
|
|
216
|
+
text,
|
|
217
|
+
}),
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
};
|
|
155
221
|
//# sourceMappingURL=commands.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { type ApprovalCliDependencies, makeApprovalClient } from "./client.js";
|
|
2
|
-
export { runApprovalAnswer, runApprovalApprove, runApprovalDeny, runApprovalList, runApprovalShow, } from "./commands.js";
|
|
2
|
+
export { runApprovalAnswer, runApprovalApprove, runApprovalDeny, runApprovalList, runApprovalShow, runSessionAnswer, } from "./commands.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { makeApprovalClient } from "./client.js";
|
|
2
|
-
export { runApprovalAnswer, runApprovalApprove, runApprovalDeny, runApprovalList, runApprovalShow, } from "./commands.js";
|
|
2
|
+
export { runApprovalAnswer, runApprovalApprove, runApprovalDeny, runApprovalList, runApprovalShow, runSessionAnswer, } from "./commands.js";
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -8,6 +8,8 @@ export type ArchiveSessionInput = {
|
|
|
8
8
|
readonly commandId?: string;
|
|
9
9
|
readonly expectedRevision: string;
|
|
10
10
|
readonly sessionId: string;
|
|
11
|
+
readonly summary?: string;
|
|
12
|
+
readonly transcriptPath?: string;
|
|
11
13
|
};
|
|
12
14
|
export declare const makeCodingSessionClient: (node: CliNodeOperations) => {
|
|
13
15
|
archiveSession: (input: ArchiveSessionInput) => CliNodeEffect<SessionArchiveResult>;
|
|
@@ -3,9 +3,8 @@ import * as Effect from "effect/Effect";
|
|
|
3
3
|
import { commandIdentifier, } from "../local-node/index.js";
|
|
4
4
|
export const makeCodingSessionClient = (node) => ({
|
|
5
5
|
archiveSession: (input) => Effect.flatMap(commandIdentifier(input.commandId), (commandId) => node.runValidatedNodeOperation({
|
|
6
|
+
...input,
|
|
6
7
|
commandId,
|
|
7
|
-
expectedRevision: input.expectedRevision,
|
|
8
|
-
sessionId: input.sessionId,
|
|
9
8
|
}, sessionArchiveParametersSchema, (client, parameters, options) => client.archiveSession(parameters, options), { commandId })),
|
|
10
9
|
diffSession: (input) => node.runValidatedNodeOperation({
|
|
11
10
|
sessionId: input.sessionId,
|
|
@@ -29,19 +29,36 @@ const summarizeArchive = (result) => ({
|
|
|
29
29
|
revision: result.session.revision,
|
|
30
30
|
sessionId: result.session.id,
|
|
31
31
|
state: result.session.state,
|
|
32
|
+
...(result.summary === undefined ? {} : { summary: result.summary }),
|
|
33
|
+
...(result.transcriptPath === undefined
|
|
34
|
+
? {}
|
|
35
|
+
: { transcriptPath: result.transcriptPath }),
|
|
32
36
|
});
|
|
33
|
-
|
|
34
|
-
const parsed = parseOptions(tokens, new Set([
|
|
37
|
+
const readArchiveInput = (tokens) => {
|
|
38
|
+
const parsed = parseOptions(tokens, new Set([
|
|
39
|
+
"--command-id",
|
|
40
|
+
"--expected-revision",
|
|
41
|
+
"--summary",
|
|
42
|
+
"--transcript",
|
|
43
|
+
]));
|
|
35
44
|
requirePositionals(parsed.positionals, 1);
|
|
36
|
-
const { archiveSession } = context.dependencies;
|
|
37
|
-
if (archiveSession === undefined)
|
|
38
|
-
throw new CliArgumentError("Session archive is unavailable.");
|
|
39
45
|
const commandId = parsed.options.get("--command-id");
|
|
40
|
-
const
|
|
46
|
+
const summary = parsed.options.get("--summary");
|
|
47
|
+
const transcriptPath = parsed.options.get("--transcript");
|
|
48
|
+
return {
|
|
41
49
|
...(commandId === undefined ? {} : { commandId }),
|
|
42
50
|
expectedRevision: readExpectedRevision(parsed.options.get("--expected-revision")),
|
|
43
51
|
sessionId: requireSessionId(parsed.positionals),
|
|
44
|
-
|
|
52
|
+
...(summary === undefined ? {} : { summary }),
|
|
53
|
+
...(transcriptPath === undefined ? {} : { transcriptPath }),
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export const runSessionArchive = (tokens, context) => Effect.gen(function* () {
|
|
57
|
+
const input = readArchiveInput(tokens);
|
|
58
|
+
const { archiveSession } = context.dependencies;
|
|
59
|
+
if (archiveSession === undefined)
|
|
60
|
+
throw new CliArgumentError("Session archive is unavailable.");
|
|
61
|
+
const result = yield* archiveSession(input);
|
|
45
62
|
return writeSessionResult(result, context, (value) => ({
|
|
46
63
|
command: "session.archive",
|
|
47
64
|
result: summarizeArchive(value),
|
package/dist/session/commands.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MAX_SESSION_INBOX_CHECK_LIMIT, MAX_SESSION_MESSAGE_BODY_BYTES, MAX_SESSION_OBSERVE_IDS, MAX_SESSION_STALL_AFTER_SECONDS, MIN_SESSION_STALL_AFTER_SECONDS, SESSION_EFFORT_LEVELS, sessionBaseRefSchema, sessionCreateParametersSchema, } from "@maiaos/sdk";
|
|
1
|
+
import { MAX_SESSION_INBOX_CHECK_LIMIT, MAX_SESSION_MESSAGE_BODY_BYTES, MAX_SESSION_OBSERVE_IDS, MAX_SESSION_SETTLED_IDLE_SECONDS, MAX_SESSION_STALL_AFTER_SECONDS, MIN_SESSION_STALL_AFTER_SECONDS, SESSION_EFFORT_LEVELS, sessionBaseRefSchema, sessionCreateParametersSchema, } from "@maiaos/sdk";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
3
|
import { listEach, writeMerged } from "../address-space/index.js";
|
|
4
|
-
import { CliArgumentError, parseOptions, parseOptionsWith, readCursor, readDuration, readExpectedRevision, readPageSize, readPermission, readWaitTimeoutSeconds, requirePositionals, writeNodeResult, } from "../command-line/index.js";
|
|
4
|
+
import { CliArgumentError, LABEL_OPTION, parseOptions, parseOptionsWith, readCursor, readDuration, readExpectedRevision, readLabels, readPageSize, readPermission, readSessionRole, readSessionTitle, readWaitTimeoutSeconds, requireOneLabelPerOption, requirePositionals, writeNodeResult, } from "../command-line/index.js";
|
|
5
5
|
import { mergeLists } from "../fleet/index.js";
|
|
6
6
|
import { runSessionTasks, } from "./create-tasks.js";
|
|
7
7
|
import { formatMergedSessions, formatSessionShow, writeSessionResult, } from "./output/index.js";
|
|
@@ -106,13 +106,6 @@ const readEffort = (value) => {
|
|
|
106
106
|
return level;
|
|
107
107
|
throw new CliArgumentError(`Option '--effort' must be ${SESSION_EFFORT_LEVELS["codex-cli"].slice(0, -1).join(", ")} or ${SESSION_EFFORT_LEVELS["codex-cli"].at(-1) ?? "ultra"}.`);
|
|
108
108
|
};
|
|
109
|
-
const readSessionRole = (value) => {
|
|
110
|
-
if (value === undefined)
|
|
111
|
-
return {};
|
|
112
|
-
if (value === "worker" || value === "orchestrator")
|
|
113
|
-
return { role: value };
|
|
114
|
-
throw new CliArgumentError("Option '--role' must be worker or orchestrator.");
|
|
115
|
-
};
|
|
116
109
|
const AGENT_FIXED_OPTIONS = [
|
|
117
110
|
"--agent-definition",
|
|
118
111
|
"--agent-definition-digest",
|
|
@@ -131,35 +124,6 @@ const readAgentId = (options) => {
|
|
|
131
124
|
throw new CliArgumentError(`Option '--agent' fixes the harness, Connection, model and effort; drop '${clash}'.`);
|
|
132
125
|
return { agentId };
|
|
133
126
|
};
|
|
134
|
-
const LABEL_OPTION = new Set(["--label"]);
|
|
135
|
-
const requireOneLabelPerOption = (tokens) => {
|
|
136
|
-
const given = tokens.flatMap((token, index) => {
|
|
137
|
-
if (tokens[index - 1] === "--label")
|
|
138
|
-
return [token];
|
|
139
|
-
return token.startsWith("--label=") ? [token.slice("--label=".length)] : [];
|
|
140
|
-
});
|
|
141
|
-
if (given.some((value) => value.includes(",")))
|
|
142
|
-
throw new CliArgumentError("Option '--label' takes one key=value; repeat the option for more.");
|
|
143
|
-
};
|
|
144
|
-
const readLabels = (value) => {
|
|
145
|
-
if (value === undefined)
|
|
146
|
-
return {};
|
|
147
|
-
const pairs = value.split(",").map((pair) => {
|
|
148
|
-
const separator = pair.indexOf("=");
|
|
149
|
-
if (separator < 1)
|
|
150
|
-
throw new CliArgumentError("Option '--label' takes key=value.");
|
|
151
|
-
return [pair.slice(0, separator), pair.slice(separator + 1)];
|
|
152
|
-
});
|
|
153
|
-
const duplicate = pairs.find(([key], index) => pairs.findIndex(([other]) => other === key) !== index);
|
|
154
|
-
if (duplicate !== undefined)
|
|
155
|
-
throw new CliArgumentError(`Label '${duplicate[0]}' is given twice.`);
|
|
156
|
-
return { labels: Object.fromEntries(pairs) };
|
|
157
|
-
};
|
|
158
|
-
const readSessionTitle = (options) => {
|
|
159
|
-
if (options.has("--name") && options.has("--title"))
|
|
160
|
-
throw new CliArgumentError("Use one of '--name' or '--title'.");
|
|
161
|
-
return options.get("--title") ?? options.get("--name");
|
|
162
|
-
};
|
|
163
127
|
const readSessionSelection = ({ flags, options }, workspaceId) => {
|
|
164
128
|
const agent = readAgentId(options);
|
|
165
129
|
const commandId = options.get("--command-id");
|
|
@@ -315,8 +279,39 @@ export const runSessionCreate = (tokens, context) => {
|
|
|
315
279
|
result: summarizeSessionCreation(value),
|
|
316
280
|
})));
|
|
317
281
|
};
|
|
282
|
+
const readSettled = ({ flags, options, }) => {
|
|
283
|
+
const idleFor = options.get("--idle-for");
|
|
284
|
+
if (!flags.has("--settled")) {
|
|
285
|
+
if (idleFor !== undefined)
|
|
286
|
+
throw new CliArgumentError("Use '--idle-for' with '--settled'.");
|
|
287
|
+
return {};
|
|
288
|
+
}
|
|
289
|
+
return {
|
|
290
|
+
...(idleFor === undefined
|
|
291
|
+
? {}
|
|
292
|
+
: {
|
|
293
|
+
idleForSeconds: readDuration(idleFor, "--idle-for", {
|
|
294
|
+
max: MAX_SESSION_SETTLED_IDLE_SECONDS,
|
|
295
|
+
min: 1,
|
|
296
|
+
}),
|
|
297
|
+
}),
|
|
298
|
+
settled: true,
|
|
299
|
+
};
|
|
300
|
+
};
|
|
318
301
|
const readSessionList = (tokens) => {
|
|
319
|
-
|
|
302
|
+
requireOneLabelPerOption(tokens);
|
|
303
|
+
const parsed = parseOptionsWith(tokens, {
|
|
304
|
+
allowed: new Set([
|
|
305
|
+
"--after",
|
|
306
|
+
"--idle-for",
|
|
307
|
+
"--label",
|
|
308
|
+
"--limit",
|
|
309
|
+
"--project",
|
|
310
|
+
"--state",
|
|
311
|
+
]),
|
|
312
|
+
allowedFlags: new Set(["--all", "--attention", "--settled"]),
|
|
313
|
+
repeatable: LABEL_OPTION,
|
|
314
|
+
});
|
|
320
315
|
requirePositionals(parsed.positionals, 0);
|
|
321
316
|
const projectId = parsed.options.get("--project");
|
|
322
317
|
if ((projectId === undefined) === !parsed.flags.has("--all"))
|
|
@@ -324,7 +319,9 @@ const readSessionList = (tokens) => {
|
|
|
324
319
|
const states = parsed.options.get("--state")?.split(",");
|
|
325
320
|
return {
|
|
326
321
|
afterCursor: readCursor(parsed.options.get("--after")),
|
|
322
|
+
...readSettled(parsed),
|
|
327
323
|
limit: readPageSize(parsed.options.get("--limit")),
|
|
324
|
+
...readLabels(parsed.options.get("--label")),
|
|
328
325
|
...(projectId === undefined ? {} : { projectId }),
|
|
329
326
|
...(parsed.flags.has("--attention") ? { attention: true } : {}),
|
|
330
327
|
...(states === undefined ? {} : { states }),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { cell, fields, formatRows, tab, withPrunedHistory, writeNodeResult, } from "../../command-line/index.js";
|
|
1
|
+
import { cell, fields, formatRows, labelCells, tab, withPrunedHistory, writeNodeResult, } from "../../command-line/index.js";
|
|
2
2
|
import { formatSessionDiff } from "./diff.js";
|
|
3
3
|
import { formatFailure, formatSessionEvents } from "./failure.js";
|
|
4
4
|
import { formatSessionObservation } from "./observe.js";
|
|
5
|
-
import { activityLabel, formatSessionList, formatSessionTasks,
|
|
5
|
+
import { activityLabel, formatSessionList, formatSessionTasks, } from "./tasks.js";
|
|
6
6
|
const formatSessionInbox = (deliveries) => formatRows(deliveries, (delivery) => `${delivery.deliveryId}\t${delivery.sequence}\t${cell(delivery.message.senderSessionId)}\t${cell(delivery.message.subject)}\t${cell(delivery.message.body)}`);
|
|
7
7
|
const formatSessionCreation = (result) => `${fields([
|
|
8
8
|
["session", result.sessionId],
|
|
@@ -33,9 +33,20 @@ const formatCodingSession = (result) => {
|
|
|
33
33
|
const formatAgentPermission = (result) => result.command === "session.agent-permission.preview"
|
|
34
34
|
? `${result.result.sessionId}\t${result.result.expiresAt}\n`
|
|
35
35
|
: `${result.result.receipt.receiptId}\t${result.result.delivery}\n`;
|
|
36
|
+
const formatPrompt = (prompt) => prompt === undefined
|
|
37
|
+
? ""
|
|
38
|
+
: `prompt: ${prompt.approvalId}\t${prompt.kind}\texpires=${prompt.expiresAt}\n${(prompt.summary ?? "")
|
|
39
|
+
.split("\n")
|
|
40
|
+
.map((line) => ` ${line}`)
|
|
41
|
+
.join("\n")}\n${(prompt.options ?? [])
|
|
42
|
+
.map((option) => ` ${option.optionId}\t${option.label}\n`)
|
|
43
|
+
.join("")}`;
|
|
36
44
|
export const formatSessionShow = ({ session, }) => `${fields([
|
|
37
45
|
["session", session.id],
|
|
38
46
|
["state", session.state],
|
|
47
|
+
...(session.status === undefined
|
|
48
|
+
? []
|
|
49
|
+
: [["status", session.status]]),
|
|
39
50
|
...(session.activity === undefined
|
|
40
51
|
? []
|
|
41
52
|
: [["activity", activityLabel(session)]]),
|
|
@@ -51,7 +62,7 @@ export const formatSessionShow = ({ session, }) => `${fields([
|
|
|
51
62
|
session.labels === undefined ? undefined : labelCells(session.labels),
|
|
52
63
|
],
|
|
53
64
|
["updated", session.updatedAt],
|
|
54
|
-
])}${formatFailure(session.failure)}`;
|
|
65
|
+
])}${formatPrompt(session.prompt)}${formatFailure(session.failure)}`;
|
|
55
66
|
const formatLifecycle = ({ revision, sessionId, state, }) => `${fields([
|
|
56
67
|
["session", sessionId],
|
|
57
68
|
["state", state],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { formatMerged } from "../../address-space/index.js";
|
|
2
|
-
import { cell, fields, formatRows, tab, withNextPage, } from "../../command-line/index.js";
|
|
2
|
+
import { cell, fields, formatRows, labelCells, tab, withNextPage, } from "../../command-line/index.js";
|
|
3
3
|
import { formatFailureCell } from "./failure.js";
|
|
4
4
|
const failureDetail = ({ failure, message, }) => {
|
|
5
5
|
if (failure !== undefined)
|
|
@@ -37,6 +37,7 @@ const SESSION_HEADERS = [
|
|
|
37
37
|
"SESSION",
|
|
38
38
|
"STATE",
|
|
39
39
|
"ACTIVITY",
|
|
40
|
+
"STATUS",
|
|
40
41
|
"WORKSPACE",
|
|
41
42
|
"ATTENTION",
|
|
42
43
|
"CONTAINMENT",
|
|
@@ -44,18 +45,23 @@ const SESSION_HEADERS = [
|
|
|
44
45
|
"LABELS",
|
|
45
46
|
"LAST ACTIVE",
|
|
46
47
|
];
|
|
47
|
-
export const activityLabel = (session) =>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
.
|
|
54
|
-
|
|
48
|
+
export const activityLabel = (session) => {
|
|
49
|
+
const completed = session.status === undefined
|
|
50
|
+
? session.latestTurnState === "completed"
|
|
51
|
+
: session.status === "done";
|
|
52
|
+
return session.activity === "idle" && completed
|
|
53
|
+
? "done"
|
|
54
|
+
: (session.activity ?? "-");
|
|
55
|
+
};
|
|
56
|
+
const sessionHeaders = (items) => items.some((session) => session.settledReason !== undefined)
|
|
57
|
+
? [...SESSION_HEADERS, "SETTLED"]
|
|
58
|
+
: SESSION_HEADERS;
|
|
59
|
+
const settledCells = (session, headers) => headers.length > SESSION_HEADERS.length ? [session.settledReason ?? "-"] : [];
|
|
55
60
|
const sessionCells = (session, attention) => [
|
|
56
61
|
session.id,
|
|
57
62
|
session.state,
|
|
58
63
|
activityLabel(session),
|
|
64
|
+
session.status ?? "-",
|
|
59
65
|
session.workspaceId,
|
|
60
66
|
attention ?? "-",
|
|
61
67
|
session.containment ?? "-",
|
|
@@ -65,7 +71,11 @@ const sessionCells = (session, attention) => [
|
|
|
65
71
|
];
|
|
66
72
|
export const formatSessionList = (result) => {
|
|
67
73
|
const attention = new Map((result.attention ?? []).map((item) => [item.sessionId, item.attention]));
|
|
68
|
-
|
|
74
|
+
const headers = sessionHeaders(result.items);
|
|
75
|
+
return withNextPage(formatRows(result.items, (session) => tab([
|
|
76
|
+
...sessionCells(session, attention.get(session.id)),
|
|
77
|
+
...settledCells(session, headers),
|
|
78
|
+
]), { empty: "No Sessions.", headers }), result.nextCursor);
|
|
69
79
|
};
|
|
70
80
|
const sessionKey = (node, id) => `${node} ${id}`;
|
|
71
81
|
export const formatMergedSessions = ({ result, }) => {
|
|
@@ -73,6 +83,10 @@ export const formatMergedSessions = ({ result, }) => {
|
|
|
73
83
|
sessionKey(item.node, item.sessionId),
|
|
74
84
|
item.attention,
|
|
75
85
|
]));
|
|
76
|
-
|
|
86
|
+
const headers = sessionHeaders(result.items);
|
|
87
|
+
return formatMerged(result, (session) => tab([
|
|
88
|
+
...sessionCells(session, attention.get(sessionKey(session.node, session.id))),
|
|
89
|
+
...settledCells(session, headers),
|
|
90
|
+
]), { empty: "No Sessions.", headers });
|
|
77
91
|
};
|
|
78
92
|
//# sourceMappingURL=tasks.js.map
|