@fungi.computer/computer 0.3.0 → 0.3.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.
@@ -14544,6 +14544,21 @@ function makeIsGreaterThanOrEqualTo(options) {
14544
14544
  });
14545
14545
  };
14546
14546
  }
14547
+ function makeIsLessThanOrEqualTo(options) {
14548
+ const lte = isLessThanOrEqualTo(options.order);
14549
+ const formatter = options.formatter ?? format;
14550
+ return (maximum, annotations) => {
14551
+ return makeFilter2((input) => lte(input, maximum), {
14552
+ expected: `a value less than or equal to ${formatter(maximum)}`,
14553
+ arbitraryConstraint: {
14554
+ order: options.order,
14555
+ maximum
14556
+ },
14557
+ ...options.annotate?.(maximum),
14558
+ ...annotations
14559
+ });
14560
+ };
14561
+ }
14547
14562
  function makeIsBetween(deriveOptions) {
14548
14563
  const greaterThanOrEqualTo = isGreaterThanOrEqualTo(deriveOptions.order);
14549
14564
  const greaterThan = isGreaterThan(deriveOptions.order);
@@ -14611,6 +14626,23 @@ var isGreaterThanOrEqualTo2 = /* @__PURE__ */ makeIsGreaterThanOrEqualTo({
14611
14626
  })
14612
14627
  })
14613
14628
  });
14629
+ var isLessThanOrEqualTo2 = /* @__PURE__ */ makeIsLessThanOrEqualTo({
14630
+ order: Number2,
14631
+ annotate: (maximum) => ({
14632
+ representation: {
14633
+ id: "effect/schema/isLessThanOrEqualTo",
14634
+ payload: {
14635
+ maximum: encodeNumberPayload(maximum)
14636
+ }
14637
+ },
14638
+ toJsonSchema: () => ({
14639
+ maximum
14640
+ }),
14641
+ toCode: () => ({
14642
+ runtime: `Schema.isLessThanOrEqualTo(${format(maximum)})`
14643
+ })
14644
+ })
14645
+ });
14614
14646
  var isBetween = /* @__PURE__ */ makeIsBetween({
14615
14647
  order: Number2,
14616
14648
  annotate: (options) => {
@@ -16806,14 +16838,14 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
16806
16838
  return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
16807
16839
  };
16808
16840
  doc.write(`const input = payload.value;`);
16809
- const ids = /* @__PURE__ */ Object.create(null);
16841
+ const ids2 = /* @__PURE__ */ Object.create(null);
16810
16842
  let counter = 0;
16811
16843
  for (const key of normalized.keys) {
16812
- ids[key] = `key_${counter++}`;
16844
+ ids2[key] = `key_${counter++}`;
16813
16845
  }
16814
16846
  doc.write(`const newResult = {};`);
16815
16847
  for (const key of normalized.keys) {
16816
- const id = ids[key];
16848
+ const id = ids2[key];
16817
16849
  const k = esc(key);
16818
16850
  const schema2 = shape[key];
16819
16851
  const isOptionalIn = schema2?._zod?.optin === "optional";
@@ -21625,6 +21657,204 @@ var publicRouteConfigurationSchema = Struct({
21625
21657
  // src/build/candidate-cli.ts
21626
21658
  import { readFile as readFile6 } from "node:fs/promises";
21627
21659
 
21660
+ // ../carrier/dist/internal/post-contract.js
21661
+ var CursorResultSchema = Struct({
21662
+ status: Literals(["accepted", "duplicate"]),
21663
+ cursor: Int.check(isGreaterThanOrEqualTo2(0))
21664
+ });
21665
+ var PostDeliveryResultSchema = Union2([
21666
+ Literals(["accepted", "duplicate", "refused"]),
21667
+ CursorResultSchema,
21668
+ Struct({
21669
+ status: Literals(["accepted", "duplicate", "refused"]),
21670
+ receipt: Json2
21671
+ })
21672
+ ]);
21673
+ var PostError = class extends TaggedError2("PostError") {
21674
+ constructor(message, reason) {
21675
+ super(reason === void 0 ? { message } : { message, reason });
21676
+ }
21677
+ };
21678
+
21679
+ // ../carrier/dist/post.js
21680
+ var Key = String4.check(isMinLength(1), isMaxLength(256));
21681
+ var JobPayload = Struct({ postKey: Key });
21682
+ var PageLimit = Int.check(isGreaterThanOrEqualTo2(1), isLessThanOrEqualTo2(64));
21683
+ var maxRouteDeadlineMs = 7 * 24 * 60 * 60 * 1e3;
21684
+ var ids = defineIdFamily({
21685
+ family: "post",
21686
+ version: 1,
21687
+ kinds: { work: { prefix: "post_work" } }
21688
+ });
21689
+ var PostEnvelopeSchema = Struct({
21690
+ key: Key,
21691
+ kind: Key,
21692
+ address: Unknown2,
21693
+ event: Unknown2
21694
+ });
21695
+ var PostRowSchema = fromJsonString2(Union2([
21696
+ Struct({
21697
+ state: Literal2("pending"),
21698
+ envelope: PostEnvelopeSchema,
21699
+ attempts: Int.check(isGreaterThanOrEqualTo2(0)),
21700
+ nextAttemptAt: Number5.check(isGreaterThanOrEqualTo2(0)),
21701
+ deadlineAt: optional2(Number5.check(isGreaterThanOrEqualTo2(0))),
21702
+ jobId: optional2(Key),
21703
+ delivery: optional2(PostEnvelopeSchema),
21704
+ nextKey: optional2(Key)
21705
+ }),
21706
+ Struct({
21707
+ state: Literal2("delivered"),
21708
+ receipt: optional2(Json2),
21709
+ nextKey: optional2(Key)
21710
+ }),
21711
+ Struct({
21712
+ state: Literal2("dead"),
21713
+ envelope: PostEnvelopeSchema,
21714
+ attempts: Int.check(isGreaterThanOrEqualTo2(0)),
21715
+ reason: Literals(["refused", "exhausted", "expired"]),
21716
+ deadlineAt: optional2(Number5.check(isGreaterThanOrEqualTo2(0))),
21717
+ receipt: optional2(Json2),
21718
+ delivery: optional2(PostEnvelopeSchema),
21719
+ nextKey: optional2(Key)
21720
+ })
21721
+ ]));
21722
+ var StoredRow = Struct({ key: String4, value: String4 });
21723
+ var DueRow = Struct({
21724
+ due: NullOr(Number5.check(isGreaterThanOrEqualTo2(0)))
21725
+ });
21726
+
21727
+ // ../bird-dog/dist/effect.js
21728
+ var Identifier = String4.check(isMinLength(1), isMaxLength(256));
21729
+ var BIRD_DOG_MAIL_CONTENT_MAX_BYTES = 256 * 1024;
21730
+ var MailContent = String4.check(makeFilter2((content) => new TextEncoder().encode(content).byteLength <= BIRD_DOG_MAIL_CONTENT_MAX_BYTES, {
21731
+ message: `Mail content must be at most ${String(BIRD_DOG_MAIL_CONTENT_MAX_BYTES)} UTF-8 bytes`
21732
+ }));
21733
+ var BirdDogAgentReferenceSchema = Struct({
21734
+ kind: Literal2("agent"),
21735
+ agentId: Identifier,
21736
+ sessionId: Identifier
21737
+ });
21738
+ var BirdDogAgentRecipientReferenceSchema = Struct({
21739
+ kind: Literal2("agent"),
21740
+ agentId: Identifier,
21741
+ sessionId: optionalKey2(Identifier)
21742
+ });
21743
+ var BirdDogSystemIdentitySchema = Struct({
21744
+ kind: Literal2("system"),
21745
+ systemId: Literal2("hub")
21746
+ });
21747
+ var BIRD_DOG_DIAGNOSTIC_MAX_LENGTH = 200;
21748
+ var SettledBirdDogReplySchema = Struct({
21749
+ commandId: Identifier,
21750
+ outcome: Literals([
21751
+ "completed",
21752
+ "failed",
21753
+ "interrupted",
21754
+ "cancelled",
21755
+ "outcome_unknown"
21756
+ ]),
21757
+ diagnostic: optionalKey2(String4.check(isMinLength(1), isMaxLength(BIRD_DOG_DIAGNOSTIC_MAX_LENGTH)))
21758
+ });
21759
+ var BirdDogUndeliverableReasonSchema = Literals([
21760
+ "recipient_offline",
21761
+ "recipient_left"
21762
+ ]);
21763
+ var UndeliverableBirdDogReplySchema = Struct({
21764
+ outcome: Literal2("undeliverable"),
21765
+ reason: BirdDogUndeliverableReasonSchema
21766
+ });
21767
+ var AcceptedBirdDogReplySchema = Struct({
21768
+ outcome: Literal2("accepted"),
21769
+ commandId: Identifier
21770
+ });
21771
+ var BirdDogReplySchema = Union2([
21772
+ SettledBirdDogReplySchema,
21773
+ UndeliverableBirdDogReplySchema,
21774
+ AcceptedBirdDogReplySchema
21775
+ ]);
21776
+ var BirdDogAgentReplySchema = Union2([
21777
+ SettledBirdDogReplySchema,
21778
+ AcceptedBirdDogReplySchema,
21779
+ Struct({
21780
+ outcome: Literal2("undeliverable"),
21781
+ reason: Literal2("recipient_left")
21782
+ })
21783
+ ]);
21784
+ var REDACTED = "[redacted]";
21785
+ var schemeCredential = /\b(bearer|basic)\s+[^\s"',;]+/giu;
21786
+ var namedCredential = /\b((?:api[_-]?key|access[_-]?token|refresh[_-]?token|token|secret|password|authorization)["']?\s*[:=]\s*["']?)(?!(?:bearer|basic)\s)[^\s"',;&]+/giu;
21787
+ var opaqueToken = /[A-Za-z0-9][\w-]{23,}/gu;
21788
+ function redactCredentials(text) {
21789
+ return text.replace(schemeCredential, `$1 ${REDACTED}`).replace(namedCredential, `$1${REDACTED}`).replace(opaqueToken, (token) => /\d/u.test(token) && /[A-Za-z]/u.test(token) ? REDACTED : token);
21790
+ }
21791
+ function boundedDiagnostic(text) {
21792
+ const line = redactCredentials(text.replace(/[\p{Cc}\p{Zl}\p{Zp}\s]+/gu, " ").trim()).slice(0, BIRD_DOG_DIAGNOSTIC_MAX_LENGTH).trimEnd();
21793
+ return line.length === 0 ? void 0 : line;
21794
+ }
21795
+ var BirdDogMailFields = {
21796
+ key: Identifier,
21797
+ to: BirdDogAgentRecipientReferenceSchema,
21798
+ replyTo: ArraySchema(BirdDogAgentReferenceSchema),
21799
+ content: MailContent,
21800
+ createdAt: Number5.check(isGreaterThanOrEqualTo2(0)),
21801
+ /** The sender's opaque host metadata; BirdDog never reads it. */
21802
+ meta: optionalKey2(Json2)
21803
+ };
21804
+ var BirdDogMailSchema = Union2([
21805
+ Struct({
21806
+ ...BirdDogMailFields,
21807
+ from: BirdDogAgentReferenceSchema,
21808
+ /** Settlement or acceptance facts, present only on a reply. */
21809
+ reply: optionalKey2(BirdDogAgentReplySchema)
21810
+ }),
21811
+ Struct({
21812
+ ...BirdDogMailFields,
21813
+ from: BirdDogSystemIdentitySchema,
21814
+ /** Only the Hub may author this offline disposition. */
21815
+ reply: Struct({
21816
+ outcome: Literal2("undeliverable"),
21817
+ reason: Literal2("recipient_offline")
21818
+ })
21819
+ })
21820
+ ]);
21821
+ var BirdDogAgentWorkSchema = Struct({
21822
+ jobId: Identifier,
21823
+ sessionId: Identifier,
21824
+ commandFactId: Identifier,
21825
+ recovery: optional2(Struct({
21826
+ maxRecoveries: Int.check(isGreaterThanOrEqualTo2(0))
21827
+ }))
21828
+ });
21829
+ var BirdDogAgentJobPayloadSchema = Struct({
21830
+ work: Struct({
21831
+ sessionId: Identifier,
21832
+ commandFactId: Identifier
21833
+ }),
21834
+ mail: optional2(BirdDogMailSchema)
21835
+ });
21836
+ var BirdDogAgentJobInputSchema = Struct({
21837
+ work: BirdDogAgentWorkSchema,
21838
+ mail: optional2(BirdDogMailSchema)
21839
+ });
21840
+
21841
+ // src/build/candidate-diagnostic.ts
21842
+ function candidateFailureDiagnostic(cause) {
21843
+ const messages = [];
21844
+ let current = cause;
21845
+ for (let depth = 0; depth < 3; depth += 1) {
21846
+ if (!(current instanceof Error)) {
21847
+ if (depth === 0) messages.push("Non-error thrown");
21848
+ break;
21849
+ }
21850
+ messages.push(
21851
+ `${depth === 0 ? "" : "Caused by: "}${current.message || current.name}`
21852
+ );
21853
+ current = current.cause;
21854
+ }
21855
+ return boundedDiagnostic(messages.join("; ")) ?? "Build failed";
21856
+ }
21857
+
21628
21858
  // ../puffball/dist/assets.js
21629
21859
  var positiveInteger = Number5.pipe(check(isInt()), check(isGreaterThan2(0)), check(makeFilter2(Number.isSafeInteger)));
21630
21860
  var assetBuildPolicySchema = Struct({
@@ -36087,10 +36317,14 @@ async function buildTeamCandidate(input) {
36087
36317
  var uploadConcurrency = 4;
36088
36318
  var uploadAttempts = 3;
36089
36319
  function reportFailure2(cause) {
36320
+ const diagnostic = candidateFailureDiagnostic(cause);
36321
+ process.stderr.write(`Team App source/build failed: ${diagnostic}
36322
+ `);
36090
36323
  process.stderr.write(
36091
36324
  `${JSON.stringify({
36092
36325
  source: "oyster-candidate-builder",
36093
- failureKind: cause instanceof Error ? "Error" : "NonErrorThrown"
36326
+ failureKind: cause instanceof Error ? "Error" : "NonErrorThrown",
36327
+ diagnostic
36094
36328
  })}
36095
36329
  `
36096
36330
  );
@@ -36199,7 +36433,6 @@ try {
36199
36433
  );
36200
36434
  } catch (cause) {
36201
36435
  reportFailure2(cause);
36202
- process.stderr.write("Team App source/build failed\n");
36203
36436
  process.exitCode = 1;
36204
36437
  }
36205
36438
  /*! Bundled license information:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/computer",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "author": "Levi <levi@technomancy.dev>",
5
5
  "description": "Cloudflare Computer host for one durable Fungi Computer",
6
6
  "type": "module",
@@ -60,10 +60,10 @@
60
60
  "@fungi.computer/capnweb": "0.12.0",
61
61
  "@fungi.computer/cloudflare-computer": "0.2.1-fungi.2",
62
62
  "@fungi.computer/cordyceps": "0.4.0",
63
- "@fungi.computer/knapsack": "0.3.0",
63
+ "@fungi.computer/knapsack": "0.3.1",
64
64
  "@fungi.computer/seam": "0.2.0",
65
65
  "@fungi.computer/watchdog": "0.1.0",
66
- "@fungi.computer/computer-contract": "0.0.3",
66
+ "@fungi.computer/computer-contract": "0.0.4",
67
67
  "effect": "4.0.2",
68
68
  "just-bash": "3.4.2",
69
69
  "zod": "4.4.3"