feat(goal): add TypeRT gateway example

This commit is contained in:
imccyu
2026-08-06 15:28:54 +08:00
parent 61c2c15dc4
commit 9400926bdf
36 changed files with 809 additions and 155 deletions

View File

@@ -23,6 +23,14 @@
"types": "./lib/types/client.d.ts",
"default": "./lib/types/client.js"
},
"./typert": {
"types": "./lib/typert.host.d.ts",
"default": "./lib/typert.host.js"
},
"./remote": {
"types": "./lib/typert.remote-client.d.ts",
"default": "./lib/typert.remote-client.js"
},
"./src/*": "./src/*",
"./package.json": "./package.json"
},
@@ -30,7 +38,13 @@
"lib/index.js",
"lib/invariant.js",
"lib/types/**/*.js",
"lib/types/**/*.d.ts"
"lib/types/**/*.d.ts",
"lib/typert.host.js",
"lib/typert.host.d.ts",
"lib/typert.remote-client.js",
"lib/typert.remote-client.d.ts",
"lib/typert.remote-client.d.ts.map",
"src"
],
"license": "BSD-3-Clause",
"peerDependencies": {
@@ -41,6 +55,7 @@
"@deepseek-ai/dsh-llm": "^0.0.1",
"@deepseek-ai/dsh-scope": "^0.0.1",
"@deepseek-ai/dsh-session": "^0.0.1",
"@deepseek-ai/dsh-type-meta": "^0.0.1",
"cordis": "^4.0.0-rc.7"
},
"dependencies": {
@@ -56,6 +71,7 @@
"@deepseek-ai/dsh-loader-smoke": "workspace:^",
"@deepseek-ai/dsh-scope": "workspace:^",
"@deepseek-ai/dsh-session": "workspace:^",
"@deepseek-ai/dsh-type-meta": "workspace:^",
"cordis": "^4.0.0-rc.7"
}
}

View File

@@ -12,6 +12,7 @@ import type { ZodType } from 'zod'
import { agentEvents } from '@deepseek-ai/dsh-agent'
import type { Agent } from '@deepseek-ai/dsh-agent'
import type { Session, SessionEvent } from '@deepseek-ai/dsh-session'
import { Remote, bindTypeRTGateway } from '@deepseek-ai/dsh-type-meta'
// Type-only: resolves ctx.sessionProjections for the optional unit child.
import type {} from '@deepseek-ai/dsh-session-projection'
import {
@@ -189,6 +190,9 @@ export class GoalService extends Service {
private readonly resolved: ResolvedConfig
private readonly caches = new WeakMap<Session, GoalCache>()
/** Explicit participation in the TypeRT Gateway under the Cordis service key. */
readonly typertGateway = bindTypeRTGateway(this, 'goals')
constructor(ctx: Context, config: Config = {}) {
super(ctx, 'goals')
this.resolved = {
@@ -576,6 +580,7 @@ export class GoalService extends Service {
* @param request - objective and optional round cap.
* @returns the created Goal identity.
*/
@Remote('create')
remoteExportCreate(agent: Agent, request: CreateGoalRequest): CreateGoalResult {
const view = this.create(agent, request)
return { ref: { id: view.id, revision: view.revision } }
@@ -588,6 +593,7 @@ export class GoalService extends Service {
* @param request - replacement fields.
* @returns the edited Goal view.
*/
@Remote('edit')
remoteExportEdit(agent: Agent, ref: GoalRef, request: EditGoalRequest): GoalView {
return this.edit(agent, ref, request)
}
@@ -598,6 +604,7 @@ export class GoalService extends Service {
* @param ref - expected current revision.
* @returns the paused Goal view.
*/
@Remote('pause')
remoteExportPause(agent: Agent, ref: GoalRef): GoalView {
return this.pause(agent, ref)
}
@@ -608,6 +615,7 @@ export class GoalService extends Service {
* @param ref - expected current revision.
* @returns the resumed Goal view.
*/
@Remote('resume')
remoteExportResume(agent: Agent, ref: GoalRef): GoalView {
return this.resume(agent, ref)
}
@@ -618,6 +626,7 @@ export class GoalService extends Service {
* @param ref - expected current revision.
* @returns the completed Goal view.
*/
@Remote('complete')
remoteExportComplete(agent: Agent, ref: GoalRef): GoalView {
return this.complete(agent, ref)
}
@@ -628,6 +637,7 @@ export class GoalService extends Service {
* @param ref - expected current revision.
* @returns the committed clear revision.
*/
@Remote('clear')
remoteExportClear(agent: Agent, ref: GoalRef): GoalRef {
return this.clear(agent, ref)
}

View File

@@ -35,6 +35,9 @@
{
"path": "../../session-projection/session-projection"
},
{
"path": "../../typert/type-meta"
},
{
"path": "../../support/invariants"
}