agent-office 0.2.3 → 0.2.4

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.
@@ -24,9 +24,10 @@ export interface AgentMode {
24
24
  export interface AgenticCodingServer {
25
25
  /**
26
26
  * Create a new session.
27
+ * @param title display title shown in the OpenCode UI.
27
28
  * @returns the server-assigned session ID.
28
29
  */
29
- createSession(): Promise<string>;
30
+ createSession(title: string): Promise<string>;
30
31
  /**
31
32
  * Permanently delete a session.
32
33
  */
@@ -2,7 +2,7 @@ import type { AgenticCodingServer, SessionMessage, AgentMode } from "./agentic-c
2
2
  export declare class OpenCodeCodingServer implements AgenticCodingServer {
3
3
  private client;
4
4
  constructor(baseURL: string);
5
- createSession(): Promise<string>;
5
+ createSession(title: string): Promise<string>;
6
6
  deleteSession(sessionID: string): Promise<void>;
7
7
  sendMessage(sessionID: string, text: string, agent: string, system: string): Promise<void>;
8
8
  getMessages(sessionID: string, limit?: number): Promise<SessionMessage[]>;
@@ -9,8 +9,8 @@ export class OpenCodeCodingServer {
9
9
  constructor(baseURL) {
10
10
  this.client = createOpencodeClient({ baseUrl: baseURL, directory: cwd() });
11
11
  }
12
- async createSession() {
13
- const { data: session } = await this.client.session.create();
12
+ async createSession(title) {
13
+ const { data: session } = await this.client.session.create({ title });
14
14
  if (!session)
15
15
  throw new Error("OpenCode returned no session");
16
16
  return session.id;
@@ -632,6 +632,7 @@ export function SessionList({ serverUrl, password, contentHeight, onSubViewChang
632
632
  setMode("browse");
633
633
  setActionError(null);
634
634
  setActionMsg(null);
635
+ reload();
635
636
  }
636
637
  });
637
638
  const handleCreate = async (name) => {
@@ -732,7 +733,7 @@ export function SessionList({ serverUrl, password, contentHeight, onSubViewChang
732
733
  setMode("reverting");
733
734
  try {
734
735
  await revertToStart(target.name);
735
- setActionMsg(`Session "${target.name}" reverted to first message and restarted.`);
736
+ setActionMsg(`Session "${target.name}" reset to a fresh session.`);
736
737
  setMode("create-done");
737
738
  reload();
738
739
  }
@@ -751,7 +752,7 @@ export function SessionList({ serverUrl, password, contentHeight, onSubViewChang
751
752
  const result = await revertAll();
752
753
  const failed = result.results.filter((r) => !r.ok);
753
754
  if (failed.length === 0) {
754
- setActionMsg(`All ${result.total} session(s) reverted and restarted.`);
755
+ setActionMsg(`All ${result.total} session(s) reset to fresh sessions.`);
755
756
  }
756
757
  else {
757
758
  setActionMsg(`Reverted ${result.total - failed.length}/${result.total} sessions. Failed: ${failed.map((f) => f.name).join(", ")}`);
@@ -191,7 +191,7 @@ export function createRouter(sql, agenticCodingServer, serverUrl, scheduler, mem
191
191
  }
192
192
  let opencodeSessionId;
193
193
  try {
194
- opencodeSessionId = await agenticCodingServer.createSession();
194
+ opencodeSessionId = await agenticCodingServer.createSession(`agent-office: ${trimmedName} ${new Date().toISOString()}`);
195
195
  }
196
196
  catch (err) {
197
197
  console.error("OpenCode session.create error:", err);
@@ -355,7 +355,7 @@ export function createRouter(sql, agenticCodingServer, serverUrl, scheduler, mem
355
355
  try {
356
356
  // Delete the old OpenCode session and create a fresh one
357
357
  await agenticCodingServer.deleteSession(session.session_id);
358
- const newSessionId = await agenticCodingServer.createSession();
358
+ const newSessionId = await agenticCodingServer.createSession(`agent-office: ${name} ${new Date().toISOString()}`);
359
359
  await sql `
360
360
  UPDATE sessions SET session_id = ${newSessionId} WHERE name = ${name}
361
361
  `;
@@ -375,7 +375,7 @@ export function createRouter(sql, agenticCodingServer, serverUrl, scheduler, mem
375
375
  try {
376
376
  // Delete the old OpenCode session and create a fresh one
377
377
  await agenticCodingServer.deleteSession(session.session_id);
378
- const newSessionId = await agenticCodingServer.createSession();
378
+ const newSessionId = await agenticCodingServer.createSession(`agent-office: ${session.name} ${new Date().toISOString()}`);
379
379
  await sql `
380
380
  UPDATE sessions SET session_id = ${newSessionId} WHERE name = ${session.name}
381
381
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-office",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "An office for your AI agents",
5
5
  "type": "module",
6
6
  "license": "MIT",