@cnwenf/occ 2.1.264 → 2.1.266

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/cli.js +111 -30
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bun
2
- globalThis.MACRO={"VERSION":"2.1.264","BUILD_TIME":"2026-07-10T08:54:12.006Z","FEEDBACK_CHANNEL":"","ISSUES_EXPLAINER":"","NATIVE_PACKAGE_URL":"","PACKAGE_URL":"@cnwenf/occ","VERSION_CHANGELOG":""};
2
+ globalThis.MACRO={"VERSION":"2.1.266","BUILD_TIME":"2026-07-10T10:40:16.259Z","FEEDBACK_CHANNEL":"","ISSUES_EXPLAINER":"","NATIVE_PACKAGE_URL":"","PACKAGE_URL":"@cnwenf/occ","VERSION_CHANGELOG":""};
3
3
  // @bun
4
4
  var __create = Object.create;
5
5
  var __getProtoOf = Object.getPrototypeOf;
@@ -190875,6 +190875,36 @@ function isUltracodeEnabled() {
190875
190875
  }
190876
190876
  function enableUltracodeForSession() {
190877
190877
  ultracodeActive = true;
190878
+ ultracodeJustEnabled = true;
190879
+ ultracodeJustDisabled = false;
190880
+ }
190881
+ function disableUltracodeForSession() {
190882
+ if (ultracodeActive || readEnvUltracode()) {
190883
+ ultracodeJustDisabled = true;
190884
+ }
190885
+ ultracodeActive = false;
190886
+ ultracodeJustEnabled = false;
190887
+ }
190888
+ function getUltracodeTurnReminders() {
190889
+ const reminders = [];
190890
+ if (ultracodeJustDisabled) {
190891
+ reminders.push({ content: ULTRACODE_EXIT_REMINDER, isMeta: true });
190892
+ ultracodeJustDisabled = false;
190893
+ return reminders;
190894
+ }
190895
+ if (!isUltracodeEnabled())
190896
+ return reminders;
190897
+ if (ultracodeJustEnabled) {
190898
+ reminders.push({
190899
+ content: ULTRACODE_WORKFLOW_KEYWORD_REQUEST,
190900
+ isMeta: true
190901
+ });
190902
+ reminders.push(getUltracodeReminderObject("full"));
190903
+ ultracodeJustEnabled = false;
190904
+ } else {
190905
+ reminders.push(getUltracodeReminderObject("still"));
190906
+ }
190907
+ return reminders;
190878
190908
  }
190879
190909
  function shouldTriggerUltracodeFromPrompt(input) {
190880
190910
  if (isUltracodeEnabled())
@@ -190883,7 +190913,7 @@ function shouldTriggerUltracodeFromPrompt(input) {
190883
190913
  return false;
190884
190914
  return detectUltracodeKeyword(input);
190885
190915
  }
190886
- var ULTRACODE_KEYWORD = "ultracode", ENABLE_ULTRACODE_DESCRIPTION, ULTRACODE_EFFORT_DESCRIPTION = "xhigh effort + dynamic workflows for maximum thoroughness", ULTRACODE_EFFORT_DISPLAY, ULTRACODE_ACTIVATION_MESSAGE = "ultracode (xhigh effort plus standing dynamic-workflow orchestration) is active for the session. Set per session via the `ultracode` settings key (--settings or apply_flag_settings).", ULTRACODE_REMINDER_FULL = "Ultracode is on: optimize for the most exhaustive, correct answer \u2014 not the fastest or cheapest. Use the Workflow tool on every substantive task; token cost is not a constraint. See the Workflow tool's **Ultracode** section and quality patterns. Solo only on conversational/trivial turns.", ULTRACODE_REMINDER_STILL = "Ultracode is still on \u2014 use the Workflow tool; see its Ultracode section.", ultracodeActive = false;
190916
+ var ULTRACODE_KEYWORD = "ultracode", ENABLE_ULTRACODE_DESCRIPTION, ULTRACODE_EFFORT_DESCRIPTION = "xhigh effort + dynamic workflows for maximum thoroughness", ULTRACODE_EFFORT_DISPLAY, ULTRACODE_ACTIVATION_MESSAGE = "ultracode (xhigh effort plus standing dynamic-workflow orchestration) is active for the session. Set per session via the `ultracode` settings key (--settings or apply_flag_settings).", ULTRACODE_REMINDER_FULL = "Ultracode is on: optimize for the most exhaustive, correct answer \u2014 not the fastest or cheapest. Use the Workflow tool on every substantive task; token cost is not a constraint. See the Workflow tool's **Ultracode** section and quality patterns. Solo only on conversational/trivial turns.", ULTRACODE_REMINDER_STILL = "Ultracode is still on \u2014 use the Workflow tool; see its Ultracode section.", ULTRACODE_WORKFLOW_KEYWORD_REQUEST = 'The user included the keyword "ultracode", opting this turn into multi-agent orchestration \u2014 use the Workflow tool to fulfill the request.', ULTRACODE_EXIT_REMINDER = "Ultracode is off \u2014 the Workflow tool's standard opt-in rule applies again.", ultracodeActive = false, ultracodeJustEnabled = false, ultracodeJustDisabled = false;
190887
190917
  var init_ultracode = __esm(() => {
190888
190918
  ENABLE_ULTRACODE_DESCRIPTION = "Enable ultracode for the session: xhigh effort plus standing dynamic-workflow orchestration. " + "Session-scoped \u2014 typically provided via --settings or the apply_flag_settings control request; " + "interactive toggles never persist it. Requires workflows to be enabled and an xhigh-capable model.";
190889
190919
  ULTRACODE_EFFORT_DISPLAY = `ultracode \xB7 ${ULTRACODE_EFFORT_DESCRIPTION}`;
@@ -190901,10 +190931,8 @@ function setSystemPromptInjection(value) {
190901
190931
  function shouldUseLeanSystemPrompt(model, effort) {
190902
190932
  return shouldUseLeanPrompt(model, effort);
190903
190933
  }
190904
- function getUltracodeSystemReminder() {
190905
- if (!isUltracodeEnabled())
190906
- return null;
190907
- return getUltracodeReminderObject("full");
190934
+ function getUltracodeSystemReminders() {
190935
+ return getUltracodeTurnReminders();
190908
190936
  }
190909
190937
  var MAX_STATUS_CHARS = 2000, systemPromptInjection = null, getGitStatus, getSystemContext, getUserContext;
190910
190938
  var init_context2 = __esm(() => {
@@ -582989,6 +583017,7 @@ var init_bundled = __esm(() => {
582989
583017
  var exports_scriptLoader = {};
582990
583018
  __export(exports_scriptLoader, {
582991
583019
  validateScriptPath: () => validateScriptPath,
583020
+ loadScriptFromSource: () => loadScriptFromSource,
582992
583021
  loadScript: () => loadScript,
582993
583022
  WorkflowScriptError: () => WorkflowScriptError
582994
583023
  });
@@ -583102,23 +583131,16 @@ function extractDefaultExport(body) {
583102
583131
  const expr = m5[2].replace(/;\s*$/, "");
583103
583132
  return { hasDefaultExport: true, defaultExportExpr: expr, body };
583104
583133
  }
583105
- function loadScript(scriptPath) {
583106
- const resolved = validateScriptPath(scriptPath);
583107
- let source2;
583108
- try {
583109
- source2 = readFileSync26(resolved, "utf8");
583110
- } catch (e4) {
583111
- const err2 = e4;
583112
- throw new WorkflowScriptError(`Failed to read workflow script ${scriptPath}: ${err2.message}`);
583113
- }
583134
+ function loadScriptFromSource(source2, scriptPath) {
583135
+ const label = scriptPath ?? "<inline>";
583114
583136
  if (!source2.trim()) {
583115
- throw new WorkflowScriptError(`Workflow script ${scriptPath} is empty`);
583137
+ throw new WorkflowScriptError(`Workflow script ${label} is empty`);
583116
583138
  }
583117
583139
  const { metaJson, bodyStart } = extractMetaStatement(source2);
583118
583140
  const meta3 = parseMeta(metaJson);
583119
583141
  let body = source2.slice(bodyStart).trim();
583120
583142
  if (!body) {
583121
- throw new WorkflowScriptError(`Workflow script ${scriptPath} has no body after \`export const meta\``);
583143
+ throw new WorkflowScriptError(`Workflow script ${label} has no body after \`export const meta\``);
583122
583144
  }
583123
583145
  validateBodyDeterminism(body);
583124
583146
  const { hasDefaultExport, defaultExportExpr, body: cleanedBody } = extractDefaultExport(body);
@@ -583127,10 +583149,24 @@ function loadScript(scriptPath) {
583127
583149
  body: cleanedBody,
583128
583150
  hasDefaultExport,
583129
583151
  defaultExportExpr,
583130
- scriptPath: resolved,
583152
+ scriptPath: scriptPath ?? "<inline>",
583131
583153
  source: source2
583132
583154
  };
583133
583155
  }
583156
+ function loadScript(scriptPath) {
583157
+ const resolved = validateScriptPath(scriptPath);
583158
+ let source2;
583159
+ try {
583160
+ source2 = readFileSync26(resolved, "utf8");
583161
+ } catch (e4) {
583162
+ const err2 = e4;
583163
+ if (err2.code === "ENOENT") {
583164
+ throw new WorkflowScriptError(`Workflow script file not found: ${scriptPath}. ` + "Create the file first (Write tool, or via shell if Write is unavailable), " + "then retry with the same path. The script must begin with " + "`export const meta = { name, description, phases }` and export a default " + "async function: `export default async ({ agent, parallel, pipeline, phase, " + "log, budget, workflow, resolveWorkflow, args }) => { ... }`.");
583165
+ }
583166
+ throw new WorkflowScriptError(`Failed to read workflow script ${scriptPath}: ${err2.message}`);
583167
+ }
583168
+ return loadScriptFromSource(source2, resolved);
583169
+ }
583134
583170
  var WorkflowScriptError;
583135
583171
  var init_scriptLoader = __esm(() => {
583136
583172
  WorkflowScriptError = class WorkflowScriptError extends Error {
@@ -584340,7 +584376,26 @@ function buildWorkflowProgressHandler(runId, seedPhases, emit2, onAgentEvent) {
584340
584376
  });
584341
584377
  };
584342
584378
  }
584343
- var import_react83, inputSchema41, outputSchema37, DESCRIPTION22 = `Run a multi-step workflow from a self-contained JavaScript script. The script runs in a sandboxed vm with access to primitives: agent(prompt, opts?) to spawn a subagent, parallel(items) for concurrent execution (max 4096 items, ~10 concurrent), pipeline(items, ...stages) for streaming, phase(title) to group agents, log(...args) for workflow-scoped logging, budget {total, remaining(), spent()} for token caps, and workflow(nameOrRef) / resolveWorkflow(name) for sub-workflows. Scripts are deterministic for resume (no Date/Math.random/import). Use the Workflow tool on substantive multi-agent tasks.`, WorkflowTool;
584379
+ var import_react83, inputSchema41, outputSchema37, DESCRIPTION22 = `Run a multi-step workflow from a self-contained JavaScript script. The script runs in a sandboxed vm with access to primitives: agent(prompt, opts?) to spawn a subagent, parallel(items) for concurrent execution (max 4096 items, ~10 concurrent), pipeline(items, ...stages) for streaming, phase(title) to group agents, log(...args) for workflow-scoped logging, budget {total, remaining(), spent()} for token caps, and workflow(nameOrRef) / resolveWorkflow(name) for sub-workflows. Scripts are deterministic for resume (no Date/Math.random/import). Use the Workflow tool on substantive multi-agent tasks.
584380
+
584381
+ - Ultracode is on for the session (a system-reminder confirms it) \u2014 see **Ultracode** below.
584382
+
584383
+ **Ultracode.** When a system-reminder confirms ultracode is on, that opt-in is standing: author and run a workflow for every substantive task by default. The goal is the most exhaustive, correct answer you can produce \u2014 token cost is not a constraint. For multi-phase work (understand \u2192 design \u2192 implement \u2192 review), that often means several workflows in sequence \u2014 one per phase \u2014 so you stay in the loop between them. The quality patterns below (adversarial verify, multi-modal sweep, completeness critic, loop-until-dry) are the tools; pick what fits the task. Lean toward orchestrating with workflows and adversarially verifying your findings \u2014 unless the work is trivial or already verified. Solo only on conversational turns or trivial mechanical edits. When a reminder says ultracode is off, revert to the opt-in rule above.
584384
+
584385
+ Quality patterns:
584386
+ - Adversarial verify: spawn N independent skeptics per finding, each prompted to REFUTE. Kill if \u2265majority refute. Prevents plausible-but-wrong findings from surviving.
584387
+ - Loop-until-dry: for unknown-size discovery (bugs, issues, edge cases), keep spawning finders until K consecutive rounds return nothing new. Simple counters (while count < N) miss the tail.
584388
+ - Multi-modal sweep: parallel agents each searching a different way (by-container, by-content, by-entity, by-time). Each is blind to what the others surface; useful when one search angle won't find everything.
584389
+ - Completeness critic: a final agent that asks "what's missing \u2014 modality not run, claim unverified, source unread?" What it finds becomes the next round of work.
584390
+ - **Research** \u2014 multi-modal sweep \u2192 deep-read \u2192 synthesize
584391
+
584392
+ Composing patterns \u2014 exhaustive review (find \u2192 dedup vs seen \u2192 diverse-lens panel \u2192 loop-until-dry):
584393
+ while (dry < 2) { // loop-until-dry
584394
+ found = await agent(\`find more in bucket \${bucket}\`) // multi-modal sweep (by bucket)
584395
+ novel = dedupVsSeen(found) // dedup vs seen
584396
+ panel = await parallel(lenses.map(L => agent(\`critique as \${L}\`))) // diverse-lens panel
584397
+ dry = novel.length === 0 ? dry + 1 : 0 // reset on any hit
584398
+ }`, WorkflowTool;
584344
584399
  var init_WorkflowTool = __esm(() => {
584345
584400
  init_v4();
584346
584401
  init_ink2();
@@ -584357,7 +584412,8 @@ var init_WorkflowTool = __esm(() => {
584357
584412
  init_wfProgress();
584358
584413
  import_react83 = __toESM(require_react(), 1);
584359
584414
  inputSchema41 = lazySchema(() => exports_external.object({
584360
- scriptPath: exports_external.string().optional().describe("Absolute path to a self-contained workflow script (.js). The script must begin with `export const meta = { name, description, phases }` and export a default async function receiving { agent, parallel, pipeline, phase, log, budget, workflow, resolveWorkflow, args }. Optional if `name` is provided."),
584415
+ scriptPath: exports_external.string().optional().describe("Absolute path to a self-contained workflow script (.js). The script must begin with `export const meta = { name, description, phases }` and export a default async function receiving { agent, parallel, pipeline, phase, log, budget, workflow, resolveWorkflow, args }. Optional if `name` or `script` is provided."),
584416
+ script: exports_external.string().optional().describe("Self-contained workflow script. Must begin with `export const meta = { name, description, phases }` (pure literal, no computed values) followed by the script body using agent()/parallel()/pipeline()/phase()."),
584361
584417
  args: exports_external.record(exports_external.string(), exports_external.unknown()).optional().describe("Arguments object passed to the workflow as `args`."),
584362
584418
  resumeFromRunId: exports_external.string().regex(/^wf_[a-z0-9-]{6,}$/).optional().describe("Resume a previous workflow run by its run ID (wf_...). Completed agent() calls with unchanged (prompt, opts) return their cached results instantly; only edited or new calls re-run."),
584363
584419
  name: exports_external.string().optional().describe("Name of a predefined workflow (built-in or from .claude/workflows/). Resolves to a self-contained script."),
@@ -584381,7 +584437,9 @@ var init_WorkflowTool = __esm(() => {
584381
584437
  return `${DESCRIPTION22} ${sizeHint} (Per the dynamicWorkflowSize setting \u2014 advisory, not a cap.)`;
584382
584438
  },
584383
584439
  async prompt() {
584384
- return `Use this tool to run a workflow script. The script must start with \`export const meta = { name, description, phases }\` and export a default async function: \`export default async ({ agent, parallel, pipeline, phase, log, budget, workflow, resolveWorkflow, args }) => { ... }\`.`;
584440
+ return `${DESCRIPTION22}
584441
+
584442
+ Use this tool to run a workflow script. The script must start with \`export const meta = { name, description, phases }\` and export a default async function: \`export default async ({ agent, parallel, pipeline, phase, log, budget, workflow, resolveWorkflow, args }) => { ... }\`.`;
584385
584443
  },
584386
584444
  get inputSchema() {
584387
584445
  return inputSchema41();
@@ -584455,6 +584513,12 @@ var init_WorkflowTool = __esm(() => {
584455
584513
  decisionReason: { type: "other", reason: "invalid script path" }
584456
584514
  };
584457
584515
  }
584516
+ } else if (input2.script) {
584517
+ return {
584518
+ behavior: "ask",
584519
+ message: `Run the inline workflow script?`,
584520
+ updatedInput: input2
584521
+ };
584458
584522
  }
584459
584523
  return {
584460
584524
  behavior: "ask",
@@ -584492,20 +584556,21 @@ ${typeof result === "string" ? result : JSON.stringify(result, null, 2)}`
584492
584556
  };
584493
584557
  },
584494
584558
  async call(input2, context7, canUseTool, _parentMessage, onProgress) {
584495
- const { scriptPath: rawScriptPath, args, resumeFromRunId, name: name3, remote } = input2;
584496
- let resolvedScriptPath;
584559
+ const { scriptPath: rawScriptPath, script, args, resumeFromRunId, name: name3, remote } = input2;
584560
+ let loaded;
584497
584561
  if (name3) {
584498
584562
  const found = resolveWorkflowScript(name3);
584499
584563
  if (!found) {
584500
584564
  throw new Error(`Workflow tool: could not resolve workflow "${name3}". Add scripts to .claude/workflows/ (project) or ~/.claude/workflows/ (user).`);
584501
584565
  }
584502
- resolvedScriptPath = found;
584566
+ loaded = loadScript(found);
584503
584567
  } else if (rawScriptPath) {
584504
- resolvedScriptPath = validateScriptPath(rawScriptPath);
584568
+ loaded = loadScript(validateScriptPath(rawScriptPath));
584569
+ } else if (script) {
584570
+ loaded = loadScriptFromSource(script);
584505
584571
  } else {
584506
- throw new Error("Workflow tool requires either `scriptPath` or `name`.");
584572
+ throw new Error("Workflow tool requires one of `script`, `scriptPath`, or `name`.");
584507
584573
  }
584508
- const loaded = loadScript(resolvedScriptPath);
584509
584574
  let runId;
584510
584575
  if (resumeFromRunId) {
584511
584576
  if (!isValidWorkflowRunId(resumeFromRunId)) {
@@ -595990,9 +596055,10 @@ async function* queryLoop(params, consumedCommandUuids) {
595990
596055
  try {
595991
596056
  let streamingFallbackOccured = false;
595992
596057
  queryCheckpoint("query_api_streaming_start");
595993
- const ultracodeReminder = getUltracodeSystemReminder();
595994
- const messagesForApi = ultracodeReminder !== null ? [
595995
- buildHarnessReminderMessage(ultracodeReminder, currentModel),
596058
+ const ultracodeReminders = getUltracodeSystemReminders();
596059
+ const ultracodeMessages = ultracodeReminders.map((r4) => buildHarnessReminderMessage(r4, currentModel));
596060
+ const messagesForApi = ultracodeMessages.length > 0 ? [
596061
+ ...ultracodeMessages,
595996
596062
  ...prependUserContext(messagesForQuery, userContext)
595997
596063
  ] : prependUserContext(messagesForQuery, userContext);
595998
596064
  for await (const message of deps.callModel({
@@ -707832,6 +707898,9 @@ function enableUltracode() {
707832
707898
  function executeEffort(args) {
707833
707899
  const normalized = args.toLowerCase();
707834
707900
  if (normalized === "auto" || normalized === "unset") {
707901
+ if (isUltracodeEnabled()) {
707902
+ disableUltracodeForSession();
707903
+ }
707835
707904
  return unsetEffortLevel();
707836
707905
  }
707837
707906
  if (normalized === "ultracode") {
@@ -707842,6 +707911,9 @@ function executeEffort(args) {
707842
707911
  message: `Invalid argument: ${args}. Valid options are: low, medium, high, max, ultracode, auto`
707843
707912
  };
707844
707913
  }
707914
+ if (isUltracodeEnabled()) {
707915
+ disableUltracodeForSession();
707916
+ }
707845
707917
  return setEffortValue(normalized);
707846
707918
  }
707847
707919
  function ShowCurrentEffort(t0) {
@@ -785298,6 +785370,7 @@ function useInstallMessages() {
785298
785370
  useStartupNotification(_temp285);
785299
785371
  }
785300
785372
  async function _temp285() {
785373
+ return null;
785301
785374
  const messages = await checkInstall();
785302
785375
  return messages.map(_temp206);
785303
785376
  }
@@ -790021,6 +790094,7 @@ function useNpmDeprecationNotification() {
790021
790094
  useStartupNotification(_temp295);
790022
790095
  }
790023
790096
  async function _temp295() {
790097
+ return null;
790024
790098
  if (isInBundledMode() || isEnvTruthy(process.env.DISABLE_INSTALLATION_CHECKS)) {
790025
790099
  return null;
790026
790100
  }
@@ -809076,6 +809150,12 @@ Startup time: ${Math.round(process.uptime() * 1000)}ms
809076
809150
  `);
809077
809151
  process.exit(0);
809078
809152
  }
809153
+ if (typeof inputPrompt === "string" && shouldTriggerUltracodeFromPrompt(inputPrompt)) {
809154
+ enableUltracodeForSession();
809155
+ logEvent2("tengu_ultracode_keyword_triggered", {
809156
+ source: "headless_prompt"
809157
+ });
809158
+ }
809079
809159
  if (feature("DOWNLOAD_USER_SETTINGS") && (isEnvTruthy(process.env.CLAUDE_CODE_REMOTE) || getIsRemoteMode())) {
809080
809160
  downloadUserSettings();
809081
809161
  }
@@ -812022,6 +812102,7 @@ var init_print = __esm(() => {
812022
812102
  init_remoteManagedSettings();
812023
812103
  init_structuredIO();
812024
812104
  init_remoteIO();
812105
+ init_ultracode();
812025
812106
  init_commands5();
812026
812107
  init_streamlinedTransform();
812027
812108
  init_streamJsonStdoutGuard();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cnwenf/occ",
3
- "version": "2.1.264",
3
+ "version": "2.1.266",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "bin": {