@krapht/ork 0.3.0 → 1.0.0-alpha.0

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 (39) hide show
  1. package/README.md +16 -12
  2. package/dist/__build_info__-DdTVd2p5.mjs +615 -0
  3. package/dist/bin.mjs +1572 -909
  4. package/dist/clean-NnboOuz6.mjs +88 -0
  5. package/dist/completion-snnYGjgK.mjs +405 -0
  6. package/dist/{context-BFGC_C02.mjs → context-DO3sBy9v.mjs} +30 -191
  7. package/dist/decide-B81wCZQg.mjs +113 -0
  8. package/dist/{find-BcvhT6UN.mjs → find-BKW-uGey.mjs} +1 -1
  9. package/dist/{format-DqpObyMl.mjs → format-CmTlTOjT.mjs} +72 -198
  10. package/dist/help-groups-BwYoAWsh.mjs +354 -0
  11. package/dist/{in-a-run-BbLhZOFW.mjs → in-a-run-BPXX09Bs.mjs} +1 -1
  12. package/dist/{limits-BKYAmqCR.mjs → limits-JCve2QpI.mjs} +1 -1
  13. package/dist/list-C7UEgmtd.mjs +110 -0
  14. package/dist/{mcp-BWsdQyri.mjs → mcp-CKPyNaKD.mjs} +7 -7
  15. package/dist/{output-Q2EdeVUt.mjs → output-B1V6ZJSx.mjs} +130 -36
  16. package/dist/{pause-DKACDfV1.mjs → pause-B_SL_yDz.mjs} +4 -4
  17. package/dist/{relay-CbK-Wme9.mjs → relay-o-Luee1c.mjs} +2 -2
  18. package/dist/remove-DAZ7ZCzt.mjs +194 -0
  19. package/dist/{send-C6yr04Fe.mjs → send-3B64fBNB.mjs} +3 -3
  20. package/dist/{src-D5ruZFgD.mjs → src-BJTegEzY.mjs} +1212 -57
  21. package/dist/{src-DtN1k-B3.mjs → src-C38BPzit.mjs} +251 -18
  22. package/dist/{src-Cz1yOUTg.mjs → src-DHvWU4tX.mjs} +2742 -1659
  23. package/dist/{src-CZOVF2yU.mjs → src-Dyz_Gy1q.mjs} +35 -8
  24. package/dist/ui/THIRD_PARTY_LICENSES.txt +2 -2
  25. package/dist/ui/assets/app-C8nJ6NpT.js +67 -0
  26. package/dist/ui/assets/app-CH7YC3in.css +1 -0
  27. package/dist/ui/assets/{index-BiO54L90.css → index-BPIbqRRb.css} +1 -1
  28. package/dist/ui/assets/{index-BoG6O-Lp.js → index-D83F2OKZ.js} +2 -2
  29. package/dist/ui/index.html +2 -3
  30. package/dist/ui-CY4xxJUu.mjs +472 -0
  31. package/dist/{usage-BIjf9Xdt.mjs → usage-CJnytoe4.mjs} +6 -5
  32. package/dist/{watch-B8o4Szd_.mjs → watch-BJB82ZJ7.mjs} +7 -7
  33. package/dist/workflows-CiM7S3l0.mjs +88 -0
  34. package/dist/worktrees-86ySXxR6.mjs +212 -0
  35. package/package.json +6 -6
  36. package/dist/__build_info__-CXXMLvjt.mjs +0 -104
  37. package/dist/ui/assets/app-BlDdP396.js +0 -61
  38. package/dist/ui/assets/app-C722xNZ3.css +0 -1
  39. package/dist/ui-CZS1XKla.mjs +0 -160
@@ -1,10 +1,15 @@
1
- import { Ct as FEEDBACK_SEVERITIES, D as parseReport, St as FEEDBACK_KINDS, wt as FEEDBACK_TARGETS } from "./src-Cz1yOUTg.mjs";
1
+ import { Bt as FEEDBACK_TARGETS, Rt as FEEDBACK_KINDS, pt as parseReport, zt as FEEDBACK_SEVERITIES } from "./src-DHvWU4tX.mjs";
2
2
  import { z } from "zod";
3
3
  import { randomBytes, timingSafeEqual } from "node:crypto";
4
4
  import { createInterface } from "node:readline";
5
5
  import { spawn } from "node:child_process";
6
6
  import { createServer } from "node:http";
7
7
  import { createSdkMcpServer, query, tool } from "@anthropic-ai/claude-agent-sdk";
8
+ // ../runtime-claude/src/cache-env.ts
9
+ /** Claude Code's switch for the one-hour prompt cache. */
10
+ const PROMPT_CACHE_1H = "ENABLE_PROMPT_CACHING_1H";
11
+ /** The variables a session adds to its driver's environment. */
12
+ const cacheEnv = (spec) => spec.promptCache === "1h" ? { [PROMPT_CACHE_1H]: "1" } : {};
8
13
  // ../runtime-claude/src/normalize.ts
9
14
  /**
10
15
  * @file Both drivers emit the same message JSON (the Agent SDK's messages are
@@ -520,8 +525,16 @@ const askUserTool = defineTool({
520
525
  context: z.string().optional().describe("What the user needs to know to decide, in a few sentences.")
521
526
  },
522
527
  run: async ({ nodeId, ports }, args) => {
528
+ let note;
529
+ let owner;
523
530
  const question = {
524
531
  nodeId,
532
+ onNote: (given) => {
533
+ note = given;
534
+ },
535
+ onOwner: (given) => {
536
+ owner = given;
537
+ },
525
538
  question: args.question,
526
539
  options: args.options.map((o) => {
527
540
  const choice = { id: o.id };
@@ -533,7 +546,8 @@ const askUserTool = defineTool({
533
546
  if (args.recommended !== void 0) question.recommended = args.recommended;
534
547
  if (args.context !== void 0) question.context = args.context;
535
548
  const answer = await ports.human.ask(question);
536
- return text(`The user chose: ${answer}`);
549
+ const who = owner === void 0 ? "The user" : `Your owner, \`${owner}\`,`;
550
+ return text(note === void 0 ? `${who} chose: ${answer}` : `${who} chose: ${answer}\nThey said: ${note}`);
537
551
  }
538
552
  });
539
553
  // ../runtime-claude/src/tools/claims.ts
@@ -707,11 +721,12 @@ const answerTool = defineTool({
707
721
  description: "Answer a question Ork asked you as the owner of a node, such as a loop of yours that ran out of rounds. The question's id and options are in Ork's message.",
708
722
  shape: {
709
723
  question: z.string().describe("The question's id, e.g. 'q1'."),
710
- choice: z.string().describe("One of its options.")
724
+ choice: z.string().describe("One of its options."),
725
+ note: z.string().optional().describe("Why, in a sentence or two; it is recorded with your answer.")
711
726
  },
712
727
  available: ({ ports }) => ports.mailbox !== void 0 && ports.ownership !== void 0,
713
728
  run: ({ ports }, args) => {
714
- const answered = ports.mailbox?.answer(args.question, args.choice);
729
+ const answered = ports.mailbox?.answer(args.question, args.choice, args.note);
715
730
  if (answered === void 0) return Promise.resolve(text("No questions."));
716
731
  return Promise.resolve(text(answered.ok ? `Answered ${args.question}: ${args.choice}.` : `Not answered: ${answered.error}.`));
717
732
  }
@@ -814,6 +829,7 @@ const buildCliArgs = (spec, mcp, allowed) => {
814
829
  [...spec.tools.allow, ...allowed].join(",")
815
830
  ];
816
831
  if (spec.tools.only !== void 0) args.push("--tools", spec.tools.only.join(","));
832
+ if (spec.tools.strictMcp === true) args.push("--strict-mcp-config");
817
833
  if (spec.agents !== void 0) args.push("--agents", JSON.stringify(spec.agents));
818
834
  if (spec.tools.deny.length > 0) args.push("--disallowedTools", spec.tools.deny.join(","));
819
835
  if (spec.model !== void 0) args.push("--model", spec.model);
@@ -821,6 +837,7 @@ const buildCliArgs = (spec, mcp, allowed) => {
821
837
  if (spec.maxTurns !== void 0) args.push("--max-turns", String(spec.maxTurns));
822
838
  if (spec.budgetUsd !== void 0) args.push("--max-budget-usd", String(spec.budgetUsd));
823
839
  if (spec.resume !== void 0) args.push("--resume", spec.resume);
840
+ if (spec.resume !== void 0 && spec.fork === true) args.push("--fork-session");
824
841
  for (const dir of spec.plugins ?? []) args.push("--plugin-dir", dir);
825
842
  const settings = mcp.holdUrl === void 0 ? spec.settings : withHoldHook(spec.settings, mcp.holdUrl, mcp.token);
826
843
  if (settings !== void 0) args.push("--settings", JSON.stringify(settings));
@@ -857,7 +874,10 @@ const createCliRuntime = (options = {}) => ({
857
874
  } : mcp;
858
875
  const legOf = (args, carried) => runLeg({
859
876
  bin: options.bin ?? "claude",
860
- env: options.env ?? process.env,
877
+ env: {
878
+ ...options.env ?? process.env,
879
+ ...cacheEnv(spec)
880
+ },
861
881
  cwd: spec.cwd,
862
882
  args,
863
883
  carried,
@@ -886,7 +906,8 @@ const createCliRuntime = (options = {}) => ({
886
906
  }
887
907
  args = buildCliArgs({
888
908
  ...spec,
889
- resume: leg.sessionId
909
+ resume: leg.sessionId,
910
+ fork: false
890
911
  }, endpoint, allowed);
891
912
  }
892
913
  } finally {
@@ -1015,7 +1036,10 @@ const buildSdkOptions = (spec, ports, env, held) => {
1015
1036
  });
1016
1037
  const options = {
1017
1038
  cwd: spec.cwd,
1018
- env: definedEnv(env),
1039
+ env: definedEnv({
1040
+ ...env,
1041
+ ...cacheEnv(spec)
1042
+ }),
1019
1043
  settingSources: spec.settingSources,
1020
1044
  systemPrompt: {
1021
1045
  type: "preset",
@@ -1046,12 +1070,14 @@ const buildSdkOptions = (spec, ports, env, held) => {
1046
1070
  }
1047
1071
  };
1048
1072
  if (spec.tools.only !== void 0) options.tools = spec.tools.only;
1073
+ if (spec.tools.strictMcp === true) options.strictMcpConfig = true;
1049
1074
  if (spec.agents !== void 0) options.agents = spec.agents;
1050
1075
  if (spec.model !== void 0) options.model = spec.model;
1051
1076
  if (spec.effort !== void 0) options.effort = spec.effort;
1052
1077
  if (spec.maxTurns !== void 0) options.maxTurns = spec.maxTurns;
1053
1078
  if (spec.budgetUsd !== void 0) options.maxBudgetUsd = spec.budgetUsd;
1054
1079
  if (spec.resume !== void 0) options.resume = spec.resume;
1080
+ if (spec.resume !== void 0 && spec.fork === true) options.forkSession = true;
1055
1081
  if (spec.plugins !== void 0) options.plugins = spec.plugins.map((dir) => ({
1056
1082
  type: "local",
1057
1083
  path: dir
@@ -1081,7 +1107,8 @@ const createSdkRuntime = (env = process.env, holdWindowMs) => ({
1081
1107
  deferring = false;
1082
1108
  const legSpec = resume === void 0 ? spec : {
1083
1109
  ...spec,
1084
- resume
1110
+ resume,
1111
+ fork: false
1085
1112
  };
1086
1113
  current = query({
1087
1114
  prompt: input,
@@ -424,7 +424,7 @@ SOFTWARE.
424
424
 
425
425
  ------------------------------------------------------------------------
426
426
 
427
- dockview-core 8.6.2 (MIT)
427
+ dockview-core 8.8.3 (MIT)
428
428
 
429
429
  MIT License
430
430
 
@@ -450,7 +450,7 @@ SOFTWARE.
450
450
 
451
451
  ------------------------------------------------------------------------
452
452
 
453
- dockview-react 8.6.2 (MIT)
453
+ dockview-react 8.8.3 (MIT)
454
454
 
455
455
  MIT License
456
456