@ai-matrx/agents 0.18.5 → 0.19.2

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 (38) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/content-transfer/index.cjs.map +1 -1
  3. package/dist/content-transfer/index.js.map +1 -1
  4. package/dist/content-transfer/react/index.cjs.map +1 -1
  5. package/dist/content-transfer/react/index.js.map +1 -1
  6. package/dist/index.cjs +2 -2
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.js +2 -2
  9. package/dist/index.js.map +1 -1
  10. package/dist/mandates/index.cjs +2 -2
  11. package/dist/mandates/index.cjs.map +1 -1
  12. package/dist/mandates/index.d.cts +4 -4
  13. package/dist/mandates/index.d.ts +4 -4
  14. package/dist/mandates/index.js +2 -2
  15. package/dist/mandates/index.js.map +1 -1
  16. package/dist/matrx/index.cjs +2 -2
  17. package/dist/matrx/index.cjs.map +1 -1
  18. package/dist/matrx/index.js +2 -2
  19. package/dist/matrx/index.js.map +1 -1
  20. package/dist/react/index.cjs +1 -0
  21. package/dist/react/index.cjs.map +1 -1
  22. package/dist/react/index.js +1 -0
  23. package/dist/react/index.js.map +1 -1
  24. package/dist/sources/react/index.cjs +14 -4
  25. package/dist/sources/react/index.cjs.map +1 -1
  26. package/dist/sources/react/index.d.cts +11 -3
  27. package/dist/sources/react/index.d.ts +11 -3
  28. package/dist/sources/react/index.js +14 -4
  29. package/dist/sources/react/index.js.map +1 -1
  30. package/dist/sources/runtime/index.cjs +15 -4
  31. package/dist/sources/runtime/index.cjs.map +1 -1
  32. package/dist/sources/runtime/index.d.cts +22 -5
  33. package/dist/sources/runtime/index.d.ts +22 -5
  34. package/dist/sources/runtime/index.js +15 -4
  35. package/dist/sources/runtime/index.js.map +1 -1
  36. package/mandates/snapshots/keys.0.19.1.json +652 -0
  37. package/mandates/snapshots/keys.0.19.2.json +652 -0
  38. package/package.json +2 -2
@@ -596,8 +596,19 @@ declare function rememberPickedParts(card: SourceCardModel): SourceCardModel;
596
596
  declare function carryPickedParts(card: SourceCardModel, entry: SourceManifestEntry): SourceCardModel;
597
597
  declare function setCardWaitForClean(state: SourceSetState, id: string, wait: boolean): SourceSetState;
598
598
  declare function setSourceTopic(state: SourceSetState, topic: string): SourceSetState;
599
- /** Apply a set the review returned (forms, parts, caps, delivery) — and its topic. */
600
- declare function applyReviewedSourceSet(state: SourceSetState, set: SourceSet): SourceSetState;
599
+ /**
600
+ * What the person removed in "Review what goes in": the Sources that went INTO
601
+ * the review (`reviewed`) and did not come back in its answer — keyed by
602
+ * `sourceKey`. A Source that landed while the review was open is never in
603
+ * `reviewed`, so it is never removed by it (verify-4 V4-F #3).
604
+ */
605
+ declare function removedInReview(reviewed: SourceSet, answer: SourceSet): Set<string>;
606
+ /**
607
+ * Apply a set the review returned (forms, parts, caps, delivery) — and its
608
+ * topic. Pass `reviewed` (the set that was sent INTO the review) and every
609
+ * Source removed there leaves the list, bound by its own card id.
610
+ */
611
+ declare function applyReviewedSourceSet(state: SourceSetState, set: SourceSet, reviewed?: SourceSet): SourceSetState;
601
612
  /** The server measured the ready Sources: each ready card takes its entry. */
602
613
  declare function applyManifest(state: SourceSetState, manifest: SourceManifest): SourceSetState;
603
614
  /**
@@ -754,8 +765,14 @@ interface SourceSetController extends SourceSetActions {
754
765
  toSourceSet(options?: {
755
766
  targetModelId?: string | undefined;
756
767
  }): SourceSet;
757
- /** Apply a set the review returned (forms, parts, caps, delivery). */
758
- applySourceSet(set: SourceSet): void;
768
+ /**
769
+ * Apply a set the review returned (forms, parts, caps, delivery). Pass
770
+ * `reviewed` — the set sent INTO the review — and every Source removed there
771
+ * leaves the list too (only those; one that landed meanwhile stays).
772
+ */
773
+ applySourceSet(set: SourceSet, options?: {
774
+ reviewed?: SourceSet | undefined;
775
+ }): void;
759
776
  /** POST /sources/resolve — the grounded text for a generator, named as the cards name them. */
760
777
  resolve(options?: {
761
778
  targetModelId?: string | undefined;
@@ -1038,4 +1055,4 @@ declare function lookAtFileCards(cards: readonly SourceCardModel[], ctx: {
1038
1055
  signal: AbortSignal;
1039
1056
  } & FileRecoveryDeps): Promise<boolean>;
1040
1057
 
1041
- export { type BudgetVerdict, DELIVERY_CHOICES, DELIVERY_WORDS, type DeliveryWords, EMPTY_SOURCE_SET_STATE, type FetchSourcesTransportOptions, type FileRecoveryDeps, type FileSourceContext, type FileSourceStatus, type FileSourceStep, HEAVY_SHARE, KEEP_WAITING_FOR_ORGANIZATION, MAX_KEPT_TEXT_KNOB, NOT_KEPT_FOR_RELOAD, PARTS_MATCHED_BY_PAGE, PARTS_NOT_MATCHED, type PartMatchIds, type PersistedSourceCard, type PersistedSourceInput, type PlanInput, RELOADED_RESUMING, RELOADED_WHILE_ADDING, type ReloadedCard, SAME_SOURCE_AGAIN, SOURCE_CHARS_PER_TOKEN, type ScrapedSourcePage, type SourceAssociationEdge, type SourceAssociationResult, type SourceAttachTarget, type SourceAttachTo, type SourceCallOptions, type SourceCardModel, type SourceCardState, type SourceCardStatus, SourceDelivery, type SourceDoorCalls, SourceDoorError, type SourceDoorPath, type SourceDraft, type SourceDraftStorage, type SourceFileRunner, type SourceIntake, type SourceIntakeDeps, type SourceIntakeDoors, type SourceIntakeInput, type SourceKindId, type SourceLandingAnswer, type SourceLandingBodyBase, type SourceLandingNotice, type SourcePart, type SourcePartsSearchResult, type SourcePickedPart, type SourcePlan, type SourcePlanEntry, type SourcePlanStatus, type SourceSetActions, type SourceSetAdapter, type SourceSetConfig, type SourceSetController, type SourceSetMeta, type SourceSetState, type SourceSetStore, type SourceTileId, type SourceTransportOptions, type SourcesClient, type SourcesTransport, type UploadedSourceFile, WAITING_FOR_ORGANIZATION, type YouTubeTranscriptResult, addPendingCard, addReadyCard, allowedDeliveries, applyManifest, applyReviewedSourceSet, cardsToResume, cardsWaitingForOrganization, carryPickedParts, chosenForm, continueAfterOrganization, createFetchSourcesTransport, createMemorySourceDraftStorage, createMemorySourceSetStore, createSourceIntake, createSourceSetController, createSourcesClient, deliveryChoicesFor, deliveryPatch, deliverySwitchedNote, draftKindForToken, estimateSourceTokens, failCard, fileCardHeldForOrganization, fileSourcePollDelayMs, findParts, fitCardDeliveries, fitDelivery, hasSourceRef, isAskableFileCard, isSourceDraft, isWaitingFileCard, isWordQuery, lookAtFileCards, matchesPart, nextFileStep, partPages, planSourceReview, readPersistedSourceInput, readySourceRefs, registeredFileEdge, reloadedCard, rememberPickedParts, removeCard, renderedPartChars, restartCard, restoredCards, resumableInput, resumeInterrupted, sameSourceRef, selectSettled, selectSourceSet, selectTotalChars, setCardWaitForClean, setSourceTopic, settleCard, sourceAttachTargets, sourceCardChars, sourceCardMeasuredState, sourceCardState, sourceDelivery, sourceEntryChars, sourceKey, sourceRecoveryGuards, sourceRoomLeft, toPersistedSourceInput, updateCardDraft, updateCardRef, uploadCutOffSentence, withDefaultForm, withDisplayNames };
1058
+ export { type BudgetVerdict, DELIVERY_CHOICES, DELIVERY_WORDS, type DeliveryWords, EMPTY_SOURCE_SET_STATE, type FetchSourcesTransportOptions, type FileRecoveryDeps, type FileSourceContext, type FileSourceStatus, type FileSourceStep, HEAVY_SHARE, KEEP_WAITING_FOR_ORGANIZATION, MAX_KEPT_TEXT_KNOB, NOT_KEPT_FOR_RELOAD, PARTS_MATCHED_BY_PAGE, PARTS_NOT_MATCHED, type PartMatchIds, type PersistedSourceCard, type PersistedSourceInput, type PlanInput, RELOADED_RESUMING, RELOADED_WHILE_ADDING, type ReloadedCard, SAME_SOURCE_AGAIN, SOURCE_CHARS_PER_TOKEN, type ScrapedSourcePage, type SourceAssociationEdge, type SourceAssociationResult, type SourceAttachTarget, type SourceAttachTo, type SourceCallOptions, type SourceCardModel, type SourceCardState, type SourceCardStatus, SourceDelivery, type SourceDoorCalls, SourceDoorError, type SourceDoorPath, type SourceDraft, type SourceDraftStorage, type SourceFileRunner, type SourceIntake, type SourceIntakeDeps, type SourceIntakeDoors, type SourceIntakeInput, type SourceKindId, type SourceLandingAnswer, type SourceLandingBodyBase, type SourceLandingNotice, type SourcePart, type SourcePartsSearchResult, type SourcePickedPart, type SourcePlan, type SourcePlanEntry, type SourcePlanStatus, type SourceSetActions, type SourceSetAdapter, type SourceSetConfig, type SourceSetController, type SourceSetMeta, type SourceSetState, type SourceSetStore, type SourceTileId, type SourceTransportOptions, type SourcesClient, type SourcesTransport, type UploadedSourceFile, WAITING_FOR_ORGANIZATION, type YouTubeTranscriptResult, addPendingCard, addReadyCard, allowedDeliveries, applyManifest, applyReviewedSourceSet, cardsToResume, cardsWaitingForOrganization, carryPickedParts, chosenForm, continueAfterOrganization, createFetchSourcesTransport, createMemorySourceDraftStorage, createMemorySourceSetStore, createSourceIntake, createSourceSetController, createSourcesClient, deliveryChoicesFor, deliveryPatch, deliverySwitchedNote, draftKindForToken, estimateSourceTokens, failCard, fileCardHeldForOrganization, fileSourcePollDelayMs, findParts, fitCardDeliveries, fitDelivery, hasSourceRef, isAskableFileCard, isSourceDraft, isWaitingFileCard, isWordQuery, lookAtFileCards, matchesPart, nextFileStep, partPages, planSourceReview, readPersistedSourceInput, readySourceRefs, registeredFileEdge, reloadedCard, rememberPickedParts, removeCard, removedInReview, renderedPartChars, restartCard, restoredCards, resumableInput, resumeInterrupted, sameSourceRef, selectSettled, selectSourceSet, selectTotalChars, setCardWaitForClean, setSourceTopic, settleCard, sourceAttachTargets, sourceCardChars, sourceCardMeasuredState, sourceCardState, sourceDelivery, sourceEntryChars, sourceKey, sourceRecoveryGuards, sourceRoomLeft, toPersistedSourceInput, updateCardDraft, updateCardRef, uploadCutOffSentence, withDefaultForm, withDisplayNames };
@@ -596,8 +596,19 @@ declare function rememberPickedParts(card: SourceCardModel): SourceCardModel;
596
596
  declare function carryPickedParts(card: SourceCardModel, entry: SourceManifestEntry): SourceCardModel;
597
597
  declare function setCardWaitForClean(state: SourceSetState, id: string, wait: boolean): SourceSetState;
598
598
  declare function setSourceTopic(state: SourceSetState, topic: string): SourceSetState;
599
- /** Apply a set the review returned (forms, parts, caps, delivery) — and its topic. */
600
- declare function applyReviewedSourceSet(state: SourceSetState, set: SourceSet): SourceSetState;
599
+ /**
600
+ * What the person removed in "Review what goes in": the Sources that went INTO
601
+ * the review (`reviewed`) and did not come back in its answer — keyed by
602
+ * `sourceKey`. A Source that landed while the review was open is never in
603
+ * `reviewed`, so it is never removed by it (verify-4 V4-F #3).
604
+ */
605
+ declare function removedInReview(reviewed: SourceSet, answer: SourceSet): Set<string>;
606
+ /**
607
+ * Apply a set the review returned (forms, parts, caps, delivery) — and its
608
+ * topic. Pass `reviewed` (the set that was sent INTO the review) and every
609
+ * Source removed there leaves the list, bound by its own card id.
610
+ */
611
+ declare function applyReviewedSourceSet(state: SourceSetState, set: SourceSet, reviewed?: SourceSet): SourceSetState;
601
612
  /** The server measured the ready Sources: each ready card takes its entry. */
602
613
  declare function applyManifest(state: SourceSetState, manifest: SourceManifest): SourceSetState;
603
614
  /**
@@ -754,8 +765,14 @@ interface SourceSetController extends SourceSetActions {
754
765
  toSourceSet(options?: {
755
766
  targetModelId?: string | undefined;
756
767
  }): SourceSet;
757
- /** Apply a set the review returned (forms, parts, caps, delivery). */
758
- applySourceSet(set: SourceSet): void;
768
+ /**
769
+ * Apply a set the review returned (forms, parts, caps, delivery). Pass
770
+ * `reviewed` — the set sent INTO the review — and every Source removed there
771
+ * leaves the list too (only those; one that landed meanwhile stays).
772
+ */
773
+ applySourceSet(set: SourceSet, options?: {
774
+ reviewed?: SourceSet | undefined;
775
+ }): void;
759
776
  /** POST /sources/resolve — the grounded text for a generator, named as the cards name them. */
760
777
  resolve(options?: {
761
778
  targetModelId?: string | undefined;
@@ -1038,4 +1055,4 @@ declare function lookAtFileCards(cards: readonly SourceCardModel[], ctx: {
1038
1055
  signal: AbortSignal;
1039
1056
  } & FileRecoveryDeps): Promise<boolean>;
1040
1057
 
1041
- export { type BudgetVerdict, DELIVERY_CHOICES, DELIVERY_WORDS, type DeliveryWords, EMPTY_SOURCE_SET_STATE, type FetchSourcesTransportOptions, type FileRecoveryDeps, type FileSourceContext, type FileSourceStatus, type FileSourceStep, HEAVY_SHARE, KEEP_WAITING_FOR_ORGANIZATION, MAX_KEPT_TEXT_KNOB, NOT_KEPT_FOR_RELOAD, PARTS_MATCHED_BY_PAGE, PARTS_NOT_MATCHED, type PartMatchIds, type PersistedSourceCard, type PersistedSourceInput, type PlanInput, RELOADED_RESUMING, RELOADED_WHILE_ADDING, type ReloadedCard, SAME_SOURCE_AGAIN, SOURCE_CHARS_PER_TOKEN, type ScrapedSourcePage, type SourceAssociationEdge, type SourceAssociationResult, type SourceAttachTarget, type SourceAttachTo, type SourceCallOptions, type SourceCardModel, type SourceCardState, type SourceCardStatus, SourceDelivery, type SourceDoorCalls, SourceDoorError, type SourceDoorPath, type SourceDraft, type SourceDraftStorage, type SourceFileRunner, type SourceIntake, type SourceIntakeDeps, type SourceIntakeDoors, type SourceIntakeInput, type SourceKindId, type SourceLandingAnswer, type SourceLandingBodyBase, type SourceLandingNotice, type SourcePart, type SourcePartsSearchResult, type SourcePickedPart, type SourcePlan, type SourcePlanEntry, type SourcePlanStatus, type SourceSetActions, type SourceSetAdapter, type SourceSetConfig, type SourceSetController, type SourceSetMeta, type SourceSetState, type SourceSetStore, type SourceTileId, type SourceTransportOptions, type SourcesClient, type SourcesTransport, type UploadedSourceFile, WAITING_FOR_ORGANIZATION, type YouTubeTranscriptResult, addPendingCard, addReadyCard, allowedDeliveries, applyManifest, applyReviewedSourceSet, cardsToResume, cardsWaitingForOrganization, carryPickedParts, chosenForm, continueAfterOrganization, createFetchSourcesTransport, createMemorySourceDraftStorage, createMemorySourceSetStore, createSourceIntake, createSourceSetController, createSourcesClient, deliveryChoicesFor, deliveryPatch, deliverySwitchedNote, draftKindForToken, estimateSourceTokens, failCard, fileCardHeldForOrganization, fileSourcePollDelayMs, findParts, fitCardDeliveries, fitDelivery, hasSourceRef, isAskableFileCard, isSourceDraft, isWaitingFileCard, isWordQuery, lookAtFileCards, matchesPart, nextFileStep, partPages, planSourceReview, readPersistedSourceInput, readySourceRefs, registeredFileEdge, reloadedCard, rememberPickedParts, removeCard, renderedPartChars, restartCard, restoredCards, resumableInput, resumeInterrupted, sameSourceRef, selectSettled, selectSourceSet, selectTotalChars, setCardWaitForClean, setSourceTopic, settleCard, sourceAttachTargets, sourceCardChars, sourceCardMeasuredState, sourceCardState, sourceDelivery, sourceEntryChars, sourceKey, sourceRecoveryGuards, sourceRoomLeft, toPersistedSourceInput, updateCardDraft, updateCardRef, uploadCutOffSentence, withDefaultForm, withDisplayNames };
1058
+ export { type BudgetVerdict, DELIVERY_CHOICES, DELIVERY_WORDS, type DeliveryWords, EMPTY_SOURCE_SET_STATE, type FetchSourcesTransportOptions, type FileRecoveryDeps, type FileSourceContext, type FileSourceStatus, type FileSourceStep, HEAVY_SHARE, KEEP_WAITING_FOR_ORGANIZATION, MAX_KEPT_TEXT_KNOB, NOT_KEPT_FOR_RELOAD, PARTS_MATCHED_BY_PAGE, PARTS_NOT_MATCHED, type PartMatchIds, type PersistedSourceCard, type PersistedSourceInput, type PlanInput, RELOADED_RESUMING, RELOADED_WHILE_ADDING, type ReloadedCard, SAME_SOURCE_AGAIN, SOURCE_CHARS_PER_TOKEN, type ScrapedSourcePage, type SourceAssociationEdge, type SourceAssociationResult, type SourceAttachTarget, type SourceAttachTo, type SourceCallOptions, type SourceCardModel, type SourceCardState, type SourceCardStatus, SourceDelivery, type SourceDoorCalls, SourceDoorError, type SourceDoorPath, type SourceDraft, type SourceDraftStorage, type SourceFileRunner, type SourceIntake, type SourceIntakeDeps, type SourceIntakeDoors, type SourceIntakeInput, type SourceKindId, type SourceLandingAnswer, type SourceLandingBodyBase, type SourceLandingNotice, type SourcePart, type SourcePartsSearchResult, type SourcePickedPart, type SourcePlan, type SourcePlanEntry, type SourcePlanStatus, type SourceSetActions, type SourceSetAdapter, type SourceSetConfig, type SourceSetController, type SourceSetMeta, type SourceSetState, type SourceSetStore, type SourceTileId, type SourceTransportOptions, type SourcesClient, type SourcesTransport, type UploadedSourceFile, WAITING_FOR_ORGANIZATION, type YouTubeTranscriptResult, addPendingCard, addReadyCard, allowedDeliveries, applyManifest, applyReviewedSourceSet, cardsToResume, cardsWaitingForOrganization, carryPickedParts, chosenForm, continueAfterOrganization, createFetchSourcesTransport, createMemorySourceDraftStorage, createMemorySourceSetStore, createSourceIntake, createSourceSetController, createSourcesClient, deliveryChoicesFor, deliveryPatch, deliverySwitchedNote, draftKindForToken, estimateSourceTokens, failCard, fileCardHeldForOrganization, fileSourcePollDelayMs, findParts, fitCardDeliveries, fitDelivery, hasSourceRef, isAskableFileCard, isSourceDraft, isWaitingFileCard, isWordQuery, lookAtFileCards, matchesPart, nextFileStep, partPages, planSourceReview, readPersistedSourceInput, readySourceRefs, registeredFileEdge, reloadedCard, rememberPickedParts, removeCard, removedInReview, renderedPartChars, restartCard, restoredCards, resumableInput, resumeInterrupted, sameSourceRef, selectSettled, selectSourceSet, selectTotalChars, setCardWaitForClean, setSourceTopic, settleCard, sourceAttachTargets, sourceCardChars, sourceCardMeasuredState, sourceCardState, sourceDelivery, sourceEntryChars, sourceKey, sourceRecoveryGuards, sourceRoomLeft, toPersistedSourceInput, updateCardDraft, updateCardRef, uploadCutOffSentence, withDefaultForm, withDisplayNames };
@@ -391,9 +391,19 @@ function setCardWaitForClean(state, id, wait) {
391
391
  function setSourceTopic(state, topic) {
392
392
  return state.topic === topic ? state : { ...state, topic };
393
393
  }
394
- function applyReviewedSourceSet(state, set) {
394
+ function removedInReview(reviewed, answer) {
395
+ const kept = new Set(answer.sources.map(sourceKey));
396
+ return new Set(reviewed.sources.map(sourceKey).filter((k) => !kept.has(k)));
397
+ }
398
+ function applyReviewedSourceSet(state, set, reviewed) {
395
399
  let next = state;
396
- for (const card of state.cards) {
400
+ if (reviewed) {
401
+ const removed = removedInReview(reviewed, set);
402
+ for (const card of state.cards) {
403
+ if (card.draft.ref && removed.has(sourceKey(card.draft.ref))) next = removeCard(next, card.id);
404
+ }
405
+ }
406
+ for (const card of next.cards) {
397
407
  const ref = card.draft.ref;
398
408
  if (!ref) continue;
399
409
  const match = set.sources.find((r) => sameSourceRef(r, ref));
@@ -846,8 +856,8 @@ function createSourceSetController(adapter) {
846
856
  hasRef: (resourceType, resourceId) => hasSourceRef(store.getState(), resourceType, resourceId),
847
857
  liveCount: () => store.getState().cards.length,
848
858
  toSourceSet: (options = {}) => selectSourceSet(store.getState(), options),
849
- applySourceSet(set) {
850
- commit(applyReviewedSourceSet(store.getState(), set));
859
+ applySourceSet(set, options = {}) {
860
+ commit(applyReviewedSourceSet(store.getState(), set, options.reviewed));
851
861
  },
852
862
  async manifest() {
853
863
  const refs = readySourceRefs(store.getState());
@@ -1425,6 +1435,7 @@ export {
1425
1435
  reloadedCard,
1426
1436
  rememberPickedParts,
1427
1437
  removeCard,
1438
+ removedInReview,
1428
1439
  renderedPartChars,
1429
1440
  restartCard,
1430
1441
  restoredCards,