@almyty/acp-server 1.0.12 → 1.0.14

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.
package/dist/agent.js CHANGED
@@ -310,11 +310,11 @@ export class AlmytyAcpAgent {
310
310
  run = await this.proxy.sendRunInput(session.agentId, session.activeRunId, { message: input });
311
311
  }
312
312
  else {
313
- // Start a new run
314
- run = await this.proxy.startRun(session.agentId, { message: input });
313
+ // Start a new run, reusing the session's conversation for history
314
+ run = await this.proxy.startRun(session.agentId, { message: input }, session.conversationId);
315
315
  this.sessions.update(session.id, {
316
316
  activeRunId: run.id,
317
- conversationId: run.conversationId,
317
+ conversationId: run.conversationId || session.conversationId,
318
318
  });
319
319
  }
320
320
  process.stderr.write(`[acp] Run started: ${run.id} (status: ${run.status})\n`);
@@ -378,19 +378,20 @@ export class AlmytyAcpAgent {
378
378
  if (finalRun.status === 'running') {
379
379
  process.stderr.write(`[acp] Run still running after stream ended, polling...\n`);
380
380
  finalRun = await this.pollRunToCompletion(session.agentId, run.id, signal);
381
- if (finalRun.output) {
382
- const text = typeof finalRun.output === 'string'
383
- ? finalRun.output
384
- : JSON.stringify(finalRun.output, null, 2);
385
- if (!collectedText.includes(text)) {
386
- collectedText.push(text);
387
- this.sendSessionUpdate(session.id, { type: 'agent_message_chunk', text });
388
- }
389
- }
390
- if (finalRun.error) {
391
- const errText = typeof finalRun.error === 'string'
392
- ? finalRun.error
393
- : JSON.stringify(finalRun.error);
381
+ }
382
+ // Send output if streaming didn't capture it
383
+ if (collectedText.length === 0 && finalRun.output) {
384
+ const text = typeof finalRun.output === 'string'
385
+ ? finalRun.output
386
+ : JSON.stringify(finalRun.output, null, 2);
387
+ collectedText.push(text);
388
+ this.sendSessionUpdate(session.id, { type: 'agent_message_chunk', text });
389
+ }
390
+ if (finalRun.error) {
391
+ const errText = typeof finalRun.error === 'string'
392
+ ? finalRun.error
393
+ : JSON.stringify(finalRun.error);
394
+ if (!collectedText.includes(`Error: ${errText}`)) {
394
395
  collectedText.push(`Error: ${errText}`);
395
396
  }
396
397
  }
package/dist/auth.d.ts CHANGED
@@ -1,22 +1,6 @@
1
1
  /**
2
- * Credential resolver for @almyty/acp-server.
3
- *
4
- * Reads the shared credential store written by `npx @almyty/auth login`.
5
- * Lookup order: ALMYTY_TOKEN env var, then ~/.almyty/credentials.json.
2
+ * Thin re-export from the shared @almyty/client credential resolver.
3
+ * Keeps `./auth.js` imports working across the acp-server codebase.
6
4
  */
7
- interface StoredCredentials {
8
- url: string;
9
- token: string;
10
- email?: string;
11
- frontendUrl?: string;
12
- }
13
- export declare function loadCredentials(): StoredCredentials | null;
14
- /**
15
- * Resolve token: env var > stored credentials. Returns null when no
16
- * credentials are available.
17
- */
18
- export declare function resolveCredentials(): {
19
- url: string;
20
- token: string;
21
- } | null;
22
- export {};
5
+ export { resolveCredentials, resolveCredentialsOrExit, loadCredentials, CREDENTIALS_FILE, } from '@almyty/client';
6
+ export type { StoredCredentials } from '@almyty/client';
package/dist/auth.js CHANGED
@@ -1,36 +1,5 @@
1
1
  /**
2
- * Credential resolver for @almyty/acp-server.
3
- *
4
- * Reads the shared credential store written by `npx @almyty/auth login`.
5
- * Lookup order: ALMYTY_TOKEN env var, then ~/.almyty/credentials.json.
2
+ * Thin re-export from the shared @almyty/client credential resolver.
3
+ * Keeps `./auth.js` imports working across the acp-server codebase.
6
4
  */
7
- import { readFileSync, existsSync } from 'node:fs';
8
- import { homedir } from 'node:os';
9
- import { join } from 'node:path';
10
- const CREDENTIALS_FILE = join(homedir(), '.almyty', 'credentials.json');
11
- export function loadCredentials() {
12
- try {
13
- if (!existsSync(CREDENTIALS_FILE))
14
- return null;
15
- return JSON.parse(readFileSync(CREDENTIALS_FILE, 'utf-8'));
16
- }
17
- catch {
18
- return null;
19
- }
20
- }
21
- /**
22
- * Resolve token: env var > stored credentials. Returns null when no
23
- * credentials are available.
24
- */
25
- export function resolveCredentials() {
26
- const envToken = process.env.ALMYTY_TOKEN;
27
- const envUrl = process.env.ALMYTY_URL || 'https://api.almyty.com';
28
- if (envToken) {
29
- return { url: envUrl, token: envToken };
30
- }
31
- const creds = loadCredentials();
32
- if (creds?.token) {
33
- return { url: creds.url, token: creds.token };
34
- }
35
- return null;
36
- }
5
+ export { resolveCredentials, resolveCredentialsOrExit, loadCredentials, CREDENTIALS_FILE, } from '@almyty/client';
package/dist/proxy.d.ts CHANGED
@@ -50,7 +50,7 @@ export declare class AlmytyProxy {
50
50
  * iterator; aborting the signal will terminate the stream.
51
51
  */
52
52
  streamAgent(id: string, input: Record<string, unknown>, signal?: AbortSignal): AsyncGenerator<StreamEvent>;
53
- startRun(id: string, input: Record<string, unknown>): Promise<AgentRun>;
53
+ startRun(id: string, input: Record<string, unknown>, conversationId?: string): Promise<AgentRun>;
54
54
  getRun(agentId: string, runId: string): Promise<AgentRun>;
55
55
  sendRunInput(agentId: string, runId: string, input: Record<string, unknown>): Promise<AgentRun>;
56
56
  cancelRun(agentId: string, runId: string): Promise<void>;
package/dist/proxy.js CHANGED
@@ -40,8 +40,11 @@ export class AlmytyProxy {
40
40
  yield* this.ssePost(`/agents/${encodeURIComponent(id)}/stream`, input, signal);
41
41
  }
42
42
  // ── Autonomous run management ──────────────────────────────────
43
- async startRun(id, input) {
44
- const data = await this.post(`/agents/${encodeURIComponent(id)}/runs`, { input }, INVOKE_TIMEOUT_MS);
43
+ async startRun(id, input, conversationId) {
44
+ const body = { input };
45
+ if (conversationId)
46
+ body.conversationId = conversationId;
47
+ const data = await this.post(`/agents/${encodeURIComponent(id)}/runs`, body, INVOKE_TIMEOUT_MS);
45
48
  return data?.data || data;
46
49
  }
47
50
  async getRun(agentId, runId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almyty/acp-server",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "ACP agent server for almyty — expose any almyty agent via the Agent Client Protocol",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -28,6 +28,7 @@
28
28
  "author": "almyty",
29
29
  "license": "BSL-1.1",
30
30
  "dependencies": {
31
+ "@almyty/client": "file:../client",
31
32
  "eventsource-parser": "^3.0.0"
32
33
  },
33
34
  "devDependencies": {