@tinoy/pi-canon 0.5.0 → 0.6.1
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/README.md +7 -0
- package/index.ts +19 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
> [!WARNING]
|
|
2
|
+
> **Do not install anything here yet.**
|
|
3
|
+
>
|
|
4
|
+
> This is a fast-moving prototype: the interfaces change without notice, and nothing here
|
|
5
|
+
> is stable. Every package in this project is headed for a stable 1.0, but that is still
|
|
6
|
+
> some way off. Install one only if you intend to follow the code and expect breakage.
|
|
7
|
+
|
|
1
8
|
# @tinoy/pi-canon
|
|
2
9
|
|
|
3
10
|
Durable system-prompt rules ("canon") for pi. Rules and learned facts are stored
|
package/index.ts
CHANGED
|
@@ -764,7 +764,25 @@ export default function (pi: ExtensionAPI) {
|
|
|
764
764
|
const payload = event.payload as Partial<CanonNotice> | null;
|
|
765
765
|
if (!payload || payload.type !== "canon" || !payload.scope || !payload.id)
|
|
766
766
|
return;
|
|
767
|
-
if (!matches(payload.scope, currentModel(), audiences))
|
|
767
|
+
if (!matches(payload.scope, currentModel(), audiences)) {
|
|
768
|
+
// Withholding is otherwise unattributable: nothing is delivered and nothing is
|
|
769
|
+
// sent back, so a scope mismatch leaves no trace on either side. The decision is
|
|
770
|
+
// unchanged here — only the record of it is added.
|
|
771
|
+
hookLog("canon", "notice-withheld", {
|
|
772
|
+
namespace: NAMESPACE,
|
|
773
|
+
id: payload.id,
|
|
774
|
+
op: payload.op,
|
|
775
|
+
entryModel: payload.scope.model,
|
|
776
|
+
entryAudience: payload.scope.audience,
|
|
777
|
+
sessionModel: currentModel(),
|
|
778
|
+
sessionAudience: sessionLabel(audiences),
|
|
779
|
+
mismatch:
|
|
780
|
+
payload.scope.audience !== "all" && !audiences.has(payload.scope.audience)
|
|
781
|
+
? "audience"
|
|
782
|
+
: "model",
|
|
783
|
+
});
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
768
786
|
const sender = payload.sender?.trim() || event.fromSessionId.slice(0, 8);
|
|
769
787
|
const verb =
|
|
770
788
|
payload.op === "remove" || payload.op === "category_remove"
|