@defend-tech/opencode-optima 0.1.45 → 0.1.46

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.js CHANGED
@@ -9565,10 +9565,10 @@ function clearClickUpPendingSessionMetadata(metadata, metadataKey) {
9565
9565
  }
9566
9566
  async function openCodeSessionExists(client, sessionId) {
9567
9567
  const getAttempts = [
9568
- { sessionID: sessionId },
9569
- { id: sessionId },
9568
+ { path: { id: sessionId } },
9570
9569
  { path: { sessionID: sessionId } },
9571
- { path: { id: sessionId } }
9570
+ { sessionID: sessionId },
9571
+ { id: sessionId }
9572
9572
  ];
9573
9573
  if (typeof client?.session?.get === "function") {
9574
9574
  for (const attempt of getAttempts) {
@@ -9580,10 +9580,10 @@ async function openCodeSessionExists(client, sessionId) {
9580
9580
  }
9581
9581
  }
9582
9582
  const messageAttempts = [
9583
- { sessionID: sessionId, limit: 1 },
9584
- { id: sessionId, limit: 1 },
9583
+ { path: { id: sessionId }, query: { limit: 1 } },
9585
9584
  { path: { sessionID: sessionId }, query: { limit: 1 } },
9586
- { path: { id: sessionId }, query: { limit: 1 } }
9585
+ { sessionID: sessionId, limit: 1 },
9586
+ { id: sessionId, limit: 1 }
9587
9587
  ];
9588
9588
  if (typeof client?.session?.messages === "function") {
9589
9589
  for (const attempt of messageAttempts) {
@@ -9605,7 +9605,7 @@ async function createOpenCodeSession(client, { title, directory, agent } = {}) {
9605
9605
  if (agent) flatPayload.agent = agent;
9606
9606
  const body = { title };
9607
9607
  if (agent) body.agent = agent;
9608
- const attempts = [flatPayload, { query: { directory }, body }];
9608
+ const attempts = [{ query: { directory }, body }, flatPayload];
9609
9609
  let firstError = null;
9610
9610
  for (const attempt of attempts) {
9611
9611
  try {
@@ -9700,10 +9700,10 @@ async function sendOpenCodeSessionEventDirect({ baseUrl, sessionId, text, agent,
9700
9700
  }
9701
9701
  async function callOpenCodePromptWithFallbacks(method, sessionId, flatPayload, structuredPayload) {
9702
9702
  const attempts = [
9703
- { sessionID: sessionId, ...flatPayload },
9704
- { id: sessionId, ...flatPayload },
9705
9703
  { ...structuredPayload, path: { id: sessionId } },
9706
- { ...structuredPayload, path: { sessionID: sessionId } }
9704
+ { ...structuredPayload, path: { sessionID: sessionId } },
9705
+ { sessionID: sessionId, ...flatPayload },
9706
+ { id: sessionId, ...flatPayload }
9707
9707
  ];
9708
9708
  let firstError = null;
9709
9709
  for (const attempt of attempts) {
@@ -9753,10 +9753,10 @@ function normalizeOpenCodeSessionMessages(result) {
9753
9753
  async function readOpenCodeSessionMessages(client, { sessionId, limit = 20 } = {}) {
9754
9754
  if (typeof client?.session?.messages !== "function") return null;
9755
9755
  const attempts = [
9756
- { sessionID: sessionId, limit },
9757
- { id: sessionId, limit },
9758
9756
  { path: { id: sessionId }, query: { limit } },
9759
- { path: { sessionID: sessionId }, query: { limit } }
9757
+ { path: { sessionID: sessionId }, query: { limit } },
9758
+ { sessionID: sessionId, limit },
9759
+ { id: sessionId, limit }
9760
9760
  ];
9761
9761
  let firstError = null;
9762
9762
  for (const attempt of attempts) {
@@ -9572,10 +9572,10 @@ function clearClickUpPendingSessionMetadata(metadata, metadataKey) {
9572
9572
  }
9573
9573
  async function openCodeSessionExists(client, sessionId) {
9574
9574
  const getAttempts = [
9575
- { sessionID: sessionId },
9576
- { id: sessionId },
9575
+ { path: { id: sessionId } },
9577
9576
  { path: { sessionID: sessionId } },
9578
- { path: { id: sessionId } }
9577
+ { sessionID: sessionId },
9578
+ { id: sessionId }
9579
9579
  ];
9580
9580
  if (typeof client?.session?.get === "function") {
9581
9581
  for (const attempt of getAttempts) {
@@ -9587,10 +9587,10 @@ async function openCodeSessionExists(client, sessionId) {
9587
9587
  }
9588
9588
  }
9589
9589
  const messageAttempts = [
9590
- { sessionID: sessionId, limit: 1 },
9591
- { id: sessionId, limit: 1 },
9590
+ { path: { id: sessionId }, query: { limit: 1 } },
9592
9591
  { path: { sessionID: sessionId }, query: { limit: 1 } },
9593
- { path: { id: sessionId }, query: { limit: 1 } }
9592
+ { sessionID: sessionId, limit: 1 },
9593
+ { id: sessionId, limit: 1 }
9594
9594
  ];
9595
9595
  if (typeof client?.session?.messages === "function") {
9596
9596
  for (const attempt of messageAttempts) {
@@ -9612,7 +9612,7 @@ async function createOpenCodeSession(client, { title, directory, agent } = {}) {
9612
9612
  if (agent) flatPayload.agent = agent;
9613
9613
  const body = { title };
9614
9614
  if (agent) body.agent = agent;
9615
- const attempts = [flatPayload, { query: { directory }, body }];
9615
+ const attempts = [{ query: { directory }, body }, flatPayload];
9616
9616
  let firstError = null;
9617
9617
  for (const attempt of attempts) {
9618
9618
  try {
@@ -9707,10 +9707,10 @@ async function sendOpenCodeSessionEventDirect({ baseUrl, sessionId, text, agent,
9707
9707
  }
9708
9708
  async function callOpenCodePromptWithFallbacks(method, sessionId, flatPayload, structuredPayload) {
9709
9709
  const attempts = [
9710
- { sessionID: sessionId, ...flatPayload },
9711
- { id: sessionId, ...flatPayload },
9712
9710
  { ...structuredPayload, path: { id: sessionId } },
9713
- { ...structuredPayload, path: { sessionID: sessionId } }
9711
+ { ...structuredPayload, path: { sessionID: sessionId } },
9712
+ { sessionID: sessionId, ...flatPayload },
9713
+ { id: sessionId, ...flatPayload }
9714
9714
  ];
9715
9715
  let firstError = null;
9716
9716
  for (const attempt of attempts) {
@@ -9760,10 +9760,10 @@ function normalizeOpenCodeSessionMessages(result) {
9760
9760
  async function readOpenCodeSessionMessages(client, { sessionId, limit = 20 } = {}) {
9761
9761
  if (typeof client?.session?.messages !== "function") return null;
9762
9762
  const attempts = [
9763
- { sessionID: sessionId, limit },
9764
- { id: sessionId, limit },
9765
9763
  { path: { id: sessionId }, query: { limit } },
9766
- { path: { sessionID: sessionId }, query: { limit } }
9764
+ { path: { sessionID: sessionId }, query: { limit } },
9765
+ { sessionID: sessionId, limit },
9766
+ { id: sessionId, limit }
9767
9767
  ];
9768
9768
  let firstError = null;
9769
9769
  for (const attempt of attempts) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defend-tech/opencode-optima",
3
- "version": "0.1.45",
3
+ "version": "0.1.46",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@github.com/defend-tech/opencode-optima.git"