@swarmcraftai/cli 0.4.0 → 0.4.1

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/main.cjs CHANGED
@@ -403,13 +403,13 @@ var require_packetFile = __commonJS({
403
403
  ""
404
404
  ].join("\n");
405
405
  }
406
- function renderProvisionalPacketFile(input2) {
407
- const title = input2.title.trim();
408
- const provisionalTaskId = input2.provisionalTaskId?.trim() || `${exports2.PROVISIONAL_TASK_ID_PREFIX}${slugify(title)}`;
406
+ function renderProvisionalPacketFile(input) {
407
+ const title = input.title.trim();
408
+ const provisionalTaskId = input.provisionalTaskId?.trim() || `${exports2.PROVISIONAL_TASK_ID_PREFIX}${slugify(title)}`;
409
409
  return [
410
410
  "---",
411
411
  "swarmcraftVersion: 2",
412
- `projectId: ${input2.projectId}`,
412
+ `projectId: ${input.projectId}`,
413
413
  `taskId: ${provisionalTaskId}`,
414
414
  `title: ${escapeFrontmatterValue(title)}`,
415
415
  "lane: todo",
@@ -420,33 +420,33 @@ var require_packetFile = __commonJS({
420
420
  "",
421
421
  "## Goal",
422
422
  "",
423
- input2.goal.trim() || "Describe the outcome in one short paragraph.",
423
+ input.goal.trim() || "Describe the outcome in one short paragraph.",
424
424
  "",
425
425
  "## Doing Checklist",
426
426
  "",
427
427
  CHECKLIST_SYNC_COMMENT,
428
428
  "",
429
- renderProvisionalChecklist(input2.checklists.doing),
429
+ renderProvisionalChecklist(input.checklists.doing),
430
430
  "",
431
431
  "## Checking Checklist",
432
432
  "",
433
433
  CHECKLIST_SYNC_COMMENT,
434
434
  "",
435
- renderProvisionalChecklist(input2.checklists.checking),
435
+ renderProvisionalChecklist(input.checklists.checking),
436
436
  "",
437
437
  "## Reviewing Checklist",
438
438
  "",
439
439
  CHECKLIST_SYNC_COMMENT,
440
440
  "",
441
- renderProvisionalChecklist(input2.checklists.reviewing),
441
+ renderProvisionalChecklist(input.checklists.reviewing),
442
442
  "",
443
443
  "## Notes",
444
444
  "",
445
- input2.notes?.trim() ?? "",
445
+ input.notes?.trim() ?? "",
446
446
  "",
447
447
  "## Agent Update",
448
448
  "",
449
- input2.agentUpdate?.trim() || "<!-- Short structured summary of what changed, what is blocked, and what still needs review. -->",
449
+ input.agentUpdate?.trim() || "<!-- Short structured summary of what changed, what is blocked, and what still needs review. -->",
450
450
  ""
451
451
  ].join("\n");
452
452
  }
@@ -544,14 +544,14 @@ ${rewrittenFrontmatter}
544
544
  ${body.startsWith("\n") ? body : `
545
545
  ${body}`}`;
546
546
  }
547
- function rewritePacketFile(input2) {
548
- let rewritten = rewritePacketFileMetadata3(input2.contents, {
549
- lane: input2.lane,
550
- syncRevision: parsePacketFile3(input2.contents).frontmatter.syncRevision,
551
- lastSyncedAt: input2.syncedAt ?? (/* @__PURE__ */ new Date()).toISOString()
547
+ function rewritePacketFile(input) {
548
+ let rewritten = rewritePacketFileMetadata3(input.contents, {
549
+ lane: input.lane,
550
+ syncRevision: parsePacketFile3(input.contents).frontmatter.syncRevision,
551
+ lastSyncedAt: input.syncedAt ?? (/* @__PURE__ */ new Date()).toISOString()
552
552
  });
553
- rewritten = markChecklistStageComplete(rewritten, input2.completeStage);
554
- return appendAgentUpdateLines(rewritten, input2.agentUpdateLines);
553
+ rewritten = markChecklistStageComplete(rewritten, input.completeStage);
554
+ return appendAgentUpdateLines(rewritten, input.agentUpdateLines);
555
555
  }
556
556
  function markChecklistStageComplete(contents, checklistStage) {
557
557
  const heading = checklistSectionHeading(checklistStage);
@@ -1062,29 +1062,29 @@ var require_stageCommands = __commonJS({
1062
1062
  stageName: toStageName(stage.command)
1063
1063
  }
1064
1064
  ]));
1065
- function buildPacketStageCommand2(input2) {
1066
- const commandParts = COMMAND_BY_WORKFLOW_STATE[input2.workflowState];
1065
+ function buildPacketStageCommand2(input) {
1066
+ const commandParts = COMMAND_BY_WORKFLOW_STATE[input.workflowState];
1067
1067
  if (!commandParts) {
1068
1068
  return null;
1069
1069
  }
1070
1070
  return buildAssistantActionCommand({
1071
1071
  actionKey: commandParts.actionKey,
1072
- relativePacketFilePath: input2.relativePacketFilePath,
1073
- agentProvider: input2.agentProvider
1072
+ relativePacketFilePath: input.relativePacketFilePath,
1073
+ agentProvider: input.agentProvider
1074
1074
  });
1075
1075
  }
1076
- function buildAssistantActionCommand(input2) {
1077
- const action = (0, assistantActions_js_1.getSwarmCraftAssistantAction)(input2.actionKey);
1078
- const agentProvider = input2.agentProvider ?? exports2.DEFAULT_SWARMCRAFT_AGENT_PROVIDER;
1076
+ function buildAssistantActionCommand(input) {
1077
+ const action = (0, assistantActions_js_1.getSwarmCraftAssistantAction)(input.actionKey);
1078
+ const agentProvider = input.agentProvider ?? exports2.DEFAULT_SWARMCRAFT_AGENT_PROVIDER;
1079
1079
  const invocation = agentProvider === "codex" ? action.codexInvocation : action.copilotInvocation;
1080
- const command = input2.relativePacketFilePath ? invocation.replace("<packet-path>", formatTaskArgument(input2.relativePacketFilePath)) : invocation;
1080
+ const command = input.relativePacketFilePath ? invocation.replace("<packet-path>", formatTaskArgument(input.relativePacketFilePath)) : invocation;
1081
1081
  const args = [];
1082
- if (input2.relativePacketFilePath && command === invocation) {
1083
- const packetArgumentName = input2.actionKey === "test" ? "task" : "scope";
1084
- args.push(`${packetArgumentName}=${formatTaskArgument(input2.relativePacketFilePath)}`);
1082
+ if (input.relativePacketFilePath && command === invocation) {
1083
+ const packetArgumentName = input.actionKey === "test" ? "task" : "scope";
1084
+ args.push(`${packetArgumentName}=${formatTaskArgument(input.relativePacketFilePath)}`);
1085
1085
  }
1086
- if (input2.scope?.trim()) {
1087
- args.push(`scope=${formatTaskArgument(input2.scope.trim())}`);
1086
+ if (input.scope?.trim()) {
1087
+ args.push(`scope=${formatTaskArgument(input.scope.trim())}`);
1088
1088
  }
1089
1089
  return [command, ...args].join(" ");
1090
1090
  }
@@ -2506,26 +2506,26 @@ var require_renderCopilotPrompts = __commonJS({
2506
2506
  ""
2507
2507
  ].join("\n");
2508
2508
  }
2509
- function renderLaneIndependentPromptFile(action, input2) {
2509
+ function renderLaneIndependentPromptFile(action, input) {
2510
2510
  return [
2511
2511
  "---",
2512
- `description: '${input2.description}'`,
2513
- `argument-hint: '${input2.inputName}=<request-or-path>'`,
2512
+ `description: '${input.description}'`,
2513
+ `argument-hint: '${input.inputName}=<request-or-path>'`,
2514
2514
  "---",
2515
2515
  "",
2516
2516
  `#file:${action.copilotSkillPath}`,
2517
2517
  "",
2518
- `# ${input2.title}`,
2518
+ `# ${input.title}`,
2519
2519
  "",
2520
2520
  "## Inputs",
2521
2521
  "",
2522
- `* \${input:${input2.inputName}}: ${input2.inputDescription}`,
2522
+ `* \${input:${input.inputName}}: ${input.inputDescription}`,
2523
2523
  "",
2524
2524
  "## Requirements",
2525
2525
  "",
2526
- ...(0, packet_workflow_1.renderNumberedLines)(input2.requirements),
2526
+ ...(0, packet_workflow_1.renderNumberedLines)(input.requirements),
2527
2527
  "",
2528
- `Proceed with the user's request using \`\${input:${input2.inputName}}\` as the action scope.`,
2528
+ `Proceed with the user's request using \`\${input:${input.inputName}}\` as the action scope.`,
2529
2529
  ""
2530
2530
  ].join("\n");
2531
2531
  }
@@ -2850,6 +2850,8 @@ Prototype when seeing or operating the proposed experience would materially impr
2850
2850
 
2851
2851
  Do not force a prototype for routine backend work, dependency changes, migrations, or a decision already clear in text. Explain briefly when a prototype would add little value and continue the surrounding discovery or planning workflow.
2852
2852
 
2853
+ When a surrounding discovery or planning workflow invokes this skill again, inspect reviewed prototypes before choosing a path. Revise an existing prototype when the new questions share its actors, product shell, interaction model, and decision context. Create a separate focused prototype when a distinct role, operating context, workflow, or recovery model would make the existing artifact confusing. Preserve and cross-link related prototypes; do not collapse separate decision surfaces into one oversized demo.
2854
+
2853
2855
  ## Build the smallest decision surface
2854
2856
 
2855
2857
  1. State the decision questions the prototype must answer before building it.
@@ -3983,19 +3985,19 @@ var require_trust = __commonJS({
3983
3985
  }
3984
3986
  };
3985
3987
  exports2.AccountingTrustError = AccountingTrustError;
3986
- function buildAccountingConsentDisclosure(input2) {
3987
- if (!Number.isInteger(input2.lookbackMonths) || input2.lookbackMonths < 1 || input2.lookbackMonths > 36 || input2.dataClasses.length === 0) {
3988
+ function buildAccountingConsentDisclosure(input) {
3989
+ if (!Number.isInteger(input.lookbackMonths) || input.lookbackMonths < 1 || input.lookbackMonths > 36 || input.dataClasses.length === 0) {
3988
3990
  throw new AccountingTrustError("INVALID_CONSENT", "Accounting consent requires a 1-36 month lookback and at least one named data class.");
3989
3991
  }
3990
3992
  return {
3991
- provider: input2.provider,
3992
- organizationLabel: input2.organizationLabel ?? null,
3993
- connectionMethod: input2.connectionMethod,
3994
- requestedScopes: input2.requestedScopes ?? [],
3995
- dataClasses: input2.dataClasses,
3996
- lookbackMonths: input2.lookbackMonths,
3993
+ provider: input.provider,
3994
+ organizationLabel: input.organizationLabel ?? null,
3995
+ connectionMethod: input.connectionMethod,
3996
+ requestedScopes: input.requestedScopes ?? [],
3997
+ dataClasses: input.dataClasses,
3998
+ lookbackMonths: input.lookbackMonths,
3997
3999
  outputPath: "docs/reports/spend-analysis.md",
3998
- providerPermissionCaveat: input2.providerPermissionCaveat ?? null,
4000
+ providerPermissionCaveat: input.providerPermissionCaveat ?? null,
3999
4001
  localProcessing: "Provider responses and normalized transactions are processed in a bounded local run area outside the repository. Deterministic recurrence analysis runs locally.",
4000
4002
  swarmCraftProcessing: "SwarmCraft does not upload raw accounting transactions. A future OAuth broker may exchange authorization codes transiently only when a provider requires a confidential client; that path is disabled until separately approved.",
4001
4003
  aiProcessing: "The configured AI assistant may receive minimized subscription candidates and evidence summaries for interpretation and report drafting. It must not receive access tokens, refresh tokens, raw provider payloads, account numbers, or unrelated transactions.",
@@ -4077,12 +4079,12 @@ var require_analysis = __commonJS({
4077
4079
  }
4078
4080
  return normalized;
4079
4081
  }
4080
- function analyseRecurringSpend(input2) {
4081
- const aliasRules = input2.aliases ?? [];
4082
- const known = new Map((input2.knownSoftware ?? []).map((vendor) => [normalizeMerchantIdentity(vendor.canonicalMerchant, aliasRules), vendor.displayName]));
4082
+ function analyseRecurringSpend(input) {
4083
+ const aliasRules = input.aliases ?? [];
4084
+ const known = new Map((input.knownSoftware ?? []).map((vendor) => [normalizeMerchantIdentity(vendor.canonicalMerchant, aliasRules), vendor.displayName]));
4083
4085
  const currenciesByMerchant = /* @__PURE__ */ new Map();
4084
4086
  const groups = /* @__PURE__ */ new Map();
4085
- for (const transaction of input2.transactions) {
4087
+ for (const transaction of input.transactions) {
4086
4088
  validateTransaction(transaction);
4087
4089
  const merchant = normalizeMerchantIdentity(transaction.merchantIdentity, aliasRules);
4088
4090
  const currency = transaction.currency.toUpperCase();
@@ -4155,11 +4157,11 @@ var require_analysis = __commonJS({
4155
4157
  limitations
4156
4158
  });
4157
4159
  }
4158
- const corrected = applyCorrections(findings, input2.corrections ?? []);
4160
+ const corrected = applyCorrections(findings, input.corrections ?? []);
4159
4161
  return {
4160
4162
  findings: corrected.sort((left, right) => left.id.localeCompare(right.id)),
4161
4163
  ignoredOneOffGroups,
4162
- currencies: [...new Set(input2.transactions.map((transaction) => transaction.currency.toUpperCase()))].sort(),
4164
+ currencies: [...new Set(input.transactions.map((transaction) => transaction.currency.toUpperCase()))].sort(),
4163
4165
  limitations: [
4164
4166
  "Annualized values extrapolate observed cadence and are not forecasts or contract totals.",
4165
4167
  "Amounts in different currencies are never silently converted or combined.",
@@ -4167,16 +4169,16 @@ var require_analysis = __commonJS({
4167
4169
  ]
4168
4170
  };
4169
4171
  }
4170
- function renderSpendReport(input2) {
4171
- if (!input2.ownerReviewed)
4172
+ function renderSpendReport(input) {
4173
+ if (!input.ownerReviewed)
4172
4174
  throw new Error("Spend report must be owner-reviewed before rendering for the repository.");
4173
- return renderSpendReportProposal(input2);
4175
+ return renderSpendReportProposal(input);
4174
4176
  }
4175
- function renderSpendReportProposal(input2) {
4177
+ function renderSpendReportProposal(input) {
4176
4178
  const confidenceOrder = { high: 0, medium: 1, low: 2 };
4177
- const ranked = [...input2.result.findings].sort((left, right) => confidenceOrder[left.confidence] - confidenceOrder[right.confidence] || left.displayMerchant.localeCompare(right.displayMerchant));
4179
+ const ranked = [...input.result.findings].sort((left, right) => confidenceOrder[left.confidence] - confidenceOrder[right.confidence] || left.displayMerchant.localeCompare(right.displayMerchant));
4178
4180
  const rows = ranked.map((finding) => `| \`${finding.id}\` | ${safeCell(finding.displayMerchant)} | ${finding.cadence} | ${finding.currency} ${formatMinor(finding.observedSpendMinor)} | ${finding.annualizedSpendMinor === null ? "Not estimated" : `${finding.currency} ${formatMinor(finding.annualizedSpendMinor)}`} | ${finding.classification} | ${finding.confidence} | ${finding.businessOwner ? safeCell(finding.businessOwner) : "Unconfirmed"} |`).join("\n") || "| \u2014 | No recurring candidates in scope | \u2014 | \u2014 | \u2014 | \u2014 | \u2014 | \u2014 |";
4179
- const previous = new Set(input2.previousFindingIds ?? []);
4181
+ const previous = new Set(input.previousFindingIds ?? []);
4180
4182
  const current = new Set(ranked.map(({ id }) => id));
4181
4183
  const newIds = [...current].filter((id) => !previous.has(id));
4182
4184
  const continuingIds = [...current].filter((id) => previous.has(id));
@@ -4191,12 +4193,12 @@ var require_analysis = __commonJS({
4191
4193
  swarmcraftReport: 1
4192
4194
  reportType: spend-analysis
4193
4195
  ownerSkill: swarmcraft-spend-analysis
4194
- generatedAt: ${input2.generatedAt}
4195
- assessedRef: ${safeScalar(input2.assessedRef)}
4196
- mode: ${input2.mode}
4197
- scope: ${safeScalar(input2.scope)}
4196
+ generatedAt: ${input.generatedAt}
4197
+ assessedRef: ${safeScalar(input.assessedRef)}
4198
+ mode: ${input.mode}
4199
+ scope: ${safeScalar(input.scope)}
4198
4200
  status: COMPLETE
4199
- previousReportCommit: ${input2.previousReportCommit ?? "null"}
4201
+ previousReportCommit: ${input.previousReportCommit ?? "null"}
4200
4202
  ---
4201
4203
 
4202
4204
  # Spend Analysis
@@ -4245,14 +4247,14 @@ ${ranked.filter((finding) => finding.businessOwner || finding.uncertaintyNote ||
4245
4247
 
4246
4248
  ## Limitations
4247
4249
 
4248
- ${[.../* @__PURE__ */ new Set([...input2.result.limitations, ...input2.result.findings.flatMap((finding) => finding.limitations)])].map((limitation) => `- ${safeText(limitation)}`).join("\n")}
4250
+ ${[.../* @__PURE__ */ new Set([...input.result.limitations, ...input.result.findings.flatMap((finding) => finding.limitations)])].map((limitation) => `- ${safeText(limitation)}`).join("\n")}
4249
4251
 
4250
4252
  ## Run record
4251
4253
 
4252
- - Assessed revision: \`${safeText(input2.assessedRef)}\`
4253
- - Findings: ${input2.result.findings.length}
4254
- - Ignored one-off groups: ${input2.result.ignoredOneOffGroups}
4255
- - Currencies reported separately: ${input2.result.currencies.join(", ") || "none"}
4254
+ - Assessed revision: \`${safeText(input.assessedRef)}\`
4255
+ - Findings: ${input.result.findings.length}
4256
+ - Ignored one-off groups: ${input.result.ignoredOneOffGroups}
4257
+ - Currencies reported separately: ${input.result.currencies.join(", ") || "none"}
4256
4258
  - Report commit message: \`SwarmCraft: Update Spend Analysis\`
4257
4259
  `;
4258
4260
  }
@@ -4351,8 +4353,8 @@ ${[.../* @__PURE__ */ new Set([...input2.result.limitations, ...input2.result.fi
4351
4353
  }
4352
4354
  return null;
4353
4355
  }
4354
- function buildConfidenceReasons(input2) {
4355
- return [input2.charges.length >= 6 ? "six-or-more-charges" : "multiple-charges", input2.cadence !== "irregular" ? "repeatable-cadence" : "irregular-cadence", input2.amountVariation <= 0.1 ? "stable-amount" : "variable-amount", input2.classification === "known-saas" ? "known-software-vendor" : input2.classification === "likely-software" ? "software-category" : input2.classification === "ambiguous-processor" ? "processor-ambiguity" : "unknown-merchant", input2.reconciled === input2.charges.length ? "reconciled-evidence" : "mixed-reconciliation"].filter(Boolean);
4356
+ function buildConfidenceReasons(input) {
4357
+ return [input.charges.length >= 6 ? "six-or-more-charges" : "multiple-charges", input.cadence !== "irregular" ? "repeatable-cadence" : "irregular-cadence", input.amountVariation <= 0.1 ? "stable-amount" : "variable-amount", input.classification === "known-saas" ? "known-software-vendor" : input.classification === "likely-software" ? "software-category" : input.classification === "ambiguous-processor" ? "processor-ambiguity" : "unknown-merchant", input.reconciled === input.charges.length ? "reconciled-evidence" : "mixed-reconciliation"].filter(Boolean);
4356
4358
  }
4357
4359
  function confidenceWeight(reason) {
4358
4360
  return { "six-or-more-charges": 30, "multiple-charges": 15, "repeatable-cadence": 25, "irregular-cadence": 5, "stable-amount": 15, "variable-amount": 5, "known-software-vendor": 25, "software-category": 15, "processor-ambiguity": 0, "unknown-merchant": 5, "reconciled-evidence": 10, "mixed-reconciliation": 3 }[reason] ?? 0;
@@ -8777,7 +8779,7 @@ var require_stream_writable = __commonJS({
8777
8779
  "../../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_writable.js"(exports2, module2) {
8778
8780
  "use strict";
8779
8781
  var pna = require_process_nextick_args();
8780
- module2.exports = Writable;
8782
+ module2.exports = Writable2;
8781
8783
  function CorkedRequest(state) {
8782
8784
  var _this = this;
8783
8785
  this.next = null;
@@ -8788,7 +8790,7 @@ var require_stream_writable = __commonJS({
8788
8790
  }
8789
8791
  var asyncWrite = !process.browser && ["v0.10", "v0.9."].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
8790
8792
  var Duplex;
8791
- Writable.WritableState = WritableState;
8793
+ Writable2.WritableState = WritableState;
8792
8794
  var util = Object.create(require_util());
8793
8795
  util.inherits = require_inherits();
8794
8796
  var internalUtil = {
@@ -8805,7 +8807,7 @@ var require_stream_writable = __commonJS({
8805
8807
  return Buffer2.isBuffer(obj2) || obj2 instanceof OurUint8Array;
8806
8808
  }
8807
8809
  var destroyImpl = require_destroy();
8808
- util.inherits(Writable, Stream);
8810
+ util.inherits(Writable2, Stream);
8809
8811
  function nop() {
8810
8812
  }
8811
8813
  function WritableState(options, stream) {
@@ -8870,10 +8872,10 @@ var require_stream_writable = __commonJS({
8870
8872
  var realHasInstance;
8871
8873
  if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") {
8872
8874
  realHasInstance = Function.prototype[Symbol.hasInstance];
8873
- Object.defineProperty(Writable, Symbol.hasInstance, {
8875
+ Object.defineProperty(Writable2, Symbol.hasInstance, {
8874
8876
  value: function(object) {
8875
8877
  if (realHasInstance.call(this, object)) return true;
8876
- if (this !== Writable) return false;
8878
+ if (this !== Writable2) return false;
8877
8879
  return object && object._writableState instanceof WritableState;
8878
8880
  }
8879
8881
  });
@@ -8882,10 +8884,10 @@ var require_stream_writable = __commonJS({
8882
8884
  return object instanceof this;
8883
8885
  };
8884
8886
  }
8885
- function Writable(options) {
8887
+ function Writable2(options) {
8886
8888
  Duplex = Duplex || require_stream_duplex();
8887
- if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
8888
- return new Writable(options);
8889
+ if (!realHasInstance.call(Writable2, this) && !(this instanceof Duplex)) {
8890
+ return new Writable2(options);
8889
8891
  }
8890
8892
  this._writableState = new WritableState(options, this);
8891
8893
  this.writable = true;
@@ -8897,7 +8899,7 @@ var require_stream_writable = __commonJS({
8897
8899
  }
8898
8900
  Stream.call(this);
8899
8901
  }
8900
- Writable.prototype.pipe = function() {
8902
+ Writable2.prototype.pipe = function() {
8901
8903
  this.emit("error", new Error("Cannot pipe, not readable"));
8902
8904
  };
8903
8905
  function writeAfterEnd(stream, cb) {
@@ -8920,7 +8922,7 @@ var require_stream_writable = __commonJS({
8920
8922
  }
8921
8923
  return valid;
8922
8924
  }
8923
- Writable.prototype.write = function(chunk, encoding, cb) {
8925
+ Writable2.prototype.write = function(chunk, encoding, cb) {
8924
8926
  var state = this._writableState;
8925
8927
  var ret2 = false;
8926
8928
  var isBuf = !state.objectMode && _isUint8Array(chunk);
@@ -8941,18 +8943,18 @@ var require_stream_writable = __commonJS({
8941
8943
  }
8942
8944
  return ret2;
8943
8945
  };
8944
- Writable.prototype.cork = function() {
8946
+ Writable2.prototype.cork = function() {
8945
8947
  var state = this._writableState;
8946
8948
  state.corked++;
8947
8949
  };
8948
- Writable.prototype.uncork = function() {
8950
+ Writable2.prototype.uncork = function() {
8949
8951
  var state = this._writableState;
8950
8952
  if (state.corked) {
8951
8953
  state.corked--;
8952
8954
  if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
8953
8955
  }
8954
8956
  };
8955
- Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
8957
+ Writable2.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
8956
8958
  if (typeof encoding === "string") encoding = encoding.toLowerCase();
8957
8959
  if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1)) throw new TypeError("Unknown encoding: " + encoding);
8958
8960
  this._writableState.defaultEncoding = encoding;
@@ -8964,7 +8966,7 @@ var require_stream_writable = __commonJS({
8964
8966
  }
8965
8967
  return chunk;
8966
8968
  }
8967
- Object.defineProperty(Writable.prototype, "writableHighWaterMark", {
8969
+ Object.defineProperty(Writable2.prototype, "writableHighWaterMark", {
8968
8970
  // making it explicit this property is not enumerable
8969
8971
  // because otherwise some prototype manipulation in
8970
8972
  // userland will fail
@@ -9110,11 +9112,11 @@ var require_stream_writable = __commonJS({
9110
9112
  state.bufferedRequest = entry;
9111
9113
  state.bufferProcessing = false;
9112
9114
  }
9113
- Writable.prototype._write = function(chunk, encoding, cb) {
9115
+ Writable2.prototype._write = function(chunk, encoding, cb) {
9114
9116
  cb(new Error("_write() is not implemented"));
9115
9117
  };
9116
- Writable.prototype._writev = null;
9117
- Writable.prototype.end = function(chunk, encoding, cb) {
9118
+ Writable2.prototype._writev = null;
9119
+ Writable2.prototype.end = function(chunk, encoding, cb) {
9118
9120
  var state = this._writableState;
9119
9121
  if (typeof chunk === "function") {
9120
9122
  cb = chunk;
@@ -9189,7 +9191,7 @@ var require_stream_writable = __commonJS({
9189
9191
  }
9190
9192
  state.corkedRequestsFree.next = corkReq;
9191
9193
  }
9192
- Object.defineProperty(Writable.prototype, "destroyed", {
9194
+ Object.defineProperty(Writable2.prototype, "destroyed", {
9193
9195
  get: function() {
9194
9196
  if (this._writableState === void 0) {
9195
9197
  return false;
@@ -9203,9 +9205,9 @@ var require_stream_writable = __commonJS({
9203
9205
  this._writableState.destroyed = value;
9204
9206
  }
9205
9207
  });
9206
- Writable.prototype.destroy = destroyImpl.destroy;
9207
- Writable.prototype._undestroy = destroyImpl.undestroy;
9208
- Writable.prototype._destroy = function(err, cb) {
9208
+ Writable2.prototype.destroy = destroyImpl.destroy;
9209
+ Writable2.prototype._undestroy = destroyImpl.undestroy;
9210
+ Writable2.prototype._destroy = function(err, cb) {
9209
9211
  this.end();
9210
9212
  cb(err);
9211
9213
  };
@@ -9228,13 +9230,13 @@ var require_stream_duplex = __commonJS({
9228
9230
  var util = Object.create(require_util());
9229
9231
  util.inherits = require_inherits();
9230
9232
  var Readable = require_stream_readable();
9231
- var Writable = require_stream_writable();
9233
+ var Writable2 = require_stream_writable();
9232
9234
  util.inherits(Duplex, Readable);
9233
9235
  {
9234
- keys = objectKeys(Writable.prototype);
9236
+ keys = objectKeys(Writable2.prototype);
9235
9237
  for (v = 0; v < keys.length; v++) {
9236
9238
  method = keys[v];
9237
- if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
9239
+ if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable2.prototype[method];
9238
9240
  }
9239
9241
  }
9240
9242
  var keys;
@@ -9243,7 +9245,7 @@ var require_stream_duplex = __commonJS({
9243
9245
  function Duplex(options) {
9244
9246
  if (!(this instanceof Duplex)) return new Duplex(options);
9245
9247
  Readable.call(this, options);
9246
- Writable.call(this, options);
9248
+ Writable2.call(this, options);
9247
9249
  if (options && options.readable === false) this.readable = false;
9248
9250
  if (options && options.writable === false) this.writable = false;
9249
9251
  this.allowHalfOpen = true;
@@ -10404,72 +10406,72 @@ var require_base64 = __commonJS({
10404
10406
  var utils = require_utils();
10405
10407
  var support = require_support();
10406
10408
  var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
10407
- exports2.encode = function(input2) {
10408
- var output2 = [];
10409
+ exports2.encode = function(input) {
10410
+ var output = [];
10409
10411
  var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
10410
- var i = 0, len = input2.length, remainingBytes = len;
10411
- var isArray = utils.getTypeOf(input2) !== "string";
10412
- while (i < input2.length) {
10412
+ var i = 0, len = input.length, remainingBytes = len;
10413
+ var isArray = utils.getTypeOf(input) !== "string";
10414
+ while (i < input.length) {
10413
10415
  remainingBytes = len - i;
10414
10416
  if (!isArray) {
10415
- chr1 = input2.charCodeAt(i++);
10416
- chr2 = i < len ? input2.charCodeAt(i++) : 0;
10417
- chr3 = i < len ? input2.charCodeAt(i++) : 0;
10417
+ chr1 = input.charCodeAt(i++);
10418
+ chr2 = i < len ? input.charCodeAt(i++) : 0;
10419
+ chr3 = i < len ? input.charCodeAt(i++) : 0;
10418
10420
  } else {
10419
- chr1 = input2[i++];
10420
- chr2 = i < len ? input2[i++] : 0;
10421
- chr3 = i < len ? input2[i++] : 0;
10421
+ chr1 = input[i++];
10422
+ chr2 = i < len ? input[i++] : 0;
10423
+ chr3 = i < len ? input[i++] : 0;
10422
10424
  }
10423
10425
  enc1 = chr1 >> 2;
10424
10426
  enc2 = (chr1 & 3) << 4 | chr2 >> 4;
10425
10427
  enc3 = remainingBytes > 1 ? (chr2 & 15) << 2 | chr3 >> 6 : 64;
10426
10428
  enc4 = remainingBytes > 2 ? chr3 & 63 : 64;
10427
- output2.push(_keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4));
10429
+ output.push(_keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4));
10428
10430
  }
10429
- return output2.join("");
10431
+ return output.join("");
10430
10432
  };
10431
- exports2.decode = function(input2) {
10433
+ exports2.decode = function(input) {
10432
10434
  var chr1, chr2, chr3;
10433
10435
  var enc1, enc2, enc3, enc4;
10434
10436
  var i = 0, resultIndex = 0;
10435
10437
  var dataUrlPrefix = "data:";
10436
- if (input2.substr(0, dataUrlPrefix.length) === dataUrlPrefix) {
10438
+ if (input.substr(0, dataUrlPrefix.length) === dataUrlPrefix) {
10437
10439
  throw new Error("Invalid base64 input, it looks like a data url.");
10438
10440
  }
10439
- input2 = input2.replace(/[^A-Za-z0-9+/=]/g, "");
10440
- var totalLength = input2.length * 3 / 4;
10441
- if (input2.charAt(input2.length - 1) === _keyStr.charAt(64)) {
10441
+ input = input.replace(/[^A-Za-z0-9+/=]/g, "");
10442
+ var totalLength = input.length * 3 / 4;
10443
+ if (input.charAt(input.length - 1) === _keyStr.charAt(64)) {
10442
10444
  totalLength--;
10443
10445
  }
10444
- if (input2.charAt(input2.length - 2) === _keyStr.charAt(64)) {
10446
+ if (input.charAt(input.length - 2) === _keyStr.charAt(64)) {
10445
10447
  totalLength--;
10446
10448
  }
10447
10449
  if (totalLength % 1 !== 0) {
10448
10450
  throw new Error("Invalid base64 input, bad content length.");
10449
10451
  }
10450
- var output2;
10452
+ var output;
10451
10453
  if (support.uint8array) {
10452
- output2 = new Uint8Array(totalLength | 0);
10454
+ output = new Uint8Array(totalLength | 0);
10453
10455
  } else {
10454
- output2 = new Array(totalLength | 0);
10456
+ output = new Array(totalLength | 0);
10455
10457
  }
10456
- while (i < input2.length) {
10457
- enc1 = _keyStr.indexOf(input2.charAt(i++));
10458
- enc2 = _keyStr.indexOf(input2.charAt(i++));
10459
- enc3 = _keyStr.indexOf(input2.charAt(i++));
10460
- enc4 = _keyStr.indexOf(input2.charAt(i++));
10458
+ while (i < input.length) {
10459
+ enc1 = _keyStr.indexOf(input.charAt(i++));
10460
+ enc2 = _keyStr.indexOf(input.charAt(i++));
10461
+ enc3 = _keyStr.indexOf(input.charAt(i++));
10462
+ enc4 = _keyStr.indexOf(input.charAt(i++));
10461
10463
  chr1 = enc1 << 2 | enc2 >> 4;
10462
10464
  chr2 = (enc2 & 15) << 4 | enc3 >> 2;
10463
10465
  chr3 = (enc3 & 3) << 6 | enc4;
10464
- output2[resultIndex++] = chr1;
10466
+ output[resultIndex++] = chr1;
10465
10467
  if (enc3 !== 64) {
10466
- output2[resultIndex++] = chr2;
10468
+ output[resultIndex++] = chr2;
10467
10469
  }
10468
10470
  if (enc4 !== 64) {
10469
- output2[resultIndex++] = chr3;
10471
+ output[resultIndex++] = chr3;
10470
10472
  }
10471
10473
  }
10472
- return output2;
10474
+ return output;
10473
10475
  };
10474
10476
  }
10475
10477
  });
@@ -11073,8 +11075,8 @@ var require_utils = __commonJS({
11073
11075
  }
11074
11076
  }
11075
11077
  };
11076
- function identity(input2) {
11077
- return input2;
11078
+ function identity(input) {
11079
+ return input;
11078
11080
  }
11079
11081
  function stringToArrayLike(str, array) {
11080
11082
  for (var i = 0; i < str.length; ++i) {
@@ -11172,83 +11174,83 @@ var require_utils = __commonJS({
11172
11174
  var transform = {};
11173
11175
  transform["string"] = {
11174
11176
  "string": identity,
11175
- "array": function(input2) {
11176
- return stringToArrayLike(input2, new Array(input2.length));
11177
+ "array": function(input) {
11178
+ return stringToArrayLike(input, new Array(input.length));
11177
11179
  },
11178
- "arraybuffer": function(input2) {
11179
- return transform["string"]["uint8array"](input2).buffer;
11180
+ "arraybuffer": function(input) {
11181
+ return transform["string"]["uint8array"](input).buffer;
11180
11182
  },
11181
- "uint8array": function(input2) {
11182
- return stringToArrayLike(input2, new Uint8Array(input2.length));
11183
+ "uint8array": function(input) {
11184
+ return stringToArrayLike(input, new Uint8Array(input.length));
11183
11185
  },
11184
- "nodebuffer": function(input2) {
11185
- return stringToArrayLike(input2, nodejsUtils.allocBuffer(input2.length));
11186
+ "nodebuffer": function(input) {
11187
+ return stringToArrayLike(input, nodejsUtils.allocBuffer(input.length));
11186
11188
  }
11187
11189
  };
11188
11190
  transform["array"] = {
11189
11191
  "string": arrayLikeToString,
11190
11192
  "array": identity,
11191
- "arraybuffer": function(input2) {
11192
- return new Uint8Array(input2).buffer;
11193
+ "arraybuffer": function(input) {
11194
+ return new Uint8Array(input).buffer;
11193
11195
  },
11194
- "uint8array": function(input2) {
11195
- return new Uint8Array(input2);
11196
+ "uint8array": function(input) {
11197
+ return new Uint8Array(input);
11196
11198
  },
11197
- "nodebuffer": function(input2) {
11198
- return nodejsUtils.newBufferFrom(input2);
11199
+ "nodebuffer": function(input) {
11200
+ return nodejsUtils.newBufferFrom(input);
11199
11201
  }
11200
11202
  };
11201
11203
  transform["arraybuffer"] = {
11202
- "string": function(input2) {
11203
- return arrayLikeToString(new Uint8Array(input2));
11204
+ "string": function(input) {
11205
+ return arrayLikeToString(new Uint8Array(input));
11204
11206
  },
11205
- "array": function(input2) {
11206
- return arrayLikeToArrayLike(new Uint8Array(input2), new Array(input2.byteLength));
11207
+ "array": function(input) {
11208
+ return arrayLikeToArrayLike(new Uint8Array(input), new Array(input.byteLength));
11207
11209
  },
11208
11210
  "arraybuffer": identity,
11209
- "uint8array": function(input2) {
11210
- return new Uint8Array(input2);
11211
+ "uint8array": function(input) {
11212
+ return new Uint8Array(input);
11211
11213
  },
11212
- "nodebuffer": function(input2) {
11213
- return nodejsUtils.newBufferFrom(new Uint8Array(input2));
11214
+ "nodebuffer": function(input) {
11215
+ return nodejsUtils.newBufferFrom(new Uint8Array(input));
11214
11216
  }
11215
11217
  };
11216
11218
  transform["uint8array"] = {
11217
11219
  "string": arrayLikeToString,
11218
- "array": function(input2) {
11219
- return arrayLikeToArrayLike(input2, new Array(input2.length));
11220
+ "array": function(input) {
11221
+ return arrayLikeToArrayLike(input, new Array(input.length));
11220
11222
  },
11221
- "arraybuffer": function(input2) {
11222
- return input2.buffer;
11223
+ "arraybuffer": function(input) {
11224
+ return input.buffer;
11223
11225
  },
11224
11226
  "uint8array": identity,
11225
- "nodebuffer": function(input2) {
11226
- return nodejsUtils.newBufferFrom(input2);
11227
+ "nodebuffer": function(input) {
11228
+ return nodejsUtils.newBufferFrom(input);
11227
11229
  }
11228
11230
  };
11229
11231
  transform["nodebuffer"] = {
11230
11232
  "string": arrayLikeToString,
11231
- "array": function(input2) {
11232
- return arrayLikeToArrayLike(input2, new Array(input2.length));
11233
+ "array": function(input) {
11234
+ return arrayLikeToArrayLike(input, new Array(input.length));
11233
11235
  },
11234
- "arraybuffer": function(input2) {
11235
- return transform["nodebuffer"]["uint8array"](input2).buffer;
11236
+ "arraybuffer": function(input) {
11237
+ return transform["nodebuffer"]["uint8array"](input).buffer;
11236
11238
  },
11237
- "uint8array": function(input2) {
11238
- return arrayLikeToArrayLike(input2, new Uint8Array(input2.length));
11239
+ "uint8array": function(input) {
11240
+ return arrayLikeToArrayLike(input, new Uint8Array(input.length));
11239
11241
  },
11240
11242
  "nodebuffer": identity
11241
11243
  };
11242
- exports2.transformTo = function(outputType, input2) {
11243
- if (!input2) {
11244
- input2 = "";
11244
+ exports2.transformTo = function(outputType, input) {
11245
+ if (!input) {
11246
+ input = "";
11245
11247
  }
11246
11248
  if (!outputType) {
11247
- return input2;
11249
+ return input;
11248
11250
  }
11249
11251
  exports2.checkSupport(outputType);
11250
- var inputType = exports2.getTypeOf(input2);
11251
- var result = transform[inputType][outputType](input2);
11252
+ var inputType = exports2.getTypeOf(input);
11253
+ var result = transform[inputType][outputType](input);
11252
11254
  return result;
11253
11255
  };
11254
11256
  exports2.resolve = function(path10) {
@@ -11266,20 +11268,20 @@ var require_utils = __commonJS({
11266
11268
  }
11267
11269
  return result.join("/");
11268
11270
  };
11269
- exports2.getTypeOf = function(input2) {
11270
- if (typeof input2 === "string") {
11271
+ exports2.getTypeOf = function(input) {
11272
+ if (typeof input === "string") {
11271
11273
  return "string";
11272
11274
  }
11273
- if (Object.prototype.toString.call(input2) === "[object Array]") {
11275
+ if (Object.prototype.toString.call(input) === "[object Array]") {
11274
11276
  return "array";
11275
11277
  }
11276
- if (support.nodebuffer && nodejsUtils.isBuffer(input2)) {
11278
+ if (support.nodebuffer && nodejsUtils.isBuffer(input)) {
11277
11279
  return "nodebuffer";
11278
11280
  }
11279
- if (support.uint8array && input2 instanceof Uint8Array) {
11281
+ if (support.uint8array && input instanceof Uint8Array) {
11280
11282
  return "uint8array";
11281
11283
  }
11282
- if (support.arraybuffer && input2 instanceof ArrayBuffer) {
11284
+ if (support.arraybuffer && input instanceof ArrayBuffer) {
11283
11285
  return "arraybuffer";
11284
11286
  }
11285
11287
  };
@@ -12130,15 +12132,15 @@ var require_crc32 = __commonJS({
12130
12132
  }
12131
12133
  return crc ^ -1;
12132
12134
  }
12133
- module2.exports = function crc32wrapper(input2, crc) {
12134
- if (typeof input2 === "undefined" || !input2.length) {
12135
+ module2.exports = function crc32wrapper(input, crc) {
12136
+ if (typeof input === "undefined" || !input.length) {
12135
12137
  return 0;
12136
12138
  }
12137
- var isArray = utils.getTypeOf(input2) !== "string";
12139
+ var isArray = utils.getTypeOf(input) !== "string";
12138
12140
  if (isArray) {
12139
- return crc32(crc | 0, input2, input2.length, 0);
12141
+ return crc32(crc | 0, input, input.length, 0);
12140
12142
  } else {
12141
- return crc32str(crc | 0, input2, input2.length, 0);
12143
+ return crc32str(crc | 0, input, input.length, 0);
12142
12144
  }
12143
12145
  };
12144
12146
  }
@@ -14138,7 +14140,7 @@ var require_deflate = __commonJS({
14138
14140
  var wrap;
14139
14141
  var avail;
14140
14142
  var next;
14141
- var input2;
14143
+ var input;
14142
14144
  var tmpDict;
14143
14145
  if (!strm || !strm.state) {
14144
14146
  return Z_STREAM_ERROR;
@@ -14166,7 +14168,7 @@ var require_deflate = __commonJS({
14166
14168
  }
14167
14169
  avail = strm.avail_in;
14168
14170
  next = strm.next_in;
14169
- input2 = strm.input;
14171
+ input = strm.input;
14170
14172
  strm.avail_in = dictLength;
14171
14173
  strm.next_in = 0;
14172
14174
  strm.input = dictionary;
@@ -14191,7 +14193,7 @@ var require_deflate = __commonJS({
14191
14193
  s.match_length = s.prev_length = MIN_MATCH - 1;
14192
14194
  s.match_available = 0;
14193
14195
  strm.next_in = next;
14194
- strm.input = input2;
14196
+ strm.input = input;
14195
14197
  strm.avail_in = avail;
14196
14198
  s.wrap = wrap;
14197
14199
  return Z_OK;
@@ -14508,23 +14510,23 @@ var require_deflate2 = __commonJS({
14508
14510
  this.err = status;
14509
14511
  this.msg = this.strm.msg;
14510
14512
  };
14511
- function deflate(input2, options) {
14513
+ function deflate(input, options) {
14512
14514
  var deflator = new Deflate(options);
14513
- deflator.push(input2, true);
14515
+ deflator.push(input, true);
14514
14516
  if (deflator.err) {
14515
14517
  throw deflator.msg || msg[deflator.err];
14516
14518
  }
14517
14519
  return deflator.result;
14518
14520
  }
14519
- function deflateRaw(input2, options) {
14521
+ function deflateRaw(input, options) {
14520
14522
  options = options || {};
14521
14523
  options.raw = true;
14522
- return deflate(input2, options);
14524
+ return deflate(input, options);
14523
14525
  }
14524
- function gzip(input2, options) {
14526
+ function gzip(input, options) {
14525
14527
  options = options || {};
14526
14528
  options.gzip = true;
14527
- return deflate(input2, options);
14529
+ return deflate(input, options);
14528
14530
  }
14529
14531
  exports2.Deflate = Deflate;
14530
14532
  exports2.deflate = deflate;
@@ -14563,13 +14565,13 @@ var require_inffast = __commonJS({
14563
14565
  var dist;
14564
14566
  var from;
14565
14567
  var from_source;
14566
- var input2, output2;
14568
+ var input, output;
14567
14569
  state = strm.state;
14568
14570
  _in = strm.next_in;
14569
- input2 = strm.input;
14571
+ input = strm.input;
14570
14572
  last = _in + (strm.avail_in - 5);
14571
14573
  _out = strm.next_out;
14572
- output2 = strm.output;
14574
+ output = strm.output;
14573
14575
  beg = _out - (start - strm.avail_out);
14574
14576
  end = _out + (strm.avail_out - 257);
14575
14577
  dmax = state.dmax;
@@ -14586,9 +14588,9 @@ var require_inffast = __commonJS({
14586
14588
  top:
14587
14589
  do {
14588
14590
  if (bits < 15) {
14589
- hold += input2[_in++] << bits;
14591
+ hold += input[_in++] << bits;
14590
14592
  bits += 8;
14591
- hold += input2[_in++] << bits;
14593
+ hold += input[_in++] << bits;
14592
14594
  bits += 8;
14593
14595
  }
14594
14596
  here = lcode[hold & lmask];
@@ -14599,13 +14601,13 @@ var require_inffast = __commonJS({
14599
14601
  bits -= op;
14600
14602
  op = here >>> 16 & 255;
14601
14603
  if (op === 0) {
14602
- output2[_out++] = here & 65535;
14604
+ output[_out++] = here & 65535;
14603
14605
  } else if (op & 16) {
14604
14606
  len = here & 65535;
14605
14607
  op &= 15;
14606
14608
  if (op) {
14607
14609
  if (bits < op) {
14608
- hold += input2[_in++] << bits;
14610
+ hold += input[_in++] << bits;
14609
14611
  bits += 8;
14610
14612
  }
14611
14613
  len += hold & (1 << op) - 1;
@@ -14613,9 +14615,9 @@ var require_inffast = __commonJS({
14613
14615
  bits -= op;
14614
14616
  }
14615
14617
  if (bits < 15) {
14616
- hold += input2[_in++] << bits;
14618
+ hold += input[_in++] << bits;
14617
14619
  bits += 8;
14618
- hold += input2[_in++] << bits;
14620
+ hold += input[_in++] << bits;
14619
14621
  bits += 8;
14620
14622
  }
14621
14623
  here = dcode[hold & dmask];
@@ -14629,10 +14631,10 @@ var require_inffast = __commonJS({
14629
14631
  dist = here & 65535;
14630
14632
  op &= 15;
14631
14633
  if (bits < op) {
14632
- hold += input2[_in++] << bits;
14634
+ hold += input[_in++] << bits;
14633
14635
  bits += 8;
14634
14636
  if (bits < op) {
14635
- hold += input2[_in++] << bits;
14637
+ hold += input[_in++] << bits;
14636
14638
  bits += 8;
14637
14639
  }
14638
14640
  }
@@ -14661,10 +14663,10 @@ var require_inffast = __commonJS({
14661
14663
  if (op < len) {
14662
14664
  len -= op;
14663
14665
  do {
14664
- output2[_out++] = s_window[from++];
14666
+ output[_out++] = s_window[from++];
14665
14667
  } while (--op);
14666
14668
  from = _out - dist;
14667
- from_source = output2;
14669
+ from_source = output;
14668
14670
  }
14669
14671
  } else if (wnext < op) {
14670
14672
  from += wsize + wnext - op;
@@ -14672,17 +14674,17 @@ var require_inffast = __commonJS({
14672
14674
  if (op < len) {
14673
14675
  len -= op;
14674
14676
  do {
14675
- output2[_out++] = s_window[from++];
14677
+ output[_out++] = s_window[from++];
14676
14678
  } while (--op);
14677
14679
  from = 0;
14678
14680
  if (wnext < len) {
14679
14681
  op = wnext;
14680
14682
  len -= op;
14681
14683
  do {
14682
- output2[_out++] = s_window[from++];
14684
+ output[_out++] = s_window[from++];
14683
14685
  } while (--op);
14684
14686
  from = _out - dist;
14685
- from_source = output2;
14687
+ from_source = output;
14686
14688
  }
14687
14689
  }
14688
14690
  } else {
@@ -14690,36 +14692,36 @@ var require_inffast = __commonJS({
14690
14692
  if (op < len) {
14691
14693
  len -= op;
14692
14694
  do {
14693
- output2[_out++] = s_window[from++];
14695
+ output[_out++] = s_window[from++];
14694
14696
  } while (--op);
14695
14697
  from = _out - dist;
14696
- from_source = output2;
14698
+ from_source = output;
14697
14699
  }
14698
14700
  }
14699
14701
  while (len > 2) {
14700
- output2[_out++] = from_source[from++];
14701
- output2[_out++] = from_source[from++];
14702
- output2[_out++] = from_source[from++];
14702
+ output[_out++] = from_source[from++];
14703
+ output[_out++] = from_source[from++];
14704
+ output[_out++] = from_source[from++];
14703
14705
  len -= 3;
14704
14706
  }
14705
14707
  if (len) {
14706
- output2[_out++] = from_source[from++];
14708
+ output[_out++] = from_source[from++];
14707
14709
  if (len > 1) {
14708
- output2[_out++] = from_source[from++];
14710
+ output[_out++] = from_source[from++];
14709
14711
  }
14710
14712
  }
14711
14713
  } else {
14712
14714
  from = _out - dist;
14713
14715
  do {
14714
- output2[_out++] = output2[from++];
14715
- output2[_out++] = output2[from++];
14716
- output2[_out++] = output2[from++];
14716
+ output[_out++] = output[from++];
14717
+ output[_out++] = output[from++];
14718
+ output[_out++] = output[from++];
14717
14719
  len -= 3;
14718
14720
  } while (len > 2);
14719
14721
  if (len) {
14720
- output2[_out++] = output2[from++];
14722
+ output[_out++] = output[from++];
14721
14723
  if (len > 1) {
14722
- output2[_out++] = output2[from++];
14724
+ output[_out++] = output[from++];
14723
14725
  }
14724
14726
  }
14725
14727
  }
@@ -15328,7 +15330,7 @@ var require_inflate = __commonJS({
15328
15330
  }
15329
15331
  function inflate(strm, flush) {
15330
15332
  var state;
15331
- var input2, output2;
15333
+ var input, output;
15332
15334
  var next;
15333
15335
  var put;
15334
15336
  var have, left;
@@ -15358,10 +15360,10 @@ var require_inflate = __commonJS({
15358
15360
  state.mode = TYPEDO;
15359
15361
  }
15360
15362
  put = strm.next_out;
15361
- output2 = strm.output;
15363
+ output = strm.output;
15362
15364
  left = strm.avail_out;
15363
15365
  next = strm.next_in;
15364
- input2 = strm.input;
15366
+ input = strm.input;
15365
15367
  have = strm.avail_in;
15366
15368
  hold = state.hold;
15367
15369
  bits = state.bits;
@@ -15381,7 +15383,7 @@ var require_inflate = __commonJS({
15381
15383
  break inf_leave;
15382
15384
  }
15383
15385
  have--;
15384
- hold += input2[next++] << bits;
15386
+ hold += input[next++] << bits;
15385
15387
  bits += 8;
15386
15388
  }
15387
15389
  if (state.wrap & 2 && hold === 35615) {
@@ -15431,7 +15433,7 @@ var require_inflate = __commonJS({
15431
15433
  break inf_leave;
15432
15434
  }
15433
15435
  have--;
15434
- hold += input2[next++] << bits;
15436
+ hold += input[next++] << bits;
15435
15437
  bits += 8;
15436
15438
  }
15437
15439
  state.flags = hold;
@@ -15463,7 +15465,7 @@ var require_inflate = __commonJS({
15463
15465
  break inf_leave;
15464
15466
  }
15465
15467
  have--;
15466
- hold += input2[next++] << bits;
15468
+ hold += input[next++] << bits;
15467
15469
  bits += 8;
15468
15470
  }
15469
15471
  if (state.head) {
@@ -15486,7 +15488,7 @@ var require_inflate = __commonJS({
15486
15488
  break inf_leave;
15487
15489
  }
15488
15490
  have--;
15489
- hold += input2[next++] << bits;
15491
+ hold += input[next++] << bits;
15490
15492
  bits += 8;
15491
15493
  }
15492
15494
  if (state.head) {
@@ -15509,7 +15511,7 @@ var require_inflate = __commonJS({
15509
15511
  break inf_leave;
15510
15512
  }
15511
15513
  have--;
15512
- hold += input2[next++] << bits;
15514
+ hold += input[next++] << bits;
15513
15515
  bits += 8;
15514
15516
  }
15515
15517
  state.length = hold;
@@ -15542,7 +15544,7 @@ var require_inflate = __commonJS({
15542
15544
  }
15543
15545
  utils.arraySet(
15544
15546
  state.head.extra,
15545
- input2,
15547
+ input,
15546
15548
  next,
15547
15549
  // extra field is limited to 65536 bytes
15548
15550
  // - no need for additional size check
@@ -15552,7 +15554,7 @@ var require_inflate = __commonJS({
15552
15554
  );
15553
15555
  }
15554
15556
  if (state.flags & 512) {
15555
- state.check = crc32(state.check, input2, copy, next);
15557
+ state.check = crc32(state.check, input, copy, next);
15556
15558
  }
15557
15559
  have -= copy;
15558
15560
  next += copy;
@@ -15572,13 +15574,13 @@ var require_inflate = __commonJS({
15572
15574
  }
15573
15575
  copy = 0;
15574
15576
  do {
15575
- len = input2[next + copy++];
15577
+ len = input[next + copy++];
15576
15578
  if (state.head && len && state.length < 65536) {
15577
15579
  state.head.name += String.fromCharCode(len);
15578
15580
  }
15579
15581
  } while (len && copy < have);
15580
15582
  if (state.flags & 512) {
15581
- state.check = crc32(state.check, input2, copy, next);
15583
+ state.check = crc32(state.check, input, copy, next);
15582
15584
  }
15583
15585
  have -= copy;
15584
15586
  next += copy;
@@ -15598,13 +15600,13 @@ var require_inflate = __commonJS({
15598
15600
  }
15599
15601
  copy = 0;
15600
15602
  do {
15601
- len = input2[next + copy++];
15603
+ len = input[next + copy++];
15602
15604
  if (state.head && len && state.length < 65536) {
15603
15605
  state.head.comment += String.fromCharCode(len);
15604
15606
  }
15605
15607
  } while (len && copy < have);
15606
15608
  if (state.flags & 512) {
15607
- state.check = crc32(state.check, input2, copy, next);
15609
+ state.check = crc32(state.check, input, copy, next);
15608
15610
  }
15609
15611
  have -= copy;
15610
15612
  next += copy;
@@ -15623,7 +15625,7 @@ var require_inflate = __commonJS({
15623
15625
  break inf_leave;
15624
15626
  }
15625
15627
  have--;
15626
- hold += input2[next++] << bits;
15628
+ hold += input[next++] << bits;
15627
15629
  bits += 8;
15628
15630
  }
15629
15631
  if (hold !== (state.check & 65535)) {
@@ -15647,7 +15649,7 @@ var require_inflate = __commonJS({
15647
15649
  break inf_leave;
15648
15650
  }
15649
15651
  have--;
15650
- hold += input2[next++] << bits;
15652
+ hold += input[next++] << bits;
15651
15653
  bits += 8;
15652
15654
  }
15653
15655
  strm.adler = state.check = zswap32(hold);
@@ -15685,7 +15687,7 @@ var require_inflate = __commonJS({
15685
15687
  break inf_leave;
15686
15688
  }
15687
15689
  have--;
15688
- hold += input2[next++] << bits;
15690
+ hold += input[next++] << bits;
15689
15691
  bits += 8;
15690
15692
  }
15691
15693
  state.last = hold & 1;
@@ -15722,7 +15724,7 @@ var require_inflate = __commonJS({
15722
15724
  break inf_leave;
15723
15725
  }
15724
15726
  have--;
15725
- hold += input2[next++] << bits;
15727
+ hold += input[next++] << bits;
15726
15728
  bits += 8;
15727
15729
  }
15728
15730
  if ((hold & 65535) !== (hold >>> 16 ^ 65535)) {
@@ -15753,7 +15755,7 @@ var require_inflate = __commonJS({
15753
15755
  if (copy === 0) {
15754
15756
  break inf_leave;
15755
15757
  }
15756
- utils.arraySet(output2, input2, next, copy, put);
15758
+ utils.arraySet(output, input, next, copy, put);
15757
15759
  have -= copy;
15758
15760
  next += copy;
15759
15761
  left -= copy;
@@ -15769,7 +15771,7 @@ var require_inflate = __commonJS({
15769
15771
  break inf_leave;
15770
15772
  }
15771
15773
  have--;
15772
- hold += input2[next++] << bits;
15774
+ hold += input[next++] << bits;
15773
15775
  bits += 8;
15774
15776
  }
15775
15777
  state.nlen = (hold & 31) + 257;
@@ -15796,7 +15798,7 @@ var require_inflate = __commonJS({
15796
15798
  break inf_leave;
15797
15799
  }
15798
15800
  have--;
15799
- hold += input2[next++] << bits;
15801
+ hold += input[next++] << bits;
15800
15802
  bits += 8;
15801
15803
  }
15802
15804
  state.lens[order[state.have++]] = hold & 7;
@@ -15833,7 +15835,7 @@ var require_inflate = __commonJS({
15833
15835
  break inf_leave;
15834
15836
  }
15835
15837
  have--;
15836
- hold += input2[next++] << bits;
15838
+ hold += input[next++] << bits;
15837
15839
  bits += 8;
15838
15840
  }
15839
15841
  if (here_val < 16) {
@@ -15848,7 +15850,7 @@ var require_inflate = __commonJS({
15848
15850
  break inf_leave;
15849
15851
  }
15850
15852
  have--;
15851
- hold += input2[next++] << bits;
15853
+ hold += input[next++] << bits;
15852
15854
  bits += 8;
15853
15855
  }
15854
15856
  hold >>>= here_bits;
@@ -15869,7 +15871,7 @@ var require_inflate = __commonJS({
15869
15871
  break inf_leave;
15870
15872
  }
15871
15873
  have--;
15872
- hold += input2[next++] << bits;
15874
+ hold += input[next++] << bits;
15873
15875
  bits += 8;
15874
15876
  }
15875
15877
  hold >>>= here_bits;
@@ -15885,7 +15887,7 @@ var require_inflate = __commonJS({
15885
15887
  break inf_leave;
15886
15888
  }
15887
15889
  have--;
15888
- hold += input2[next++] << bits;
15890
+ hold += input[next++] << bits;
15889
15891
  bits += 8;
15890
15892
  }
15891
15893
  hold >>>= here_bits;
@@ -15950,10 +15952,10 @@ var require_inflate = __commonJS({
15950
15952
  state.bits = bits;
15951
15953
  inflate_fast(strm, _out);
15952
15954
  put = strm.next_out;
15953
- output2 = strm.output;
15955
+ output = strm.output;
15954
15956
  left = strm.avail_out;
15955
15957
  next = strm.next_in;
15956
- input2 = strm.input;
15958
+ input = strm.input;
15957
15959
  have = strm.avail_in;
15958
15960
  hold = state.hold;
15959
15961
  bits = state.bits;
@@ -15975,7 +15977,7 @@ var require_inflate = __commonJS({
15975
15977
  break inf_leave;
15976
15978
  }
15977
15979
  have--;
15978
- hold += input2[next++] << bits;
15980
+ hold += input[next++] << bits;
15979
15981
  bits += 8;
15980
15982
  }
15981
15983
  if (here_op && (here_op & 240) === 0) {
@@ -15994,7 +15996,7 @@ var require_inflate = __commonJS({
15994
15996
  break inf_leave;
15995
15997
  }
15996
15998
  have--;
15997
- hold += input2[next++] << bits;
15999
+ hold += input[next++] << bits;
15998
16000
  bits += 8;
15999
16001
  }
16000
16002
  hold >>>= last_bits;
@@ -16030,7 +16032,7 @@ var require_inflate = __commonJS({
16030
16032
  break inf_leave;
16031
16033
  }
16032
16034
  have--;
16033
- hold += input2[next++] << bits;
16035
+ hold += input[next++] << bits;
16034
16036
  bits += 8;
16035
16037
  }
16036
16038
  state.length += hold & (1 << state.extra) - 1;
@@ -16054,7 +16056,7 @@ var require_inflate = __commonJS({
16054
16056
  break inf_leave;
16055
16057
  }
16056
16058
  have--;
16057
- hold += input2[next++] << bits;
16059
+ hold += input[next++] << bits;
16058
16060
  bits += 8;
16059
16061
  }
16060
16062
  if ((here_op & 240) === 0) {
@@ -16073,7 +16075,7 @@ var require_inflate = __commonJS({
16073
16075
  break inf_leave;
16074
16076
  }
16075
16077
  have--;
16076
- hold += input2[next++] << bits;
16078
+ hold += input[next++] << bits;
16077
16079
  bits += 8;
16078
16080
  }
16079
16081
  hold >>>= last_bits;
@@ -16100,7 +16102,7 @@ var require_inflate = __commonJS({
16100
16102
  break inf_leave;
16101
16103
  }
16102
16104
  have--;
16103
- hold += input2[next++] << bits;
16105
+ hold += input[next++] << bits;
16104
16106
  bits += 8;
16105
16107
  }
16106
16108
  state.offset += hold & (1 << state.extra) - 1;
@@ -16140,7 +16142,7 @@ var require_inflate = __commonJS({
16140
16142
  }
16141
16143
  from_source = state.window;
16142
16144
  } else {
16143
- from_source = output2;
16145
+ from_source = output;
16144
16146
  from = put - state.offset;
16145
16147
  copy = state.length;
16146
16148
  }
@@ -16150,7 +16152,7 @@ var require_inflate = __commonJS({
16150
16152
  left -= copy;
16151
16153
  state.length -= copy;
16152
16154
  do {
16153
- output2[put++] = from_source[from++];
16155
+ output[put++] = from_source[from++];
16154
16156
  } while (--copy);
16155
16157
  if (state.length === 0) {
16156
16158
  state.mode = LEN;
@@ -16160,7 +16162,7 @@ var require_inflate = __commonJS({
16160
16162
  if (left === 0) {
16161
16163
  break inf_leave;
16162
16164
  }
16163
- output2[put++] = state.length;
16165
+ output[put++] = state.length;
16164
16166
  left--;
16165
16167
  state.mode = LEN;
16166
16168
  break;
@@ -16171,7 +16173,7 @@ var require_inflate = __commonJS({
16171
16173
  break inf_leave;
16172
16174
  }
16173
16175
  have--;
16174
- hold |= input2[next++] << bits;
16176
+ hold |= input[next++] << bits;
16175
16177
  bits += 8;
16176
16178
  }
16177
16179
  _out -= left;
@@ -16179,7 +16181,7 @@ var require_inflate = __commonJS({
16179
16181
  state.total += _out;
16180
16182
  if (_out) {
16181
16183
  strm.adler = state.check = /*UPDATE(state.check, put - _out, _out);*/
16182
- state.flags ? crc32(state.check, output2, _out, put - _out) : adler32(state.check, output2, _out, put - _out);
16184
+ state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out);
16183
16185
  }
16184
16186
  _out = left;
16185
16187
  if ((state.flags ? hold : zswap32(hold)) !== state.check) {
@@ -16199,7 +16201,7 @@ var require_inflate = __commonJS({
16199
16201
  break inf_leave;
16200
16202
  }
16201
16203
  have--;
16202
- hold += input2[next++] << bits;
16204
+ hold += input[next++] << bits;
16203
16205
  bits += 8;
16204
16206
  }
16205
16207
  if (hold !== (state.total & 4294967295)) {
@@ -16245,7 +16247,7 @@ var require_inflate = __commonJS({
16245
16247
  state.total += _out;
16246
16248
  if (state.wrap && _out) {
16247
16249
  strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/
16248
- state.flags ? crc32(state.check, output2, _out, strm.next_out - _out) : adler32(state.check, output2, _out, strm.next_out - _out);
16250
+ state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out);
16249
16251
  }
16250
16252
  strm.data_type = state.bits + (state.last ? 64 : 0) + (state.mode === TYPE ? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);
16251
16253
  if ((_in === 0 && _out === 0 || flush === Z_FINISH) && ret2 === Z_OK) {
@@ -16538,18 +16540,18 @@ var require_inflate2 = __commonJS({
16538
16540
  this.err = status;
16539
16541
  this.msg = this.strm.msg;
16540
16542
  };
16541
- function inflate(input2, options) {
16543
+ function inflate(input, options) {
16542
16544
  var inflator = new Inflate(options);
16543
- inflator.push(input2, true);
16545
+ inflator.push(input, true);
16544
16546
  if (inflator.err) {
16545
16547
  throw inflator.msg || msg[inflator.err];
16546
16548
  }
16547
16549
  return inflator.result;
16548
16550
  }
16549
- function inflateRaw(input2, options) {
16551
+ function inflateRaw(input, options) {
16550
16552
  options = options || {};
16551
16553
  options.raw = true;
16552
- return inflate(input2, options);
16554
+ return inflate(input, options);
16553
16555
  }
16554
16556
  exports2.Inflate = Inflate;
16555
16557
  exports2.inflate = inflate;
@@ -18052,20 +18054,20 @@ var require_load = __commonJS({
18052
18054
  var zipEntries = results.shift();
18053
18055
  var files = zipEntries.files;
18054
18056
  for (var i = 0; i < files.length; i++) {
18055
- var input2 = files[i];
18056
- var unsafeName = input2.fileNameStr;
18057
- var safeName = utils.resolve(input2.fileNameStr);
18058
- zip.file(safeName, input2.decompressed, {
18057
+ var input = files[i];
18058
+ var unsafeName = input.fileNameStr;
18059
+ var safeName = utils.resolve(input.fileNameStr);
18060
+ zip.file(safeName, input.decompressed, {
18059
18061
  binary: true,
18060
18062
  optimizedBinaryString: true,
18061
- date: input2.date,
18062
- dir: input2.dir,
18063
- comment: input2.fileCommentStr.length ? input2.fileCommentStr : null,
18064
- unixPermissions: input2.unixPermissions,
18065
- dosPermissions: input2.dosPermissions,
18063
+ date: input.date,
18064
+ dir: input.dir,
18065
+ comment: input.fileCommentStr.length ? input.fileCommentStr : null,
18066
+ unixPermissions: input.unixPermissions,
18067
+ dosPermissions: input.dosPermissions,
18066
18068
  createFolders: options.createFolders
18067
18069
  });
18068
- if (!input2.dir) {
18070
+ if (!input.dir) {
18069
18071
  zip.file(safeName).unsafeOriginalName = unsafeName;
18070
18072
  }
18071
18073
  }
@@ -18180,15 +18182,15 @@ var require_buffer_list = __commonJS({
18180
18182
  var key = _toPrimitive(arg, "string");
18181
18183
  return typeof key === "symbol" ? key : String(key);
18182
18184
  }
18183
- function _toPrimitive(input2, hint) {
18184
- if (typeof input2 !== "object" || input2 === null) return input2;
18185
- var prim = input2[Symbol.toPrimitive];
18185
+ function _toPrimitive(input, hint) {
18186
+ if (typeof input !== "object" || input === null) return input;
18187
+ var prim = input[Symbol.toPrimitive];
18186
18188
  if (prim !== void 0) {
18187
- var res = prim.call(input2, hint || "default");
18189
+ var res = prim.call(input, hint || "default");
18188
18190
  if (typeof res !== "object") return res;
18189
18191
  throw new TypeError("@@toPrimitive must return a primitive value.");
18190
18192
  }
18191
- return (hint === "string" ? String : Number)(input2);
18193
+ return (hint === "string" ? String : Number)(input);
18192
18194
  }
18193
18195
  var _require = require("buffer");
18194
18196
  var Buffer2 = _require.Buffer;
@@ -18582,7 +18584,7 @@ var require_state = __commonJS({
18582
18584
  var require_stream_writable2 = __commonJS({
18583
18585
  "../../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_writable.js"(exports2, module2) {
18584
18586
  "use strict";
18585
- module2.exports = Writable;
18587
+ module2.exports = Writable2;
18586
18588
  function CorkedRequest(state) {
18587
18589
  var _this = this;
18588
18590
  this.next = null;
@@ -18592,7 +18594,7 @@ var require_stream_writable2 = __commonJS({
18592
18594
  };
18593
18595
  }
18594
18596
  var Duplex;
18595
- Writable.WritableState = WritableState;
18597
+ Writable2.WritableState = WritableState;
18596
18598
  var internalUtil = {
18597
18599
  deprecate: require_node()
18598
18600
  };
@@ -18619,7 +18621,7 @@ var require_stream_writable2 = __commonJS({
18619
18621
  var ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END;
18620
18622
  var ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
18621
18623
  var errorOrDestroy = destroyImpl.errorOrDestroy;
18622
- require_inherits()(Writable, Stream);
18624
+ require_inherits()(Writable2, Stream);
18623
18625
  function nop() {
18624
18626
  }
18625
18627
  function WritableState(options, stream, isDuplex) {
@@ -18680,10 +18682,10 @@ var require_stream_writable2 = __commonJS({
18680
18682
  var realHasInstance;
18681
18683
  if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") {
18682
18684
  realHasInstance = Function.prototype[Symbol.hasInstance];
18683
- Object.defineProperty(Writable, Symbol.hasInstance, {
18685
+ Object.defineProperty(Writable2, Symbol.hasInstance, {
18684
18686
  value: function value(object) {
18685
18687
  if (realHasInstance.call(this, object)) return true;
18686
- if (this !== Writable) return false;
18688
+ if (this !== Writable2) return false;
18687
18689
  return object && object._writableState instanceof WritableState;
18688
18690
  }
18689
18691
  });
@@ -18692,10 +18694,10 @@ var require_stream_writable2 = __commonJS({
18692
18694
  return object instanceof this;
18693
18695
  };
18694
18696
  }
18695
- function Writable(options) {
18697
+ function Writable2(options) {
18696
18698
  Duplex = Duplex || require_stream_duplex2();
18697
18699
  var isDuplex = this instanceof Duplex;
18698
- if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);
18700
+ if (!isDuplex && !realHasInstance.call(Writable2, this)) return new Writable2(options);
18699
18701
  this._writableState = new WritableState(options, this, isDuplex);
18700
18702
  this.writable = true;
18701
18703
  if (options) {
@@ -18706,7 +18708,7 @@ var require_stream_writable2 = __commonJS({
18706
18708
  }
18707
18709
  Stream.call(this);
18708
18710
  }
18709
- Writable.prototype.pipe = function() {
18711
+ Writable2.prototype.pipe = function() {
18710
18712
  errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
18711
18713
  };
18712
18714
  function writeAfterEnd(stream, cb) {
@@ -18728,7 +18730,7 @@ var require_stream_writable2 = __commonJS({
18728
18730
  }
18729
18731
  return true;
18730
18732
  }
18731
- Writable.prototype.write = function(chunk, encoding, cb) {
18733
+ Writable2.prototype.write = function(chunk, encoding, cb) {
18732
18734
  var state = this._writableState;
18733
18735
  var ret2 = false;
18734
18736
  var isBuf = !state.objectMode && _isUint8Array(chunk);
@@ -18749,23 +18751,23 @@ var require_stream_writable2 = __commonJS({
18749
18751
  }
18750
18752
  return ret2;
18751
18753
  };
18752
- Writable.prototype.cork = function() {
18754
+ Writable2.prototype.cork = function() {
18753
18755
  this._writableState.corked++;
18754
18756
  };
18755
- Writable.prototype.uncork = function() {
18757
+ Writable2.prototype.uncork = function() {
18756
18758
  var state = this._writableState;
18757
18759
  if (state.corked) {
18758
18760
  state.corked--;
18759
18761
  if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
18760
18762
  }
18761
18763
  };
18762
- Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
18764
+ Writable2.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
18763
18765
  if (typeof encoding === "string") encoding = encoding.toLowerCase();
18764
18766
  if (!(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((encoding + "").toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);
18765
18767
  this._writableState.defaultEncoding = encoding;
18766
18768
  return this;
18767
18769
  };
18768
- Object.defineProperty(Writable.prototype, "writableBuffer", {
18770
+ Object.defineProperty(Writable2.prototype, "writableBuffer", {
18769
18771
  // making it explicit this property is not enumerable
18770
18772
  // because otherwise some prototype manipulation in
18771
18773
  // userland will fail
@@ -18780,7 +18782,7 @@ var require_stream_writable2 = __commonJS({
18780
18782
  }
18781
18783
  return chunk;
18782
18784
  }
18783
- Object.defineProperty(Writable.prototype, "writableHighWaterMark", {
18785
+ Object.defineProperty(Writable2.prototype, "writableHighWaterMark", {
18784
18786
  // making it explicit this property is not enumerable
18785
18787
  // because otherwise some prototype manipulation in
18786
18788
  // userland will fail
@@ -18928,11 +18930,11 @@ var require_stream_writable2 = __commonJS({
18928
18930
  state.bufferedRequest = entry;
18929
18931
  state.bufferProcessing = false;
18930
18932
  }
18931
- Writable.prototype._write = function(chunk, encoding, cb) {
18933
+ Writable2.prototype._write = function(chunk, encoding, cb) {
18932
18934
  cb(new ERR_METHOD_NOT_IMPLEMENTED("_write()"));
18933
18935
  };
18934
- Writable.prototype._writev = null;
18935
- Writable.prototype.end = function(chunk, encoding, cb) {
18936
+ Writable2.prototype._writev = null;
18937
+ Writable2.prototype.end = function(chunk, encoding, cb) {
18936
18938
  var state = this._writableState;
18937
18939
  if (typeof chunk === "function") {
18938
18940
  cb = chunk;
@@ -18950,7 +18952,7 @@ var require_stream_writable2 = __commonJS({
18950
18952
  if (!state.ending) endWritable(this, state, cb);
18951
18953
  return this;
18952
18954
  };
18953
- Object.defineProperty(Writable.prototype, "writableLength", {
18955
+ Object.defineProperty(Writable2.prototype, "writableLength", {
18954
18956
  // making it explicit this property is not enumerable
18955
18957
  // because otherwise some prototype manipulation in
18956
18958
  // userland will fail
@@ -19023,7 +19025,7 @@ var require_stream_writable2 = __commonJS({
19023
19025
  }
19024
19026
  state.corkedRequestsFree.next = corkReq;
19025
19027
  }
19026
- Object.defineProperty(Writable.prototype, "destroyed", {
19028
+ Object.defineProperty(Writable2.prototype, "destroyed", {
19027
19029
  // making it explicit this property is not enumerable
19028
19030
  // because otherwise some prototype manipulation in
19029
19031
  // userland will fail
@@ -19041,9 +19043,9 @@ var require_stream_writable2 = __commonJS({
19041
19043
  this._writableState.destroyed = value;
19042
19044
  }
19043
19045
  });
19044
- Writable.prototype.destroy = destroyImpl.destroy;
19045
- Writable.prototype._undestroy = destroyImpl.undestroy;
19046
- Writable.prototype._destroy = function(err, cb) {
19046
+ Writable2.prototype.destroy = destroyImpl.destroy;
19047
+ Writable2.prototype._undestroy = destroyImpl.undestroy;
19048
+ Writable2.prototype._destroy = function(err, cb) {
19047
19049
  cb(err);
19048
19050
  };
19049
19051
  }
@@ -19060,13 +19062,13 @@ var require_stream_duplex2 = __commonJS({
19060
19062
  };
19061
19063
  module2.exports = Duplex;
19062
19064
  var Readable = require_stream_readable2();
19063
- var Writable = require_stream_writable2();
19065
+ var Writable2 = require_stream_writable2();
19064
19066
  require_inherits()(Duplex, Readable);
19065
19067
  {
19066
- keys = objectKeys(Writable.prototype);
19068
+ keys = objectKeys(Writable2.prototype);
19067
19069
  for (v = 0; v < keys.length; v++) {
19068
19070
  method = keys[v];
19069
- if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
19071
+ if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable2.prototype[method];
19070
19072
  }
19071
19073
  }
19072
19074
  var keys;
@@ -19075,7 +19077,7 @@ var require_stream_duplex2 = __commonJS({
19075
19077
  function Duplex(options) {
19076
19078
  if (!(this instanceof Duplex)) return new Duplex(options);
19077
19079
  Readable.call(this, options);
19078
- Writable.call(this, options);
19080
+ Writable2.call(this, options);
19079
19081
  this.allowHalfOpen = true;
19080
19082
  if (options) {
19081
19083
  if (options.readable === false) this.readable = false;
@@ -19545,15 +19547,15 @@ var require_async_iterator = __commonJS({
19545
19547
  var key = _toPrimitive(arg, "string");
19546
19548
  return typeof key === "symbol" ? key : String(key);
19547
19549
  }
19548
- function _toPrimitive(input2, hint) {
19549
- if (typeof input2 !== "object" || input2 === null) return input2;
19550
- var prim = input2[Symbol.toPrimitive];
19550
+ function _toPrimitive(input, hint) {
19551
+ if (typeof input !== "object" || input === null) return input;
19552
+ var prim = input[Symbol.toPrimitive];
19551
19553
  if (prim !== void 0) {
19552
- var res = prim.call(input2, hint || "default");
19554
+ var res = prim.call(input, hint || "default");
19553
19555
  if (typeof res !== "object") return res;
19554
19556
  throw new TypeError("@@toPrimitive must return a primitive value.");
19555
19557
  }
19556
- return (hint === "string" ? String : Number)(input2);
19558
+ return (hint === "string" ? String : Number)(input);
19557
19559
  }
19558
19560
  var finished = require_end_of_stream();
19559
19561
  var kLastResolve = Symbol("lastResolve");
@@ -19777,15 +19779,15 @@ var require_from = __commonJS({
19777
19779
  var key = _toPrimitive(arg, "string");
19778
19780
  return typeof key === "symbol" ? key : String(key);
19779
19781
  }
19780
- function _toPrimitive(input2, hint) {
19781
- if (typeof input2 !== "object" || input2 === null) return input2;
19782
- var prim = input2[Symbol.toPrimitive];
19782
+ function _toPrimitive(input, hint) {
19783
+ if (typeof input !== "object" || input === null) return input;
19784
+ var prim = input[Symbol.toPrimitive];
19783
19785
  if (prim !== void 0) {
19784
- var res = prim.call(input2, hint || "default");
19786
+ var res = prim.call(input, hint || "default");
19785
19787
  if (typeof res !== "object") return res;
19786
19788
  throw new TypeError("@@toPrimitive must return a primitive value.");
19787
19789
  }
19788
- return (hint === "string" ? String : Number)(input2);
19790
+ return (hint === "string" ? String : Number)(input);
19789
19791
  }
19790
19792
  var ERR_INVALID_ARG_TYPE = require_errors().codes.ERR_INVALID_ARG_TYPE;
19791
19793
  function from(Readable, iterable, opts) {
@@ -41850,10 +41852,10 @@ var require_lazystream = __commonJS({
41850
41852
  var PassThrough = require_passthrough();
41851
41853
  module2.exports = {
41852
41854
  Readable,
41853
- Writable
41855
+ Writable: Writable2
41854
41856
  };
41855
41857
  util.inherits(Readable, PassThrough);
41856
- util.inherits(Writable, PassThrough);
41858
+ util.inherits(Writable2, PassThrough);
41857
41859
  function beforeFirstCall(instance, method, callback) {
41858
41860
  instance[method] = function() {
41859
41861
  delete instance[method];
@@ -41873,9 +41875,9 @@ var require_lazystream = __commonJS({
41873
41875
  });
41874
41876
  this.emit("readable");
41875
41877
  }
41876
- function Writable(fn, options) {
41877
- if (!(this instanceof Writable))
41878
- return new Writable(fn, options);
41878
+ function Writable2(fn, options) {
41879
+ if (!(this instanceof Writable2))
41880
+ return new Writable2(fn, options);
41879
41881
  PassThrough.call(this, options);
41880
41882
  beforeFirstCall(this, "_write", function() {
41881
41883
  var destination = fn.call(this, options);
@@ -47028,17 +47030,17 @@ var require_buffer_crc32 = __commonJS({
47028
47030
  if (typeof Int32Array !== "undefined") {
47029
47031
  CRC_TABLE = new Int32Array(CRC_TABLE);
47030
47032
  }
47031
- function ensureBuffer(input2) {
47032
- if (Buffer2.isBuffer(input2)) {
47033
- return input2;
47033
+ function ensureBuffer(input) {
47034
+ if (Buffer2.isBuffer(input)) {
47035
+ return input;
47034
47036
  }
47035
47037
  var hasNewBufferAPI = typeof Buffer2.alloc === "function" && typeof Buffer2.from === "function";
47036
- if (typeof input2 === "number") {
47037
- return hasNewBufferAPI ? Buffer2.alloc(input2) : new Buffer2(input2);
47038
- } else if (typeof input2 === "string") {
47039
- return hasNewBufferAPI ? Buffer2.from(input2) : new Buffer2(input2);
47038
+ if (typeof input === "number") {
47039
+ return hasNewBufferAPI ? Buffer2.alloc(input) : new Buffer2(input);
47040
+ } else if (typeof input === "string") {
47041
+ return hasNewBufferAPI ? Buffer2.from(input) : new Buffer2(input);
47040
47042
  } else {
47041
- throw new Error("input must be buffer, number, or string, received " + typeof input2);
47043
+ throw new Error("input must be buffer, number, or string, received " + typeof input);
47042
47044
  }
47043
47045
  }
47044
47046
  function bufferizeInt(num) {
@@ -48591,7 +48593,7 @@ var require_extract = __commonJS({
48591
48593
  var util = require("util");
48592
48594
  var bl = require_bl();
48593
48595
  var headers = require_headers();
48594
- var Writable = require_readable2().Writable;
48596
+ var Writable2 = require_readable2().Writable;
48595
48597
  var PassThrough = require_readable2().PassThrough;
48596
48598
  var noop = function() {
48597
48599
  };
@@ -48622,7 +48624,7 @@ var require_extract = __commonJS({
48622
48624
  };
48623
48625
  var Extract = function(opts) {
48624
48626
  if (!(this instanceof Extract)) return new Extract(opts);
48625
- Writable.call(this, opts);
48627
+ Writable2.call(this, opts);
48626
48628
  opts = opts || {};
48627
48629
  this._offset = 0;
48628
48630
  this._buffer = bl();
@@ -48746,7 +48748,7 @@ var require_extract = __commonJS({
48746
48748
  this._onheader = onheader;
48747
48749
  this._parse(512, onheader);
48748
48750
  };
48749
- util.inherits(Extract, Writable);
48751
+ util.inherits(Extract, Writable2);
48750
48752
  Extract.prototype.destroy = function(err) {
48751
48753
  if (this._destroyed) return;
48752
48754
  this._destroyed = true;
@@ -48899,7 +48901,7 @@ var require_pack = __commonJS({
48899
48901
  var inherits2 = require_inherits();
48900
48902
  var alloc = Buffer.alloc;
48901
48903
  var Readable = require_readable2().Readable;
48902
- var Writable = require_readable2().Writable;
48904
+ var Writable2 = require_readable2().Writable;
48903
48905
  var StringDecoder = require("string_decoder").StringDecoder;
48904
48906
  var headers = require_headers();
48905
48907
  var DMODE = parseInt("755", 8);
@@ -48927,12 +48929,12 @@ var require_pack = __commonJS({
48927
48929
  return "file";
48928
48930
  }
48929
48931
  var Sink = function(to) {
48930
- Writable.call(this);
48932
+ Writable2.call(this);
48931
48933
  this.written = 0;
48932
48934
  this._to = to;
48933
48935
  this._destroyed = false;
48934
48936
  };
48935
- inherits2(Sink, Writable);
48937
+ inherits2(Sink, Writable2);
48936
48938
  Sink.prototype._write = function(data, enc, cb) {
48937
48939
  this.written += data.length;
48938
48940
  if (this._to.push(data)) return cb();
@@ -48944,12 +48946,12 @@ var require_pack = __commonJS({
48944
48946
  this.emit("close");
48945
48947
  };
48946
48948
  var LinkSink = function() {
48947
- Writable.call(this);
48949
+ Writable2.call(this);
48948
48950
  this.linkname = "";
48949
48951
  this._decoder = new StringDecoder("utf-8");
48950
48952
  this._destroyed = false;
48951
48953
  };
48952
- inherits2(LinkSink, Writable);
48954
+ inherits2(LinkSink, Writable2);
48953
48955
  LinkSink.prototype._write = function(data, enc, cb) {
48954
48956
  this.linkname += this._decoder.write(data);
48955
48957
  cb();
@@ -48960,10 +48962,10 @@ var require_pack = __commonJS({
48960
48962
  this.emit("close");
48961
48963
  };
48962
48964
  var Void = function() {
48963
- Writable.call(this);
48965
+ Writable2.call(this);
48964
48966
  this._destroyed = false;
48965
48967
  };
48966
- inherits2(Void, Writable);
48968
+ inherits2(Void, Writable2);
48967
48969
  Void.prototype._write = function(data, enc, cb) {
48968
48970
  cb(new Error("No body allowed for this entry"));
48969
48971
  };
@@ -51087,8 +51089,8 @@ var require_binary = __commonJS({
51087
51089
  }
51088
51090
  return s;
51089
51091
  };
51090
- exports2.stream = function(input2) {
51091
- if (input2) return exports2.apply(null, arguments);
51092
+ exports2.stream = function(input) {
51093
+ if (input) return exports2.apply(null, arguments);
51092
51094
  var pending = null;
51093
51095
  function getBytes(bytes, cb, skip) {
51094
51096
  pending = {
@@ -54486,19 +54488,19 @@ var require_using = __commonJS({
54486
54488
  if (typeof fn !== "function") {
54487
54489
  return apiRejection("expecting a function but got " + util.classString(fn));
54488
54490
  }
54489
- var input2;
54491
+ var input;
54490
54492
  var spreadArgs = true;
54491
54493
  if (len === 2 && Array.isArray(arguments[0])) {
54492
- input2 = arguments[0];
54493
- len = input2.length;
54494
+ input = arguments[0];
54495
+ len = input.length;
54494
54496
  spreadArgs = false;
54495
54497
  } else {
54496
- input2 = arguments;
54498
+ input = arguments;
54497
54499
  len--;
54498
54500
  }
54499
54501
  var resources = new ResourceList(len);
54500
54502
  for (var i = 0; i < len; ++i) {
54501
- var resource = input2[i];
54503
+ var resource = input[i];
54502
54504
  if (Disposer.isDisposer(resource)) {
54503
54505
  var disposer = resource;
54504
54506
  resource = resource.promise();
@@ -56933,8 +56935,8 @@ var require_duplexer2 = __commonJS({
56933
56935
  }
56934
56936
  }
56935
56937
  DuplexWrapper.prototype = Object.create(stream.Duplex.prototype, { constructor: { value: DuplexWrapper } });
56936
- DuplexWrapper.prototype._write = function _write(input2, encoding, done) {
56937
- this._writable.write(input2, encoding, done);
56938
+ DuplexWrapper.prototype._write = function _write(input, encoding, done) {
56939
+ this._writable.write(input, encoding, done);
56938
56940
  };
56939
56941
  DuplexWrapper.prototype._read = function _read() {
56940
56942
  var buf;
@@ -61381,9 +61383,9 @@ var require_workbook_reader = __commonJS({
61381
61383
  var HyperlinkReader = require_hyperlink_reader();
61382
61384
  tmp.setGracefulCleanup();
61383
61385
  var WorkbookReader = class extends EventEmitter {
61384
- constructor(input2, options = {}) {
61386
+ constructor(input, options = {}) {
61385
61387
  super();
61386
- this.input = input2;
61388
+ this.input = input;
61387
61389
  this.options = {
61388
61390
  worksheets: "emit",
61389
61391
  sharedStrings: "cache",
@@ -61395,18 +61397,18 @@ var require_workbook_reader = __commonJS({
61395
61397
  this.styles = new StyleManager();
61396
61398
  this.styles.init();
61397
61399
  }
61398
- _getStream(input2) {
61399
- if (input2 instanceof nodeStream.Readable || input2 instanceof Readable) {
61400
- return input2;
61400
+ _getStream(input) {
61401
+ if (input instanceof nodeStream.Readable || input instanceof Readable) {
61402
+ return input;
61401
61403
  }
61402
- if (typeof input2 === "string") {
61403
- return fs.createReadStream(input2);
61404
+ if (typeof input === "string") {
61405
+ return fs.createReadStream(input);
61404
61406
  }
61405
- throw new Error(`Could not recognise input: ${input2}`);
61407
+ throw new Error(`Could not recognise input: ${input}`);
61406
61408
  }
61407
- async read(input2, options) {
61409
+ async read(input, options) {
61408
61410
  try {
61409
- for await (const { eventType, value } of this.parse(input2, options)) {
61411
+ for await (const { eventType, value } of this.parse(input, options)) {
61410
61412
  switch (eventType) {
61411
61413
  case "shared-strings":
61412
61414
  this.emit(eventType, value);
@@ -61433,9 +61435,9 @@ var require_workbook_reader = __commonJS({
61433
61435
  }
61434
61436
  }
61435
61437
  }
61436
- async *parse(input2, options) {
61438
+ async *parse(input, options) {
61437
61439
  if (options) this.options = options;
61438
- const stream = this.stream = this._getStream(input2 || this.input);
61440
+ const stream = this.stream = this._getStream(input || this.input);
61439
61441
  const zip = unzip.Parse({ forceStream: true });
61440
61442
  stream.pipe(zip);
61441
61443
  const waitingWorkSheets = [];
@@ -61933,25 +61935,25 @@ var require_providers = __commonJS({
61933
61935
  officialDocumentationUrl: "https://developer.intuit.com/app/developer/qbo/docs/develop/authentication-and-authorization/oauth-2.0"
61934
61936
  }
61935
61937
  ];
61936
- async function fetchProviderTransactions(input2) {
61937
- validateDateRange(input2.startDate, input2.endDate);
61938
- const capability = requireCapability(input2.provider);
61939
- const output2 = [];
61938
+ async function fetchProviderTransactions(input) {
61939
+ validateDateRange(input.startDate, input.endDate);
61940
+ const capability = requireCapability(input.provider);
61941
+ const output = [];
61940
61942
  let page = 1;
61941
61943
  let startPosition = 1;
61942
61944
  let nextUrl = null;
61943
61945
  do {
61944
- const url = nextUrl ?? buildProviderPageUrl(capability, input2, page, startPosition);
61945
- const response = await requestWithRetry(input2.transport, { url, headers: providerHeaders(input2) }, input2.signal, input2.wait);
61946
- const parsed = parseProviderPage(input2.provider, response.body, input2.organizationCurrency);
61947
- output2.push(...parsed.transactions);
61946
+ const url = nextUrl ?? buildProviderPageUrl(capability, input, page, startPosition);
61947
+ const response = await requestWithRetry(input.transport, { url, headers: providerHeaders(input) }, input.signal, input.wait);
61948
+ const parsed = parseProviderPage(input.provider, response.body, input.organizationCurrency);
61949
+ output.push(...parsed.transactions);
61948
61950
  nextUrl = parsed.nextUrl;
61949
61951
  page += 1;
61950
61952
  startPosition += parsed.pageSize;
61951
61953
  if (page > 1e3)
61952
61954
  throw new Error("Accounting provider pagination exceeded the safe page limit.");
61953
- } while (nextUrl || shouldContinueProviderPagination(input2.provider, output2.length, page - 1));
61954
- return output2;
61955
+ } while (nextUrl || shouldContinueProviderPagination(input.provider, output.length, page - 1));
61956
+ return output;
61955
61957
  }
61956
61958
  function requireCapability(provider) {
61957
61959
  const capability = exports2.ACCOUNTING_PROVIDER_CAPABILITIES.find((candidate) => candidate.provider === provider);
@@ -61974,20 +61976,20 @@ var require_providers = __commonJS({
61974
61976
  }
61975
61977
  throw new Error("Accounting provider request failed.");
61976
61978
  }
61977
- function buildProviderPageUrl(capability, input2, page, startPosition) {
61978
- if (input2.provider === "xero")
61979
- return capability.apiBaseUrl + "/BankTransactions?page=" + page + "&where=" + encodeURIComponent("Date >= DateTime(" + input2.startDate.replaceAll("-", ",") + ") && Date <= DateTime(" + input2.endDate.replaceAll("-", ",") + ")");
61980
- if (input2.provider === "myob")
61981
- return capability.apiBaseUrl + "/" + encodeURIComponent(input2.organizationId) + "/Banking/SpendMoneyTxn?$filter=" + encodeURIComponent("Date ge datetime'" + input2.startDate + "' and Date le datetime'" + input2.endDate + "'") + "&$top=400&$skip=" + (page - 1) * 400;
61982
- const query = "select * from Purchase where TxnDate >= '" + input2.startDate + "' and TxnDate <= '" + input2.endDate + "' startposition " + startPosition + " maxresults 1000";
61983
- return capability.apiBaseUrl + "/" + encodeURIComponent(input2.organizationId) + "/query?minorversion=75&query=" + encodeURIComponent(query);
61984
- }
61985
- function providerHeaders(input2) {
61986
- if (input2.provider === "xero")
61987
- return { Authorization: "Bearer " + input2.accessToken, "Xero-tenant-id": input2.organizationId, Accept: "application/json" };
61988
- if (input2.provider === "myob")
61989
- return { Authorization: "Bearer " + input2.accessToken, Accept: "application/json", "x-myobapi-version": "v2" };
61990
- return { Authorization: "Bearer " + input2.accessToken, Accept: "application/json" };
61979
+ function buildProviderPageUrl(capability, input, page, startPosition) {
61980
+ if (input.provider === "xero")
61981
+ return capability.apiBaseUrl + "/BankTransactions?page=" + page + "&where=" + encodeURIComponent("Date >= DateTime(" + input.startDate.replaceAll("-", ",") + ") && Date <= DateTime(" + input.endDate.replaceAll("-", ",") + ")");
61982
+ if (input.provider === "myob")
61983
+ return capability.apiBaseUrl + "/" + encodeURIComponent(input.organizationId) + "/Banking/SpendMoneyTxn?$filter=" + encodeURIComponent("Date ge datetime'" + input.startDate + "' and Date le datetime'" + input.endDate + "'") + "&$top=400&$skip=" + (page - 1) * 400;
61984
+ const query = "select * from Purchase where TxnDate >= '" + input.startDate + "' and TxnDate <= '" + input.endDate + "' startposition " + startPosition + " maxresults 1000";
61985
+ return capability.apiBaseUrl + "/" + encodeURIComponent(input.organizationId) + "/query?minorversion=75&query=" + encodeURIComponent(query);
61986
+ }
61987
+ function providerHeaders(input) {
61988
+ if (input.provider === "xero")
61989
+ return { Authorization: "Bearer " + input.accessToken, "Xero-tenant-id": input.organizationId, Accept: "application/json" };
61990
+ if (input.provider === "myob")
61991
+ return { Authorization: "Bearer " + input.accessToken, Accept: "application/json", "x-myobapi-version": "v2" };
61992
+ return { Authorization: "Bearer " + input.accessToken, Accept: "application/json" };
61991
61993
  }
61992
61994
  function parseProviderPage(provider, body, defaultCurrency) {
61993
61995
  if (provider === "xero") {
@@ -62019,8 +62021,8 @@ var require_providers = __commonJS({
62019
62021
  const currency = asRecord(item.CurrencyRef);
62020
62022
  return normalized({ provider: "quickbooks", id: stringValue(item.Id), merchant: stringValue(entity.name) || "Unknown QuickBooks entity", date: dateValue(item.TxnDate), amount: numberValue(item.TotalAmt), currency: stringValue(currency.value) || defaultCurrency, category: stringValue(account.name) || null, reference: [stringValue(item.PrivateNote), stringValue(item.PaymentType)], reconciled: "unknown" });
62021
62023
  }
62022
- function normalized(input2) {
62023
- return { transactionIdHash: (0, node_crypto_1.createHash)("sha256").update(input2.provider + "\0" + input2.id).digest("hex"), merchantIdentity: input2.merchant, transactionDate: input2.date, amountMinor: Math.round(input2.amount * 100), currency: input2.currency.toUpperCase(), sourceAccountClass: "bank", accountingCategory: input2.category, referenceFragments: input2.reference.filter(Boolean).map(safeFragment).slice(0, 4), reconciliationState: input2.reconciled, evidenceSource: input2.provider };
62024
+ function normalized(input) {
62025
+ return { transactionIdHash: (0, node_crypto_1.createHash)("sha256").update(input.provider + "\0" + input.id).digest("hex"), merchantIdentity: input.merchant, transactionDate: input.date, amountMinor: Math.round(input.amount * 100), currency: input.currency.toUpperCase(), sourceAccountClass: "bank", accountingCategory: input.category, referenceFragments: input.reference.filter(Boolean).map(safeFragment).slice(0, 4), reconciliationState: input.reconciled, evidenceSource: input.provider };
62024
62026
  }
62025
62027
  function shouldContinueProviderPagination(provider, total, pageCount) {
62026
62028
  if (provider === "xero")
@@ -62145,15 +62147,17 @@ When the source manifest is absent or has **GATHERING** status:
62145
62147
 
62146
62148
  - Always use the same progressive opening, whether source files already exist or not. Ask exactly one question at a time and wait for its answer before asking the next:
62147
62149
  1. **Do you have an existing website, product, or repository I should understand?** Accept a URL, path, short description, or \u201Cno.\u201D
62148
- 2. **In one sentence, what is the main problem and who are we solving it for?**
62149
- 3. **What software or integrations are involved today?** Accept \u201Cnone\u201D or \u201Cnot sure.\u201D
62150
+ 2. **Briefly, what is the main problem, who experiences it, and what outcome would make this work worthwhile?**
62151
+ 3. **What software or integrations are involved today, and are any required to stay, specifically intended for replacement, or open to consolidation?** Accept \u201Cnone\u201D or \u201Cnot sure.\u201D
62150
62152
  4. **How would you like me to work?** Offer the three discovery depths below.
62151
62153
  5. **${accounting_discovery_1.ACCOUNTING_DISCOVERY_QUESTION}** If yes, offer local CSV/XLSX export first and only supported, enabled browser providers. Before either path, explain the processing, temporary-data, configured AI-provider, Git-report, cleanup, and revocation boundaries truthfully. If no, cancelled, unsupported, or authorization fails, record only that the optional branch was not used and continue ordinary discovery.
62152
62154
  - Do not display all five questions in the first response and do not ask the owner to answer them as a form.
62153
62155
  - Keep the first response short: explain that discovery starts with five brief questions asked one at a time, then ask question one only.
62154
62156
  - Create **docs/discovery/sources/owner-interview.md** when the first answer arrives. After each answer, append it with the date, then distribute the useful meaning into every affected curated document as **DRAFT** material. One answer may update several documents; do not wait until a later document-specific interview. Preserve what the owner actually said separately from AI inference.
62155
- - After question five and any optional spend-analysis branch, ask the owner to copy any useful Markdown or text material into **docs/discovery/sources/** and reply **gathering is complete** when ready. Explain briefly that requirements, process notes, policies, research, system notes, contracts, standards, manuals, spreadsheets, presentations, and prior decisions can help.
62156
- - Explain only the source rules needed at that moment: raw material remains local and is ignored by Git by default; exclude credentials, secrets, unnecessary personal or regulated information, and material the owner cannot process; difficult binary material needs a Markdown sidecar.
62157
+ - For question three, record each material product or channel with an owner-evidenced disposition: **REQUIRED_TO_STAY**, **REPLACE**, **OPEN_TO_CONSOLIDATION**, **TRANSITIONAL_OR_FALLBACK**, or **UNDECIDED**. Mentioning a current product proves only that it exists; never infer that it should remain. If the owner provides a list without future intent, preserve every disposition as **UNDECIDED** and resolve only the materially consequential choices by targeted exception during synthesis.
62158
+ - After question five and any optional spend-analysis branch, clearly invite the owner to add as much relevant source material as they can readily find and are comfortable allowing the configured AI to process. Ask them to paste notes as Markdown or text or copy existing documents into **docs/discovery/sources/**. Tell them not to organize, rename, summarize, deduplicate, or decide what matters: SwarmCraft will inventory the collection, identify duplicates and contradictions, flag unsupported or sensitive content, and propose one useful source set for aggregate confirmation.
62159
+ - Give concrete examples: requirements, process notes, policies, procedures, proposals, research, system documentation, contracts, standards, manuals, spreadsheets, presentations, reports, stakeholder notes, screenshots, and prior decisions. Explain that drafts and conflicting versions are useful when their status is clear. Ask the owner to reply **gathering is complete** after adding everything they are comfortable providing, even when they have nothing else.
62160
+ - Explain only the source rules needed at that moment: files stay in the local workspace and are ignored by Git by default; the SwarmCraft product does not directly upload the source directory, but the configured AI may read and process its contents during discovery; exclude credentials, secrets, unnecessary personal or regulated information, and material the owner is not permitted to process; difficult binary material needs a Markdown sidecar.
62157
62161
  - Pause until the owner says **gathering is complete**, even when they have no additional material. Then inventory the interview record and any supplied sources together.
62158
62162
 
62159
62163
  ## Checkpoint progress as you go
@@ -62229,8 +62233,13 @@ Treat the nine curated documents as one coverage map, not nine consecutive inter
62229
62233
  - In **goals-and-success.md**, propose a short plain-language **projectTitle** in frontmatter and include it in whole-document review. Do not use a digest, workspace folder, or generic "Deep Discovery project" label as the owner-facing name.
62230
62234
  - Preserve stable source paths, section/page anchors, and digests. Preserve raw sources and sidecars unless the owner explicitly asks for an edit.
62231
62235
  - Draft a coherent proposed understanding across goals, roles, workflows, records and rules, integrations, experience, quality and operations, risks and decisions, and acceptance. Present the recommended direction in concise owner language, with alternatives only where a material fork exists.
62236
+ - Before fixing the target shape, reconcile a product-disposition matrix across **goals-and-success.md**, **domain-data-and-rules.md**, **integrations-and-boundaries.md**, and **decisions-risks-and-open-questions.md**. Distinguish owner-confirmed dispositions from recommendations and unresolved choices. If an undecided product could materially change whether the outcome is orchestration, selective replacement, consolidation, or staged transition, ask one grouped exception question and keep affected documents out of **REVIEWED** until answered.
62232
62237
  - Do the initial thinking for the owner. Ask what is incorrect, missing, unsafe, or materially different rather than asking the owner to originate every role, rule, status, exception, or measure.
62233
- - For **Recommend, then refine**, invoke **${provider === "codex" ? "$swarmcraft-prototype" : "/prototype"}** after the initial synthesis and no more than one focused clarification round. Build the smallest useful branded flow that exposes the main workflow and its important authority, safety, failure, or recovery decision. Balanced and detail-first discovery may resolve more high-impact boundaries first, but must not revert to a document-by-document questionnaire.
62238
+ - For **Recommend, then refine**, invoke **${provider === "codex" ? "$swarmcraft-prototype" : "/prototype"}** after the initial synthesis and no more than one focused clarification round. Start with the smallest useful branded flow that exposes the primary workflow and its important authority, safety, failure, or recovery decision. Balanced and detail-first discovery may resolve more high-impact boundaries first, but must not revert to a document-by-document questionnaire.
62239
+ - After each prototype review, perform a prototype-coverage check across independently meaningful user or operator journeys, materially different roles and authority boundaries, consequential safety or payment decisions, exception and recovery paths, offline or degraded operation, and interaction-heavy integration failures. Do not proceed to consolidation merely because one prototype exists.
62240
+ - Extend the current prototype when remaining scenarios share the same product shell, actors, interaction model, and decision context. Invoke **${provider === "codex" ? "$swarmcraft-prototype" : "/prototype"}** again to create another focused prototype when combining a distinct role, operating context, workflow, or recovery model would obscure the decisions being reviewed. Preserve and link every reviewed prototype.
62241
+ - Use no fixed prototype count. Stop when material interaction uncertainty is experienceable and owner-corrected, already clear from evidence and prose, or explicitly recorded as delivery-stage validation because a disposable prototype cannot resolve it. Do not prototype routine screens or implementation detail merely for completeness.
62242
+ - Before Stage 4, record a concise prototype-coverage summary in **sources/owner-interview.md** and affected curated documents: each prototype path and decision scope, important scenarios covered, material areas intentionally handled in prose, deferred validation with rationale, and why the combined evidence is sufficient for discovery. A material gap that could change what is built remains discovery work.
62234
62243
  - Ask follow-up questions only for owner corrections, contradictions, genuine blockers, or high-impact safety, security, privacy, authority, payment, compliance, destructive migration, and observable acceptance boundaries. Group related questions and do not ask what the evidence or accepted proposal already answers.
62235
62244
  - Identify gaps, assumptions, risks, deferrals, exclusions, and not-applicable areas internally and in the curated documents. Do not burden the owner with a separate visible assumption ledger when a clear proposed direction and exception-based review can resolve it.
62236
62245
  - When a prototype is reviewed, copy its accepted meaning into every affected curated document so they remain complete without the local artifact. Keep prototype code and images under **docs/prototypes/** as local review aids; they do not enter the text-only Discovery Package automatically.
@@ -62245,18 +62254,20 @@ The first proposed direction should cover, in plain language: desired outcome an
62245
62254
 
62246
62255
  ## Stage 4: consolidate and review
62247
62256
 
62248
- Use the confirmed direction and prototype corrections to update every affected curated document before asking for final review:
62257
+ Use the confirmed direction and prototype corrections to update every affected curated document before completing aggregate review:
62249
62258
 
62250
62259
  - Present one concise review map across all nine documents: the proposed outcome, roles, workflow, records, integrations, experience, operating constraints, material risks, acceptance direction, unresolved questions, and any proposed **NOT_APPLICABLE** document.
62251
- - Do not run a new questionnaire for each document. Let the owner accept the listed direction as a whole, request corrections, identify an exception, or ask to inspect any document in detail.
62252
- - Make all nine full documents available for inspection. An explicit aggregate acceptance may review several named documents at once only when their material contents were represented in the review map and the owner was told exactly which documents would be accepted.
62260
+ - Do not run a new questionnaire for each document or finish with a blanket request to accept all nine. Present the completed discovery record, invite corrections by exception, and let the owner ask to inspect any document in detail.
62261
+ - Make all nine full documents available for inspection. Name the documents covered by the review map, but do not describe them as **awaiting acceptance** when their material contents were already presented and the owner has explicitly directed the work to continue.
62253
62262
  - Summarize important content under confirmed material, open questions, deferrals, exclusions, not-applicable scope, and high-impact concerns without requiring the owner to manage an assumption inventory.
62254
62263
  - Visibly call out unresolved core workflow, security, privacy, compliance, destructive migration, payment, and acceptance issues.
62255
62264
  - Distinguish **Discovery blockers** from **delivery or launch gates**. A discovery blocker means the owner cannot yet define what must be built or how a high-impact concern can be handled safely. A delivery or launch gate describes implementation or evidence that the future project must complete and does not by itself set **criticalUnresolved: true**.
62256
- - Ask the owner to accept the presented direction as an accurate current record, request changes, or leave the affected documents in draft.
62257
- - When a reviewed prototype informed the document, summarize its firm decisions, adaptable direction, rejected alternatives, and unresolved questions in the document before asking for whole-document review. A prototype walkthrough does not replace document review.
62265
+ - Treat a prior explicit instruction such as **Continue with this direction**, plus the owner's subsequent corrections by exception, as aggregate review evidence for material that was actually visible in the proposal, prototype review, corrections, and final review map. If the final map introduces no new material decision, hidden extrapolation, unresolved owner question, or discovery blocker, set the covered documents to **REVIEWED**, create their scoped checkpoints, state that discovery is complete, and invite corrections without asking for another confirmation.
62266
+ - When the final map introduces a material decision that the owner has not seen, a proposed **NOT_APPLICABLE** disposition without owner rationale, or an unresolved high-impact exception, keep only the affected documents **READY_FOR_REVIEW** and ask one targeted exception question. Do not hold unrelated documents behind that question.
62267
+ - If no earlier explicit direction exists, ask once for corrections or an instruction to continue with the presented direction. Silence alone is not review evidence.
62268
+ - When a reviewed prototype informed the document, summarize its firm decisions, adaptable direction, rejected alternatives, and unresolved questions before concluding aggregate review or asking a targeted exception question. A prototype walkthrough alone does not replace document review.
62258
62269
  - Whole-document review confirms that each presented outcome is represented accurately; it does not turn hidden extrapolations or unresolved items into facts.
62259
- - After explicit review, set each accepted document to **REVIEWED**, record **reviewedAt**, and write a concise owner-review summary identifying the proposal and corrections reviewed. Use **NOT_APPLICABLE** only with explicit owner rationale and review time.
62270
+ - After sufficient aggregate or targeted review evidence, set each covered document to **REVIEWED**, record **reviewedAt**, and write a concise owner-review summary identifying the proposal, explicit continuation, review map, and corrections reviewed. Use **NOT_APPLICABLE** only with explicit owner rationale and review time.
62260
62271
  - After writing each **REVIEWED** or **NOT_APPLICABLE** document, create one local Git checkpoint for that exact curated document with \`git commit --only -m "SwarmCraft: Review <filename>" -- docs/discovery/<filename>\`. Even when several documents were accepted together, create separate exact-path checkpoints. Never add raw sources, another discovery document, generated state, or unrelated repository work, and never push. If a document has no change, do not create an empty commit. If the checkpoint fails, preserve the reviewed file and tell the owner what Git needs; do not broaden the commit or change semantic outcomes to make it succeed.
62261
62272
  - Any later material edit returns the document to **DRAFT** or **READY_FOR_REVIEW** and clears the old review time.
62262
62273
 
@@ -62280,7 +62291,7 @@ Use the swarmcraft-discover skill. Detect the current discovery stage, explain t
62280
62291
  function renderDiscoveryGuide() {
62281
62292
  return `# Deep Discovery
62282
62293
 
62283
- These files are the owner-and-agent working surface before SwarmCraft creates a project board. They are not the Discovery Package transport schema or the private seven-slice compiler.
62294
+ These files are the owner-and-agent working surface before SwarmCraft creates a project board. They are not the Discovery Package transport schema or the private server-side catalogue compiler.
62284
62295
 
62285
62296
  ## Start here
62286
62297
 
@@ -62289,10 +62300,10 @@ These files are the owner-and-agent working surface before SwarmCraft creates a
62289
62300
 
62290
62301
  ## Journey
62291
62302
 
62292
- 1. **Answer five brief opening questions.** The discover assistant always asks, one at a time, about existing website/product/repository context, the main problem and intended user, current software or integrations, how you want it to work, and whether you want optional SaaS-spend evidence. Each answer is recorded and distributed into every affected discovery-document draft as you go.
62293
- 2. **Add sources and confirm gathering.** Copy any useful Markdown or text material into **sources/**, then say **gathering is complete** even when you have nothing else to add. For PDF and other difficult formats, keep the original and create a same-named Markdown sidecar using the source guidance. The assistant inventories the interview record and supplied material, asks for one aggregate source-set confirmation, and creates a local Git checkpoint containing only that manifest.
62294
- 3. **Review a proposed direction and early prototype.** The assistant researches owner-authorized context, drafts a recommendation across all nine discovery areas, and asks you to correct it by exception. The recommended **Recommend, then refine** route builds a small disposable prototype after at most one focused clarification round. Open its \`README.md\` in Markdown Preview and right-click \`index.html\` to **Open in Integrated Browser** so you can review both side by side.
62295
- 4. **Consolidate and review.** Prototype corrections flow into every affected document. The assistant presents one concise review map rather than interviewing through each file, while all nine full documents remain available for inspection. Explicit acceptance applies only to material actually presented. Each accepted document receives its own local Git checkpoint; the assistant does not push.
62303
+ 1. **Answer five brief opening questions.** The discover assistant always asks, one at a time, about existing website/product/repository context; the problem, affected people, and desired outcome; current software and whether it must stay, should be replaced, or is open to consolidation; how you want discovery to work; and whether you want optional SaaS-spend evidence. Each answer is recorded and distributed into every affected discovery-document draft as you go.
62304
+ 2. **Add sources and confirm gathering.** Add as much relevant source material as you can readily find and are comfortable allowing the configured AI to process. Paste notes as Markdown or text or copy existing documents into **sources/**; you do not need to organize, rename, summarize, deduplicate, or decide what matters. Drafts and conflicting versions are useful when their status is clear. The assistant inventories the collection, identifies duplicates and contradictions, flags unsupported or sensitive content, and proposes one useful source set for aggregate confirmation. For PDF and other difficult formats, keep the original and create a same-named Markdown sidecar using the source guidance. Say **gathering is complete** after adding everything you are comfortable providing, even when you have nothing else. The assistant creates a local Git checkpoint containing only the confirmed manifest.
62305
+ 3. **Review a proposed direction and focused prototypes.** The assistant researches owner-authorized context, drafts a recommendation across all nine discovery areas, and asks you to correct it by exception. The recommended **Recommend, then refine** route starts with one small disposable prototype after at most one focused clarification round, then checks whether materially different roles, workflows, authority boundaries, or failure and recovery experiences need another focused prototype. Related scenarios extend the existing prototype; distinct experiences remain separate. Open each \`README.md\` in Markdown Preview and right-click its \`index.html\` to **Open in Integrated Browser** so you can review both side by side.
62306
+ 4. **Consolidate and review.** Prototype corrections flow into every affected document. The assistant presents one concise review map rather than interviewing through each file, while all nine full documents remain available for inspection. If you already explicitly continued with the presented direction and the map adds no new material decision, the assistant completes review and invites corrections by exception instead of asking you to accept all nine again. Each reviewed document receives its own local Git checkpoint; the assistant does not push.
62296
62307
  5. **Prepare only when ready.** All nine documents must be **REVIEWED** or explicitly **NOT_APPLICABLE**, selected sidecars must be current, and missing owner knowledge must not prevent a safe, coherent project definition. A recommended visual comparison remains visible in the sidebar but does not block preparation. Future implementation work and launch evidence belong in the reviewed documents and do not have to exist before preparation.
62297
62308
 
62298
62309
  ## Curated coverage map
@@ -62309,7 +62320,7 @@ These files are the owner-and-agent working surface before SwarmCraft creates a
62309
62320
 
62310
62321
  Discovery can resume after any interruption. Human-authored files remain owner-controlled, and raw binary bodies are never uploaded in a Discovery Package.
62311
62322
 
62312
- Every discovery uses the same opening whether documents already exist or not. The assistant asks the five questions one at a time, records the answers in **sources/owner-interview.md**, and uses each answer immediately across the relevant document drafts. The fifth branch is optional and returns cleanly to discovery when declined, cancelled, unsupported, or unsuccessful. After you finish adding any other sources and say **gathering is complete**, it uses the nine documents as a coverage map rather than a conversation script.
62323
+ Every discovery uses the same opening whether documents already exist or not. The assistant asks the five questions one at a time, records the answers in **sources/owner-interview.md**, and uses each answer immediately across the relevant document drafts. Current products remain dispositionally undecided unless you say they must stay, should be replaced, are open to consolidation, or are transitional. The fifth branch is optional and returns cleanly to discovery when declined, cancelled, unsupported, or unsuccessful. After you finish adding any other sources and say **gathering is complete**, it uses the nine documents as a coverage map rather than a conversation script.
62313
62324
  `;
62314
62325
  }
62315
62326
  function renderCuratedDiscoveryDocument(title, prompt, includeProjectTitle = false) {
@@ -62347,9 +62358,11 @@ Record the owner's whole-document review summary here. Reviewing this document c
62347
62358
  function renderSourceGuide() {
62348
62359
  return `# Raw discovery sources
62349
62360
 
62350
- Copy or paste existing source material here before synthesis. SwarmCraft does not upload this directory directly, and raw files are ignored by Git by default. Tell the discover assistant when gathering is complete; it will inventory the material and ask for one aggregate confirmation of the proposed source set.
62361
+ Add as much relevant source material as you can readily find and are comfortable allowing the configured AI to process. Paste notes as Markdown or text or copy existing documents here before synthesis. You do not need to organize, rename, summarize, deduplicate, or decide what matters. SwarmCraft will inventory the collection, identify duplicates and contradictions, flag unsupported or sensitive content, and propose one useful source set for aggregate confirmation.
62362
+
62363
+ Useful inputs include requirements, process notes, policies, procedures, proposals, research, system documentation, contracts, standards, manuals, spreadsheets, presentations, reports, stakeholder notes, screenshots, and prior decisions. Drafts and conflicting versions are useful when their status is clear.
62351
62364
 
62352
- Useful inputs include requirements, process notes, policies, proposals, user research, contracts, standards, manuals, spreadsheets, presentations, system notes, and existing decisions. Exclude credentials, secrets, unnecessary personal or regulated information, and material you are not permitted to process.
62365
+ Files stay in the local workspace and are ignored by Git by default. The SwarmCraft product does not directly upload this directory, but the configured AI may read and process its contents during discovery. Exclude credentials, secrets, unnecessary personal or regulated information, and material you are not permitted to process. Tell the discover assistant **gathering is complete** after adding everything you are comfortable providing, even when you have nothing else.
62353
62366
 
62354
62367
  ## PDF and difficult formats
62355
62368
 
@@ -62391,7 +62404,7 @@ var require_seedDiscoveryFiles = __commonJS({
62391
62404
  var renderDiscovery_1 = require_renderDiscovery();
62392
62405
  var renderPrototype_1 = require_renderPrototype();
62393
62406
  var renderReports_1 = require_renderReports();
62394
- exports2.DISCOVERY_SEED_VERSION = 5;
62407
+ exports2.DISCOVERY_SEED_VERSION = 9;
62395
62408
  exports2.DISCOVERY_SEED_STATE_PATH = ".swarmcraft/discovery.seed-state.json";
62396
62409
  var curated = [
62397
62410
  ["goals-and-success.md", "Goals and success", "Capture desired outcomes, measurable success, boundaries, and why the work matters."],
@@ -62446,12 +62459,6 @@ var require_seedDiscoveryFiles = __commonJS({
62446
62459
  for (const file of files) {
62447
62460
  const exists = await dependencies.fileExists(file.relativePath);
62448
62461
  if (exists && file.ownership === "CREATE_ONCE_HUMAN") {
62449
- const current = await dependencies.readFile(file.relativePath);
62450
- const legacyHashes = legacyCreateOnceHashes(file.relativePath);
62451
- if ((previous?.seedVersion ?? 1) < exports2.DISCOVERY_SEED_VERSION && legacyHashes.includes(hash(current)) && current !== file.contents) {
62452
- await dependencies.writeFile(file.relativePath, file.contents);
62453
- result.written.push(file.relativePath);
62454
- }
62455
62462
  continue;
62456
62463
  }
62457
62464
  if (exists) {
@@ -62509,25 +62516,6 @@ var require_seedDiscoveryFiles = __commonJS({
62509
62516
  function hash(contents) {
62510
62517
  return (0, node_crypto_1.createHash)("sha256").update(contents, "utf8").digest("hex");
62511
62518
  }
62512
- function legacyCreateOnceHashes(relativePath) {
62513
- if (relativePath === "docs/discovery/README.md")
62514
- return [
62515
- "efe8dd9e59acc48cfef1b3d7397c69fc6bc635ffcc736d86fb276a09dc0b9876",
62516
- "b21d6412d5750395933c2e92dad09851a03e5a85cc74961ab8ad210acf412e0b",
62517
- "f86ac3f41439c57612112810783361fda8a9d280469d99ce05fab43072e75117"
62518
- ];
62519
- if (relativePath === "docs/discovery/sources/README.md")
62520
- return ["78480d822849225c02d0fe09b2ba9e6497112f90c203f3e77a55c5f3284a3172"];
62521
- const match = curated.find(([file]) => relativePath === `docs/discovery/${file}`);
62522
- return match ? [hash(`# ${match[1]}
62523
-
62524
- ${match[2]}
62525
-
62526
- ## Confirmed
62527
-
62528
- ## Assumptions and open questions
62529
- `)] : [];
62530
- }
62531
62519
  }
62532
62520
  });
62533
62521
 
@@ -62550,24 +62538,24 @@ var require_securityReportContract = __commonJS({
62550
62538
  function redactSecurityEvidence(value) {
62551
62539
  return value.replace(/\b(Bearer\s+)[A-Za-z0-9._~+\/-]+/gi, "$1[REDACTED]").replace(/\b(api[_-]?key|token|secret|password)\s*[:=]\s*[^\s,;]+/gi, "$1=[REDACTED]").replace(/[\r\n]+/g, " ").replace(/[`|]/g, " ").replace(/\s+/g, " ").trim().slice(0, 500);
62552
62540
  }
62553
- function updateSecurityAssessment(input2) {
62554
- if (input2.cancelled)
62541
+ function updateSecurityAssessment(input) {
62542
+ if (input.cancelled)
62555
62543
  throw new Error("Cancelled security analysis preserves the previous report.");
62556
- if (input2.status === "PARTIAL" && input2.current.length === 0)
62544
+ if (input.status === "PARTIAL" && input.current.length === 0)
62557
62545
  throw new Error("A partial security report requires useful evidence.");
62558
- const accepted = new Map((input2.acceptedRisks ?? []).map((record) => {
62546
+ const accepted = new Map((input.acceptedRisks ?? []).map((record) => {
62559
62547
  validateAcceptedRisk(record);
62560
62548
  return [record.findingId, record];
62561
62549
  }));
62562
- const previousById = new Map(input2.previous.map((finding) => [finding.id, finding]));
62563
- const findings = input2.current.map((evidence) => {
62550
+ const previousById = new Map(input.previous.map((finding) => [finding.id, finding]));
62551
+ const findings = input.current.map((evidence) => {
62564
62552
  const id = createSecurityFindingId(evidence.ruleId, evidence.affectedSurface);
62565
62553
  const state = accepted.has(id) ? "accepted-risk" : evidence.confidence === "low" ? "human-verification" : previousById.has(id) ? "continuing" : "new";
62566
62554
  return { ...evidence, id, evidence: redactSecurityEvidence(evidence.evidence), state };
62567
62555
  }).sort((left, right) => left.id.localeCompare(right.id));
62568
62556
  const currentIds = new Set(findings.map(({ id }) => id));
62569
- const resolved = input2.previous.filter(({ id, state }) => !currentIds.has(id) && state !== "false-positive").map((finding) => ({ ...finding, state: "resolved" }));
62570
- const fullBaseline = input2.mode === "baseline" ? renderBaseline(input2.assessedRef, findings) : input2.previousFullBaseline ?? "No full baseline has been recorded.";
62557
+ const resolved = input.previous.filter(({ id, state }) => !currentIds.has(id) && state !== "false-positive").map((finding) => ({ ...finding, state: "resolved" }));
62558
+ const fullBaseline = input.mode === "baseline" ? renderBaseline(input.assessedRef, findings) : input.previousFullBaseline ?? "No full baseline has been recorded.";
62571
62559
  return { findings, resolved, fullBaseline };
62572
62560
  }
62573
62561
  function securityCheckingDisposition(findings) {
@@ -63202,19 +63190,18 @@ __export(main_exports, {
63202
63190
  findCommand: () => findCommand,
63203
63191
  formatDiscoveryElapsed: () => formatDiscoveryElapsed,
63204
63192
  main: () => main,
63205
- parseArgs: () => parseArgs
63193
+ parseArgs: () => parseArgs,
63194
+ runAuthLogin: () => runAuthLogin
63206
63195
  });
63207
63196
  module.exports = __toCommonJS(main_exports);
63208
- var import_promises9 = require("node:fs/promises");
63197
+ var import_promises10 = require("node:fs/promises");
63209
63198
  var import_node_path9 = __toESM(require("node:path"), 1);
63210
- var import_promises10 = require("node:readline/promises");
63211
- var import_node_process = require("node:process");
63212
63199
  var import_packet_workflow6 = __toESM(require_dist(), 1);
63213
63200
 
63214
63201
  // package.json
63215
63202
  var package_default = {
63216
63203
  name: "@swarmcraftai/cli",
63217
- version: "0.4.0",
63204
+ version: "0.4.1",
63218
63205
  description: "Prepare repositories and run packet-based SwarmCraft agent workflows from the terminal.",
63219
63206
  license: "SEE LICENSE IN LICENSE.txt",
63220
63207
  type: "module",
@@ -63846,22 +63833,22 @@ function shellQuote(value) {
63846
63833
 
63847
63834
  // src/workflows/one-shot-board-sync.ts
63848
63835
  var import_packet_workflow3 = __toESM(require_dist(), 1);
63849
- async function syncPacketFile(input2) {
63836
+ async function syncPacketFile(input) {
63850
63837
  const syncedAt = (/* @__PURE__ */ new Date()).toISOString();
63851
- const fileContents = await readWorkspaceFile(input2.workspacePath, input2.relativePacketPath);
63838
+ const fileContents = await readWorkspaceFile(input.workspacePath, input.relativePacketPath);
63852
63839
  const parsedPacket = (0, import_packet_workflow3.parsePacketFile)(fileContents);
63853
- if (parsedPacket.frontmatter.projectId !== input2.project.id || parsedPacket.frontmatter.taskId !== input2.task.id) {
63854
- throw new Error(`Packet ${input2.relativePacketPath} does not belong to task ${input2.task.id}.`);
63840
+ if (parsedPacket.frontmatter.projectId !== input.project.id || parsedPacket.frontmatter.taskId !== input.task.id) {
63841
+ throw new Error(`Packet ${input.relativePacketPath} does not belong to task ${input.task.id}.`);
63855
63842
  }
63856
- if (parsedPacket.frontmatter.syncRevision !== input2.task.revision) {
63857
- throw new Error(`Packet ${input2.relativePacketPath} is stale; expected revision ${input2.task.revision}.`);
63843
+ if (parsedPacket.frontmatter.syncRevision !== input.task.revision) {
63844
+ throw new Error(`Packet ${input.relativePacketPath} is stale; expected revision ${input.task.revision}.`);
63858
63845
  }
63859
- const shapeProblem = (0, import_packet_workflow3.findChecklistShapeProblem)(input2.task.checklistItems, parsedPacket.sections.checklists);
63846
+ const shapeProblem = (0, import_packet_workflow3.findChecklistShapeProblem)(input.task.checklistItems, parsedPacket.sections.checklists);
63860
63847
  if (shapeProblem) {
63861
63848
  throw new Error(shapeProblem.message);
63862
63849
  }
63863
- let currentBoard = input2.board;
63864
- let currentTask = input2.task;
63850
+ let currentBoard = input.board;
63851
+ let currentTask = input.task;
63865
63852
  let syncedChanges = 0;
63866
63853
  for (const checklistStage of import_packet_workflow3.CHECKLIST_STAGES) {
63867
63854
  const currentItems = (0, import_packet_workflow3.listChecklistItemsForStage)(currentTask.checklistItems, checklistStage);
@@ -63871,29 +63858,29 @@ async function syncPacketFile(input2) {
63871
63858
  if (currentItem.completed === parsedItem.completed) {
63872
63859
  continue;
63873
63860
  }
63874
- currentBoard = await input2.client.updateChecklistItem(input2.project.id, currentTask.id, currentItem.id, {
63861
+ currentBoard = await input.client.updateChecklistItem(input.project.id, currentTask.id, currentItem.id, {
63875
63862
  completed: parsedItem.completed,
63876
63863
  expectedRevision: currentItem.revision
63877
- }, await input2.getAccessToken(), input2.delegationId);
63864
+ }, await input.getAccessToken(), input.delegationId);
63878
63865
  currentTask = requireBoardTask(currentBoard, currentTask.id);
63879
63866
  syncedChanges += 1;
63880
63867
  }
63881
63868
  }
63882
63869
  const desiredNotes = (0, import_packet_workflow3.composeTaskNotes)(parsedPacket.sections.notes, parsedPacket.sections.agentUpdate);
63883
63870
  if ((currentTask.notes ?? null) !== desiredNotes) {
63884
- currentBoard = await input2.client.updateTaskNotes(input2.project.id, currentTask.id, {
63871
+ currentBoard = await input.client.updateTaskNotes(input.project.id, currentTask.id, {
63885
63872
  notes: desiredNotes,
63886
63873
  expectedRevision: currentTask.revision
63887
- }, await input2.getAccessToken(), input2.delegationId);
63874
+ }, await input.getAccessToken(), input.delegationId);
63888
63875
  currentTask = requireBoardTask(currentBoard, currentTask.id);
63889
63876
  syncedChanges += 1;
63890
63877
  }
63891
- if (input2.allowLaneSync && parsedPacket.frontmatter.lane !== currentTask.workflowState) {
63892
- currentBoard = await moveBoardTask(input2.client, await input2.getAccessToken(), input2.project.id, currentTask, parsedPacket.frontmatter.lane, input2.delegationId);
63878
+ if (input.allowLaneSync && parsedPacket.frontmatter.lane !== currentTask.workflowState) {
63879
+ currentBoard = await moveBoardTask(input.client, await input.getAccessToken(), input.project.id, currentTask, parsedPacket.frontmatter.lane, input.delegationId);
63893
63880
  currentTask = requireBoardTask(currentBoard, currentTask.id);
63894
63881
  syncedChanges += 1;
63895
63882
  }
63896
- await refreshPacketMetadata(input2.workspacePath, input2.relativePacketPath, currentTask, syncedAt);
63883
+ await refreshPacketMetadata(input.workspacePath, input.relativePacketPath, currentTask, syncedAt);
63897
63884
  return { board: currentBoard, task: currentTask, syncedChanges };
63898
63885
  }
63899
63886
  async function moveBoardTask(client, accessToken, projectId, task, workflowState, delegationId) {
@@ -64947,6 +64934,46 @@ function findCommand(positionals) {
64947
64934
  return COMMANDS.find((command) => command.name === commandKey);
64948
64935
  }
64949
64936
 
64937
+ // src/terminalPrompt.ts
64938
+ var import_node_process = require("node:process");
64939
+ var import_promises9 = require("node:readline/promises");
64940
+ var import_node_stream = require("node:stream");
64941
+ var DEFAULT_STREAMS = { input: import_node_process.stdin, output: import_node_process.stdout };
64942
+ async function promptLine(prompt, streams = DEFAULT_STREAMS) {
64943
+ const readline = (0, import_promises9.createInterface)({ input: streams.input, output: streams.output });
64944
+ try {
64945
+ return (await readline.question(prompt)).trim();
64946
+ } finally {
64947
+ readline.close();
64948
+ }
64949
+ }
64950
+ async function promptSecret(prompt, streams = DEFAULT_STREAMS) {
64951
+ if (!streams.input.isTTY) {
64952
+ return promptLine(prompt, streams);
64953
+ }
64954
+ let muted = false;
64955
+ const concealedOutput = new import_node_stream.Writable({
64956
+ write(chunk, _encoding, callback) {
64957
+ if (!muted) {
64958
+ streams.output.write(chunk);
64959
+ }
64960
+ callback();
64961
+ }
64962
+ });
64963
+ concealedOutput.isTTY = true;
64964
+ concealedOutput.columns = streams.output.columns ?? 80;
64965
+ const readline = (0, import_promises9.createInterface)({ input: streams.input, output: concealedOutput, terminal: true });
64966
+ try {
64967
+ const answer = readline.question(prompt);
64968
+ muted = true;
64969
+ return (await answer).trim();
64970
+ } finally {
64971
+ muted = false;
64972
+ readline.close();
64973
+ streams.output.write("\n");
64974
+ }
64975
+ }
64976
+
64950
64977
  // src/main.ts
64951
64978
  var VERSION = package_default.version;
64952
64979
  var DEFAULT_API_BASE_URL = "https://swarmcraft.ai/api";
@@ -65028,17 +65055,21 @@ ${command.summary}
65028
65055
  This command is planned but not implemented yet.`);
65029
65056
  }
65030
65057
  }
65031
- async function runAuthLogin(parsed) {
65058
+ var DEFAULT_AUTH_LOGIN_PROMPTS = { line: promptLine, secret: promptSecret };
65059
+ async function runAuthLogin(parsed, prompts = DEFAULT_AUTH_LOGIN_PROMPTS) {
65032
65060
  const apiBaseUrl = getOption(parsed, "api-base-url") ?? process.env.SWARMCRAFT_API_BASE_URL ?? DEFAULT_API_BASE_URL;
65033
- const email = getOption(parsed, "email") ?? process.env.SWARMCRAFT_EMAIL ?? await promptLine("Email: ");
65034
- const password = getOption(parsed, "password") ?? process.env.SWARMCRAFT_PASSWORD ?? await promptSecret("Password: ");
65061
+ const email = getOption(parsed, "email") ?? process.env.SWARMCRAFT_EMAIL ?? await prompts.line("Email: ");
65062
+ const password = getOption(parsed, "password") ?? process.env.SWARMCRAFT_PASSWORD ?? await prompts.secret("Password: ");
65035
65063
  const client = new SwarmCraftClient(apiBaseUrl);
65036
65064
  let tokenResponse = await client.login(email, password);
65037
65065
  if (tokenResponse.user.mfaEnrolled && !tokenResponse.user.mfaVerified) {
65038
- const mfaCode = getOption(parsed, "mfa-code") ?? process.env.SWARMCRAFT_MFA_CODE;
65039
- const recoveryCode = getOption(parsed, "recovery-code") ?? process.env.SWARMCRAFT_MFA_RECOVERY_CODE;
65066
+ let mfaCode = getOption(parsed, "mfa-code") ?? process.env.SWARMCRAFT_MFA_CODE;
65067
+ let recoveryCode = getOption(parsed, "recovery-code") ?? process.env.SWARMCRAFT_MFA_RECOVERY_CODE;
65040
65068
  if (!mfaCode && !recoveryCode) {
65041
- throw new Error("MFA is required. Rerun with --mfa-code <code> or --recovery-code <code>.");
65069
+ mfaCode = await prompts.secret("MFA code (press Enter to use a recovery code): ");
65070
+ if (!mfaCode) {
65071
+ recoveryCode = await prompts.secret("Recovery code: ");
65072
+ }
65042
65073
  }
65043
65074
  const mfaResponse = recoveryCode ? await client.mfaRecovery(tokenResponse.accessToken, recoveryCode) : await client.mfaChallenge(tokenResponse.accessToken, mfaCode);
65044
65075
  tokenResponse = {
@@ -65346,7 +65377,7 @@ function parseOneShotOptions(parsed) {
65346
65377
  };
65347
65378
  }
65348
65379
  async function readRunManifest(workspacePath, runId) {
65349
- return JSON.parse(await (0, import_promises9.readFile)(resolveManifestPath(import_node_path9.default.resolve(workspacePath), runId), "utf8"));
65380
+ return JSON.parse(await (0, import_promises10.readFile)(resolveManifestPath(import_node_path9.default.resolve(workspacePath), runId), "utf8"));
65350
65381
  }
65351
65382
  function printGeneralHelp() {
65352
65383
  console.log(`SwarmCraft CLI ${VERSION}
@@ -65427,17 +65458,6 @@ function parseRunId2(rawValue) {
65427
65458
  }
65428
65459
  return rawValue;
65429
65460
  }
65430
- async function promptLine(prompt) {
65431
- const readline = (0, import_promises10.createInterface)({ input: import_node_process.stdin, output: import_node_process.stdout });
65432
- try {
65433
- return (await readline.question(prompt)).trim();
65434
- } finally {
65435
- readline.close();
65436
- }
65437
- }
65438
- async function promptSecret(prompt) {
65439
- return promptLine(prompt);
65440
- }
65441
65461
  if (isCliEntrypoint()) {
65442
65462
  main(process.argv.slice(2)).then((exitCode) => {
65443
65463
  process.exitCode = exitCode;
@@ -65461,7 +65481,8 @@ function isCliEntrypoint() {
65461
65481
  findCommand,
65462
65482
  formatDiscoveryElapsed,
65463
65483
  main,
65464
- parseArgs
65484
+ parseArgs,
65485
+ runAuthLogin
65465
65486
  });
65466
65487
  /*! Bundled license information:
65467
65488