oasis_test 0.1.40 → 0.1.42

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/dist/index.js +30 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -38983,15 +38983,16 @@ async function runACPSession(job, cfg) {
38983
38983
  });
38984
38984
  void (async () => {
38985
38985
  try {
38986
- await client.request("initialize", {
38986
+ const initRes = await client.request("initialize", {
38987
38987
  protocolVersion: 1,
38988
38988
  clientInfo: { name: "oasis-adapter", version: "0.1.0" },
38989
38989
  clientCapabilities: {}
38990
38990
  });
38991
+ const advertisedLoadSession = initRes?.agentCapabilities?.loadSession === true;
38991
38992
  const resolvedModel = job.model ?? cfg.model;
38992
38993
  let sessionId = "";
38993
38994
  let ambiguousResume = false;
38994
- if (job.resumeRuntimeSession && job.runtimeSessionId) {
38995
+ if (job.resumeRuntimeSession && job.runtimeSessionId && advertisedLoadSession) {
38995
38996
  const method = cfg.resumeMethod ?? "session/load";
38996
38997
  try {
38997
38998
  const resumeRes = await client.request(method, {
@@ -39110,6 +39111,11 @@ var init_acp = __esm({
39110
39111
  seq = 0;
39111
39112
  /** Token usage accumulator (updated from UsageUpdate notifications) */
39112
39113
  usage = newUsageAcc();
39114
+ /**
39115
+ * 单调递增的通知计数——用于 drainReplayQuiet 探测 hermes/session/load 后的 replay 通知
39116
+ * 是否还在流。每收到一条 session/update / session/notification 就 +1,主循环轮询该值。
39117
+ */
39118
+ notificationCount = 0;
39113
39119
  request(method, params) {
39114
39120
  const id = this.nextId++;
39115
39121
  return new Promise((resolve4, reject) => {
@@ -39182,11 +39188,19 @@ var init_acp = __esm({
39182
39188
  case "tool_call":
39183
39189
  this.flushTextBuffers();
39184
39190
  this.handleToolCallStart(updateData);
39185
- this.handleToolCallUpdate(updateData);
39191
+ this.handleToolCallUpdate(
39192
+ updateData,
39193
+ /* skipOutputAccum */
39194
+ true
39195
+ );
39186
39196
  break;
39187
39197
  case "tool_call_update":
39188
39198
  this.flushTextBuffers();
39189
- this.handleToolCallUpdate(updateData);
39199
+ this.handleToolCallUpdate(
39200
+ updateData,
39201
+ /* skipOutputAccum */
39202
+ false
39203
+ );
39190
39204
  break;
39191
39205
  case "usage_update":
39192
39206
  this.handleUsageUpdate(updateData);
@@ -39291,9 +39305,19 @@ var init_acp = __esm({
39291
39305
  const input2 = pending.input ?? parseArgsJSON(pending.argsText);
39292
39306
  this.emit("tool_use", { id: toolCallId, name: pending.toolName, input: input2 ?? {} });
39293
39307
  }
39308
+ let content;
39309
+ if (typeof output === "string") {
39310
+ let longest = output;
39311
+ for (const p2 of pending.outputParts) {
39312
+ if (typeof p2 === "string" && p2.length > longest.length) longest = p2;
39313
+ }
39314
+ content = longest;
39315
+ } else {
39316
+ content = output ?? joinOutputParts(pending.outputParts);
39317
+ }
39294
39318
  this.emit("tool_result", {
39295
39319
  tool_use_id: toolCallId,
39296
- content: output ?? joinOutputParts(pending.outputParts),
39320
+ content,
39297
39321
  is_error: isErrorToolStatus(status, d)
39298
39322
  });
39299
39323
  }
@@ -58122,7 +58146,7 @@ ${res.warning}`);
58122
58146
  }
58123
58147
 
58124
58148
  // src/index.ts
58125
- var PKG_VERSION = true ? "0.1.40" : "dev";
58149
+ var PKG_VERSION = true ? "0.1.42" : "dev";
58126
58150
  var OASIS_DIR = path18.join(os10.homedir(), ".oasis");
58127
58151
  var CONFIG_FILE = path18.join(OASIS_DIR, "node-config.json");
58128
58152
  var PID_FILE = path18.join(OASIS_DIR, "node.pid");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oasis_test",
3
- "version": "0.1.40",
3
+ "version": "0.1.42",
4
4
  "description": "Oasis node daemon + CLI — background daemon, auto-start, full server CLI",
5
5
  "bin": {
6
6
  "oasis": "./dist/index.js"