@agimon-ai/po-network 0.0.2-alpha.86 → 0.0.2-alpha.88
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.
|
@@ -15,12 +15,8 @@ function validCapabilityOperations(value) {
|
|
|
15
15
|
if (!Array.isArray(value) || value.length > 3) return false;
|
|
16
16
|
const scopes = /* @__PURE__ */ new Set();
|
|
17
17
|
return value.every((operation) => {
|
|
18
|
-
if (!record(operation) || !
|
|
19
|
-
|
|
20
|
-
"workspace",
|
|
21
|
-
"session"
|
|
22
|
-
].includes(String(operation.scope))) return false;
|
|
23
|
-
const scope = String(operation.scope);
|
|
18
|
+
if (!record(operation) || !_agimon_ai_po_core.FEDERATION_OPERATION_SCOPES.includes(String(operation.scope))) return false;
|
|
19
|
+
const scope = operation.scope === "global" ? "host" : String(operation.scope);
|
|
24
20
|
if (scopes.has(scope)) return false;
|
|
25
21
|
scopes.add(scope);
|
|
26
22
|
return Array.isArray(operation.names) && operation.names.length <= 64 && operation.names.every((name) => typeof name === "string" && /^[a-z][a-z0-9.-]{0,63}$/.test(name)) && new Set(operation.names).size === operation.names.length;
|
|
@@ -61,7 +57,13 @@ async function verifyCapabilityManifest(envelope, roster, now) {
|
|
|
61
57
|
ids.add(template.id);
|
|
62
58
|
}
|
|
63
59
|
if (!await (0, _agimon_ai_po_web_security_browser.verifyAttestation)(host.publicKey, "po/capabilities/v1", (0, _agimon_ai_po_web_security_browser.federationEnvelopeFields)(payload), envelope.signature)) return void 0;
|
|
64
|
-
return structuredClone(
|
|
60
|
+
return structuredClone({
|
|
61
|
+
...payload,
|
|
62
|
+
packages: payload.packages.map((pkg) => ({
|
|
63
|
+
...pkg,
|
|
64
|
+
operations: (0, _agimon_ai_po_core.normalizeFederationOperations)(pkg.operations)
|
|
65
|
+
}))
|
|
66
|
+
});
|
|
65
67
|
} catch {
|
|
66
68
|
return;
|
|
67
69
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { splitConsentOperations } from "@agimon-ai/po-core";
|
|
1
|
+
import { FEDERATION_OPERATION_SCOPES, normalizeFederationOperations, splitConsentOperations } from "@agimon-ai/po-core";
|
|
2
2
|
import { FEDERATION_FRESHNESS, federationEnvelopeFields, verifyAttestation } from "@agimon-ai/po-web-security/browser";
|
|
3
3
|
//#region src/services/capabilities.ts
|
|
4
4
|
function record(value) {
|
|
@@ -15,12 +15,8 @@ function validCapabilityOperations(value) {
|
|
|
15
15
|
if (!Array.isArray(value) || value.length > 3) return false;
|
|
16
16
|
const scopes = /* @__PURE__ */ new Set();
|
|
17
17
|
return value.every((operation) => {
|
|
18
|
-
if (!record(operation) || !
|
|
19
|
-
|
|
20
|
-
"workspace",
|
|
21
|
-
"session"
|
|
22
|
-
].includes(String(operation.scope))) return false;
|
|
23
|
-
const scope = String(operation.scope);
|
|
18
|
+
if (!record(operation) || !FEDERATION_OPERATION_SCOPES.includes(String(operation.scope))) return false;
|
|
19
|
+
const scope = operation.scope === "global" ? "host" : String(operation.scope);
|
|
24
20
|
if (scopes.has(scope)) return false;
|
|
25
21
|
scopes.add(scope);
|
|
26
22
|
return Array.isArray(operation.names) && operation.names.length <= 64 && operation.names.every((name) => typeof name === "string" && /^[a-z][a-z0-9.-]{0,63}$/.test(name)) && new Set(operation.names).size === operation.names.length;
|
|
@@ -61,7 +57,13 @@ async function verifyCapabilityManifest(envelope, roster, now) {
|
|
|
61
57
|
ids.add(template.id);
|
|
62
58
|
}
|
|
63
59
|
if (!await verifyAttestation(host.publicKey, "po/capabilities/v1", federationEnvelopeFields(payload), envelope.signature)) return void 0;
|
|
64
|
-
return structuredClone(
|
|
60
|
+
return structuredClone({
|
|
61
|
+
...payload,
|
|
62
|
+
packages: payload.packages.map((pkg) => ({
|
|
63
|
+
...pkg,
|
|
64
|
+
operations: normalizeFederationOperations(pkg.operations)
|
|
65
|
+
}))
|
|
66
|
+
});
|
|
65
67
|
} catch {
|
|
66
68
|
return;
|
|
67
69
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agimon-ai/po-network",
|
|
3
|
-
"version": "0.0.2-alpha.
|
|
3
|
+
"version": "0.0.2-alpha.88",
|
|
4
4
|
"description": "Host-neutral network election core and deterministic safety simulator.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
43
|
-
"@agimon-ai/po-web-security": "0.0.0-alpha.
|
|
42
|
+
"@agimon-ai/po-core": "0.0.0-alpha.141",
|
|
43
|
+
"@agimon-ai/po-web-security": "0.0.0-alpha.141"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@agimon-ai/vibe-lint-plugin-po-core": "0.0.0-alpha.
|
|
46
|
+
"@agimon-ai/vibe-lint-plugin-po-core": "0.0.0-alpha.141",
|
|
47
47
|
"@types/node": "26.4.1",
|
|
48
48
|
"tsdown": "0.23.0",
|
|
49
49
|
"typescript": "7.0.2",
|