Skip to content

Commit fa01353

Browse files
Simplify the start method since the config is public
1 parent d4608a6 commit fa01353

File tree

6 files changed

+24
-22
lines changed

6 files changed

+24
-22
lines changed

packages/lib/examples/echo-agent.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,13 @@ agent.onExecution(async (context) => {
6868

6969
// Start the agent
7070
try {
71-
const startInfo = await agent.start();
72-
logger.info("Echo agent started", startInfo || {});
71+
await agent.start();
72+
logger.info("Echo agent started", {
73+
runtimeId: agent.config.runtimeId,
74+
runtimeType: agent.config.runtimeType,
75+
notebookId: agent.config.notebookId,
76+
sessionId: agent.config.sessionId,
77+
});
7378

7479
await agent.keepAlive();
7580
} catch (error) {

packages/lib/examples/enhanced-output-example.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ExamplePythonRuntime {
3939
}
4040

4141
async start() {
42-
return await this.agent.start();
42+
await this.agent.start();
4343
}
4444

4545
async shutdown() {

packages/lib/examples/streaming-demo.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,10 @@ class StreamingDemoAgent {
3737
}
3838

3939
async start() {
40-
const result = await this.agent.start();
40+
await this.agent.start();
4141

4242
// Auto-create help cell if notebook is empty
4343
this.createHelpCellIfEmpty();
44-
45-
return result;
4644
}
4745

4846
async shutdown() {
@@ -56,7 +54,7 @@ class StreamingDemoAgent {
5654
private createHelpCellIfEmpty() {
5755
try {
5856
// Check if there are any existing cells using LiveStore query
59-
const cells = this.agent.liveStore.query(
57+
const cells = this.agent.store.query(
6058
tables.cells.select(),
6159
);
6260

@@ -65,23 +63,23 @@ class StreamingDemoAgent {
6563

6664
// Create a cell with help command
6765
const cellId = crypto.randomUUID();
68-
this.agent.liveStore.commit(events.cellCreated({
66+
this.agent.store.commit(events.cellCreated({
6967
id: cellId,
7068
cellType: "code",
7169
position: 0,
7270
createdBy: "streaming-demo-runtime",
7371
}));
7472

7573
// Update the cell with source content
76-
this.agent.liveStore.commit(events.cellSourceChanged({
74+
this.agent.store.commit(events.cellSourceChanged({
7775
id: cellId,
7876
source: "help",
7977
modifiedBy: "streaming-demo-runtime",
8078
}));
8179

8280
// Queue it for execution
8381
const queueId = crypto.randomUUID();
84-
this.agent.liveStore.commit(events.executionRequested({
82+
this.agent.store.commit(events.executionRequested({
8583
queueId: queueId,
8684
cellId: cellId,
8785
executionCount: 1,

packages/lib/src/runtime-agent.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class RuntimeAgent {
4545
/**
4646
* Start the runtime agent - connects to LiveStore and begins processing
4747
*/
48-
async start(): Promise<Record<string, unknown> | void> {
48+
async start(): Promise<void> {
4949
try {
5050
await this.handlers.onStartup?.(this.config.environmentOptions);
5151

@@ -119,14 +119,7 @@ export class RuntimeAgent {
119119
// Set up shutdown handlers
120120
this.setupShutdownHandlers();
121121

122-
// Return startup info for logging
123-
return {
124-
runtimeId: this.config.runtimeId,
125-
runtimeType: this.config.runtimeType,
126-
notebookId: this.config.notebookId,
127-
sessionId: this.config.sessionId,
128-
syncUrl: this.config.syncUrl,
129-
};
122+
// No return value
130123
} catch (error) {
131124
const logger = createLogger(`${this.config.runtimeType}-agent`);
132125
logger.error("Failed to start runtime agent", error);

packages/lib/src/runtime-runner.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ export async function runner(agent: RuntimeAgent, name: string) {
1010

1111
try {
1212
await agent.start();
13-
logger.info(`${name} started`);
13+
logger.info(`${name} started`, {
14+
runtimeId: agent.config.runtimeId,
15+
runtimeType: agent.config.runtimeType,
16+
notebookId: agent.config.notebookId,
17+
sessionId: agent.config.sessionId,
18+
syncUrl: agent.config.syncUrl,
19+
});
1420

1521
await agent.keepAlive();
1622
} catch (error) {

packages/pyodide-runtime-agent/src/pyodide-agent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export class PyodideRuntimeAgent extends RuntimeAgent {
112112
/**
113113
* Start the Pyodide runtime agent
114114
*/
115-
override async start(): Promise<Record<string, unknown> | void> {
115+
override async start(): Promise<void> {
116116
this.logger.info("Starting Pyodide Python runtime agent");
117117

118118
// Discover available AI models if enabled
@@ -138,7 +138,7 @@ export class PyodideRuntimeAgent extends RuntimeAgent {
138138
}
139139
}
140140

141-
return super.start();
141+
await super.start();
142142
}
143143

144144
/**

0 commit comments

Comments
 (0)