oasis_test 0.1.129 → 0.1.130

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 +53 -11
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -191002,7 +191002,13 @@ function scanCodexTelemetry(workdir, sinceMs, sessionsRoot = codexSessionsRoot()
191002
191002
  return {};
191003
191003
  }
191004
191004
  function createCodexNormalizeState() {
191005
- return { toolUseIds: /* @__PURE__ */ new Set(), previousAgentMessage: false, lastAgentMessageEndedWithNewline: false };
191005
+ return {
191006
+ toolUseIds: /* @__PURE__ */ new Set(),
191007
+ previousAgentMessage: false,
191008
+ lastAgentMessageEndedWithNewline: false,
191009
+ streamedAgentText: "",
191010
+ streamedReasoningText: ""
191011
+ };
191006
191012
  }
191007
191013
  function record4(value2) {
191008
191014
  return value2 && typeof value2 === "object" && !Array.isArray(value2) ? value2 : void 0;
@@ -191036,21 +191042,54 @@ function toolUseOnce(state, id, name, input) {
191036
191042
  state.toolUseIds.add(id);
191037
191043
  return [{ kind: "tool_use", payload: { id, name, input } }];
191038
191044
  }
191045
+ function remainderAfterStream(streamed, snapshot) {
191046
+ if (!streamed) return snapshot;
191047
+ return snapshot.startsWith(streamed) ? snapshot.slice(streamed.length) : "";
191048
+ }
191049
+ function noteCodexAgentDelta(state, delta) {
191050
+ if (!delta) return [];
191051
+ const needsBoundary = state.streamedAgentText.length === 0 && state.previousAgentMessage && !state.lastAgentMessageEndedWithNewline && !delta.startsWith("\n");
191052
+ state.streamedAgentText += delta;
191053
+ const text5 = needsBoundary ? `
191054
+ ${delta}` : delta;
191055
+ return [{ kind: "message", payload: { text: text5 }, outputText: text5 }];
191056
+ }
191057
+ function noteCodexReasoningDelta(state, delta) {
191058
+ if (!delta) return [];
191059
+ state.streamedReasoningText += delta;
191060
+ return [{ kind: "thought", payload: { text: delta } }];
191061
+ }
191039
191062
  function normalizeCodexItem(item, phase, state) {
191040
191063
  const type = item.type;
191041
191064
  if (type === "agent_message") {
191042
- const text5 = typeof item.text === "string" ? item.text : "";
191043
- if (!text5) return [];
191044
- const needsBoundary = state.previousAgentMessage && !state.lastAgentMessageEndedWithNewline && !text5.startsWith("\n");
191045
- const delta = needsBoundary ? `
191046
- ${text5}` : text5;
191065
+ const full = typeof item.text === "string" ? item.text : "";
191066
+ const streamed = state.streamedAgentText;
191067
+ const finalizes = phase !== "started";
191068
+ if (!full) {
191069
+ if (finalizes) state.streamedAgentText = "";
191070
+ return [];
191071
+ }
191072
+ const rest = remainderAfterStream(streamed, full);
191073
+ const needsBoundary = !streamed && state.previousAgentMessage && !state.lastAgentMessageEndedWithNewline && !full.startsWith("\n");
191047
191074
  state.previousAgentMessage = true;
191048
- state.lastAgentMessageEndedWithNewline = text5.endsWith("\n");
191075
+ state.lastAgentMessageEndedWithNewline = full.endsWith("\n");
191076
+ state.streamedAgentText = finalizes ? "" : full.startsWith(streamed) ? full : streamed;
191077
+ if (!rest) return [];
191078
+ const delta = needsBoundary ? `
191079
+ ${rest}` : rest;
191049
191080
  return [{ kind: "message", payload: { text: delta }, outputText: delta }];
191050
191081
  }
191051
191082
  if (type === "reasoning") {
191052
- const text5 = textOf2(item.text ?? item.summary ?? item.content ?? item);
191053
- return text5 ? [{ kind: "thought", payload: { text: text5 } }] : [];
191083
+ const full = textOf2(item.text ?? item.summary ?? item.content ?? item);
191084
+ const streamed = state.streamedReasoningText;
191085
+ const finalizes = phase !== "started";
191086
+ if (!full) {
191087
+ if (finalizes) state.streamedReasoningText = "";
191088
+ return [];
191089
+ }
191090
+ const rest = remainderAfterStream(streamed, full);
191091
+ state.streamedReasoningText = finalizes ? "" : full.startsWith(streamed) ? full : streamed;
191092
+ return rest ? [{ kind: "thought", payload: { text: rest } }] : [];
191054
191093
  }
191055
191094
  if (type === "command_execution" && typeof item.id === "string") {
191056
191095
  resetAgentMessageBoundary(state);
@@ -191302,7 +191341,10 @@ ${task}` : task;
191302
191341
  }
191303
191342
  if (method === "item/agentMessage/delta" || method === "item/reasoning/textDelta") {
191304
191343
  const delta = params?.delta;
191305
- if (typeof delta === "string" && delta) return [{ kind: method.includes("reasoning") ? "thought" : "message", payload: { text: delta }, ...method.includes("reasoning") ? {} : { outputText: delta } }];
191344
+ if (typeof delta === "string" && delta) {
191345
+ const codex = state.codex ??= createCodexNormalizeState();
191346
+ return method.includes("reasoning") ? noteCodexReasoningDelta(codex, delta) : noteCodexAgentDelta(codex, delta);
191347
+ }
191306
191348
  }
191307
191349
  if (method === "item/started" || method === "item/completed") {
191308
191350
  const raw = params?.item;
@@ -244114,7 +244156,7 @@ function shimScript() {
244114
244156
  }
244115
244157
 
244116
244158
  // src/index.ts
244117
- var PKG_VERSION = true ? "0.1.129" : "dev";
244159
+ var PKG_VERSION = true ? "0.1.130" : "dev";
244118
244160
  var LOCAL_BIN = localBin();
244119
244161
  var NPM_PREFIX = npmPrefix();
244120
244162
  var INSTANCE = DEFAULT_INSTANCE;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oasis_test",
3
- "version": "0.1.129",
3
+ "version": "0.1.130",
4
4
  "description": "Oasis node daemon + CLI — background daemon, auto-start, full server CLI",
5
5
  "bin": {
6
6
  "oasis": "./dist/index.js"
@@ -26,6 +26,6 @@
26
26
  "node": ">=20"
27
27
  },
28
28
  "oasisRelease": {
29
- "sourceHead": "d5063bab558443d535d4c4370a53ed4e169e445e"
29
+ "sourceHead": "362d2c9bb59ca0b422922b0512bac20ab41ac4a8"
30
30
  }
31
31
  }