@asgard-js/core 0.3.83 → 0.3.84

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/index.mjs CHANGED
@@ -16,7 +16,7 @@ class y extends Error {
16
16
  super(`HTTP ${t}: ${e}`), this.name = "HttpError", this.status = t, this.statusText = e, this.body = s;
17
17
  }
18
18
  }
19
- function kn(n) {
19
+ function _n(n) {
20
20
  return n instanceof y;
21
21
  }
22
22
  class te extends Error {
@@ -26,7 +26,7 @@ class te extends Error {
26
26
  super(`Cannot send a message while a "${t}" run is in flight on this channel.`), this.name = "ChannelBusyError", this.runKind = t;
27
27
  }
28
28
  }
29
- function Pn(n) {
29
+ function Mn(n) {
30
30
  return n instanceof te;
31
31
  }
32
32
  class ne extends Error {
@@ -43,7 +43,7 @@ class ne extends Error {
43
43
  super("Cannot send this turn while the channel is awaiting a tool-call consent response."), this.name = "ChannelAwaitingConsentError", this.processId = t;
44
44
  }
45
45
  }
46
- function _n(n) {
46
+ function Un(n) {
47
47
  return n instanceof ne;
48
48
  }
49
49
  var H = /* @__PURE__ */ ((n) => (n.RESET_CHANNEL = "RESET_CHANNEL", n.NONE = "NONE", n.RESPONSE_TOOL_CALL_CONSENT = "RESPONSE_TOOL_CALL_CONSENT", n.NUDGE = "NUDGE", n))(H || {}), l = /* @__PURE__ */ ((n) => (n.INIT = "asgard.run.init", n.PROCESS = "asgard.process", n.PROCESS_START = "asgard.process.start", n.PROCESS_COMPLETE = "asgard.process.complete", n.MESSAGE = "asgard.message", n.MESSAGE_START = "asgard.message.start", n.MESSAGE_DELTA = "asgard.message.delta", n.MESSAGE_COMPLETE = "asgard.message.complete", n.MESSAGE_USER = "asgard.message.user", n.MESSAGE_THINKING_START = "asgard.message.thinking.start", n.MESSAGE_THINKING_DELTA = "asgard.message.thinking.delta", n.MESSAGE_THINKING_COMPLETE = "asgard.message.thinking.complete", n.MESSAGE_CANVAS_START = "asgard.message.canvas.start", n.MESSAGE_CANVAS_DELTA = "asgard.message.canvas.delta", n.MESSAGE_CANVAS_COMPLETE = "asgard.message.canvas.complete", n.TOOL_CALL = "asgard.tool_call", n.TOOL_CALL_START = "asgard.tool_call.start", n.TOOL_CALL_COMPLETE = "asgard.tool_call.complete", n.TOOL_CALL_CONSENT = "asgard.tool_call.consent", n.SUBAGENT_START = "asgard.subagent.start", n.SUBAGENT_COMPLETE = "asgard.subagent.complete", n.CHANNEL_TITLE_UPDATE = "asgard.channel.title.update", n.PROMPT_SUGGESTION = "asgard.prompt_suggestion", n.SANDBOX_LAUNCH = "asgard.sandbox.launch", n.SANDBOX_READY = "asgard.sandbox.ready", n.MESSAGE_FEEDBACK = "asgard.message.feedback", n.DONE = "asgard.run.done", n.ERROR = "asgard.run.error", n))(l || {}), ze = /* @__PURE__ */ ((n) => (n.ALLOW_ONCE = "ALLOW_ONCE", n.ALLOW_ALWAYS = "ALLOW_ALWAYS", n.DENY_ONCE = "DENY_ONCE", n))(ze || {}), Ce = /* @__PURE__ */ ((n) => (n.TEXT = "TEXT", n.HINT = "HINT", n.BUTTON = "BUTTON", n.IMAGE = "IMAGE", n.VIDEO = "VIDEO", n.AUDIO = "AUDIO", n.LOCATION = "LOCATION", n.CAROUSEL = "CAROUSEL", n.CHART = "CHART", n.TABLE = "TABLE", n.ATTACHMENT = "ATTACHMENT", n.QUESTION = "QUESTION", n.CANVAS = "CANVAS", n))(Ce || {});
@@ -1474,7 +1474,7 @@ const nn = 50;
1474
1474
  function Se(n, t) {
1475
1475
  return t?.customChannelId && n.searchParams.set("custom_channel_id", t.customChannelId), n;
1476
1476
  }
1477
- class Mn {
1477
+ class Ln {
1478
1478
  apiKey;
1479
1479
  endpoint;
1480
1480
  botProviderEndpoint;
@@ -2044,7 +2044,7 @@ const Xe = 1e3, an = 1e4;
2044
2044
  function ye(n) {
2045
2045
  return Math.min(Math.max(1, Math.floor(n)), Xe);
2046
2046
  }
2047
- class Un {
2047
+ class Nn {
2048
2048
  endpoint;
2049
2049
  apiKey;
2050
2050
  customHeaders;
@@ -3364,36 +3364,40 @@ class G {
3364
3364
  const On = {
3365
3365
  GOOD: "[Response Feedback: Good]",
3366
3366
  BAD: "[Response Feedback: Bad]"
3367
- }, Ln = 8 * 1024;
3368
- function Nn(n) {
3367
+ }, Rn = 8 * 1024;
3368
+ function Fn(n) {
3369
3369
  return new TextEncoder().encode(n).length;
3370
3370
  }
3371
- function Rn(n, t) {
3371
+ function jn(n, t) {
3372
3372
  const e = On[n], s = t?.trim() ?? "";
3373
3373
  return s ? `${e}
3374
3374
 
3375
3375
  ${s}` : e;
3376
3376
  }
3377
- function Fn(n) {
3377
+ const kn = ["open-file", "open-folder"];
3378
+ function Pn(n) {
3379
+ return kn.includes(n);
3380
+ }
3381
+ function $n(n) {
3378
3382
  const t = /^sandbox:\/\/([^/]+)\/([^?#]+)(?:\?([^#]*))?/.exec(n.trim());
3379
3383
  if (!t) return null;
3380
3384
  const e = decodeURIComponent(t[1]), s = t[2], r = new URLSearchParams(t[3] ?? "");
3381
3385
  if (s === "open-browser") return { kind: "open-browser", sandboxName: e };
3382
- if (s === "open-file") {
3386
+ if (Pn(s)) {
3383
3387
  const i = r.get("absolute_path");
3384
- return i ? { kind: "open-file", sandboxName: e, absolutePath: i } : null;
3388
+ return i ? { kind: s, sandboxName: e, absolutePath: i } : null;
3385
3389
  }
3386
3390
  return null;
3387
3391
  }
3388
3392
  export {
3389
- Mn as AsgardServiceClient,
3390
- Un as AsgardSourceSetClient,
3393
+ Ln as AsgardServiceClient,
3394
+ Nn as AsgardSourceSetClient,
3391
3395
  G as Channel,
3392
3396
  ne as ChannelAwaitingConsentError,
3393
3397
  te as ChannelBusyError,
3394
3398
  g as Conversation,
3395
3399
  l as EventType,
3396
- Ln as FEEDBACK_COMMENT_MAX_BYTES,
3400
+ Rn as FEEDBACK_COMMENT_MAX_BYTES,
3397
3401
  H as FetchSseAction,
3398
3402
  y as HttpError,
3399
3403
  Ce as MessageTemplateType,
@@ -3403,22 +3407,22 @@ export {
3403
3407
  sn as SOURCE_SET_VOLUME_ROOT,
3404
3408
  ze as ToolCallConsentResult,
3405
3409
  C as assertVolumePath,
3406
- Rn as composeFeedbackMessage,
3410
+ jn as composeFeedbackMessage,
3407
3411
  Sn as conversationToSubagentEvents,
3408
3412
  Cn as createDerivedStores,
3409
3413
  wn as deriveSubagents,
3410
3414
  yn as deriveTasks,
3411
- Nn as feedbackCommentByteLength,
3415
+ Fn as feedbackCommentByteLength,
3412
3416
  gn as isAgentTool,
3413
- _n as isChannelAwaitingConsentError,
3414
- Pn as isChannelBusyError,
3415
- kn as isHttpError,
3417
+ Un as isChannelAwaitingConsentError,
3418
+ Mn as isChannelBusyError,
3419
+ _n as isHttpError,
3416
3420
  mn as isSubagentChildTool,
3417
3421
  fn as isTaskTool,
3418
3422
  Te as reconcileLaunched,
3419
3423
  bn as reduceSubagents,
3420
3424
  pn as reduceTaskEvents,
3421
- Fn as resolveSandboxUri,
3425
+ $n as resolveSandboxUri,
3422
3426
  Tn as subagentsEqual,
3423
3427
  En as tasksEqual
3424
3428
  };