@maiaos/client-core 0.1.0-canary.5 → 0.1.0-canary.50
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/dist/portfolio/portfolio.d.ts +16 -0
- package/dist/presentation/live.d.ts +8 -0
- package/dist/presentation/session-view.d.ts +8 -0
- package/dist/session-view/session-view.d.ts +2 -0
- package/dist/session-view/session-view.js +9 -6
- package/dist/session-view/timeline.d.ts +10 -1
- package/dist/session-view/timeline.js +12 -4
- package/package.json +2 -2
|
@@ -60,11 +60,13 @@ export declare const makePortfolioService: (client: PortfolioClient) => {
|
|
|
60
60
|
readonly updatedAt: string;
|
|
61
61
|
readonly workspaceId: string;
|
|
62
62
|
readonly workspaceRevision: string;
|
|
63
|
+
readonly activity?: "idle" | "stopped" | "waiting_approval" | "working" | undefined;
|
|
63
64
|
readonly agentDefinitionRef?: {
|
|
64
65
|
readonly contentDigest: string;
|
|
65
66
|
readonly key: string;
|
|
66
67
|
readonly version: string;
|
|
67
68
|
} | undefined;
|
|
69
|
+
readonly containment?: "none" | undefined;
|
|
68
70
|
readonly executor?: {
|
|
69
71
|
readonly connectionId: string;
|
|
70
72
|
readonly effort?: "high" | "low" | "max" | "medium" | "ultra" | "xhigh" | undefined;
|
|
@@ -75,6 +77,12 @@ export declare const makePortfolioService: (client: PortfolioClient) => {
|
|
|
75
77
|
readonly code: string;
|
|
76
78
|
readonly message: string;
|
|
77
79
|
} | undefined;
|
|
80
|
+
readonly labels?: {
|
|
81
|
+
readonly [x: string]: string;
|
|
82
|
+
} | undefined;
|
|
83
|
+
readonly latestTurnId?: string | undefined;
|
|
84
|
+
readonly latestTurnState?: "completed" | "dispatching" | "failed" | "interrupted" | "outcome-unknown" | "queued" | "running" | undefined;
|
|
85
|
+
readonly permission?: "acceptEdits" | "bypassPermissions" | "default" | "dontAsk" | "never" | "on-request" | "plan" | "untrusted" | undefined;
|
|
78
86
|
readonly schemaVersion: 4;
|
|
79
87
|
readonly title?: string | undefined;
|
|
80
88
|
readonly worktree?: {
|
|
@@ -104,11 +112,13 @@ export declare const makePortfolioService: (client: PortfolioClient) => {
|
|
|
104
112
|
readonly updatedAt: string;
|
|
105
113
|
readonly workspaceId: string;
|
|
106
114
|
readonly workspaceRevision: string;
|
|
115
|
+
readonly activity?: "idle" | "stopped" | "waiting_approval" | "working" | undefined;
|
|
107
116
|
readonly agentDefinitionRef?: {
|
|
108
117
|
readonly contentDigest: string;
|
|
109
118
|
readonly key: string;
|
|
110
119
|
readonly version: string;
|
|
111
120
|
} | undefined;
|
|
121
|
+
readonly containment?: "none" | undefined;
|
|
112
122
|
readonly executor?: {
|
|
113
123
|
readonly connectionId: string;
|
|
114
124
|
readonly effort?: "high" | "low" | "max" | "medium" | "ultra" | "xhigh" | undefined;
|
|
@@ -119,6 +129,12 @@ export declare const makePortfolioService: (client: PortfolioClient) => {
|
|
|
119
129
|
readonly code: string;
|
|
120
130
|
readonly message: string;
|
|
121
131
|
} | undefined;
|
|
132
|
+
readonly labels?: {
|
|
133
|
+
readonly [x: string]: string;
|
|
134
|
+
} | undefined;
|
|
135
|
+
readonly latestTurnId?: string | undefined;
|
|
136
|
+
readonly latestTurnState?: "completed" | "dispatching" | "failed" | "interrupted" | "outcome-unknown" | "queued" | "running" | undefined;
|
|
137
|
+
readonly permission?: "acceptEdits" | "bypassPermissions" | "default" | "dontAsk" | "never" | "on-request" | "plan" | "untrusted" | undefined;
|
|
122
138
|
readonly schemaVersion: 4;
|
|
123
139
|
readonly title?: string | undefined;
|
|
124
140
|
readonly worktree?: {
|
|
@@ -91,11 +91,13 @@ export declare const watchSessionList: (view: import("./collection-view.js").Col
|
|
|
91
91
|
readonly updatedAt: string;
|
|
92
92
|
readonly workspaceId: string;
|
|
93
93
|
readonly workspaceRevision: string;
|
|
94
|
+
readonly activity?: "idle" | "stopped" | "waiting_approval" | "working" | undefined;
|
|
94
95
|
readonly agentDefinitionRef?: {
|
|
95
96
|
readonly contentDigest: string;
|
|
96
97
|
readonly key: string;
|
|
97
98
|
readonly version: string;
|
|
98
99
|
} | undefined;
|
|
100
|
+
readonly containment?: "none" | undefined;
|
|
99
101
|
readonly executor?: {
|
|
100
102
|
readonly connectionId: string;
|
|
101
103
|
readonly effort?: "high" | "low" | "max" | "medium" | "ultra" | "xhigh" | undefined;
|
|
@@ -106,6 +108,12 @@ export declare const watchSessionList: (view: import("./collection-view.js").Col
|
|
|
106
108
|
readonly code: string;
|
|
107
109
|
readonly message: string;
|
|
108
110
|
} | undefined;
|
|
111
|
+
readonly labels?: {
|
|
112
|
+
readonly [x: string]: string;
|
|
113
|
+
} | undefined;
|
|
114
|
+
readonly latestTurnId?: string | undefined;
|
|
115
|
+
readonly latestTurnState?: "completed" | "dispatching" | "failed" | "interrupted" | "outcome-unknown" | "queued" | "running" | undefined;
|
|
116
|
+
readonly permission?: "acceptEdits" | "bypassPermissions" | "default" | "dontAsk" | "never" | "on-request" | "plan" | "untrusted" | undefined;
|
|
109
117
|
readonly schemaVersion: 4;
|
|
110
118
|
readonly title?: string | undefined;
|
|
111
119
|
readonly worktree?: {
|
|
@@ -75,11 +75,13 @@ export declare const makeSessionListView: (target: PortfolioProject, emit: (stat
|
|
|
75
75
|
readonly updatedAt: string;
|
|
76
76
|
readonly workspaceId: string;
|
|
77
77
|
readonly workspaceRevision: string;
|
|
78
|
+
readonly activity?: "idle" | "stopped" | "waiting_approval" | "working" | undefined;
|
|
78
79
|
readonly agentDefinitionRef?: {
|
|
79
80
|
readonly contentDigest: string;
|
|
80
81
|
readonly key: string;
|
|
81
82
|
readonly version: string;
|
|
82
83
|
} | undefined;
|
|
84
|
+
readonly containment?: "none" | undefined;
|
|
83
85
|
readonly executor?: {
|
|
84
86
|
readonly connectionId: string;
|
|
85
87
|
readonly effort?: "high" | "low" | "max" | "medium" | "ultra" | "xhigh" | undefined;
|
|
@@ -90,6 +92,12 @@ export declare const makeSessionListView: (target: PortfolioProject, emit: (stat
|
|
|
90
92
|
readonly code: string;
|
|
91
93
|
readonly message: string;
|
|
92
94
|
} | undefined;
|
|
95
|
+
readonly labels?: {
|
|
96
|
+
readonly [x: string]: string;
|
|
97
|
+
} | undefined;
|
|
98
|
+
readonly latestTurnId?: string | undefined;
|
|
99
|
+
readonly latestTurnState?: "completed" | "dispatching" | "failed" | "interrupted" | "outcome-unknown" | "queued" | "running" | undefined;
|
|
100
|
+
readonly permission?: "acceptEdits" | "bypassPermissions" | "default" | "dontAsk" | "never" | "on-request" | "plan" | "untrusted" | undefined;
|
|
93
101
|
readonly schemaVersion: 4;
|
|
94
102
|
readonly title?: string | undefined;
|
|
95
103
|
readonly worktree?: {
|
|
@@ -43,6 +43,8 @@ export type SessionViewState = {
|
|
|
43
43
|
readonly observedAt?: number;
|
|
44
44
|
/** An interrupt prepared for confirmation, bound to one turn revision. */
|
|
45
45
|
readonly pendingInterrupt?: TurnInterruptParameters;
|
|
46
|
+
/** The oldest cursor the Node still holds, when it pruned earlier history. */
|
|
47
|
+
readonly prunedBefore?: string;
|
|
46
48
|
readonly session?: Session;
|
|
47
49
|
readonly source: TimelineSource["kind"];
|
|
48
50
|
readonly turns: readonly TimelineTurn[];
|
|
@@ -38,14 +38,17 @@ const readDiff = (context, session) => session.worktree === undefined
|
|
|
38
38
|
}),
|
|
39
39
|
onSuccess: (diff) => ({ diffError: _error, ...state }) => ({ ...state, diff }),
|
|
40
40
|
}), Effect.flatMap((change) => SubscriptionRef.update(context.ref, change)));
|
|
41
|
+
/** A fresh read replaces the turns and the pruned marker, and clears an error. */
|
|
42
|
+
const withTimeline = (session, { prunedBefore, turns }) => ({ error: _error, prunedBefore: _pruned, ...state }) => ({
|
|
43
|
+
...state,
|
|
44
|
+
...(prunedBefore === undefined ? {} : { prunedBefore }),
|
|
45
|
+
session,
|
|
46
|
+
turns,
|
|
47
|
+
});
|
|
41
48
|
const refresh = (context) => Effect.gen(function* () {
|
|
42
49
|
const shown = yield* read("session.show", (options) => context.client.showSession({ sessionId: context.sessionId }, options));
|
|
43
|
-
const
|
|
44
|
-
yield* SubscriptionRef.update(context.ref, (
|
|
45
|
-
...state,
|
|
46
|
-
session: shown.session,
|
|
47
|
-
turns,
|
|
48
|
-
}));
|
|
50
|
+
const loaded = yield* context.timeline.load(context.sessionId);
|
|
51
|
+
yield* SubscriptionRef.update(context.ref, withTimeline(shown.session, loaded));
|
|
49
52
|
yield* observed(context);
|
|
50
53
|
yield* Effect.all([
|
|
51
54
|
readDiff(context, shown.session),
|
|
@@ -20,7 +20,16 @@ export type TimelineTurn = {
|
|
|
20
20
|
*/
|
|
21
21
|
export type TimelineSource = {
|
|
22
22
|
readonly kind: "final-text";
|
|
23
|
-
readonly load: (sessionId: string) => Effect.Effect<
|
|
23
|
+
readonly load: (sessionId: string) => Effect.Effect<TimelineLoad, CockpitError>;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* The recent turns and, when the Node pruned older events, the oldest cursor
|
|
27
|
+
* it still holds. The detail has no older-page load, so the read from cursor 0
|
|
28
|
+
* is the one place a hole can show.
|
|
29
|
+
*/
|
|
30
|
+
export type TimelineLoad = {
|
|
31
|
+
readonly prunedBefore?: string;
|
|
32
|
+
readonly turns: readonly TimelineTurn[];
|
|
24
33
|
};
|
|
25
34
|
/** The most recent turns a detail shows; older ones stay on the Node. */
|
|
26
35
|
export declare const MAX_TIMELINE_TURNS = 20;
|
|
@@ -14,6 +14,9 @@ const eventPage = (client, sessionId, after) => read("session.events.list", (opt
|
|
|
14
14
|
...(result.nextSessionCursor === undefined
|
|
15
15
|
? {}
|
|
16
16
|
: { next: result.nextSessionCursor }),
|
|
17
|
+
...(result.oldestRetainedCursor === undefined
|
|
18
|
+
? {}
|
|
19
|
+
: { oldest: result.oldestRetainedCursor }),
|
|
17
20
|
})));
|
|
18
21
|
/** Reads the last `EVENT_WINDOW` events, never the whole history. */
|
|
19
22
|
const recentEvents = (client, sessionId) => Effect.gen(function* () {
|
|
@@ -22,9 +25,11 @@ const recentEvents = (client, sessionId) => Effect.gen(function* () {
|
|
|
22
25
|
const collect = (after, seen) => Effect.flatMap(eventPage(client, sessionId, after), (page) => page.next === undefined || page.items.length === 0
|
|
23
26
|
? Effect.succeed([...seen, ...page.items])
|
|
24
27
|
: collect(page.next, [...seen, ...page.items]));
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
const events = from <= 0n ? yield* collect("0", []) : yield* collect(String(from), []);
|
|
29
|
+
return {
|
|
30
|
+
events,
|
|
31
|
+
...(probe.oldest === undefined ? {} : { oldest: probe.oldest }),
|
|
32
|
+
};
|
|
28
33
|
});
|
|
29
34
|
const toTimeline = (turn) => ({
|
|
30
35
|
...("failureReason" in turn ? { failureReason: turn.failureReason } : {}),
|
|
@@ -38,6 +43,9 @@ const toTimeline = (turn) => ({
|
|
|
38
43
|
/** The final-text source over `session.events.list` and `turn.show`. */
|
|
39
44
|
export const finalTextTimeline = (client) => ({
|
|
40
45
|
kind: "final-text",
|
|
41
|
-
load: (sessionId) => recentEvents(client, sessionId).pipe(Effect.
|
|
46
|
+
load: (sessionId) => recentEvents(client, sessionId).pipe(Effect.flatMap(({ events, oldest }) => Effect.forEach([...new Set(events.flatMap((event) => turnIdOf(event) ?? []))].slice(-MAX_TIMELINE_TURNS), (turnId) => read("turn.show", (options) => client.showTurn({ turnId }, options)).pipe(Effect.map((result) => toTimeline(result.turn))), { concurrency: 4 }).pipe(Effect.map((turns) => ({
|
|
47
|
+
...(oldest === undefined ? {} : { prunedBefore: oldest }),
|
|
48
|
+
turns,
|
|
49
|
+
}))))),
|
|
42
50
|
});
|
|
43
51
|
//# sourceMappingURL=timeline.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maiaos/client-core",
|
|
3
|
-
"version": "0.1.0-canary.
|
|
3
|
+
"version": "0.1.0-canary.50",
|
|
4
4
|
"description": "Platform-neutral client use cases for Maia OS: Effect services between a client's renderer and the SDK, so every client reads Maia Node state and sends requests the same way.",
|
|
5
5
|
"homepage": "https://github.com/vllnt/maia/tree/main/packages/client-core#readme",
|
|
6
6
|
"bugs": "https://github.com/vllnt/maia/issues",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"node": "24.22.1"
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
|
-
"@maiaos/sdk": "0.1.0-canary.
|
|
97
|
+
"@maiaos/sdk": "0.1.0-canary.50",
|
|
98
98
|
"effect": "4.0.0"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|