pi-background-tasks 1.0.3 → 1.0.6
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/BACKGROUND-TASKS-INSTRUCTIONS.md +2 -1
- package/README.md +2 -1
- package/TESTING.md +3 -3
- package/TEST_PLAN.md +10 -9
- package/docs/attestations.json +5 -5
- package/docs/manifest.json +9 -5
- package/docs/operations/configuration.md +10 -0
- package/docs/operations/testing.md +2 -1
- package/docs/operations/troubleshooting.md +3 -1
- package/docs/read-before-edit.md +1 -0
- package/docs/reference/runtime-contracts.md +44 -40
- package/docs/subsystems/docs-freshness-gate.md +6 -6
- package/docs/subsystems/fusion.md +18 -11
- package/package.json +4 -3
- package/src/core/fusion/budget.ts +11 -4
- package/src/core/fusion/child-protocol.ts +137 -12
- package/src/core/fusion/claude-cache.ts +186 -0
- package/src/core/fusion/config.ts +13 -0
- package/src/core/fusion/pi-child.ts +617 -30
- package/src/core/fusion/types.ts +29 -7
- package/src/fusion-child-extension.ts +659 -55
package/src/core/fusion/types.ts
CHANGED
|
@@ -14,14 +14,15 @@ export const FUSION_MODEL_CONFIG_SCHEMA_VERSION = 'pi-background-tasks.fusion-mo
|
|
|
14
14
|
export const FUSION_LEGACY_INPUT_SCHEMA_VERSION = 'pi-background-tasks.fusion-input.v4';
|
|
15
15
|
export const FUSION_INPUT_SCHEMA_VERSION = 'pi-background-tasks.fusion-input.v5';
|
|
16
16
|
export const FUSION_EVALUATION_SCHEMA_VERSION = 'pi-background-tasks.fusion-evaluation.v1';
|
|
17
|
-
export const FUSION_VALIDATE_CANDIDATE_SCHEMA_VERSION =
|
|
17
|
+
export const FUSION_VALIDATE_CANDIDATE_SCHEMA_VERSION =
|
|
18
|
+
'pi-background-tasks.fusion-validation-candidate.v1';
|
|
18
19
|
export const FUSION_LEGACY_RESULT_SCHEMA_VERSION = 'pi-background-tasks.fusion-result.v4';
|
|
19
20
|
export const FUSION_RESULT_SCHEMA_VERSION = 'pi-background-tasks.fusion-result.v5';
|
|
20
21
|
export const FUSION_LEGACY_MANIFEST_SCHEMA_VERSION = 'pi-background-tasks.fusion-manifest.v3';
|
|
21
22
|
export const FUSION_MANIFEST_SCHEMA_VERSION = 'pi-background-tasks.fusion-manifest.v4';
|
|
22
23
|
export const FUSION_CONTEXT_LEDGER_SCHEMA_VERSION = 'pi-background-tasks.fusion-context-ledger.v2';
|
|
23
24
|
export const FUSION_SOURCE_POLICY_SCHEMA_VERSION = 'pi-background-tasks.fusion-source-policy.v1';
|
|
24
|
-
export const FUSION_BUDGET_PLAN_SCHEMA_VERSION = 'pi-background-tasks.fusion-budget-plan.
|
|
25
|
+
export const FUSION_BUDGET_PLAN_SCHEMA_VERSION = 'pi-background-tasks.fusion-budget-plan.v4';
|
|
25
26
|
export const FUSION_CALIBRATION_VIOLATION_SCHEMA_VERSION =
|
|
26
27
|
'pi-background-tasks.fusion-calibration-violation.v1';
|
|
27
28
|
export const FUSION_TOOL_CALL_LOG_SCHEMA_VERSION = 'pi-background-tasks.fusion-tool-call.v1';
|
|
@@ -186,6 +187,7 @@ export interface ResolvedFusionModel {
|
|
|
186
187
|
qualifiedId: string;
|
|
187
188
|
thinkingLevel: FusionThinkingLevel;
|
|
188
189
|
contextWindow: number;
|
|
190
|
+
maxOutputTokens: number;
|
|
189
191
|
}
|
|
190
192
|
|
|
191
193
|
export interface ResolvedFusionModels {
|
|
@@ -556,7 +558,11 @@ export interface FusionResultDetails {
|
|
|
556
558
|
source: FusionSource;
|
|
557
559
|
status: 'completed';
|
|
558
560
|
context: { kind: FusionContextKind; policy_id: string };
|
|
559
|
-
tool_policy: {
|
|
561
|
+
tool_policy: {
|
|
562
|
+
candidate_tools: readonly string[];
|
|
563
|
+
evaluation_tools: readonly [];
|
|
564
|
+
merge_tools: readonly [];
|
|
565
|
+
};
|
|
560
566
|
artifact_dir: string;
|
|
561
567
|
models: {
|
|
562
568
|
candidates: readonly [string, string, string];
|
|
@@ -595,6 +601,8 @@ export type FusionErrorCode =
|
|
|
595
601
|
| 'child_stdin_failed'
|
|
596
602
|
| 'child_event_invalid'
|
|
597
603
|
| 'child_exit_failed'
|
|
604
|
+
| 'child_runtime_budget_exceeded'
|
|
605
|
+
| 'child_cache_policy_invalid'
|
|
598
606
|
| 'child_timeout'
|
|
599
607
|
| 'child_output_cap'
|
|
600
608
|
| 'child_cancelled'
|
|
@@ -815,8 +823,17 @@ export interface FusionArtifactManifest {
|
|
|
815
823
|
evaluation: FusionCapability;
|
|
816
824
|
merge: FusionCapability;
|
|
817
825
|
};
|
|
818
|
-
context: {
|
|
819
|
-
|
|
826
|
+
context: {
|
|
827
|
+
kind: FusionContextKind;
|
|
828
|
+
policy_id: string;
|
|
829
|
+
ledger_artifact?: string;
|
|
830
|
+
source_policy_artifact?: string;
|
|
831
|
+
};
|
|
832
|
+
tool_policy: {
|
|
833
|
+
candidate_tools: readonly string[];
|
|
834
|
+
evaluation_tools: readonly [];
|
|
835
|
+
merge_tools: readonly [];
|
|
836
|
+
};
|
|
820
837
|
usage: FusionUsage;
|
|
821
838
|
attempts: readonly FusionAttemptArtifactRecord[];
|
|
822
839
|
artifacts: Readonly<Record<string, FusionArtifactRef>>;
|
|
@@ -900,7 +917,11 @@ export interface FusionBudgetPlanV1 {
|
|
|
900
917
|
workflow: FusionWorkflowId;
|
|
901
918
|
context: { kind: FusionContextKind; policy_id: string };
|
|
902
919
|
fixed_candidate_policy: { capability: FusionCapability; tools: readonly string[] };
|
|
903
|
-
tool_policy: {
|
|
920
|
+
tool_policy: {
|
|
921
|
+
candidate_tools: readonly string[];
|
|
922
|
+
evaluation_tools: readonly [];
|
|
923
|
+
merge_tools: readonly [];
|
|
924
|
+
};
|
|
904
925
|
policy: FusionBudgetPolicyDescriptor;
|
|
905
926
|
routes: readonly FusionRouteCapacity[];
|
|
906
927
|
stages: readonly FusionStageBudgetPlanEntry[];
|
|
@@ -913,7 +934,8 @@ export interface FusionBudgetPlanV1 {
|
|
|
913
934
|
|
|
914
935
|
/** Documented, versioned budget policy. */
|
|
915
936
|
export interface FusionBudgetPolicyDescriptor {
|
|
916
|
-
id: 'fusion-budget-policy-
|
|
937
|
+
id: 'fusion-budget-policy-v4';
|
|
938
|
+
route_output_reserve_strategy: 'max_fusion_contract_or_model_max';
|
|
917
939
|
calibration_version: string;
|
|
918
940
|
calibration_table: Readonly<Record<TokenBudgetFamily, TokenBudgetFamilyCalibration>>;
|
|
919
941
|
reserved_output_tokens: number;
|