@kitman-sh/cli 0.10.81 → 0.10.82

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 (26) hide show
  1. package/dist/{chunk-scabqmnx.js → chunk-2mxpxw3j.js} +3 -3
  2. package/dist/{chunk-tbgxe3w0.js → chunk-5my30s53.js} +8 -8
  3. package/dist/{chunk-aj4ev9v2.js → chunk-62565d52.js} +2 -2
  4. package/dist/{chunk-maj4dn1b.js → chunk-76ctrqm6.js} +1 -1
  5. package/dist/{chunk-52209e52.js → chunk-8p0psats.js} +4 -4
  6. package/dist/{chunk-ybp1mwv9.js → chunk-98sg1yyd.js} +60 -14
  7. package/dist/{chunk-5dwyvg1z.js → chunk-9zd52pda.js} +5 -5
  8. package/dist/{chunk-f5mmvr81.js → chunk-a03wf71k.js} +7 -7
  9. package/dist/{chunk-xk8qzgn7.js → chunk-by4t402z.js} +25 -25
  10. package/dist/{chunk-a10dn5vf.js → chunk-d4atn90g.js} +23 -23
  11. package/dist/{chunk-dmwqvnmb.js → chunk-e8zm8z3a.js} +8 -8
  12. package/dist/{chunk-vne4rsj0.js → chunk-fq47a5yd.js} +2 -2
  13. package/dist/{chunk-symx9akd.js → chunk-gn0v83as.js} +115 -115
  14. package/dist/{chunk-caqesagt.js → chunk-jbwk6k6m.js} +28 -70
  15. package/dist/{chunk-q0gqkem3.js → chunk-jr1363cj.js} +5 -5
  16. package/dist/{chunk-p74pmd81.js → chunk-kgdppbdr.js} +1 -1
  17. package/dist/{chunk-cw2ghw7n.js → chunk-ky974pcr.js} +4 -4
  18. package/dist/{chunk-bjbphmyt.js → chunk-pkn6g975.js} +4 -4
  19. package/dist/{chunk-4325dpky.js → chunk-q4cpages.js} +5 -5
  20. package/dist/{chunk-ym8t1vr6.js → chunk-q767c0cv.js} +7 -7
  21. package/dist/{chunk-zktywann.js → chunk-szf97jdk.js} +21 -21
  22. package/dist/{chunk-1mcwey0c.js → chunk-tzz4fv17.js} +1 -1
  23. package/dist/{chunk-w9j2yb0n.js → chunk-xb70ys3n.js} +17 -17
  24. package/dist/{chunk-5tezkbn0.js → chunk-zzhewave.js} +111 -124
  25. package/dist/index.js +4 -4
  26. package/package.json +1 -1
@@ -102,7 +102,7 @@ import {
102
102
  decodeJsonStringOption,
103
103
  encodeJsonStringSync,
104
104
  encodePrettyJsonString
105
- } from "./chunk-caqesagt.js";
105
+ } from "./chunk-jbwk6k6m.js";
106
106
  import {
107
107
  currentTimeMillis,
108
108
  SecureRandom,
@@ -142,8 +142,8 @@ import {
142
142
  sessionForApi,
143
143
  readAuthStore,
144
144
  agentCredentialForApi,
145
- make5,
146
145
  make6,
146
+ make7,
147
147
  Service,
148
148
  shouldRefresh,
149
149
  refreshSession,
@@ -154,19 +154,18 @@ import {
154
154
  runMcpEffect,
155
155
  createAgentAuthSignedFetch,
156
156
  setupMcpAgentCredential
157
- } from "./chunk-symx9akd.js";
157
+ } from "./chunk-gn0v83as.js";
158
158
  import {
159
159
  guard,
160
160
  Id,
161
161
  Timestamp,
162
162
  ActorType
163
- } from "./chunk-p74pmd81.js";
163
+ } from "./chunk-kgdppbdr.js";
164
164
  import {
165
165
  toJsonValue,
166
166
  isOneOf,
167
167
  isKeyOf,
168
168
  toJsonObject,
169
- isBigInt,
170
169
  isBoolean,
171
170
  isFunction,
172
171
  isNumber,
@@ -174,7 +173,7 @@ import {
174
173
  isJsonObject,
175
174
  isString,
176
175
  kindOf
177
- } from "./chunk-1mcwey0c.js";
176
+ } from "./chunk-tzz4fv17.js";
178
177
  import {
179
178
  join,
180
179
  interrupt,
@@ -188,17 +187,17 @@ import {
188
187
  withDefault,
189
188
  option,
190
189
  String2
191
- } from "./chunk-w9j2yb0n.js";
190
+ } from "./chunk-xb70ys3n.js";
192
191
  import {
193
192
  nextInt
194
- } from "./chunk-maj4dn1b.js";
193
+ } from "./chunk-76ctrqm6.js";
195
194
  import {
196
195
  layerJson,
197
- make3,
196
+ make4,
198
197
  withHeaders,
199
198
  layerProtocolSocket,
200
199
  ConnectionHooks
201
- } from "./chunk-4325dpky.js";
200
+ } from "./chunk-q4cpages.js";
202
201
 
203
202
  // apps/cli/src/mcp.ts
204
203
  import { tmpdir } from "os";
@@ -1950,56 +1949,56 @@ var LivePresenceSubscriptionMessage = Union([
1950
1949
  LivePresenceSubscriptionUpdate
1951
1950
  ]);
1952
1951
 
1953
- class LiveRpcs extends make6(make5("Session", {
1952
+ class LiveRpcs extends make7(make6("Session", {
1954
1953
  success: Struct({ workspaceId: String4, clientKind: String4 }),
1955
1954
  error: LiveRpcError
1956
- }), make5("Subscribe", {
1955
+ }), make6("Subscribe", {
1957
1956
  payload: LiveSubscribeInput,
1958
1957
  success: LiveSubscriptionMessage,
1959
1958
  error: LiveRpcError,
1960
1959
  stream: true
1961
- }), make5("Replay", {
1960
+ }), make6("Replay", {
1962
1961
  payload: LiveReplayInput,
1963
1962
  success: ArraySchema(LiveEvent),
1964
1963
  error: LiveRpcError
1965
- }), make5("Ack", {
1964
+ }), make6("Ack", {
1966
1965
  payload: LiveAckInput,
1967
1966
  success: LiveAckResult,
1968
1967
  error: LiveRpcError
1969
- }), make5("SubscribeWeb", {
1968
+ }), make6("SubscribeWeb", {
1970
1969
  payload: LiveWebSubscribeInput,
1971
1970
  success: LiveWebSubscriptionMessage,
1972
1971
  error: LiveRpcError,
1973
1972
  stream: true
1974
- }), make5("SubscriptionStatus", {
1973
+ }), make6("SubscriptionStatus", {
1975
1974
  payload: { subscriptionId: String4 },
1976
1975
  success: LiveSubscriptionStatus,
1977
1976
  error: LiveRpcError
1978
- }), make5("ReplayWeb", {
1977
+ }), make6("ReplayWeb", {
1979
1978
  payload: LiveWebReplayInput,
1980
1979
  success: LiveWebReplayResult,
1981
1980
  error: LiveRpcError
1982
- }), make5("AckWeb", {
1981
+ }), make6("AckWeb", {
1983
1982
  payload: LiveWebAckInput,
1984
1983
  success: LiveWebAckResult,
1985
1984
  error: LiveRpcError
1986
- }), make5("PublishPresence", {
1985
+ }), make6("PublishPresence", {
1987
1986
  payload: LivePresencePublishInput,
1988
1987
  success: LivePresenceEntry,
1989
1988
  error: LiveRpcError
1990
- }), make5("SubscribePresence", {
1989
+ }), make6("SubscribePresence", {
1991
1990
  payload: LivePresenceSubscribeInput,
1992
1991
  success: LivePresenceSubscriptionMessage,
1993
1992
  error: LiveRpcError,
1994
1993
  stream: true
1995
- }), make5("ClearPresence", {
1994
+ }), make6("ClearPresence", {
1996
1995
  payload: { scope: optional(LiveScope) },
1997
1996
  error: LiveRpcError
1998
- }), make5("RecordSessionUpdate", {
1997
+ }), make6("RecordSessionUpdate", {
1999
1998
  payload: { sessionId: String4, input: SessionUpdateCreate },
2000
1999
  success: SessionUpdate,
2001
2000
  error: LiveRpcError
2002
- }), make5("EndSession", {
2001
+ }), make6("EndSession", {
2003
2002
  payload: { sessionId: String4, input: SessionEnd },
2004
2003
  success: Session,
2005
2004
  error: LiveRpcError
@@ -2051,7 +2050,7 @@ function connectKitmanLiveRoot(protocol) {
2051
2050
  })
2052
2051
  });
2053
2052
  const layer = (isString(protocol) ? liveWebSocketProtocol(protocol) : protocol()).pipe(provideMerge(hooks));
2054
- const client = await runPromise(buildWithScope(layer, scope).pipe(flatMap3((context) => make3(LiveRpcs).pipe(provideContext2(context))), provide(scope)));
2053
+ const client = await runPromise(buildWithScope(layer, scope).pipe(flatMap3((context) => make4(LiveRpcs).pipe(provideContext2(context))), provide(scope)));
2055
2054
  let abandon = () => {};
2056
2055
  const abandoned = new Promise((_resolve, reject) => {
2057
2056
  abandon = reject;
@@ -4774,16 +4773,43 @@ function compactOperationDescriptor(operation) {
4774
4773
  // apps/mcp/src/result.ts
4775
4774
  var SummaryFieldMaxLength = 120;
4776
4775
  var ErrorMessageMaxLength = 500;
4777
- var OutputPreviewMaxLength = 500;
4778
- var EmittedOutputMaxItems = 10;
4776
+ var NestedTextMaxLength = 2000;
4779
4777
  function formatMcpToolSuccess(capability, output) {
4780
4778
  const safeOutput = preserveExecutionPauseMetadata(output, redactResponseSurface(output));
4781
- const outputSummary = toolOutputSummary(safeOutput, capability);
4779
+ const outputSummary = toolOutputSummary(safeOutput);
4782
4780
  return {
4783
4781
  content: [{ type: "text", text: `${capability} completed.${outputSummary}` }],
4784
4782
  ...isRecord(safeOutput) ? { structuredContent: safeOutput } : undefined
4785
4783
  };
4786
4784
  }
4785
+ function formatCodeModeResult(output, options = {}) {
4786
+ const safeOutput = preserveExecutionPauseMetadata(output, redactResponseSurface(output));
4787
+ const shown = options.full === true || !isRecord(safeOutput) ? safeOutput : cutCodeModeFields(safeOutput);
4788
+ return { content: [{ type: "text", text: encodeJsonStringSync(shown) }] };
4789
+ }
4790
+ function cutCodeModeFields(output) {
4791
+ return Object.fromEntries(Object.entries(output).map(([key, value]) => {
4792
+ if (key === "result" && !isString(value))
4793
+ return [key, cutNestedText(value)];
4794
+ if ((key === "emittedOutput" || key === "logs") && Array.isArray(value))
4795
+ return [key, cutNestedText(value)];
4796
+ return [key, value];
4797
+ }));
4798
+ }
4799
+ function cutNestedText(value) {
4800
+ if (isString(value))
4801
+ return cutText(value);
4802
+ if (Array.isArray(value))
4803
+ return value.map(cutNestedText);
4804
+ if (isRecord(value))
4805
+ return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, cutNestedText(child)]));
4806
+ return value;
4807
+ }
4808
+ function cutText(value) {
4809
+ if (value.length <= NestedTextMaxLength)
4810
+ return value;
4811
+ return `${value.slice(0, NestedTextMaxLength)}\u2026[cut ${value.length - NestedTextMaxLength} characters; return this field on its own or call execute with full: true]`;
4812
+ }
4787
4813
  function formatMcpToolError(error) {
4788
4814
  return {
4789
4815
  content: [{ type: "text", text: safeErrorMessage(error) }],
@@ -4825,13 +4851,11 @@ class McpToolInputError extends TaggedError("McpToolInputError") {
4825
4851
  function isRecord(value) {
4826
4852
  return isObject(value) && value !== null && !Array.isArray(value);
4827
4853
  }
4828
- function toolOutputSummary(output, capability) {
4854
+ function toolOutputSummary(output) {
4829
4855
  if (Array.isArray(output))
4830
4856
  return itemListSummary(output);
4831
4857
  if (!isRecord(output))
4832
4858
  return "";
4833
- if (capability === "execute" && (Object.hasOwn(output, "result") || Array.isArray(output.emittedOutput)))
4834
- return executeOutputSummary(output);
4835
4859
  if (output.result !== undefined)
4836
4860
  return toolOutputSummary(output.result);
4837
4861
  const items = output.items;
@@ -4850,71 +4874,6 @@ task: ${recordSummary(task)}`;
4850
4874
  repoBinding: ${recordSummary(repoBinding)}`;
4851
4875
  return "";
4852
4876
  }
4853
- function executeOutputSummary(output) {
4854
- const lines = [];
4855
- const result = output.result;
4856
- const resultSummary = result === undefined ? "" : toolOutputSummary(result);
4857
- if (resultSummary.length > 0)
4858
- lines.push(resultSummary.slice(1));
4859
- else if (Object.hasOwn(output, "result"))
4860
- lines.push(`Returned result: ${safeOutputPreview(result)}`);
4861
- const emittedOutput = output.emittedOutput;
4862
- if (Array.isArray(emittedOutput) && emittedOutput.length > 0) {
4863
- const rows = emittedOutput.slice(0, EmittedOutputMaxItems).map((value) => `- ${safeOutputPreview(value)}`);
4864
- const remaining = emittedOutput.length - rows.length;
4865
- lines.push(`Emitted output (${emittedOutput.length}):
4866
- ${rows.join(`
4867
- `)}${remaining > 0 ? `
4868
- ...and ${remaining} more.` : ""}`);
4869
- }
4870
- return lines.length > 0 ? `
4871
- ${lines.join(`
4872
- `)}` : "";
4873
- }
4874
- function safeOutputPreview(value) {
4875
- const preview = isString(value) ? previewString(value) : stringifyOutput(value);
4876
- const sanitized = sanitizeOutputText(preview);
4877
- if (sanitized.length <= OutputPreviewMaxLength)
4878
- return sanitized;
4879
- return `${sanitized.slice(0, OutputPreviewMaxLength - 1)}\u2026`;
4880
- }
4881
- function previewString(value) {
4882
- const parsed = getOrUndefined(decodeJsonStringOption(value));
4883
- return isRecord(parsed) || Array.isArray(parsed) ? stringifyOutput(parsed) : value;
4884
- }
4885
- function stringifyOutput(value) {
4886
- if (value === undefined)
4887
- return "undefined";
4888
- if (value === null)
4889
- return "null";
4890
- if (isString(value))
4891
- return value;
4892
- if (isNumber(value) || isBoolean(value) || isBigInt(value))
4893
- return String(value);
4894
- const seen = new WeakSet;
4895
- try {
4896
- return JSON.stringify(value, (key, item) => {
4897
- if (key.length > 0 && sensitiveOutputKey(key))
4898
- return "<redacted>";
4899
- if (isBigInt(item))
4900
- return `${item}n`;
4901
- if (isObject(item) && item !== null) {
4902
- if (seen.has(item))
4903
- return "<circular>";
4904
- seen.add(item);
4905
- }
4906
- return isString(item) ? sanitizeOutputText(item) : item;
4907
- }) ?? String(value);
4908
- } catch {
4909
- return "[unavailable]";
4910
- }
4911
- }
4912
- function sensitiveOutputKey(key) {
4913
- return /(?:password|token|secret|private[_-]?key|api[_-]?key|authorization|cookie|credential|url|uri)/iu.test(key);
4914
- }
4915
- function sanitizeOutputText(value) {
4916
- return value.replace(/https?:\/\/[^\s?]+\?[^\s]+/gu, (url) => `${url.slice(0, url.indexOf("?"))}?<redacted>`).replace(/(bearer\s+)[^\s]+/giu, "$1<redacted>").replace(/((?:token|secret|private[_-]?key|password|api[_-]?key)\s*[=:]\s*)[^\s,;}]+/giu, "$1<redacted>").replace(/[\p{C}\s]+/gu, " ").trim();
4917
- }
4918
4877
  function resolverTeamContextSummary(output) {
4919
4878
  if (!isString(output.resolutionSource))
4920
4879
  return "";
@@ -5339,6 +5298,7 @@ Run JavaScript/TypeScript-like code in a sandbox with a host-side Kitman operati
5339
5298
  - \`kitman.search\` returns exact callable paths. Prefer those paths over guessing namespaces.
5340
5299
  - \`kitman.describe.operation\` returns the summary, input schema, generated TypeScript shapes, examples, auth notes, and approval policy. Pass \`full: true\` for the output JSON Schema too.
5341
5300
  - \`kitman.call(operationName, args)\` is available for dynamic calls.
5301
+ - A string over 2,000 characters nested in what you return or emit is cut. Return that field on its own, or call execute with \`full: true\`, to read it whole.
5342
5302
  - Direct network access is denied. Use \`kitman.*\` operations only.
5343
5303
  - Credentials, bearer tokens, private keys, raw auth stores, env, filesystem, and child processes are not available in the sandbox.
5344
5304
  - Routine reads and work-loop updates should not pause. Destructive, authority-expanding, governance, and external-delivery operations may pause for approval.
@@ -5769,7 +5729,11 @@ var ExecuteInputSchema = {
5769
5729
  additionalProperties: false,
5770
5730
  properties: {
5771
5731
  code: { type: "string", minLength: 1 },
5772
- reason: { type: "string", minLength: 1 }
5732
+ reason: { type: "string", minLength: 1 },
5733
+ full: {
5734
+ type: "boolean",
5735
+ description: "Return nested strings over 2,000 characters whole instead of cut."
5736
+ }
5773
5737
  }
5774
5738
  };
5775
5739
  var ToolOutputSchema2 = {
@@ -5820,6 +5784,7 @@ function registerCodeModeTools(server, options = {}) {
5820
5784
  return runCode({
5821
5785
  code: input.code,
5822
5786
  ...input.reason === undefined ? undefined : { reason: input.reason },
5787
+ full: input.full,
5823
5788
  approvals,
5824
5789
  replayResults,
5825
5790
  owner: input.owner
@@ -5831,7 +5796,7 @@ function registerCodeModeTools(server, options = {}) {
5831
5796
  label = "canceled";
5832
5797
  else if (action === "decline")
5833
5798
  label = "declined";
5834
- return formatMcpToolSuccess("resume", {
5799
+ return formatCodeModeResult({
5835
5800
  status: "completed",
5836
5801
  executionId,
5837
5802
  result: {
@@ -5857,15 +5822,13 @@ function registerCodeModeTools(server, options = {}) {
5857
5822
  ...input.reason === undefined ? undefined : { reason: input.reason }
5858
5823
  });
5859
5824
  if (isPausedExecution(result.value, pauseToken))
5860
- return formatMcpToolSuccess("execute", publicPauseValue(result.value));
5861
- return formatMcpToolSuccess("execute", {
5825
+ return formatCodeModeResult(publicPauseValue(result.value));
5826
+ return formatCodeModeResult({
5862
5827
  status: "completed",
5863
5828
  result: result.value,
5864
- emitted: result.output.length || undefined,
5865
- emittedOutput: result.output,
5866
- logs: result.logs,
5867
- metadata: result.metadata
5868
- });
5829
+ ...result.output.length > 0 ? { emittedOutput: result.output } : undefined,
5830
+ ...result.logs.length > 0 ? { logs: result.logs } : undefined
5831
+ }, { full: input.full });
5869
5832
  });
5870
5833
  server.registerTool("execute", {
5871
5834
  description: [
@@ -5875,13 +5838,13 @@ function registerCodeModeTools(server, options = {}) {
5875
5838
  ].join(`
5876
5839
  `),
5877
5840
  inputSchema: adapt(ExecuteInputSchema),
5878
- outputSchema: adapt(ToolOutputSchema2),
5879
5841
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false }
5880
5842
  }, (args) => runMcpEffect(gen(function* () {
5881
5843
  const reason = yield* optionalStringArg(args, "reason");
5882
5844
  return yield* runCode({
5883
5845
  code: yield* stringArg(args, "code"),
5884
5846
  ...reason === undefined ? undefined : { reason },
5847
+ full: yield* optionalBooleanArg(args, "full"),
5885
5848
  approvals: new Set,
5886
5849
  owner: resolveExecutionOwner()
5887
5850
  });
@@ -5903,7 +5866,6 @@ function registerCodeModeTools(server, options = {}) {
5903
5866
  server.registerTool("resume", {
5904
5867
  description: "Resume a paused Code Mode execution. If the execution is unknown, expired, forbidden, or already settled, a structured unavailable status is returned.",
5905
5868
  inputSchema: adapt(ResumeInputSchema),
5906
- outputSchema: adapt(ToolOutputSchema2),
5907
5869
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true }
5908
5870
  }, (args) => runMcpEffect(resumeExecution(args).pipe(catch_((error) => succeed6(formatMcpToolError(error))))));
5909
5871
  registerWaitRunTool(server, adapt, options.waitRun ?? (dispatchOperation === undefined ? undefined : runWaiterFromOperations(dispatchOperation)));
@@ -5925,21 +5887,21 @@ function registerCodeModeTools(server, options = {}) {
5925
5887
  } else if (paused.length === 1 && action !== undefined)
5926
5888
  executionId = paused[0]?.executionId;
5927
5889
  else
5928
- return formatMcpToolSuccess("resume", {
5890
+ return formatCodeModeResult({
5929
5891
  status: "execution_id_required",
5930
5892
  candidateExecutionIds: paused.map((execution) => execution.executionId),
5931
5893
  message: "Provide executionId when there is not exactly one approved paused execution."
5932
5894
  });
5933
5895
  }
5934
5896
  if (executionId === undefined)
5935
- return formatMcpToolSuccess("resume", {
5897
+ return formatCodeModeResult({
5936
5898
  status: "execution_id_required",
5937
5899
  candidateExecutionIds: [],
5938
5900
  message: "No paused Code Mode execution is available for this actor."
5939
5901
  });
5940
5902
  durableAction ??= yield* resolveDecision(executionId);
5941
5903
  if (action !== undefined && durableAction !== undefined && action !== durableAction)
5942
- return formatMcpToolSuccess("resume", {
5904
+ return formatCodeModeResult({
5943
5905
  status: "idempotency_conflict",
5944
5906
  executionId,
5945
5907
  error: {
@@ -5967,13 +5929,13 @@ function registerCodeModeTools(server, options = {}) {
5967
5929
  if (outcome.status === "invalid_action")
5968
5930
  return formatMcpToolError(new McpToolInputError({ message: "action must be accept, reject, or cancel." }));
5969
5931
  if (outcome.status === "execution_not_found")
5970
- return formatMcpToolSuccess("resume", {
5932
+ return formatCodeModeResult({
5971
5933
  status: outcome.status,
5972
5934
  executionId,
5973
5935
  recovery: "re_execute",
5974
5936
  message: "No paused Code Mode execution is available in this MCP host session."
5975
5937
  });
5976
- return formatMcpToolSuccess("resume", {
5938
+ return formatCodeModeResult({
5977
5939
  status: outcome.status,
5978
5940
  executionId,
5979
5941
  ...outcome.status === "execution_unknown" ? {
@@ -6013,6 +5975,12 @@ function optionalStringArg(args, key) {
6013
5975
  return undefined_;
6014
5976
  return isString(value) && value.length > 0 ? succeed6(value) : fail7(new McpToolInputError({ message: `${key} must be a non-empty string.` }));
6015
5977
  }
5978
+ function optionalBooleanArg(args, key) {
5979
+ const value = args[key];
5980
+ if (value === undefined)
5981
+ return succeed6(false);
5982
+ return isBoolean(value) ? succeed6(value) : fail7(new McpToolInputError({ message: `${key} must be a boolean.` }));
5983
+ }
6016
5984
  function optionalResumeAction(args) {
6017
5985
  const value = args.action;
6018
5986
  if (value === undefined)
@@ -7110,13 +7078,36 @@ function methodValue(client, methodName) {
7110
7078
  class StepToolRequestError extends TaggedError("StepToolRequestError") {
7111
7079
  }
7112
7080
  var StepCredentialHeader = "x-kitman-step-credential";
7113
- var NoArguments = { type: "object", properties: {}, additionalProperties: false };
7114
- var SubmitOutputArguments = {
7081
+ var StepBriefArguments = {
7115
7082
  type: "object",
7116
- properties: { output: { type: "object", description: "Your Output; it must match the JSON Schema in your brief." } },
7117
- required: ["output"],
7083
+ properties: {
7084
+ offset: {
7085
+ type: "integer",
7086
+ minimum: 0,
7087
+ description: "Where to start reading, in characters; a page that does not finish the brief names the next one."
7088
+ }
7089
+ },
7118
7090
  additionalProperties: false
7119
7091
  };
7092
+ var briefPageSize = 30000;
7093
+ var briefPage = (prompt, offset) => {
7094
+ const start = Math.min(Math.max(0, Math.trunc(offset)), prompt.length);
7095
+ if (prompt.length - start <= briefPageSize)
7096
+ return prompt.slice(start);
7097
+ const continuation = (next, left) => `
7098
+ [brief continues: call step_brief with offset ${next}; ${left} characters left]`;
7099
+ const end = start + briefPageSize - continuation(prompt.length, prompt.length).length;
7100
+ return `${prompt.slice(start, end)}${continuation(end, prompt.length - end)}`;
7101
+ };
7102
+ var SubmitOutputArguments = {
7103
+ type: "object",
7104
+ properties: { output: { description: "Your Output; it must match the JSON Schema in your brief." } },
7105
+ additionalProperties: true
7106
+ };
7107
+ var submittedOutput = (args) => {
7108
+ const keys = Object.keys(args);
7109
+ return keys.length === 1 && keys[0] === "output" && isJsonObject(args.output) ? args.output : args;
7110
+ };
7120
7111
  var SessionUpdateArguments = {
7121
7112
  type: "object",
7122
7113
  properties: {
@@ -7238,14 +7229,10 @@ function registerStepTools(server, adapt, input) {
7238
7229
  const request = (path, body) => flatMap3(send(path, body), bodyOf);
7239
7230
  const run = (effect) => runMcpEffect(effect.pipe(catch_((error) => succeed6(failure(error.message)))));
7240
7231
  server.registerTool("step_brief", {
7241
- description: "Read the brief for the Step you are working on: its instructions, Context Pack and Output schema.",
7242
- inputSchema: adapt(NoArguments),
7243
- outputSchema: adapt(AnyResult),
7232
+ description: "Read the brief for the Step you are working on: its instructions, Context Pack and Output schema. A long brief comes in pages; each names the offset of the next.",
7233
+ inputSchema: adapt(StepBriefArguments),
7244
7234
  annotations: { readOnlyHint: true, idempotentHint: true }
7245
- }, () => run(map8(request("/brief"), (brief) => ({
7246
- content: [{ type: "text", text: brief.prompt }],
7247
- structuredContent: brief
7248
- }))));
7235
+ }, (args) => run(map8(request("/brief"), (brief) => text(briefPage(brief.prompt, isNumber(args.offset) ? args.offset : 0)))));
7249
7236
  const closed = (question) => gen(function* () {
7250
7237
  let current = question;
7251
7238
  const interval = fromInputUnsafe(input.answerPollInterval ?? "2 seconds");
@@ -7262,7 +7249,7 @@ function registerStepTools(server, adapt, input) {
7262
7249
  inputSchema: adapt(SubmitOutputArguments),
7263
7250
  outputSchema: adapt(AnyResult),
7264
7251
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false }
7265
- }, (args) => run(flatMap3(request("/output", { output: args.output ?? null }), (result) => {
7252
+ }, (args) => run(flatMap3(request("/output", { output: submittedOutput(args) }), (result) => {
7266
7253
  switch (result.status) {
7267
7254
  case "accepted":
7268
7255
  return succeed6({
@@ -7289,7 +7276,7 @@ function registerStepTools(server, adapt, input) {
7289
7276
  if (input.outputOnly === true)
7290
7277
  return;
7291
7278
  server.registerTool("session_update", {
7292
- description: "Record a SessionUpdate at a milestone: what you did and what is next. If this Step is retried on another Runner, the retry starts from your updates.",
7279
+ description: "Record a SessionUpdate only before long work that a retry without your conversation would have to redo: what you did and what is next. Never call it just before submit_output.",
7293
7280
  inputSchema: adapt(SessionUpdateArguments),
7294
7281
  outputSchema: adapt(AnyResult),
7295
7282
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false }
package/dist/index.js CHANGED
@@ -5,15 +5,15 @@
5
5
  var args = process.argv.slice(2);
6
6
  if (args[0] === "srt") {
7
7
  process.argv.splice(2, 1);
8
- const { runSrtCli } = await import("./chunk-vne4rsj0.js");
8
+ const { runSrtCli } = await import("./chunk-fq47a5yd.js");
9
9
  await runSrtCli();
10
10
  } else if (args[0] === "srt-step") {
11
- const { runSrtStep } = await import("./chunk-cw2ghw7n.js");
11
+ const { runSrtStep } = await import("./chunk-ky974pcr.js");
12
12
  await runSrtStep(args.slice(1));
13
13
  } else if (args[0] === "opencode-read") {
14
- const { runOpencodeReader } = await import("./chunk-5dwyvg1z.js");
14
+ const { runOpencodeReader } = await import("./chunk-9zd52pda.js");
15
15
  runOpencodeReader();
16
16
  } else {
17
- const { runCli } = await import("./chunk-a10dn5vf.js");
17
+ const { runCli } = await import("./chunk-d4atn90g.js");
18
18
  runCli(args);
19
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitman-sh/cli",
3
- "version": "0.10.81",
3
+ "version": "0.10.82",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "bin": {