@orchagent/cli 0.3.49 → 0.3.52

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/lib/api.js CHANGED
@@ -32,6 +32,9 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
35
38
  Object.defineProperty(exports, "__esModule", { value: true });
36
39
  exports.ApiError = void 0;
37
40
  exports.safeFetch = safeFetch;
@@ -61,7 +64,11 @@ exports.deleteEnvironment = deleteEnvironment;
61
64
  exports.setWorkspaceDefaultEnvironment = setWorkspaceDefaultEnvironment;
62
65
  exports.getCreditsBalance = getCreditsBalance;
63
66
  exports.createCreditCheckout = createCreditCheckout;
67
+ exports.listAgentKeys = listAgentKeys;
68
+ exports.createAgentKey = createAgentKey;
69
+ exports.deleteAgentKey = deleteAgentKey;
64
70
  const errors_1 = require("./errors");
71
+ const package_json_1 = __importDefault(require("../../package.json"));
65
72
  const DEFAULT_TIMEOUT_MS = 15000;
66
73
  const CALL_TIMEOUT_MS = 120000; // 2 minutes for agent calls (can take time)
67
74
  const MAX_RETRIES = 3;
@@ -192,6 +199,7 @@ async function request(config, method, path, options = {}) {
192
199
  method,
193
200
  headers: {
194
201
  Authorization: `Bearer ${config.apiKey}`,
202
+ 'X-CLI-Version': package_json_1.default.version,
195
203
  ...(options.headers ?? {}),
196
204
  },
197
205
  body: options.body,
@@ -430,3 +438,12 @@ async function createCreditCheckout(config, amountCents) {
430
438
  headers: { 'Content-Type': 'application/json' },
431
439
  });
432
440
  }
441
+ async function listAgentKeys(config, agentId) {
442
+ return request(config, 'GET', `/agents/${agentId}/keys`);
443
+ }
444
+ async function createAgentKey(config, agentId) {
445
+ return request(config, 'POST', `/agents/${agentId}/keys`);
446
+ }
447
+ async function deleteAgentKey(config, agentId, keyId) {
448
+ return request(config, 'DELETE', `/agents/${agentId}/keys/${keyId}`);
449
+ }
@@ -44,6 +44,7 @@ const api_1 = require("./api");
44
44
  class CliError extends Error {
45
45
  exitCode;
46
46
  cause;
47
+ responseBody;
47
48
  constructor(message, exitCode = 1) {
48
49
  super(message);
49
50
  this.exitCode = exitCode;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ /**
3
+ * Minimal SSE (Server-Sent Events) parser for ReadableStream<Uint8Array>.
4
+ *
5
+ * Parses an SSE byte stream into typed event objects. No external dependencies.
6
+ * Works with Node 18+ native fetch ReadableStream.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.parseSSE = parseSSE;
10
+ async function* parseSSE(stream) {
11
+ const decoder = new TextDecoder();
12
+ const reader = stream.getReader();
13
+ let buffer = '';
14
+ try {
15
+ while (true) {
16
+ const { done, value } = await reader.read();
17
+ if (done)
18
+ break;
19
+ buffer += decoder.decode(value, { stream: true });
20
+ const parts = buffer.split('\n\n');
21
+ buffer = parts.pop();
22
+ for (const part of parts) {
23
+ if (!part.trim())
24
+ continue;
25
+ let event = 'message';
26
+ let data = '';
27
+ for (const line of part.split('\n')) {
28
+ if (line.startsWith('event: '))
29
+ event = line.slice(7);
30
+ else if (line.startsWith('data: '))
31
+ data += (data ? '\n' : '') + line.slice(6);
32
+ }
33
+ if (data)
34
+ yield { event, data };
35
+ }
36
+ }
37
+ }
38
+ finally {
39
+ reader.releaseLock();
40
+ }
41
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orchagent/cli",
3
- "version": "0.3.49",
3
+ "version": "0.3.52",
4
4
  "description": "Command-line interface for orchagent — deploy and run AI agents for your team",
5
5
  "license": "MIT",
6
6
  "author": "orchagent <hello@orchagent.io>",
@@ -28,7 +28,8 @@
28
28
  "orch": "dist/index.js"
29
29
  },
30
30
  "files": [
31
- "dist"
31
+ "dist",
32
+ "src/resources"
32
33
  ],
33
34
  "scripts": {
34
35
  "build": "tsc -p tsconfig.json",