intella-cli 0.0.5 → 0.0.7

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.
Files changed (2) hide show
  1. package/bin/intella.js +275 -41
  2. package/package.json +2 -2
package/bin/intella.js CHANGED
@@ -185264,7 +185264,7 @@ var require_lib6 = __commonJS((exports) => {
185264
185264
  // ../../node_modules/@vercel/sandbox/dist/api-client/validators.js
185265
185265
  var require_validators = __commonJS((exports) => {
185266
185266
  Object.defineProperty(exports, "__esModule", { value: true });
185267
- exports.SnapshotResponse = exports.CreateSnapshotResponse = exports.ExtendTimeoutResponse = exports.SandboxesResponse = exports.LogLine = exports.LogError = exports.LogLineStderr = exports.LogLineStdout = exports.EmptyResponse = exports.CommandFinishedResponse = exports.CommandResponse = exports.SandboxAndRoutesResponse = exports.SandboxResponse = exports.Command = exports.Pagination = exports.Snapshot = exports.SandboxRoute = exports.Sandbox = undefined;
185267
+ exports.SnapshotResponse = exports.CreateSnapshotResponse = exports.ExtendTimeoutResponse = exports.SnapshotsResponse = exports.SandboxesResponse = exports.LogLine = exports.LogError = exports.LogLineStderr = exports.LogLineStdout = exports.EmptyResponse = exports.CommandFinishedResponse = exports.CommandResponse = exports.SandboxAndRoutesResponse = exports.SandboxResponse = exports.Command = exports.Pagination = exports.Snapshot = exports.SandboxRoute = exports.Sandbox = undefined;
185268
185268
  var zod_1 = require_lib6();
185269
185269
  exports.Sandbox = zod_1.z.object({
185270
185270
  id: zod_1.z.string(),
@@ -185361,6 +185361,10 @@ var require_validators = __commonJS((exports) => {
185361
185361
  sandboxes: zod_1.z.array(exports.Sandbox),
185362
185362
  pagination: exports.Pagination
185363
185363
  });
185364
+ exports.SnapshotsResponse = zod_1.z.object({
185365
+ snapshots: zod_1.z.array(exports.Snapshot),
185366
+ pagination: exports.Pagination
185367
+ });
185364
185368
  exports.ExtendTimeoutResponse = zod_1.z.object({
185365
185369
  sandbox: exports.Sandbox
185366
185370
  });
@@ -187832,7 +187836,7 @@ var require_file_writer = __commonJS((exports) => {
187832
187836
  var require_version3 = __commonJS((exports) => {
187833
187837
  Object.defineProperty(exports, "__esModule", { value: true });
187834
187838
  exports.VERSION = undefined;
187835
- exports.VERSION = "1.2.0";
187839
+ exports.VERSION = "1.3.2";
187836
187840
  });
187837
187841
 
187838
187842
  // ../../node_modules/@vercel/sandbox/dist/utils/consume-readable.js
@@ -188277,6 +188281,9 @@ var require_file3 = __commonJS((exports) => {
188277
188281
  }
188278
188282
  };
188279
188283
  var getGlobalPathConfig = () => {
188284
+ if (process.env.VERCEL_AUTH_CONFIG_DIR) {
188285
+ return process.env.VERCEL_AUTH_CONFIG_DIR;
188286
+ }
188280
188287
  const vercelDirectories = (0, xdg_app_paths_1.default)("com.vercel.cli").dataDirs();
188281
188288
  const possibleConfigPaths = [
188282
188289
  ...vercelDirectories,
@@ -189300,6 +189307,7 @@ var require_api_client = __commonJS((exports) => {
189300
189307
  var file_writer_1 = require_file_writer();
189301
189308
  var version_1 = require_version3();
189302
189309
  var consume_readable_1 = require_consume_readable();
189310
+ var zod_1 = require_lib6();
189303
189311
  var jsonlines_1 = __importDefault(require_jsonlines());
189304
189312
  var os_1 = __importDefault(__require("os"));
189305
189313
  var stream_1 = __require("stream");
@@ -189382,6 +189390,9 @@ var require_api_client = __commonJS((exports) => {
189382
189390
  }),
189383
189391
  signal: params.signal
189384
189392
  });
189393
+ if (!response.ok) {
189394
+ await (0, base_client_1.parseOrThrow)(zod_1.z.any(), response);
189395
+ }
189385
189396
  if (response.headers.get("content-type") !== "application/x-ndjson") {
189386
189397
  throw new api_error_1.APIError(response, {
189387
189398
  message: "Expected a stream of command data",
@@ -189459,6 +189470,18 @@ var require_api_client = __commonJS((exports) => {
189459
189470
  signal: params.signal
189460
189471
  }));
189461
189472
  }
189473
+ async listSnapshots(params) {
189474
+ return (0, base_client_1.parseOrThrow)(validators_1.SnapshotsResponse, await this.request(`/v1/sandboxes/snapshots`, {
189475
+ query: {
189476
+ project: params.projectId,
189477
+ limit: params.limit,
189478
+ since: typeof params.since === "number" ? params.since : params.since?.getTime(),
189479
+ until: typeof params.until === "number" ? params.until : params.until?.getTime()
189480
+ },
189481
+ method: "GET",
189482
+ signal: params.signal
189483
+ }));
189484
+ }
189462
189485
  async writeFiles(params) {
189463
189486
  const { writer, response } = this.getFileWriter({
189464
189487
  sandboxId: params.sandboxId,
@@ -189509,6 +189532,9 @@ var require_api_client = __commonJS((exports) => {
189509
189532
  method: "GET",
189510
189533
  signal
189511
189534
  });
189535
+ if (!response.ok) {
189536
+ await (0, base_client_1.parseOrThrow)(zod_1.z.any(), response);
189537
+ }
189512
189538
  if (response.headers.get("content-type") !== "application/x-ndjson") {
189513
189539
  throw new api_error_1.APIError(response, {
189514
189540
  message: "Expected a stream of logs",
@@ -189746,6 +189772,18 @@ var require_snapshot = __commonJS((exports) => {
189746
189772
  this.client = client4;
189747
189773
  this.snapshot = snapshot;
189748
189774
  }
189775
+ static async list(params) {
189776
+ const credentials = await (0, get_credentials_1.getCredentials)(params);
189777
+ const client4 = new api_client_1.APIClient({
189778
+ teamId: credentials.teamId,
189779
+ token: credentials.token,
189780
+ fetch: params?.fetch
189781
+ });
189782
+ return client4.listSnapshots({
189783
+ ...credentials,
189784
+ ...params
189785
+ });
189786
+ }
189749
189787
  static async get(params) {
189750
189788
  const credentials = await (0, get_credentials_1.getCredentials)(params);
189751
189789
  const client4 = new api_client_1.APIClient({
@@ -190050,7 +190088,7 @@ var require_sandbox2 = __commonJS((exports) => {
190050
190088
  // ../../node_modules/@vercel/sandbox/dist/index.js
190051
190089
  var require_dist7 = __commonJS((exports) => {
190052
190090
  Object.defineProperty(exports, "__esModule", { value: true });
190053
- exports.StreamError = exports.CommandFinished = exports.Command = exports.Snapshot = exports.Sandbox = undefined;
190091
+ exports.APIError = exports.StreamError = exports.CommandFinished = exports.Command = exports.Snapshot = exports.Sandbox = undefined;
190054
190092
  var sandbox_1 = require_sandbox2();
190055
190093
  Object.defineProperty(exports, "Sandbox", { enumerable: true, get: function() {
190056
190094
  return sandbox_1.Sandbox;
@@ -190070,6 +190108,10 @@ var require_dist7 = __commonJS((exports) => {
190070
190108
  Object.defineProperty(exports, "StreamError", { enumerable: true, get: function() {
190071
190109
  return api_error_1.StreamError;
190072
190110
  } });
190111
+ var api_error_2 = require_api_error();
190112
+ Object.defineProperty(exports, "APIError", { enumerable: true, get: function() {
190113
+ return api_error_2.APIError;
190114
+ } });
190073
190115
  });
190074
190116
 
190075
190117
  // ../../node_modules/ulid-uuid-converter/dist/index.js
@@ -251782,7 +251824,7 @@ class ClaudeAgent extends BaseAgent {
251782
251824
  const customProvider = createClaudeCode({
251783
251825
  defaultSettings: settings
251784
251826
  });
251785
- this.modelInstance = customProvider(modelId);
251827
+ this.modelInstance = customProvider(modelId, settings);
251786
251828
  } else {
251787
251829
  this.modelInstance = claudeCode(modelId);
251788
251830
  }
@@ -251810,10 +251852,19 @@ class CodexAgent extends BaseAgent {
251810
251852
  this.modelInstance = codexCli2(modelId, {
251811
251853
  reasoningEffort: this.config.reasoningEffort,
251812
251854
  approvalMode: this.config.approvalMode,
251813
- sandboxMode: this.config.sandboxMode,
251855
+ sandboxMode: this.config.sandboxMode || "workspace-write",
251814
251856
  mcpServers: this.config.mcpServers,
251815
251857
  verbose: this.config.verbose,
251816
- logger: this.config.logger
251858
+ logger: this.config.logger,
251859
+ dangerouslyBypassApprovalsAndSandbox: this.config.dangerouslyBypassApprovalsAndSandbox,
251860
+ allowNpx: this.config.allowNpx,
251861
+ cwd: this.config.cwd,
251862
+ fullAuto: this.config.fullAuto || true,
251863
+ webSearch: this.config.webSearch || true,
251864
+ configOverrides: {
251865
+ sandbox_workspace_write: { network_access: true },
251866
+ ...this.config.configOverrides || {}
251867
+ }
251817
251868
  });
251818
251869
  } else {
251819
251870
  this.modelInstance = codexCli2(modelId);
@@ -253784,7 +253835,13 @@ class OpenCodeAgent extends BaseAgent {
253784
253835
  async getModel() {
253785
253836
  if (!this.modelInstance) {
253786
253837
  const modelId = this.config.model || "anthropic/claude-sonnet-4-5-20250929";
253787
- this.modelInstance = opencode(modelId);
253838
+ console.log("modelId", modelId);
253839
+ console.log("cwd", this.config.cwd);
253840
+ this.modelInstance = opencode(modelId, {
253841
+ cwd: this.config.cwd,
253842
+ verbose: this.config.verbose,
253843
+ tools: this.config.tools
253844
+ });
253788
253845
  }
253789
253846
  return this.modelInstance;
253790
253847
  }
@@ -306235,8 +306292,8 @@ var import_ulid_uuid_converter = __toESM(require_dist8(), 1);
306235
306292
 
306236
306293
  class IdGenerator {
306237
306294
  static ulid = monotonicFactory();
306238
- static generateIds() {
306239
- const ulid4 = this.ulid();
306295
+ static generateIds(timestamp) {
306296
+ const ulid4 = this.ulid(timestamp);
306240
306297
  const uuid5 = this.ulidToUuid(ulid4);
306241
306298
  return [ulid4, uuid5];
306242
306299
  }
@@ -306363,6 +306420,7 @@ async function publishChunkToSession(sessionId, chunk, redisUrl) {
306363
306420
  chunkId,
306364
306421
  chunk: chunk.chunk || "",
306365
306422
  segmentId: chunk.segmentId || "",
306423
+ parentSegmentId: chunk.parentSegmentId || "",
306366
306424
  isDone: chunk.isDone ? "true" : "false",
306367
306425
  type: chunk.type || "text-delta",
306368
306426
  senderType: chunk.senderType || "",
@@ -306680,15 +306738,13 @@ import { existsSync as existsSync8, readFileSync as readFileSync8, writeFileSync
306680
306738
  init_config();
306681
306739
  async function getUserInfo() {
306682
306740
  try {
306683
- const token = await getAccessToken();
306684
- if (!token) {
306741
+ const authHeaders = await getAuthHeaders();
306742
+ if (!authHeaders || Object.keys(authHeaders).length === 0) {
306685
306743
  return null;
306686
306744
  }
306687
306745
  const config4 = getConfig();
306688
306746
  const response = await fetch(`${config4.apiUrl}/api/v1/auth/me`, {
306689
- headers: {
306690
- Authorization: `Bearer ${token}`
306691
- }
306747
+ headers: authHeaders
306692
306748
  });
306693
306749
  if (response.ok) {
306694
306750
  return await response.json();
@@ -306721,6 +306777,25 @@ async function refreshToken(refreshToken2) {
306721
306777
  return null;
306722
306778
  }
306723
306779
  }
306780
+ async function getOrCreateApiKey(accessToken) {
306781
+ try {
306782
+ const config4 = getConfig();
306783
+ const apiKeyUrl = `${config4.apiUrl}/api/v1/auth/api-key`;
306784
+ const response = await fetch(apiKeyUrl, {
306785
+ method: "GET",
306786
+ headers: {
306787
+ Authorization: `Bearer ${accessToken}`
306788
+ }
306789
+ });
306790
+ if (!response.ok) {
306791
+ return null;
306792
+ }
306793
+ const data = await response.json();
306794
+ return data.api_key || null;
306795
+ } catch (error49) {
306796
+ return null;
306797
+ }
306798
+ }
306724
306799
 
306725
306800
  // auth.ts
306726
306801
  function getAuth() {
@@ -306755,7 +306830,7 @@ function clearAuth() {
306755
306830
  }
306756
306831
  }
306757
306832
  }
306758
- async function getAccessToken() {
306833
+ async function getAccessToken2() {
306759
306834
  const auth = getAuth();
306760
306835
  if (!auth) {
306761
306836
  return null;
@@ -306790,13 +306865,68 @@ async function getAccessToken() {
306790
306865
  }
306791
306866
  return null;
306792
306867
  }
306868
+ async function getAuthHeaders() {
306869
+ const auth = getAuth();
306870
+ if (!auth) {
306871
+ return {};
306872
+ }
306873
+ if (auth.type === "apikey") {
306874
+ const envApiKey = process.env.INTELLA_API_KEY;
306875
+ const apiKey = envApiKey || auth.apikey;
306876
+ if (apiKey) {
306877
+ return {
306878
+ "X-API-Key": apiKey
306879
+ };
306880
+ }
306881
+ if (auth.oauth?.refresh_token) {
306882
+ const newApiKey = await refreshApiKeyFromRefreshToken(auth.oauth.refresh_token);
306883
+ if (newApiKey) {
306884
+ saveAuth({
306885
+ type: "apikey",
306886
+ apikey: newApiKey,
306887
+ oauth: auth.oauth
306888
+ });
306889
+ return {
306890
+ "X-API-Key": newApiKey
306891
+ };
306892
+ }
306893
+ }
306894
+ return {};
306895
+ }
306896
+ if (auth.type === "oauth" && auth.oauth) {
306897
+ const token = await getAccessToken2();
306898
+ if (token) {
306899
+ return {
306900
+ Authorization: `Bearer ${token}`
306901
+ };
306902
+ }
306903
+ }
306904
+ return {};
306905
+ }
306906
+ async function refreshApiKeyFromRefreshToken(refreshTokenValue) {
306907
+ try {
306908
+ const tokenData = await refreshToken(refreshTokenValue);
306909
+ if (!tokenData || !tokenData.access_token) {
306910
+ return null;
306911
+ }
306912
+ const apiKey = await getOrCreateApiKey(tokenData.access_token);
306913
+ return apiKey;
306914
+ } catch (error49) {
306915
+ return null;
306916
+ }
306917
+ }
306793
306918
  function setAuthType(type) {
306794
306919
  const auth = getAuth() || { type };
306795
306920
  if (type === "apikey") {
306796
306921
  const envApiKey = process.env.INTELLA_API_KEY;
306797
306922
  saveAuth({
306798
306923
  type: "apikey",
306799
- apikey: envApiKey || auth.apikey
306924
+ apikey: envApiKey || auth.apikey,
306925
+ oauth: auth.oauth ? {
306926
+ refresh_token: auth.oauth.refresh_token,
306927
+ access_token: "",
306928
+ expires_at: 0
306929
+ } : undefined
306800
306930
  });
306801
306931
  } else {
306802
306932
  saveAuth({
@@ -306825,13 +306955,11 @@ async function publishSessionEvent(sessionId, event) {
306825
306955
  const config4 = getConfig();
306826
306956
  const apiUrl = config4.apiUrl || "https://app.intella.xyz";
306827
306957
  const endpoint = `${apiUrl}/api/v1/sessions/${sessionId}/events`;
306828
- const token = await getAccessToken();
306958
+ const authHeaders = await getAuthHeaders();
306829
306959
  const headers = {
306830
- "Content-Type": "application/json"
306960
+ "Content-Type": "application/json",
306961
+ ...authHeaders
306831
306962
  };
306832
- if (token) {
306833
- headers["Authorization"] = `Bearer ${token}`;
306834
- }
306835
306963
  try {
306836
306964
  const response = await fetch(endpoint, {
306837
306965
  method: "POST",
@@ -307044,7 +307172,11 @@ async function processAgentCommand(options, logger, doneCallback) {
307044
307172
  if (!agentConfig.executablePath) {
307045
307173
  agentConfig.executablePath = findClaudeBinary() || "/usr/local/bin/claude";
307046
307174
  }
307047
- agentConfig.allowedTools = ["Read", "Write", "Edit", "Bash", "WebSearch", "Grep"];
307175
+ agentConfig.allowedTools = ["Read", "Write", "Edit", "Bash", "WebSearch", "Grep", "WebFetch"];
307176
+ }
307177
+ if (agentType === "codex") {
307178
+ agentConfig.sandboxMode = "workspace-write";
307179
+ agentConfig.dangerouslyBypassApprovalsAndSandbox = true;
307048
307180
  }
307049
307181
  agentConfig.model = model;
307050
307182
  log.info(`[DAEMON] Executing agent task with agent: ${agentType}`);
@@ -307060,30 +307192,89 @@ async function processAgentCommand(options, logger, doneCallback) {
307060
307192
  let fullResponse = "";
307061
307193
  const responseChunks = [];
307062
307194
  let chunkCount = 0;
307063
- let segmentId = IdGenerator.generatePrefixUlid("seg");
307064
- let segmentSent = false;
307195
+ let mainSegmentId = IdGenerator.generatePrefixUlid("seg");
307196
+ let firstTextChunkSent = false;
307197
+ const isToolRelatedChunk = (type) => {
307198
+ return type.startsWith("tool-") || type === "tool-call" || type === "tool-result" || type === "tool-error" || type === "tool-input-start" || type === "tool-input-end" || type === "tool-input-delta" || type === "tool-output-denied";
307199
+ };
307200
+ const shouldEmitEvent = (chunk) => {
307201
+ if (chunk.isDone || chunk.type === "done" || chunk.type === "error" || chunk.type === "start") {
307202
+ return true;
307203
+ }
307204
+ return false;
307205
+ };
307206
+ const config4 = getConfig();
307207
+ let uniquePartId = {};
307208
+ let textSegment = [];
307065
307209
  for await (const chunk of sdk.streamTask(taskRequest, agentType)) {
307066
307210
  chunkCount++;
307067
307211
  responseChunks.push({ ...chunk, timestamp: Date.now() });
307212
+ const chunkData = chunk.data;
307213
+ if (chunkData && chunkData.id || chunkData?.toolCallId) {
307214
+ if (chunk.type === "text-start") {
307215
+ if (!uniquePartId[chunkData.id]) {
307216
+ if (textSegment.length > 0) {
307217
+ uniquePartId[chunkData.id] = IdGenerator.generatePrefixUlid("seg");
307218
+ textSegment.push(chunkData.id);
307219
+ } else {
307220
+ uniquePartId[chunkData.id] = mainSegmentId;
307221
+ textSegment.push(chunkData.id);
307222
+ }
307223
+ }
307224
+ } else if (chunk.type === "reasoning-start") {
307225
+ if (!uniquePartId[chunkData.id]) {
307226
+ uniquePartId[chunkData.id] = IdGenerator.generatePrefixUlid("seg");
307227
+ }
307228
+ } else if (chunk.type === "tool-input-start") {
307229
+ if (!uniquePartId[chunkData.id]) {
307230
+ uniquePartId[chunkData.id] = IdGenerator.generatePrefixUlid("seg");
307231
+ }
307232
+ }
307233
+ }
307068
307234
  if (session?.id) {
307069
- const config4 = getConfig();
307235
+ let currentSegmentId;
307236
+ if (chunk.type === "text-delta" || chunk.type === "text-start" || chunk.type === "text-end") {
307237
+ currentSegmentId = uniquePartId[chunkData.id];
307238
+ } else if (isToolRelatedChunk(chunk.type)) {
307239
+ if (chunkData.toolCallId) {
307240
+ currentSegmentId = uniquePartId[chunkData.toolCallId];
307241
+ } else if (chunkData.id) {
307242
+ currentSegmentId = uniquePartId[chunkData.id];
307243
+ } else {
307244
+ currentSegmentId = IdGenerator.generatePrefixUlid("seg");
307245
+ }
307246
+ } else if (chunk.type.startsWith("reasoning")) {
307247
+ if (chunkData.id) {
307248
+ currentSegmentId = uniquePartId[chunkData.id];
307249
+ } else {
307250
+ currentSegmentId = mainSegmentId;
307251
+ }
307252
+ } else if (chunk.type === "file") {
307253
+ currentSegmentId = IdGenerator.generatePrefixUlid("seg");
307254
+ } else {
307255
+ currentSegmentId = mainSegmentId;
307256
+ }
307070
307257
  await publishChunkToSession(session.id, {
307071
307258
  chunk: chunk.text,
307072
307259
  isDone: chunk.isDone,
307073
307260
  type: chunk.type,
307074
307261
  senderType: "assistant",
307075
307262
  timestamp: Date.now(),
307076
- segmentId,
307263
+ segmentId: currentSegmentId,
307264
+ parentSegmentId: mainSegmentId,
307077
307265
  data: {
307078
307266
  agentType,
307079
307267
  ...chunk.data
307080
307268
  }
307081
307269
  }, config4.redisUrl);
307082
- agentResponseEmitter.emit("agent:response", {
307083
- chunk,
307084
- sessionId: session.id,
307085
- segmentId
307086
- });
307270
+ if (shouldEmitEvent(chunk)) {
307271
+ agentResponseEmitter.emit("agent:response", {
307272
+ chunk,
307273
+ sessionId: session.id,
307274
+ segmentId: currentSegmentId,
307275
+ parentSegmentId: mainSegmentId
307276
+ });
307277
+ }
307087
307278
  if (options.streamAgentResult) {
307088
307279
  await publishChunk(options.sandboxId, {
307089
307280
  chunk: chunk.text,
@@ -307091,17 +307282,14 @@ async function processAgentCommand(options, logger, doneCallback) {
307091
307282
  type: chunk.type,
307092
307283
  senderType: "assistant",
307093
307284
  timestamp: Date.now(),
307094
- segmentId,
307285
+ segmentId: currentSegmentId,
307286
+ parentSegmentId: mainSegmentId,
307095
307287
  data: {
307096
307288
  agentType,
307097
307289
  ...chunk.data
307098
307290
  }
307099
307291
  });
307100
307292
  }
307101
- if (!segmentSent) {
307102
- }
307103
- } else if (chunk.type === "text-delta") {
307104
- process.stdout.write(chunk.text);
307105
307293
  }
307106
307294
  if (chunk.isDone) {
307107
307295
  log.info(`[DAEMON] \u2705 Agent execution completed (${chunkCount} chunks, ${fullResponse.length} chars)`);
@@ -307141,8 +307329,35 @@ async function processAgentCommand(options, logger, doneCallback) {
307141
307329
  }
307142
307330
  var agentResponseEmitter = new EventEmitter;
307143
307331
  agentResponseEmitter.on("agent:response", async (response) => {
307144
- console.log("Agent response:", response);
307145
- await publishSessionEvent(response.sessionId, response.chunk);
307332
+ let eventType = "chunk";
307333
+ if (response.chunk.isDone || response.chunk.type === "done") {
307334
+ eventType = "done";
307335
+ } else if (response.chunk.type === "error") {
307336
+ eventType = "error";
307337
+ } else if (response.chunk.type.startsWith("tool")) {
307338
+ eventType = "tool-use";
307339
+ } else if (response.chunk.type.startsWith("start")) {
307340
+ eventType = "start";
307341
+ } else if (response.chunk.type.startsWith("status")) {
307342
+ eventType = "status";
307343
+ } else if (response.chunk.type.startsWith("thinking")) {
307344
+ eventType = "thinking";
307345
+ } else if (response.chunk.type.startsWith("attachments") || response.chunk.type.startsWith("file")) {
307346
+ eventType = "attachments";
307347
+ } else if (response.chunk.type.startsWith("finish")) {
307348
+ eventType = "finish-step";
307349
+ }
307350
+ await publishSessionEvent(response.sessionId, {
307351
+ type: eventType,
307352
+ segmentId: response.segmentId,
307353
+ parentSegmentId: response.parentSegmentId,
307354
+ message: response.chunk.text || eventType,
307355
+ data: {
307356
+ ...response.chunk,
307357
+ segmentId: response.segmentId,
307358
+ parentSegmentId: response.parentSegmentId
307359
+ }
307360
+ });
307146
307361
  });
307147
307362
 
307148
307363
  // commands/sandbox.ts
@@ -307934,7 +308149,7 @@ async function loginCommand(options) {
307934
308149
  reject(new Error("Authentication timeout. Please try again."));
307935
308150
  }
307936
308151
  }, timeout);
307937
- listenToSSE(sseUrl, (data) => {
308152
+ listenToSSE(sseUrl, async (data) => {
307938
308153
  if (resolved)
307939
308154
  return;
307940
308155
  if (data.type === "auth_success") {
@@ -307950,7 +308165,26 @@ async function loginCommand(options) {
307950
308165
  }
307951
308166
  });
307952
308167
  console.log("\u2705 Authentication successful!");
307953
- console.log(` Access token stored securely in ${config4.authPath}\n`);
308168
+ console.log(" Fetching API key for persistent authentication...");
308169
+ const apiKey = await getOrCreateApiKey(data.access_token);
308170
+ if (apiKey) {
308171
+ saveAuth({
308172
+ type: "apikey",
308173
+ apikey: apiKey,
308174
+ oauth: {
308175
+ refresh_token: data.refresh_token || "",
308176
+ access_token: "",
308177
+ expires_at: 0
308178
+ }
308179
+ });
308180
+ console.log("\u2705 API key stored successfully!");
308181
+ console.log(` You can now authenticate without worrying about token expiration.`);
308182
+ console.log(` Refresh token saved as fallback in case API key is deleted.`);
308183
+ console.log(` Credentials stored securely in ${config4.authPath}\n`);
308184
+ } else {
308185
+ console.log("\u26A0\uFE0F Warning: Could not fetch API key, using OAuth tokens (may expire)");
308186
+ console.log(` Access token stored securely in ${config4.authPath}\n`);
308187
+ }
307954
308188
  resolve8();
307955
308189
  } else if (data.type === "auth_error") {
307956
308190
  clearTimeout(timeoutId);
@@ -309166,4 +309400,4 @@ yargs_default(hideBin(process.argv)).scriptName("intella-cli").version("1.0.0").
309166
309400
  await whoamiCommand();
309167
309401
  }).demandCommand(1, "You need at least one command before moving on").help().alias("help", "h").alias("version", "v").strict().parse();
309168
309402
 
309169
- //# debugId=035B99541C02033564756E2164756E21
309403
+ //# debugId=673D9FD4C99DA41C64756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intella-cli",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "bin": {
5
5
  "intella": "bin/intella.js"
6
6
  },
@@ -20,7 +20,7 @@
20
20
  "README.md"
21
21
  ],
22
22
  "dependencies": {
23
- "@intella/sdk": "0.0.5",
23
+ "@intella/sdk": "0.0.8",
24
24
  "dotenv": "^17.2.3",
25
25
  "open": "^10.1.0",
26
26
  "redis": "^5.10.0",