@nextclaw/nextclaw-engine-codex-sdk 0.3.5 → 0.3.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/dist/index.js +12 -26
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { createRequire } from "node:module";
2
2
  import {
3
- buildRequestedSkillsUserPrompt,
3
+ buildBootstrapAwareUserPrompt,
4
+ readRequestedSkillsFromMetadata,
4
5
  resolveProviderRuntime,
5
6
  SkillsLoader
6
7
  } from "@nextclaw/core";
@@ -52,29 +53,6 @@ function readStringArray(input, key) {
52
53
  const normalized = value.map((entry) => typeof entry === "string" ? entry.trim() : "").filter(Boolean);
53
54
  return normalized.length > 0 ? normalized : void 0;
54
55
  }
55
- function readRequestedSkills(metadata) {
56
- if (!metadata) {
57
- return [];
58
- }
59
- const raw = metadata.requested_skills ?? metadata.requestedSkills;
60
- const values = [];
61
- if (Array.isArray(raw)) {
62
- for (const entry of raw) {
63
- if (typeof entry !== "string") {
64
- continue;
65
- }
66
- const trimmed = entry.trim();
67
- if (trimmed) {
68
- values.push(trimmed);
69
- }
70
- }
71
- } else if (typeof raw === "string") {
72
- values.push(
73
- ...raw.split(/[,\s]+/g).map((entry) => entry.trim()).filter(Boolean)
74
- );
75
- }
76
- return Array.from(new Set(values)).slice(0, 8);
77
- }
78
56
  function readReasoningEffort(input, key) {
79
57
  const value = readString(input, key);
80
58
  if (value === "minimal" || value === "low" || value === "medium" || value === "high" || value === "xhigh") {
@@ -162,7 +140,7 @@ class PluginCodexSdkEngine {
162
140
  const channel = typeof params.channel === "string" && params.channel.trim() ? params.channel : "cli";
163
141
  const chatId = typeof params.chatId === "string" && params.chatId.trim() ? params.chatId : "direct";
164
142
  const model = readString(params.metadata ?? {}, "model") ?? this.defaultModel;
165
- const requestedSkills = readRequestedSkills(params.metadata ?? {});
143
+ const requestedSkills = readRequestedSkillsFromMetadata(params.metadata ?? {});
166
144
  const session = this.options.sessionManager.getOrCreate(sessionKey);
167
145
  const userExtra = { channel, chatId };
168
146
  if (requestedSkills.length > 0) {
@@ -170,7 +148,14 @@ class PluginCodexSdkEngine {
170
148
  }
171
149
  const userEvent = this.options.sessionManager.addMessage(session, "user", params.content, userExtra);
172
150
  params.onSessionEvent?.(userEvent);
173
- const prompt = buildRequestedSkillsUserPrompt(this.skillsLoader, requestedSkills, params.content);
151
+ const prompt = buildBootstrapAwareUserPrompt({
152
+ workspace: this.options.workspace,
153
+ contextConfig: this.options.contextConfig,
154
+ sessionKey,
155
+ skills: this.skillsLoader,
156
+ skillNames: requestedSkills,
157
+ userMessage: params.content
158
+ });
174
159
  const thread = await this.resolveThread(sessionKey, model);
175
160
  const streamed = await thread.runStreamed(prompt, {
176
161
  ...params.abortSignal ? { signal: params.abortSignal } : {}
@@ -287,6 +272,7 @@ const plugin = {
287
272
  sessionManager: context.sessionManager,
288
273
  model,
289
274
  workspace: context.workspace,
275
+ contextConfig: context.config.agents.context,
290
276
  apiKey: resolved.apiKey,
291
277
  apiBase: resolved.apiBase,
292
278
  codexPathOverride: readString(engineConfig, "codexPathOverride"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/nextclaw-engine-codex-sdk",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "private": false,
5
5
  "description": "NextClaw Codex engine plugin backed by OpenAI Codex SDK.",
6
6
  "type": "module",