@kitman-sh/sdk 0.10.79 → 0.10.80
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/build/index.js +2 -2
- package/dist/{chunk-r609bz8q.js → chunk-9ff7wyqt.js} +1561 -1501
- package/dist/{chunk-7tbysqtf.js → chunk-hrwq77a0.js} +1 -1
- package/dist/loop/index.js +1 -1
- package/dist/program/index.js +2 -2
- package/package.json +1 -1
- package/types/packages/core/src/loop.d.ts +64 -11
- package/types/packages/core/src/redaction.d.ts +5 -0
- package/types/packages/core/src/secret.d.ts +2 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// packages/core/src/kit-declarations.ts
|
|
3
|
-
import * as
|
|
3
|
+
import * as Schema15 from "effect/Schema";
|
|
4
4
|
|
|
5
5
|
// packages/core/src/agent-sandbox-policy.ts
|
|
6
6
|
import * as Schema from "effect/Schema";
|
|
@@ -352,7 +352,7 @@ var AgentCapabilities = ["web", "subagents", "artifacts", "browser"];
|
|
|
352
352
|
|
|
353
353
|
// packages/core/src/loop.ts
|
|
354
354
|
import * as Effect from "effect/Effect";
|
|
355
|
-
import * as
|
|
355
|
+
import * as Schema13 from "effect/Schema";
|
|
356
356
|
|
|
357
357
|
// packages/core/src/context-pack.ts
|
|
358
358
|
import * as Schema6 from "effect/Schema";
|
|
@@ -483,61 +483,102 @@ var ContextPackRetrievedContext = Schema6.Struct({
|
|
|
483
483
|
});
|
|
484
484
|
|
|
485
485
|
// packages/core/src/extension.ts
|
|
486
|
-
import * as
|
|
486
|
+
import * as Schema10 from "effect/Schema";
|
|
487
487
|
|
|
488
488
|
// packages/core/src/run.ts
|
|
489
|
-
import * as
|
|
489
|
+
import * as Schema9 from "effect/Schema";
|
|
490
490
|
|
|
491
491
|
// packages/core/src/redaction.ts
|
|
492
|
-
import * as
|
|
492
|
+
import * as Schema8 from "effect/Schema";
|
|
493
493
|
import * as Data from "effect/Data";
|
|
494
|
+
|
|
495
|
+
// packages/core/src/secret.ts
|
|
496
|
+
import * as Schema7 from "effect/Schema";
|
|
497
|
+
var SecretName = Schema7.String.check(Schema7.isPattern(new RegExp("^[A-Za-z_][A-Za-z0-9_]*$", "u")), Schema7.isMinLength(1), Schema7.isMaxLength(128));
|
|
498
|
+
var SecretScope = Schema7.Union([Schema7.Literal("workspace"), Schema7.Literal("team")]);
|
|
499
|
+
var SecretHost = Schema7.String.check(Schema7.isPattern(new RegExp("^(\\*\\.)?[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*(?::[0-9]{1,5})?$", "u")), Schema7.isMaxLength(260));
|
|
500
|
+
var SecretHosts = Schema7.Array(SecretHost).check(Schema7.isMaxLength(32));
|
|
501
|
+
var referencePattern = /secret:\/\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+/;
|
|
502
|
+
var placeholderMarker = "kitmanref";
|
|
503
|
+
var tokenCharacter = "[A-Za-z0-9._~+/-]";
|
|
504
|
+
var placeholderPattern = new RegExp(`(?<!${tokenCharacter})(?:proxy-ep=[A-Za-z0-9.-]+;)?${tokenCharacter}*${placeholderMarker}((?:[0-9a-f]{2})+)`);
|
|
505
|
+
var anyReference = new RegExp(`${referencePattern.source}|${placeholderPattern.source}`, "g");
|
|
506
|
+
var unhex = (text) => new TextDecoder().decode(Uint8Array.from(text.match(/../g) ?? [], (pair) => Number.parseInt(pair, 16)));
|
|
507
|
+
var isReference = (text) => new RegExp(`^${referencePattern.source}$`).test(text);
|
|
508
|
+
var tokenPrefix = /^(?:sk-ant-[a-z]+[0-9]*-|sk-proj-|sk-or-v[0-9]+-|sk-|ya29\.|gh[opsu]_|github_pat_|xai-|gsk_|AIza)/;
|
|
509
|
+
var wholePlaceholder = new RegExp(`^(?:[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.|proxy-ep=[A-Za-z0-9.-]+;|${tokenPrefix.source.slice(1)})?${placeholderMarker}((?:[0-9a-f]{2})+)$`);
|
|
510
|
+
var isSecretReference = (text) => {
|
|
511
|
+
if (isReference(text))
|
|
512
|
+
return true;
|
|
513
|
+
const encoded = wholePlaceholder.exec(text)?.[1];
|
|
514
|
+
return encoded !== undefined && isReference(unhex(encoded));
|
|
515
|
+
};
|
|
516
|
+
var SecretSummary = Schema7.Struct({
|
|
517
|
+
name: SecretName,
|
|
518
|
+
scope: SecretScope,
|
|
519
|
+
teamId: Schema7.optionalKey(Id),
|
|
520
|
+
hosts: SecretHosts,
|
|
521
|
+
setByActorType: ActorType,
|
|
522
|
+
setByActorId: Schema7.String,
|
|
523
|
+
setAt: Timestamp
|
|
524
|
+
});
|
|
525
|
+
var SecretList = Schema7.Struct({ items: Schema7.Array(SecretSummary) });
|
|
526
|
+
var SecretSet = Schema7.Struct({
|
|
527
|
+
value: Schema7.String.check(Schema7.isMinLength(1), Schema7.isMaxLength(65536)),
|
|
528
|
+
teamId: Schema7.optionalKey(Schema7.String.check(Schema7.isMinLength(1))),
|
|
529
|
+
hosts: Schema7.optionalKey(SecretHosts)
|
|
530
|
+
});
|
|
531
|
+
var SecretScopeQuery = Schema7.Struct({ teamId: Schema7.optionalKey(Id) });
|
|
532
|
+
|
|
533
|
+
// packages/core/src/redaction.ts
|
|
494
534
|
var EvidenceRefContractVersion = "evidence-ref.v1";
|
|
495
|
-
var RedactionClassificationSchema =
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
535
|
+
var RedactionClassificationSchema = Schema8.Union([
|
|
536
|
+
Schema8.Literal("secret"),
|
|
537
|
+
Schema8.Literal("credential"),
|
|
538
|
+
Schema8.Literal("pii"),
|
|
539
|
+
Schema8.Literal("source"),
|
|
540
|
+
Schema8.Literal("log"),
|
|
541
|
+
Schema8.Literal("diff"),
|
|
542
|
+
Schema8.Literal("transcript"),
|
|
543
|
+
Schema8.Literal("provider_payload"),
|
|
544
|
+
Schema8.Literal("url"),
|
|
545
|
+
Schema8.Literal("path"),
|
|
546
|
+
Schema8.Literal("unknown")
|
|
507
547
|
]);
|
|
508
|
-
var RedactionFindingSchema =
|
|
509
|
-
path:
|
|
548
|
+
var RedactionFindingSchema = Schema8.Struct({
|
|
549
|
+
path: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(512)),
|
|
510
550
|
classification: RedactionClassificationSchema,
|
|
511
|
-
rule:
|
|
512
|
-
preview:
|
|
513
|
-
sha256:
|
|
514
|
-
})
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
551
|
+
rule: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(120)),
|
|
552
|
+
preview: Schema8.String.check(Schema8.isMaxLength(160)),
|
|
553
|
+
sha256: Schema8.String.check(Schema8.isPattern(new RegExp("^[a-f0-9]{64}$", "u"))),
|
|
554
|
+
span: Schema8.optionalKey(Schema8.Struct({ start: Schema8.Int.check(Schema8.isGreaterThanOrEqualTo(0)), end: Schema8.Int }))
|
|
555
|
+
});
|
|
556
|
+
var EvidenceRef = Schema8.Struct({
|
|
557
|
+
contractVersion: Schema8.Literal(EvidenceRefContractVersion),
|
|
558
|
+
kind: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(80)),
|
|
559
|
+
summary: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(240)),
|
|
560
|
+
sha256: Schema8.String.check(Schema8.isPattern(new RegExp("^[a-f0-9]{64}$", "u"))),
|
|
561
|
+
redaction: Schema8.Literal("redacted"),
|
|
562
|
+
findingCount: Schema8.Int.check(Schema8.isGreaterThanOrEqualTo(0)),
|
|
563
|
+
classifications: Schema8.Array(RedactionClassificationSchema).check(Schema8.isMaxLength(20))
|
|
523
564
|
});
|
|
524
565
|
var RedactionSurfaceKinds = ["api", "mcp", "cli", "web", "event", "log", "evidence", "export"];
|
|
525
|
-
var RedactionSurfaceKindSchema =
|
|
526
|
-
var RedactionWaiver =
|
|
527
|
-
contractVersion:
|
|
528
|
-
id:
|
|
529
|
-
workspaceId:
|
|
530
|
-
findingId:
|
|
531
|
-
reason:
|
|
532
|
-
authorityActorType:
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
566
|
+
var RedactionSurfaceKindSchema = Schema8.Literals(RedactionSurfaceKinds);
|
|
567
|
+
var RedactionWaiver = Schema8.Struct({
|
|
568
|
+
contractVersion: Schema8.Literal("redaction-waiver.v1"),
|
|
569
|
+
id: Schema8.String.check(Schema8.isMinLength(1)),
|
|
570
|
+
workspaceId: Schema8.String.check(Schema8.isMinLength(1)),
|
|
571
|
+
findingId: Schema8.String.check(Schema8.isMinLength(1)),
|
|
572
|
+
reason: Schema8.String.check(Schema8.isMinLength(1), Schema8.isMaxLength(1000)),
|
|
573
|
+
authorityActorType: Schema8.Union([
|
|
574
|
+
Schema8.Literal("human"),
|
|
575
|
+
Schema8.Literal("delegated_agent"),
|
|
576
|
+
Schema8.Literal("agent")
|
|
536
577
|
]),
|
|
537
|
-
authorityActorId:
|
|
538
|
-
authorityRole:
|
|
539
|
-
expiresAt:
|
|
540
|
-
createdAt:
|
|
578
|
+
authorityActorId: Schema8.String.check(Schema8.isMinLength(1)),
|
|
579
|
+
authorityRole: Schema8.Union([Schema8.Literal("owner"), Schema8.Literal("admin")]),
|
|
580
|
+
expiresAt: Schema8.optionalKey(Schema8.String.check(isDateTime)),
|
|
581
|
+
createdAt: Schema8.String.check(isDateTime)
|
|
541
582
|
});
|
|
542
583
|
class DurableSurfaceScanError extends Data.TaggedError("DurableSurfaceScanError") {
|
|
543
584
|
constructor(findings) {
|
|
@@ -585,144 +626,190 @@ var LOCAL_PATH_KEYS = new Set([
|
|
|
585
626
|
"docker_socket",
|
|
586
627
|
"ssh_agent_socket"
|
|
587
628
|
]);
|
|
629
|
+
var wrappedValue = String.raw`<[A-Za-z][A-Za-z0-9 _.-]*>|\$\{[^{}\s]*\}|\{\{[^{}]*\}\}|proxy-ep=[A-Za-z0-9.-]+;kitmanref(?:[0-9a-f]{2})+(?![A-Za-z0-9._~+/-])`;
|
|
630
|
+
var secretReferenceTail = String.raw`(?<=secret:)\/\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+(?![^\s,;}"')\]\x60])`;
|
|
631
|
+
var bearerValue = /[0-9]|[._~+/:-][A-Za-z0-9]|[<{]/u;
|
|
588
632
|
var VALUE_RULES = [
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
"
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
"credential",
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
633
|
+
{ classification: "secret", name: "private-key", pattern: /-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----/u },
|
|
634
|
+
{
|
|
635
|
+
classification: "credential",
|
|
636
|
+
name: "bearer-token",
|
|
637
|
+
pattern: new RegExp(`\\bBearer\\s+(?<value>(?:${wrappedValue}|[A-Za-z0-9._~+/*:=-])+(?<![.,:]))`, "iu"),
|
|
638
|
+
holds: (value) => !isPlaceholder(value) && bearerValue.test(value)
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
classification: "credential",
|
|
642
|
+
name: "provider-token",
|
|
643
|
+
pattern: /(?:^|[^A-Za-z0-9])(?<value><?(?:ghp_|github_pat_|glpat-|ksa1\.|sk-[A-Za-z0-9_-]{8,}|xox[baprs]-)[A-Za-z0-9._*-]*[A-Za-z0-9_*-]>?)/u,
|
|
644
|
+
holds: (value) => !isPlaceholder(value)
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
classification: "credential",
|
|
648
|
+
name: "credential-assignment",
|
|
649
|
+
pattern: new RegExp(`(?:api[_ -]?key|secret|token|password)\\s*[:=]\\s*(?!env\\b|file\\b|exec\\b|${secretReferenceTail})(?<value>(?:${wrappedValue}|[^\\s,;{}])+)`, "iu"),
|
|
650
|
+
holds: looksLikeCredential
|
|
651
|
+
},
|
|
652
|
+
{ classification: "pii", name: "email", pattern: /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/iu },
|
|
653
|
+
{ classification: "pii", name: "ssn", pattern: /\b\d{3}-\d{2}-\d{4}\b/u },
|
|
654
|
+
{
|
|
655
|
+
classification: "pii",
|
|
656
|
+
name: "phone",
|
|
657
|
+
pattern: /(?:\+\d[\d ()-]{8,}\d|\(\d{3}\)[\d -]{7,}\d|\b\d{3}[ -]\d{3}[ -]\d{4}\b)/u
|
|
658
|
+
},
|
|
659
|
+
{ classification: "pii", name: "payment-number", pattern: /\b(?:\d[ -]*?){13,19}\b/u },
|
|
660
|
+
{ classification: "url", name: "url-content", pattern: /\b(?:https?|ftp):\/\/[^\s]+/iu },
|
|
661
|
+
{ classification: "diff", name: "diff-content", pattern: /(^|\n)diff --git\s/u },
|
|
662
|
+
{
|
|
663
|
+
classification: "source",
|
|
664
|
+
name: "source-content",
|
|
665
|
+
pattern: /(^|\n)\s*(?:import|export|const|let|var|function|class)\s+[A-Za-z_$]/u
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
classification: "log",
|
|
669
|
+
name: "structured-log",
|
|
670
|
+
pattern: /(?:^|\n)\s*\d{4}-\d{2}-\d{2}T\S+\s+(?:ERROR|WARN|INFO|DEBUG)\b/u
|
|
671
|
+
},
|
|
672
|
+
{ classification: "transcript", name: "transcript-content", pattern: /(?:^|\n)\s*(?:user|assistant|system)\s*:/iu }
|
|
610
673
|
];
|
|
611
|
-
var
|
|
674
|
+
var maskedToken = /^(?:ghp_|github_pat_|glpat-|ksa1\.|xox[baprs]-|sk-(?:ant-(?:[a-z]+[0-9]*-)?|proj-|or-v[0-9]+-)?)(?:x{4,}|X{4,}|\*{4,})$/u;
|
|
675
|
+
var placeholderWord = "(?:[A-Z]?[a-z]+|[A-Z]+)";
|
|
676
|
+
var placeholders = [
|
|
677
|
+
maskedToken,
|
|
678
|
+
new RegExp(`^<${placeholderWord}[0-9]{0,2}(?:[ _.-]${placeholderWord}[0-9]{0,2})*>$`, "u"),
|
|
679
|
+
/^\$\{[A-Za-z_][A-Za-z0-9_]*\}$/u,
|
|
680
|
+
/^\$[A-Za-z_][A-Za-z0-9_]*$/u,
|
|
681
|
+
/^\{\{\s*[A-Za-z_][A-Za-z0-9_.]*\s*\}\}$/u,
|
|
682
|
+
/^%[A-Za-z_][A-Za-z0-9_]*%$/u,
|
|
683
|
+
/^\[REDACTED(?::[a-z_]+)?\]$/u,
|
|
684
|
+
/^[A-Z][A-Z0-9]*(?:_[A-Z][A-Z0-9]*)+$/u,
|
|
685
|
+
/^([xX*\u2022#.-])\1{2,}$/u,
|
|
686
|
+
/^runner-secret:[A-Z0-9_]+:(?:env|file|exec)$/u
|
|
687
|
+
];
|
|
688
|
+
var isPlaceholder = (value) => placeholders.some((pattern) => pattern.test(value)) || isSecretReference(value);
|
|
689
|
+
var unwrapped = (value) => value.replace(/^["'`(]+/u, "").replace(/["'`).]+$/u, "");
|
|
690
|
+
function looksLikeCredential(raw, matched) {
|
|
691
|
+
const value = unwrapped(raw);
|
|
692
|
+
if (isPlaceholder(raw) || isPlaceholder(value))
|
|
693
|
+
return false;
|
|
694
|
+
return /^[^\s:=]+=\S/u.test(matched) || value.length >= 6 && /[0-9]/u.test(value) || value.length >= 20 && /[a-z]/u.test(value) && /[A-Z]/u.test(value);
|
|
695
|
+
}
|
|
696
|
+
var globalPatterns = new WeakMap;
|
|
697
|
+
var credentialUrlRule = {
|
|
698
|
+
classification: "url",
|
|
699
|
+
name: "credential-url",
|
|
700
|
+
pattern: /\b(?:https?|ftp):\/\/(?:[^\s/?#]*@|[^\s?#]*\?)[^\s]*/iu
|
|
701
|
+
};
|
|
612
702
|
var keptClassifications = new Set(["secret", "credential", "unknown"]);
|
|
613
703
|
var normalizedKeys = new Map;
|
|
614
|
-
var CREDENTIAL_RULES = VALUE_RULES.
|
|
615
|
-
var RESPONSE_RULES = [
|
|
616
|
-
...CREDENTIAL_RULES,
|
|
617
|
-
["url", new RegExp(credentialUrl.source, "giu")]
|
|
618
|
-
];
|
|
704
|
+
var CREDENTIAL_RULES = VALUE_RULES.filter((rule) => rule.classification === "secret" || rule.classification === "credential");
|
|
705
|
+
var RESPONSE_RULES = [...CREDENTIAL_RULES, credentialUrlRule];
|
|
619
706
|
|
|
620
707
|
// packages/core/src/run.ts
|
|
621
|
-
var RunContractVersion =
|
|
622
|
-
var ImmutableExecutionClosureContractVersion =
|
|
623
|
-
var Sha256 =
|
|
624
|
-
var BoundedText =
|
|
625
|
-
var SafeKey =
|
|
626
|
-
var SafeJson =
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
708
|
+
var RunContractVersion = Schema9.Literal("run.v1");
|
|
709
|
+
var ImmutableExecutionClosureContractVersion = Schema9.Literal("immutable-execution-closure.v1");
|
|
710
|
+
var Sha256 = Schema9.String.check(Schema9.isPattern(new RegExp("^[a-f0-9]{64}$", "u")));
|
|
711
|
+
var BoundedText = Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(4000));
|
|
712
|
+
var SafeKey = Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(120), Schema9.isPattern(new RegExp("^[A-Za-z][A-Za-z0-9_-]*$", "u")));
|
|
713
|
+
var SafeJson = Schema9.Union([
|
|
714
|
+
Schema9.Null,
|
|
715
|
+
Schema9.Boolean,
|
|
716
|
+
Schema9.Finite.check(Schema9.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER), Schema9.isGreaterThanOrEqualTo(Number.MIN_SAFE_INTEGER)),
|
|
630
717
|
BoundedText,
|
|
631
|
-
|
|
632
|
-
|
|
718
|
+
Schema9.Array(Schema9.suspend(() => SafeJson)).check(Schema9.isMaxLength(200)),
|
|
719
|
+
Schema9.Record(SafeKey, Schema9.suspend(() => SafeJson)).check(Schema9.isMaxProperties(200))
|
|
633
720
|
]).annotate({ identifier: "RunSafeJson" });
|
|
634
|
-
var RunActorRef =
|
|
635
|
-
actorType:
|
|
721
|
+
var RunActorRef = Schema9.Struct({
|
|
722
|
+
actorType: Schema9.Union([ActorType, Schema9.Literal("runner")]),
|
|
636
723
|
actorId: Id,
|
|
637
|
-
delegatedByUserId:
|
|
638
|
-
agentIdentityId:
|
|
639
|
-
runnerId:
|
|
724
|
+
delegatedByUserId: Schema9.optionalKey(Id),
|
|
725
|
+
agentIdentityId: Schema9.optionalKey(Id),
|
|
726
|
+
runnerId: Schema9.optionalKey(Id)
|
|
640
727
|
});
|
|
641
|
-
var RunResourceRef =
|
|
642
|
-
kind:
|
|
728
|
+
var RunResourceRef = Schema9.Struct({
|
|
729
|
+
kind: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(80)),
|
|
643
730
|
id: Id
|
|
644
731
|
});
|
|
645
|
-
var RunSchemaRef =
|
|
646
|
-
kind:
|
|
647
|
-
name:
|
|
648
|
-
version:
|
|
732
|
+
var RunSchemaRef = Schema9.Struct({
|
|
733
|
+
kind: Schema9.Literal("typebox_ref"),
|
|
734
|
+
name: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(160)),
|
|
735
|
+
version: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(40)),
|
|
649
736
|
sha256: Sha256
|
|
650
737
|
});
|
|
651
|
-
var AgentPinnedKitRef =
|
|
738
|
+
var AgentPinnedKitRef = Schema9.Struct({
|
|
652
739
|
kitId: Id,
|
|
653
|
-
version:
|
|
740
|
+
version: Schema9.Int.check(Schema9.isGreaterThanOrEqualTo(1)),
|
|
654
741
|
sha256: Sha256,
|
|
655
|
-
precedence:
|
|
656
|
-
required:
|
|
657
|
-
});
|
|
658
|
-
var AgentSkillRef =
|
|
659
|
-
sourceId:
|
|
660
|
-
name:
|
|
661
|
-
version:
|
|
662
|
-
sha256:
|
|
663
|
-
required:
|
|
664
|
-
});
|
|
665
|
-
var AgentReference =
|
|
666
|
-
|
|
667
|
-
|
|
742
|
+
precedence: Schema9.Int.check(Schema9.isGreaterThanOrEqualTo(0)),
|
|
743
|
+
required: Schema9.Boolean
|
|
744
|
+
});
|
|
745
|
+
var AgentSkillRef = Schema9.Struct({
|
|
746
|
+
sourceId: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(240)),
|
|
747
|
+
name: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(160)),
|
|
748
|
+
version: Schema9.optionalKey(Schema9.String.check(Schema9.isMaxLength(80))),
|
|
749
|
+
sha256: Schema9.optionalKey(Sha256),
|
|
750
|
+
required: Schema9.Boolean
|
|
751
|
+
});
|
|
752
|
+
var AgentReference = Schema9.Union([
|
|
753
|
+
Schema9.Struct({ agentId: Id, alias: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(80)) }),
|
|
754
|
+
Schema9.Struct({ agentId: Id, version: Schema9.Int.check(Schema9.isGreaterThanOrEqualTo(1)), digest: Sha256 })
|
|
668
755
|
]);
|
|
669
|
-
var AgentToolGrant =
|
|
670
|
-
ref:
|
|
671
|
-
inputSchema:
|
|
672
|
-
scope:
|
|
673
|
-
approval:
|
|
674
|
-
delegable:
|
|
675
|
-
});
|
|
676
|
-
var AgentHarnessSelector =
|
|
677
|
-
mode:
|
|
678
|
-
harness:
|
|
679
|
-
adapterRef:
|
|
680
|
-
requiredCapabilities:
|
|
681
|
-
allowedFallbacks:
|
|
682
|
-
});
|
|
683
|
-
var AgentModelSelector =
|
|
684
|
-
providerRef:
|
|
685
|
-
modelRef:
|
|
686
|
-
profile:
|
|
687
|
-
reasoning:
|
|
688
|
-
});
|
|
689
|
-
var AgentPolicy =
|
|
690
|
-
requestedCapabilities:
|
|
691
|
-
maxChildDepth:
|
|
692
|
-
allowSubdelegation:
|
|
693
|
-
maxWallSeconds:
|
|
694
|
-
maxInputTokens:
|
|
695
|
-
maxOutputTokens:
|
|
696
|
-
hardLimit:
|
|
697
|
-
});
|
|
698
|
-
var AgentProvenance =
|
|
699
|
-
source:
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
756
|
+
var AgentToolGrant = Schema9.Struct({
|
|
757
|
+
ref: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(240)),
|
|
758
|
+
inputSchema: Schema9.optionalKey(RunSchemaRef),
|
|
759
|
+
scope: Schema9.optionalKey(RunResourceRef),
|
|
760
|
+
approval: Schema9.Union([Schema9.Literal("none"), Schema9.Literal("human_each_call"), Schema9.Literal("human_once")]),
|
|
761
|
+
delegable: Schema9.Boolean
|
|
762
|
+
});
|
|
763
|
+
var AgentHarnessSelector = Schema9.Struct({
|
|
764
|
+
mode: Schema9.Union([Schema9.Literal("direct_model"), Schema9.Literal("harness_v1"), Schema9.Literal("native")]),
|
|
765
|
+
harness: Schema9.optionalKey(Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(80))),
|
|
766
|
+
adapterRef: Schema9.optionalKey(Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(240))),
|
|
767
|
+
requiredCapabilities: Schema9.Array(Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(80))).check(Schema9.isMaxLength(40)),
|
|
768
|
+
allowedFallbacks: Schema9.Array(Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(160))).check(Schema9.isMaxLength(20))
|
|
769
|
+
});
|
|
770
|
+
var AgentModelSelector = Schema9.Struct({
|
|
771
|
+
providerRef: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(160)),
|
|
772
|
+
modelRef: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(160)),
|
|
773
|
+
profile: Schema9.optionalKey(Schema9.String.check(Schema9.isMaxLength(80))),
|
|
774
|
+
reasoning: Schema9.optionalKey(Schema9.String.check(Schema9.isMaxLength(80)))
|
|
775
|
+
});
|
|
776
|
+
var AgentPolicy = Schema9.Struct({
|
|
777
|
+
requestedCapabilities: Schema9.Array(Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(120))).check(Schema9.isMaxLength(100)),
|
|
778
|
+
maxChildDepth: Schema9.Int.check(Schema9.isGreaterThanOrEqualTo(0), Schema9.isLessThanOrEqualTo(32)),
|
|
779
|
+
allowSubdelegation: Schema9.Boolean,
|
|
780
|
+
maxWallSeconds: Schema9.optionalKey(Schema9.Int.check(Schema9.isGreaterThanOrEqualTo(1), Schema9.isLessThanOrEqualTo(31536000))),
|
|
781
|
+
maxInputTokens: Schema9.optionalKey(Schema9.Int.check(Schema9.isGreaterThanOrEqualTo(0), Schema9.isLessThanOrEqualTo(1e8))),
|
|
782
|
+
maxOutputTokens: Schema9.optionalKey(Schema9.Int.check(Schema9.isGreaterThanOrEqualTo(0), Schema9.isLessThanOrEqualTo(1e8))),
|
|
783
|
+
hardLimit: Schema9.Boolean
|
|
784
|
+
});
|
|
785
|
+
var AgentProvenance = Schema9.Struct({
|
|
786
|
+
source: Schema9.Union([
|
|
787
|
+
Schema9.Literal("kitman"),
|
|
788
|
+
Schema9.Literal("workspace"),
|
|
789
|
+
Schema9.Literal("team"),
|
|
790
|
+
Schema9.Literal("git"),
|
|
791
|
+
Schema9.Literal("package"),
|
|
792
|
+
Schema9.Literal("import")
|
|
706
793
|
]),
|
|
707
|
-
sourceRef:
|
|
708
|
-
sourceCommitSha:
|
|
794
|
+
sourceRef: Schema9.optionalKey(Schema9.String.check(Schema9.isMaxLength(240))),
|
|
795
|
+
sourceCommitSha: Schema9.optionalKey(Schema9.String.check(Schema9.isMaxLength(128))),
|
|
709
796
|
contentSha256: Sha256,
|
|
710
|
-
reviewedBy:
|
|
797
|
+
reviewedBy: Schema9.optionalKey(Schema9.Array(RunActorRef).check(Schema9.isMaxLength(20)))
|
|
711
798
|
});
|
|
712
|
-
var Agent =
|
|
799
|
+
var Agent = Schema9.Struct({
|
|
713
800
|
contractVersion: RunContractVersion,
|
|
714
801
|
id: Id,
|
|
715
802
|
workspaceId: Id,
|
|
716
|
-
teamId:
|
|
717
|
-
name:
|
|
718
|
-
slug:
|
|
719
|
-
currentVersion:
|
|
720
|
-
status:
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
803
|
+
teamId: Schema9.optionalKey(Id),
|
|
804
|
+
name: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(160)),
|
|
805
|
+
slug: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(160), Schema9.isPattern(new RegExp("^[a-z0-9]+(?:-[a-z0-9]+)*$", "u"))),
|
|
806
|
+
currentVersion: Schema9.optionalKey(Schema9.Int.check(Schema9.isGreaterThanOrEqualTo(1))),
|
|
807
|
+
status: Schema9.Union([
|
|
808
|
+
Schema9.Literal("draft"),
|
|
809
|
+
Schema9.Literal("published"),
|
|
810
|
+
Schema9.Literal("deprecated"),
|
|
811
|
+
Schema9.Literal("disabled"),
|
|
812
|
+
Schema9.Literal("archived")
|
|
726
813
|
]),
|
|
727
814
|
createdBy: RunActorRef,
|
|
728
815
|
createdAt: Timestamp,
|
|
@@ -740,78 +827,78 @@ var RunMessageTypes = [
|
|
|
740
827
|
"instruction",
|
|
741
828
|
"notice"
|
|
742
829
|
];
|
|
743
|
-
var RunMessageType =
|
|
744
|
-
var MessageEvidenceRefs =
|
|
745
|
-
var MessageProgressPayload =
|
|
746
|
-
type:
|
|
830
|
+
var RunMessageType = Schema9.Literals(RunMessageTypes);
|
|
831
|
+
var MessageEvidenceRefs = Schema9.Array(RunResourceRef).check(Schema9.isMaxLength(100));
|
|
832
|
+
var MessageProgressPayload = Schema9.Struct({
|
|
833
|
+
type: Schema9.Literal("progress"),
|
|
747
834
|
summary: BoundedText,
|
|
748
|
-
phase:
|
|
749
|
-
percent:
|
|
750
|
-
evidenceRefs:
|
|
835
|
+
phase: Schema9.optionalKey(Schema9.String.check(Schema9.isMaxLength(120))),
|
|
836
|
+
percent: Schema9.optionalKey(Schema9.Finite.check(Schema9.isGreaterThanOrEqualTo(0), Schema9.isLessThanOrEqualTo(100))),
|
|
837
|
+
evidenceRefs: Schema9.optionalKey(MessageEvidenceRefs)
|
|
751
838
|
});
|
|
752
|
-
var MessageQuestionPayload =
|
|
753
|
-
type:
|
|
754
|
-
questionId:
|
|
839
|
+
var MessageQuestionPayload = Schema9.Struct({
|
|
840
|
+
type: Schema9.Literal("question"),
|
|
841
|
+
questionId: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(160)),
|
|
755
842
|
prompt: BoundedText,
|
|
756
843
|
answerSchema: RunSchemaRef,
|
|
757
|
-
urgency:
|
|
844
|
+
urgency: Schema9.Union([Schema9.Literal("normal"), Schema9.Literal("blocking")]),
|
|
758
845
|
waitId: Id
|
|
759
846
|
});
|
|
760
|
-
var MessageAnswerPayload =
|
|
761
|
-
type:
|
|
762
|
-
questionId:
|
|
847
|
+
var MessageAnswerPayload = Schema9.Struct({
|
|
848
|
+
type: Schema9.Literal("answer"),
|
|
849
|
+
questionId: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(160)),
|
|
763
850
|
answer: SafeJson,
|
|
764
851
|
answerSchema: RunSchemaRef,
|
|
765
852
|
waitId: Id
|
|
766
853
|
});
|
|
767
|
-
var MessageContextRequestPayload =
|
|
768
|
-
type:
|
|
769
|
-
requestId:
|
|
770
|
-
refs:
|
|
854
|
+
var MessageContextRequestPayload = Schema9.Struct({
|
|
855
|
+
type: Schema9.Literal("context_request"),
|
|
856
|
+
requestId: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(160)),
|
|
857
|
+
refs: Schema9.Array(RunResourceRef).check(Schema9.isMaxLength(100)),
|
|
771
858
|
reason: BoundedText
|
|
772
859
|
});
|
|
773
|
-
var MessageContextResponsePayload =
|
|
774
|
-
type:
|
|
775
|
-
requestId:
|
|
776
|
-
refs:
|
|
777
|
-
summaries:
|
|
778
|
-
});
|
|
779
|
-
var MessageFindingPayload =
|
|
780
|
-
type:
|
|
781
|
-
severity:
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
860
|
+
var MessageContextResponsePayload = Schema9.Struct({
|
|
861
|
+
type: Schema9.Literal("context_response"),
|
|
862
|
+
requestId: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(160)),
|
|
863
|
+
refs: Schema9.Array(RunResourceRef).check(Schema9.isMaxLength(100)),
|
|
864
|
+
summaries: Schema9.Array(SafeJson).check(Schema9.isMaxLength(100))
|
|
865
|
+
});
|
|
866
|
+
var MessageFindingPayload = Schema9.Struct({
|
|
867
|
+
type: Schema9.Literal("finding"),
|
|
868
|
+
severity: Schema9.Union([
|
|
869
|
+
Schema9.Literal("info"),
|
|
870
|
+
Schema9.Literal("low"),
|
|
871
|
+
Schema9.Literal("medium"),
|
|
872
|
+
Schema9.Literal("high"),
|
|
873
|
+
Schema9.Literal("critical")
|
|
787
874
|
]),
|
|
788
|
-
category:
|
|
875
|
+
category: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(120)),
|
|
789
876
|
summary: BoundedText,
|
|
790
877
|
evidenceRefs: MessageEvidenceRefs
|
|
791
878
|
});
|
|
792
|
-
var MessagePartialResultPayload =
|
|
793
|
-
type:
|
|
879
|
+
var MessagePartialResultPayload = Schema9.Struct({
|
|
880
|
+
type: Schema9.Literal("partial_result"),
|
|
794
881
|
outputSchema: RunSchemaRef,
|
|
795
882
|
data: SafeJson,
|
|
796
|
-
complete:
|
|
883
|
+
complete: Schema9.Literal(false)
|
|
797
884
|
});
|
|
798
|
-
var MessageHandoffPayload =
|
|
799
|
-
type:
|
|
885
|
+
var MessageHandoffPayload = Schema9.Struct({
|
|
886
|
+
type: Schema9.Literal("handoff"),
|
|
800
887
|
summary: BoundedText,
|
|
801
|
-
nextAction:
|
|
802
|
-
evidenceRefs:
|
|
888
|
+
nextAction: Schema9.optionalKey(Schema9.String.check(Schema9.isMaxLength(4000))),
|
|
889
|
+
evidenceRefs: Schema9.optionalKey(MessageEvidenceRefs)
|
|
803
890
|
});
|
|
804
|
-
var MessageInstructionPayload =
|
|
805
|
-
type:
|
|
891
|
+
var MessageInstructionPayload = Schema9.Struct({
|
|
892
|
+
type: Schema9.Literal("instruction"),
|
|
806
893
|
instruction: BoundedText,
|
|
807
|
-
authority:
|
|
894
|
+
authority: Schema9.Union([Schema9.Literal("normal"), Schema9.Literal("operator")])
|
|
808
895
|
});
|
|
809
|
-
var MessageNoticePayload =
|
|
810
|
-
type:
|
|
811
|
-
code:
|
|
896
|
+
var MessageNoticePayload = Schema9.Struct({
|
|
897
|
+
type: Schema9.Literal("notice"),
|
|
898
|
+
code: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(120)),
|
|
812
899
|
summary: BoundedText
|
|
813
900
|
});
|
|
814
|
-
var RunMessagePayload =
|
|
901
|
+
var RunMessagePayload = Schema9.Union([
|
|
815
902
|
MessageProgressPayload,
|
|
816
903
|
MessageQuestionPayload,
|
|
817
904
|
MessageAnswerPayload,
|
|
@@ -823,94 +910,94 @@ var RunMessagePayload = Schema8.Union([
|
|
|
823
910
|
MessageInstructionPayload,
|
|
824
911
|
MessageNoticePayload
|
|
825
912
|
]);
|
|
826
|
-
var RunMessage =
|
|
913
|
+
var RunMessage = Schema9.Struct({
|
|
827
914
|
contractVersion: RunContractVersion,
|
|
828
915
|
id: Id,
|
|
829
916
|
workspaceId: Id,
|
|
830
|
-
teamId:
|
|
917
|
+
teamId: Schema9.optionalKey(Id),
|
|
831
918
|
rootRunId: Id,
|
|
832
|
-
sender:
|
|
833
|
-
|
|
919
|
+
sender: Schema9.Union([
|
|
920
|
+
Schema9.Struct({ kind: Schema9.Union([Schema9.Literal("run"), Schema9.Literal("step_attempt")]), id: Id }),
|
|
834
921
|
RunActorRef
|
|
835
922
|
]),
|
|
836
|
-
recipient:
|
|
923
|
+
recipient: Schema9.Struct({ kind: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(80)), id: Id }),
|
|
837
924
|
type: RunMessageType,
|
|
838
|
-
streamKey:
|
|
839
|
-
sequence:
|
|
840
|
-
correlationId:
|
|
841
|
-
causationId:
|
|
842
|
-
replyToMessageId:
|
|
843
|
-
payloadSchema:
|
|
925
|
+
streamKey: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(240)),
|
|
926
|
+
sequence: Schema9.Int.check(Schema9.isGreaterThanOrEqualTo(1)),
|
|
927
|
+
correlationId: Schema9.optionalKey(Id),
|
|
928
|
+
causationId: Schema9.optionalKey(Id),
|
|
929
|
+
replyToMessageId: Schema9.optionalKey(Id),
|
|
930
|
+
payloadSchema: Schema9.optionalKey(RunSchemaRef),
|
|
844
931
|
payload: RunMessagePayload,
|
|
845
|
-
delivery:
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
932
|
+
delivery: Schema9.Union([
|
|
933
|
+
Schema9.Literal("created"),
|
|
934
|
+
Schema9.Literal("queued"),
|
|
935
|
+
Schema9.Literal("delivered"),
|
|
936
|
+
Schema9.Literal("acknowledged"),
|
|
937
|
+
Schema9.Literal("expired"),
|
|
938
|
+
Schema9.Literal("failed")
|
|
852
939
|
]),
|
|
853
|
-
idempotencyKey:
|
|
854
|
-
expiresAt:
|
|
940
|
+
idempotencyKey: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(240)),
|
|
941
|
+
expiresAt: Schema9.optionalKey(Timestamp),
|
|
855
942
|
createdAt: Timestamp,
|
|
856
|
-
acknowledgedAt:
|
|
943
|
+
acknowledgedAt: Schema9.optionalKey(Timestamp)
|
|
857
944
|
});
|
|
858
|
-
var RunResult =
|
|
945
|
+
var RunResult = Schema9.Struct({
|
|
859
946
|
contractVersion: RunContractVersion,
|
|
860
947
|
id: Id,
|
|
861
948
|
workspaceId: Id,
|
|
862
|
-
teamId:
|
|
949
|
+
teamId: Schema9.optionalKey(Id),
|
|
863
950
|
runId: Id,
|
|
864
951
|
rootRunId: Id,
|
|
865
|
-
attempt:
|
|
866
|
-
outcome:
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
952
|
+
attempt: Schema9.Int.check(Schema9.isGreaterThanOrEqualTo(1)),
|
|
953
|
+
outcome: Schema9.Union([
|
|
954
|
+
Schema9.Literal("succeeded"),
|
|
955
|
+
Schema9.Literal("failed"),
|
|
956
|
+
Schema9.Literal("canceled"),
|
|
957
|
+
Schema9.Literal("blocked"),
|
|
958
|
+
Schema9.Literal("expired")
|
|
872
959
|
]),
|
|
873
|
-
output:
|
|
874
|
-
failure:
|
|
875
|
-
code:
|
|
876
|
-
category:
|
|
960
|
+
output: Schema9.optionalKey(Schema9.Struct({ schema: RunSchemaRef, data: SafeJson, digest: Sha256 })),
|
|
961
|
+
failure: Schema9.optionalKey(Schema9.Struct({
|
|
962
|
+
code: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(120)),
|
|
963
|
+
category: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(80)),
|
|
877
964
|
summary: BoundedText,
|
|
878
|
-
retryable:
|
|
879
|
-
details:
|
|
965
|
+
retryable: Schema9.Boolean,
|
|
966
|
+
details: Schema9.optionalKey(SafeJson)
|
|
880
967
|
})),
|
|
881
|
-
evidenceRefs:
|
|
882
|
-
childSummary:
|
|
883
|
-
awaited:
|
|
884
|
-
detached:
|
|
885
|
-
succeeded:
|
|
886
|
-
failed:
|
|
887
|
-
canceled:
|
|
968
|
+
evidenceRefs: Schema9.Array(Schema9.Union([RunResourceRef, EvidenceRef])).check(Schema9.isMaxLength(100)),
|
|
969
|
+
childSummary: Schema9.Struct({
|
|
970
|
+
awaited: Schema9.Int.check(Schema9.isGreaterThanOrEqualTo(0)),
|
|
971
|
+
detached: Schema9.Int.check(Schema9.isGreaterThanOrEqualTo(0)),
|
|
972
|
+
succeeded: Schema9.Int.check(Schema9.isGreaterThanOrEqualTo(0)),
|
|
973
|
+
failed: Schema9.Int.check(Schema9.isGreaterThanOrEqualTo(0)),
|
|
974
|
+
canceled: Schema9.Int.check(Schema9.isGreaterThanOrEqualTo(0))
|
|
888
975
|
}),
|
|
889
|
-
usage:
|
|
890
|
-
producedBy:
|
|
891
|
-
workUnitId:
|
|
892
|
-
leaseId:
|
|
893
|
-
fencingTokenDigest:
|
|
976
|
+
usage: Schema9.optionalKey(Schema9.Record(SafeKey, SafeJson).check(Schema9.isMaxProperties(20))),
|
|
977
|
+
producedBy: Schema9.Struct({
|
|
978
|
+
workUnitId: Schema9.optionalKey(Id),
|
|
979
|
+
leaseId: Schema9.optionalKey(Id),
|
|
980
|
+
fencingTokenDigest: Schema9.optionalKey(Sha256)
|
|
894
981
|
}),
|
|
895
982
|
createdAt: Timestamp,
|
|
896
983
|
finalizedAt: Timestamp
|
|
897
984
|
});
|
|
898
|
-
var RunEvent =
|
|
985
|
+
var RunEvent = Schema9.Struct({
|
|
899
986
|
contractVersion: RunContractVersion,
|
|
900
987
|
id: Id,
|
|
901
|
-
eventVersion:
|
|
988
|
+
eventVersion: Schema9.Literal(1),
|
|
902
989
|
streamId: Id,
|
|
903
|
-
sequence:
|
|
990
|
+
sequence: Schema9.Int.check(Schema9.isGreaterThanOrEqualTo(1)),
|
|
904
991
|
workspaceId: Id,
|
|
905
|
-
teamId:
|
|
992
|
+
teamId: Schema9.optionalKey(Id),
|
|
906
993
|
subject: RunResourceRef,
|
|
907
994
|
rootRunId: Id,
|
|
908
|
-
type:
|
|
909
|
-
actor:
|
|
910
|
-
correlationId:
|
|
911
|
-
causationId:
|
|
995
|
+
type: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(100)),
|
|
996
|
+
actor: Schema9.optionalKey(RunActorRef),
|
|
997
|
+
correlationId: Schema9.optionalKey(Id),
|
|
998
|
+
causationId: Schema9.optionalKey(Id),
|
|
912
999
|
occurredAt: Timestamp,
|
|
913
|
-
data:
|
|
1000
|
+
data: Schema9.Struct({ type: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(100)), value: SafeJson })
|
|
914
1001
|
});
|
|
915
1002
|
var WaitKinds = [
|
|
916
1003
|
"timer",
|
|
@@ -922,44 +1009,44 @@ var WaitKinds = [
|
|
|
922
1009
|
"provider_quota",
|
|
923
1010
|
"resource"
|
|
924
1011
|
];
|
|
925
|
-
var WaitKind =
|
|
926
|
-
var Wait =
|
|
1012
|
+
var WaitKind = Schema9.Literals(WaitKinds);
|
|
1013
|
+
var Wait = Schema9.Struct({
|
|
927
1014
|
contractVersion: RunContractVersion,
|
|
928
1015
|
id: Id,
|
|
929
1016
|
workspaceId: Id,
|
|
930
|
-
teamId:
|
|
1017
|
+
teamId: Schema9.optionalKey(Id),
|
|
931
1018
|
runId: Id,
|
|
932
1019
|
rootRunId: Id,
|
|
933
|
-
stepKey:
|
|
1020
|
+
stepKey: Schema9.optionalKey(Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(160))),
|
|
934
1021
|
kind: WaitKind,
|
|
935
|
-
state:
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
1022
|
+
state: Schema9.Union([
|
|
1023
|
+
Schema9.Literal("open"),
|
|
1024
|
+
Schema9.Literal("resolved"),
|
|
1025
|
+
Schema9.Literal("expired"),
|
|
1026
|
+
Schema9.Literal("canceled")
|
|
940
1027
|
]),
|
|
941
|
-
correlation:
|
|
942
|
-
expectedSchema:
|
|
943
|
-
timeout:
|
|
944
|
-
dueAt:
|
|
945
|
-
onTimeout:
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
1028
|
+
correlation: Schema9.Record(SafeKey, SafeJson).check(Schema9.isMaxProperties(20)),
|
|
1029
|
+
expectedSchema: Schema9.optionalKey(RunSchemaRef),
|
|
1030
|
+
timeout: Schema9.Struct({
|
|
1031
|
+
dueAt: Schema9.optionalKey(Timestamp),
|
|
1032
|
+
onTimeout: Schema9.Union([
|
|
1033
|
+
Schema9.Literal("fail"),
|
|
1034
|
+
Schema9.Literal("block"),
|
|
1035
|
+
Schema9.Literal("cancel"),
|
|
1036
|
+
Schema9.Literal("default"),
|
|
1037
|
+
Schema9.Literal("escalate")
|
|
951
1038
|
]),
|
|
952
|
-
defaultValue:
|
|
1039
|
+
defaultValue: Schema9.optionalKey(SafeJson)
|
|
953
1040
|
}),
|
|
954
|
-
responderScope:
|
|
955
|
-
resolution:
|
|
956
|
-
kind:
|
|
957
|
-
data:
|
|
1041
|
+
responderScope: Schema9.optionalKey(RunResourceRef),
|
|
1042
|
+
resolution: Schema9.optionalKey(Schema9.Struct({
|
|
1043
|
+
kind: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(80)),
|
|
1044
|
+
data: Schema9.optionalKey(SafeJson),
|
|
958
1045
|
digest: Sha256,
|
|
959
|
-
actor:
|
|
1046
|
+
actor: Schema9.optionalKey(RunActorRef)
|
|
960
1047
|
})),
|
|
961
1048
|
createdAt: Timestamp,
|
|
962
|
-
resolvedAt:
|
|
1049
|
+
resolvedAt: Schema9.optionalKey(Timestamp)
|
|
963
1050
|
});
|
|
964
1051
|
var ControlCommandKinds = [
|
|
965
1052
|
"pause",
|
|
@@ -985,74 +1072,74 @@ var ControlCommandKinds = [
|
|
|
985
1072
|
"request_status",
|
|
986
1073
|
"request_handoff"
|
|
987
1074
|
];
|
|
988
|
-
var ControlCommandKind =
|
|
989
|
-
var ControlCommand =
|
|
1075
|
+
var ControlCommandKind = Schema9.Literals(ControlCommandKinds);
|
|
1076
|
+
var ControlCommand = Schema9.Struct({
|
|
990
1077
|
contractVersion: RunContractVersion,
|
|
991
1078
|
id: Id,
|
|
992
1079
|
workspaceId: Id,
|
|
993
|
-
teamId:
|
|
1080
|
+
teamId: Schema9.optionalKey(Id),
|
|
994
1081
|
target: RunResourceRef,
|
|
995
1082
|
kind: ControlCommandKind,
|
|
996
|
-
payload:
|
|
1083
|
+
payload: Schema9.Struct({ kind: ControlCommandKind, data: SafeJson }),
|
|
997
1084
|
requestedBy: RunActorRef,
|
|
998
|
-
idempotencyKey:
|
|
999
|
-
expectedResourceVersion:
|
|
1000
|
-
status:
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1085
|
+
idempotencyKey: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(240)),
|
|
1086
|
+
expectedResourceVersion: Schema9.optionalKey(Schema9.Int.check(Schema9.isGreaterThanOrEqualTo(1))),
|
|
1087
|
+
status: Schema9.Union([
|
|
1088
|
+
Schema9.Literal("accepted"),
|
|
1089
|
+
Schema9.Literal("queued"),
|
|
1090
|
+
Schema9.Literal("applied"),
|
|
1091
|
+
Schema9.Literal("rejected"),
|
|
1092
|
+
Schema9.Literal("expired"),
|
|
1093
|
+
Schema9.Literal("superseded")
|
|
1007
1094
|
]),
|
|
1008
|
-
rejection:
|
|
1095
|
+
rejection: Schema9.optionalKey(Schema9.Struct({ code: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(120)), summary: BoundedText })),
|
|
1009
1096
|
createdAt: Timestamp,
|
|
1010
|
-
appliedAt:
|
|
1011
|
-
});
|
|
1012
|
-
var ControlCommandList =
|
|
1013
|
-
var RunCommandCenterSnapshot =
|
|
1014
|
-
source:
|
|
1015
|
-
collection:
|
|
1016
|
-
scope:
|
|
1017
|
-
kind:
|
|
1097
|
+
appliedAt: Schema9.optionalKey(Timestamp)
|
|
1098
|
+
});
|
|
1099
|
+
var ControlCommandList = Schema9.Struct({ items: Schema9.Array(ControlCommand).check(Schema9.isMaxLength(50)) });
|
|
1100
|
+
var RunCommandCenterSnapshot = Schema9.Struct({
|
|
1101
|
+
source: Schema9.Literal("http_snapshot"),
|
|
1102
|
+
collection: Schema9.Literal("run_command_center"),
|
|
1103
|
+
scope: Schema9.Struct({
|
|
1104
|
+
kind: Schema9.Literal("run"),
|
|
1018
1105
|
workspaceId: Id,
|
|
1019
|
-
teamId:
|
|
1106
|
+
teamId: Schema9.optionalKey(Id),
|
|
1020
1107
|
runId: Id
|
|
1021
1108
|
}),
|
|
1022
1109
|
capturedAt: Timestamp,
|
|
1023
|
-
consistency:
|
|
1024
|
-
lowerBound:
|
|
1025
|
-
isComplete:
|
|
1110
|
+
consistency: Schema9.Literal("lower_bound"),
|
|
1111
|
+
lowerBound: Schema9.String.check(Schema9.isMinLength(1), Schema9.isMaxLength(512)),
|
|
1112
|
+
isComplete: Schema9.Literal(true)
|
|
1026
1113
|
});
|
|
1027
1114
|
|
|
1028
1115
|
// packages/core/src/extension.ts
|
|
1029
1116
|
var NativeExtensionTargets = ["runner_backend", "harness", "sandbox"];
|
|
1030
|
-
var NativeExtensionTarget =
|
|
1117
|
+
var NativeExtensionTarget = Schema10.Literals(NativeExtensionTargets);
|
|
1031
1118
|
var NativeExtensionPolicies = ["optional", "required"];
|
|
1032
|
-
var NativeExtensionPolicy =
|
|
1033
|
-
var NativeExtensionIdentity =
|
|
1034
|
-
var NativeExtensionRef =
|
|
1119
|
+
var NativeExtensionPolicy = Schema10.Literals(NativeExtensionPolicies);
|
|
1120
|
+
var NativeExtensionIdentity = Schema10.String.check(Schema10.isMinLength(3), Schema10.isMaxLength(120), Schema10.isPattern(new RegExp("^[a-z0-9][a-z0-9_-]*(\\.[a-z0-9][a-z0-9_-]*)+$", "u")));
|
|
1121
|
+
var NativeExtensionRef = Schema10.Struct({
|
|
1035
1122
|
extensionId: NativeExtensionIdentity,
|
|
1036
|
-
version:
|
|
1123
|
+
version: Schema10.Int.check(Schema10.isGreaterThanOrEqualTo(1), Schema10.isLessThanOrEqualTo(10)),
|
|
1037
1124
|
policy: NativeExtensionPolicy,
|
|
1038
|
-
requiredCapabilities:
|
|
1039
|
-
configuration:
|
|
1125
|
+
requiredCapabilities: Schema10.optionalKey(Schema10.Array(Schema10.String.check(Schema10.isMinLength(1), Schema10.isMaxLength(120))).check(Schema10.isMaxLength(50))),
|
|
1126
|
+
configuration: Schema10.optionalKey(Schema10.Record(Schema10.String.check(Schema10.isMinLength(1), Schema10.isMaxLength(120)), SafeJson).check(Schema10.isMaxProperties(40)))
|
|
1040
1127
|
});
|
|
1041
|
-
var NativeExtensionDescriptor =
|
|
1128
|
+
var NativeExtensionDescriptor = Schema10.Struct({
|
|
1042
1129
|
extensionId: NativeExtensionIdentity,
|
|
1043
|
-
version:
|
|
1130
|
+
version: Schema10.Int.check(Schema10.isGreaterThanOrEqualTo(1), Schema10.isLessThanOrEqualTo(10)),
|
|
1044
1131
|
target: NativeExtensionTarget,
|
|
1045
|
-
requiredCapabilities:
|
|
1046
|
-
configurationSchema:
|
|
1047
|
-
resultSchema:
|
|
1048
|
-
observability:
|
|
1049
|
-
transcriptPolicy:
|
|
1050
|
-
maxMetadataChars:
|
|
1132
|
+
requiredCapabilities: Schema10.Array(Schema10.String.check(Schema10.isMinLength(1), Schema10.isMaxLength(120))).check(Schema10.isMaxLength(50)),
|
|
1133
|
+
configurationSchema: Schema10.optionalKey(Schema10.Record(Schema10.String.check(Schema10.isMinLength(1), Schema10.isMaxLength(120)), SafeJson).check(Schema10.isMaxProperties(80))),
|
|
1134
|
+
resultSchema: Schema10.optionalKey(Schema10.Record(Schema10.String.check(Schema10.isMinLength(1), Schema10.isMaxLength(120)), SafeJson).check(Schema10.isMaxProperties(80))),
|
|
1135
|
+
observability: Schema10.Struct({
|
|
1136
|
+
transcriptPolicy: Schema10.Literal("metadata_only"),
|
|
1137
|
+
maxMetadataChars: Schema10.optionalKey(Schema10.Int.check(Schema10.isGreaterThanOrEqualTo(1), Schema10.isLessThanOrEqualTo(65536)))
|
|
1051
1138
|
})
|
|
1052
1139
|
});
|
|
1053
1140
|
|
|
1054
1141
|
// packages/core/src/proposal.ts
|
|
1055
|
-
import * as
|
|
1142
|
+
import * as Schema11 from "effect/Schema";
|
|
1056
1143
|
var ProposalStatuses = [
|
|
1057
1144
|
"proposed",
|
|
1058
1145
|
"in_review",
|
|
@@ -1165,105 +1252,105 @@ var ForbiddenProposalNormalizedKeySet = new Set(ForbiddenProposalNormalizedKeys)
|
|
|
1165
1252
|
var ProposalSafePayloadKeyPattern = `^(?!(?:${proposalForbiddenKeyVariants().map(escapeRegExp).join("|")})$).+$`;
|
|
1166
1253
|
var ProposalForbiddenContentPattern = "sk-[A-Za-z0-9_-]{8,}|ghp_[A-Za-z0-9_]+|glpat-[A-Za-z0-9_-]+|\\bBearer\\s+[A-Za-z0-9._~+/=-]+|eyJ[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+|[dD][iI][fF][fF]\\s+--git|[rR][aA][wW]\\s+(?:[tT][eE][rR][mM][iI][nN][aA][lL]\\s+)?[lL][oO][gG]s?|[tT][eE][rR][mM][iI][nN][aA][lL]\\s+[oO][uU][tT][pP][uU][tT]|[rR][aA][wW]\\s+[tT][rR][aA][nN][sS][cC][rR][iI][pP][tT]s?|[sS][oO][uU][rR][cC][eE]\\s+[cC][oO][dD][eE]|[fF][iI][lL][eE]\\s+[cC][oO][nN][tT][eE][nN][tT]";
|
|
1167
1254
|
var ProposalSafeStringPattern = `^(?!.*(?:${ProposalForbiddenContentPattern})).*$`;
|
|
1168
|
-
var ProposalStatus =
|
|
1169
|
-
var ProposalTargetType =
|
|
1170
|
-
var ProposalRiskLevel =
|
|
1171
|
-
var ProposalApprovalPolicyMode =
|
|
1172
|
-
var ProposalPolicyViolationCode =
|
|
1173
|
-
var ProposalPolicyViolationSeverity =
|
|
1174
|
-
var ProposalCheckKind =
|
|
1175
|
-
var ProposalCheckStatus =
|
|
1176
|
-
var ProposalApplicationAction =
|
|
1177
|
-
var ProposalRenderedDiffFormat =
|
|
1178
|
-
var ProposalRenderedDiffSectionRisk =
|
|
1179
|
-
var ProposalRenderedDiffRefKind =
|
|
1180
|
-
var ProposalSafeString =
|
|
1181
|
-
var ProposalSafeMetadataScalar =
|
|
1182
|
-
var ProposalSafeMetadataValue =
|
|
1255
|
+
var ProposalStatus = Schema11.Literals(ProposalStatuses);
|
|
1256
|
+
var ProposalTargetType = Schema11.Literals(ProposalTargetTypes);
|
|
1257
|
+
var ProposalRiskLevel = Schema11.Literals(ProposalRiskLevels);
|
|
1258
|
+
var ProposalApprovalPolicyMode = Schema11.Literals(ProposalApprovalPolicyModes);
|
|
1259
|
+
var ProposalPolicyViolationCode = Schema11.Literals(ProposalPolicyViolationCodes);
|
|
1260
|
+
var ProposalPolicyViolationSeverity = Schema11.Literals(ProposalPolicyViolationSeverities);
|
|
1261
|
+
var ProposalCheckKind = Schema11.Literals(ProposalCheckKinds);
|
|
1262
|
+
var ProposalCheckStatus = Schema11.Literals(ProposalCheckStatuses);
|
|
1263
|
+
var ProposalApplicationAction = Schema11.Literals(ProposalApplicationActions);
|
|
1264
|
+
var ProposalRenderedDiffFormat = Schema11.Literals(ProposalRenderedDiffFormats);
|
|
1265
|
+
var ProposalRenderedDiffSectionRisk = Schema11.Literals(ProposalRenderedDiffSectionRisks);
|
|
1266
|
+
var ProposalRenderedDiffRefKind = Schema11.Literals(ProposalRenderedDiffRefKinds);
|
|
1267
|
+
var ProposalSafeString = Schema11.String.check(Schema11.isMaxLength(4000), Schema11.isPattern(new RegExp(ProposalSafeStringPattern, "u")));
|
|
1268
|
+
var ProposalSafeMetadataScalar = Schema11.Union([ProposalSafeString, Schema11.Finite, Schema11.Boolean, Schema11.Null]);
|
|
1269
|
+
var ProposalSafeMetadataValue = Schema11.Union([
|
|
1183
1270
|
ProposalSafeMetadataScalar,
|
|
1184
|
-
|
|
1271
|
+
Schema11.Array(ProposalSafeMetadataScalar).check(Schema11.isMaxLength(100))
|
|
1185
1272
|
]);
|
|
1186
|
-
var ProposalSafeMetadata =
|
|
1187
|
-
var ProposalPayload =
|
|
1188
|
-
memory:
|
|
1189
|
-
kit:
|
|
1190
|
-
kit_source:
|
|
1191
|
-
kit_version:
|
|
1192
|
-
kit_installation:
|
|
1193
|
-
kit_activation:
|
|
1194
|
-
kit_trust_policy:
|
|
1195
|
-
agent_environment_policy:
|
|
1196
|
-
decision:
|
|
1197
|
-
task:
|
|
1198
|
-
team_context:
|
|
1199
|
-
context_relevance:
|
|
1200
|
-
});
|
|
1201
|
-
var ProposalTargetRef =
|
|
1273
|
+
var ProposalSafeMetadata = Schema11.Record(Schema11.String.check(Schema11.isMinLength(1), Schema11.isPattern(new RegExp(ProposalSafePayloadKeyPattern, "u"))), ProposalSafeMetadataValue);
|
|
1274
|
+
var ProposalPayload = Schema11.Struct({
|
|
1275
|
+
memory: Schema11.optionalKey(ProposalSafeMetadata),
|
|
1276
|
+
kit: Schema11.optionalKey(ProposalSafeMetadata),
|
|
1277
|
+
kit_source: Schema11.optionalKey(ProposalSafeMetadata),
|
|
1278
|
+
kit_version: Schema11.optionalKey(ProposalSafeMetadata),
|
|
1279
|
+
kit_installation: Schema11.optionalKey(ProposalSafeMetadata),
|
|
1280
|
+
kit_activation: Schema11.optionalKey(ProposalSafeMetadata),
|
|
1281
|
+
kit_trust_policy: Schema11.optionalKey(ProposalSafeMetadata),
|
|
1282
|
+
agent_environment_policy: Schema11.optionalKey(ProposalSafeMetadata),
|
|
1283
|
+
decision: Schema11.optionalKey(ProposalSafeMetadata),
|
|
1284
|
+
task: Schema11.optionalKey(ProposalSafeMetadata),
|
|
1285
|
+
team_context: Schema11.optionalKey(ProposalSafeMetadata),
|
|
1286
|
+
context_relevance: Schema11.optionalKey(ProposalSafeMetadata)
|
|
1287
|
+
});
|
|
1288
|
+
var ProposalTargetRef = Schema11.Struct({
|
|
1202
1289
|
type: ProposalTargetType,
|
|
1203
|
-
id:
|
|
1204
|
-
scopeType:
|
|
1205
|
-
scopeId:
|
|
1290
|
+
id: Schema11.optionalKey(Id),
|
|
1291
|
+
scopeType: Schema11.optionalKey(Schema11.Union([Schema11.Literal("workspace"), Schema11.Literal("team"), Schema11.Literal("task"), Schema11.Literal("kit")])),
|
|
1292
|
+
scopeId: Schema11.optionalKey(Id)
|
|
1206
1293
|
});
|
|
1207
|
-
var ProposalApprovalPolicy =
|
|
1294
|
+
var ProposalApprovalPolicy = Schema11.Struct({
|
|
1208
1295
|
mode: ProposalApprovalPolicyMode,
|
|
1209
|
-
requireDifferentApprover:
|
|
1210
|
-
autonomousAgentApprovalAllowed:
|
|
1211
|
-
deniedViolationCodes:
|
|
1296
|
+
requireDifferentApprover: Schema11.optionalKey(Schema11.Boolean),
|
|
1297
|
+
autonomousAgentApprovalAllowed: Schema11.Literal(false),
|
|
1298
|
+
deniedViolationCodes: Schema11.Array(ProposalPolicyViolationCode)
|
|
1212
1299
|
});
|
|
1213
|
-
var ProposalPolicyViolation =
|
|
1300
|
+
var ProposalPolicyViolation = Schema11.Struct({
|
|
1214
1301
|
code: ProposalPolicyViolationCode,
|
|
1215
1302
|
severity: ProposalPolicyViolationSeverity,
|
|
1216
1303
|
message: ProposalSafeString,
|
|
1217
|
-
actorId:
|
|
1218
|
-
target:
|
|
1219
|
-
metadata:
|
|
1304
|
+
actorId: Schema11.optionalKey(Id),
|
|
1305
|
+
target: Schema11.optionalKey(ProposalTargetRef),
|
|
1306
|
+
metadata: Schema11.optionalKey(ProposalSafeMetadata)
|
|
1220
1307
|
});
|
|
1221
|
-
var ProposalRenderedDiffRef =
|
|
1308
|
+
var ProposalRenderedDiffRef = Schema11.Struct({
|
|
1222
1309
|
kind: ProposalRenderedDiffRefKind,
|
|
1223
|
-
id:
|
|
1224
|
-
externalId:
|
|
1225
|
-
url:
|
|
1226
|
-
title:
|
|
1227
|
-
});
|
|
1228
|
-
var ProposalRenderedDiffSection =
|
|
1229
|
-
title:
|
|
1230
|
-
beforeSummary:
|
|
1231
|
-
afterSummary:
|
|
1310
|
+
id: Schema11.optionalKey(Id),
|
|
1311
|
+
externalId: Schema11.optionalKey(Schema11.String.check(Schema11.isMinLength(1))),
|
|
1312
|
+
url: Schema11.optionalKey(Schema11.String.check(Schema11.isMinLength(1))),
|
|
1313
|
+
title: Schema11.optionalKey(Schema11.String.check(Schema11.isMinLength(1), Schema11.isMaxLength(240)))
|
|
1314
|
+
});
|
|
1315
|
+
var ProposalRenderedDiffSection = Schema11.Struct({
|
|
1316
|
+
title: Schema11.String.check(Schema11.isMinLength(1), Schema11.isMaxLength(240), Schema11.isPattern(new RegExp(ProposalSafeStringPattern, "u"))),
|
|
1317
|
+
beforeSummary: Schema11.optionalKey(ProposalSafeString),
|
|
1318
|
+
afterSummary: Schema11.optionalKey(ProposalSafeString),
|
|
1232
1319
|
risk: ProposalRenderedDiffSectionRisk
|
|
1233
1320
|
});
|
|
1234
|
-
var ProposalRenderedDiff =
|
|
1321
|
+
var ProposalRenderedDiff = Schema11.Struct({
|
|
1235
1322
|
format: ProposalRenderedDiffFormat,
|
|
1236
|
-
title:
|
|
1323
|
+
title: Schema11.String.check(Schema11.isMinLength(1), Schema11.isMaxLength(240), Schema11.isPattern(new RegExp(ProposalSafeStringPattern, "u"))),
|
|
1237
1324
|
summary: ProposalSafeString,
|
|
1238
|
-
sections:
|
|
1239
|
-
refs:
|
|
1325
|
+
sections: Schema11.Array(ProposalRenderedDiffSection),
|
|
1326
|
+
refs: Schema11.Array(ProposalRenderedDiffRef)
|
|
1240
1327
|
});
|
|
1241
|
-
var ProposalRiskSummary =
|
|
1328
|
+
var ProposalRiskSummary = Schema11.Struct({
|
|
1242
1329
|
level: ProposalRiskLevel,
|
|
1243
1330
|
summary: ProposalSafeString,
|
|
1244
|
-
reasons:
|
|
1331
|
+
reasons: Schema11.Array(ProposalSafeString)
|
|
1245
1332
|
});
|
|
1246
|
-
var Proposal =
|
|
1333
|
+
var Proposal = Schema11.Struct({
|
|
1247
1334
|
id: Id,
|
|
1248
1335
|
workspaceId: Id,
|
|
1249
|
-
teamId:
|
|
1250
|
-
taskId:
|
|
1336
|
+
teamId: Schema11.optionalKey(Id),
|
|
1337
|
+
taskId: Schema11.optionalKey(Id),
|
|
1251
1338
|
target: ProposalTargetRef,
|
|
1252
|
-
title:
|
|
1339
|
+
title: Schema11.String.check(Schema11.isMinLength(1), Schema11.isMaxLength(240), Schema11.isPattern(new RegExp(ProposalSafeStringPattern, "u"))),
|
|
1253
1340
|
summary: ProposalSafeString,
|
|
1254
1341
|
status: ProposalStatus,
|
|
1255
1342
|
riskLevel: ProposalRiskLevel,
|
|
1256
1343
|
approvalPolicy: ProposalApprovalPolicy,
|
|
1257
1344
|
proposedByActorType: ActorType,
|
|
1258
1345
|
proposedByActorId: Id,
|
|
1259
|
-
delegatedByUserId:
|
|
1346
|
+
delegatedByUserId: Schema11.optionalKey(Id),
|
|
1260
1347
|
createdAt: Timestamp,
|
|
1261
1348
|
updatedAt: Timestamp
|
|
1262
1349
|
});
|
|
1263
|
-
var ProposalRevision =
|
|
1350
|
+
var ProposalRevision = Schema11.Struct({
|
|
1264
1351
|
id: Id,
|
|
1265
1352
|
proposalId: Id,
|
|
1266
|
-
revisionNumber:
|
|
1353
|
+
revisionNumber: Schema11.Int.check(Schema11.isGreaterThanOrEqualTo(1)),
|
|
1267
1354
|
payload: ProposalPayload,
|
|
1268
1355
|
renderedDiff: ProposalRenderedDiff,
|
|
1269
1356
|
riskSummary: ProposalRiskSummary,
|
|
@@ -1271,32 +1358,32 @@ var ProposalRevision = Schema10.Struct({
|
|
|
1271
1358
|
createdByActorId: Id,
|
|
1272
1359
|
createdAt: Timestamp
|
|
1273
1360
|
});
|
|
1274
|
-
var ProposalCommentAnchor =
|
|
1275
|
-
path:
|
|
1276
|
-
label:
|
|
1361
|
+
var ProposalCommentAnchor = Schema11.Struct({
|
|
1362
|
+
path: Schema11.Array(Schema11.String.check(Schema11.isMinLength(1), Schema11.isPattern(new RegExp(ProposalSafePayloadKeyPattern, "u")))),
|
|
1363
|
+
label: Schema11.optionalKey(Schema11.String.check(Schema11.isMinLength(1), Schema11.isMaxLength(120), Schema11.isPattern(new RegExp(ProposalSafeStringPattern, "u"))))
|
|
1277
1364
|
});
|
|
1278
|
-
var ProposalComment =
|
|
1365
|
+
var ProposalComment = Schema11.Struct({
|
|
1279
1366
|
id: Id,
|
|
1280
1367
|
proposalId: Id,
|
|
1281
|
-
revisionId:
|
|
1368
|
+
revisionId: Schema11.optionalKey(Id),
|
|
1282
1369
|
body: ProposalSafeString,
|
|
1283
|
-
anchor:
|
|
1370
|
+
anchor: Schema11.optionalKey(ProposalCommentAnchor),
|
|
1284
1371
|
actorType: ActorType,
|
|
1285
1372
|
actorId: Id,
|
|
1286
|
-
delegatedByUserId:
|
|
1373
|
+
delegatedByUserId: Schema11.optionalKey(Id),
|
|
1287
1374
|
createdAt: Timestamp
|
|
1288
1375
|
});
|
|
1289
|
-
var ProposalCheck =
|
|
1376
|
+
var ProposalCheck = Schema11.Struct({
|
|
1290
1377
|
id: Id,
|
|
1291
1378
|
proposalId: Id,
|
|
1292
|
-
revisionId:
|
|
1379
|
+
revisionId: Schema11.optionalKey(Id),
|
|
1293
1380
|
kind: ProposalCheckKind,
|
|
1294
1381
|
status: ProposalCheckStatus,
|
|
1295
1382
|
summary: ProposalSafeString,
|
|
1296
|
-
details:
|
|
1383
|
+
details: Schema11.optionalKey(ProposalSafeMetadata),
|
|
1297
1384
|
createdAt: Timestamp
|
|
1298
1385
|
});
|
|
1299
|
-
var ProposalApplication =
|
|
1386
|
+
var ProposalApplication = Schema11.Struct({
|
|
1300
1387
|
id: Id,
|
|
1301
1388
|
proposalId: Id,
|
|
1302
1389
|
revisionId: Id,
|
|
@@ -1304,9 +1391,9 @@ var ProposalApplication = Schema10.Struct({
|
|
|
1304
1391
|
target: ProposalTargetRef,
|
|
1305
1392
|
appliedByActorType: ActorType,
|
|
1306
1393
|
appliedByActorId: Id,
|
|
1307
|
-
targetVersionBefore:
|
|
1308
|
-
targetVersionAfter:
|
|
1309
|
-
rollbackRef:
|
|
1394
|
+
targetVersionBefore: Schema11.optionalKey(Schema11.String.check(Schema11.isMinLength(1), Schema11.isMaxLength(240), Schema11.isPattern(new RegExp(ProposalSafeStringPattern, "u")))),
|
|
1395
|
+
targetVersionAfter: Schema11.optionalKey(Schema11.String.check(Schema11.isMinLength(1), Schema11.isMaxLength(240), Schema11.isPattern(new RegExp(ProposalSafeStringPattern, "u")))),
|
|
1396
|
+
rollbackRef: Schema11.optionalKey(Schema11.String.check(Schema11.isMinLength(1), Schema11.isMaxLength(240), Schema11.isPattern(new RegExp(ProposalSafeStringPattern, "u")))),
|
|
1310
1397
|
appliedAt: Timestamp
|
|
1311
1398
|
});
|
|
1312
1399
|
function proposalForbiddenKeyVariants() {
|
|
@@ -1321,8 +1408,8 @@ function escapeRegExp(value) {
|
|
|
1321
1408
|
}
|
|
1322
1409
|
|
|
1323
1410
|
// packages/core/src/waiting-on.ts
|
|
1324
|
-
import * as
|
|
1325
|
-
var WaitingOn =
|
|
1411
|
+
import * as Schema12 from "effect/Schema";
|
|
1412
|
+
var WaitingOn = Schema12.Struct({ keys: Schema12.Array(Schema12.String), hidden: Schema12.Int });
|
|
1326
1413
|
|
|
1327
1414
|
// packages/core/src/run-queue.ts
|
|
1328
1415
|
var ClaimRanks = ["in_progress", "finishing", "new"];
|
|
@@ -1465,23 +1552,23 @@ var LoopCapabilityKinds = [
|
|
|
1465
1552
|
"propose_context_relevance",
|
|
1466
1553
|
"execute_runner_sandbox"
|
|
1467
1554
|
];
|
|
1468
|
-
var LoopStatus =
|
|
1469
|
-
var LoopTriggerEvent =
|
|
1470
|
-
var LoopStepImplementationKind =
|
|
1471
|
-
var RunStatus =
|
|
1472
|
-
var RunStepStatus =
|
|
1473
|
-
var StepAttemptStatus =
|
|
1474
|
-
var QuestionStatus =
|
|
1475
|
-
var LoopGuardSource =
|
|
1476
|
-
var LoopSourceMode =
|
|
1477
|
-
var LoopCapabilityKind =
|
|
1478
|
-
var LoopGuardOperator =
|
|
1479
|
-
var LoopCapabilityScopeKind =
|
|
1480
|
-
var LoopRetryBackoffKind =
|
|
1481
|
-
var LoopRequiredRunStepStatus =
|
|
1482
|
-
var LoopSafeRefKind =
|
|
1483
|
-
var LoopSha256 =
|
|
1484
|
-
var LoopGitCommitSha =
|
|
1555
|
+
var LoopStatus = Schema13.Literals(LoopStatuses);
|
|
1556
|
+
var LoopTriggerEvent = Schema13.String.check(Schema13.isMinLength(3), Schema13.isMaxLength(160), Schema13.isPattern(new RegExp("^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)+$", "u")));
|
|
1557
|
+
var LoopStepImplementationKind = Schema13.Literals(LoopStepImplementationKinds);
|
|
1558
|
+
var RunStatus = Schema13.Literals(RunStatuses);
|
|
1559
|
+
var RunStepStatus = Schema13.Literals(RunStepStatuses);
|
|
1560
|
+
var StepAttemptStatus = Schema13.Literals(StepAttemptStatuses);
|
|
1561
|
+
var QuestionStatus = Schema13.Literals(QuestionStatuses);
|
|
1562
|
+
var LoopGuardSource = Schema13.Literals(LoopGuardSources);
|
|
1563
|
+
var LoopSourceMode = Schema13.Literals(LoopSourceModes);
|
|
1564
|
+
var LoopCapabilityKind = Schema13.Literals(LoopCapabilityKinds);
|
|
1565
|
+
var LoopGuardOperator = Schema13.Literals(LoopGuardOperators);
|
|
1566
|
+
var LoopCapabilityScopeKind = Schema13.Literals(LoopCapabilityScopeKinds);
|
|
1567
|
+
var LoopRetryBackoffKind = Schema13.Literals(LoopRetryBackoffKinds);
|
|
1568
|
+
var LoopRequiredRunStepStatus = Schema13.Literals(LoopRequiredRunStepStatuses);
|
|
1569
|
+
var LoopSafeRefKind = Schema13.Literals(LoopSafeRefKinds);
|
|
1570
|
+
var LoopSha256 = Schema13.String.check(Schema13.isPattern(new RegExp("^[a-fA-F0-9]{64}$", "u")));
|
|
1571
|
+
var LoopGitCommitSha = Schema13.String.check(Schema13.isPattern(new RegExp("^[a-fA-F0-9]{40}$|^[a-fA-F0-9]{64}$", "u")));
|
|
1485
1572
|
var LoopCredentialContentPattern = "(?:^|[^A-Za-z0-9])sk-[A-Za-z0-9_-]{16,}|ghp_[A-Za-z0-9_]+|github_pat_[A-Za-z0-9_]+|glpat-[A-Za-z0-9_-]+|\\b[Bb][Ee][Aa][Rr][Ee][Rr]\\s+[A-Za-z0-9._~+/=-]+|eyJ[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+";
|
|
1486
1573
|
var LoopReferenceForbiddenContentPattern = `${LoopCredentialContentPattern}|[dD][iI][fF][fF]\\s+--git|[rR][aA][wW]\\s+(?:[tT][eE][rR][mM][iI][nN][aA][lL]\\s+)?[lL][oO][gG]s?|[tT][eE][rR][mM][iI][nN][aA][lL]\\s+[oO][uU][tT][pP][uU][tT]|[rR][aA][wW]\\s+[tT][rR][aA][nN][sS][cC][rR][iI][pP][tT]s?|[sS][oO][uU][rR][cC][eE]\\s+[cC][oO][dD][eE]|[fF][iI][lL][eE]\\s+[cC][oO][nN][tT][eE][nN][tT]`;
|
|
1487
1574
|
var LoopReferenceAndUrlForbiddenContentPattern = `${LoopReferenceForbiddenContentPattern}|[A-Za-z][A-Za-z0-9+.-]*://\\S+`;
|
|
@@ -1548,26 +1635,26 @@ var LoopForbiddenDataflowKeys = [
|
|
|
1548
1635
|
var LoopForbiddenDataflowKeyPattern = LoopForbiddenDataflowKeys.map(loopForbiddenKeyPattern).join("|");
|
|
1549
1636
|
var LoopForbiddenDataflowKeyRegExp = new RegExp(LoopForbiddenDataflowKeyPattern);
|
|
1550
1637
|
var LoopForbiddenContentRegExp = new RegExp(LoopReferenceAndUrlForbiddenContentPattern);
|
|
1551
|
-
var LoopSafeReferenceString =
|
|
1552
|
-
var LoopSafeInternalReferenceString =
|
|
1553
|
-
var LoopSafeText =
|
|
1554
|
-
var recommendedDefault = (recommended) => recommended !== undefined &&
|
|
1638
|
+
var LoopSafeReferenceString = Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(240), Schema13.isPattern(new RegExp(LoopSafeReferencePattern, "u")));
|
|
1639
|
+
var LoopSafeInternalReferenceString = Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(240), Schema13.isPattern(new RegExp(LoopSafeInternalReferencePattern, "u")));
|
|
1640
|
+
var LoopSafeText = Schema13.String.check(Schema13.isMaxLength(4000), Schema13.isPattern(new RegExp(`^(?![\\s\\S]*(?:${LoopCredentialContentPattern}|[A-Za-z][A-Za-z0-9+.-]*://(?:[^\\s/?#]*@|[^\\s?#]*\\?)))[\\s\\S]*$`, "u")));
|
|
1641
|
+
var recommendedDefault = (recommended) => recommended !== undefined && Schema13.is(LoopSafeText)(recommended) ? recommended : undefined;
|
|
1555
1642
|
var unansweredQuestionLead = "Nobody answers in full auto, and the agent's Question has no answer to take";
|
|
1556
1643
|
var unansweredQuestionReason2 = (prompt) => {
|
|
1557
1644
|
const reason = `${unansweredQuestionLead}: ${prompt}`.slice(0, 4000);
|
|
1558
|
-
return
|
|
1645
|
+
return Schema13.is(LoopSafeText)(reason) ? reason : `${unansweredQuestionLead}; its text is on the Run`;
|
|
1559
1646
|
};
|
|
1560
1647
|
var isUnansweredQuestion2 = (reason) => reason.startsWith(unansweredQuestionLead);
|
|
1561
|
-
var QuestionText =
|
|
1562
|
-
var LoopSafeOutputDataString =
|
|
1563
|
-
var LoopSafePackageName =
|
|
1564
|
-
var LoopSafeScopeValue =
|
|
1565
|
-
var LoopSafeKey =
|
|
1566
|
-
var LoopDataflowKey =
|
|
1567
|
-
var LoopDataPathSegment =
|
|
1568
|
-
var LoopGitRef =
|
|
1569
|
-
var LoopBundleRef =
|
|
1570
|
-
var LoopSourcePath =
|
|
1648
|
+
var QuestionText = Schema13.String;
|
|
1649
|
+
var LoopSafeOutputDataString = Schema13.String.check(Schema13.isMaxLength(4000), Schema13.isPattern(new RegExp(LoopSafeInternalReferencePattern, "u")));
|
|
1650
|
+
var LoopSafePackageName = Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(200), Schema13.isPattern(new RegExp(LoopSafeReferencePattern, "u")));
|
|
1651
|
+
var LoopSafeScopeValue = Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(240), Schema13.isPattern(new RegExp(LoopSafeScopeValuePattern, "u")));
|
|
1652
|
+
var LoopSafeKey = Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(120), Schema13.isPattern(new RegExp(`^(?!.*(?:${LoopForbiddenDataflowKeyPattern}))(?!.*(?:${LoopReferenceForbiddenContentPattern}))[A-Za-z0-9][A-Za-z0-9_-]*$`, "u")));
|
|
1653
|
+
var LoopDataflowKey = Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(120), Schema13.isPattern(new RegExp(`^(?!.*(?:${LoopForbiddenDataflowKeyPattern}))(?!.*(?:${LoopReferenceForbiddenContentPattern}))[A-Za-z][A-Za-z0-9]*(?:[_-][A-Za-z0-9]+)*$`, "u")));
|
|
1654
|
+
var LoopDataPathSegment = Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(120), Schema13.isPattern(new RegExp(`^(?!.*(?:${LoopForbiddenDataflowKeyPattern}))(?!.*(?:${LoopReferenceForbiddenContentPattern}))[A-Za-z_][A-Za-z0-9_-]*$`, "u")));
|
|
1655
|
+
var LoopGitRef = Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(240), Schema13.isPattern(new RegExp(`^(?!.*(?:${LoopReferenceForbiddenContentPattern}))(?!@$)(?!.*\\.\\.)(?!.*@\\{)(?!.*//)(?!.*[\\s~^:?*\\[\\\\])(?!.*(?:^|/)\\.)(?!.*(?:^|/)\\.\\.?(?:/|$))(?!.*\\.lock(?:/|$))(?!.*/$)(?!.*\\.$)[A-Za-z0-9][A-Za-z0-9._/-]*$`, "u")));
|
|
1656
|
+
var LoopBundleRef = Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(500), Schema13.isPattern(new RegExp(`^(?!.*(?:${LoopReferenceAndUrlForbiddenContentPattern}))(?!/)(?!.*:)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.\\.?($|/))(?!.*\\s).+$`, "u")));
|
|
1657
|
+
var LoopSourcePath = Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(500), Schema13.isPattern(new RegExp(`^(?!.*(?:${LoopReferenceForbiddenContentPattern}))(?!/)(?!.*:)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.\\.?($|/))(?!.*\\s).+$`, "u")));
|
|
1571
1658
|
function loopForbiddenKeyPattern(key) {
|
|
1572
1659
|
const words = key.split(/[_-]+/).filter(Boolean);
|
|
1573
1660
|
const separated = words.map((word) => loopCaseInsensitiveWordPattern(word)).join("[_-]+");
|
|
@@ -1585,186 +1672,186 @@ function loopCaseInsensitiveWordPattern(word, uppercaseFirst = false) {
|
|
|
1585
1672
|
return char.replace(/[\\^$.*+?()[\]{}|]/g, "\\$&");
|
|
1586
1673
|
}).join("");
|
|
1587
1674
|
}
|
|
1588
|
-
var LoopDataSchemaRef =
|
|
1589
|
-
kind:
|
|
1675
|
+
var LoopDataSchemaRef = Schema13.Struct({
|
|
1676
|
+
kind: Schema13.Literal("typebox_ref"),
|
|
1590
1677
|
name: LoopSafeReferenceString,
|
|
1591
|
-
version:
|
|
1592
|
-
sha256:
|
|
1678
|
+
version: Schema13.optionalKey(Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(120), Schema13.isPattern(new RegExp(LoopSafeReferencePattern, "u")))),
|
|
1679
|
+
sha256: Schema13.optionalKey(LoopSha256)
|
|
1593
1680
|
});
|
|
1594
|
-
var LoopStepOutputDataValue =
|
|
1681
|
+
var LoopStepOutputDataValue = Schema13.Union([
|
|
1595
1682
|
LoopSafeOutputDataString,
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1683
|
+
Schema13.Finite,
|
|
1684
|
+
Schema13.Boolean,
|
|
1685
|
+
Schema13.Null,
|
|
1686
|
+
Schema13.Array(Schema13.suspend(() => LoopStepOutputDataValue)).check(Schema13.isMaxLength(200)),
|
|
1687
|
+
Schema13.Record(LoopDataPathSegment, Schema13.suspend(() => LoopStepOutputDataValue)).check(Schema13.isMaxProperties(200))
|
|
1601
1688
|
]).annotate({ identifier: "LoopStepOutputDataValue" });
|
|
1602
|
-
var LoopSafeMetadata =
|
|
1603
|
-
var LoopGuardValue =
|
|
1604
|
-
var LoopSafeRef =
|
|
1689
|
+
var LoopSafeMetadata = Schema13.Record(LoopDataPathSegment, LoopStepOutputDataValue);
|
|
1690
|
+
var LoopGuardValue = Schema13.Union([LoopSafeOutputDataString, Schema13.Finite, Schema13.Boolean]);
|
|
1691
|
+
var LoopSafeRef = Schema13.Struct({
|
|
1605
1692
|
kind: LoopSafeRefKind,
|
|
1606
|
-
id:
|
|
1607
|
-
externalId:
|
|
1608
|
-
provider:
|
|
1609
|
-
title:
|
|
1693
|
+
id: Schema13.optionalKey(LoopSafeInternalReferenceString),
|
|
1694
|
+
externalId: Schema13.optionalKey(LoopSafeInternalReferenceString),
|
|
1695
|
+
provider: Schema13.optionalKey(LoopSafeInternalReferenceString),
|
|
1696
|
+
title: Schema13.optionalKey(LoopSafeInternalReferenceString)
|
|
1610
1697
|
});
|
|
1611
|
-
var LoopGuard =
|
|
1698
|
+
var LoopGuard = Schema13.Struct({
|
|
1612
1699
|
key: LoopSafeKey,
|
|
1613
1700
|
source: LoopGuardSource,
|
|
1614
|
-
path:
|
|
1701
|
+
path: Schema13.Array(LoopDataPathSegment).check(Schema13.isMinLength(1)),
|
|
1615
1702
|
operator: LoopGuardOperator,
|
|
1616
|
-
value:
|
|
1617
|
-
values:
|
|
1703
|
+
value: Schema13.optionalKey(LoopGuardValue),
|
|
1704
|
+
values: Schema13.optionalKey(Schema13.Array(LoopGuardValue).check(Schema13.isMinLength(1)))
|
|
1618
1705
|
});
|
|
1619
|
-
var LoopCapabilityScope =
|
|
1706
|
+
var LoopCapabilityScope = Schema13.Struct({
|
|
1620
1707
|
kind: LoopCapabilityScopeKind,
|
|
1621
|
-
id:
|
|
1622
|
-
idRef:
|
|
1623
|
-
value:
|
|
1708
|
+
id: Schema13.optionalKey(Id),
|
|
1709
|
+
idRef: Schema13.optionalKey(LoopSafeReferenceString),
|
|
1710
|
+
value: Schema13.optionalKey(LoopSafeScopeValue)
|
|
1624
1711
|
});
|
|
1625
|
-
var LoopCapabilityGrant =
|
|
1712
|
+
var LoopCapabilityGrant = Schema13.Struct({
|
|
1626
1713
|
capability: LoopCapabilityKind,
|
|
1627
|
-
scope:
|
|
1628
|
-
reason:
|
|
1714
|
+
scope: Schema13.optionalKey(LoopCapabilityScope),
|
|
1715
|
+
reason: Schema13.optionalKey(LoopSafeText)
|
|
1629
1716
|
});
|
|
1630
|
-
var LoopRequiredContextSlice =
|
|
1717
|
+
var LoopRequiredContextSlice = Schema13.Struct({
|
|
1631
1718
|
kind: ContextPackRetrievalRefKind,
|
|
1632
|
-
id:
|
|
1633
|
-
idRef:
|
|
1719
|
+
id: Schema13.optionalKey(Id),
|
|
1720
|
+
idRef: Schema13.optionalKey(LoopSafeReferenceString),
|
|
1634
1721
|
reason: LoopSafeText,
|
|
1635
|
-
required:
|
|
1722
|
+
required: Schema13.Boolean.pipe(Schema13.withDecodingDefaultKey(Effect.succeed(true)))
|
|
1636
1723
|
});
|
|
1637
|
-
var LoopRetryPolicy =
|
|
1638
|
-
maxAttempts:
|
|
1724
|
+
var LoopRetryPolicy = Schema13.Struct({
|
|
1725
|
+
maxAttempts: Schema13.Int.check(Schema13.isGreaterThanOrEqualTo(1), Schema13.isLessThanOrEqualTo(20)),
|
|
1639
1726
|
backoff: LoopRetryBackoffKind,
|
|
1640
|
-
delaySeconds:
|
|
1727
|
+
delaySeconds: Schema13.optionalKey(Schema13.Int.check(Schema13.isGreaterThanOrEqualTo(1), Schema13.isLessThanOrEqualTo(86400)))
|
|
1641
1728
|
});
|
|
1642
|
-
var LoopTimeoutPolicy =
|
|
1643
|
-
timeoutSeconds:
|
|
1729
|
+
var LoopTimeoutPolicy = Schema13.Struct({
|
|
1730
|
+
timeoutSeconds: Schema13.Int.check(Schema13.isGreaterThanOrEqualTo(1), Schema13.isLessThanOrEqualTo(604800))
|
|
1644
1731
|
});
|
|
1645
|
-
var LoopDirectSource =
|
|
1646
|
-
mode:
|
|
1647
|
-
registeredFrom:
|
|
1648
|
-
bundleRef:
|
|
1649
|
-
bundleSha256:
|
|
1650
|
-
metadata:
|
|
1732
|
+
var LoopDirectSource = Schema13.Struct({
|
|
1733
|
+
mode: Schema13.Literal("direct"),
|
|
1734
|
+
registeredFrom: Schema13.optionalKey(Schema13.Union([Schema13.Literal("api"), Schema13.Literal("cli"), Schema13.Literal("mcp"), Schema13.Literal("import")])),
|
|
1735
|
+
bundleRef: Schema13.optionalKey(LoopBundleRef),
|
|
1736
|
+
bundleSha256: Schema13.optionalKey(LoopSha256),
|
|
1737
|
+
metadata: Schema13.optionalKey(LoopSafeMetadata)
|
|
1651
1738
|
});
|
|
1652
|
-
var LoopGitBackedSource =
|
|
1653
|
-
mode:
|
|
1739
|
+
var LoopGitBackedSource = Schema13.Struct({
|
|
1740
|
+
mode: Schema13.Literal("git_backed"),
|
|
1654
1741
|
repoBindingId: Id,
|
|
1655
1742
|
gitRef: LoopGitRef,
|
|
1656
1743
|
commitSha: LoopGitCommitSha,
|
|
1657
|
-
definitionPath:
|
|
1658
|
-
packagePath:
|
|
1659
|
-
metadata:
|
|
1744
|
+
definitionPath: Schema13.optionalKey(LoopSourcePath),
|
|
1745
|
+
packagePath: Schema13.optionalKey(LoopSourcePath),
|
|
1746
|
+
metadata: Schema13.optionalKey(LoopSafeMetadata)
|
|
1660
1747
|
});
|
|
1661
|
-
var LoopSource =
|
|
1662
|
-
var LoopStepPackageMetadata =
|
|
1748
|
+
var LoopSource = Schema13.Union([LoopDirectSource, LoopGitBackedSource]);
|
|
1749
|
+
var LoopStepPackageMetadata = Schema13.Struct({
|
|
1663
1750
|
packageName: LoopSafePackageName,
|
|
1664
|
-
version:
|
|
1751
|
+
version: Schema13.optionalKey(Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(120), Schema13.isPattern(new RegExp(LoopSafeReferencePattern, "u")))),
|
|
1665
1752
|
entrypoint: LoopSafeReferenceString,
|
|
1666
1753
|
source: LoopSource,
|
|
1667
|
-
runtime:
|
|
1668
|
-
integritySha256:
|
|
1669
|
-
metadata:
|
|
1754
|
+
runtime: Schema13.optionalKey(Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(120), Schema13.isPattern(new RegExp(LoopSafeReferencePattern, "u")))),
|
|
1755
|
+
integritySha256: Schema13.optionalKey(LoopSha256),
|
|
1756
|
+
metadata: Schema13.optionalKey(LoopSafeMetadata)
|
|
1670
1757
|
});
|
|
1671
1758
|
var LoopStepInputBindingFields = {
|
|
1672
1759
|
key: LoopDataflowKey,
|
|
1673
|
-
required:
|
|
1760
|
+
required: Schema13.optionalKey(Schema13.Boolean)
|
|
1674
1761
|
};
|
|
1675
|
-
var LoopStepInputBinding =
|
|
1676
|
-
|
|
1762
|
+
var LoopStepInputBinding = Schema13.Union([
|
|
1763
|
+
Schema13.Struct({
|
|
1677
1764
|
...LoopStepInputBindingFields,
|
|
1678
|
-
source:
|
|
1679
|
-
path:
|
|
1765
|
+
source: Schema13.Literal("trigger_event"),
|
|
1766
|
+
path: Schema13.Array(LoopDataPathSegment).check(Schema13.isMinLength(1))
|
|
1680
1767
|
}),
|
|
1681
|
-
|
|
1768
|
+
Schema13.Struct({
|
|
1682
1769
|
...LoopStepInputBindingFields,
|
|
1683
|
-
source:
|
|
1684
|
-
path:
|
|
1770
|
+
source: Schema13.Literal("subject"),
|
|
1771
|
+
path: Schema13.Array(LoopDataPathSegment).check(Schema13.isMinLength(1))
|
|
1685
1772
|
}),
|
|
1686
|
-
|
|
1773
|
+
Schema13.Struct({
|
|
1687
1774
|
...LoopStepInputBindingFields,
|
|
1688
|
-
source:
|
|
1689
|
-
path:
|
|
1775
|
+
source: Schema13.Literal("context"),
|
|
1776
|
+
path: Schema13.Array(LoopDataPathSegment).check(Schema13.isMinLength(1))
|
|
1690
1777
|
}),
|
|
1691
|
-
|
|
1778
|
+
Schema13.Struct({
|
|
1692
1779
|
...LoopStepInputBindingFields,
|
|
1693
|
-
source:
|
|
1780
|
+
source: Schema13.Literal("step_output"),
|
|
1694
1781
|
stepKey: LoopSafeKey,
|
|
1695
1782
|
outputKey: LoopDataflowKey,
|
|
1696
|
-
path:
|
|
1783
|
+
path: Schema13.optionalKey(Schema13.Array(LoopDataPathSegment).check(Schema13.isMinLength(1)))
|
|
1697
1784
|
}),
|
|
1698
|
-
|
|
1785
|
+
Schema13.Struct({
|
|
1699
1786
|
...LoopStepInputBindingFields,
|
|
1700
|
-
source:
|
|
1701
|
-
path:
|
|
1787
|
+
source: Schema13.Literal("run"),
|
|
1788
|
+
path: Schema13.Array(LoopDataPathSegment).check(Schema13.isMinLength(1))
|
|
1702
1789
|
}),
|
|
1703
|
-
|
|
1790
|
+
Schema13.Struct({
|
|
1704
1791
|
...LoopStepInputBindingFields,
|
|
1705
|
-
source:
|
|
1792
|
+
source: Schema13.Literal("literal"),
|
|
1706
1793
|
value: LoopStepOutputDataValue
|
|
1707
1794
|
})
|
|
1708
1795
|
]);
|
|
1709
|
-
var LoopStepOutputRef =
|
|
1796
|
+
var LoopStepOutputRef = Schema13.Struct({
|
|
1710
1797
|
key: LoopDataflowKey,
|
|
1711
|
-
schemaRef:
|
|
1712
|
-
path:
|
|
1713
|
-
required:
|
|
1798
|
+
schemaRef: Schema13.optionalKey(LoopDataSchemaRef),
|
|
1799
|
+
path: Schema13.optionalKey(Schema13.Array(LoopDataPathSegment).check(Schema13.isMinLength(1))),
|
|
1800
|
+
required: Schema13.optionalKey(Schema13.Boolean)
|
|
1714
1801
|
});
|
|
1715
|
-
var LoopBuiltInActionStepImplementation =
|
|
1716
|
-
kind:
|
|
1802
|
+
var LoopBuiltInActionStepImplementation = Schema13.Struct({
|
|
1803
|
+
kind: Schema13.Literal("built_in_action"),
|
|
1717
1804
|
action: LoopSafeReferenceString,
|
|
1718
|
-
input:
|
|
1805
|
+
input: Schema13.optionalKey(LoopSafeMetadata)
|
|
1719
1806
|
});
|
|
1720
|
-
var LoopAgentRuntimeComponentSelector =
|
|
1807
|
+
var LoopAgentRuntimeComponentSelector = Schema13.Struct({
|
|
1721
1808
|
implementation: LoopSafeReferenceString,
|
|
1722
|
-
kind:
|
|
1809
|
+
kind: Schema13.Union([Schema13.Literal("preferred"), Schema13.Literal("required")])
|
|
1723
1810
|
});
|
|
1724
|
-
var LoopAgentStepImplementation =
|
|
1725
|
-
kind:
|
|
1811
|
+
var LoopAgentStepImplementation = Schema13.Struct({
|
|
1812
|
+
kind: Schema13.Literal("agent"),
|
|
1726
1813
|
taskIdRef: LoopSafeReferenceString,
|
|
1727
1814
|
agentId: Id,
|
|
1728
|
-
agentRef:
|
|
1729
|
-
runtimeKind:
|
|
1730
|
-
harness:
|
|
1731
|
-
sandbox:
|
|
1732
|
-
models:
|
|
1733
|
-
extensions:
|
|
1734
|
-
});
|
|
1735
|
-
var LoopWaitForEventStepImplementation =
|
|
1736
|
-
kind:
|
|
1815
|
+
agentRef: Schema13.optionalKey(AgentReference),
|
|
1816
|
+
runtimeKind: Schema13.optionalKey(LoopSafeReferenceString),
|
|
1817
|
+
harness: Schema13.optionalKey(LoopAgentRuntimeComponentSelector),
|
|
1818
|
+
sandbox: Schema13.optionalKey(LoopAgentRuntimeComponentSelector),
|
|
1819
|
+
models: Schema13.optionalKey(Schema13.Array(AgentModelSelector).check(Schema13.isMinLength(1), Schema13.isMaxLength(20))),
|
|
1820
|
+
extensions: Schema13.optionalKey(Schema13.Array(NativeExtensionRef).check(Schema13.isMaxLength(20)))
|
|
1821
|
+
});
|
|
1822
|
+
var LoopWaitForEventStepImplementation = Schema13.Struct({
|
|
1823
|
+
kind: Schema13.Literal("wait_for_event"),
|
|
1737
1824
|
event: LoopTriggerEvent,
|
|
1738
|
-
anyOf:
|
|
1739
|
-
correlationPath:
|
|
1740
|
-
authPolicy:
|
|
1741
|
-
mode:
|
|
1742
|
-
capability:
|
|
1825
|
+
anyOf: Schema13.optionalKey(Schema13.Array(LoopTriggerEvent).check(Schema13.isMinLength(1))),
|
|
1826
|
+
correlationPath: Schema13.Array(LoopDataPathSegment).check(Schema13.isMinLength(1)),
|
|
1827
|
+
authPolicy: Schema13.optionalKey(Schema13.Struct({
|
|
1828
|
+
mode: Schema13.Union([Schema13.Literal("trusted_source"), Schema13.Literal("actor")]),
|
|
1829
|
+
capability: Schema13.optionalKey(LoopSafeReferenceString)
|
|
1743
1830
|
})),
|
|
1744
|
-
cancellation:
|
|
1745
|
-
releaseRunner:
|
|
1831
|
+
cancellation: Schema13.optionalKey(Schema13.Union([Schema13.Literal("cancel"), Schema13.Literal("timeout")])),
|
|
1832
|
+
releaseRunner: Schema13.optionalKey(Schema13.Boolean)
|
|
1746
1833
|
});
|
|
1747
|
-
var LoopHumanApprovalStepImplementation =
|
|
1748
|
-
kind:
|
|
1834
|
+
var LoopHumanApprovalStepImplementation = Schema13.Struct({
|
|
1835
|
+
kind: Schema13.Literal("human_approval"),
|
|
1749
1836
|
prompt: LoopSafeText,
|
|
1750
1837
|
approvalPolicy: ProposalApprovalPolicy
|
|
1751
1838
|
});
|
|
1752
|
-
var LoopRunnerSandboxStepImplementation =
|
|
1753
|
-
kind:
|
|
1839
|
+
var LoopRunnerSandboxStepImplementation = Schema13.Struct({
|
|
1840
|
+
kind: Schema13.Literal("runner_sandbox"),
|
|
1754
1841
|
runnerSelector: LoopSafeMetadata,
|
|
1755
1842
|
entrypoint: LoopSafeReferenceString,
|
|
1756
|
-
package:
|
|
1843
|
+
package: Schema13.optionalKey(LoopStepPackageMetadata)
|
|
1757
1844
|
});
|
|
1758
|
-
var LoopPackageRefStepImplementation =
|
|
1759
|
-
kind:
|
|
1845
|
+
var LoopPackageRefStepImplementation = Schema13.Struct({
|
|
1846
|
+
kind: Schema13.Literal("package_ref"),
|
|
1760
1847
|
package: LoopStepPackageMetadata
|
|
1761
1848
|
});
|
|
1762
|
-
var LoopCallStepImplementation =
|
|
1763
|
-
kind:
|
|
1849
|
+
var LoopCallStepImplementation = Schema13.Struct({
|
|
1850
|
+
kind: Schema13.Literal("call_loop"),
|
|
1764
1851
|
loop: LoopReferenceSchema,
|
|
1765
|
-
mode:
|
|
1852
|
+
mode: Schema13.Literal("awaited")
|
|
1766
1853
|
});
|
|
1767
|
-
var LoopConcreteActionImplementation =
|
|
1854
|
+
var LoopConcreteActionImplementation = Schema13.Union([
|
|
1768
1855
|
LoopBuiltInActionStepImplementation,
|
|
1769
1856
|
LoopAgentStepImplementation,
|
|
1770
1857
|
LoopWaitForEventStepImplementation,
|
|
@@ -1772,221 +1859,221 @@ var LoopConcreteActionImplementation = Schema12.Union([
|
|
|
1772
1859
|
LoopRunnerSandboxStepImplementation,
|
|
1773
1860
|
LoopPackageRefStepImplementation
|
|
1774
1861
|
]);
|
|
1775
|
-
var LoopRepeatUntilSafetyPolicy =
|
|
1776
|
-
maxIterations:
|
|
1777
|
-
timeoutSeconds:
|
|
1862
|
+
var LoopRepeatUntilSafetyPolicy = Schema13.Struct({
|
|
1863
|
+
maxIterations: Schema13.Int.check(Schema13.isGreaterThanOrEqualTo(1), Schema13.isLessThanOrEqualTo(1000)),
|
|
1864
|
+
timeoutSeconds: Schema13.optionalKey(Schema13.Int.check(Schema13.isGreaterThanOrEqualTo(1), Schema13.isLessThanOrEqualTo(604800)))
|
|
1778
1865
|
});
|
|
1779
|
-
var LoopRepeatUntilStepImplementation =
|
|
1780
|
-
kind:
|
|
1866
|
+
var LoopRepeatUntilStepImplementation = Schema13.Struct({
|
|
1867
|
+
kind: Schema13.Literal("repeat_until"),
|
|
1781
1868
|
body: LoopConcreteActionImplementation,
|
|
1782
1869
|
convergenceOutput: LoopDataflowKey,
|
|
1783
1870
|
safetyPolicy: LoopRepeatUntilSafetyPolicy
|
|
1784
1871
|
});
|
|
1785
|
-
var LoopStepImplementation =
|
|
1872
|
+
var LoopStepImplementation = Schema13.Union([
|
|
1786
1873
|
LoopConcreteActionImplementation,
|
|
1787
1874
|
LoopRepeatUntilStepImplementation,
|
|
1788
1875
|
LoopCallStepImplementation
|
|
1789
1876
|
]);
|
|
1790
|
-
var LoopStep =
|
|
1877
|
+
var LoopStep = Schema13.Struct({
|
|
1791
1878
|
key: LoopSafeKey,
|
|
1792
1879
|
title: LoopSafeReferenceString,
|
|
1793
|
-
required:
|
|
1794
|
-
dependsOn:
|
|
1795
|
-
requiredContext:
|
|
1796
|
-
guards:
|
|
1880
|
+
required: Schema13.Boolean.pipe(Schema13.withDecodingDefaultKey(Effect.succeed(true))),
|
|
1881
|
+
dependsOn: Schema13.Array(LoopSafeKey),
|
|
1882
|
+
requiredContext: Schema13.Array(LoopRequiredContextSlice),
|
|
1883
|
+
guards: Schema13.Array(LoopGuard),
|
|
1797
1884
|
implementation: LoopStepImplementation,
|
|
1798
1885
|
inputSchemaRef: LoopDataSchemaRef,
|
|
1799
1886
|
outputSchemaRef: LoopDataSchemaRef,
|
|
1800
|
-
inputBindings:
|
|
1801
|
-
outputRefs:
|
|
1802
|
-
allowedCapabilities:
|
|
1887
|
+
inputBindings: Schema13.Array(LoopStepInputBinding),
|
|
1888
|
+
outputRefs: Schema13.Array(LoopStepOutputRef),
|
|
1889
|
+
allowedCapabilities: Schema13.Array(LoopCapabilityGrant),
|
|
1803
1890
|
retryPolicy: LoopRetryPolicy,
|
|
1804
1891
|
timeoutPolicy: LoopTimeoutPolicy,
|
|
1805
1892
|
metadata: LoopSafeMetadata
|
|
1806
1893
|
});
|
|
1807
|
-
var LoopStepOutput =
|
|
1894
|
+
var LoopStepOutput = Schema13.Struct({
|
|
1808
1895
|
stepKey: LoopSafeKey,
|
|
1809
1896
|
outputSchemaRef: LoopDataSchemaRef,
|
|
1810
1897
|
summary: LoopSafeText,
|
|
1811
|
-
data:
|
|
1812
|
-
metadata:
|
|
1813
|
-
refs:
|
|
1898
|
+
data: Schema13.Record(LoopDataflowKey, LoopStepOutputDataValue).check(Schema13.isMinProperties(1)),
|
|
1899
|
+
metadata: Schema13.optionalKey(LoopSafeMetadata),
|
|
1900
|
+
refs: Schema13.Array(LoopSafeRef)
|
|
1814
1901
|
});
|
|
1815
1902
|
var RunStepStateFields = {
|
|
1816
|
-
stepKey:
|
|
1817
|
-
sequence:
|
|
1818
|
-
attempts:
|
|
1819
|
-
stepAttemptId:
|
|
1820
|
-
startedAt:
|
|
1821
|
-
endedAt:
|
|
1822
|
-
output:
|
|
1823
|
-
failureSummary:
|
|
1903
|
+
stepKey: Schema13.String.check(Schema13.isMinLength(1)),
|
|
1904
|
+
sequence: Schema13.Int.check(Schema13.isGreaterThanOrEqualTo(0)),
|
|
1905
|
+
attempts: Schema13.Int.check(Schema13.isGreaterThanOrEqualTo(0)),
|
|
1906
|
+
stepAttemptId: Schema13.optionalKey(Id),
|
|
1907
|
+
startedAt: Schema13.optionalKey(Timestamp),
|
|
1908
|
+
endedAt: Schema13.optionalKey(Timestamp),
|
|
1909
|
+
output: Schema13.optionalKey(LoopStepOutput),
|
|
1910
|
+
failureSummary: Schema13.optionalKey(LoopSafeText),
|
|
1824
1911
|
updatedAt: Timestamp
|
|
1825
1912
|
};
|
|
1826
|
-
var RunStepState =
|
|
1827
|
-
|
|
1913
|
+
var RunStepState = Schema13.Union([
|
|
1914
|
+
Schema13.Struct({
|
|
1828
1915
|
...RunStepStateFields,
|
|
1829
|
-
required:
|
|
1916
|
+
required: Schema13.Literal(true),
|
|
1830
1917
|
status: LoopRequiredRunStepStatus
|
|
1831
1918
|
}),
|
|
1832
|
-
|
|
1919
|
+
Schema13.Struct({
|
|
1833
1920
|
...RunStepStateFields,
|
|
1834
|
-
required:
|
|
1921
|
+
required: Schema13.Literal(false),
|
|
1835
1922
|
status: RunStepStatus
|
|
1836
1923
|
})
|
|
1837
1924
|
]);
|
|
1838
|
-
var RunState =
|
|
1839
|
-
stepStates:
|
|
1840
|
-
summary:
|
|
1925
|
+
var RunState = Schema13.Struct({
|
|
1926
|
+
stepStates: Schema13.Array(RunStepState),
|
|
1927
|
+
summary: Schema13.optionalKey(LoopSafeText),
|
|
1841
1928
|
resultMetadata: LoopSafeMetadata
|
|
1842
1929
|
});
|
|
1843
|
-
var RunTrigger =
|
|
1930
|
+
var RunTrigger = Schema13.Struct({
|
|
1844
1931
|
event: LoopSafeReferenceString,
|
|
1845
1932
|
eventId: Id,
|
|
1846
|
-
subject:
|
|
1933
|
+
subject: Schema13.optionalKey(RunResourceRef),
|
|
1847
1934
|
occurredAt: Timestamp,
|
|
1848
1935
|
metadata: LoopSafeMetadata
|
|
1849
1936
|
});
|
|
1850
|
-
var RunWaiting =
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
kind:
|
|
1854
|
-
name:
|
|
1937
|
+
var RunWaiting = Schema13.Union([
|
|
1938
|
+
Schema13.Struct({ kind: Schema13.Literal("question"), name: Schema13.String.check(Schema13.isMinLength(1)), questionId: Id }),
|
|
1939
|
+
Schema13.Struct({
|
|
1940
|
+
kind: Schema13.Literal("clock"),
|
|
1941
|
+
name: Schema13.String.check(Schema13.isMinLength(1)),
|
|
1855
1942
|
firesAt: Timestamp
|
|
1856
1943
|
}),
|
|
1857
|
-
|
|
1858
|
-
kind:
|
|
1859
|
-
name:
|
|
1860
|
-
event:
|
|
1944
|
+
Schema13.Struct({
|
|
1945
|
+
kind: Schema13.Literal("event"),
|
|
1946
|
+
name: Schema13.String.check(Schema13.isMinLength(1)),
|
|
1947
|
+
event: Schema13.String.check(Schema13.isMinLength(1)),
|
|
1861
1948
|
timesOutAt: Timestamp
|
|
1862
1949
|
}),
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
kind:
|
|
1867
|
-
name:
|
|
1950
|
+
Schema13.Struct({ kind: Schema13.Literal("step"), name: Schema13.String.check(Schema13.isMinLength(1)), stepAttemptId: Id }),
|
|
1951
|
+
Schema13.Struct({ kind: Schema13.Literal("child"), name: Schema13.String.check(Schema13.isMinLength(1)), runId: Id }),
|
|
1952
|
+
Schema13.Struct({
|
|
1953
|
+
kind: Schema13.Literal("verification"),
|
|
1954
|
+
name: Schema13.String.check(Schema13.isMinLength(1)),
|
|
1868
1955
|
verificationId: Id
|
|
1869
1956
|
}),
|
|
1870
|
-
|
|
1871
|
-
kind:
|
|
1872
|
-
name:
|
|
1873
|
-
resource:
|
|
1874
|
-
holder:
|
|
1957
|
+
Schema13.Struct({
|
|
1958
|
+
kind: Schema13.Literal("claim"),
|
|
1959
|
+
name: Schema13.String.check(Schema13.isMinLength(1)),
|
|
1960
|
+
resource: Schema13.String.check(Schema13.isMinLength(1)),
|
|
1961
|
+
holder: Schema13.optionalKey(Schema13.Struct({ runId: Id, loopId: Schema13.String }))
|
|
1875
1962
|
}),
|
|
1876
|
-
|
|
1877
|
-
kind:
|
|
1878
|
-
name:
|
|
1963
|
+
Schema13.Struct({
|
|
1964
|
+
kind: Schema13.Literal("queue"),
|
|
1965
|
+
name: Schema13.String.check(Schema13.isMinLength(1)),
|
|
1879
1966
|
workUnitId: Id,
|
|
1880
|
-
rank:
|
|
1881
|
-
position:
|
|
1882
|
-
reason:
|
|
1967
|
+
rank: Schema13.Literals(ClaimRanks),
|
|
1968
|
+
position: Schema13.Int.check(Schema13.isGreaterThanOrEqualTo(1)),
|
|
1969
|
+
reason: Schema13.String
|
|
1883
1970
|
})
|
|
1884
1971
|
]);
|
|
1885
|
-
var RunEvidence =
|
|
1972
|
+
var RunEvidence = Schema13.Struct({
|
|
1886
1973
|
id: Id,
|
|
1887
|
-
step:
|
|
1888
|
-
name:
|
|
1889
|
-
command:
|
|
1890
|
-
status:
|
|
1891
|
-
preExisting:
|
|
1892
|
-
revision:
|
|
1893
|
-
tree:
|
|
1894
|
-
durationMs:
|
|
1895
|
-
outputTail:
|
|
1896
|
-
fileIds:
|
|
1897
|
-
skippedSinceBaseline:
|
|
1898
|
-
newNotRun:
|
|
1974
|
+
step: Schema13.String,
|
|
1975
|
+
name: Schema13.String,
|
|
1976
|
+
command: Schema13.String,
|
|
1977
|
+
status: Schema13.Literals(["passed", "failed"]),
|
|
1978
|
+
preExisting: Schema13.Boolean,
|
|
1979
|
+
revision: Schema13.String,
|
|
1980
|
+
tree: Schema13.String,
|
|
1981
|
+
durationMs: Schema13.Int.check(Schema13.isGreaterThanOrEqualTo(0)),
|
|
1982
|
+
outputTail: Schema13.String,
|
|
1983
|
+
fileIds: Schema13.optionalKey(Schema13.Array(Schema13.String)),
|
|
1984
|
+
skippedSinceBaseline: Schema13.optionalKey(Schema13.Array(Schema13.String)),
|
|
1985
|
+
newNotRun: Schema13.optionalKey(Schema13.Array(Schema13.String)),
|
|
1899
1986
|
recordedAt: Timestamp
|
|
1900
1987
|
});
|
|
1901
|
-
var ApprovedVerification =
|
|
1988
|
+
var ApprovedVerification = Schema13.Struct({
|
|
1902
1989
|
id: Id,
|
|
1903
1990
|
repoBindingId: Id,
|
|
1904
|
-
name:
|
|
1905
|
-
command:
|
|
1906
|
-
workingDirectory:
|
|
1907
|
-
pipeline:
|
|
1908
|
-
approvedByUserId:
|
|
1991
|
+
name: Schema13.String,
|
|
1992
|
+
command: Schema13.String,
|
|
1993
|
+
workingDirectory: Schema13.optionalKey(Schema13.String),
|
|
1994
|
+
pipeline: Schema13.optionalKey(Schema13.Boolean),
|
|
1995
|
+
approvedByUserId: Schema13.String,
|
|
1909
1996
|
createdAt: Timestamp
|
|
1910
1997
|
});
|
|
1911
|
-
var ApprovedVerificationList =
|
|
1912
|
-
var BundleDigest =
|
|
1913
|
-
var RunArtifact =
|
|
1998
|
+
var ApprovedVerificationList = Schema13.Struct({ items: Schema13.Array(ApprovedVerification) });
|
|
1999
|
+
var BundleDigest = Schema13.String.check(Schema13.isMinLength(64), Schema13.isMaxLength(64), Schema13.isPattern(new RegExp("^[a-f0-9]{64}$", "u")));
|
|
2000
|
+
var RunArtifact = Schema13.Struct({
|
|
1914
2001
|
id: Id,
|
|
1915
2002
|
runId: Id,
|
|
1916
|
-
teamId:
|
|
1917
|
-
taskId:
|
|
1918
|
-
step:
|
|
1919
|
-
kind:
|
|
1920
|
-
title:
|
|
1921
|
-
text:
|
|
1922
|
-
data:
|
|
2003
|
+
teamId: Schema13.optionalKey(Id),
|
|
2004
|
+
taskId: Schema13.optionalKey(Id),
|
|
2005
|
+
step: Schema13.String,
|
|
2006
|
+
kind: Schema13.String,
|
|
2007
|
+
title: Schema13.String,
|
|
2008
|
+
text: Schema13.String,
|
|
2009
|
+
data: Schema13.optionalKey(Schema13.Unknown),
|
|
1923
2010
|
createdAt: Timestamp
|
|
1924
2011
|
});
|
|
1925
|
-
var RunArtifactSearch =
|
|
1926
|
-
query:
|
|
1927
|
-
limit:
|
|
2012
|
+
var RunArtifactSearch = Schema13.Struct({
|
|
2013
|
+
query: Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(2000)),
|
|
2014
|
+
limit: Schema13.optionalKey(Schema13.Int.check(Schema13.isGreaterThanOrEqualTo(1), Schema13.isLessThanOrEqualTo(50)))
|
|
1928
2015
|
});
|
|
1929
|
-
var RunArtifactSearchResult =
|
|
2016
|
+
var RunArtifactSearchResult = Schema13.Struct({ items: Schema13.Array(RunArtifact) });
|
|
1930
2017
|
var RunClosureKinds = ["complete", "abandoned"];
|
|
1931
|
-
var RunClosure =
|
|
1932
|
-
kind:
|
|
1933
|
-
reason:
|
|
2018
|
+
var RunClosure = Schema13.Struct({
|
|
2019
|
+
kind: Schema13.Literals(RunClosureKinds),
|
|
2020
|
+
reason: Schema13.optionalKey(Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(2000))),
|
|
1934
2021
|
closedByUserId: Id,
|
|
1935
2022
|
closedAt: Timestamp
|
|
1936
2023
|
});
|
|
1937
|
-
var RunCloseInput =
|
|
1938
|
-
kind:
|
|
1939
|
-
reason:
|
|
2024
|
+
var RunCloseInput = Schema13.Struct({
|
|
2025
|
+
kind: Schema13.Literals(RunClosureKinds),
|
|
2026
|
+
reason: Schema13.optionalKey(Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(2000)))
|
|
1940
2027
|
});
|
|
1941
2028
|
var RunAlignmentVerdicts = ["aligned", "not_aligned", "unverified"];
|
|
1942
|
-
var RunAlignment =
|
|
1943
|
-
verdict:
|
|
1944
|
-
reasons:
|
|
1945
|
-
intentVersion:
|
|
2029
|
+
var RunAlignment = Schema13.Struct({
|
|
2030
|
+
verdict: Schema13.Literals(RunAlignmentVerdicts),
|
|
2031
|
+
reasons: Schema13.Array(Schema13.String),
|
|
2032
|
+
intentVersion: Schema13.Int.check(Schema13.isGreaterThanOrEqualTo(1)),
|
|
1946
2033
|
judgedAt: Timestamp
|
|
1947
2034
|
});
|
|
1948
|
-
var Run =
|
|
2035
|
+
var Run = Schema13.Struct({
|
|
1949
2036
|
id: Id,
|
|
1950
2037
|
workspaceId: Id,
|
|
1951
|
-
teamId:
|
|
1952
|
-
taskId:
|
|
1953
|
-
sessionId:
|
|
2038
|
+
teamId: Schema13.optionalKey(Id),
|
|
2039
|
+
taskId: Schema13.optionalKey(Id),
|
|
2040
|
+
sessionId: Schema13.optionalKey(Id),
|
|
1954
2041
|
loopId: Id,
|
|
1955
|
-
kitVersionId:
|
|
1956
|
-
resourceVersion:
|
|
2042
|
+
kitVersionId: Schema13.optionalKey(Id),
|
|
2043
|
+
resourceVersion: Schema13.Int.check(Schema13.isGreaterThanOrEqualTo(1)),
|
|
1957
2044
|
status: RunStatus,
|
|
1958
2045
|
trigger: RunTrigger,
|
|
1959
2046
|
state: RunState,
|
|
1960
|
-
loopDigest:
|
|
1961
|
-
loopLayer:
|
|
1962
|
-
loopVersion:
|
|
1963
|
-
parentRunId:
|
|
1964
|
-
continuesRunId:
|
|
1965
|
-
waiting:
|
|
1966
|
-
output:
|
|
1967
|
-
failureSummary:
|
|
1968
|
-
closure:
|
|
1969
|
-
alignment:
|
|
1970
|
-
startedAt:
|
|
1971
|
-
completedAt:
|
|
2047
|
+
loopDigest: Schema13.optionalKey(BundleDigest),
|
|
2048
|
+
loopLayer: Schema13.optionalKey(Schema13.Literals(["team", "workspace"])),
|
|
2049
|
+
loopVersion: Schema13.optionalKey(Schema13.String),
|
|
2050
|
+
parentRunId: Schema13.optionalKey(Id),
|
|
2051
|
+
continuesRunId: Schema13.optionalKey(Id),
|
|
2052
|
+
waiting: Schema13.optionalKey(Schema13.Array(RunWaiting)),
|
|
2053
|
+
output: Schema13.optionalKey(Schema13.Unknown),
|
|
2054
|
+
failureSummary: Schema13.optionalKey(Schema13.String),
|
|
2055
|
+
closure: Schema13.optionalKey(RunClosure),
|
|
2056
|
+
alignment: Schema13.optionalKey(RunAlignment),
|
|
2057
|
+
startedAt: Schema13.optionalKey(Timestamp),
|
|
2058
|
+
completedAt: Schema13.optionalKey(Timestamp),
|
|
1972
2059
|
createdAt: Timestamp,
|
|
1973
2060
|
updatedAt: Timestamp
|
|
1974
2061
|
});
|
|
1975
2062
|
var StepAttemptInputKinds = ["kit", "memory", "decision", "knowledge_record", "context_pack"];
|
|
1976
2063
|
var StepAttemptInputScopeKinds = ["workspace", "team", "task", "loop", "agent"];
|
|
1977
|
-
var StepAttemptInputKind =
|
|
1978
|
-
var StepAttemptInputScopeKind =
|
|
1979
|
-
var StepAttemptInputScope =
|
|
2064
|
+
var StepAttemptInputKind = Schema13.Literals(StepAttemptInputKinds);
|
|
2065
|
+
var StepAttemptInputScopeKind = Schema13.Literals(StepAttemptInputScopeKinds);
|
|
2066
|
+
var StepAttemptInputScope = Schema13.Struct({
|
|
1980
2067
|
kind: StepAttemptInputScopeKind,
|
|
1981
2068
|
id: Id
|
|
1982
2069
|
});
|
|
1983
|
-
var StepAttemptInputAvailability =
|
|
1984
|
-
|
|
1985
|
-
kind:
|
|
2070
|
+
var StepAttemptInputAvailability = Schema13.Union([
|
|
2071
|
+
Schema13.Struct({
|
|
2072
|
+
kind: Schema13.Literal("available"),
|
|
1986
2073
|
inspectRef: LoopSafeRef
|
|
1987
2074
|
}),
|
|
1988
|
-
|
|
1989
|
-
kind:
|
|
2075
|
+
Schema13.Struct({
|
|
2076
|
+
kind: Schema13.Union([Schema13.Literal("redacted"), Schema13.Literal("unavailable")]),
|
|
1990
2077
|
reason: LoopSafeText
|
|
1991
2078
|
})
|
|
1992
2079
|
]);
|
|
@@ -1999,243 +2086,244 @@ var StepAttemptInputBase = {
|
|
|
1999
2086
|
appliedToStepKey: LoopSafeKey,
|
|
2000
2087
|
availability: StepAttemptInputAvailability
|
|
2001
2088
|
};
|
|
2002
|
-
var StepAttemptInput =
|
|
2003
|
-
|
|
2089
|
+
var StepAttemptInput = Schema13.Union([
|
|
2090
|
+
Schema13.Struct({
|
|
2004
2091
|
...StepAttemptInputBase,
|
|
2005
|
-
sourceVersion:
|
|
2092
|
+
sourceVersion: Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(240), Schema13.isPattern(new RegExp(LoopSafeReferencePattern, "u")))
|
|
2006
2093
|
}),
|
|
2007
|
-
|
|
2094
|
+
Schema13.Struct({
|
|
2008
2095
|
...StepAttemptInputBase,
|
|
2009
2096
|
contentSha256: LoopSha256
|
|
2010
2097
|
})
|
|
2011
2098
|
]);
|
|
2012
|
-
var StepAttemptInputManifest =
|
|
2013
|
-
manifestVersion:
|
|
2099
|
+
var StepAttemptInputManifest = Schema13.Struct({
|
|
2100
|
+
manifestVersion: Schema13.Int.check(Schema13.isGreaterThanOrEqualTo(1)),
|
|
2014
2101
|
assembledAt: Timestamp,
|
|
2015
|
-
entries:
|
|
2016
|
-
budget:
|
|
2102
|
+
entries: Schema13.Array(StepAttemptInput),
|
|
2103
|
+
budget: Schema13.optionalKey(LoopSafeMetadata)
|
|
2017
2104
|
});
|
|
2018
|
-
var StepAttemptAgent =
|
|
2105
|
+
var StepAttemptAgent = Schema13.Struct({
|
|
2019
2106
|
id: Id,
|
|
2020
|
-
version:
|
|
2107
|
+
version: Schema13.optionalKey(Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(240), Schema13.isPattern(new RegExp(LoopSafeReferencePattern, "u"))))
|
|
2021
2108
|
});
|
|
2022
|
-
var StepAttemptRunner =
|
|
2109
|
+
var StepAttemptRunner = Schema13.Struct({
|
|
2023
2110
|
id: Id,
|
|
2024
|
-
capabilitySnapshot:
|
|
2111
|
+
capabilitySnapshot: Schema13.optionalKey(LoopSafeMetadata)
|
|
2025
2112
|
});
|
|
2026
|
-
var StepAttemptExecutionEnvironment =
|
|
2027
|
-
agent:
|
|
2028
|
-
runner:
|
|
2029
|
-
harness:
|
|
2030
|
-
model:
|
|
2113
|
+
var StepAttemptExecutionEnvironment = Schema13.Struct({
|
|
2114
|
+
agent: Schema13.optionalKey(StepAttemptAgent),
|
|
2115
|
+
runner: Schema13.optionalKey(StepAttemptRunner),
|
|
2116
|
+
harness: Schema13.optionalKey(LoopSafeReferenceString),
|
|
2117
|
+
model: Schema13.optionalKey(LoopSafeReferenceString),
|
|
2031
2118
|
metadata: LoopSafeMetadata
|
|
2032
2119
|
});
|
|
2033
|
-
var StepAttemptLease =
|
|
2120
|
+
var StepAttemptLease = Schema13.Struct({
|
|
2034
2121
|
ownerId: Id,
|
|
2035
|
-
runnerReplicaId:
|
|
2122
|
+
runnerReplicaId: Schema13.optionalKey(Id),
|
|
2036
2123
|
leaseId: Id,
|
|
2037
2124
|
fencingToken: LoopSafeReferenceString,
|
|
2038
|
-
capacitySlot:
|
|
2125
|
+
capacitySlot: Schema13.optionalKey(LoopSafeReferenceString),
|
|
2039
2126
|
expiresAt: Timestamp,
|
|
2040
|
-
lastHeartbeatAt:
|
|
2127
|
+
lastHeartbeatAt: Schema13.optionalKey(Timestamp)
|
|
2041
2128
|
});
|
|
2042
|
-
var JsonDocumentObject =
|
|
2043
|
-
var StepBrief =
|
|
2129
|
+
var JsonDocumentObject = Schema13.JsonObject;
|
|
2130
|
+
var StepBrief = Schema13.Struct({
|
|
2044
2131
|
stepAttemptId: Id,
|
|
2045
|
-
harness:
|
|
2046
|
-
model:
|
|
2047
|
-
effort:
|
|
2048
|
-
prompt:
|
|
2049
|
-
contextPack:
|
|
2050
|
-
contextPackId:
|
|
2051
|
-
mode:
|
|
2052
|
-
contentMarkdown:
|
|
2132
|
+
harness: Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(80)),
|
|
2133
|
+
model: Schema13.optionalKey(Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(200))),
|
|
2134
|
+
effort: Schema13.optionalKey(Schema13.Literals(AgentEfforts)),
|
|
2135
|
+
prompt: Schema13.String.check(Schema13.isMinLength(1)),
|
|
2136
|
+
contextPack: Schema13.optionalKey(Schema13.Struct({
|
|
2137
|
+
contextPackId: Schema13.optionalKey(Id),
|
|
2138
|
+
mode: Schema13.String.check(Schema13.isMinLength(1)),
|
|
2139
|
+
contentMarkdown: Schema13.String.check(Schema13.isMinLength(1))
|
|
2053
2140
|
})),
|
|
2054
2141
|
outputSchema: JsonDocumentObject,
|
|
2055
|
-
kits:
|
|
2056
|
-
name:
|
|
2057
|
-
version:
|
|
2058
|
-
setupDigest:
|
|
2142
|
+
kits: Schema13.optionalKey(Schema13.Array(Schema13.Struct({
|
|
2143
|
+
name: Schema13.String.check(Schema13.isMinLength(1)),
|
|
2144
|
+
version: Schema13.String.check(Schema13.isMinLength(1)),
|
|
2145
|
+
setupDigest: Schema13.String.check(Schema13.isPattern(/^[a-f0-9]{64}$/u))
|
|
2059
2146
|
}))),
|
|
2060
|
-
toolless:
|
|
2061
|
-
tools:
|
|
2062
|
-
listedSkills:
|
|
2147
|
+
toolless: Schema13.optionalKey(Schema13.Literal(true)),
|
|
2148
|
+
tools: Schema13.optionalKey(Schema13.Array(Schema13.Literals(AgentCapabilities))),
|
|
2149
|
+
listedSkills: Schema13.optionalKey(Schema13.Array(Schema13.String.check(Schema13.isMinLength(1))))
|
|
2063
2150
|
});
|
|
2064
|
-
var StepOutputSubmission =
|
|
2065
|
-
var StepSessionUpdate =
|
|
2066
|
-
kind:
|
|
2067
|
-
content:
|
|
2151
|
+
var StepOutputSubmission = Schema13.Struct({ output: JsonDocumentObject });
|
|
2152
|
+
var StepSessionUpdate = Schema13.Struct({
|
|
2153
|
+
kind: Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(80)),
|
|
2154
|
+
content: Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(4000))
|
|
2068
2155
|
});
|
|
2069
|
-
var StepAttemptSessionUpdate =
|
|
2156
|
+
var StepAttemptSessionUpdate = Schema13.Struct({
|
|
2070
2157
|
id: Id,
|
|
2071
|
-
kind:
|
|
2072
|
-
content:
|
|
2158
|
+
kind: Schema13.String,
|
|
2159
|
+
content: Schema13.String,
|
|
2073
2160
|
createdAt: Timestamp
|
|
2074
2161
|
});
|
|
2075
|
-
var StepAttemptSessionUpdateList =
|
|
2076
|
-
items:
|
|
2077
|
-
next:
|
|
2162
|
+
var StepAttemptSessionUpdateList = Schema13.Struct({
|
|
2163
|
+
items: Schema13.Array(StepAttemptSessionUpdate),
|
|
2164
|
+
next: Schema13.optionalKey(Schema13.String)
|
|
2078
2165
|
});
|
|
2079
|
-
var StepOutputSubmissionResult = Schema12.Union([
|
|
2080
|
-
Schema12.Struct({ status: Schema12.Literal("accepted") }),
|
|
2081
|
-
Schema12.Struct({
|
|
2082
|
-
status: Schema12.Literal("rejected"),
|
|
2083
|
-
message: Schema12.String,
|
|
2084
|
-
submissionsLeft: Schema12.Int.check(Schema12.isGreaterThanOrEqualTo(0))
|
|
2085
|
-
}),
|
|
2086
|
-
Schema12.Struct({ status: Schema12.Literal("failed"), message: Schema12.String })
|
|
2087
|
-
]);
|
|
2088
2166
|
var HarnessHoldReasons = ["out_of_quota", "rate_limited", "login_refused", "failed_to_start"];
|
|
2089
2167
|
var SkippedChoiceReasons = ["not_on_runner", ...HarnessHoldReasons];
|
|
2090
|
-
var SkippedChoice =
|
|
2091
|
-
harness:
|
|
2092
|
-
model:
|
|
2093
|
-
effort:
|
|
2094
|
-
reason:
|
|
2095
|
-
until:
|
|
2096
|
-
});
|
|
2097
|
-
var StepAttempt =
|
|
2168
|
+
var SkippedChoice = Schema13.Struct({
|
|
2169
|
+
harness: Schema13.optionalKey(Schema13.String),
|
|
2170
|
+
model: Schema13.optionalKey(Schema13.String),
|
|
2171
|
+
effort: Schema13.optionalKey(Schema13.Literals(AgentEfforts)),
|
|
2172
|
+
reason: Schema13.Literals(SkippedChoiceReasons),
|
|
2173
|
+
until: Schema13.optionalKey(Timestamp)
|
|
2174
|
+
});
|
|
2175
|
+
var StepAttempt = Schema13.Struct({
|
|
2098
2176
|
id: Id,
|
|
2099
2177
|
workspaceId: Id,
|
|
2100
|
-
teamId:
|
|
2101
|
-
taskId:
|
|
2102
|
-
sessionId:
|
|
2178
|
+
teamId: Schema13.optionalKey(Id),
|
|
2179
|
+
taskId: Schema13.optionalKey(Id),
|
|
2180
|
+
sessionId: Schema13.optionalKey(Id),
|
|
2103
2181
|
runId: Id,
|
|
2104
|
-
stepSnapshotId:
|
|
2105
|
-
stepKey:
|
|
2106
|
-
sequence:
|
|
2107
|
-
required:
|
|
2108
|
-
attempt:
|
|
2109
|
-
retryOfAttemptId:
|
|
2182
|
+
stepSnapshotId: Schema13.optionalKey(Id),
|
|
2183
|
+
stepKey: Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(240)),
|
|
2184
|
+
sequence: Schema13.Int.check(Schema13.isGreaterThanOrEqualTo(0)),
|
|
2185
|
+
required: Schema13.Boolean,
|
|
2186
|
+
attempt: Schema13.Int.check(Schema13.isGreaterThanOrEqualTo(1)),
|
|
2187
|
+
retryOfAttemptId: Schema13.optionalKey(Id),
|
|
2110
2188
|
status: StepAttemptStatus,
|
|
2111
2189
|
inputManifest: StepAttemptInputManifest,
|
|
2112
2190
|
execution: StepAttemptExecutionEnvironment,
|
|
2113
|
-
output:
|
|
2114
|
-
brief:
|
|
2115
|
-
failureSummary:
|
|
2116
|
-
reviewEvidence:
|
|
2117
|
-
skippedChoices:
|
|
2118
|
-
lease:
|
|
2119
|
-
claimIdempotencyKey:
|
|
2120
|
-
terminalIdempotencyKey:
|
|
2121
|
-
startedAt:
|
|
2122
|
-
completedAt:
|
|
2191
|
+
output: Schema13.optionalKey(LoopStepOutput),
|
|
2192
|
+
brief: Schema13.optionalKey(StepBrief),
|
|
2193
|
+
failureSummary: Schema13.optionalKey(LoopSafeText),
|
|
2194
|
+
reviewEvidence: Schema13.Array(LoopSafeRef),
|
|
2195
|
+
skippedChoices: Schema13.optionalKey(Schema13.Array(SkippedChoice)),
|
|
2196
|
+
lease: Schema13.optionalKey(StepAttemptLease),
|
|
2197
|
+
claimIdempotencyKey: Schema13.optionalKey(LoopSafeReferenceString),
|
|
2198
|
+
terminalIdempotencyKey: Schema13.optionalKey(LoopSafeReferenceString),
|
|
2199
|
+
startedAt: Schema13.optionalKey(Timestamp),
|
|
2200
|
+
completedAt: Schema13.optionalKey(Timestamp),
|
|
2123
2201
|
createdAt: Timestamp,
|
|
2124
2202
|
updatedAt: Timestamp
|
|
2125
2203
|
});
|
|
2126
|
-
var StepAttemptList =
|
|
2127
|
-
var QuestionResponderPolicy =
|
|
2128
|
-
eligibleMemberIds:
|
|
2129
|
-
allowWorkspaceAdmins:
|
|
2130
|
-
});
|
|
2131
|
-
var QuestionAnswer =
|
|
2204
|
+
var StepAttemptList = Schema13.Struct({ items: Schema13.Array(StepAttempt) });
|
|
2205
|
+
var QuestionResponderPolicy = Schema13.Struct({
|
|
2206
|
+
eligibleMemberIds: Schema13.Array(Id).check(Schema13.isMaxLength(100), Schema13.isUnique()),
|
|
2207
|
+
allowWorkspaceAdmins: Schema13.Boolean
|
|
2208
|
+
}).check(Schema13.makeFilter((policy) => policy.eligibleMemberIds.length > 0 || policy.allowWorkspaceAdmins || "someone who may answer"));
|
|
2209
|
+
var QuestionAnswer = Schema13.Struct({
|
|
2132
2210
|
value: LoopSafeText,
|
|
2133
|
-
answeredByUserId:
|
|
2134
|
-
byDefault:
|
|
2211
|
+
answeredByUserId: Schema13.optionalKey(Id),
|
|
2212
|
+
byDefault: Schema13.optionalKey(Schema13.Boolean),
|
|
2135
2213
|
answeredAt: Timestamp,
|
|
2136
|
-
idempotencyKey:
|
|
2214
|
+
idempotencyKey: Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(240))
|
|
2137
2215
|
});
|
|
2138
|
-
var Question =
|
|
2216
|
+
var Question = Schema13.Struct({
|
|
2139
2217
|
id: Id,
|
|
2140
2218
|
workspaceId: Id,
|
|
2141
|
-
teamId:
|
|
2142
|
-
taskId:
|
|
2219
|
+
teamId: Schema13.optionalKey(Id),
|
|
2220
|
+
taskId: Schema13.optionalKey(Id),
|
|
2143
2221
|
runId: Id,
|
|
2144
|
-
stepKey:
|
|
2222
|
+
stepKey: Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(240)),
|
|
2145
2223
|
waitId: Id,
|
|
2146
|
-
taskThreadEntryId:
|
|
2224
|
+
taskThreadEntryId: Schema13.optionalKey(Id),
|
|
2147
2225
|
prompt: QuestionText,
|
|
2148
|
-
options:
|
|
2149
|
-
freeText:
|
|
2150
|
-
optionDescriptions:
|
|
2151
|
-
recommended:
|
|
2152
|
-
recommendationReason:
|
|
2153
|
-
informationOnly:
|
|
2154
|
-
default:
|
|
2155
|
-
defaultAt:
|
|
2226
|
+
options: Schema13.optionalKey(Schema13.Array(QuestionText)),
|
|
2227
|
+
freeText: Schema13.optionalKey(Schema13.Boolean),
|
|
2228
|
+
optionDescriptions: Schema13.optionalKey(Schema13.Record(Schema13.String, QuestionText)),
|
|
2229
|
+
recommended: Schema13.optionalKey(QuestionText),
|
|
2230
|
+
recommendationReason: Schema13.optionalKey(QuestionText),
|
|
2231
|
+
informationOnly: Schema13.optionalKey(Schema13.Boolean),
|
|
2232
|
+
default: Schema13.optionalKey(LoopSafeText),
|
|
2233
|
+
defaultAt: Schema13.optionalKey(Timestamp),
|
|
2156
2234
|
responderPolicy: QuestionResponderPolicy,
|
|
2157
2235
|
status: QuestionStatus,
|
|
2158
|
-
answer:
|
|
2159
|
-
resolutionOutcome:
|
|
2236
|
+
answer: Schema13.optionalKey(QuestionAnswer),
|
|
2237
|
+
resolutionOutcome: Schema13.optionalKey(LoopSafeText),
|
|
2160
2238
|
createdAt: Timestamp,
|
|
2161
2239
|
updatedAt: Timestamp,
|
|
2162
|
-
resolvedAt:
|
|
2163
|
-
});
|
|
2164
|
-
var
|
|
2240
|
+
resolvedAt: Schema13.optionalKey(Timestamp)
|
|
2241
|
+
});
|
|
2242
|
+
var StepOutputSubmissionResult = Schema13.Union([
|
|
2243
|
+
Schema13.Struct({ status: Schema13.Literal("accepted") }),
|
|
2244
|
+
Schema13.Struct({
|
|
2245
|
+
status: Schema13.Literal("rejected"),
|
|
2246
|
+
message: Schema13.String,
|
|
2247
|
+
submissionsLeft: Schema13.Int.check(Schema13.isGreaterThanOrEqualTo(0))
|
|
2248
|
+
}),
|
|
2249
|
+
Schema13.Struct({ status: Schema13.Literal("failed"), message: Schema13.String }),
|
|
2250
|
+
Schema13.Struct({ status: Schema13.Literal("parked"), message: Schema13.String, question: Question })
|
|
2251
|
+
]);
|
|
2252
|
+
var QuestionAnswerCreate = Schema13.Struct({
|
|
2165
2253
|
value: LoopSafeText,
|
|
2166
|
-
idempotencyKey:
|
|
2254
|
+
idempotencyKey: Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(240))
|
|
2167
2255
|
});
|
|
2168
|
-
var QuestionList =
|
|
2169
|
-
var RunLaunchContext =
|
|
2170
|
-
teamId:
|
|
2171
|
-
remoteUrl:
|
|
2172
|
-
repoBindingId:
|
|
2173
|
-
branch:
|
|
2256
|
+
var QuestionList = Schema13.Struct({ items: Schema13.Array(Question) });
|
|
2257
|
+
var RunLaunchContext = Schema13.Struct({
|
|
2258
|
+
teamId: Schema13.optionalKey(Id),
|
|
2259
|
+
remoteUrl: Schema13.optionalKey(Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(2000))),
|
|
2260
|
+
repoBindingId: Schema13.optionalKey(Id),
|
|
2261
|
+
branch: Schema13.optionalKey(Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(255)))
|
|
2174
2262
|
});
|
|
2175
|
-
var RunStart =
|
|
2263
|
+
var RunStart = Schema13.Struct({
|
|
2176
2264
|
workspaceId: Id,
|
|
2177
|
-
loop:
|
|
2178
|
-
words:
|
|
2179
|
-
plainWords:
|
|
2180
|
-
task:
|
|
2181
|
-
teamId:
|
|
2182
|
-
taskTypeId:
|
|
2183
|
-
input:
|
|
2184
|
-
context:
|
|
2185
|
-
devVersionId:
|
|
2186
|
-
constraints:
|
|
2187
|
-
fresh:
|
|
2188
|
-
overrideBlockers:
|
|
2189
|
-
});
|
|
2190
|
-
var RunActionTake =
|
|
2191
|
-
var RunStarted =
|
|
2265
|
+
loop: Schema13.optionalKey(Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(120))),
|
|
2266
|
+
words: Schema13.optionalKey(Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(4000))),
|
|
2267
|
+
plainWords: Schema13.optionalKey(Schema13.Boolean),
|
|
2268
|
+
task: Schema13.optionalKey(Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(200))),
|
|
2269
|
+
teamId: Schema13.optionalKey(Id),
|
|
2270
|
+
taskTypeId: Schema13.optionalKey(Id),
|
|
2271
|
+
input: Schema13.optionalKey(Schema13.Record(Schema13.String, Schema13.Unknown)),
|
|
2272
|
+
context: Schema13.optionalKey(RunLaunchContext),
|
|
2273
|
+
devVersionId: Schema13.optionalKey(Id),
|
|
2274
|
+
constraints: Schema13.optionalKey(Schema13.Array(Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(1000))).check(Schema13.isMaxLength(20))),
|
|
2275
|
+
fresh: Schema13.optionalKey(Schema13.Boolean),
|
|
2276
|
+
overrideBlockers: Schema13.optionalKey(Schema13.Boolean)
|
|
2277
|
+
});
|
|
2278
|
+
var RunActionTake = Schema13.Struct({ overrideBlockers: Schema13.optionalKey(Schema13.Boolean) });
|
|
2279
|
+
var RunStarted = Schema13.Struct({
|
|
2192
2280
|
run: Run,
|
|
2193
|
-
task:
|
|
2194
|
-
inferred:
|
|
2195
|
-
repoBindingId:
|
|
2196
|
-
branch:
|
|
2197
|
-
changeRequestId:
|
|
2198
|
-
trackerKeys:
|
|
2199
|
-
outcome:
|
|
2281
|
+
task: Schema13.optionalKey(Schema13.Struct({ id: Id, taskKey: Schema13.String })),
|
|
2282
|
+
inferred: Schema13.Struct({
|
|
2283
|
+
repoBindingId: Schema13.optionalKey(Id),
|
|
2284
|
+
branch: Schema13.optionalKey(Schema13.String),
|
|
2285
|
+
changeRequestId: Schema13.optionalKey(Id),
|
|
2286
|
+
trackerKeys: Schema13.Array(Schema13.String),
|
|
2287
|
+
outcome: Schema13.optionalKey(Schema13.String)
|
|
2200
2288
|
})
|
|
2201
2289
|
});
|
|
2202
|
-
var RunStepSummary =
|
|
2203
|
-
name:
|
|
2290
|
+
var RunStepSummary = Schema13.Struct({
|
|
2291
|
+
name: Schema13.String,
|
|
2204
2292
|
status: StepAttemptStatus,
|
|
2205
2293
|
startedAt: Timestamp,
|
|
2206
|
-
completedAt:
|
|
2207
|
-
output:
|
|
2208
|
-
attempts:
|
|
2294
|
+
completedAt: Schema13.optionalKey(Timestamp),
|
|
2295
|
+
output: Schema13.optionalKey(Schema13.Unknown),
|
|
2296
|
+
attempts: Schema13.Array(Schema13.Struct({
|
|
2209
2297
|
id: Id,
|
|
2210
|
-
attempt:
|
|
2298
|
+
attempt: Schema13.Int.check(Schema13.isGreaterThanOrEqualTo(1)),
|
|
2211
2299
|
status: StepAttemptStatus,
|
|
2212
|
-
failureSummary:
|
|
2213
|
-
output:
|
|
2214
|
-
revision:
|
|
2300
|
+
failureSummary: Schema13.optionalKey(Schema13.String),
|
|
2301
|
+
output: Schema13.optionalKey(Schema13.Unknown),
|
|
2302
|
+
revision: Schema13.optionalKey(Schema13.String)
|
|
2215
2303
|
}))
|
|
2216
2304
|
});
|
|
2217
2305
|
var RunSteerDeliveries = ["queued", "delivered", "failed"];
|
|
2218
|
-
var RunSteer =
|
|
2306
|
+
var RunSteer = Schema13.Struct({
|
|
2219
2307
|
id: Id,
|
|
2220
2308
|
text: LoopSafeText,
|
|
2221
|
-
delivery:
|
|
2222
|
-
step:
|
|
2309
|
+
delivery: Schema13.Literals(RunSteerDeliveries),
|
|
2310
|
+
step: Schema13.optionalKey(Schema13.String),
|
|
2223
2311
|
createdAt: Timestamp
|
|
2224
2312
|
});
|
|
2225
|
-
var RunSteerInput =
|
|
2313
|
+
var RunSteerInput = Schema13.Struct({
|
|
2226
2314
|
text: LoopSafeText,
|
|
2227
|
-
stepAttemptId:
|
|
2228
|
-
idempotencyKey:
|
|
2315
|
+
stepAttemptId: Schema13.optionalKey(Id),
|
|
2316
|
+
idempotencyKey: Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(240))
|
|
2229
2317
|
});
|
|
2230
|
-
var RunResumeInput =
|
|
2231
|
-
steer:
|
|
2318
|
+
var RunResumeInput = Schema13.Struct({
|
|
2319
|
+
steer: Schema13.optionalKey(Schema13.Struct({
|
|
2232
2320
|
text: LoopSafeText,
|
|
2233
|
-
idempotencyKey:
|
|
2321
|
+
idempotencyKey: Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(240))
|
|
2234
2322
|
}))
|
|
2235
2323
|
});
|
|
2236
|
-
var RunSteerSent =
|
|
2324
|
+
var RunSteerSent = Schema13.Struct({
|
|
2237
2325
|
steer: RunSteer,
|
|
2238
|
-
target:
|
|
2326
|
+
target: Schema13.Literals(["session", "next_step"])
|
|
2239
2327
|
});
|
|
2240
2328
|
var RunDisplayStates = [
|
|
2241
2329
|
"queued",
|
|
@@ -2247,206 +2335,206 @@ var RunDisplayStates = [
|
|
|
2247
2335
|
"succeeded",
|
|
2248
2336
|
"partial"
|
|
2249
2337
|
];
|
|
2250
|
-
var RunDisplay =
|
|
2251
|
-
state:
|
|
2252
|
-
retried:
|
|
2253
|
-
summary:
|
|
2338
|
+
var RunDisplay = Schema13.Struct({
|
|
2339
|
+
state: Schema13.Literals(RunDisplayStates),
|
|
2340
|
+
retried: Schema13.Boolean,
|
|
2341
|
+
summary: Schema13.optionalKey(Schema13.String)
|
|
2254
2342
|
});
|
|
2255
2343
|
var RunGraphNodeKinds = ["agent", "check", "question", "child", "wait", "activity"];
|
|
2256
|
-
var RunGraphNode =
|
|
2344
|
+
var RunGraphNode = Schema13.Struct({
|
|
2257
2345
|
id: Id,
|
|
2258
|
-
name:
|
|
2259
|
-
kind:
|
|
2260
|
-
status:
|
|
2346
|
+
name: Schema13.String,
|
|
2347
|
+
kind: Schema13.Literals(RunGraphNodeKinds),
|
|
2348
|
+
status: Schema13.Literals(RunDisplayStates),
|
|
2261
2349
|
startedAt: Timestamp,
|
|
2262
|
-
endedAt:
|
|
2263
|
-
attempts:
|
|
2350
|
+
endedAt: Schema13.optionalKey(Timestamp),
|
|
2351
|
+
attempts: Schema13.Array(Schema13.Struct({
|
|
2264
2352
|
id: Id,
|
|
2265
|
-
attempt:
|
|
2266
|
-
status:
|
|
2267
|
-
failureSummary:
|
|
2353
|
+
attempt: Schema13.Int.check(Schema13.isGreaterThanOrEqualTo(1)),
|
|
2354
|
+
status: Schema13.Literals(RunDisplayStates),
|
|
2355
|
+
failureSummary: Schema13.optionalKey(Schema13.String)
|
|
2268
2356
|
})),
|
|
2269
|
-
agent:
|
|
2357
|
+
agent: Schema13.optionalKey(Schema13.Struct({
|
|
2270
2358
|
id: Id,
|
|
2271
|
-
harness:
|
|
2272
|
-
model:
|
|
2273
|
-
runner:
|
|
2359
|
+
harness: Schema13.optionalKey(Schema13.String),
|
|
2360
|
+
model: Schema13.optionalKey(Schema13.String),
|
|
2361
|
+
runner: Schema13.optionalKey(Schema13.Struct({ id: Id, name: Schema13.String }))
|
|
2274
2362
|
})),
|
|
2275
|
-
child:
|
|
2363
|
+
child: Schema13.optionalKey(Schema13.Struct({
|
|
2276
2364
|
runId: Id,
|
|
2277
|
-
loopTitle:
|
|
2365
|
+
loopTitle: Schema13.String,
|
|
2278
2366
|
display: RunDisplay,
|
|
2279
|
-
task:
|
|
2367
|
+
task: Schema13.optionalKey(Schema13.Struct({ id: Id, key: Schema13.String, title: Schema13.String }))
|
|
2280
2368
|
}))
|
|
2281
2369
|
});
|
|
2282
|
-
var RunGraph =
|
|
2283
|
-
columns:
|
|
2284
|
-
needs:
|
|
2285
|
-
});
|
|
2286
|
-
var RunHeader =
|
|
2287
|
-
loopTitle:
|
|
2288
|
-
branch:
|
|
2289
|
-
changeRequest:
|
|
2290
|
-
startedBy:
|
|
2291
|
-
|
|
2292
|
-
|
|
2370
|
+
var RunGraph = Schema13.Struct({
|
|
2371
|
+
columns: Schema13.Array(Schema13.Array(RunGraphNode)),
|
|
2372
|
+
needs: Schema13.Array(Schema13.Struct({ from: Id, to: Id }))
|
|
2373
|
+
});
|
|
2374
|
+
var RunHeader = Schema13.Struct({
|
|
2375
|
+
loopTitle: Schema13.String,
|
|
2376
|
+
branch: Schema13.optionalKey(Schema13.String),
|
|
2377
|
+
changeRequest: Schema13.optionalKey(Schema13.Struct({ id: Id, title: Schema13.String, url: Schema13.String })),
|
|
2378
|
+
startedBy: Schema13.optionalKey(Schema13.Union([
|
|
2379
|
+
Schema13.Struct({ kind: Schema13.Literal("person"), name: Schema13.String }),
|
|
2380
|
+
Schema13.Struct({ kind: Schema13.Literal("event"), event: Schema13.String })
|
|
2293
2381
|
]))
|
|
2294
2382
|
});
|
|
2295
|
-
var RunShow =
|
|
2383
|
+
var RunShow = Schema13.Struct({
|
|
2296
2384
|
run: Run,
|
|
2297
2385
|
header: RunHeader,
|
|
2298
2386
|
display: RunDisplay,
|
|
2299
2387
|
graph: RunGraph,
|
|
2300
|
-
steps:
|
|
2301
|
-
questions:
|
|
2302
|
-
children:
|
|
2388
|
+
steps: Schema13.Array(RunStepSummary),
|
|
2389
|
+
questions: Schema13.Array(Question),
|
|
2390
|
+
children: Schema13.Array(Schema13.Struct({
|
|
2303
2391
|
runId: Id,
|
|
2304
|
-
name:
|
|
2392
|
+
name: Schema13.String,
|
|
2305
2393
|
status: RunStatus,
|
|
2306
2394
|
createdAt: Timestamp,
|
|
2307
|
-
unsettled:
|
|
2395
|
+
unsettled: Schema13.optional(Schema13.Array(Schema13.String))
|
|
2308
2396
|
})),
|
|
2309
|
-
activities:
|
|
2310
|
-
name:
|
|
2311
|
-
attempt:
|
|
2312
|
-
status:
|
|
2397
|
+
activities: Schema13.Array(Schema13.Struct({
|
|
2398
|
+
name: Schema13.String,
|
|
2399
|
+
attempt: Schema13.Int.check(Schema13.isGreaterThanOrEqualTo(1)),
|
|
2400
|
+
status: Schema13.Literals(["succeeded", "failed"]),
|
|
2313
2401
|
recordedAt: Timestamp
|
|
2314
2402
|
})),
|
|
2315
|
-
artifacts:
|
|
2316
|
-
findings:
|
|
2317
|
-
events:
|
|
2318
|
-
evidence:
|
|
2319
|
-
steers:
|
|
2320
|
-
waiting:
|
|
2321
|
-
closures:
|
|
2322
|
-
});
|
|
2323
|
-
var RunStartPreview =
|
|
2324
|
-
loop:
|
|
2325
|
-
inputSchema:
|
|
2326
|
-
input:
|
|
2327
|
-
missing:
|
|
2328
|
-
message:
|
|
2329
|
-
waitingOn:
|
|
2330
|
-
teamId:
|
|
2331
|
-
inferred:
|
|
2332
|
-
repoBindingId:
|
|
2333
|
-
branch:
|
|
2334
|
-
changeRequestId:
|
|
2335
|
-
trackerKeys:
|
|
2336
|
-
outcome:
|
|
2403
|
+
artifacts: Schema13.Array(RunArtifact),
|
|
2404
|
+
findings: Schema13.Array(RunArtifact),
|
|
2405
|
+
events: Schema13.Array(Schema13.Struct({ id: Id, type: Schema13.String, occurredAt: Timestamp })),
|
|
2406
|
+
evidence: Schema13.Array(RunEvidence),
|
|
2407
|
+
steers: Schema13.Array(RunSteer),
|
|
2408
|
+
waiting: Schema13.Array(RunWaiting),
|
|
2409
|
+
closures: Schema13.Array(RunClosure)
|
|
2410
|
+
});
|
|
2411
|
+
var RunStartPreview = Schema13.Struct({
|
|
2412
|
+
loop: Schema13.Struct({ id: Schema13.String, title: Schema13.String, outcome: Schema13.optionalKey(Schema13.String) }),
|
|
2413
|
+
inputSchema: Schema13.Record(Schema13.String, Schema13.Unknown),
|
|
2414
|
+
input: Schema13.Record(Schema13.String, Schema13.Unknown),
|
|
2415
|
+
missing: Schema13.Array(Schema13.String),
|
|
2416
|
+
message: Schema13.optionalKey(Schema13.String),
|
|
2417
|
+
waitingOn: Schema13.optionalKey(WaitingOn),
|
|
2418
|
+
teamId: Schema13.optionalKey(Id),
|
|
2419
|
+
inferred: Schema13.Struct({
|
|
2420
|
+
repoBindingId: Schema13.optionalKey(Id),
|
|
2421
|
+
branch: Schema13.optionalKey(Schema13.String),
|
|
2422
|
+
changeRequestId: Schema13.optionalKey(Id),
|
|
2423
|
+
trackerKeys: Schema13.Array(Schema13.String),
|
|
2424
|
+
outcome: Schema13.optionalKey(Schema13.String)
|
|
2337
2425
|
})
|
|
2338
2426
|
});
|
|
2339
|
-
var LoopVersion =
|
|
2340
|
-
var ProgramLoop =
|
|
2341
|
-
id:
|
|
2342
|
-
title:
|
|
2343
|
-
version:
|
|
2344
|
-
layer:
|
|
2345
|
-
digest:
|
|
2346
|
-
outcome:
|
|
2347
|
-
offers:
|
|
2348
|
-
id:
|
|
2349
|
-
title:
|
|
2350
|
-
loop:
|
|
2351
|
-
from:
|
|
2427
|
+
var LoopVersion = Schema13.String.check(Schema13.isPattern(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/));
|
|
2428
|
+
var ProgramLoop = Schema13.Struct({
|
|
2429
|
+
id: Schema13.String,
|
|
2430
|
+
title: Schema13.String,
|
|
2431
|
+
version: Schema13.optionalKey(LoopVersion),
|
|
2432
|
+
layer: Schema13.Literals(["team", "workspace"]),
|
|
2433
|
+
digest: Schema13.String,
|
|
2434
|
+
outcome: Schema13.optionalKey(Schema13.String),
|
|
2435
|
+
offers: Schema13.Array(Schema13.Struct({
|
|
2436
|
+
id: Schema13.String,
|
|
2437
|
+
title: Schema13.String,
|
|
2438
|
+
loop: Schema13.String,
|
|
2439
|
+
from: Schema13.optionalKey(Schema13.String)
|
|
2352
2440
|
})),
|
|
2353
2441
|
publishedAt: Timestamp,
|
|
2354
|
-
kit:
|
|
2355
|
-
});
|
|
2356
|
-
var AutomaticStart =
|
|
2357
|
-
eventId:
|
|
2358
|
-
eventType:
|
|
2359
|
-
teamId:
|
|
2360
|
-
loop:
|
|
2361
|
-
runId:
|
|
2362
|
-
rejection:
|
|
2363
|
-
at:
|
|
2364
|
-
});
|
|
2365
|
-
var AutomaticStartList =
|
|
2366
|
-
var AgentFallback =
|
|
2367
|
-
harness:
|
|
2368
|
-
model:
|
|
2369
|
-
effort:
|
|
2370
|
-
});
|
|
2371
|
-
var ProgramAgent =
|
|
2372
|
-
id:
|
|
2373
|
-
layer:
|
|
2374
|
-
kit:
|
|
2375
|
-
extends:
|
|
2376
|
-
instructions:
|
|
2377
|
-
harness:
|
|
2378
|
-
model:
|
|
2379
|
-
effort:
|
|
2380
|
-
fallbacks:
|
|
2381
|
-
tools:
|
|
2382
|
-
skills:
|
|
2383
|
-
network:
|
|
2384
|
-
sandbox:
|
|
2385
|
-
fieldLayers:
|
|
2386
|
-
instructions:
|
|
2387
|
-
harness:
|
|
2388
|
-
model:
|
|
2389
|
-
effort:
|
|
2390
|
-
fallbacks:
|
|
2391
|
-
tools:
|
|
2392
|
-
skills:
|
|
2393
|
-
network:
|
|
2394
|
-
sandbox:
|
|
2442
|
+
kit: Schema13.String
|
|
2443
|
+
});
|
|
2444
|
+
var AutomaticStart = Schema13.Struct({
|
|
2445
|
+
eventId: Schema13.String,
|
|
2446
|
+
eventType: Schema13.String,
|
|
2447
|
+
teamId: Schema13.Union([Schema13.String, Schema13.Null]),
|
|
2448
|
+
loop: Schema13.String,
|
|
2449
|
+
runId: Schema13.optionalKey(Schema13.String),
|
|
2450
|
+
rejection: Schema13.optionalKey(Schema13.String),
|
|
2451
|
+
at: Schema13.String
|
|
2452
|
+
});
|
|
2453
|
+
var AutomaticStartList = Schema13.Struct({ items: Schema13.Array(AutomaticStart) });
|
|
2454
|
+
var AgentFallback = Schema13.Struct({
|
|
2455
|
+
harness: Schema13.String,
|
|
2456
|
+
model: Schema13.optionalKey(Schema13.String),
|
|
2457
|
+
effort: Schema13.optionalKey(Schema13.Literals(AgentEfforts))
|
|
2458
|
+
});
|
|
2459
|
+
var ProgramAgent = Schema13.Struct({
|
|
2460
|
+
id: Schema13.String,
|
|
2461
|
+
layer: Schema13.Literals(["team", "workspace"]),
|
|
2462
|
+
kit: Schema13.String,
|
|
2463
|
+
extends: Schema13.optionalKey(Schema13.String),
|
|
2464
|
+
instructions: Schema13.optionalKey(Schema13.String),
|
|
2465
|
+
harness: Schema13.optionalKey(Schema13.String),
|
|
2466
|
+
model: Schema13.optionalKey(Schema13.String),
|
|
2467
|
+
effort: Schema13.optionalKey(Schema13.Literals(AgentEfforts)),
|
|
2468
|
+
fallbacks: Schema13.optionalKey(Schema13.Array(AgentFallback)),
|
|
2469
|
+
tools: Schema13.optionalKey(Schema13.Array(Schema13.Literals(AgentCapabilities))),
|
|
2470
|
+
skills: Schema13.optionalKey(Schema13.Array(Schema13.String)),
|
|
2471
|
+
network: Schema13.optionalKey(AgentSandboxNetwork),
|
|
2472
|
+
sandbox: Schema13.optionalKey(Schema13.Literal("docker")),
|
|
2473
|
+
fieldLayers: Schema13.optionalKey(Schema13.Struct({
|
|
2474
|
+
instructions: Schema13.optionalKey(Schema13.Literals(LoopLayers)),
|
|
2475
|
+
harness: Schema13.optionalKey(Schema13.Literals(LoopLayers)),
|
|
2476
|
+
model: Schema13.optionalKey(Schema13.Literals(LoopLayers)),
|
|
2477
|
+
effort: Schema13.optionalKey(Schema13.Literals(LoopLayers)),
|
|
2478
|
+
fallbacks: Schema13.optionalKey(Schema13.Literals(LoopLayers)),
|
|
2479
|
+
tools: Schema13.optionalKey(Schema13.Literals(LoopLayers)),
|
|
2480
|
+
skills: Schema13.optionalKey(Schema13.Literals(LoopLayers)),
|
|
2481
|
+
network: Schema13.optionalKey(Schema13.Literals(LoopLayers)),
|
|
2482
|
+
sandbox: Schema13.optionalKey(Schema13.Literals(LoopLayers))
|
|
2395
2483
|
}))
|
|
2396
2484
|
});
|
|
2397
|
-
var ProgramAgentList =
|
|
2398
|
-
var ProgramLoopList =
|
|
2399
|
-
var RunListItem =
|
|
2485
|
+
var ProgramAgentList = Schema13.Struct({ items: Schema13.Array(ProgramAgent) });
|
|
2486
|
+
var ProgramLoopList = Schema13.Struct({ items: Schema13.Array(ProgramLoop) });
|
|
2487
|
+
var RunListItem = Schema13.Struct({
|
|
2400
2488
|
run: Run,
|
|
2401
|
-
loop:
|
|
2402
|
-
task:
|
|
2489
|
+
loop: Schema13.Struct({ id: Schema13.String, title: Schema13.String }),
|
|
2490
|
+
task: Schema13.optionalKey(Schema13.Struct({ id: Id, key: Schema13.String, title: Schema13.String })),
|
|
2403
2491
|
display: RunDisplay,
|
|
2404
|
-
miniGraph:
|
|
2492
|
+
miniGraph: Schema13.Array(Schema13.Literals(RunDisplayStates))
|
|
2405
2493
|
});
|
|
2406
|
-
var RunList =
|
|
2407
|
-
items:
|
|
2408
|
-
next:
|
|
2494
|
+
var RunList = Schema13.Struct({
|
|
2495
|
+
items: Schema13.Array(RunListItem),
|
|
2496
|
+
next: Schema13.optionalKey(Schema13.String)
|
|
2409
2497
|
});
|
|
2410
2498
|
var RunWaitReasons = ["question", "completed", "failed", "stopped", "timeout"];
|
|
2411
|
-
var RunWaitResult =
|
|
2412
|
-
reason:
|
|
2499
|
+
var RunWaitResult = Schema13.Struct({
|
|
2500
|
+
reason: Schema13.Literals(RunWaitReasons),
|
|
2413
2501
|
run: Run,
|
|
2414
|
-
questions:
|
|
2502
|
+
questions: Schema13.Array(Question)
|
|
2415
2503
|
});
|
|
2416
|
-
var RunAnswer =
|
|
2504
|
+
var RunAnswer = Schema13.Struct({
|
|
2417
2505
|
value: LoopSafeText,
|
|
2418
|
-
question:
|
|
2419
|
-
idempotencyKey:
|
|
2506
|
+
question: Schema13.optionalKey(Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(200))),
|
|
2507
|
+
idempotencyKey: Schema13.String.check(Schema13.isMinLength(1), Schema13.isMaxLength(240))
|
|
2420
2508
|
});
|
|
2421
2509
|
var RunActionKinds = ["offer", "stop", "resume"];
|
|
2422
|
-
var RunActionSummary =
|
|
2423
|
-
id:
|
|
2424
|
-
title:
|
|
2425
|
-
kind:
|
|
2426
|
-
loop:
|
|
2427
|
-
});
|
|
2428
|
-
var RunActionList =
|
|
2429
|
-
var RunActionTaken =
|
|
2510
|
+
var RunActionSummary = Schema13.Struct({
|
|
2511
|
+
id: Schema13.String.check(Schema13.isMinLength(1)),
|
|
2512
|
+
title: Schema13.String,
|
|
2513
|
+
kind: Schema13.Literals(RunActionKinds),
|
|
2514
|
+
loop: Schema13.optionalKey(Schema13.String)
|
|
2515
|
+
});
|
|
2516
|
+
var RunActionList = Schema13.Struct({ items: Schema13.Array(RunActionSummary) });
|
|
2517
|
+
var RunActionTaken = Schema13.Struct({ action: Schema13.String, run: Run });
|
|
2430
2518
|
|
|
2431
2519
|
// packages/core/src/schedule.ts
|
|
2432
|
-
import * as
|
|
2520
|
+
import * as Schema14 from "effect/Schema";
|
|
2433
2521
|
import * as DateTime from "effect/DateTime";
|
|
2434
2522
|
import * as Option from "effect/Option";
|
|
2435
2523
|
var ScheduleFrequency = ["daily", "weekly"];
|
|
2436
2524
|
var ScheduleMisfirePolicies = ["skip", "fire_once", "catch_up"];
|
|
2437
2525
|
var ScheduleOverlapPolicies = ["allow", "skip", "coalesce"];
|
|
2438
2526
|
var ScheduleVersionStatuses = ["draft", "published", "disabled", "archived"];
|
|
2439
|
-
var ScheduleCalendarRule =
|
|
2440
|
-
frequency:
|
|
2441
|
-
hour:
|
|
2442
|
-
minute:
|
|
2443
|
-
second:
|
|
2444
|
-
daysOfWeek:
|
|
2527
|
+
var ScheduleCalendarRule = Schema14.Struct({
|
|
2528
|
+
frequency: Schema14.Literals(ScheduleFrequency),
|
|
2529
|
+
hour: Schema14.Int.check(Schema14.isGreaterThanOrEqualTo(0), Schema14.isLessThanOrEqualTo(23)),
|
|
2530
|
+
minute: Schema14.Int.check(Schema14.isGreaterThanOrEqualTo(0), Schema14.isLessThanOrEqualTo(59)),
|
|
2531
|
+
second: Schema14.optionalKey(Schema14.Int.check(Schema14.isGreaterThanOrEqualTo(0), Schema14.isLessThanOrEqualTo(59))),
|
|
2532
|
+
daysOfWeek: Schema14.optionalKey(Schema14.Array(Schema14.Int.check(Schema14.isGreaterThanOrEqualTo(0), Schema14.isLessThanOrEqualTo(6))).check(Schema14.isMinLength(1), Schema14.isMaxLength(7)))
|
|
2445
2533
|
});
|
|
2446
|
-
var ScheduleCronRule =
|
|
2447
|
-
cron:
|
|
2534
|
+
var ScheduleCronRule = Schema14.Struct({
|
|
2535
|
+
cron: Schema14.String.check(Schema14.isMinLength(9), Schema14.isMaxLength(200), Schema14.isPattern(new RegExp("^[0-9*,/-]+( [0-9*,/-]+){4}$", "u")))
|
|
2448
2536
|
});
|
|
2449
|
-
var ScheduleRule =
|
|
2537
|
+
var ScheduleRule = Schema14.Union([ScheduleCalendarRule, ScheduleCronRule]);
|
|
2450
2538
|
var cronBounds = [
|
|
2451
2539
|
[0, 59],
|
|
2452
2540
|
[0, 23],
|
|
@@ -2488,25 +2576,25 @@ function parseCron(cron) {
|
|
|
2488
2576
|
function isScheduleRule(value) {
|
|
2489
2577
|
return guard(ScheduleRule)(value) && (!("cron" in value) || parseCron(value.cron) !== undefined);
|
|
2490
2578
|
}
|
|
2491
|
-
var ScheduleVersion =
|
|
2492
|
-
contractVersion:
|
|
2493
|
-
id:
|
|
2494
|
-
scheduleId:
|
|
2495
|
-
workspaceId:
|
|
2496
|
-
teamId:
|
|
2497
|
-
loopId:
|
|
2498
|
-
name:
|
|
2499
|
-
version:
|
|
2500
|
-
status:
|
|
2501
|
-
timezone:
|
|
2579
|
+
var ScheduleVersion = Schema14.Struct({
|
|
2580
|
+
contractVersion: Schema14.Literal("schedule.v1"),
|
|
2581
|
+
id: Schema14.String.check(Schema14.isMinLength(1)),
|
|
2582
|
+
scheduleId: Schema14.String.check(Schema14.isMinLength(1)),
|
|
2583
|
+
workspaceId: Schema14.String.check(Schema14.isMinLength(1)),
|
|
2584
|
+
teamId: Schema14.optionalKey(Schema14.String.check(Schema14.isMinLength(1))),
|
|
2585
|
+
loopId: Schema14.optionalKey(Schema14.String.check(Schema14.isMinLength(1))),
|
|
2586
|
+
name: Schema14.optionalKey(Schema14.String.check(Schema14.isMinLength(1), Schema14.isMaxLength(200))),
|
|
2587
|
+
version: Schema14.Int.check(Schema14.isGreaterThanOrEqualTo(1)),
|
|
2588
|
+
status: Schema14.Literals(ScheduleVersionStatuses),
|
|
2589
|
+
timezone: Schema14.String.check(Schema14.isMinLength(1), Schema14.isMaxLength(80)),
|
|
2502
2590
|
rule: ScheduleRule,
|
|
2503
|
-
misfirePolicy:
|
|
2504
|
-
overlapPolicy:
|
|
2505
|
-
maxCatchUp:
|
|
2506
|
-
misfireGraceSeconds:
|
|
2507
|
-
inputSchemaRef:
|
|
2508
|
-
input:
|
|
2509
|
-
createdAt:
|
|
2591
|
+
misfirePolicy: Schema14.Literals(ScheduleMisfirePolicies),
|
|
2592
|
+
overlapPolicy: Schema14.Literals(ScheduleOverlapPolicies),
|
|
2593
|
+
maxCatchUp: Schema14.Int.check(Schema14.isGreaterThanOrEqualTo(0), Schema14.isLessThanOrEqualTo(200)),
|
|
2594
|
+
misfireGraceSeconds: Schema14.optionalKey(Schema14.Int.check(Schema14.isGreaterThanOrEqualTo(0), Schema14.isLessThanOrEqualTo(604800))),
|
|
2595
|
+
inputSchemaRef: Schema14.optionalKey(LoopDataSchemaRef),
|
|
2596
|
+
input: Schema14.optionalKey(SafeJson),
|
|
2597
|
+
createdAt: Schema14.String.check(Schema14.isMinLength(1))
|
|
2510
2598
|
});
|
|
2511
2599
|
var zones = new Map;
|
|
2512
2600
|
var resolvedLocalDateTimes = new Map;
|
|
@@ -2532,102 +2620,102 @@ var LoopCapabilities2 = [
|
|
|
2532
2620
|
"read_project",
|
|
2533
2621
|
"draft_update"
|
|
2534
2622
|
];
|
|
2535
|
-
var JsonObject2 =
|
|
2536
|
-
var
|
|
2537
|
-
var EventFilterValue =
|
|
2538
|
-
var LoopManifest =
|
|
2539
|
-
id:
|
|
2540
|
-
title:
|
|
2541
|
-
version:
|
|
2623
|
+
var JsonObject2 = Schema15.Record(Schema15.String, Schema15.Json);
|
|
2624
|
+
var SecretName2 = Schema15.String.check(Schema15.isPattern(/^[A-Za-z_][A-Za-z0-9_]{0,127}$/));
|
|
2625
|
+
var EventFilterValue = Schema15.Union([Schema15.String, Schema15.Finite, Schema15.Boolean, Schema15.Null]);
|
|
2626
|
+
var LoopManifest = Schema15.Struct({
|
|
2627
|
+
id: Schema15.String,
|
|
2628
|
+
title: Schema15.String,
|
|
2629
|
+
version: Schema15.optionalKey(LoopVersion),
|
|
2542
2630
|
input: JsonObject2,
|
|
2543
2631
|
output: JsonObject2,
|
|
2544
|
-
outcome:
|
|
2545
|
-
agents:
|
|
2546
|
-
checkout:
|
|
2547
|
-
when:
|
|
2548
|
-
event:
|
|
2549
|
-
filter:
|
|
2550
|
-
input:
|
|
2551
|
-
values:
|
|
2632
|
+
outcome: Schema15.optionalKey(Schema15.Literals(["feature", "bug", "refactor", "investigation", "docs", "migration", "performance"])),
|
|
2633
|
+
agents: Schema15.Record(Schema15.String, Schema15.String),
|
|
2634
|
+
checkout: Schema15.Literals(["none", "read", "write"]),
|
|
2635
|
+
when: Schema15.Array(Schema15.Struct({
|
|
2636
|
+
event: Schema15.String,
|
|
2637
|
+
filter: Schema15.optionalKey(Schema15.Record(Schema15.String, Schema15.Union([EventFilterValue, Schema15.Array(EventFilterValue)]))),
|
|
2638
|
+
input: Schema15.Record(Schema15.String, Schema15.String),
|
|
2639
|
+
values: Schema15.optionalKey(JsonObject2)
|
|
2552
2640
|
})),
|
|
2553
|
-
offers:
|
|
2554
|
-
id:
|
|
2555
|
-
title:
|
|
2556
|
-
loop:
|
|
2557
|
-
from:
|
|
2641
|
+
offers: Schema15.Array(Schema15.Struct({
|
|
2642
|
+
id: Schema15.String,
|
|
2643
|
+
title: Schema15.String,
|
|
2644
|
+
loop: Schema15.String,
|
|
2645
|
+
from: Schema15.optionalKey(Schema15.String)
|
|
2558
2646
|
})),
|
|
2559
|
-
capabilities:
|
|
2560
|
-
secrets:
|
|
2561
|
-
network:
|
|
2562
|
-
schedule:
|
|
2563
|
-
});
|
|
2564
|
-
var LoopDetail =
|
|
2565
|
-
id:
|
|
2566
|
-
resolved:
|
|
2647
|
+
capabilities: Schema15.Array(Schema15.Literals(LoopCapabilities2)),
|
|
2648
|
+
secrets: Schema15.optionalKey(Schema15.Array(SecretName2)),
|
|
2649
|
+
network: Schema15.optionalKey(AgentSandboxNetwork),
|
|
2650
|
+
schedule: Schema15.optionalKey(Schema15.Struct({ rule: ScheduleRule, timezone: Schema15.String }))
|
|
2651
|
+
});
|
|
2652
|
+
var LoopDetail = Schema15.Struct({
|
|
2653
|
+
id: Schema15.String,
|
|
2654
|
+
resolved: Schema15.optionalKey(Schema15.Struct({
|
|
2567
2655
|
...ProgramLoop.fields,
|
|
2568
2656
|
agents: LoopManifest.fields.agents,
|
|
2569
2657
|
when: LoopManifest.fields.when,
|
|
2570
|
-
schedule:
|
|
2658
|
+
schedule: Schema15.optionalKey(Schema15.Struct({
|
|
2571
2659
|
rule: ScheduleRule,
|
|
2572
|
-
timezone:
|
|
2573
|
-
on:
|
|
2574
|
-
nextRunAt:
|
|
2660
|
+
timezone: Schema15.String,
|
|
2661
|
+
on: Schema15.Boolean,
|
|
2662
|
+
nextRunAt: Schema15.optionalKey(Schema15.String)
|
|
2575
2663
|
}))
|
|
2576
2664
|
}))
|
|
2577
2665
|
});
|
|
2578
|
-
var AgentDeclaration =
|
|
2579
|
-
extends:
|
|
2580
|
-
instructions:
|
|
2581
|
-
harness:
|
|
2582
|
-
model:
|
|
2583
|
-
effort:
|
|
2584
|
-
fallbacks:
|
|
2585
|
-
tools:
|
|
2586
|
-
skills:
|
|
2587
|
-
network:
|
|
2588
|
-
sandbox:
|
|
2666
|
+
var AgentDeclaration = Schema15.Struct({
|
|
2667
|
+
extends: Schema15.optionalKey(Schema15.String),
|
|
2668
|
+
instructions: Schema15.optionalKey(Schema15.String),
|
|
2669
|
+
harness: Schema15.optionalKey(Schema15.String),
|
|
2670
|
+
model: Schema15.optionalKey(Schema15.String),
|
|
2671
|
+
effort: Schema15.optionalKey(Schema15.Literals(AgentEfforts)),
|
|
2672
|
+
fallbacks: Schema15.optionalKey(Schema15.Array(AgentFallback)),
|
|
2673
|
+
tools: Schema15.optionalKey(Schema15.Array(Schema15.Literals(AgentCapabilities))),
|
|
2674
|
+
skills: Schema15.optionalKey(Schema15.Array(Schema15.String.check(Schema15.isMinLength(1)))),
|
|
2675
|
+
network: Schema15.optionalKey(Schema15.Union([Schema15.Struct({ hosts: Schema15.Array(Schema15.String) }), Schema15.Literal("open")])),
|
|
2676
|
+
sandbox: Schema15.optionalKey(Schema15.Literal("docker"))
|
|
2589
2677
|
});
|
|
2590
2678
|
var scheduleFields = {
|
|
2591
|
-
name:
|
|
2592
|
-
loop:
|
|
2593
|
-
team:
|
|
2594
|
-
input:
|
|
2595
|
-
timezone:
|
|
2596
|
-
misfire:
|
|
2597
|
-
overlap:
|
|
2679
|
+
name: Schema15.String.check(Schema15.isMinLength(1)),
|
|
2680
|
+
loop: Schema15.String,
|
|
2681
|
+
team: Schema15.optionalKey(Schema15.String),
|
|
2682
|
+
input: Schema15.optionalKey(JsonObject2),
|
|
2683
|
+
timezone: Schema15.String,
|
|
2684
|
+
misfire: Schema15.optionalKey(Schema15.Literals(ScheduleMisfirePolicies)),
|
|
2685
|
+
overlap: Schema15.optionalKey(Schema15.Literals(ScheduleOverlapPolicies))
|
|
2598
2686
|
};
|
|
2599
|
-
var ScheduleDeclaration =
|
|
2600
|
-
|
|
2687
|
+
var ScheduleDeclaration = Schema15.Union([
|
|
2688
|
+
Schema15.Struct({
|
|
2601
2689
|
...scheduleFields,
|
|
2602
|
-
cron:
|
|
2690
|
+
cron: Schema15.String.check(Schema15.makeFilter((cron) => isScheduleRule({ cron }) || "five cron fields, each within its range"))
|
|
2603
2691
|
}),
|
|
2604
|
-
|
|
2692
|
+
Schema15.Struct({
|
|
2605
2693
|
...scheduleFields,
|
|
2606
|
-
rule:
|
|
2694
|
+
rule: Schema15.declare((value) => isScheduleRule(value), {
|
|
2607
2695
|
expected: "a Schedule rule: frequency daily or weekly, hour, minute, and optionally second and daysOfWeek"
|
|
2608
2696
|
})
|
|
2609
2697
|
})
|
|
2610
2698
|
]);
|
|
2611
|
-
var CarriedKit =
|
|
2699
|
+
var CarriedKit = Schema15.Struct({
|
|
2612
2700
|
name: KitName,
|
|
2613
|
-
version:
|
|
2701
|
+
version: Schema15.String.check(Schema15.isMinLength(1)),
|
|
2614
2702
|
setup: KitDigest,
|
|
2615
|
-
loops:
|
|
2616
|
-
agents:
|
|
2703
|
+
loops: Schema15.Array(Schema15.String),
|
|
2704
|
+
agents: Schema15.Array(Schema15.String)
|
|
2617
2705
|
});
|
|
2618
|
-
var KitDeclarations =
|
|
2619
|
-
loops:
|
|
2620
|
-
agents:
|
|
2621
|
-
schedules:
|
|
2622
|
-
carried:
|
|
2706
|
+
var KitDeclarations = Schema15.Struct({
|
|
2707
|
+
loops: Schema15.Array(LoopManifest),
|
|
2708
|
+
agents: Schema15.Record(Schema15.String, AgentDeclaration),
|
|
2709
|
+
schedules: Schema15.optionalKey(Schema15.Record(Schema15.String, ScheduleDeclaration)),
|
|
2710
|
+
carried: Schema15.optionalKey(Schema15.Array(CarriedKit))
|
|
2623
2711
|
});
|
|
2624
|
-
var sameLoop =
|
|
2625
|
-
var sameAgent =
|
|
2712
|
+
var sameLoop = Schema15.toEquivalence(LoopManifest);
|
|
2713
|
+
var sameAgent = Schema15.toEquivalence(AgentDeclaration);
|
|
2626
2714
|
|
|
2627
2715
|
// packages/sdk/src/loop/define.ts
|
|
2628
2716
|
import * as Effect2 from "effect/Effect";
|
|
2629
|
-
import * as
|
|
2630
|
-
var LoopOutcome2 =
|
|
2717
|
+
import * as Schema16 from "effect/Schema";
|
|
2718
|
+
var LoopOutcome2 = Schema16.Literals([
|
|
2631
2719
|
"feature",
|
|
2632
2720
|
"bug",
|
|
2633
2721
|
"refactor",
|
|
@@ -2656,17 +2744,17 @@ var capabilitiesOf2 = (loop) => {
|
|
|
2656
2744
|
};
|
|
2657
2745
|
var defineLoop2 = (definition) => definition;
|
|
2658
2746
|
|
|
2659
|
-
class ManifestInvalid2 extends
|
|
2660
|
-
loop:
|
|
2661
|
-
message:
|
|
2747
|
+
class ManifestInvalid2 extends Schema16.TaggedError()("ManifestInvalid", {
|
|
2748
|
+
loop: Schema16.String,
|
|
2749
|
+
message: Schema16.String
|
|
2662
2750
|
}) {
|
|
2663
2751
|
}
|
|
2664
2752
|
var jsonSchemaOf2 = (loop, schema) => Effect2.try({
|
|
2665
|
-
try: () =>
|
|
2753
|
+
try: () => Schema16.toJsonSchemaDocument(schema),
|
|
2666
2754
|
catch: (error) => new ManifestInvalid2({ loop, message: `Schema has no JSON Schema: ${String(error)}` })
|
|
2667
|
-
}).pipe(Effect2.flatMap((document) =>
|
|
2668
|
-
var JsonObjectSchema =
|
|
2669
|
-
var declarationsAreData = (definition) =>
|
|
2755
|
+
}).pipe(Effect2.flatMap((document) => Schema16.decodeUnknownEffect(JsonObjectSchema)({ ...document.schema, $defs: document.definitions }).pipe(Effect2.mapError((error) => new ManifestInvalid2({ loop, message: error.message })))));
|
|
2756
|
+
var JsonObjectSchema = Schema16.Record(Schema16.String, Schema16.Json);
|
|
2757
|
+
var declarationsAreData = (definition) => Schema16.decodeEffect(JsonObjectSchema)({
|
|
2670
2758
|
agents: definition.agents,
|
|
2671
2759
|
when: definition.when ?? [],
|
|
2672
2760
|
offers: definition.offers ?? [],
|
|
@@ -2674,7 +2762,7 @@ var declarationsAreData = (definition) => Schema15.decodeEffect(JsonObjectSchema
|
|
|
2674
2762
|
}).pipe(Effect2.mapError((error) => new ManifestInvalid2({ loop: definition.id, message: `Declarations must be data: ${error.message}` })));
|
|
2675
2763
|
var loopManifest2 = (definition) => Effect2.gen(function* () {
|
|
2676
2764
|
yield* declarationsAreData(definition);
|
|
2677
|
-
if (definition.version !== undefined && !
|
|
2765
|
+
if (definition.version !== undefined && !Schema16.is(LoopVersion)(definition.version))
|
|
2678
2766
|
return yield* new ManifestInvalid2({
|
|
2679
2767
|
loop: definition.id,
|
|
2680
2768
|
message: `version "${String(definition.version)}" is not semver, such as 2.0.0`
|
|
@@ -2702,7 +2790,7 @@ import * as Context from "effect/Context";
|
|
|
2702
2790
|
import * as Duration from "effect/Duration";
|
|
2703
2791
|
import * as Effect3 from "effect/Effect";
|
|
2704
2792
|
import * as Exit2 from "effect/Exit";
|
|
2705
|
-
import * as
|
|
2793
|
+
import * as Schema18 from "effect/Schema";
|
|
2706
2794
|
import { Activity, DurableDeferred } from "effect/workflow";
|
|
2707
2795
|
|
|
2708
2796
|
// packages/core/src/question-recommendation.ts
|
|
@@ -2739,25 +2827,25 @@ var questionAdvice = (question) => ({
|
|
|
2739
2827
|
});
|
|
2740
2828
|
|
|
2741
2829
|
// packages/sdk/src/loop/evidence.ts
|
|
2742
|
-
import * as
|
|
2743
|
-
var EvidenceCheck2 =
|
|
2744
|
-
name:
|
|
2745
|
-
command:
|
|
2746
|
-
status:
|
|
2747
|
-
preExisting:
|
|
2748
|
-
durationMs:
|
|
2749
|
-
evidenceId:
|
|
2750
|
-
outputTail:
|
|
2751
|
-
suggested:
|
|
2752
|
-
skippedSinceBaseline:
|
|
2753
|
-
newNotRun:
|
|
2754
|
-
});
|
|
2755
|
-
var VerifyResult2 =
|
|
2756
|
-
revision:
|
|
2757
|
-
tree:
|
|
2758
|
-
passed:
|
|
2759
|
-
unchanged:
|
|
2760
|
-
checks:
|
|
2830
|
+
import * as Schema17 from "effect/Schema";
|
|
2831
|
+
var EvidenceCheck2 = Schema17.Struct({
|
|
2832
|
+
name: Schema17.String,
|
|
2833
|
+
command: Schema17.String,
|
|
2834
|
+
status: Schema17.Literals(["passed", "failed"]),
|
|
2835
|
+
preExisting: Schema17.Boolean,
|
|
2836
|
+
durationMs: Schema17.Finite,
|
|
2837
|
+
evidenceId: Schema17.String,
|
|
2838
|
+
outputTail: Schema17.optionalKey(Schema17.String),
|
|
2839
|
+
suggested: Schema17.optionalKey(Schema17.Boolean),
|
|
2840
|
+
skippedSinceBaseline: Schema17.optionalKey(Schema17.Array(Schema17.String)),
|
|
2841
|
+
newNotRun: Schema17.optionalKey(Schema17.Array(Schema17.String))
|
|
2842
|
+
});
|
|
2843
|
+
var VerifyResult2 = Schema17.Struct({
|
|
2844
|
+
revision: Schema17.String,
|
|
2845
|
+
tree: Schema17.String,
|
|
2846
|
+
passed: Schema17.Boolean,
|
|
2847
|
+
unchanged: Schema17.optionalKey(Schema17.Boolean),
|
|
2848
|
+
checks: Schema17.Array(EvidenceCheck2)
|
|
2761
2849
|
});
|
|
2762
2850
|
var OutcomeTable2 = {
|
|
2763
2851
|
feature: "Approved verifications pass on the head tree, and review says the scope was met",
|
|
@@ -2853,82 +2941,82 @@ var outcomeGate = (input) => {
|
|
|
2853
2941
|
};
|
|
2854
2942
|
|
|
2855
2943
|
// packages/sdk/src/loop/steps.ts
|
|
2856
|
-
class StepFailed2 extends
|
|
2857
|
-
step:
|
|
2858
|
-
reason:
|
|
2944
|
+
class StepFailed2 extends Schema18.TaggedError()("StepFailed", {
|
|
2945
|
+
step: Schema18.String,
|
|
2946
|
+
reason: Schema18.String
|
|
2859
2947
|
}) {
|
|
2860
2948
|
get message() {
|
|
2861
2949
|
return `Step "${this.step}" failed: ${this.reason}`;
|
|
2862
2950
|
}
|
|
2863
2951
|
}
|
|
2864
2952
|
|
|
2865
|
-
class OutputInvalid2 extends
|
|
2866
|
-
step:
|
|
2867
|
-
message:
|
|
2953
|
+
class OutputInvalid2 extends Schema18.TaggedError()("OutputInvalid", {
|
|
2954
|
+
step: Schema18.String,
|
|
2955
|
+
message: Schema18.String
|
|
2868
2956
|
}) {
|
|
2869
2957
|
}
|
|
2870
2958
|
|
|
2871
|
-
class QuestionRefused2 extends
|
|
2872
|
-
step:
|
|
2873
|
-
answer:
|
|
2874
|
-
options:
|
|
2959
|
+
class QuestionRefused2 extends Schema18.TaggedError()("QuestionRefused", {
|
|
2960
|
+
step: Schema18.String,
|
|
2961
|
+
answer: Schema18.String,
|
|
2962
|
+
options: Schema18.Array(Schema18.String)
|
|
2875
2963
|
}) {
|
|
2876
2964
|
}
|
|
2877
2965
|
|
|
2878
|
-
class WaitTimedOut2 extends
|
|
2879
|
-
step:
|
|
2880
|
-
event:
|
|
2966
|
+
class WaitTimedOut2 extends Schema18.TaggedError()("WaitTimedOut", {
|
|
2967
|
+
step: Schema18.String,
|
|
2968
|
+
event: Schema18.String
|
|
2881
2969
|
}) {
|
|
2882
2970
|
}
|
|
2883
2971
|
|
|
2884
|
-
class ChangeRequestClosed2 extends
|
|
2885
|
-
step:
|
|
2886
|
-
merged:
|
|
2972
|
+
class ChangeRequestClosed2 extends Schema18.TaggedError()("ChangeRequestClosed", {
|
|
2973
|
+
step: Schema18.String,
|
|
2974
|
+
merged: Schema18.Boolean
|
|
2887
2975
|
}) {
|
|
2888
2976
|
}
|
|
2889
2977
|
|
|
2890
|
-
class ChildFailed2 extends
|
|
2891
|
-
step:
|
|
2892
|
-
loop:
|
|
2893
|
-
reason:
|
|
2978
|
+
class ChildFailed2 extends Schema18.TaggedError()("ChildFailed", {
|
|
2979
|
+
step: Schema18.String,
|
|
2980
|
+
loop: Schema18.String,
|
|
2981
|
+
reason: Schema18.String
|
|
2894
2982
|
}) {
|
|
2895
2983
|
get message() {
|
|
2896
2984
|
return `Child Run of "${this.loop}" for Step "${this.step}" failed: ${this.reason}`;
|
|
2897
2985
|
}
|
|
2898
2986
|
}
|
|
2899
2987
|
|
|
2900
|
-
class CapabilityDenied2 extends
|
|
2901
|
-
step:
|
|
2902
|
-
capability:
|
|
2903
|
-
secret:
|
|
2988
|
+
class CapabilityDenied2 extends Schema18.TaggedError()("CapabilityDenied", {
|
|
2989
|
+
step: Schema18.String,
|
|
2990
|
+
capability: Schema18.Literals(LoopCapabilities2),
|
|
2991
|
+
secret: Schema18.optionalKey(Schema18.String)
|
|
2904
2992
|
}) {
|
|
2905
2993
|
get message() {
|
|
2906
2994
|
return this.secret === undefined ? `Step "${this.step}" needs the "${this.capability}" capability, which this Run was not granted` : `Step "${this.step}" names the Secret "${this.secret}", which its Loop does not declare`;
|
|
2907
2995
|
}
|
|
2908
2996
|
}
|
|
2909
2997
|
|
|
2910
|
-
class DuplicateStep2 extends
|
|
2911
|
-
step:
|
|
2998
|
+
class DuplicateStep2 extends Schema18.TaggedError()("DuplicateStep", {
|
|
2999
|
+
step: Schema18.String
|
|
2912
3000
|
}) {
|
|
2913
3001
|
}
|
|
2914
3002
|
|
|
2915
|
-
class InputInvalid2 extends
|
|
2916
|
-
loop:
|
|
2917
|
-
message:
|
|
3003
|
+
class InputInvalid2 extends Schema18.TaggedError()("InputInvalid", {
|
|
3004
|
+
loop: Schema18.String,
|
|
3005
|
+
message: Schema18.String
|
|
2918
3006
|
}) {
|
|
2919
3007
|
}
|
|
2920
|
-
var LoopEvent2 =
|
|
3008
|
+
var LoopEvent2 = Schema18.Struct({ type: Schema18.String, payload: Schema18.Record(Schema18.String, Schema18.Json) });
|
|
2921
3009
|
|
|
2922
3010
|
class LoopRun2 extends Context.Service()("@kitman-sh/sdk/loop/LoopRun") {
|
|
2923
3011
|
}
|
|
2924
3012
|
|
|
2925
3013
|
class LoopHost2 extends Context.Service()("@kitman-sh/sdk/loop/LoopHost") {
|
|
2926
3014
|
}
|
|
2927
|
-
var agentDeferredNamed2 = (deferredName) => DurableDeferred.make(deferredName, { success:
|
|
3015
|
+
var agentDeferredNamed2 = (deferredName) => DurableDeferred.make(deferredName, { success: Schema18.Json, error: StepFailed2 });
|
|
2928
3016
|
var agentWorkDeferred2 = (step) => agentDeferredNamed2(`agent_work/${step}`);
|
|
2929
3017
|
var syncDeferred2 = (step) => agentDeferredNamed2(`sync/${step}`);
|
|
2930
|
-
var answerDeferred2 = (step) => DurableDeferred.make(`ask/${step}`, { success:
|
|
2931
|
-
var childDeferred2 = (step) => DurableDeferred.make(`call/${step}`, { success:
|
|
3018
|
+
var answerDeferred2 = (step) => DurableDeferred.make(`ask/${step}`, { success: Schema18.String, error: StepFailed2 });
|
|
3019
|
+
var childDeferred2 = (step) => DurableDeferred.make(`call/${step}`, { success: Schema18.Json, error: ChildFailed2 });
|
|
2932
3020
|
var eventDeferred2 = (step) => DurableDeferred.make(`wait_for/${step}`, { success: LoopEvent2, error: WaitTimedOut2 });
|
|
2933
3021
|
var verifyDeferred2 = (step) => DurableDeferred.make(`verify/${step}`, { success: VerifyResult2, error: StepFailed2 });
|
|
2934
3022
|
var recordStep = (name, kind, exit) => {
|
|
@@ -2958,7 +3046,7 @@ var launch2 = (deferred, start) => Activity.make({
|
|
|
2958
3046
|
return yield* start(yield* LoopHost2, yield* DurableDeferred.token(deferred));
|
|
2959
3047
|
})
|
|
2960
3048
|
});
|
|
2961
|
-
var toJson = (step, schema, value) =>
|
|
3049
|
+
var toJson = (step, schema, value) => Schema18.encodeUnknownEffect(Schema18.toCodecJson(schema))(value).pipe(Effect3.flatMap(Schema18.decodeUnknownEffect(Schema18.Json)), Effect3.mapError((error) => new StepFailed2({ step, reason: error.message })));
|
|
2962
3050
|
var agentWork2 = (name, options) => agentWorkAs2(agentWorkDeferred2, name, options);
|
|
2963
3051
|
var agentWorkAs2 = (deferredOf, name, options) => takeStep2(name, "agent_work", "agent_work", Effect3.gen(function* () {
|
|
2964
3052
|
const run = yield* LoopRun2;
|
|
@@ -2984,7 +3072,7 @@ var agentWorkAs2 = (deferredOf, name, options) => takeStep2(name, "agent_work",
|
|
|
2984
3072
|
token
|
|
2985
3073
|
}));
|
|
2986
3074
|
const submitted = yield* DurableDeferred.await(deferred);
|
|
2987
|
-
return yield*
|
|
3075
|
+
return yield* Schema18.decodeEffect(Schema18.toCodecJson(options.output))(submitted).pipe(Effect3.mapError((error) => new OutputInvalid2({ step: name, message: error.message })));
|
|
2988
3076
|
}));
|
|
2989
3077
|
var agentWorkOnce2 = (name, options) => agentWork2(name, options).pipe(Effect3.catchTag("OutputInvalid", (invalid) => agentWork2(`${name}:again`, {
|
|
2990
3078
|
...options,
|
|
@@ -3046,7 +3134,7 @@ var call2 = (name, loop, input, options) => takeStep2(name, "call", "call", Effe
|
|
|
3046
3134
|
token
|
|
3047
3135
|
}));
|
|
3048
3136
|
const result = yield* DurableDeferred.await(deferred);
|
|
3049
|
-
return yield*
|
|
3137
|
+
return yield* Schema18.decodeEffect(Schema18.toCodecJson(loop.output))(result).pipe(Effect3.mapError((error) => new ChildFailed2({ step: name, loop: loop.id, reason: error.message })));
|
|
3050
3138
|
}));
|
|
3051
3139
|
var waitFor2 = (name, wait) => takeStep2(name, "wait_for", undefined, Effect3.gen(function* () {
|
|
3052
3140
|
const deferred = eventDeferred2(name);
|
|
@@ -3101,21 +3189,21 @@ var suggestVerification2 = (name, verification) => takeStep2(name, "ask", "ask",
|
|
|
3101
3189
|
// packages/sdk/src/loop/activities.ts
|
|
3102
3190
|
import * as Context2 from "effect/Context";
|
|
3103
3191
|
import * as Effect5 from "effect/Effect";
|
|
3104
|
-
import * as
|
|
3192
|
+
import * as Schema20 from "effect/Schema";
|
|
3105
3193
|
import * as SchemaTransformation from "effect/SchemaTransformation";
|
|
3106
3194
|
import { Activity as Activity2 } from "effect/workflow";
|
|
3107
3195
|
|
|
3108
3196
|
// packages/sdk/src/loop/plan.ts
|
|
3109
3197
|
import * as Effect4 from "effect/Effect";
|
|
3110
|
-
import * as
|
|
3111
|
-
var PlanTicket2 =
|
|
3112
|
-
key:
|
|
3113
|
-
title:
|
|
3114
|
-
body:
|
|
3115
|
-
acceptanceCriteria:
|
|
3116
|
-
repoBindingId:
|
|
3117
|
-
blockedBy:
|
|
3118
|
-
outcome:
|
|
3198
|
+
import * as Schema19 from "effect/Schema";
|
|
3199
|
+
var PlanTicket2 = Schema19.Struct({
|
|
3200
|
+
key: Schema19.String,
|
|
3201
|
+
title: Schema19.String,
|
|
3202
|
+
body: Schema19.String,
|
|
3203
|
+
acceptanceCriteria: Schema19.Array(Schema19.String),
|
|
3204
|
+
repoBindingId: Schema19.optional(Schema19.String),
|
|
3205
|
+
blockedBy: Schema19.Array(Schema19.String),
|
|
3206
|
+
outcome: Schema19.optional(LoopOutcome2)
|
|
3119
3207
|
});
|
|
3120
3208
|
var cycleMessage = (keys) => `These tickets block each other in a cycle, so none can start: ${keys.join(", ")}`;
|
|
3121
3209
|
var ticketsProblem = (tickets) => {
|
|
@@ -3132,10 +3220,10 @@ var ticketsProblem = (tickets) => {
|
|
|
3132
3220
|
const { blocked } = wavesOf(tickets);
|
|
3133
3221
|
return blocked.length === 0 ? undefined : cycleMessage(blocked);
|
|
3134
3222
|
};
|
|
3135
|
-
var PlanTickets2 =
|
|
3223
|
+
var PlanTickets2 = Schema19.Array(PlanTicket2).check(Schema19.makeFilter((tickets) => ticketsProblem(tickets) ?? true));
|
|
3136
3224
|
|
|
3137
|
-
class BlockingCycle2 extends
|
|
3138
|
-
tickets:
|
|
3225
|
+
class BlockingCycle2 extends Schema19.TaggedError()("BlockingCycle", {
|
|
3226
|
+
tickets: Schema19.Array(Schema19.String)
|
|
3139
3227
|
}) {
|
|
3140
3228
|
get message() {
|
|
3141
3229
|
return cycleMessage(this.tickets);
|
|
@@ -3163,235 +3251,235 @@ var planWaves2 = (tickets) => Effect4.suspend(() => {
|
|
|
3163
3251
|
});
|
|
3164
3252
|
|
|
3165
3253
|
// packages/sdk/src/loop/activities.ts
|
|
3166
|
-
var ChangeRequestRequest2 =
|
|
3167
|
-
title:
|
|
3168
|
-
body:
|
|
3169
|
-
integration:
|
|
3254
|
+
var ChangeRequestRequest2 = Schema20.Struct({
|
|
3255
|
+
title: Schema20.String,
|
|
3256
|
+
body: Schema20.String,
|
|
3257
|
+
integration: Schema20.optional(Schema20.String)
|
|
3170
3258
|
});
|
|
3171
|
-
var ChangeRequestResult2 =
|
|
3259
|
+
var ChangeRequestResult2 = Schema20.Struct({ id: Schema20.String, number: Schema20.String, url: Schema20.String });
|
|
3172
3260
|
var WriteBackMilestones2 = ["started", "change_request_opened", "merged", "failed"];
|
|
3173
|
-
var WriteBackRequest2 =
|
|
3174
|
-
milestone:
|
|
3175
|
-
changeRequestUrl:
|
|
3261
|
+
var WriteBackRequest2 = Schema20.Struct({
|
|
3262
|
+
milestone: Schema20.optional(Schema20.Literals(WriteBackMilestones2)),
|
|
3263
|
+
changeRequestUrl: Schema20.optional(Schema20.String)
|
|
3176
3264
|
});
|
|
3177
|
-
var RunFile2 =
|
|
3265
|
+
var RunFile2 = Schema20.Struct({ runFile: Schema20.String }).pipe(Schema20.decodeTo(Schema20.Struct({ id: Schema20.String }), SchemaTransformation.transform({
|
|
3178
3266
|
decode: ({ runFile }) => ({ id: runFile }),
|
|
3179
3267
|
encode: ({ id }) => ({ runFile: id })
|
|
3180
3268
|
})));
|
|
3181
|
-
var FileRequest2 =
|
|
3182
|
-
var ArtifactRequest2 =
|
|
3183
|
-
kind:
|
|
3184
|
-
title:
|
|
3185
|
-
text:
|
|
3186
|
-
data:
|
|
3187
|
-
files:
|
|
3188
|
-
});
|
|
3189
|
-
var ArtifactResult2 =
|
|
3190
|
-
var NoteRequest2 =
|
|
3191
|
-
text:
|
|
3192
|
-
artifactId:
|
|
3193
|
-
kind:
|
|
3194
|
-
});
|
|
3195
|
-
var CreateTasksRequest2 =
|
|
3196
|
-
tickets:
|
|
3197
|
-
projectId:
|
|
3198
|
-
});
|
|
3199
|
-
var CreateTasksResult2 =
|
|
3200
|
-
tasks:
|
|
3201
|
-
});
|
|
3202
|
-
var AlertTaskRequest2 =
|
|
3203
|
-
fingerprint:
|
|
3204
|
-
title:
|
|
3205
|
-
windowHours:
|
|
3206
|
-
resolved:
|
|
3207
|
-
priority:
|
|
3208
|
-
});
|
|
3209
|
-
var AlertTaskResult2 =
|
|
3210
|
-
taskId:
|
|
3211
|
-
created:
|
|
3212
|
-
resolved:
|
|
3213
|
-
joined:
|
|
3214
|
-
});
|
|
3215
|
-
var IntegrationBranchRequest2 =
|
|
3216
|
-
var IntegrationBranch2 =
|
|
3217
|
-
repoBindingId:
|
|
3218
|
-
branch:
|
|
3219
|
-
revision:
|
|
3220
|
-
});
|
|
3221
|
-
var MergeChangeRequestRequest2 =
|
|
3222
|
-
changeRequestId:
|
|
3223
|
-
head:
|
|
3224
|
-
});
|
|
3225
|
-
var MergeResult2 =
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3269
|
+
var FileRequest2 = Schema20.Struct({ path: Schema20.String, caption: Schema20.optional(Schema20.String) });
|
|
3270
|
+
var ArtifactRequest2 = Schema20.Struct({
|
|
3271
|
+
kind: Schema20.String,
|
|
3272
|
+
title: Schema20.String,
|
|
3273
|
+
text: Schema20.String,
|
|
3274
|
+
data: Schema20.optional(Schema20.Json),
|
|
3275
|
+
files: Schema20.optional(Schema20.Array(RunFile2))
|
|
3276
|
+
});
|
|
3277
|
+
var ArtifactResult2 = Schema20.Struct({ artifactId: Schema20.String });
|
|
3278
|
+
var NoteRequest2 = Schema20.Struct({
|
|
3279
|
+
text: Schema20.String,
|
|
3280
|
+
artifactId: Schema20.optional(Schema20.String),
|
|
3281
|
+
kind: Schema20.optional(Schema20.Literals(["note", "blocker"]))
|
|
3282
|
+
});
|
|
3283
|
+
var CreateTasksRequest2 = Schema20.Struct({
|
|
3284
|
+
tickets: Schema20.Array(PlanTicket2),
|
|
3285
|
+
projectId: Schema20.optionalKey(Schema20.String)
|
|
3286
|
+
});
|
|
3287
|
+
var CreateTasksResult2 = Schema20.Struct({
|
|
3288
|
+
tasks: Schema20.Array(Schema20.Struct({ key: Schema20.String, taskId: Schema20.String }))
|
|
3289
|
+
});
|
|
3290
|
+
var AlertTaskRequest2 = Schema20.Struct({
|
|
3291
|
+
fingerprint: Schema20.String.check(Schema20.isMinLength(1), Schema20.isMaxLength(400)),
|
|
3292
|
+
title: Schema20.String,
|
|
3293
|
+
windowHours: Schema20.Int.check(Schema20.isGreaterThanOrEqualTo(0), Schema20.isLessThanOrEqualTo(720)),
|
|
3294
|
+
resolved: Schema20.optionalKey(Schema20.Boolean),
|
|
3295
|
+
priority: Schema20.optionalKey(Schema20.Literals(["urgent", "high", "medium", "low"]))
|
|
3296
|
+
});
|
|
3297
|
+
var AlertTaskResult2 = Schema20.Struct({
|
|
3298
|
+
taskId: Schema20.optionalKey(Schema20.String),
|
|
3299
|
+
created: Schema20.Boolean,
|
|
3300
|
+
resolved: Schema20.optionalKey(Schema20.Boolean),
|
|
3301
|
+
joined: Schema20.optionalKey(Schema20.Struct({ kind: Schema20.Literals(["run", "recent"]), runId: Schema20.String }))
|
|
3302
|
+
});
|
|
3303
|
+
var IntegrationBranchRequest2 = Schema20.Struct({ repoBindingId: Schema20.optional(Schema20.String) });
|
|
3304
|
+
var IntegrationBranch2 = Schema20.Struct({
|
|
3305
|
+
repoBindingId: Schema20.String,
|
|
3306
|
+
branch: Schema20.String,
|
|
3307
|
+
revision: Schema20.String
|
|
3308
|
+
});
|
|
3309
|
+
var MergeChangeRequestRequest2 = Schema20.Struct({
|
|
3310
|
+
changeRequestId: Schema20.String,
|
|
3311
|
+
head: Schema20.optionalKey(Schema20.String)
|
|
3312
|
+
});
|
|
3313
|
+
var MergeResult2 = Schema20.Union([
|
|
3314
|
+
Schema20.Struct({ status: Schema20.Literal("merged"), revision: Schema20.String }),
|
|
3315
|
+
Schema20.Struct({ status: Schema20.Literal("conflict") }),
|
|
3316
|
+
Schema20.Struct({ status: Schema20.Literal("moved"), head: Schema20.String })
|
|
3229
3317
|
]);
|
|
3230
|
-
var ApproveChangeRequestRequest2 =
|
|
3231
|
-
changeRequestId:
|
|
3232
|
-
head:
|
|
3233
|
-
summary:
|
|
3234
|
-
review:
|
|
3235
|
-
carries:
|
|
3236
|
-
});
|
|
3237
|
-
var ApproveChangeRequestResult2 =
|
|
3238
|
-
|
|
3239
|
-
|
|
3318
|
+
var ApproveChangeRequestRequest2 = Schema20.Struct({
|
|
3319
|
+
changeRequestId: Schema20.String,
|
|
3320
|
+
head: Schema20.String,
|
|
3321
|
+
summary: Schema20.String,
|
|
3322
|
+
review: Schema20.optionalKey(Schema20.String),
|
|
3323
|
+
carries: Schema20.optionalKey(Schema20.String)
|
|
3324
|
+
});
|
|
3325
|
+
var ApproveChangeRequestResult2 = Schema20.Union([
|
|
3326
|
+
Schema20.Struct({ approved: Schema20.Literal(true), reviewId: Schema20.String }),
|
|
3327
|
+
Schema20.Struct({ approved: Schema20.Literal(false), reason: Schema20.String })
|
|
3240
3328
|
]);
|
|
3241
|
-
var CloseChangeRequestRequest2 =
|
|
3242
|
-
number:
|
|
3243
|
-
head:
|
|
3244
|
-
note:
|
|
3245
|
-
});
|
|
3246
|
-
var CloseChangeRequestResult2 =
|
|
3247
|
-
closed:
|
|
3248
|
-
head:
|
|
3249
|
-
});
|
|
3250
|
-
var RerunPipelineRequest2 =
|
|
3251
|
-
|
|
3252
|
-
|
|
3329
|
+
var CloseChangeRequestRequest2 = Schema20.Struct({
|
|
3330
|
+
number: Schema20.String,
|
|
3331
|
+
head: Schema20.String,
|
|
3332
|
+
note: Schema20.String
|
|
3333
|
+
});
|
|
3334
|
+
var CloseChangeRequestResult2 = Schema20.Struct({
|
|
3335
|
+
closed: Schema20.Boolean,
|
|
3336
|
+
head: Schema20.optionalKey(Schema20.String)
|
|
3337
|
+
});
|
|
3338
|
+
var RerunPipelineRequest2 = Schema20.Union([
|
|
3339
|
+
Schema20.Struct({ changeRequestId: Schema20.String }),
|
|
3340
|
+
Schema20.Struct({ ref: Schema20.String, all: Schema20.optionalKey(Schema20.Boolean) })
|
|
3253
3341
|
]);
|
|
3254
|
-
var RerunPipelineResult2 =
|
|
3255
|
-
var ReportPipelineRequest2 =
|
|
3256
|
-
var ReportPipelineResult2 =
|
|
3257
|
-
head:
|
|
3258
|
-
status:
|
|
3259
|
-
});
|
|
3260
|
-
var CommentRequest2 =
|
|
3261
|
-
changeRequestId:
|
|
3262
|
-
body:
|
|
3263
|
-
threadId:
|
|
3264
|
-
summary:
|
|
3265
|
-
anchors:
|
|
3266
|
-
file:
|
|
3267
|
-
line:
|
|
3268
|
-
body:
|
|
3342
|
+
var RerunPipelineResult2 = Schema20.Struct({ head: Schema20.String, pipelines: Schema20.Int });
|
|
3343
|
+
var ReportPipelineRequest2 = Schema20.Struct({ changeRequestId: Schema20.String, verification: Schema20.String });
|
|
3344
|
+
var ReportPipelineResult2 = Schema20.Struct({
|
|
3345
|
+
head: Schema20.String,
|
|
3346
|
+
status: Schema20.Literals(["success", "failed"])
|
|
3347
|
+
});
|
|
3348
|
+
var CommentRequest2 = Schema20.Struct({
|
|
3349
|
+
changeRequestId: Schema20.String,
|
|
3350
|
+
body: Schema20.String,
|
|
3351
|
+
threadId: Schema20.optionalKey(Schema20.String),
|
|
3352
|
+
summary: Schema20.optionalKey(Schema20.String),
|
|
3353
|
+
anchors: Schema20.optionalKey(Schema20.Array(Schema20.Struct({
|
|
3354
|
+
file: Schema20.String,
|
|
3355
|
+
line: Schema20.Int.check(Schema20.isGreaterThanOrEqualTo(1)),
|
|
3356
|
+
body: Schema20.String.check(Schema20.isMinLength(1))
|
|
3269
3357
|
})))
|
|
3270
3358
|
});
|
|
3271
|
-
var ReleaseRequest2 =
|
|
3272
|
-
tag:
|
|
3273
|
-
revision:
|
|
3274
|
-
title:
|
|
3275
|
-
notes:
|
|
3276
|
-
});
|
|
3277
|
-
var ReleaseResult2 =
|
|
3278
|
-
var ChangeRequestReadRequest2 =
|
|
3279
|
-
var PipelineJob2 =
|
|
3280
|
-
name:
|
|
3281
|
-
status:
|
|
3282
|
-
url:
|
|
3283
|
-
logTail:
|
|
3284
|
-
});
|
|
3285
|
-
var PipelineStatus2 =
|
|
3286
|
-
head:
|
|
3287
|
-
status:
|
|
3288
|
-
source:
|
|
3289
|
-
jobs:
|
|
3290
|
-
readAt:
|
|
3291
|
-
runnerChecks:
|
|
3292
|
-
approved:
|
|
3293
|
-
repository:
|
|
3294
|
-
conflicts:
|
|
3295
|
-
needsRebase:
|
|
3296
|
-
target:
|
|
3297
|
-
});
|
|
3298
|
-
var ReviewThread2 =
|
|
3299
|
-
id:
|
|
3300
|
-
path:
|
|
3301
|
-
line:
|
|
3302
|
-
outdated:
|
|
3303
|
-
comments:
|
|
3304
|
-
});
|
|
3305
|
-
var ReviewThreads2 =
|
|
3306
|
-
var OpenChangeRequestsRequest2 =
|
|
3307
|
-
var OpenChangeRequest2 =
|
|
3308
|
-
number:
|
|
3309
|
-
title:
|
|
3310
|
-
body:
|
|
3311
|
-
url:
|
|
3312
|
-
author:
|
|
3313
|
-
sourceBranch:
|
|
3314
|
-
head:
|
|
3315
|
-
});
|
|
3316
|
-
var OpenChangeRequests2 =
|
|
3317
|
-
var OwnChangeRequest2 =
|
|
3318
|
-
id:
|
|
3319
|
-
number:
|
|
3320
|
-
url:
|
|
3321
|
-
title:
|
|
3322
|
-
sourceBranch:
|
|
3323
|
-
body:
|
|
3324
|
-
});
|
|
3325
|
-
var OwnChangeRequests2 =
|
|
3326
|
-
var TranscriptPoint2 =
|
|
3327
|
-
runId:
|
|
3328
|
-
stepAttemptId:
|
|
3329
|
-
sequence:
|
|
3330
|
-
});
|
|
3331
|
-
var TranscriptsRequest2 =
|
|
3332
|
-
days:
|
|
3333
|
-
});
|
|
3334
|
-
var TranscriptsResult2 =
|
|
3335
|
-
runs:
|
|
3336
|
-
runId:
|
|
3337
|
-
loopId:
|
|
3338
|
-
status:
|
|
3339
|
-
teamId:
|
|
3340
|
-
failure:
|
|
3341
|
-
retried:
|
|
3342
|
-
entries:
|
|
3359
|
+
var ReleaseRequest2 = Schema20.Struct({
|
|
3360
|
+
tag: Schema20.String,
|
|
3361
|
+
revision: Schema20.optional(Schema20.String),
|
|
3362
|
+
title: Schema20.String,
|
|
3363
|
+
notes: Schema20.String
|
|
3364
|
+
});
|
|
3365
|
+
var ReleaseResult2 = Schema20.Struct({ tag: Schema20.String, revision: Schema20.String, url: Schema20.String });
|
|
3366
|
+
var ChangeRequestReadRequest2 = Schema20.Struct({ changeRequestId: Schema20.String });
|
|
3367
|
+
var PipelineJob2 = Schema20.Struct({
|
|
3368
|
+
name: Schema20.String,
|
|
3369
|
+
status: Schema20.Literals(["running", "success", "failed", "skipped"]),
|
|
3370
|
+
url: Schema20.optional(Schema20.String),
|
|
3371
|
+
logTail: Schema20.optional(Schema20.String)
|
|
3372
|
+
});
|
|
3373
|
+
var PipelineStatus2 = Schema20.Struct({
|
|
3374
|
+
head: Schema20.String,
|
|
3375
|
+
status: Schema20.Literals(["none", "running", "success", "failed", "canceled"]),
|
|
3376
|
+
source: Schema20.Literals(["forge", "reported"]),
|
|
3377
|
+
jobs: Schema20.Array(PipelineJob2),
|
|
3378
|
+
readAt: Schema20.optionalKey(Schema20.String),
|
|
3379
|
+
runnerChecks: Schema20.optionalKey(Schema20.Array(Schema20.String)),
|
|
3380
|
+
approved: Schema20.optionalKey(Schema20.String),
|
|
3381
|
+
repository: Schema20.optionalKey(Schema20.String),
|
|
3382
|
+
conflicts: Schema20.optionalKey(Schema20.Boolean),
|
|
3383
|
+
needsRebase: Schema20.optionalKey(Schema20.Boolean),
|
|
3384
|
+
target: Schema20.optionalKey(Schema20.Struct({ branch: Schema20.String, head: Schema20.String, jobs: Schema20.Array(PipelineJob2) }))
|
|
3385
|
+
});
|
|
3386
|
+
var ReviewThread2 = Schema20.Struct({
|
|
3387
|
+
id: Schema20.String,
|
|
3388
|
+
path: Schema20.optional(Schema20.String),
|
|
3389
|
+
line: Schema20.optional(Schema20.Int),
|
|
3390
|
+
outdated: Schema20.optional(Schema20.Boolean),
|
|
3391
|
+
comments: Schema20.Array(Schema20.Struct({ author: Schema20.optional(Schema20.String), body: Schema20.String }))
|
|
3392
|
+
});
|
|
3393
|
+
var ReviewThreads2 = Schema20.Struct({ threads: Schema20.Array(ReviewThread2) });
|
|
3394
|
+
var OpenChangeRequestsRequest2 = Schema20.Struct({ authors: Schema20.NonEmptyArray(Schema20.String) });
|
|
3395
|
+
var OpenChangeRequest2 = Schema20.Struct({
|
|
3396
|
+
number: Schema20.String,
|
|
3397
|
+
title: Schema20.String,
|
|
3398
|
+
body: Schema20.String,
|
|
3399
|
+
url: Schema20.String,
|
|
3400
|
+
author: Schema20.String,
|
|
3401
|
+
sourceBranch: Schema20.String,
|
|
3402
|
+
head: Schema20.String
|
|
3403
|
+
});
|
|
3404
|
+
var OpenChangeRequests2 = Schema20.Struct({ changeRequests: Schema20.Array(OpenChangeRequest2) });
|
|
3405
|
+
var OwnChangeRequest2 = Schema20.Struct({
|
|
3406
|
+
id: Schema20.String,
|
|
3407
|
+
number: Schema20.String,
|
|
3408
|
+
url: Schema20.String,
|
|
3409
|
+
title: Schema20.String,
|
|
3410
|
+
sourceBranch: Schema20.String,
|
|
3411
|
+
body: Schema20.String
|
|
3412
|
+
});
|
|
3413
|
+
var OwnChangeRequests2 = Schema20.Struct({ changeRequests: Schema20.Array(OwnChangeRequest2) });
|
|
3414
|
+
var TranscriptPoint2 = Schema20.Struct({
|
|
3415
|
+
runId: Schema20.String,
|
|
3416
|
+
stepAttemptId: Schema20.String,
|
|
3417
|
+
sequence: Schema20.Int
|
|
3418
|
+
});
|
|
3419
|
+
var TranscriptsRequest2 = Schema20.Struct({
|
|
3420
|
+
days: Schema20.Int.check(Schema20.isGreaterThanOrEqualTo(1), Schema20.isLessThanOrEqualTo(31))
|
|
3421
|
+
});
|
|
3422
|
+
var TranscriptsResult2 = Schema20.Struct({
|
|
3423
|
+
runs: Schema20.Array(Schema20.Struct({
|
|
3424
|
+
runId: Schema20.String,
|
|
3425
|
+
loopId: Schema20.String,
|
|
3426
|
+
status: Schema20.optional(Schema20.Literals(["completed", "failed", "canceled", "expired"])),
|
|
3427
|
+
teamId: Schema20.optional(Schema20.String),
|
|
3428
|
+
failure: Schema20.optional(Schema20.String),
|
|
3429
|
+
retried: Schema20.optional(Schema20.Boolean),
|
|
3430
|
+
entries: Schema20.Array(Schema20.Struct({ stepAttemptId: Schema20.String, sequence: Schema20.Int, kind: Schema20.String, text: Schema20.String }))
|
|
3343
3431
|
}))
|
|
3344
3432
|
});
|
|
3345
|
-
var Citations =
|
|
3346
|
-
var ProposeRequest2 =
|
|
3347
|
-
|
|
3348
|
-
kind:
|
|
3349
|
-
teamId:
|
|
3350
|
-
content:
|
|
3433
|
+
var Citations = Schema20.NonEmptyArray(TranscriptPoint2);
|
|
3434
|
+
var ProposeRequest2 = Schema20.Union([
|
|
3435
|
+
Schema20.Struct({
|
|
3436
|
+
kind: Schema20.Literal("memory"),
|
|
3437
|
+
teamId: Schema20.String,
|
|
3438
|
+
content: Schema20.String,
|
|
3351
3439
|
citations: Citations
|
|
3352
3440
|
}),
|
|
3353
|
-
|
|
3354
|
-
kind:
|
|
3355
|
-
title:
|
|
3356
|
-
description:
|
|
3357
|
-
teamId:
|
|
3358
|
-
key:
|
|
3441
|
+
Schema20.Struct({
|
|
3442
|
+
kind: Schema20.Literal("task"),
|
|
3443
|
+
title: Schema20.String,
|
|
3444
|
+
description: Schema20.String,
|
|
3445
|
+
teamId: Schema20.optional(Schema20.String),
|
|
3446
|
+
key: Schema20.optionalKey(Schema20.String.check(Schema20.isPattern(/^[a-z0-9]+(?:-[a-z0-9]+)*$/), Schema20.isMaxLength(80))),
|
|
3359
3447
|
citations: Citations
|
|
3360
3448
|
})
|
|
3361
3449
|
]);
|
|
3362
|
-
var ProposeResult2 =
|
|
3363
|
-
kind:
|
|
3364
|
-
id:
|
|
3365
|
-
matched:
|
|
3366
|
-
});
|
|
3367
|
-
var Health =
|
|
3368
|
-
var ProjectActivityRequest2 =
|
|
3369
|
-
var ProjectActivityResult2 =
|
|
3370
|
-
project:
|
|
3371
|
-
health:
|
|
3372
|
-
since:
|
|
3373
|
-
runs:
|
|
3374
|
-
runId:
|
|
3375
|
-
loopId:
|
|
3376
|
-
status:
|
|
3377
|
-
taskKey:
|
|
3378
|
-
taskTitle:
|
|
3379
|
-
summary:
|
|
3380
|
-
entries:
|
|
3450
|
+
var ProposeResult2 = Schema20.Struct({
|
|
3451
|
+
kind: Schema20.Literals(["memory", "task"]),
|
|
3452
|
+
id: Schema20.String,
|
|
3453
|
+
matched: Schema20.optionalKey(Schema20.Boolean)
|
|
3454
|
+
});
|
|
3455
|
+
var Health = Schema20.Literals(["on_track", "at_risk", "off_track"]);
|
|
3456
|
+
var ProjectActivityRequest2 = Schema20.Struct({ projectId: Schema20.String });
|
|
3457
|
+
var ProjectActivityResult2 = Schema20.Struct({
|
|
3458
|
+
project: Schema20.Struct({ id: Schema20.String, name: Schema20.String }),
|
|
3459
|
+
health: Schema20.optional(Health),
|
|
3460
|
+
since: Schema20.optional(Schema20.String),
|
|
3461
|
+
runs: Schema20.Array(Schema20.Struct({
|
|
3462
|
+
runId: Schema20.String,
|
|
3463
|
+
loopId: Schema20.String,
|
|
3464
|
+
status: Schema20.String,
|
|
3465
|
+
taskKey: Schema20.optional(Schema20.String),
|
|
3466
|
+
taskTitle: Schema20.optional(Schema20.String),
|
|
3467
|
+
summary: Schema20.optional(Schema20.String),
|
|
3468
|
+
entries: Schema20.Array(Schema20.Struct({ stepAttemptId: Schema20.String, sequence: Schema20.Int, kind: Schema20.String, text: Schema20.String }))
|
|
3381
3469
|
})),
|
|
3382
|
-
taskChanges:
|
|
3470
|
+
taskChanges: Schema20.Array(Schema20.Struct({ taskKey: Schema20.String, title: Schema20.String, change: Schema20.String, at: Schema20.String }))
|
|
3383
3471
|
});
|
|
3384
|
-
var DraftUpdateRequest2 =
|
|
3385
|
-
projectId:
|
|
3472
|
+
var DraftUpdateRequest2 = Schema20.Struct({
|
|
3473
|
+
projectId: Schema20.String,
|
|
3386
3474
|
health: Health,
|
|
3387
|
-
note:
|
|
3388
|
-
writtenFrom:
|
|
3389
|
-
runs:
|
|
3390
|
-
taskChanges:
|
|
3391
|
-
since:
|
|
3475
|
+
note: Schema20.String,
|
|
3476
|
+
writtenFrom: Schema20.Struct({
|
|
3477
|
+
runs: Schema20.Int,
|
|
3478
|
+
taskChanges: Schema20.Int,
|
|
3479
|
+
since: Schema20.optional(Schema20.String)
|
|
3392
3480
|
})
|
|
3393
3481
|
});
|
|
3394
|
-
var DraftUpdateResult2 =
|
|
3482
|
+
var DraftUpdateResult2 = Schema20.Struct({ id: Schema20.String });
|
|
3395
3483
|
|
|
3396
3484
|
class ChangeRequestActivity2 extends Context2.Service()("@kitman-sh/sdk/loop/ChangeRequestActivity") {
|
|
3397
3485
|
}
|
|
@@ -3444,7 +3532,7 @@ var hostActivity = (name, kind, capability, success, execute) => takeStep2(name,
|
|
|
3444
3532
|
var changeRequest2 = (name, request) => hostActivity(name, "change_request", "change_request", ChangeRequestResult2, Effect5.gen(function* () {
|
|
3445
3533
|
return yield* (yield* ChangeRequestActivity2).run(request, name);
|
|
3446
3534
|
}));
|
|
3447
|
-
var writeBack2 = (name, request) => hostActivity(name, "write_back", "write_back",
|
|
3535
|
+
var writeBack2 = (name, request) => hostActivity(name, "write_back", "write_back", Schema20.Void, Effect5.gen(function* () {
|
|
3448
3536
|
return yield* (yield* WriteBackActivity2).run(request, name);
|
|
3449
3537
|
}));
|
|
3450
3538
|
var artifact2 = (name, request) => hostActivity(name, "artifact", undefined, ArtifactResult2, Effect5.gen(function* () {
|
|
@@ -3453,10 +3541,10 @@ var artifact2 = (name, request) => hostActivity(name, "artifact", undefined, Art
|
|
|
3453
3541
|
var file2 = (name, request) => hostActivity(name, "file", undefined, RunFile2, Effect5.gen(function* () {
|
|
3454
3542
|
return yield* (yield* FileActivity2).run(request, name);
|
|
3455
3543
|
}));
|
|
3456
|
-
var note2 = (name, request) => hostActivity(name, "note", undefined,
|
|
3544
|
+
var note2 = (name, request) => hostActivity(name, "note", undefined, Schema20.Void, Effect5.gen(function* () {
|
|
3457
3545
|
return yield* (yield* NoteActivity2).run(request, name);
|
|
3458
3546
|
}));
|
|
3459
|
-
var comment2 = (name, request) => hostActivity(name, "comment", "post_comment",
|
|
3547
|
+
var comment2 = (name, request) => hostActivity(name, "comment", "post_comment", Schema20.Void, Effect5.gen(function* () {
|
|
3460
3548
|
return yield* (yield* CommentActivity2).run(request, name);
|
|
3461
3549
|
}));
|
|
3462
3550
|
var createTasks2 = (name, request) => hostActivity(name, "create_tasks", "create_tasks", CreateTasksResult2, Effect5.gen(function* () {
|
|
@@ -3529,45 +3617,45 @@ import * as Schema28 from "effect/Schema";
|
|
|
3529
3617
|
import { DurableDeferred as DurableDeferred4, Workflow, WorkflowEngine } from "effect/workflow";
|
|
3530
3618
|
|
|
3531
3619
|
// packages/core/src/resource-claim.ts
|
|
3532
|
-
import * as
|
|
3533
|
-
var ResourceName =
|
|
3534
|
-
var ClaimHolder =
|
|
3535
|
-
runId:
|
|
3536
|
-
loopId:
|
|
3537
|
-
status:
|
|
3538
|
-
reason:
|
|
3539
|
-
private:
|
|
3540
|
-
sameLoop:
|
|
3541
|
-
});
|
|
3542
|
-
var ClaimResult2 =
|
|
3543
|
-
|
|
3544
|
-
status:
|
|
3620
|
+
import * as Schema21 from "effect/Schema";
|
|
3621
|
+
var ResourceName = Schema21.String.check(Schema21.isPattern(/^[a-z0-9][a-z0-9._:-]*$/u), Schema21.isMinLength(1), Schema21.isMaxLength(128));
|
|
3622
|
+
var ClaimHolder = Schema21.Struct({
|
|
3623
|
+
runId: Schema21.optionalKey(Id),
|
|
3624
|
+
loopId: Schema21.optionalKey(Schema21.String),
|
|
3625
|
+
status: Schema21.optionalKey(RunStatus),
|
|
3626
|
+
reason: Schema21.optionalKey(Schema21.String),
|
|
3627
|
+
private: Schema21.optionalKey(Schema21.Literal(true)),
|
|
3628
|
+
sameLoop: Schema21.Boolean
|
|
3629
|
+
});
|
|
3630
|
+
var ClaimResult2 = Schema21.Union([
|
|
3631
|
+
Schema21.Struct({
|
|
3632
|
+
status: Schema21.Literal("granted"),
|
|
3545
3633
|
resource: ResourceName,
|
|
3546
|
-
takenOverFrom:
|
|
3634
|
+
takenOverFrom: Schema21.optionalKey(ClaimHolder)
|
|
3547
3635
|
}),
|
|
3548
|
-
|
|
3636
|
+
Schema21.Struct({ status: Schema21.Literal("kept"), resource: ResourceName, holder: ClaimHolder })
|
|
3549
3637
|
]);
|
|
3550
|
-
var ResourceClaim =
|
|
3638
|
+
var ResourceClaim = Schema21.Struct({
|
|
3551
3639
|
resource: ResourceName,
|
|
3552
3640
|
runId: Id,
|
|
3553
|
-
loopId:
|
|
3641
|
+
loopId: Schema21.String,
|
|
3554
3642
|
runStatus: RunStatus,
|
|
3555
3643
|
claimedAt: Timestamp,
|
|
3556
|
-
keptAt:
|
|
3557
|
-
keptReason:
|
|
3558
|
-
waiting:
|
|
3644
|
+
keptAt: Schema21.optionalKey(Timestamp),
|
|
3645
|
+
keptReason: Schema21.optionalKey(Schema21.String),
|
|
3646
|
+
waiting: Schema21.Array(Id)
|
|
3559
3647
|
});
|
|
3560
|
-
var ResourceClaimList =
|
|
3561
|
-
var ClaimRelease =
|
|
3562
|
-
reason:
|
|
3648
|
+
var ResourceClaimList = Schema21.Struct({ items: Schema21.Array(ResourceClaim) });
|
|
3649
|
+
var ClaimRelease = Schema21.Struct({
|
|
3650
|
+
reason: Schema21.String.check(Schema21.isMinLength(1), Schema21.isMaxLength(500))
|
|
3563
3651
|
});
|
|
3564
3652
|
|
|
3565
3653
|
// packages/sdk/src/loop/claims.ts
|
|
3566
3654
|
import * as Effect6 from "effect/Effect";
|
|
3567
|
-
import * as
|
|
3655
|
+
import * as Schema22 from "effect/Schema";
|
|
3568
3656
|
import { DurableDeferred as DurableDeferred2 } from "effect/workflow";
|
|
3569
3657
|
var claimDeferred2 = (step) => DurableDeferred2.make(`claim/${step}`, { success: ClaimResult2, error: StepFailed2 });
|
|
3570
|
-
var letGoDeferred2 = (step) => DurableDeferred2.make(`let_go/${step}`, { success:
|
|
3658
|
+
var letGoDeferred2 = (step) => DurableDeferred2.make(`let_go/${step}`, { success: Schema22.Null, error: StepFailed2 });
|
|
3571
3659
|
var claimOnce = (name, resource, action) => takeStep2(name, "claim", "claim", Effect6.gen(function* () {
|
|
3572
3660
|
const deferred = claimDeferred2(name);
|
|
3573
3661
|
yield* launch2(deferred, (host, token) => host.claimResource({ step: name, resource, action, token }));
|
|
@@ -3606,114 +3694,114 @@ import * as Schema26 from "effect/Schema";
|
|
|
3606
3694
|
import * as Struct24 from "effect/Struct";
|
|
3607
3695
|
|
|
3608
3696
|
// packages/core/src/repo-binding.ts
|
|
3609
|
-
import * as
|
|
3697
|
+
import * as Schema23 from "effect/Schema";
|
|
3610
3698
|
var ForgeKinds = ["github", "gitlab", "forgejo", "gitea", "gitee", "bitbucket", "azure-devops"];
|
|
3611
|
-
var ForgeKind =
|
|
3699
|
+
var ForgeKind = Schema23.Literals(ForgeKinds);
|
|
3612
3700
|
var RepoBindingProviders = [...ForgeKinds, "generic_git"];
|
|
3613
3701
|
var RepoBindingPathPrefixPattern = "^(?!/)(?!.*\\\\)(?!.*(?:^|/)\\.\\.?(?:/|$))(?!.*//)\\S+$";
|
|
3614
|
-
var RepoBindingProvider =
|
|
3615
|
-
var RepoBindingStatus =
|
|
3616
|
-
var RepoBindingCredentialProviderType =
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3702
|
+
var RepoBindingProvider = Schema23.Literals(RepoBindingProviders);
|
|
3703
|
+
var RepoBindingStatus = Schema23.Union([Schema23.Literal("active"), Schema23.Literal("disabled")]);
|
|
3704
|
+
var RepoBindingCredentialProviderType = Schema23.Union([
|
|
3705
|
+
Schema23.Literal("env"),
|
|
3706
|
+
Schema23.Literal("file"),
|
|
3707
|
+
Schema23.Literal("exec")
|
|
3620
3708
|
]);
|
|
3621
|
-
var RepoBindingAccessMode =
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3709
|
+
var RepoBindingAccessMode = Schema23.Union([
|
|
3710
|
+
Schema23.Literal("local_checkout"),
|
|
3711
|
+
Schema23.Literal("managed_clone"),
|
|
3712
|
+
Schema23.Literal("runner_secret_provider")
|
|
3625
3713
|
]);
|
|
3626
|
-
var RepoBindingCredentialRef =
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
kind:
|
|
3631
|
-
runnerSecretName:
|
|
3714
|
+
var RepoBindingCredentialRef = Schema23.Union([
|
|
3715
|
+
Schema23.Struct({ kind: Schema23.Literal("none") }),
|
|
3716
|
+
Schema23.Struct({ kind: Schema23.Literal("local_env"), envName: Schema23.String.check(Schema23.isMinLength(1)) }),
|
|
3717
|
+
Schema23.Struct({
|
|
3718
|
+
kind: Schema23.Literal("runner_secret"),
|
|
3719
|
+
runnerSecretName: Schema23.String.check(Schema23.isMinLength(1)),
|
|
3632
3720
|
providerType: RepoBindingCredentialProviderType
|
|
3633
3721
|
}),
|
|
3634
|
-
|
|
3722
|
+
Schema23.Struct({ kind: Schema23.Literal("ssh_agent") })
|
|
3635
3723
|
]);
|
|
3636
|
-
var RepoBinding =
|
|
3724
|
+
var RepoBinding = Schema23.Struct({
|
|
3637
3725
|
id: Id,
|
|
3638
3726
|
workspaceId: Id,
|
|
3639
|
-
teamId:
|
|
3727
|
+
teamId: Schema23.optionalKey(Id),
|
|
3640
3728
|
provider: RepoBindingProvider,
|
|
3641
|
-
host:
|
|
3642
|
-
owner:
|
|
3643
|
-
name:
|
|
3644
|
-
repositoryUrl:
|
|
3645
|
-
pathPrefix:
|
|
3646
|
-
defaultTargetBranch:
|
|
3647
|
-
expectedBranch:
|
|
3648
|
-
expectedCommitSha:
|
|
3649
|
-
credentialRefs:
|
|
3729
|
+
host: Schema23.String.check(Schema23.isMinLength(1)),
|
|
3730
|
+
owner: Schema23.String.check(Schema23.isMinLength(1)),
|
|
3731
|
+
name: Schema23.String.check(Schema23.isMinLength(1)),
|
|
3732
|
+
repositoryUrl: Schema23.optionalKey(Schema23.String.check(Schema23.isMinLength(1))),
|
|
3733
|
+
pathPrefix: Schema23.optionalKey(Schema23.String.check(Schema23.isMinLength(1), Schema23.isPattern(new RegExp(RepoBindingPathPrefixPattern, "u")))),
|
|
3734
|
+
defaultTargetBranch: Schema23.String.check(Schema23.isMinLength(1)),
|
|
3735
|
+
expectedBranch: Schema23.optionalKey(Schema23.String.check(Schema23.isMinLength(1))),
|
|
3736
|
+
expectedCommitSha: Schema23.optionalKey(Schema23.String.check(Schema23.isMinLength(1))),
|
|
3737
|
+
credentialRefs: Schema23.Array(RepoBindingCredentialRef),
|
|
3650
3738
|
status: RepoBindingStatus,
|
|
3651
|
-
webhook:
|
|
3652
|
-
status:
|
|
3653
|
-
message:
|
|
3739
|
+
webhook: Schema23.optionalKey(Schema23.Struct({
|
|
3740
|
+
status: Schema23.Literals(["active", "missing", "unavailable"]),
|
|
3741
|
+
message: Schema23.optionalKey(Schema23.String.check(Schema23.isMaxLength(240)))
|
|
3654
3742
|
})),
|
|
3655
3743
|
createdAt: Timestamp,
|
|
3656
3744
|
updatedAt: Timestamp
|
|
3657
3745
|
});
|
|
3658
|
-
var RepoBindingCreate =
|
|
3659
|
-
teamId:
|
|
3746
|
+
var RepoBindingCreate = Schema23.Struct({
|
|
3747
|
+
teamId: Schema23.optionalKey(Id),
|
|
3660
3748
|
provider: RepoBindingProvider,
|
|
3661
|
-
host:
|
|
3662
|
-
owner:
|
|
3663
|
-
name:
|
|
3664
|
-
repositoryUrl:
|
|
3665
|
-
pathPrefix:
|
|
3666
|
-
defaultTargetBranch:
|
|
3667
|
-
expectedBranch:
|
|
3668
|
-
expectedCommitSha:
|
|
3669
|
-
credentialRefs:
|
|
3670
|
-
});
|
|
3671
|
-
var RepoBindingTargetOverride =
|
|
3672
|
-
targetBranch:
|
|
3673
|
-
});
|
|
3674
|
-
var RepoBindingList =
|
|
3675
|
-
var RunnerRepoBindingCapability =
|
|
3749
|
+
host: Schema23.String.check(Schema23.isMinLength(1)),
|
|
3750
|
+
owner: Schema23.String.check(Schema23.isMinLength(1)),
|
|
3751
|
+
name: Schema23.String.check(Schema23.isMinLength(1)),
|
|
3752
|
+
repositoryUrl: Schema23.optionalKey(Schema23.String.check(Schema23.isMinLength(1))),
|
|
3753
|
+
pathPrefix: Schema23.optionalKey(Schema23.String.check(Schema23.isMinLength(1), Schema23.isPattern(new RegExp(RepoBindingPathPrefixPattern, "u")))),
|
|
3754
|
+
defaultTargetBranch: Schema23.String.check(Schema23.isMinLength(1)),
|
|
3755
|
+
expectedBranch: Schema23.optionalKey(Schema23.String.check(Schema23.isMinLength(1))),
|
|
3756
|
+
expectedCommitSha: Schema23.optionalKey(Schema23.String.check(Schema23.isMinLength(1))),
|
|
3757
|
+
credentialRefs: Schema23.optionalKey(Schema23.Array(RepoBindingCredentialRef))
|
|
3758
|
+
});
|
|
3759
|
+
var RepoBindingTargetOverride = Schema23.Struct({
|
|
3760
|
+
targetBranch: Schema23.optionalKey(Schema23.String.check(Schema23.isMinLength(1)))
|
|
3761
|
+
});
|
|
3762
|
+
var RepoBindingList = Schema23.Struct({ items: Schema23.Array(RepoBinding) });
|
|
3763
|
+
var RunnerRepoBindingCapability = Schema23.Struct({
|
|
3676
3764
|
repoBindingId: Id,
|
|
3677
3765
|
provider: RepoBindingProvider,
|
|
3678
|
-
host:
|
|
3679
|
-
accessModes:
|
|
3680
|
-
credentialProviderTypes:
|
|
3681
|
-
authenticated:
|
|
3682
|
-
canPush:
|
|
3766
|
+
host: Schema23.String.check(Schema23.isMinLength(1)),
|
|
3767
|
+
accessModes: Schema23.Array(RepoBindingAccessMode),
|
|
3768
|
+
credentialProviderTypes: Schema23.Array(RepoBindingCredentialProviderType),
|
|
3769
|
+
authenticated: Schema23.Boolean,
|
|
3770
|
+
canPush: Schema23.optionalKey(Schema23.Boolean)
|
|
3683
3771
|
});
|
|
3684
3772
|
|
|
3685
3773
|
// packages/core/src/network-host.ts
|
|
3686
|
-
import * as
|
|
3774
|
+
import * as Schema24 from "effect/Schema";
|
|
3687
3775
|
var label = "[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?";
|
|
3688
3776
|
var port = "(?:[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])";
|
|
3689
|
-
var NetworkHost =
|
|
3690
|
-
var NetworkHostScope =
|
|
3691
|
-
var NetworkHostSummary =
|
|
3777
|
+
var NetworkHost = Schema24.String.check(Schema24.isMaxLength(260), Schema24.isPattern(new RegExp(`^(?:localhost|${label}(?:\\.${label})+|\\*\\.${label}\\.${label}(?:\\.${label})*)(?::${port})?$`, "u")));
|
|
3778
|
+
var NetworkHostScope = Schema24.Union([Schema24.Struct({ teamId: Id }), Schema24.Struct({ repoBindingId: Id })]);
|
|
3779
|
+
var NetworkHostSummary = Schema24.Struct({
|
|
3692
3780
|
host: NetworkHost,
|
|
3693
|
-
teamId:
|
|
3694
|
-
repoBindingId:
|
|
3781
|
+
teamId: Schema24.optionalKey(Id),
|
|
3782
|
+
repoBindingId: Schema24.optionalKey(Id),
|
|
3695
3783
|
addedByActorType: ActorType,
|
|
3696
|
-
addedByActorId:
|
|
3784
|
+
addedByActorId: Schema24.String,
|
|
3697
3785
|
addedAt: Timestamp
|
|
3698
3786
|
});
|
|
3699
|
-
var NetworkHostList =
|
|
3700
|
-
var NetworkHostQuery =
|
|
3701
|
-
teamId:
|
|
3702
|
-
repoBindingId:
|
|
3787
|
+
var NetworkHostList = Schema24.Struct({ items: Schema24.Array(NetworkHostSummary) });
|
|
3788
|
+
var NetworkHostQuery = Schema24.Struct({
|
|
3789
|
+
teamId: Schema24.optionalKey(Id),
|
|
3790
|
+
repoBindingId: Schema24.optionalKey(Id)
|
|
3703
3791
|
});
|
|
3704
3792
|
|
|
3705
3793
|
// packages/core/src/test-report.ts
|
|
3706
|
-
import * as
|
|
3794
|
+
import * as Schema25 from "effect/Schema";
|
|
3707
3795
|
var maxSkippedTests = 1e4;
|
|
3708
3796
|
var maxRanDigests = 1e5;
|
|
3709
|
-
var TestId =
|
|
3710
|
-
var CheckTests =
|
|
3711
|
-
reports:
|
|
3712
|
-
passed:
|
|
3713
|
-
failed:
|
|
3714
|
-
skipped:
|
|
3715
|
-
skippedTests:
|
|
3716
|
-
ranDigests:
|
|
3797
|
+
var TestId = Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(1000));
|
|
3798
|
+
var CheckTests = Schema25.Struct({
|
|
3799
|
+
reports: Schema25.Int.check(Schema25.isGreaterThanOrEqualTo(0)),
|
|
3800
|
+
passed: Schema25.Int.check(Schema25.isGreaterThanOrEqualTo(0)),
|
|
3801
|
+
failed: Schema25.Int.check(Schema25.isGreaterThanOrEqualTo(0)),
|
|
3802
|
+
skipped: Schema25.Int.check(Schema25.isGreaterThanOrEqualTo(0)),
|
|
3803
|
+
skippedTests: Schema25.Array(TestId).check(Schema25.isMaxLength(maxSkippedTests)),
|
|
3804
|
+
ranDigests: Schema25.Array(Schema25.String.check(Schema25.isMaxLength(16))).check(Schema25.isMaxLength(maxRanDigests))
|
|
3717
3805
|
});
|
|
3718
3806
|
var entities = new Map([
|
|
3719
3807
|
["amp", "&"],
|
|
@@ -3723,34 +3811,6 @@ var entities = new Map([
|
|
|
3723
3811
|
["apos", "'"]
|
|
3724
3812
|
]);
|
|
3725
3813
|
|
|
3726
|
-
// packages/core/src/secret.ts
|
|
3727
|
-
import * as Schema25 from "effect/Schema";
|
|
3728
|
-
var SecretName2 = Schema25.String.check(Schema25.isPattern(new RegExp("^[A-Za-z_][A-Za-z0-9_]*$", "u")), Schema25.isMinLength(1), Schema25.isMaxLength(128));
|
|
3729
|
-
var SecretScope = Schema25.Union([Schema25.Literal("workspace"), Schema25.Literal("team")]);
|
|
3730
|
-
var SecretHost = Schema25.String.check(Schema25.isPattern(new RegExp("^(\\*\\.)?[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*(?::[0-9]{1,5})?$", "u")), Schema25.isMaxLength(260));
|
|
3731
|
-
var SecretHosts = Schema25.Array(SecretHost).check(Schema25.isMaxLength(32));
|
|
3732
|
-
var referencePattern = /secret:\/\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+/;
|
|
3733
|
-
var placeholderMarker = "kitmanref";
|
|
3734
|
-
var tokenCharacter = "[A-Za-z0-9._~+/-]";
|
|
3735
|
-
var placeholderPattern = new RegExp(`(?<!${tokenCharacter})(?:proxy-ep=[A-Za-z0-9.-]+;)?${tokenCharacter}*${placeholderMarker}((?:[0-9a-f]{2})+)`);
|
|
3736
|
-
var anyReference = new RegExp(`${referencePattern.source}|${placeholderPattern.source}`, "g");
|
|
3737
|
-
var SecretSummary = Schema25.Struct({
|
|
3738
|
-
name: SecretName2,
|
|
3739
|
-
scope: SecretScope,
|
|
3740
|
-
teamId: Schema25.optionalKey(Id),
|
|
3741
|
-
hosts: SecretHosts,
|
|
3742
|
-
setByActorType: ActorType,
|
|
3743
|
-
setByActorId: Schema25.String,
|
|
3744
|
-
setAt: Timestamp
|
|
3745
|
-
});
|
|
3746
|
-
var SecretList = Schema25.Struct({ items: Schema25.Array(SecretSummary) });
|
|
3747
|
-
var SecretSet = Schema25.Struct({
|
|
3748
|
-
value: Schema25.String.check(Schema25.isMinLength(1), Schema25.isMaxLength(65536)),
|
|
3749
|
-
teamId: Schema25.optionalKey(Schema25.String.check(Schema25.isMinLength(1))),
|
|
3750
|
-
hosts: Schema25.optionalKey(SecretHosts)
|
|
3751
|
-
});
|
|
3752
|
-
var SecretScopeQuery = Schema25.Struct({ teamId: Schema25.optionalKey(Id) });
|
|
3753
|
-
|
|
3754
3814
|
// packages/core/src/work-unit.ts
|
|
3755
3815
|
var WorkUnitLease = Schema26.Struct({
|
|
3756
3816
|
leaseOwnerId: Id,
|
|
@@ -3914,14 +3974,14 @@ var WorkUnitHeartbeatInput = Schema26.Struct({
|
|
|
3914
3974
|
workUnitId: Id,
|
|
3915
3975
|
lease: WorkUnitLeaseInput,
|
|
3916
3976
|
leaseDurationSeconds: Schema26.optionalKey(Schema26.Int.check(Schema26.isGreaterThanOrEqualTo(1), Schema26.isLessThanOrEqualTo(3600))),
|
|
3917
|
-
secrets: Schema26.optionalKey(Schema26.Array(Schema26.Struct({ name:
|
|
3977
|
+
secrets: Schema26.optionalKey(Schema26.Array(Schema26.Struct({ name: SecretName, version: Schema26.String.check(Schema26.isMinLength(1), Schema26.isMaxLength(128)) })).check(Schema26.isMaxLength(256)))
|
|
3918
3978
|
});
|
|
3919
3979
|
var WorkUnitHeartbeatResult = Schema26.Struct({
|
|
3920
3980
|
settled: Schema26.Boolean,
|
|
3921
3981
|
outputSubmitted: Schema26.optionalKey(Schema26.Boolean),
|
|
3922
3982
|
outputMerged: Schema26.optionalKey(Schema26.Boolean),
|
|
3923
3983
|
questionOpen: Schema26.optionalKey(Schema26.Boolean),
|
|
3924
|
-
revokedSecrets: Schema26.optionalKey(Schema26.Array(
|
|
3984
|
+
revokedSecrets: Schema26.optionalKey(Schema26.Array(SecretName))
|
|
3925
3985
|
});
|
|
3926
3986
|
var WorkUnitReleaseInput = Schema26.Struct({
|
|
3927
3987
|
workUnitId: Id,
|