feat(tess): wire durable interaction surfaces (#732)
This commit was merged in pull request #732.
This commit is contained in:
@@ -10,6 +10,7 @@ describe('generic interaction CLI', (): void => {
|
||||
expect(command.commands.map((item) => item.name()).sort()).toEqual([
|
||||
'attach',
|
||||
'chat',
|
||||
'enroll',
|
||||
'health',
|
||||
'recover',
|
||||
'send',
|
||||
|
||||
@@ -3,6 +3,7 @@ import type { Command } from 'commander';
|
||||
import { withAuth } from './with-auth.js';
|
||||
import {
|
||||
attachInteractionSession,
|
||||
enrollInteractionSession,
|
||||
fetchInteractionHealth,
|
||||
fetchInteractionSessions,
|
||||
fetchInteractionStatus,
|
||||
@@ -10,6 +11,7 @@ import {
|
||||
recoverInteractionSession,
|
||||
sendInteractionMessage,
|
||||
stopInteractionSession,
|
||||
streamInteractionSession,
|
||||
} from '../tui/gateway-api.js';
|
||||
|
||||
interface InteractionOptions {
|
||||
@@ -103,18 +105,48 @@ export function registerInteractionCommand(program: Command): Command {
|
||||
});
|
||||
|
||||
options(
|
||||
command.command('attach <sessionId>').description('Create a scoped read or write attachment'),
|
||||
command
|
||||
.command('enroll <sessionId> <provider> <runtimeSessionId>')
|
||||
.description('Bind an authorized runtime session to a durable conversation handle'),
|
||||
).action(
|
||||
async (
|
||||
sessionId: string,
|
||||
providerId: string,
|
||||
runtimeSessionId: string,
|
||||
opts: InteractionOptions,
|
||||
) => {
|
||||
const request = await authRequest(opts);
|
||||
print(
|
||||
await enrollInteractionSession(request.gateway, request.cookie, {
|
||||
...request,
|
||||
sessionId,
|
||||
providerId,
|
||||
runtimeSessionId,
|
||||
}),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
options(
|
||||
command
|
||||
.command('attach <sessionId>')
|
||||
.description('Create a scoped read or write attachment and stream the session'),
|
||||
)
|
||||
.option('--control', 'Request control mode (provider policy may deny it)')
|
||||
.action(async (sessionId: string, opts: InteractionOptions & { control?: boolean }) => {
|
||||
const request = await authRequest(opts);
|
||||
print(
|
||||
await attachInteractionSession(request.gateway, request.cookie, {
|
||||
...request,
|
||||
sessionId,
|
||||
mode: opts.control ? 'control' : 'read',
|
||||
}),
|
||||
);
|
||||
const attachment = await attachInteractionSession(request.gateway, request.cookie, {
|
||||
...request,
|
||||
sessionId,
|
||||
mode: opts.control ? 'control' : 'read',
|
||||
});
|
||||
print(attachment);
|
||||
for await (const event of streamInteractionSession(request.gateway, request.cookie, {
|
||||
...request,
|
||||
sessionId,
|
||||
})) {
|
||||
print(event);
|
||||
}
|
||||
});
|
||||
|
||||
const send = options(
|
||||
|
||||
Reference in New Issue
Block a user