@qilin-agent/client-ui-sidebar-tasks 0.0.0-stage → 3.1.4
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/LICENSE +21 -0
- package/README.i18n.yaml +40 -0
- package/README.md +83 -2
- package/README.zh.md +84 -0
- package/lib/client.js +2006 -0
- package/lib/index.js +6 -0
- package/lib/types/client/TasksBadge.d.ts +35 -0
- package/lib/types/client/TasksBody.d.ts +30 -0
- package/lib/types/client/TasksGraphView.d.ts +22 -0
- package/lib/types/client/definition.d.ts +20 -0
- package/lib/types/client/face.d.ts +94 -0
- package/lib/types/client/index.d.ts +38 -0
- package/lib/types/client/lineage.d.ts +21 -0
- package/lib/types/client/locales.d.ts +133 -0
- package/lib/types/client/rows.d.ts +166 -0
- package/lib/types/client/tasks-graph-layout.d.ts +104 -0
- package/lib/types/client/tasks-graph-model.d.ts +132 -0
- package/lib/types/client/tasks-graph-store.d.ts +82 -0
- package/lib/types/client/work-sources.d.ts +25 -0
- package/lib/types/index.d.ts +4 -0
- package/package.json +77 -3
package/lib/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The chip's status pill: how much work this Session currently has running.
|
|
3
|
+
*
|
|
4
|
+
* The kit draws it between the chip's glyph and its title and calls it on every
|
|
5
|
+
* strip render, so it reads the two snapshots straight through the standard
|
|
6
|
+
* `useSessions` hook and derives nothing else.
|
|
7
|
+
*/
|
|
8
|
+
import type { ReactNode } from 'react';
|
|
9
|
+
import type { JobsSnapshot } from '@qilin-agent/api-job-controller/client';
|
|
10
|
+
import type { InjectFace, PropsRuntime } from '@qilin-agent/client-ui-slots';
|
|
11
|
+
import type { SessionId } from '@qilin-agent/session/types';
|
|
12
|
+
/** The badge's injected face: the background-job roster and its watcher. */
|
|
13
|
+
export interface TasksBadgeInjected {
|
|
14
|
+
hooks: {
|
|
15
|
+
/** Client jobs snapshot (rosters and observations) bound by the renderer as useJobs. */
|
|
16
|
+
jobs: {
|
|
17
|
+
getSnapshot(): JobsSnapshot;
|
|
18
|
+
subscribe(listener: () => void): () => void;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Keep this Session's roster current while the badge is mounted; returns the
|
|
23
|
+
* stop function.
|
|
24
|
+
*/
|
|
25
|
+
watchRows: (sessionId: SessionId) => () => void;
|
|
26
|
+
}
|
|
27
|
+
/** The badge's composed props: the Session scope's standard kit and the roster face. */
|
|
28
|
+
export type TasksBadgeProps = PropsRuntime<'sidebar.right.pane.tab.badge'> & InjectFace<TasksBadgeInjected>;
|
|
29
|
+
/**
|
|
30
|
+
* Render the running-work count, or nothing when the Session is idle.
|
|
31
|
+
* @param props - the Session scope's standard props.
|
|
32
|
+
* @returns the count, or null when no subagent and no job is running.
|
|
33
|
+
*/
|
|
34
|
+
export declare function TasksBadge({ sessionId, useSessions, useJobs, watchRows }: TasksBadgeProps): ReactNode;
|
|
35
|
+
//# sourceMappingURL=TasksBadge.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { InjectFace, PropsLocale, PropsRuntime, PropsStore, TranslateNS } from '@qilin-agent/client-ui-slots';
|
|
3
|
+
import type { TasksInjected } from './face.ts';
|
|
4
|
+
import { NS } from './locales.ts';
|
|
5
|
+
import type { SubagentRow } from './rows.ts';
|
|
6
|
+
import type { createTasksGraphStore } from './tasks-graph-store.ts';
|
|
7
|
+
/** The store handle type the body's store share derives from. */
|
|
8
|
+
type TasksGraphStore = ReturnType<typeof createTasksGraphStore>;
|
|
9
|
+
/** The body's composed props: the tab it draws, its face, its store, and its copy. */
|
|
10
|
+
export type TasksBodyProps = PropsRuntime<'sidebar.right.pane.tab'> & InjectFace<TasksInjected> & PropsStore<TasksGraphStore> & PropsLocale<typeof NS>;
|
|
11
|
+
/** How many subagent rows an unfolded section shows before folding the rest. */
|
|
12
|
+
export declare const SUBAGENT_PREVIEW = 5;
|
|
13
|
+
/** How many job rows an unfolded section shows before folding the rest. */
|
|
14
|
+
export declare const TASK_PREVIEW = 3;
|
|
15
|
+
/** One subagent row: the open gesture across the row, the interrupt beside it. */
|
|
16
|
+
export declare function SubagentRowView({ row, t, onOpen, onInterrupt }: {
|
|
17
|
+
readonly row: SubagentRow;
|
|
18
|
+
readonly t: TranslateNS<typeof NS>;
|
|
19
|
+
readonly onOpen: TasksInjected['openChild'];
|
|
20
|
+
readonly onInterrupt: TasksInjected['interruptChild'];
|
|
21
|
+
}): ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* The page body.
|
|
24
|
+
* @param props - the tab's runtime share, the injected face, the graph store
|
|
25
|
+
* shares, and the copy.
|
|
26
|
+
* @returns the two sections, or the single line a Session with no work shows.
|
|
27
|
+
*/
|
|
28
|
+
export declare function TasksBody({ sessionId, useSessions, useJobs, useStore, actions, watchRows, openChild, refresh, interruptChild, t, }: TasksBodyProps): ReactNode;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=TasksBody.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { PropsLocale, PropsStore } from '@qilin-agent/client-ui-slots';
|
|
3
|
+
import type { NS } from './locales.ts';
|
|
4
|
+
import type { TaskNodeVM, TasksGraphModel } from './tasks-graph-model.ts';
|
|
5
|
+
import type { createTasksGraphStore } from './tasks-graph-store.ts';
|
|
6
|
+
/** The store handle type the view's props share derives from. */
|
|
7
|
+
type TasksGraphStore = ReturnType<typeof createTasksGraphStore>;
|
|
8
|
+
/** The view's composed props: the model, the node gesture, the copy, and the store shares. */
|
|
9
|
+
export type TasksGraphViewProps = {
|
|
10
|
+
/** The view model the canvas lays out. */
|
|
11
|
+
readonly model: TasksGraphModel;
|
|
12
|
+
/** One node activation, already routed by the page. */
|
|
13
|
+
readonly onNodeClick: (node: TaskNodeVM) => void;
|
|
14
|
+
} & PropsLocale<typeof NS> & PropsStore<TasksGraphStore>;
|
|
15
|
+
/**
|
|
16
|
+
* The tasks graph canvas.
|
|
17
|
+
* @param props - the model, the node gesture, the copy, and the store shares.
|
|
18
|
+
* @returns the canvas and its control cluster.
|
|
19
|
+
*/
|
|
20
|
+
export declare function TasksGraphView({ model, onNodeClick, useStore, actions, t, }: TasksGraphViewProps): ReactNode;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=TasksGraphView.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stage one of this package's registration: what the `tasks` tab type IS.
|
|
3
|
+
*
|
|
4
|
+
* The type is a page, not a viewer: it claims no address, so a tab of this kind
|
|
5
|
+
* is opened by kind alone — from the guide page's entry box, or from anywhere
|
|
6
|
+
* that calls `ctx.sidebarRight.openTab('tasks')`.
|
|
7
|
+
*/
|
|
8
|
+
import type { TranslateNS } from '@qilin-agent/client-locale/client';
|
|
9
|
+
import type { SidebarRightTabDefinition } from '@qilin-agent/client-ui-sidebar-right/client';
|
|
10
|
+
/** The tab kind this package owns; `ctx.sidebarRight.openTab` names it. */
|
|
11
|
+
export declare const TASKS_KIND = "tasks";
|
|
12
|
+
/** This implementation's identity in the tab system, and the key its body registers under. */
|
|
13
|
+
export declare const TASKS_ID = "@qilin-agent/client-ui-sidebar-tasks";
|
|
14
|
+
/**
|
|
15
|
+
* The tasks type's registry definition.
|
|
16
|
+
* @param t - namespace-bound translate, read fresh on every label call.
|
|
17
|
+
* @returns the definition to register.
|
|
18
|
+
*/
|
|
19
|
+
export declare function tasksDefinition(t: TranslateNS<'sidebarTasks'>): SidebarRightTabDefinition;
|
|
20
|
+
//# sourceMappingURL=definition.d.ts.map
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The page's actions, bound to the Session service and the subagent Remote.
|
|
3
|
+
*
|
|
4
|
+
* The component awaits nothing: it calls `openChild`, `refresh`, and
|
|
5
|
+
* `interruptChild`, and this face performs the service and Remote calls behind
|
|
6
|
+
* them. Each action resolves what it needs at call time, never at render time.
|
|
7
|
+
*/
|
|
8
|
+
import type { JobsSnapshot } from '@qilin-agent/api-job-controller/client';
|
|
9
|
+
import type { SessionTarget } from '@qilin-agent/api-session-controller/client';
|
|
10
|
+
import type { SessionId } from '@qilin-agent/session/types';
|
|
11
|
+
import type { SubagentInterruptReceipt } from '@qilin-agent/subagent/client';
|
|
12
|
+
import type { RemoteResult } from '@qilin-agent/typert-protocol';
|
|
13
|
+
/** The `ctx.sessions` reads the page's actions perform. */
|
|
14
|
+
export interface TasksSessionActions {
|
|
15
|
+
/**
|
|
16
|
+
* Reveal one Session as the current one: a catalog child through its
|
|
17
|
+
* durable address, or a bare id (the graph's main card).
|
|
18
|
+
* @param target - the Session to open.
|
|
19
|
+
*/
|
|
20
|
+
openSubagent(target: SessionTarget): void;
|
|
21
|
+
/**
|
|
22
|
+
* Re-read one parent's direct-child catalog.
|
|
23
|
+
* @param parentSessionId - catalog owner.
|
|
24
|
+
* @returns completion of the current or newly started read.
|
|
25
|
+
*/
|
|
26
|
+
refreshProjections(parentSessionId: SessionId): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
/** One child interrupt, as the Host's generated `subagents.interruptByParent` declares it. */
|
|
29
|
+
export type InterruptByParent = (childSessionId: SessionId, parentSessionId: SessionId, mode: 'continuable') => Promise<RemoteResult<SubagentInterruptReceipt>>;
|
|
30
|
+
/** The slice of the Client Remote face the page calls. */
|
|
31
|
+
export interface TasksSubagentsRemote {
|
|
32
|
+
/**
|
|
33
|
+
* Stop one continuable child through its durable parent address.
|
|
34
|
+
* @param childSessionId - the child being stopped.
|
|
35
|
+
* @param parentSessionId - the child's direct parent.
|
|
36
|
+
* @param mode - the delivery mode the address must carry.
|
|
37
|
+
* @returns the Host's receipt, or its failure.
|
|
38
|
+
*/
|
|
39
|
+
interruptByParent: InterruptByParent;
|
|
40
|
+
}
|
|
41
|
+
/** The page's injected business face, as the body receives it. */
|
|
42
|
+
export interface TasksInjected {
|
|
43
|
+
/**
|
|
44
|
+
* Reveal one Session as the current one: a row's catalog address, or the
|
|
45
|
+
* graph's bare main id.
|
|
46
|
+
* @param target - the Session to open.
|
|
47
|
+
*/
|
|
48
|
+
readonly openChild: (target: SessionTarget) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Re-read one parent's direct-child catalog.
|
|
51
|
+
* @param parentSessionId - catalog owner.
|
|
52
|
+
*/
|
|
53
|
+
readonly refresh: (parentSessionId: SessionId) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Stop one running continuable child through its durable parent address. The
|
|
56
|
+
* call is fire-and-forget: a rejected interrupt leaves the row exactly as the
|
|
57
|
+
* catalog reports it until the next refresh.
|
|
58
|
+
* @param childSessionId - the child being stopped.
|
|
59
|
+
* @param parentSessionId - the child's direct parent.
|
|
60
|
+
*/
|
|
61
|
+
readonly interruptChild: (childSessionId: SessionId, parentSessionId: SessionId) => void;
|
|
62
|
+
/** The client jobs roster the page draws, bound by the renderer as useJobs. */
|
|
63
|
+
readonly hooks: {
|
|
64
|
+
readonly jobs: {
|
|
65
|
+
getSnapshot(): JobsSnapshot;
|
|
66
|
+
subscribe(listener: () => void): () => void;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Keep this Session's roster current while the page is mounted; returns the
|
|
71
|
+
* stop function.
|
|
72
|
+
* @param sessionId - the Session whose visible jobs to mirror.
|
|
73
|
+
*/
|
|
74
|
+
readonly watchRows: (sessionId: SessionId) => () => void;
|
|
75
|
+
}
|
|
76
|
+
/** The background-job roster and watcher the page draws from. */
|
|
77
|
+
export interface TasksJobsFace {
|
|
78
|
+
readonly hooks: {
|
|
79
|
+
readonly jobs: {
|
|
80
|
+
getSnapshot(): JobsSnapshot;
|
|
81
|
+
subscribe(listener: () => void): () => void;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
readonly watchRows: (sessionId: SessionId) => () => void;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Bind the page's actions to the service and Remote they call.
|
|
88
|
+
* @param sessions - the Client Session service's navigation and catalog reads.
|
|
89
|
+
* @param subagents - the generated `subagents` Remote namespace.
|
|
90
|
+
* @param jobs - the client jobs roster and its watcher.
|
|
91
|
+
* @returns the Slot `inject` face the body receives.
|
|
92
|
+
*/
|
|
93
|
+
export declare function tasksFace(sessions: TasksSessionActions, subagents: TasksSubagentsRemote, jobs: TasksJobsFace): TasksInjected;
|
|
94
|
+
//# sourceMappingURL=face.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser half: register `tasks` as a right-Sidebar tab type.
|
|
3
|
+
*
|
|
4
|
+
* The public two-stage path, unmodified: the type into `ctx.sidebarRightTabs`,
|
|
5
|
+
* the body into the keyed `sidebar.right.pane.tab` seat, and the strip's status
|
|
6
|
+
* pill into the keyed `sidebar.right.pane.tab.badge` seat, all under the type's
|
|
7
|
+
* `id`.
|
|
8
|
+
*
|
|
9
|
+
* The split is this package's layering: what the type IS (`definition.tsx`),
|
|
10
|
+
* what it says (`locales.ts`), the pure projections of the two snapshots
|
|
11
|
+
* (`rows.ts`, `lineage.ts`), the graph's pure model and layout
|
|
12
|
+
* (`tasks-graph-model.ts`, `tasks-graph-layout.ts`), what it keeps
|
|
13
|
+
* (`tasks-graph-store.ts`), the actions it performs (`face.ts`), what it draws
|
|
14
|
+
* (`TasksBody.tsx`, `TasksGraphView.tsx`, `TasksBadge.tsx`), and this module,
|
|
15
|
+
* which wires them.
|
|
16
|
+
*/
|
|
17
|
+
import type { Context as ClientContext } from '@qilin-agent/kylin';
|
|
18
|
+
export type { SidebarTasksKey } from './locales.ts';
|
|
19
|
+
export type { InterruptByParent, TasksInjected, TasksSessionActions, TasksSubagentsRemote } from './face.ts';
|
|
20
|
+
export type { SubagentDescendantSummary } from './lineage.ts';
|
|
21
|
+
export type { SubagentRow } from './rows.ts';
|
|
22
|
+
export type { TaskNodeKind, TaskNodeVM, TasksGraphModel } from './tasks-graph-model.ts';
|
|
23
|
+
export type { NodeOffsets, TaskLayoutMode } from './tasks-graph-layout.ts';
|
|
24
|
+
export type { TasksGraphCamera, TasksGraphState } from './tasks-graph-store.ts';
|
|
25
|
+
export type { TasksBadgeProps } from './TasksBadge.tsx';
|
|
26
|
+
export type { TasksBodyProps } from './TasksBody.tsx';
|
|
27
|
+
/**
|
|
28
|
+
* Required browser services: the tab registry, the keyed seats, the Session
|
|
29
|
+
* service and its subagent Remote, and copy.
|
|
30
|
+
*/
|
|
31
|
+
export declare const inject: string[];
|
|
32
|
+
/**
|
|
33
|
+
* Client plugin body: register the type, its dictionaries, its body, and the
|
|
34
|
+
* chip's status pill.
|
|
35
|
+
* @param ctx - client root context carrying the registry, the slots, the Session service, and the Remote face.
|
|
36
|
+
*/
|
|
37
|
+
export declare function apply(ctx: ClientContext): void;
|
|
38
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** UI Sidebar Tasks-owned projection of descendant counts from Session summaries. */
|
|
2
|
+
import type { SessionId } from '@qilin-agent/session/types';
|
|
3
|
+
interface LineageEntry {
|
|
4
|
+
readonly id: SessionId;
|
|
5
|
+
readonly parentId?: SessionId;
|
|
6
|
+
readonly origin?: 'subagent';
|
|
7
|
+
readonly running: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** Descendant counts for one possible parent Session. */
|
|
10
|
+
export interface SubagentDescendantSummary {
|
|
11
|
+
readonly count: number;
|
|
12
|
+
readonly runningCount: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Index uninterrupted subagent descendants under each ancestor.
|
|
16
|
+
* @param summaries - Session summaries keyed by id.
|
|
17
|
+
* @returns descendant totals keyed by possible parent id.
|
|
18
|
+
*/
|
|
19
|
+
export declare function indexSubagentDescendants(summaries: Readonly<Record<SessionId, LineageEntry>>): ReadonlyMap<SessionId, SubagentDescendantSummary>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=lineage.d.ts.map
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
declare module '@qilin-agent/client-ui-slots' {
|
|
2
|
+
interface LocaleNamespaceMap {
|
|
3
|
+
/** Tasks page type name, guide entry, section copy, and job status words. */
|
|
4
|
+
sidebarTasks: SidebarTasksKey;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
/** Dictionary namespace owned by this plugin. */
|
|
8
|
+
export declare const NS = "sidebarTasks";
|
|
9
|
+
/** Simplified Chinese dictionary and key-set source of truth. */
|
|
10
|
+
export declare const zh: {
|
|
11
|
+
'type.label': string;
|
|
12
|
+
'guide.title': string;
|
|
13
|
+
'guide.description': string;
|
|
14
|
+
empty: string;
|
|
15
|
+
'subagents.title': string;
|
|
16
|
+
'subagents.count.one': string;
|
|
17
|
+
'subagents.count.other': string;
|
|
18
|
+
'subagents.loading': string;
|
|
19
|
+
'subagents.empty': string;
|
|
20
|
+
'subagents.failed': string;
|
|
21
|
+
'subagents.retry': string;
|
|
22
|
+
'subagents.refresh': string;
|
|
23
|
+
'subagents.interrupt': string;
|
|
24
|
+
'subagents.mode.oneShot': string;
|
|
25
|
+
'subagents.mode.continuable': string;
|
|
26
|
+
'subagents.diagnostic.corrupt': string;
|
|
27
|
+
'subagents.diagnostic.unsupported': string;
|
|
28
|
+
'subagents.diagnostic.unavailable': string;
|
|
29
|
+
'tasks.title': string;
|
|
30
|
+
'tasks.count.one': string;
|
|
31
|
+
'tasks.count.other': string;
|
|
32
|
+
'tasks.empty': string;
|
|
33
|
+
'tasks.status.running': string;
|
|
34
|
+
'tasks.status.stopping': string;
|
|
35
|
+
'tasks.status.completed': string;
|
|
36
|
+
'tasks.status.killed': string;
|
|
37
|
+
'tasks.status.failed': string;
|
|
38
|
+
'tasks.duration.seconds': string;
|
|
39
|
+
'tasks.duration.minutes': string;
|
|
40
|
+
'tasks.duration.hours': string;
|
|
41
|
+
'tasks.duration.live': string;
|
|
42
|
+
'tasks.duration.done': string;
|
|
43
|
+
'more.expand': string;
|
|
44
|
+
'more.collapse': string;
|
|
45
|
+
'graph.toggle': string;
|
|
46
|
+
'graph.view': string;
|
|
47
|
+
'graph.list': string;
|
|
48
|
+
'graph.zoomIn': string;
|
|
49
|
+
'graph.zoomOut': string;
|
|
50
|
+
'graph.fit': string;
|
|
51
|
+
'graph.arrange': string;
|
|
52
|
+
'graph.mode.tree': string;
|
|
53
|
+
'graph.mode.compact': string;
|
|
54
|
+
'graph.mode.grid': string;
|
|
55
|
+
'graph.resetLayout': string;
|
|
56
|
+
'graph.status.running': string;
|
|
57
|
+
'graph.status.idle': string;
|
|
58
|
+
'graph.loading': string;
|
|
59
|
+
'graph.unphased': string;
|
|
60
|
+
'graph.badge.main': string;
|
|
61
|
+
'graph.badge.subagent': string;
|
|
62
|
+
'graph.badge.done': string;
|
|
63
|
+
'graph.badge.standby': string;
|
|
64
|
+
'graph.badge.placeholder': string;
|
|
65
|
+
'graph.badge.diagnostic': string;
|
|
66
|
+
'graph.badge.run': string;
|
|
67
|
+
'graph.badge.phase': string;
|
|
68
|
+
'graph.badge.member': string;
|
|
69
|
+
};
|
|
70
|
+
/** Tasks dictionary key union. */
|
|
71
|
+
export type SidebarTasksKey = keyof typeof zh;
|
|
72
|
+
/** English dictionary, checked against the Chinese key set. */
|
|
73
|
+
export declare const en: {
|
|
74
|
+
'type.label': string;
|
|
75
|
+
'guide.title': string;
|
|
76
|
+
'guide.description': string;
|
|
77
|
+
empty: string;
|
|
78
|
+
'subagents.title': string;
|
|
79
|
+
'subagents.count.one': string;
|
|
80
|
+
'subagents.count.other': string;
|
|
81
|
+
'subagents.loading': string;
|
|
82
|
+
'subagents.empty': string;
|
|
83
|
+
'subagents.failed': string;
|
|
84
|
+
'subagents.retry': string;
|
|
85
|
+
'subagents.refresh': string;
|
|
86
|
+
'subagents.interrupt': string;
|
|
87
|
+
'subagents.mode.oneShot': string;
|
|
88
|
+
'subagents.mode.continuable': string;
|
|
89
|
+
'subagents.diagnostic.corrupt': string;
|
|
90
|
+
'subagents.diagnostic.unsupported': string;
|
|
91
|
+
'subagents.diagnostic.unavailable': string;
|
|
92
|
+
'tasks.title': string;
|
|
93
|
+
'tasks.count.one': string;
|
|
94
|
+
'tasks.count.other': string;
|
|
95
|
+
'tasks.empty': string;
|
|
96
|
+
'tasks.status.running': string;
|
|
97
|
+
'tasks.status.stopping': string;
|
|
98
|
+
'tasks.status.completed': string;
|
|
99
|
+
'tasks.status.killed': string;
|
|
100
|
+
'tasks.status.failed': string;
|
|
101
|
+
'tasks.duration.seconds': string;
|
|
102
|
+
'tasks.duration.minutes': string;
|
|
103
|
+
'tasks.duration.hours': string;
|
|
104
|
+
'tasks.duration.live': string;
|
|
105
|
+
'tasks.duration.done': string;
|
|
106
|
+
'more.expand': string;
|
|
107
|
+
'more.collapse': string;
|
|
108
|
+
'graph.toggle': string;
|
|
109
|
+
'graph.view': string;
|
|
110
|
+
'graph.list': string;
|
|
111
|
+
'graph.zoomIn': string;
|
|
112
|
+
'graph.zoomOut': string;
|
|
113
|
+
'graph.fit': string;
|
|
114
|
+
'graph.arrange': string;
|
|
115
|
+
'graph.mode.tree': string;
|
|
116
|
+
'graph.mode.compact': string;
|
|
117
|
+
'graph.mode.grid': string;
|
|
118
|
+
'graph.resetLayout': string;
|
|
119
|
+
'graph.status.running': string;
|
|
120
|
+
'graph.status.idle': string;
|
|
121
|
+
'graph.loading': string;
|
|
122
|
+
'graph.unphased': string;
|
|
123
|
+
'graph.badge.main': string;
|
|
124
|
+
'graph.badge.subagent': string;
|
|
125
|
+
'graph.badge.done': string;
|
|
126
|
+
'graph.badge.standby': string;
|
|
127
|
+
'graph.badge.placeholder': string;
|
|
128
|
+
'graph.badge.diagnostic': string;
|
|
129
|
+
'graph.badge.run': string;
|
|
130
|
+
'graph.badge.phase': string;
|
|
131
|
+
'graph.badge.member': string;
|
|
132
|
+
};
|
|
133
|
+
//# sourceMappingURL=locales.d.ts.map
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure projections of the two snapshots the page draws: this Session's
|
|
3
|
+
* direct-child subagent catalogs and its background-job list.
|
|
4
|
+
*
|
|
5
|
+
* Nothing here subscribes, requests, or reads a clock it does not take as a
|
|
6
|
+
* parameter: each function maps a snapshot the Session list already holds onto
|
|
7
|
+
* the rows the page renders. Descendant totals come from the summary lineage
|
|
8
|
+
* (`indexSubagentDescendants`), the only projection that sees subagents below
|
|
9
|
+
* the direct children a catalog reports.
|
|
10
|
+
*/
|
|
11
|
+
import type { SessionProjectionSnapshot } from '@qilin-agent/api-session-controller/client';
|
|
12
|
+
import type { JobView } from '@qilin-agent/jobs/view';
|
|
13
|
+
import type { StateDotState } from '@qilin-agent/client-ui-primitives';
|
|
14
|
+
import type { TranslateNS } from '@qilin-agent/client-ui-slots';
|
|
15
|
+
import type { SessionId } from '@qilin-agent/session/types';
|
|
16
|
+
import type { SubagentAddress } from '@qilin-agent/subagent/client';
|
|
17
|
+
import type { SubagentDescendantSummary } from './lineage.ts';
|
|
18
|
+
import { NS } from './locales.ts';
|
|
19
|
+
/** Stable empty job list, so a Session without jobs keeps one array identity. */
|
|
20
|
+
export declare const NO_JOBS: readonly JobView[];
|
|
21
|
+
/**
|
|
22
|
+
* One row of a parent's direct-child catalog as the page draws it: a described
|
|
23
|
+
* child, or a candidate the Host could not describe.
|
|
24
|
+
*/
|
|
25
|
+
export type CatalogRow = {
|
|
26
|
+
readonly kind: 'child';
|
|
27
|
+
readonly id: SessionId;
|
|
28
|
+
readonly mode: SubagentAddress['mode'];
|
|
29
|
+
readonly label?: string;
|
|
30
|
+
/** Whether the Session list currently reports the child as running. */
|
|
31
|
+
readonly activity: 'running' | 'inactive';
|
|
32
|
+
/** Whether a catalog below this child has yet to prove it childless. */
|
|
33
|
+
readonly hasChildren: boolean;
|
|
34
|
+
} | {
|
|
35
|
+
readonly kind: 'diagnostic';
|
|
36
|
+
readonly id: SessionId;
|
|
37
|
+
readonly reason: 'corrupt' | 'unsupported' | 'unavailable';
|
|
38
|
+
};
|
|
39
|
+
/** One parent's direct-child catalog and the state of its explicit read. */
|
|
40
|
+
export interface CatalogSnapshot {
|
|
41
|
+
readonly state: 'loading' | 'ready' | 'error';
|
|
42
|
+
readonly error: {
|
|
43
|
+
readonly message: string;
|
|
44
|
+
} | null;
|
|
45
|
+
readonly entries: readonly CatalogRow[];
|
|
46
|
+
}
|
|
47
|
+
/** Direct-child catalogs keyed by the Session they describe. */
|
|
48
|
+
export type Catalogs = Readonly<Record<SessionId, CatalogSnapshot>>;
|
|
49
|
+
/**
|
|
50
|
+
* Project the shared per-Session projection snapshots into the catalogs the page draws.
|
|
51
|
+
* @param projections - projection snapshots keyed by Session id.
|
|
52
|
+
* @param running - whether the Session list currently reports a Session as running.
|
|
53
|
+
* @returns one catalog per projected Session.
|
|
54
|
+
*/
|
|
55
|
+
export declare function catalogsOf(projections: Readonly<Record<SessionId, SessionProjectionSnapshot>>, running: (id: SessionId) => boolean): Catalogs;
|
|
56
|
+
/** One row the subagents section draws: a catalog child, or a child whose durable record could not be read. */
|
|
57
|
+
export type SubagentRow = {
|
|
58
|
+
readonly kind: 'child';
|
|
59
|
+
/** The child's Session id, and the row's stable key. */
|
|
60
|
+
readonly id: SessionId;
|
|
61
|
+
/** The durable direct-parent address every action on this row travels through. */
|
|
62
|
+
readonly address: SubagentAddress;
|
|
63
|
+
readonly label: string;
|
|
64
|
+
/** Nesting level under the section's root Session. */
|
|
65
|
+
readonly depth: number;
|
|
66
|
+
readonly running: boolean;
|
|
67
|
+
} | {
|
|
68
|
+
readonly kind: 'diagnostic';
|
|
69
|
+
readonly id: SessionId;
|
|
70
|
+
readonly depth: number;
|
|
71
|
+
readonly reason: 'corrupt' | 'unsupported' | 'unavailable';
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Flatten one Session's subagent topology from the catalogs in hand.
|
|
75
|
+
*
|
|
76
|
+
* A level is one parent's catalog, and the walk descends only into children
|
|
77
|
+
* whose own catalog has been read; a child the page has never opened
|
|
78
|
+
* contributes its own row and no rows below it. Siblings are newest-first
|
|
79
|
+
* because the Host orders a catalog by durable creation time. The seen set
|
|
80
|
+
* makes a repeated or cyclic parent an ordinary skip rather than an endless
|
|
81
|
+
* walk.
|
|
82
|
+
* @param catalogs - direct-child catalogs keyed by parent Session id.
|
|
83
|
+
* @param rootSessionId - the Session the section is rooted at.
|
|
84
|
+
* @returns rows in display order, depth-first.
|
|
85
|
+
*/
|
|
86
|
+
export declare function subagentRows(catalogs: Catalogs, rootSessionId: SessionId): SubagentRow[];
|
|
87
|
+
/**
|
|
88
|
+
* How many rows the subagents section counts as children. A diagnostic row is a
|
|
89
|
+
* child the Host could not describe, so it is drawn but never counted.
|
|
90
|
+
* @param rows - the section's rows.
|
|
91
|
+
* @returns the number of child rows.
|
|
92
|
+
*/
|
|
93
|
+
export declare function childRowCount(rows: readonly SubagentRow[]): number;
|
|
94
|
+
/**
|
|
95
|
+
* The subagents section's stated total: the direct children the catalog
|
|
96
|
+
* reports, or the descendants the summary lineage records, whichever is
|
|
97
|
+
* greater.
|
|
98
|
+
*
|
|
99
|
+
* The lineage reaches subagents below the direct children, and the catalog is
|
|
100
|
+
* authoritative while the lineage is still converging, so taking the greater
|
|
101
|
+
* of the two is never an undercount during that window.
|
|
102
|
+
* @param children - child rows the catalog reports.
|
|
103
|
+
* @param descendants - lineage totals keyed by possible parent.
|
|
104
|
+
* @param rootSessionId - the Session the section is rooted at.
|
|
105
|
+
* @returns the total the section header states.
|
|
106
|
+
*/
|
|
107
|
+
export declare function subagentTotal(children: number, descendants: ReadonlyMap<SessionId, SubagentDescendantSummary>, rootSessionId: SessionId): number;
|
|
108
|
+
/**
|
|
109
|
+
* Whether a job remains active in the registry.
|
|
110
|
+
* @param job - the Session job row.
|
|
111
|
+
* @returns whether the job is running or stopping.
|
|
112
|
+
*/
|
|
113
|
+
export declare function isLive(job: JobView): boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Live rows first in start order, then settled rows newest-first. Two jobs that
|
|
116
|
+
* settled in the same millisecond fall back to the later start, which is the
|
|
117
|
+
* same newest-first reading the settled order already uses, so the sort never
|
|
118
|
+
* depends on the Host's map iteration.
|
|
119
|
+
* @param jobs - the Session's job rows.
|
|
120
|
+
* @returns a new array in display order.
|
|
121
|
+
*/
|
|
122
|
+
export declare function orderedJobs(jobs: readonly JobView[]): JobView[];
|
|
123
|
+
/**
|
|
124
|
+
* Elapsed milliseconds for one job row.
|
|
125
|
+
* @param job - the job.
|
|
126
|
+
* @param now - the clock sample a live duration measures against.
|
|
127
|
+
* @returns its span so far while it runs, its own span once it settled.
|
|
128
|
+
*/
|
|
129
|
+
export declare function jobElapsed(job: JobView, now: number): number;
|
|
130
|
+
/**
|
|
131
|
+
* Elapsed time in at most two adjacent units. A background job that outlives an
|
|
132
|
+
* hour is already exceptional, so hours is the widest unit.
|
|
133
|
+
* @param elapsedMs - elapsed milliseconds.
|
|
134
|
+
* @param t - namespace-bound translate.
|
|
135
|
+
* @returns the duration as the dictionary phrases it.
|
|
136
|
+
*/
|
|
137
|
+
export declare function formatDuration(elapsedMs: number, t: TranslateNS<typeof NS>): string;
|
|
138
|
+
/**
|
|
139
|
+
* Human status word for a row that carries no producer detail.
|
|
140
|
+
* @param status - the wire status.
|
|
141
|
+
* @param t - namespace-bound translate.
|
|
142
|
+
* @returns the word the row shows.
|
|
143
|
+
*/
|
|
144
|
+
export declare function jobStatusLabel(status: JobView['status'], t: TranslateNS<typeof NS>): string;
|
|
145
|
+
/**
|
|
146
|
+
* Status marker semantics. `stopping` and `killed` share the attention colour:
|
|
147
|
+
* both mean the work ended (or is ending) on request rather than on its own.
|
|
148
|
+
* @param status - the wire status.
|
|
149
|
+
* @returns the state the dot draws.
|
|
150
|
+
*/
|
|
151
|
+
export declare function jobDotState(status: JobView['status']): StateDotState;
|
|
152
|
+
/**
|
|
153
|
+
* The work a chip badge counts for one Session: direct-child catalog rows whose
|
|
154
|
+
* activity is `running`, plus the jobs the registry still holds open.
|
|
155
|
+
*
|
|
156
|
+
* A chip re-renders on every strip pass, so this reads the two snapshots
|
|
157
|
+
* directly instead of walking the summary lineage; a running grandchild implies
|
|
158
|
+
* its parent is running too, so the direct children already account for work
|
|
159
|
+
* below them.
|
|
160
|
+
* @param catalogs - direct-child catalogs keyed by parent Session id.
|
|
161
|
+
* @param jobs - the Session's job rows.
|
|
162
|
+
* @param sessionId - the Session the chip belongs to.
|
|
163
|
+
* @returns the count, zero when nothing is active.
|
|
164
|
+
*/
|
|
165
|
+
export declare function activeWorkCount(catalogs: Catalogs, jobs: readonly JobView[], sessionId: SessionId): number;
|
|
166
|
+
//# sourceMappingURL=rows.d.ts.map
|