@modelprofile.com/flexharness 3.7.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +21 -0
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/classes.flexharness.d.ts +65 -2
- package/dist_ts/classes.flexharness.js +1401 -222
- package/dist_ts/classes.stores.d.ts +10 -1
- package/dist_ts/classes.stores.js +164 -2
- package/dist_ts/index.d.ts +1 -0
- package/dist_ts/index.js +2 -1
- package/dist_ts/interfaces.d.ts +184 -6
- package/dist_ts/interfaces.js +16 -1
- package/dist_ts/utils.json.d.ts +3 -2
- package/dist_ts/utils.json.js +278 -12
- package/dist_ts/utils.projectmanagement.d.ts +5 -0
- package/dist_ts/utils.projectmanagement.js +141 -0
- package/dist_ts_migration/v3_legacyflexharness.js +1 -1
- package/package.json +1 -1
- package/readme.hints.md +7 -4
- package/readme.md +207 -25
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.flexharness.ts +2024 -255
- package/ts/classes.stores.ts +265 -6
- package/ts/index.ts +6 -0
- package/ts/interfaces.ts +254 -6
- package/ts/utils.json.ts +321 -13
- package/ts/utils.projectmanagement.ts +226 -0
- package/ts_migration/v3_legacyflexharness.ts +1 -1
package/ts/interfaces.ts
CHANGED
|
@@ -135,6 +135,8 @@ export interface IFlexSessionActivity {
|
|
|
135
135
|
export interface IFlexSession {
|
|
136
136
|
scopeId: string;
|
|
137
137
|
sessionId: string;
|
|
138
|
+
sessionGenerationId?: string;
|
|
139
|
+
sessionGenerationSequence?: number;
|
|
138
140
|
title?: string;
|
|
139
141
|
createdAt: string;
|
|
140
142
|
updatedAt: string;
|
|
@@ -428,6 +430,8 @@ export interface IFlexResourceToolProviderResolver<TScope> {
|
|
|
428
430
|
|
|
429
431
|
export interface IFlexSessionTombstone {
|
|
430
432
|
sessionId: string;
|
|
433
|
+
sessionGenerationId?: string;
|
|
434
|
+
sessionGenerationSequence?: number;
|
|
431
435
|
deletedAt: string;
|
|
432
436
|
rootSessionId?: string;
|
|
433
437
|
depth?: number;
|
|
@@ -460,8 +464,16 @@ export interface IFlexProjectionSnapshotV1 {
|
|
|
460
464
|
}
|
|
461
465
|
|
|
462
466
|
export type TFlexReversionSegmentStatus = 'capturing' | 'completed' | 'failed' | 'cancelled';
|
|
467
|
+
export type TFlexReversionProtocolVersion = 1 | 2;
|
|
468
|
+
export type TFlexReversionProvenance = 'transcript' | 'workspace';
|
|
469
|
+
export type TFlexReversionDisposition = 'pending' | 'revertible' | 'no-change' | 'nonrevertible';
|
|
463
470
|
|
|
464
|
-
export interface
|
|
471
|
+
export interface IFlexAffectedWorkspace {
|
|
472
|
+
readonly id: string;
|
|
473
|
+
readonly label: string;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
interface IFlexReversionSegmentV2 {
|
|
465
477
|
runId: string;
|
|
466
478
|
userMessageId: string;
|
|
467
479
|
status: TFlexReversionSegmentStatus;
|
|
@@ -472,13 +484,25 @@ export interface IFlexReversionSegment {
|
|
|
472
484
|
workspaceReference?: TJsonValue;
|
|
473
485
|
}
|
|
474
486
|
|
|
475
|
-
export interface
|
|
487
|
+
export interface IFlexReversionSegment extends IFlexReversionSegmentV2 {
|
|
488
|
+
protocolVersion: TFlexReversionProtocolVersion;
|
|
489
|
+
provenance: TFlexReversionProvenance;
|
|
490
|
+
disposition?: TFlexReversionDisposition;
|
|
491
|
+
affectedWorkspaces?: IFlexAffectedWorkspace[];
|
|
492
|
+
reasonCode?: string;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
interface IFlexPendingCaptureReversionV2 {
|
|
476
496
|
kind: 'capture';
|
|
477
497
|
runId: string;
|
|
478
498
|
captureId: string;
|
|
479
499
|
state: 'preparing' | 'prepared' | 'finalizing';
|
|
480
500
|
}
|
|
481
501
|
|
|
502
|
+
export interface IFlexPendingCaptureReversion extends IFlexPendingCaptureReversionV2 {
|
|
503
|
+
protocolVersion: TFlexReversionProtocolVersion;
|
|
504
|
+
}
|
|
505
|
+
|
|
482
506
|
export interface IFlexPendingApplyReversion {
|
|
483
507
|
kind: 'apply';
|
|
484
508
|
operationId: string;
|
|
@@ -489,21 +513,41 @@ export interface IFlexPendingApplyReversion {
|
|
|
489
513
|
appliedRunIds: string[];
|
|
490
514
|
}
|
|
491
515
|
|
|
516
|
+
type TFlexPendingReversionV2 =
|
|
517
|
+
| IFlexPendingCaptureReversionV2
|
|
518
|
+
| IFlexPendingApplyReversion;
|
|
519
|
+
|
|
492
520
|
export type TFlexPendingReversion =
|
|
493
521
|
| IFlexPendingCaptureReversion
|
|
494
522
|
| IFlexPendingApplyReversion;
|
|
495
523
|
|
|
496
|
-
|
|
524
|
+
interface IFlexPendingReversionReleaseV2 {
|
|
497
525
|
runId: string;
|
|
498
526
|
captureId: string;
|
|
499
527
|
reference: TJsonValue;
|
|
500
528
|
}
|
|
501
529
|
|
|
530
|
+
export interface IFlexPendingReversionRelease extends IFlexPendingReversionReleaseV2 {
|
|
531
|
+
protocolVersion: TFlexReversionProtocolVersion;
|
|
532
|
+
}
|
|
533
|
+
|
|
502
534
|
export interface IFlexProjectionSnapshotV2 {
|
|
503
535
|
schemaVersion: 2;
|
|
504
536
|
revision: number;
|
|
505
537
|
messages: IFlexMessage[];
|
|
506
538
|
stagedTerminals: IFlexTerminalProjection[];
|
|
539
|
+
reversionSegments: IFlexReversionSegmentV2[];
|
|
540
|
+
revertCursor: number;
|
|
541
|
+
excludedRunIds: string[];
|
|
542
|
+
pendingReversion?: TFlexPendingReversionV2;
|
|
543
|
+
pendingReversionReleases: IFlexPendingReversionReleaseV2[];
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
export interface IFlexProjectionSnapshotV3 {
|
|
547
|
+
schemaVersion: 3;
|
|
548
|
+
revision: number;
|
|
549
|
+
messages: IFlexMessage[];
|
|
550
|
+
stagedTerminals: IFlexTerminalProjection[];
|
|
507
551
|
reversionSegments: IFlexReversionSegment[];
|
|
508
552
|
revertCursor: number;
|
|
509
553
|
excludedRunIds: string[];
|
|
@@ -511,9 +555,12 @@ export interface IFlexProjectionSnapshotV2 {
|
|
|
511
555
|
pendingReversionReleases: IFlexPendingReversionRelease[];
|
|
512
556
|
}
|
|
513
557
|
|
|
514
|
-
export type IFlexProjectionSnapshot =
|
|
558
|
+
export type IFlexProjectionSnapshot =
|
|
559
|
+
| IFlexProjectionSnapshotV1
|
|
560
|
+
| IFlexProjectionSnapshotV2
|
|
561
|
+
| IFlexProjectionSnapshotV3;
|
|
515
562
|
export type TFlexProjectionSnapshot = IFlexProjectionSnapshot;
|
|
516
|
-
export type IFlexProjectionSnapshotCurrent =
|
|
563
|
+
export type IFlexProjectionSnapshotCurrent = IFlexProjectionSnapshotV3;
|
|
517
564
|
|
|
518
565
|
export interface IFlexPermissionSnapshot {
|
|
519
566
|
schemaVersion: 1;
|
|
@@ -521,6 +568,118 @@ export interface IFlexPermissionSnapshot {
|
|
|
521
568
|
rememberedPermissionKeys: string[];
|
|
522
569
|
}
|
|
523
570
|
|
|
571
|
+
export const FLEX_PROJECT_MANAGEMENT_SCHEMA_VERSION = 1 as const;
|
|
572
|
+
export const FLEX_SESSION_GENERATION_ID_MAX_BYTES = 128;
|
|
573
|
+
|
|
574
|
+
export const FLEX_PROJECT_MANAGEMENT_LIMITS = Object.freeze({
|
|
575
|
+
maxGoalBytes: 8 * 1024,
|
|
576
|
+
maxScratchpadBytes: 64 * 1024,
|
|
577
|
+
maxTaskContentBytes: 8 * 1024,
|
|
578
|
+
maxTaskIdBytes: 512,
|
|
579
|
+
maxTasks: 512,
|
|
580
|
+
maxTitleBytes: 2048,
|
|
581
|
+
maxSnapshotBytes: 96 * 1024,
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
export type TFlexProjectTaskStatus = 'pending' | 'in_progress' | 'completed' | 'cancelled';
|
|
585
|
+
export type TFlexProjectTaskPriority = 'high' | 'medium' | 'low';
|
|
586
|
+
|
|
587
|
+
export interface IFlexProjectTask {
|
|
588
|
+
id: string;
|
|
589
|
+
content: string;
|
|
590
|
+
status: TFlexProjectTaskStatus;
|
|
591
|
+
priority: TFlexProjectTaskPriority;
|
|
592
|
+
createdAt: string;
|
|
593
|
+
updatedAt: string;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
export interface IFlexProjectManagementSnapshot {
|
|
597
|
+
schemaVersion: 1;
|
|
598
|
+
revision: number;
|
|
599
|
+
sessionGenerationId: string;
|
|
600
|
+
sessionGenerationSequence: number;
|
|
601
|
+
goal?: string;
|
|
602
|
+
scratchpad: string;
|
|
603
|
+
tasks: IFlexProjectTask[];
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
export interface IFlexProjectManagementTombstone {
|
|
607
|
+
schemaVersion: 1;
|
|
608
|
+
revision: number;
|
|
609
|
+
sessionGenerationId: string;
|
|
610
|
+
sessionGenerationSequence: number;
|
|
611
|
+
deletedAt: string;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
export type TFlexProjectManagementRecord =
|
|
615
|
+
| IFlexProjectManagementSnapshot
|
|
616
|
+
| IFlexProjectManagementTombstone;
|
|
617
|
+
|
|
618
|
+
export type TFlexProjectManagementWriteActor = 'agent' | 'application';
|
|
619
|
+
|
|
620
|
+
export interface IFlexProjectManagementWriteContext {
|
|
621
|
+
actor: TFlexProjectManagementWriteActor;
|
|
622
|
+
runId?: string;
|
|
623
|
+
agent?: string;
|
|
624
|
+
toolCallId?: string;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
export interface IFlexProjectManagementStore {
|
|
628
|
+
load(
|
|
629
|
+
storageKey: string,
|
|
630
|
+
sessionId: string,
|
|
631
|
+
): Promise<TFlexProjectManagementRecord | undefined>;
|
|
632
|
+
save(
|
|
633
|
+
storageKey: string,
|
|
634
|
+
sessionId: string,
|
|
635
|
+
snapshot: IFlexProjectManagementSnapshot,
|
|
636
|
+
expectedRevision: number,
|
|
637
|
+
writeContext: IFlexProjectManagementWriteContext,
|
|
638
|
+
): Promise<void>;
|
|
639
|
+
tombstoneSession(
|
|
640
|
+
storageKey: string,
|
|
641
|
+
sessionId: string,
|
|
642
|
+
tombstone: IFlexProjectManagementTombstone,
|
|
643
|
+
expectedRevision: number,
|
|
644
|
+
): Promise<void>;
|
|
645
|
+
purgeNamespace(storageKey: string): Promise<void>;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
export interface IFlexCreateProjectTaskInput {
|
|
649
|
+
id: string;
|
|
650
|
+
content: string;
|
|
651
|
+
status?: TFlexProjectTaskStatus;
|
|
652
|
+
priority?: TFlexProjectTaskPriority;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
export interface IFlexUpdateProjectTaskInput {
|
|
656
|
+
id: string;
|
|
657
|
+
content?: string;
|
|
658
|
+
status?: TFlexProjectTaskStatus;
|
|
659
|
+
priority?: TFlexProjectTaskPriority;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
export interface IFlexProjectStateResult {
|
|
663
|
+
revision: number;
|
|
664
|
+
state: IFlexProjectManagementSnapshot;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
export interface IFlexProjectTaskResult extends IFlexProjectStateResult {
|
|
668
|
+
task: IFlexProjectTask;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
export interface IFlexProjectTasksResult extends IFlexProjectStateResult {
|
|
672
|
+
tasks: IFlexProjectTask[];
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
export interface IFlexProjectGoalResult extends IFlexProjectStateResult {
|
|
676
|
+
goal: string | null;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
export interface IFlexProjectScratchpadResult extends IFlexProjectStateResult {
|
|
680
|
+
scratchpad: string;
|
|
681
|
+
}
|
|
682
|
+
|
|
524
683
|
export interface IFlexScopeStore {
|
|
525
684
|
load(storageKey: string): Promise<IFlexScopeSnapshot | undefined>;
|
|
526
685
|
save(
|
|
@@ -574,6 +733,7 @@ export interface IFlexHarnessStores {
|
|
|
574
733
|
scopes: IFlexScopeStore;
|
|
575
734
|
projections: IFlexProjectionStore;
|
|
576
735
|
permissions: IFlexPermissionStore;
|
|
736
|
+
projectManagement: IFlexProjectManagementStore;
|
|
577
737
|
agentEvents: IFlexAgentEventStoreProvider;
|
|
578
738
|
jobs: IFlexToolJobStoreProvider;
|
|
579
739
|
}
|
|
@@ -619,6 +779,10 @@ export const FLEX_REVERSION_MAXIMUM_LIMITS = Object.freeze({
|
|
|
619
779
|
});
|
|
620
780
|
|
|
621
781
|
export const FLEX_REVERSION_REFERENCE_MAX_BYTES = 256 * 1024;
|
|
782
|
+
export const FLEX_REVERSION_MAX_AFFECTED_WORKSPACES = 64;
|
|
783
|
+
export const FLEX_REVERSION_WORKSPACE_ID_MAX_BYTES = 512;
|
|
784
|
+
export const FLEX_REVERSION_WORKSPACE_LABEL_MAX_BYTES = 2048;
|
|
785
|
+
export const FLEX_REVERSION_REASON_CODE_MAX_BYTES = 128;
|
|
622
786
|
|
|
623
787
|
export interface IFlexTurnReversionBaseContext<TScope> {
|
|
624
788
|
readonly scopeId: string;
|
|
@@ -672,6 +836,77 @@ export interface IFlexTurnReversionProvider<TScope> {
|
|
|
672
836
|
): Promise<void> | void;
|
|
673
837
|
}
|
|
674
838
|
|
|
839
|
+
export interface IFlexTurnReversionRevertibleOutcome {
|
|
840
|
+
readonly disposition: 'revertible';
|
|
841
|
+
readonly reference: TJsonValue;
|
|
842
|
+
readonly affectedWorkspaces: readonly IFlexAffectedWorkspace[];
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
export interface IFlexTurnReversionNoChangeOutcome {
|
|
846
|
+
readonly disposition: 'no-change';
|
|
847
|
+
readonly reference: TJsonValue;
|
|
848
|
+
readonly affectedWorkspaces?: readonly [];
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
export interface IFlexTurnReversionNonrevertibleOutcome {
|
|
852
|
+
readonly disposition: 'nonrevertible';
|
|
853
|
+
readonly reference: TJsonValue;
|
|
854
|
+
readonly reasonCode: string;
|
|
855
|
+
readonly affectedWorkspaces?: readonly IFlexAffectedWorkspace[];
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
export type TFlexTurnReversionFinalizedOutcome =
|
|
859
|
+
| IFlexTurnReversionRevertibleOutcome
|
|
860
|
+
| IFlexTurnReversionNoChangeOutcome
|
|
861
|
+
| IFlexTurnReversionNonrevertibleOutcome;
|
|
862
|
+
|
|
863
|
+
export type TFlexTurnReversionCaptureInspectionV2 =
|
|
864
|
+
| { readonly status: 'missing' | 'prepared' | 'unknown' }
|
|
865
|
+
| {
|
|
866
|
+
readonly status: 'finalized';
|
|
867
|
+
readonly outcome: TFlexTurnReversionFinalizedOutcome;
|
|
868
|
+
};
|
|
869
|
+
|
|
870
|
+
export interface IFlexTurnReversionProviderV2<TScope> {
|
|
871
|
+
readonly protocolVersion: 2;
|
|
872
|
+
prepare(
|
|
873
|
+
context: IFlexTurnReversionBaseContext<TScope>,
|
|
874
|
+
): Promise<void> | void;
|
|
875
|
+
inspectCapture(
|
|
876
|
+
context: IFlexTurnReversionBaseContext<TScope>,
|
|
877
|
+
): Promise<TFlexTurnReversionCaptureInspectionV2> | TFlexTurnReversionCaptureInspectionV2;
|
|
878
|
+
finalize(
|
|
879
|
+
context: IFlexTurnReversionBaseContext<TScope>,
|
|
880
|
+
): Promise<TFlexTurnReversionFinalizedOutcome> | TFlexTurnReversionFinalizedOutcome;
|
|
881
|
+
apply(
|
|
882
|
+
context: IFlexTurnReversionApplyContext<TScope>,
|
|
883
|
+
): Promise<void> | void;
|
|
884
|
+
inspectApply(
|
|
885
|
+
context: IFlexTurnReversionApplyContext<TScope>,
|
|
886
|
+
): Promise<IFlexTurnReversionApplyInspection> | IFlexTurnReversionApplyInspection;
|
|
887
|
+
release(
|
|
888
|
+
context: IFlexTurnReversionReleaseContext<TScope>,
|
|
889
|
+
): Promise<void> | void;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
export type TFlexReversionPolicy = 'transcript-optional' | 'workspace-required';
|
|
893
|
+
|
|
894
|
+
export type TFlexSessionReversionGroupKind = 'candidate' | 'barrier' | 'no-change';
|
|
895
|
+
|
|
896
|
+
export interface IFlexSessionReversionGroup {
|
|
897
|
+
readonly runId: string;
|
|
898
|
+
readonly kind: TFlexSessionReversionGroupKind;
|
|
899
|
+
readonly visibility: 'visible' | 'hidden';
|
|
900
|
+
readonly affectedWorkspaces: readonly IFlexAffectedWorkspace[];
|
|
901
|
+
readonly affectedWorkspacesTruncated: boolean;
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
export interface IFlexSessionReversionInfo {
|
|
905
|
+
readonly undoAvailable: boolean;
|
|
906
|
+
readonly redoAvailable: boolean;
|
|
907
|
+
readonly groups: readonly IFlexSessionReversionGroup[];
|
|
908
|
+
}
|
|
909
|
+
|
|
675
910
|
export interface IFlexUndoSessionResult {
|
|
676
911
|
revertedRunId: string;
|
|
677
912
|
}
|
|
@@ -757,6 +992,17 @@ export interface IFlexSubagentDefinition {
|
|
|
757
992
|
maxSteps?: number;
|
|
758
993
|
}
|
|
759
994
|
|
|
995
|
+
export interface IFlexProjectManagementBuiltInToolsOptions {
|
|
996
|
+
task?: boolean;
|
|
997
|
+
goal?: boolean;
|
|
998
|
+
scratchpad?: boolean;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
export interface IFlexBuiltInToolsOptions {
|
|
1002
|
+
renameSession?: boolean;
|
|
1003
|
+
projectManagement?: IFlexProjectManagementBuiltInToolsOptions;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
760
1006
|
export interface IFlexHarnessOptions<TScope> {
|
|
761
1007
|
scopeResolver: IFlexScopeResolver<TScope>;
|
|
762
1008
|
modelResolver: IFlexModelResolver<TScope>;
|
|
@@ -769,9 +1015,11 @@ export interface IFlexHarnessOptions<TScope> {
|
|
|
769
1015
|
callbackLimits?: IFlexCallbackLimits;
|
|
770
1016
|
promptQueueLimits?: IFlexPromptQueueLimits;
|
|
771
1017
|
reversionLimits?: IFlexReversionLimits;
|
|
772
|
-
turnReversionProvider?: IFlexTurnReversionProvider<TScope>;
|
|
1018
|
+
turnReversionProvider?: IFlexTurnReversionProvider<TScope> | IFlexTurnReversionProviderV2<TScope>;
|
|
1019
|
+
reversionPolicy?: TFlexReversionPolicy;
|
|
773
1020
|
externalErrorProjector?: TFlexExternalErrorProjector;
|
|
774
1021
|
subagents?: IFlexSubagentDefinition[];
|
|
1022
|
+
builtInTools?: IFlexBuiltInToolsOptions;
|
|
775
1023
|
slashCommands?: readonly TFlexSlashCommandRegistration<TScope>[];
|
|
776
1024
|
maxSubagentDepth?: number;
|
|
777
1025
|
maxSubagentCallsPerRun?: number;
|