@ordewell/core 0.4.11 → 0.4.13

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.mjs CHANGED
@@ -15,6 +15,7 @@ import {
15
15
  validatePlanModification
16
16
  } from "./chunk-UEJ3SZQ7.mjs";
17
17
  import {
18
+ CHECKPOINT_TRUNCATE_LENGTH,
18
19
  UPDATABLE_FIELDS,
19
20
  applyTaskOps,
20
21
  canMergeTasks,
@@ -26,12 +27,17 @@ import {
26
27
  dependencyCandidates,
27
28
  dependentsOf,
28
29
  effectiveAllowlist,
30
+ executionSummary,
29
31
  filterModelsForPrompt,
30
32
  parseTaskOpsJson,
33
+ serializePlan,
34
+ serializeTask,
35
+ serializeTaskStatus,
31
36
  summarizeToolCall,
32
37
  textHasTaskOps,
38
+ truncateCheckpointSummary,
33
39
  validateTaskEdit
34
- } from "./chunk-DNNZGH3I.mjs";
40
+ } from "./chunk-YTJ7EOV6.mjs";
35
41
  import {
36
42
  PLAN_ENVELOPE_KEY,
37
43
  PlanParseError,
@@ -7582,9 +7588,11 @@ function buildShellInvocation(command, args) {
7582
7588
  const inner = [command, ...args].map(posixShellQuote).join(" ");
7583
7589
  return { shellPath: "/bin/bash", shellArgs: ["-lc", inner] };
7584
7590
  }
7585
- function wrapWithPty(command, args) {
7591
+ function wrapWithPty(command, args, opts = {}) {
7586
7592
  const inner = [command, ...args].map(posixShellQuote).join(" ");
7587
- return { command: "script", args: ["-q", "-e", "-f", "-c", inner, "/dev/null"] };
7593
+ const watcher = opts.controlChannel ? 'exec 4<&0; ( while read -r C R <&3; do stty cols "$C" rows "$R" <&4; done ) & ' : "";
7594
+ const setup = opts.size ? `stty cols ${opts.size.cols} rows ${opts.size.rows}; ` : "";
7595
+ return { command: "script", args: ["-q", "-e", "-f", "-c", `${watcher}${setup}${inner}`, "/dev/null"] };
7588
7596
  }
7589
7597
 
7590
7598
  // src/utils/launch.ts
@@ -10893,53 +10901,6 @@ function createSkillsService(workspaceRoot) {
10893
10901
  return new SkillsService(workspaceRoot);
10894
10902
  }
10895
10903
 
10896
- // src/services/SessionMessage.ts
10897
- function serializeTask(t) {
10898
- return {
10899
- id: t.id,
10900
- order: t.order,
10901
- title: t.title,
10902
- type: t.type,
10903
- description: t.description,
10904
- dependencies: t.dependencies || [],
10905
- assignedRunner: t.assignedRunner,
10906
- assignedModel: t.assignedModel || null,
10907
- taskMode: t.taskMode || "build",
10908
- prompt: t.prompt || null,
10909
- subtasks: (t.subtasks || []).map(serializeTask),
10910
- userSteps: t.userSteps || void 0,
10911
- thinkingEffort: t.thinkingEffort || void 0,
10912
- autonomy: t.autonomy || void 0,
10913
- sliceType: t.sliceType || void 0,
10914
- userStoriesCovered: t.userStoriesCovered || void 0
10915
- };
10916
- }
10917
- function serializeTaskStatus(t, idleSince = null) {
10918
- return {
10919
- id: t.id,
10920
- status: t.status,
10921
- verdict: t.verdict ? { outcome: t.verdict.outcome, reason: t.verdict.reason, checks: t.verdict.checks || [] } : null,
10922
- idleSince
10923
- };
10924
- }
10925
- function serializePlan(plan) {
10926
- return {
10927
- tasks: plan.tasks.map(serializeTask),
10928
- runners: plan.runners,
10929
- generatedAt: plan.generatedAt,
10930
- conversationHistory: plan.conversationHistory,
10931
- prdMarkdown: plan.prdMarkdown,
10932
- queuedMessages: plan.queuedMessages
10933
- };
10934
- }
10935
- function executionSummary(tasks) {
10936
- return {
10937
- total: tasks.length,
10938
- completed: tasks.filter((t) => t.status === "completed").length,
10939
- failed: tasks.filter((t) => t.status === "failed").length
10940
- };
10941
- }
10942
-
10943
10904
  // src/utils/sessionStore.ts
10944
10905
  import * as fs6 from "fs";
10945
10906
  import * as path13 from "path";
@@ -12627,17 +12588,25 @@ var HeadlessSession = class extends AbstractTerminalSession {
12627
12588
  spawnImpl;
12628
12589
  process = null;
12629
12590
  outputBuffer = "";
12591
+ controlStream = null;
12630
12592
  get isStarted() {
12631
12593
  return this.process !== null;
12632
12594
  }
12633
- start(launch, cwd, resolvedPath, env) {
12595
+ start(launch, cwd, resolvedPath, env, options) {
12634
12596
  if (this.exited || this.process) return;
12597
+ const stdio = ["pipe", "pipe", "pipe"];
12598
+ if (options?.controlChannel) stdio.push("pipe");
12635
12599
  this.process = this.spawnImpl(launch.file, launch.args, {
12636
12600
  env: withPath(process.env, resolvedPath, env),
12637
- stdio: ["pipe", "pipe", "pipe"],
12601
+ stdio,
12638
12602
  cwd,
12639
12603
  windowsVerbatimArguments: launch.verbatim
12640
12604
  });
12605
+ if (options?.controlChannel) {
12606
+ this.controlStream = this.process.stdio?.[3] ?? null;
12607
+ this.controlStream?.on("error", () => {
12608
+ });
12609
+ }
12641
12610
  const onData = (data) => {
12642
12611
  const raw = data.toString();
12643
12612
  this.outputBuffer += stripAnsi(raw);
@@ -12670,6 +12639,12 @@ Process error: ${err.message}
12670
12639
  this.process.stdin.write(text);
12671
12640
  }
12672
12641
  }
12642
+ /** PTY resize requests from a surface that owns the terminal rendering the wrapper. */
12643
+ writeControl(text) {
12644
+ if (this.controlStream && !this.controlStream.destroyed) {
12645
+ this.controlStream.write(text);
12646
+ }
12647
+ }
12673
12648
  };
12674
12649
  var HeadlessRunner = class extends AbstractRunner {
12675
12650
  spawnImpl;
@@ -12695,7 +12670,7 @@ var HeadlessRunner = class extends AbstractRunner {
12695
12670
  return new HeadlessSession(id, taskId, this.spawnImpl);
12696
12671
  }
12697
12672
  /** Everything up to, but not including, spawning — so a surface that owns its own child reaches the same decisions. */
12698
- async prepareLaunch(opts) {
12673
+ async prepareLaunch(opts, ptyOptions) {
12699
12674
  const interactive = this.defaultInteractive;
12700
12675
  const invocation = buildRunnerInvocation({
12701
12676
  runner: opts.runner,
@@ -12712,7 +12687,7 @@ var HeadlessRunner = class extends AbstractRunner {
12712
12687
  const manifest = opts.registry?.get(opts.runner)?.manifest;
12713
12688
  const pty = (manifest?.runner.requiresTty === true || interactive) && this.hasScriptCmd();
12714
12689
  const resolvedPath = await this.resolvePath();
12715
- const { command, args } = pty ? wrapWithPty(invocation.command, invocation.args) : { command: invocation.command, args: invocation.args };
12690
+ const { command, args } = pty ? wrapWithPty(invocation.command, invocation.args, ptyOptions) : { command: invocation.command, args: invocation.args };
12716
12691
  return {
12717
12692
  launch: await planDirectLaunch(command, args, this.launchDeps),
12718
12693
  resolvedPath,
@@ -14031,6 +14006,7 @@ export {
14031
14006
  BaseAiService,
14032
14007
  BaseConfig,
14033
14008
  BaseFileSystem,
14009
+ CHECKPOINT_TRUNCATE_LENGTH,
14034
14010
  CLAUDE_CODE_MANIFEST,
14035
14011
  CLI_PROVIDERS,
14036
14012
  CMD_EXE_MAX_COMMAND_LINE,
@@ -14279,6 +14255,7 @@ export {
14279
14255
  toOrchestratorOptions,
14280
14256
  tokenSubprotocols,
14281
14257
  tokensMatch,
14258
+ truncateCheckpointSummary,
14282
14259
  truncatedPlanReEmitPrompt,
14283
14260
  updateTaskInPlan,
14284
14261
  validateModifiedPlan,