Merge branch 'worktree/process-plugin-streaming-72f9b3' into worktree/job-kill-delivery
# Conflicts: # docs/module-graph.i18n.yaml # docs/module-graph.md # docs/module-graph.zh.md # packages/shell/bash-sandbox/tests/sandbox.spec.ts # packages/shell/tool-pwsh/tests/tools.spec.ts
This commit is contained in:
commit
02ef5e408f
504 files changed
+7933
-3203
No files matched your search
@@ -22,15 +22,13 @@ export class SessionControlController {
|
||||
/** @param ctx - Host context carrying live Agent, projection, and jobs services. */
|
||||
constructor(private readonly ctx: Context) {
|
||||
ctx.on('session/event', (session, event) => { this.onSessionEvent(session, event) })
|
||||
ctx.inject(['sessionProjections'], (projectionCtx) => {
|
||||
projectionCtx.sessionProjections.onChanged((session, key, value, seq) => {
|
||||
this.broadcast({
|
||||
type: 'projection',
|
||||
sessionId: session.id,
|
||||
key,
|
||||
value: value as JsonValue,
|
||||
seq,
|
||||
})
|
||||
ctx.sessionProjections.onChanged((session, key, value, seq) => {
|
||||
this.broadcast({
|
||||
type: 'projection',
|
||||
sessionId: session.id,
|
||||
key,
|
||||
value: value as JsonValue,
|
||||
seq,
|
||||
})
|
||||
})
|
||||
ctx.inject(['jobs'], (jobsCtx) => {
|
||||
@@ -83,17 +81,14 @@ export class SessionControlController {
|
||||
private projectionBaseline(
|
||||
sessions: readonly Session[],
|
||||
): Readonly<Record<SessionId, SessionProjectionBaseline>> {
|
||||
const registry = this.ctx.get('sessionProjections')
|
||||
const blocks = Object.create(null) as Record<SessionId, SessionProjectionBaseline>
|
||||
for (const session of sessions) {
|
||||
const snapshot = registry?.snapshot(session)
|
||||
blocks[session.id] = snapshot === undefined
|
||||
? { asOfSeq: session.seq - 1, values: {} }
|
||||
: {
|
||||
asOfSeq: snapshot.asOfSeq,
|
||||
// Every projection definition validates its value before snapshot publication.
|
||||
values: snapshot.values as SessionProjectionValues,
|
||||
}
|
||||
const snapshot = this.ctx.sessionProjections.snapshot(session)
|
||||
blocks[session.id] = {
|
||||
asOfSeq: snapshot.asOfSeq,
|
||||
// Every projection definition validates its value before snapshot publication.
|
||||
values: snapshot.values as SessionProjectionValues,
|
||||
}
|
||||
}
|
||||
return blocks
|
||||
}
|
||||
|
||||
@@ -87,25 +87,23 @@ export class ApiSessionList {
|
||||
private readonly ctx: Context,
|
||||
private readonly coldBlankProbeMaxBytes: number,
|
||||
) {
|
||||
ctx.inject(['sessionProjections'], (projectionCtx) => {
|
||||
projectionCtx.sessionProjections.register<'sessionListMetadata', SessionListMetadata>({
|
||||
key: 'sessionListMetadata',
|
||||
stateSchema: sessionListMetadataSchema,
|
||||
init: () => ({ blank: true, lastPromptAt: null }),
|
||||
apply: applySessionListMetadata,
|
||||
wire: { viewSchema: sessionListMetadataSchema, view: state => state },
|
||||
stateVersion: 1,
|
||||
})
|
||||
ctx.sessionProjections.register<'sessionListMetadata', SessionListMetadata>({
|
||||
key: 'sessionListMetadata',
|
||||
stateSchema: sessionListMetadataSchema,
|
||||
init: () => ({ blank: true, lastPromptAt: null }),
|
||||
apply: applySessionListMetadata,
|
||||
wire: { viewSchema: sessionListMetadataSchema, view: state => state },
|
||||
stateVersion: 1,
|
||||
})
|
||||
ctx.inject(['sessionProjections', 'attachments'], (projectionCtx) => {
|
||||
projectionCtx.sessionProjections.register<'imageLimits', null>({
|
||||
ctx.inject(['attachments'], (attachmentCtx) => {
|
||||
ctx.sessionProjections.register<'imageLimits', null>({
|
||||
key: 'imageLimits',
|
||||
stateSchema: z.null(),
|
||||
init: () => null,
|
||||
apply: state => state,
|
||||
wire: {
|
||||
viewSchema: imageLimitsSchema,
|
||||
view: () => projectionCtx.attachments.imageLimits,
|
||||
view: () => attachmentCtx.attachments.imageLimits,
|
||||
},
|
||||
stateVersion: 1,
|
||||
})
|
||||
@@ -332,7 +330,7 @@ export class ApiSessionList {
|
||||
try {
|
||||
const block = session === undefined
|
||||
? this.ctx.get('sessionProjectionCache')?.cachedSnapshot(header)
|
||||
: this.ctx.get('sessionProjections')?.cachedSnapshot(session)
|
||||
: this.ctx.sessionProjections.cachedSnapshot(session)
|
||||
return block !== undefined && Object.keys(block.values).length > 0
|
||||
? {
|
||||
asOfSeq: block.asOfSeq,
|
||||
|
||||
Reference in new issue
Block a user