create-principles-disciple 1.145.11 → 1.145.13

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.
Files changed (74) hide show
  1. package/_release/product-identity.json +2 -2
  2. package/codex-adapter/dist/codec/input-decoder.js +11 -3
  3. package/codex-adapter/package.json +1 -1
  4. package/console/dist/server/models/ActivationsConsoleModel.d.ts +3 -1
  5. package/console/dist/server/models/ActivationsConsoleModel.js +39 -5
  6. package/console/dist/server/models/ApprovalsConsoleModel.d.ts +1 -1
  7. package/console/dist/server/models/ApprovalsConsoleModel.js +64 -8
  8. package/console/dist/server/models/ApprovalsGroupedConsoleModel.d.ts +25 -1
  9. package/console/dist/server/models/ApprovalsGroupedConsoleModel.js +116 -24
  10. package/console/dist/server/routes/approvals-grouped.js +5 -2
  11. package/console/dist/shared/prompt-injection-contract.d.ts +83 -2
  12. package/console/dist/ui/i18n/en.json +25 -1
  13. package/console/dist/ui/i18n/zh-CN.json +25 -1
  14. package/console/dist/ui/pages/activation/ActivationPage.js +56 -5
  15. package/console/dist/ui/pages/focus/FocusPage.js +87 -21
  16. package/console/dist/ui/pages/focus/focus-validation.js +12 -0
  17. package/console/dist/ui/utils/validators.d.ts +6 -0
  18. package/console/dist/ui/utils/validators.js +93 -4
  19. package/console/dist/web/assets/app.js +24 -24
  20. package/core/dist/host/host-adapter.d.ts +27 -0
  21. package/core/dist/host/host-adapter.d.ts.map +1 -1
  22. package/core/dist/host/host-adapter.js.map +1 -1
  23. package/core/dist/host/index.d.ts +1 -1
  24. package/core/dist/host/index.d.ts.map +1 -1
  25. package/core/dist/host/index.js.map +1 -1
  26. package/core/dist/runtime-v2/activation/index.d.ts +2 -0
  27. package/core/dist/runtime-v2/activation/index.d.ts.map +1 -1
  28. package/core/dist/runtime-v2/activation/index.js +2 -0
  29. package/core/dist/runtime-v2/activation/index.js.map +1 -1
  30. package/core/dist/runtime-v2/activation/prompt-budget-policy.d.ts +106 -0
  31. package/core/dist/runtime-v2/activation/prompt-budget-policy.d.ts.map +1 -0
  32. package/core/dist/runtime-v2/activation/prompt-budget-policy.js +229 -0
  33. package/core/dist/runtime-v2/activation/prompt-budget-policy.js.map +1 -0
  34. package/core/dist/runtime-v2/adapter/pi-ai-catalog.d.ts +2 -0
  35. package/core/dist/runtime-v2/adapter/pi-ai-catalog.d.ts.map +1 -1
  36. package/core/dist/runtime-v2/adapter/pi-ai-catalog.js +50 -1
  37. package/core/dist/runtime-v2/adapter/pi-ai-catalog.js.map +1 -1
  38. package/core/dist/runtime-v2/index.d.ts +3 -3
  39. package/core/dist/runtime-v2/index.d.ts.map +1 -1
  40. package/core/dist/runtime-v2/index.js +2 -2
  41. package/core/dist/runtime-v2/index.js.map +1 -1
  42. package/core/dist/runtime-v2/types/event-types.d.ts +24 -0
  43. package/core/dist/runtime-v2/types/event-types.d.ts.map +1 -1
  44. package/core/dist/runtime-v2/types/event-types.js +22 -0
  45. package/core/dist/runtime-v2/types/event-types.js.map +1 -1
  46. package/core/package.json +1 -1
  47. package/host-runtime/dist/active-principle-prompt.d.ts +23 -1
  48. package/host-runtime/dist/active-principle-prompt.js +21 -5
  49. package/host-runtime/dist/index.d.ts +1 -0
  50. package/host-runtime/dist/index.js +37 -2
  51. package/host-runtime/dist/prompt-activation-deliverability.d.ts +36 -3
  52. package/host-runtime/dist/prompt-activation-deliverability.js +44 -26
  53. package/host-runtime/dist/prompt-injection-budget-observation.d.ts +176 -0
  54. package/host-runtime/dist/prompt-injection-budget-observation.js +449 -0
  55. package/host-runtime/dist/prompt-injection-projection.d.ts +39 -1
  56. package/host-runtime/dist/prompt-injection-projection.js +43 -9
  57. package/host-runtime/dist/prompt-injection-status.d.ts +47 -5
  58. package/host-runtime/dist/prompt-injection-status.js +45 -8
  59. package/host-runtime/package.json +1 -1
  60. package/package.json +2 -2
  61. package/pd-cli/dist/commands/runtime-activation.d.ts +3 -1
  62. package/pd-cli/dist/commands/runtime-activation.d.ts.map +1 -1
  63. package/pd-cli/dist/commands/runtime-activation.js +23 -6
  64. package/pd-cli/dist/commands/runtime-activation.js.map +1 -1
  65. package/pd-cli/package.json +1 -1
  66. package/plugin/dist/bundle.js +430 -430
  67. package/plugin/dist/governance-audit.js +2 -2
  68. package/plugin/dist/openclaw-sdk.d.ts +9 -1
  69. package/plugin/dist/openclaw.plugin.json +1 -1
  70. package/plugin/openclaw.plugin.json +1 -1
  71. package/plugin/package.json +1 -1
  72. package/release-manager/package.json +2 -2
  73. package/workbuddy-adapter/dist/codec/input-decoder.js +16 -4
  74. package/workbuddy-adapter/package.json +1 -1
@@ -655,6 +655,12 @@ export interface ApprovalGroupData {
655
655
  intentFields: Record<string, string>;
656
656
  };
657
657
  fitsPromptBudget?: boolean;
658
+ /**
659
+ * SPEC-PD-MODEL-AWARE-PROMPT-BUDGET-001: honest tier classification of the
660
+ * candidate's own entry vs the supported budget range. `model_dependent`
661
+ * qualifies the rotation promise (fits only on larger-context models).
662
+ */
663
+ promptBudgetTierFit?: 'fits_all_tiers' | 'model_dependent' | 'exceeds_max_tier' | 'unconfirmed';
658
664
  /**
659
665
  * PRI-940: the pinned artifact is missing from the store, so the card has no
660
666
  * human-readable payload and `principleTitle` carries the synthesized
@@ -66,6 +66,30 @@ function isGovernanceTimestamp(value) {
66
66
  function hasOwnFields(value, fields) {
67
67
  return fields.every(field => Object.hasOwn(value, field));
68
68
  }
69
+ const PROMPT_BUDGET_FALLBACK_REASONS = new Set([
70
+ 'host_capacity_absent',
71
+ 'host_capacity_source_untrusted',
72
+ 'host_capacity_invalid_value',
73
+ 'catalog_unavailable',
74
+ 'model_identity_absent',
75
+ 'catalog_no_exact_match',
76
+ 'catalog_no_match_for_model_id',
77
+ 'catalog_ambiguous_model_id',
78
+ 'catalog_provider_absent',
79
+ 'catalog_metadata_invalid',
80
+ // PRI-1017: console-side bounded code — a runtime observation exists but
81
+ // is too old to be presented as the current budget.
82
+ 'runtime_budget_observation_stale',
83
+ ]);
84
+ function isPromptBudgetFallbackReason(value) {
85
+ return isString(value) && PROMPT_BUDGET_FALLBACK_REASONS.has(value);
86
+ }
87
+ function isPromptBudgetCapacitySource(value) {
88
+ return value === 'host_effective_window' || value === 'pi_catalog_exact' || value === 'legacy_fallback';
89
+ }
90
+ function isPromptBudgetCapacityStatus(value) {
91
+ return value === 'confirmed' || value === 'unknown';
92
+ }
69
93
  function isStringEnum(value, allowed) {
70
94
  return typeof value === 'string' && allowed.has(value);
71
95
  }
@@ -1061,7 +1085,7 @@ export function validateGovernanceQueue(v) {
1061
1085
  return result;
1062
1086
  }
1063
1087
  const PROMPT_INJECTION_STATUS_KINDS = new Set([
1064
- 'injectable', 'oversized', 'window_excluded', 'resolution_failed', 'route_unconfirmed',
1088
+ 'injectable', 'oversized', 'model_dependent', 'window_excluded', 'resolution_failed', 'route_unconfirmed',
1065
1089
  ]);
1066
1090
  /** rc-1..rc-4: validate the per-activation injection status as untrusted input. */
1067
1091
  function validatePromptActivationInjectionStatus(v) {
@@ -1089,9 +1113,10 @@ function validatePromptActivationInjectionStatus(v) {
1089
1113
  for (const entry of v.perHostFits) {
1090
1114
  if (!isObject(entry))
1091
1115
  return null;
1092
- if ((entry.hostKind !== 'openclaw' && entry.hostKind !== 'codex' && entry.hostKind !== 'workbuddy') || typeof entry.fits !== 'boolean')
1116
+ if ((entry.hostKind !== 'openclaw' && entry.hostKind !== 'codex' && entry.hostKind !== 'workbuddy')
1117
+ || (entry.tierFit !== 'fits_all_tiers' && entry.tierFit !== 'model_dependent' && entry.tierFit !== 'exceeds_max_tier'))
1093
1118
  return null;
1094
- perHostFits.push({ hostKind: entry.hostKind, fits: entry.fits });
1119
+ perHostFits.push({ hostKind: entry.hostKind, tierFit: entry.tierFit });
1095
1120
  }
1096
1121
  result.perHostFits = perHostFits;
1097
1122
  }
@@ -1162,6 +1187,24 @@ export function validateActivations(v) {
1162
1187
  summary.nextAction = route.nextAction;
1163
1188
  if (Object.hasOwn(route, 'globalReason') && isString(route.globalReason))
1164
1189
  summary.globalReason = route.globalReason;
1190
+ // PRI-1017: runtime budget observation timestamp the per-row budget
1191
+ // figures were computed under (additive, drop-on-invalid).
1192
+ if (Object.hasOwn(route, 'budgetObservedAt') && isString(route.budgetObservedAt) && route.budgetObservedAt.length > 0 && Number.isFinite(Date.parse(route.budgetObservedAt))) {
1193
+ summary.budgetObservedAt = route.budgetObservedAt;
1194
+ }
1195
+ if (Object.hasOwn(route, 'budgetCapacitySource') && isPromptBudgetCapacitySource(route.budgetCapacitySource)) {
1196
+ summary.budgetCapacitySource = route.budgetCapacitySource;
1197
+ }
1198
+ if (Object.hasOwn(route, 'budgetCapacityStatus') && isPromptBudgetCapacityStatus(route.budgetCapacityStatus)) {
1199
+ summary.budgetCapacityStatus = route.budgetCapacityStatus;
1200
+ }
1201
+ if (Object.hasOwn(route, 'budgetContextWindowTokens') && typeof route.budgetContextWindowTokens === 'number'
1202
+ && Number.isInteger(route.budgetContextWindowTokens) && route.budgetContextWindowTokens > 0) {
1203
+ summary.budgetContextWindowTokens = route.budgetContextWindowTokens;
1204
+ }
1205
+ if (Object.hasOwn(route, 'budgetFallbackReason') && isPromptBudgetFallbackReason(route.budgetFallbackReason)) {
1206
+ summary.budgetFallbackReason = route.budgetFallbackReason;
1207
+ }
1165
1208
  result.promptInjectionRoute = summary;
1166
1209
  }
1167
1210
  }
@@ -1743,6 +1786,13 @@ function validateApprovalGroup(v) {
1743
1786
  if (Object.hasOwn(v, 'fitsPromptBudget') && typeof v.fitsPromptBudget === 'boolean') {
1744
1787
  result.fitsPromptBudget = v.fitsPromptBudget;
1745
1788
  }
1789
+ // SPEC-PD-MODEL-AWARE-PROMPT-BUDGET-001: optional tier fit, whitelist +
1790
+ // drop-on-invalid (same rule). Absent keeps the boolean-only behavior.
1791
+ if (Object.hasOwn(v, 'promptBudgetTierFit')
1792
+ && (v.promptBudgetTierFit === 'fits_all_tiers' || v.promptBudgetTierFit === 'model_dependent'
1793
+ || v.promptBudgetTierFit === 'exceeds_max_tier' || v.promptBudgetTierFit === 'unconfirmed')) {
1794
+ result.promptBudgetTierFit = v.promptBudgetTierFit;
1795
+ }
1746
1796
  // PRI-940: optional artifactUnavailable. Only a real boolean is propagated; a
1747
1797
  // present-but-wrong value is dropped so the card keeps its plain untitled
1748
1798
  // fallback rather than rendering an unverified claim.
@@ -1806,6 +1856,26 @@ export function validatePromptInjectionBudgetStatus(v) {
1806
1856
  if (Object.hasOwn(v, 'nextAction') && isString(v.nextAction)) {
1807
1857
  result.nextAction = v.nextAction;
1808
1858
  }
1859
+ // SPEC-PD-MODEL-AWARE-PROMPT-BUDGET-001 §7: budget provenance, additive +
1860
+ // drop-on-invalid. Absent behaves as the legacy fixed-budget view
1861
+ // (pre-SPEC server compat).
1862
+ if (Object.hasOwn(v, 'budgetCapacitySource') && isPromptBudgetCapacitySource(v.budgetCapacitySource)) {
1863
+ result.budgetCapacitySource = v.budgetCapacitySource;
1864
+ }
1865
+ if (Object.hasOwn(v, 'budgetFallbackReason') && isPromptBudgetFallbackReason(v.budgetFallbackReason)) {
1866
+ result.budgetFallbackReason = v.budgetFallbackReason;
1867
+ }
1868
+ if (Object.hasOwn(v, 'budgetCapacityStatus') && isPromptBudgetCapacityStatus(v.budgetCapacityStatus)) {
1869
+ result.budgetCapacityStatus = v.budgetCapacityStatus;
1870
+ }
1871
+ if (Object.hasOwn(v, 'budgetContextWindowTokens') && typeof v.budgetContextWindowTokens === 'number' && Number.isInteger(v.budgetContextWindowTokens) && v.budgetContextWindowTokens > 0) {
1872
+ result.budgetContextWindowTokens = v.budgetContextWindowTokens;
1873
+ }
1874
+ // PRI-1017: observation timestamp — a PAST runtime fact, never a live
1875
+ // claim. Present-but-invalid drops (rc-1/rc-2), never propagated.
1876
+ if (Object.hasOwn(v, 'budgetObservedAt') && isString(v.budgetObservedAt) && v.budgetObservedAt.length > 0 && Number.isFinite(Date.parse(v.budgetObservedAt))) {
1877
+ result.budgetObservedAt = v.budgetObservedAt;
1878
+ }
1809
1879
  if (Object.hasOwn(v, 'perHost') && Array.isArray(v.perHost)) {
1810
1880
  // rc-4: validate every element, not just "is array".
1811
1881
  const perHost = [];
@@ -1819,7 +1889,26 @@ export function validatePromptInjectionBudgetStatus(v) {
1819
1889
  || typeof hostTruncated !== 'boolean') {
1820
1890
  return null;
1821
1891
  }
1822
- perHost.push({ hostKind, route, usedChars: hostUsed, truncated: hostTruncated });
1892
+ const forecast = { hostKind, route, usedChars: hostUsed, truncated: hostTruncated };
1893
+ // PRI-1017: per-host budget basis (additive, drop-on-invalid). Absent
1894
+ // behaves as the pre-PRI-1017 payload where the headline budget was
1895
+ // shared — the UI must not present one host's window as another's.
1896
+ if (Object.hasOwn(entry, 'budget') && typeof entry.budget === 'number' && Number.isInteger(entry.budget) && entry.budget > 0) {
1897
+ forecast.budget = entry.budget;
1898
+ }
1899
+ if (Object.hasOwn(entry, 'budgetCapacitySource') && isPromptBudgetCapacitySource(entry.budgetCapacitySource)) {
1900
+ forecast.budgetCapacitySource = entry.budgetCapacitySource;
1901
+ }
1902
+ if (Object.hasOwn(entry, 'budgetCapacityStatus') && isPromptBudgetCapacityStatus(entry.budgetCapacityStatus)) {
1903
+ forecast.budgetCapacityStatus = entry.budgetCapacityStatus;
1904
+ }
1905
+ if (Object.hasOwn(entry, 'budgetObservedAt') && isString(entry.budgetObservedAt) && entry.budgetObservedAt.length > 0 && Number.isFinite(Date.parse(entry.budgetObservedAt))) {
1906
+ forecast.budgetObservedAt = entry.budgetObservedAt;
1907
+ }
1908
+ if (Object.hasOwn(entry, 'budgetFallbackReason') && isPromptBudgetFallbackReason(entry.budgetFallbackReason)) {
1909
+ forecast.budgetFallbackReason = entry.budgetFallbackReason;
1910
+ }
1911
+ perHost.push(forecast);
1823
1912
  }
1824
1913
  result.perHost = perHost;
1825
1914
  }