@stigmer/server 3.22.1 → 3.23.1-dev.20260923075205
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/dist/artifactstorage/artifact-storage.d.ts +29 -31
- package/dist/artifactstorage/artifact-storage.d.ts.map +1 -1
- package/dist/artifactstorage/artifact-storage.js +5 -7
- package/dist/artifactstorage/artifact-storage.js.map +1 -1
- package/dist/artifactstorage/r2-storage.d.ts +12 -7
- package/dist/artifactstorage/r2-storage.d.ts.map +1 -1
- package/dist/artifactstorage/r2-storage.js +6 -14
- package/dist/artifactstorage/r2-storage.js.map +1 -1
- package/dist/authorization/authorizer.d.ts +4 -8
- package/dist/authorization/authorizer.d.ts.map +1 -1
- package/dist/authorization/authorizer.js +5 -9
- package/dist/authorization/authorizer.js.map +1 -1
- package/dist/authorization/derived-tuples.d.ts.map +1 -1
- package/dist/authorization/derived-tuples.js +10 -25
- package/dist/authorization/derived-tuples.js.map +1 -1
- package/dist/authorization/evaluator.d.ts +7 -8
- package/dist/authorization/evaluator.d.ts.map +1 -1
- package/dist/authorization/evaluator.js +4 -20
- package/dist/authorization/evaluator.js.map +1 -1
- package/dist/authorization/list-read-scope.d.ts.map +1 -1
- package/dist/authorization/list-read-scope.js +5 -9
- package/dist/authorization/list-read-scope.js.map +1 -1
- package/dist/authorization/model/agent.d.ts.map +1 -1
- package/dist/authorization/model/agent.js +4 -5
- package/dist/authorization/model/agent.js.map +1 -1
- package/dist/authorization/model/agent_instance.d.ts.map +1 -1
- package/dist/authorization/model/agent_instance.js +2 -2
- package/dist/authorization/model/agent_instance.js.map +1 -1
- package/dist/authorization/model/mcp_server.d.ts.map +1 -1
- package/dist/authorization/model/mcp_server.js +2 -2
- package/dist/authorization/model/mcp_server.js.map +1 -1
- package/dist/authorization/model/plugin.d.ts.map +1 -1
- package/dist/authorization/model/plugin.js +3 -4
- package/dist/authorization/model/plugin.js.map +1 -1
- package/dist/authorization/model/rewrite.d.ts +8 -10
- package/dist/authorization/model/rewrite.d.ts.map +1 -1
- package/dist/authorization/model/rewrite.js +0 -3
- package/dist/authorization/model/rewrite.js.map +1 -1
- package/dist/authorization/model/skill.d.ts.map +1 -1
- package/dist/authorization/model/skill.js +2 -2
- package/dist/authorization/model/skill.js.map +1 -1
- package/dist/authorization/model/workflow.d.ts.map +1 -1
- package/dist/authorization/model/workflow.js +2 -2
- package/dist/authorization/model/workflow.js.map +1 -1
- package/dist/authorization/model/workflow_instance.d.ts.map +1 -1
- package/dist/authorization/model/workflow_instance.js +2 -2
- package/dist/authorization/model/workflow_instance.js.map +1 -1
- package/dist/authorization/organization-directory.d.ts.map +1 -1
- package/dist/authorization/organization-directory.js +2 -3
- package/dist/authorization/organization-directory.js.map +1 -1
- package/dist/authorization/store-test-kit.d.ts +0 -6
- package/dist/authorization/store-test-kit.d.ts.map +1 -1
- package/dist/authorization/store-test-kit.js +16 -62
- package/dist/authorization/store-test-kit.js.map +1 -1
- package/dist/authorization/tuples.d.ts +13 -32
- package/dist/authorization/tuples.d.ts.map +1 -1
- package/dist/authorization/tuples.js +3 -11
- package/dist/authorization/tuples.js.map +1 -1
- package/dist/boot/compose.d.ts.map +1 -1
- package/dist/boot/compose.js +49 -24
- package/dist/boot/compose.js.map +1 -1
- package/dist/boot/config.d.ts +4 -3
- package/dist/boot/config.d.ts.map +1 -1
- package/dist/boot/config.js.map +1 -1
- package/dist/boot/skill-transfer-origin.d.ts +52 -0
- package/dist/boot/skill-transfer-origin.d.ts.map +1 -0
- package/dist/boot/skill-transfer-origin.js +54 -0
- package/dist/boot/skill-transfer-origin.js.map +1 -0
- package/dist/domain/agent/controller.d.ts.map +1 -1
- package/dist/domain/agent/controller.js +4 -4
- package/dist/domain/agent/controller.js.map +1 -1
- package/dist/domain/agentchannel/controller.d.ts.map +1 -1
- package/dist/domain/agentchannel/controller.js +3 -1
- package/dist/domain/agentchannel/controller.js.map +1 -1
- package/dist/domain/agentexecution/controller.d.ts.map +1 -1
- package/dist/domain/agentexecution/controller.js +3 -1
- package/dist/domain/agentexecution/controller.js.map +1 -1
- package/dist/domain/agentinstance/controller.d.ts.map +1 -1
- package/dist/domain/agentinstance/controller.js +3 -4
- package/dist/domain/agentinstance/controller.js.map +1 -1
- package/dist/domain/agentshare/constants.d.ts +6 -11
- package/dist/domain/agentshare/constants.d.ts.map +1 -1
- package/dist/domain/agentshare/constants.js +8 -16
- package/dist/domain/agentshare/constants.js.map +1 -1
- package/dist/domain/agentshare/controller.d.ts.map +1 -1
- package/dist/domain/agentshare/controller.js +3 -1
- package/dist/domain/agentshare/controller.js.map +1 -1
- package/dist/domain/agentshare/steps.d.ts +18 -25
- package/dist/domain/agentshare/steps.d.ts.map +1 -1
- package/dist/domain/agentshare/steps.js +41 -142
- package/dist/domain/agentshare/steps.js.map +1 -1
- package/dist/domain/environment/controller.d.ts.map +1 -1
- package/dist/domain/environment/controller.js +2 -3
- package/dist/domain/environment/controller.js.map +1 -1
- package/dist/domain/executioncontext/controller.d.ts.map +1 -1
- package/dist/domain/executioncontext/controller.js +2 -1
- package/dist/domain/executioncontext/controller.js.map +1 -1
- package/dist/domain/mcpserver/controller.d.ts.map +1 -1
- package/dist/domain/mcpserver/controller.js +3 -4
- package/dist/domain/mcpserver/controller.js.map +1 -1
- package/dist/domain/plugin/controller.d.ts +3 -7
- package/dist/domain/plugin/controller.d.ts.map +1 -1
- package/dist/domain/plugin/controller.js +9 -11
- package/dist/domain/plugin/controller.js.map +1 -1
- package/dist/domain/plugin/push.d.ts +7 -5
- package/dist/domain/plugin/push.d.ts.map +1 -1
- package/dist/domain/plugin/push.js +8 -14
- package/dist/domain/plugin/push.js.map +1 -1
- package/dist/domain/schedule/controller.d.ts.map +1 -1
- package/dist/domain/schedule/controller.js +3 -1
- package/dist/domain/schedule/controller.js.map +1 -1
- package/dist/domain/session/controller.d.ts.map +1 -1
- package/dist/domain/session/controller.js +3 -2
- package/dist/domain/session/controller.js.map +1 -1
- package/dist/domain/skill/constants.d.ts +26 -3
- package/dist/domain/skill/constants.d.ts.map +1 -1
- package/dist/domain/skill/constants.js +26 -3
- package/dist/domain/skill/constants.js.map +1 -1
- package/dist/domain/skill/controller.d.ts +6 -11
- package/dist/domain/skill/controller.d.ts.map +1 -1
- package/dist/domain/skill/controller.js +33 -24
- package/dist/domain/skill/controller.js.map +1 -1
- package/dist/domain/skill/push.d.ts +2 -2
- package/dist/domain/skill/push.d.ts.map +1 -1
- package/dist/domain/skill/push.js +2 -2
- package/dist/domain/skill/push.js.map +1 -1
- package/dist/domain/skill/transfer/handler.d.ts +17 -9
- package/dist/domain/skill/transfer/handler.d.ts.map +1 -1
- package/dist/domain/skill/transfer/handler.js +19 -8
- package/dist/domain/skill/transfer/handler.js.map +1 -1
- package/dist/domain/skill/transfer/slots.d.ts +26 -41
- package/dist/domain/skill/transfer/slots.d.ts.map +1 -1
- package/dist/domain/skill/transfer/slots.js +80 -87
- package/dist/domain/skill/transfer/slots.js.map +1 -1
- package/dist/domain/skill/transfer/staging.d.ts +48 -0
- package/dist/domain/skill/transfer/staging.d.ts.map +1 -0
- package/dist/domain/skill/transfer/staging.js +127 -0
- package/dist/domain/skill/transfer/staging.js.map +1 -0
- package/dist/domain/workflow/agent-call-references.d.ts +54 -0
- package/dist/domain/workflow/agent-call-references.d.ts.map +1 -0
- package/dist/domain/workflow/agent-call-references.js +97 -0
- package/dist/domain/workflow/agent-call-references.js.map +1 -0
- package/dist/domain/workflow/controller.d.ts.map +1 -1
- package/dist/domain/workflow/controller.js +14 -6
- package/dist/domain/workflow/controller.js.map +1 -1
- package/dist/domain/workflow/registry/data/task-kind-registry.json +1 -1
- package/dist/domain/workflow/validation/task-config-constraints.d.ts +10 -1
- package/dist/domain/workflow/validation/task-config-constraints.d.ts.map +1 -1
- package/dist/domain/workflow/validation/task-config-constraints.js +3 -2
- package/dist/domain/workflow/validation/task-config-constraints.js.map +1 -1
- package/dist/domain/workflowexecution/controller.d.ts.map +1 -1
- package/dist/domain/workflowexecution/controller.js +4 -2
- package/dist/domain/workflowexecution/controller.js.map +1 -1
- package/dist/domain/workflowinstance/controller.d.ts.map +1 -1
- package/dist/domain/workflowinstance/controller.js +3 -4
- package/dist/domain/workflowinstance/controller.js.map +1 -1
- package/dist/extensions/authorization-queries.d.ts +6 -5
- package/dist/extensions/authorization-queries.d.ts.map +1 -1
- package/dist/extensions/list-read-scope.d.ts +1 -1
- package/dist/extensions/resource-authorization.d.ts +3 -2
- package/dist/extensions/resource-authorization.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/pipeline/apiresource-meta.d.ts +12 -3
- package/dist/pipeline/apiresource-meta.d.ts.map +1 -1
- package/dist/pipeline/apiresource-meta.js +21 -10
- package/dist/pipeline/apiresource-meta.js.map +1 -1
- package/dist/pipeline/steps/authorization-tuples.d.ts +9 -3
- package/dist/pipeline/steps/authorization-tuples.d.ts.map +1 -1
- package/dist/pipeline/steps/authorization-tuples.js +9 -11
- package/dist/pipeline/steps/authorization-tuples.js.map +1 -1
- package/dist/pipeline/steps/references.d.ts +178 -20
- package/dist/pipeline/steps/references.d.ts.map +1 -1
- package/dist/pipeline/steps/references.js +344 -43
- package/dist/pipeline/steps/references.js.map +1 -1
- package/dist/pipeline/steps/resolve-artifact-source.d.ts +11 -8
- package/dist/pipeline/steps/resolve-artifact-source.d.ts.map +1 -1
- package/dist/pipeline/steps/resolve-artifact-source.js +8 -4
- package/dist/pipeline/steps/resolve-artifact-source.js.map +1 -1
- package/dist/query/search/controller.js +0 -1
- package/dist/query/search/controller.js.map +1 -1
- package/dist/query/search/criteria.d.ts +1 -5
- package/dist/query/search/criteria.d.ts.map +1 -1
- package/dist/query/search/criteria.js +3 -13
- package/dist/query/search/criteria.js.map +1 -1
- package/dist/query/search/handler.d.ts +5 -4
- package/dist/query/search/handler.d.ts.map +1 -1
- package/dist/query/search/handler.js +7 -6
- package/dist/query/search/handler.js.map +1 -1
- package/dist/query/search/query-store.d.ts.map +1 -1
- package/dist/query/search/query-store.js +0 -2
- package/dist/query/search/query-store.js.map +1 -1
- package/dist/store/interface.d.ts +3 -6
- package/dist/store/interface.d.ts.map +1 -1
- package/dist/store/interface.js.map +1 -1
- package/dist/store/postgres/migrations.d.ts +3 -1
- package/dist/store/postgres/migrations.d.ts.map +1 -1
- package/dist/store/postgres/migrations.js +35 -1
- package/dist/store/postgres/migrations.js.map +1 -1
- package/dist/store/postgres/store.d.ts.map +1 -1
- package/dist/store/postgres/store.js +4 -9
- package/dist/store/postgres/store.js.map +1 -1
- package/dist/store/public-visibility-retired.d.ts +67 -0
- package/dist/store/public-visibility-retired.d.ts.map +1 -0
- package/dist/store/public-visibility-retired.js +55 -0
- package/dist/store/public-visibility-retired.js.map +1 -0
- package/dist/store/sqlite/migrations.d.ts +3 -1
- package/dist/store/sqlite/migrations.d.ts.map +1 -1
- package/dist/store/sqlite/migrations.js +36 -1
- package/dist/store/sqlite/migrations.js.map +1 -1
- package/dist/store/sqlite/store.d.ts.map +1 -1
- package/dist/store/sqlite/store.js +4 -8
- package/dist/store/sqlite/store.js.map +1 -1
- package/package.json +6 -6
- package/src/artifactstorage/__tests__/artifact-storage.test.ts +36 -33
- package/src/artifactstorage/__tests__/r2-storage.test.ts +11 -13
- package/src/artifactstorage/artifact-storage.ts +37 -33
- package/src/artifactstorage/r2-storage.ts +6 -15
- package/src/authorization/README.md +24 -26
- package/src/authorization/__tests__/authorizer.test.ts +10 -9
- package/src/authorization/__tests__/derived-tuples.test.ts +4 -11
- package/src/authorization/__tests__/evaluator.test.ts +14 -73
- package/src/authorization/__tests__/facts.test.ts +2 -2
- package/src/authorization/__tests__/fixtures/fga/agent-instance-creation.fga.yaml +19 -27
- package/src/authorization/__tests__/fixtures/fga/blueprint-private-visibility.fga.yaml +6 -98
- package/src/authorization/__tests__/fixtures/fga/default-instance-inheritance.fga.yaml +4 -61
- package/src/authorization/__tests__/fixtures/fga/mcp-server-authoring.fga.yaml +1 -15
- package/src/authorization/__tests__/fixtures/fga/org-admin-owner-inheritance.fga.yaml +1 -21
- package/src/authorization/__tests__/fixtures/fga/platform-visibility.fga.yaml +1 -25
- package/src/authorization/__tests__/fixtures/fga/workflow-execution-sharing.fga.yaml +1 -3
- package/src/authorization/__tests__/list-read-scope.test.ts +18 -17
- package/src/authorization/__tests__/store-tests.test.ts +2 -6
- package/src/authorization/__tests__/tuples.test.ts +12 -11
- package/src/authorization/authorizer.ts +4 -9
- package/src/authorization/derived-tuples.ts +14 -31
- package/src/authorization/evaluator.ts +8 -44
- package/src/authorization/list-read-scope.ts +5 -11
- package/src/authorization/model/agent.ts +2 -5
- package/src/authorization/model/agent_instance.ts +0 -2
- package/src/authorization/model/mcp_server.ts +0 -2
- package/src/authorization/model/plugin.ts +1 -4
- package/src/authorization/model/rewrite.ts +8 -13
- package/src/authorization/model/skill.ts +0 -2
- package/src/authorization/model/workflow.ts +0 -2
- package/src/authorization/model/workflow_instance.ts +0 -2
- package/src/authorization/organization-directory.ts +1 -3
- package/src/authorization/store-test-kit.ts +16 -75
- package/src/authorization/tuples.ts +16 -39
- package/src/boot/__tests__/skill-transfer-origin.test.ts +72 -0
- package/src/boot/compose.ts +62 -25
- package/src/boot/config.ts +4 -3
- package/src/boot/skill-transfer-origin.ts +76 -0
- package/src/domain/agent/__tests__/agent.test.ts +11 -4
- package/src/domain/agent/controller.ts +7 -7
- package/src/domain/agentchannel/__tests__/agentchannel.test.ts +223 -48
- package/src/domain/agentchannel/controller.ts +6 -1
- package/src/domain/agentexecution/controller.ts +6 -1
- package/src/domain/agentinstance/controller.ts +6 -12
- package/src/domain/agentshare/__tests__/agentshare.test.ts +196 -172
- package/src/domain/agentshare/__tests__/create-authorization.test.ts +16 -31
- package/src/domain/agentshare/constants.ts +14 -26
- package/src/domain/agentshare/controller.ts +6 -1
- package/src/domain/agentshare/steps.ts +41 -194
- package/src/domain/environment/controller.ts +5 -8
- package/src/domain/executioncontext/controller.ts +5 -1
- package/src/domain/mcpserver/__tests__/mcpserver.test.ts +115 -28
- package/src/domain/mcpserver/__tests__/oauth-handshake.test.ts +53 -18
- package/src/domain/mcpserver/controller.ts +6 -12
- package/src/domain/plugin/controller.ts +16 -25
- package/src/domain/plugin/push.ts +8 -16
- package/src/domain/schedule/controller.ts +6 -1
- package/src/domain/session/controller.ts +12 -4
- package/src/domain/skill/__tests__/skill.test.ts +5 -3
- package/src/domain/skill/__tests__/slots.test.ts +113 -60
- package/src/domain/skill/__tests__/staging.test.ts +304 -0
- package/src/domain/skill/constants.ts +28 -3
- package/src/domain/skill/controller.ts +44 -42
- package/src/domain/skill/push.ts +3 -3
- package/src/domain/skill/transfer/handler.ts +33 -15
- package/src/domain/skill/transfer/slots.ts +89 -100
- package/src/domain/skill/transfer/staging.ts +191 -0
- package/src/domain/workflow/__tests__/agent-call-references.test.ts +222 -0
- package/src/domain/workflow/agent-call-references.ts +157 -0
- package/src/domain/workflow/controller.ts +28 -10
- package/src/domain/workflow/registry/data/task-kind-registry.json +1 -1
- package/src/domain/workflow/validation/task-config-constraints.ts +7 -3
- package/src/domain/workflowexecution/controller.ts +7 -2
- package/src/domain/workflowinstance/controller.ts +6 -12
- package/src/extensions/__tests__/built-in-authorization-composed.test.ts +32 -19
- package/src/extensions/__tests__/extension-composition.test.ts +4 -4
- package/src/extensions/__tests__/list-read-scope-composed.test.ts +9 -6
- package/src/extensions/authorization-queries.ts +6 -5
- package/src/extensions/list-read-scope.ts +1 -1
- package/src/extensions/resource-authorization.ts +3 -5
- package/src/index.ts +0 -1
- package/src/pipeline/__tests__/supports-visibility.test.ts +112 -0
- package/src/pipeline/apiresource-meta.ts +21 -10
- package/src/pipeline/steps/__tests__/authorization-tuples.test.ts +18 -31
- package/src/pipeline/steps/__tests__/references.test.ts +703 -0
- package/src/pipeline/steps/authorization-tuples.ts +9 -11
- package/src/pipeline/steps/references.ts +578 -70
- package/src/pipeline/steps/resolve-artifact-source.ts +20 -13
- package/src/query/search/__tests__/criteria.test.ts +0 -4
- package/src/query/search/__tests__/query-store.test.ts +11 -40
- package/src/query/search/controller.ts +0 -1
- package/src/query/search/criteria.ts +0 -14
- package/src/query/search/handler.ts +6 -7
- package/src/query/search/query-store.ts +0 -2
- package/src/store/__tests__/public-visibility-retired.test.ts +127 -0
- package/src/store/__tests__/store-contract.ts +6 -51
- package/src/store/interface.ts +3 -6
- package/src/store/postgres/__tests__/migrations.test.ts +187 -6
- package/src/store/postgres/__tests__/store-contract.test.ts +0 -2
- package/src/store/postgres/migrations.ts +48 -1
- package/src/store/postgres/store.ts +4 -11
- package/src/store/public-visibility-retired.ts +119 -0
- package/src/store/sqlite/__tests__/migrations.test.ts +191 -5
- package/src/store/sqlite/migrations.ts +45 -1
- package/src/store/sqlite/store.ts +4 -10
- package/src/transport/registry/__tests__/lanes.test.ts +1 -1
- package/dist/pipeline/steps/visibility-gates.d.ts +0 -27
- package/dist/pipeline/steps/visibility-gates.d.ts.map +0 -1
- package/dist/pipeline/steps/visibility-gates.js +0 -139
- package/dist/pipeline/steps/visibility-gates.js.map +0 -1
- package/src/authorization/__tests__/fixtures/fga/cross-org-share-creation.fga.yaml +0 -98
- package/src/authorization/__tests__/fixtures/fga/public-visibility-setter.fga.yaml +0 -52
- package/src/pipeline/steps/__tests__/visibility-gates.test.ts +0 -187
- package/src/pipeline/steps/visibility-gates.ts +0 -174
|
@@ -41,14 +41,12 @@
|
|
|
41
41
|
* `skipped` is therefore complete once every case has run; a consumer
|
|
42
42
|
* pins it after the cases, which is the order a test file declares them.
|
|
43
43
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* that
|
|
49
|
-
*
|
|
50
|
-
* key anywhere is a thrown fault, so a change to the format upstream is
|
|
51
|
-
* loud here rather than half-run.
|
|
44
|
+
* The parser is strict on purpose: an unknown key anywhere is a thrown
|
|
45
|
+
* fault, so a change to the format upstream is loud here rather than
|
|
46
|
+
* half-run. The model declares no condition, so the format's `condition`
|
|
47
|
+
* on a tuple and `context` on a check are among the keys refused: a
|
|
48
|
+
* document that still carries them is written against a model this
|
|
49
|
+
* evaluator does not answer, and saying so beats running it half-blind.
|
|
52
50
|
*/
|
|
53
51
|
import assert from "node:assert/strict";
|
|
54
52
|
import { checkRelation } from "./evaluator.js";
|
|
@@ -72,28 +70,12 @@ export function parseStoreTestDocument(value, sourceName) {
|
|
|
72
70
|
};
|
|
73
71
|
}
|
|
74
72
|
function parseTuple(value, where) {
|
|
75
|
-
const entry = record(value, where, [
|
|
76
|
-
|
|
77
|
-
"relation",
|
|
78
|
-
"object",
|
|
79
|
-
"condition",
|
|
80
|
-
]);
|
|
81
|
-
const tuple = {
|
|
73
|
+
const entry = record(value, where, ["user", "relation", "object"]);
|
|
74
|
+
return {
|
|
82
75
|
user: text(entry["user"], `${where}.user`),
|
|
83
76
|
relation: text(entry["relation"], `${where}.relation`),
|
|
84
77
|
object: text(entry["object"], `${where}.object`),
|
|
85
78
|
};
|
|
86
|
-
if (entry["condition"] === undefined) {
|
|
87
|
-
return tuple;
|
|
88
|
-
}
|
|
89
|
-
const condition = record(entry["condition"], `${where}.condition`, [
|
|
90
|
-
"name",
|
|
91
|
-
"context",
|
|
92
|
-
]);
|
|
93
|
-
return {
|
|
94
|
-
...tuple,
|
|
95
|
-
condition: { name: text(condition["name"], `${where}.condition.name`) },
|
|
96
|
-
};
|
|
97
79
|
}
|
|
98
80
|
function parseTest(value, where) {
|
|
99
81
|
const entry = record(value, where, ["name", "check", "list_objects"]);
|
|
@@ -104,12 +86,7 @@ function parseTest(value, where) {
|
|
|
104
86
|
};
|
|
105
87
|
}
|
|
106
88
|
function parseCheck(value, where) {
|
|
107
|
-
const entry = record(value, where, [
|
|
108
|
-
"user",
|
|
109
|
-
"object",
|
|
110
|
-
"context",
|
|
111
|
-
"assertions",
|
|
112
|
-
]);
|
|
89
|
+
const entry = record(value, where, ["user", "object", "assertions"]);
|
|
113
90
|
const assertions = record(entry["assertions"], `${where}.assertions`);
|
|
114
91
|
const parsed = {};
|
|
115
92
|
for (const [relation, expected] of Object.entries(assertions)) {
|
|
@@ -118,39 +95,25 @@ function parseCheck(value, where) {
|
|
|
118
95
|
}
|
|
119
96
|
parsed[relation] = expected;
|
|
120
97
|
}
|
|
121
|
-
const context = parseContext(entry["context"], `${where}.context`);
|
|
122
98
|
return {
|
|
123
99
|
user: text(entry["user"], `${where}.user`),
|
|
124
100
|
object: text(entry["object"], `${where}.object`),
|
|
125
|
-
...(context === undefined ? {} : { context }),
|
|
126
101
|
assertions: parsed,
|
|
127
102
|
};
|
|
128
103
|
}
|
|
129
104
|
function parseListObjects(value, where) {
|
|
130
|
-
const entry = record(value, where, ["user", "type", "
|
|
105
|
+
const entry = record(value, where, ["user", "type", "assertions"]);
|
|
131
106
|
const assertions = record(entry["assertions"], `${where}.assertions`);
|
|
132
107
|
const parsed = {};
|
|
133
108
|
for (const [relation, expected] of Object.entries(assertions)) {
|
|
134
109
|
parsed[relation] = list(expected, `${where}.assertions.${relation}`).map((item, index) => text(item, `${where}.assertions.${relation}[${index}]`));
|
|
135
110
|
}
|
|
136
|
-
const context = parseContext(entry["context"], `${where}.context`);
|
|
137
111
|
return {
|
|
138
112
|
user: text(entry["user"], `${where}.user`),
|
|
139
113
|
type: text(entry["type"], `${where}.type`),
|
|
140
|
-
...(context === undefined ? {} : { context }),
|
|
141
114
|
assertions: parsed,
|
|
142
115
|
};
|
|
143
116
|
}
|
|
144
|
-
function parseContext(value, where) {
|
|
145
|
-
if (value === undefined) {
|
|
146
|
-
return undefined;
|
|
147
|
-
}
|
|
148
|
-
const entry = record(value, where, ["allow"]);
|
|
149
|
-
if (typeof entry["allow"] !== "boolean") {
|
|
150
|
-
throw new Error(`${where}.allow: expected a boolean`);
|
|
151
|
-
}
|
|
152
|
-
return { allow: entry["allow"] };
|
|
153
|
-
}
|
|
154
117
|
function record(value, where, allowedKeys) {
|
|
155
118
|
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
156
119
|
throw new Error(`${where}: expected a mapping`);
|
|
@@ -180,8 +143,6 @@ function text(value, where) {
|
|
|
180
143
|
}
|
|
181
144
|
return value;
|
|
182
145
|
}
|
|
183
|
-
/** The listing posture, for a check the document leaves without a context (the module header). */
|
|
184
|
-
const CONTEXT_WHEN_ABSENT = { allow: false };
|
|
185
146
|
/**
|
|
186
147
|
* The document's tests as runnable cases over `model`, plus every
|
|
187
148
|
* assertion group the kit does not run.
|
|
@@ -225,10 +186,9 @@ export function storeTestCases(document, model) {
|
|
|
225
186
|
for (const item of runnable) {
|
|
226
187
|
const object = parseObjectRef(item.object);
|
|
227
188
|
const person = personOf(item.user);
|
|
228
|
-
const context = item.context ?? CONTEXT_WHEN_ABSENT;
|
|
229
189
|
for (const [relation, expected] of Object.entries(item.assertions)) {
|
|
230
190
|
const recording = recordUndeclaredTypes(source, model);
|
|
231
|
-
const actual = await checkRelation({ model, source: recording }, object, relation, person
|
|
191
|
+
const actual = await checkRelation({ model, source: recording }, object, relation, person);
|
|
232
192
|
if (recording.reached.size > 0) {
|
|
233
193
|
skipped.push({
|
|
234
194
|
document: document.name,
|
|
@@ -241,7 +201,7 @@ export function storeTestCases(document, model) {
|
|
|
241
201
|
});
|
|
242
202
|
continue;
|
|
243
203
|
}
|
|
244
|
-
assert.equal(actual, expected, `${document.name} :: ${test.name}: ${item.user} ${relation} ${item.object}
|
|
204
|
+
assert.equal(actual, expected, `${document.name} :: ${test.name}: ${item.user} ${relation} ${item.object} expected ${String(expected)}, got ${String(actual)}`);
|
|
245
205
|
}
|
|
246
206
|
}
|
|
247
207
|
},
|
|
@@ -252,10 +212,9 @@ export function storeTestCases(document, model) {
|
|
|
252
212
|
/**
|
|
253
213
|
* A view of `inner` that records, for one walk, every subject type the
|
|
254
214
|
* evaluator read that `model` does not declare. A person
|
|
255
|
-
* (`identity_account:<id
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
* type is.
|
|
215
|
+
* (`identity_account:<id>`) is a subject the evaluator compares, never a
|
|
216
|
+
* type it resolves, so it is not a "reach" whatever the model declares; a
|
|
217
|
+
* userset or a parent object of an undeclared type is.
|
|
259
218
|
*/
|
|
260
219
|
function recordUndeclaredTypes(inner, model) {
|
|
261
220
|
const reached = new Set();
|
|
@@ -282,8 +241,6 @@ function resolvedTypeOf(subject) {
|
|
|
282
241
|
: subject.object.type;
|
|
283
242
|
case "userset":
|
|
284
243
|
return subject.object.type;
|
|
285
|
-
case "wildcard":
|
|
286
|
-
return undefined;
|
|
287
244
|
default: {
|
|
288
245
|
const exhaustive = subject;
|
|
289
246
|
throw new Error(`unknown subject form: ${JSON.stringify(exhaustive)}`);
|
|
@@ -291,13 +248,10 @@ function resolvedTypeOf(subject) {
|
|
|
291
248
|
}
|
|
292
249
|
}
|
|
293
250
|
function tupleOf(entry) {
|
|
294
|
-
const subject = parseSubject(entry.user);
|
|
295
251
|
return {
|
|
296
252
|
object: parseObjectRef(entry.object),
|
|
297
253
|
relation: entry.relation,
|
|
298
|
-
subject:
|
|
299
|
-
? { ...subject, condition: entry.condition.name }
|
|
300
|
-
: subject,
|
|
254
|
+
subject: parseSubject(entry.user),
|
|
301
255
|
};
|
|
302
256
|
}
|
|
303
257
|
/** The document's users are plain accounts; a user of another type is a format the kit does not run. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-test-kit.js","sourceRoot":"","sources":["../../src/authorization/store-test-kit.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"store-test-kit.js","sourceRoot":"","sources":["../../src/authorization/store-test-kit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG/C,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,cAAc,EACd,YAAY,GACb,MAAM,aAAa,CAAC;AAoCrB;;;;GAIG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AAc,CAAC,KAAK,CAAC,MAAM,CAAC;QACpC,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC;KAClC,CAAC;AACJ,CAAC;AAED,wGAAwG;AACxG,SAAS,QAAQ,CAAC,IAAY;IAC5B,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,MAAM,CAAC,IAAI,KAAK,YAAY,IAAI,MAAM,CAAC,EAAE,KAAK,GAAG,EAAE,CAAC;QACtD,MAAM,IAAI,KAAK,CAAC,uCAAuC,IAAI,GAAG,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AACjE,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The tuple vocabulary of the built-in authorizer — the OpenFGA notions
|
|
3
3
|
* the cloud's model is written in (object, relation, subject; a subject
|
|
4
|
-
* being an object
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* being an object or a userset `type:id#relation`), typed once so the
|
|
5
|
+
* evaluator, the derivation and the store-test kit speak one language. The
|
|
6
|
+
* model declares no wildcard subject and no condition: every reader of a
|
|
7
|
+
* row is an account or the holder of a relation on an object, which is
|
|
8
|
+
* why a check needs no context parameter. Nothing here is
|
|
7
9
|
* stored: open source derives every tuple from a row (derived-tuples.ts)
|
|
8
10
|
* or reads it from an IamPolicy row, and this module only names what a
|
|
9
11
|
* tuple IS.
|
|
@@ -18,25 +20,16 @@
|
|
|
18
20
|
* The type is named here; the construction (`personFor`, `resolvePerson`)
|
|
19
21
|
* is person.ts's, so this module stays vocabulary with no I/O.
|
|
20
22
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* and the
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* catalog. The parameter is required so a caller states which posture it
|
|
28
|
-
* is in; there is no default because either one is wrong for the other.
|
|
29
|
-
*
|
|
30
|
-
* The string forms (`agent:x`, `organization:acme#viewer`,
|
|
31
|
-
* `identity_account:*`) are the notation the cloud's store tests and the
|
|
32
|
-
* IamPolicy proto both use; parse and format are here so the kit and the
|
|
33
|
-
* tests never spell them a second way.
|
|
23
|
+
* The string forms (`agent:x`, `organization:acme#viewer`) are the
|
|
24
|
+
* notation the cloud's store tests and the IamPolicy proto both use; parse
|
|
25
|
+
* and format are here so the kit and the tests never spell them a second
|
|
26
|
+
* way. The wildcard notation `type:*` is refused by the parser: the model
|
|
27
|
+
* has no line that admits one, so a fixture or a policy that spells it is
|
|
28
|
+
* a mistake to surface, never a subject to carry.
|
|
34
29
|
*/
|
|
35
30
|
import type { Message } from "@bufbuild/protobuf";
|
|
36
31
|
/** The FGA type name of the kind every person is: `identity_account:<id>`. */
|
|
37
32
|
export declare const ACCOUNT_TYPE = "identity_account";
|
|
38
|
-
/** The one condition the model declares; it guards the public wildcard. */
|
|
39
|
-
export declare const ALLOW_PUBLIC_CONDITION = "allow_public";
|
|
40
33
|
/** `type:id` — an object of the model. */
|
|
41
34
|
export interface ObjectRef {
|
|
42
35
|
readonly type: string;
|
|
@@ -54,12 +47,6 @@ export type Subject =
|
|
|
54
47
|
readonly form: "userset";
|
|
55
48
|
readonly object: ObjectRef;
|
|
56
49
|
readonly relation: string;
|
|
57
|
-
}
|
|
58
|
-
/** `type:*` — every object of the type, honoured only when its condition holds. */
|
|
59
|
-
| {
|
|
60
|
-
readonly form: "wildcard";
|
|
61
|
-
readonly type: string;
|
|
62
|
-
readonly condition: string | undefined;
|
|
63
50
|
};
|
|
64
51
|
export interface Tuple {
|
|
65
52
|
readonly object: ObjectRef;
|
|
@@ -91,18 +78,12 @@ export interface Person {
|
|
|
91
78
|
/** Every string a creator stamp may carry for this person; always contains `accountId`. */
|
|
92
79
|
readonly aliases: ReadonlySet<string>;
|
|
93
80
|
}
|
|
94
|
-
/** The condition parameters of a check (the module header). */
|
|
95
|
-
export interface CheckContext {
|
|
96
|
-
readonly allow: boolean;
|
|
97
|
-
}
|
|
98
81
|
/** `type:id` → ObjectRef; the id may itself contain `:` (issuer subjects do). */
|
|
99
82
|
export declare function parseObjectRef(text: string): ObjectRef;
|
|
100
83
|
export declare function formatObjectRef(object: ObjectRef): string;
|
|
101
84
|
/**
|
|
102
|
-
* `type:id
|
|
103
|
-
*
|
|
104
|
-
* says so (the store tests carry it on the tuple, the derivation attaches
|
|
105
|
-
* the model's).
|
|
85
|
+
* `type:id` or `type:id#relation` → Subject. `type:*` is refused (the
|
|
86
|
+
* module header): no line of the model admits a wildcard subject.
|
|
106
87
|
*/
|
|
107
88
|
export declare function parseSubject(text: string): Subject;
|
|
108
89
|
export declare function formatSubject(subject: Subject): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tuples.d.ts","sourceRoot":"","sources":["../../src/authorization/tuples.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tuples.d.ts","sourceRoot":"","sources":["../../src/authorization/tuples.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,8EAA8E;AAC9E,eAAO,MAAM,YAAY,qBAAqB,CAAC;AAE/C,0CAA0C;AAC1C,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED,+CAA+C;AAC/C,MAAM,MAAM,OAAO;AACjB,4EAA4E;AAC1E;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAA;CAAE;AACzD,wEAAwE;GACtE;IACE,QAAQ,CAAC,IAA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CAEnE;AAED,2FAA2F;AAC3F,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,GAC3B,WAAW,CAgBb"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/** The FGA type name of the kind every person is: `identity_account:<id>`. */
|
|
2
2
|
export const ACCOUNT_TYPE = "identity_account";
|
|
3
|
-
/** The one condition the model declares; it guards the public wildcard. */
|
|
4
|
-
export const ALLOW_PUBLIC_CONDITION = "allow_public";
|
|
5
3
|
// ---------------------------------------------------------------------------
|
|
6
4
|
// The string notation.
|
|
7
5
|
// ---------------------------------------------------------------------------
|
|
@@ -17,10 +15,8 @@ export function formatObjectRef(object) {
|
|
|
17
15
|
return `${object.type}:${object.id}`;
|
|
18
16
|
}
|
|
19
17
|
/**
|
|
20
|
-
* `type:id
|
|
21
|
-
*
|
|
22
|
-
* says so (the store tests carry it on the tuple, the derivation attaches
|
|
23
|
-
* the model's).
|
|
18
|
+
* `type:id` or `type:id#relation` → Subject. `type:*` is refused (the
|
|
19
|
+
* module header): no line of the model admits a wildcard subject.
|
|
24
20
|
*/
|
|
25
21
|
export function parseSubject(text) {
|
|
26
22
|
const hash = text.indexOf("#");
|
|
@@ -33,7 +29,7 @@ export function parseSubject(text) {
|
|
|
33
29
|
}
|
|
34
30
|
const object = parseObjectRef(text);
|
|
35
31
|
if (object.id === "*") {
|
|
36
|
-
|
|
32
|
+
throw new Error(`wildcard subject '${text}' is not admitted: the model declares no wildcard line`);
|
|
37
33
|
}
|
|
38
34
|
return { form: "object", object };
|
|
39
35
|
}
|
|
@@ -43,10 +39,6 @@ export function formatSubject(subject) {
|
|
|
43
39
|
return formatObjectRef(subject.object);
|
|
44
40
|
case "userset":
|
|
45
41
|
return `${formatObjectRef(subject.object)}#${subject.relation}`;
|
|
46
|
-
case "wildcard":
|
|
47
|
-
return subject.condition === undefined
|
|
48
|
-
? `${subject.type}:*`
|
|
49
|
-
: `${subject.type}:* with ${subject.condition}`;
|
|
50
42
|
default: {
|
|
51
43
|
const exhaustive = subject;
|
|
52
44
|
throw new Error(`unknown subject form: ${JSON.stringify(exhaustive)}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tuples.js","sourceRoot":"","sources":["../../src/authorization/tuples.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tuples.js","sourceRoot":"","sources":["../../src/authorization/tuples.ts"],"names":[],"mappings":"AA+BA,8EAA8E;AAC9E,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAqD/C,8EAA8E;AAC9E,uBAAuB;AACvB,8EAA8E;AAE9E,iFAAiF;AACjF,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAChC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,GAAG,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,OAAO,GAAG,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC;AACvC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC;QACb,OAAO;YACL,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;YAC3C,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,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AM,EAAE,CAAC;QAC3B,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;QAClD,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC7B,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;QAC3B,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IACD,OAAO;QACL,QAAQ,CAAC,MAAM,EAAE,QAAQ;YACvB,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QACtE,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../../src/boot/compose.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AA6BpE,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAIzE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAoCzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../../src/boot/compose.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AA6BpE,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAIzE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAoCzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,M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AAC;IACf;;;;OAIG;IACH,UAAU,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAC5C;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAsB,aAAa,CACjC,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,cAAc,CAAC,CAk9CzB"}
|
package/dist/boot/compose.js
CHANGED
|
@@ -92,11 +92,12 @@ import { registerSessionServices } from "../domain/session/controller.js";
|
|
|
92
92
|
import { registerPluginServices } from "../domain/plugin/controller.js";
|
|
93
93
|
import { PLUGIN_ARTIFACT_KEY_PREFIX } from "../domain/plugin/constants.js";
|
|
94
94
|
import { registerSkillServices } from "../domain/skill/controller.js";
|
|
95
|
-
import { DEFAULT_SLOT_TTL_MS, MAX_ZIP_SIZE, } from "../domain/skill/constants.js";
|
|
95
|
+
import { DEFAULT_SLOT_TTL_MS, MAX_ZIP_SIZE, STAGING_KEY_PREFIX, } from "../domain/skill/constants.js";
|
|
96
96
|
import { newSkillArtifactStorage } from "../domain/skill/storage/artifact-storage.js";
|
|
97
97
|
import { newContentAddressedArchiveStore } from "../archive/content-store.js";
|
|
98
|
-
import { newSkillTransferLane, uploadUrl as skillUploadUrl, } from "../domain/skill/transfer/handler.js";
|
|
98
|
+
import { newSkillTransferLane, transferServeUrl, uploadUrl as skillUploadUrl, } from "../domain/skill/transfer/handler.js";
|
|
99
99
|
import { UploadSlots } from "../domain/skill/transfer/slots.js";
|
|
100
|
+
import { newArchiveStaging, uploadRefOf, } from "../domain/skill/transfer/staging.js";
|
|
100
101
|
import { DEFAULT_WRITE_VERSION, ENCRYPTION_KEY_ENV_VAR, ENCRYPTION_KEY_FILE_NAME, ENCRYPTION_WRITE_VERSION_ENV_VAR, SecretService, StaticKeySecretCodec, } from "../encryption/encryption.js";
|
|
101
102
|
import { getOrCreateNamedKey } from "../encryption/key-manager.js";
|
|
102
103
|
import { V1_VERSION } from "../encryption/v1-codec.js";
|
|
@@ -121,6 +122,7 @@ import { PostgresStore } from "../store/postgres/store.js";
|
|
|
121
122
|
import { SqliteStore } from "../store/sqlite/store.js";
|
|
122
123
|
import { resolveExtensions } from "../extensions/registry.js";
|
|
123
124
|
import { resolveOAuthRedirectUri } from "./oauth-redirect-uri.js";
|
|
125
|
+
import { assessSkillTransferOrigin } from "./skill-transfer-origin.js";
|
|
124
126
|
import { registerWorkflowServices } from "../domain/workflow/controller.js";
|
|
125
127
|
import { bundledModelRegistryDocument, bundledTaskKindRegistryDocument, } from "../domain/workflow/registry/bundled.js";
|
|
126
128
|
import { ModelRegistryStore } from "../domain/workflow/registry/model-registry-store.js";
|
|
@@ -689,7 +691,7 @@ export async function composeServer(options) {
|
|
|
689
691
|
: undefined;
|
|
690
692
|
// The skill artifact store + transfer lane (Go server.go:318-340). The
|
|
691
693
|
// store is content-addressed and never-GC at {storagePath}/skills/;
|
|
692
|
-
// the slots registry wipes {storagePath}/skills
|
|
694
|
+
// the slots registry wipes {storagePath}/skills/staging at boot (orphans
|
|
693
695
|
// from a dead process are useless — the registry died with it). On OSS
|
|
694
696
|
// the lane is ALWAYS configured (Go wires it unconditionally too): the
|
|
695
697
|
// FailedPrecondition lane-absent arms exist for construction-order
|
|
@@ -701,11 +703,19 @@ export async function composeServer(options) {
|
|
|
701
703
|
// deployment changes nothing for skill artifacts until it opts in
|
|
702
704
|
// explicitly, and the Go-written skills/ directory keeps serving in
|
|
703
705
|
// place on the default arm.
|
|
704
|
-
|
|
706
|
+
//
|
|
707
|
+
// Capability URLs come from the driver through the staging port
|
|
708
|
+
// (domain/skill/transfer/staging.ts, stigmer#1219): the local driver's
|
|
709
|
+
// presignPut reserves a slot here and renders the lane URL below, a
|
|
710
|
+
// bucket driver's signs a PUT straight to the bucket, and the
|
|
711
|
+
// controllers cannot tell which. The slots are constructed on every
|
|
712
|
+
// arm so the HTTP lane always has a registry to consult; on a bucket
|
|
713
|
+
// arm nothing is ever reserved in it.
|
|
714
|
+
const skillUploadSlots = new UploadSlots(config.storagePath, STAGING_KEY_PREFIX, DEFAULT_SLOT_TTL_MS, MAX_ZIP_SIZE);
|
|
715
|
+
const skillType = config.skillArtifactStorageType === ""
|
|
716
|
+
? "local"
|
|
717
|
+
: config.skillArtifactStorageType;
|
|
705
718
|
const skillStorageDriver = (() => {
|
|
706
|
-
const skillType = config.skillArtifactStorageType === ""
|
|
707
|
-
? "local"
|
|
708
|
-
: config.skillArtifactStorageType;
|
|
709
719
|
if (skillType === "local") {
|
|
710
720
|
// Go layout invariant: {storagePath}/skills exists from boot with
|
|
711
721
|
// 0755 (the retired LocalFileStorage constructor's mkdir; the
|
|
@@ -716,14 +726,18 @@ export async function composeServer(options) {
|
|
|
716
726
|
});
|
|
717
727
|
// The local presigned-PUT arm rides the skill transfer lane's slot
|
|
718
728
|
// mechanism (§6b Q1 ruling: one upload surface, no new lane). The
|
|
719
|
-
// slots stage inside THIS driver's root
|
|
720
|
-
// reads back
|
|
721
|
-
//
|
|
722
|
-
//
|
|
723
|
-
return new LocalArtifactStorage(config.storagePath,
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
729
|
+
// slots stage inside THIS driver's root under the domain's staging
|
|
730
|
+
// key, so download(key) reads back what the lane received; the
|
|
731
|
+
// serve URL is the lane's download route, so getSignedUrl renders
|
|
732
|
+
// the very URL the lane dispatches.
|
|
733
|
+
return new LocalArtifactStorage(config.storagePath, transferServeUrl(config.skillTransferBaseUrl), {
|
|
734
|
+
reserve: (key, declaredSizeBytes) => {
|
|
735
|
+
const { ttlMs } = skillUploadSlots.reserve(key, declaredSizeBytes);
|
|
736
|
+
return {
|
|
737
|
+
url: skillUploadUrl(config.skillTransferBaseUrl, uploadRefOf(key)),
|
|
738
|
+
ttlMs,
|
|
739
|
+
};
|
|
740
|
+
},
|
|
727
741
|
});
|
|
728
742
|
}
|
|
729
743
|
// Non-local skill backends share the artifact store's R2 settings for
|
|
@@ -745,7 +759,24 @@ export async function composeServer(options) {
|
|
|
745
759
|
// (`plugins/`) keeps the two stores apart and the plugin store owns its
|
|
746
760
|
// keys (src/archive/content-store.ts).
|
|
747
761
|
const pluginArtifactStorage = newContentAddressedArchiveStore(skillStorageDriver, PLUGIN_ARTIFACT_KEY_PREFIX);
|
|
762
|
+
// One staging port for every archive kind, over the one skill blob
|
|
763
|
+
// driver: the controllers mint, consume and sign through it and never
|
|
764
|
+
// meet the slots or the bucket.
|
|
765
|
+
const skillArchiveStaging = newArchiveStaging(skillStorageDriver, logger);
|
|
748
766
|
const skillTransferLane = newSkillTransferLane(skillUploadSlots, skillArtifactStorage, logger);
|
|
767
|
+
// A hosted server relaying bytes through itself from its loopback
|
|
768
|
+
// default mints URLs no caller can reach (stigmer#1219); nothing inside
|
|
769
|
+
// the process can observe that, so the boot says it. Never fatal: the
|
|
770
|
+
// inline push and every other RPC work, and a self-host behind a tunnel
|
|
771
|
+
// it forgot to name deserves a pointer, not an outage.
|
|
772
|
+
const transferOrigin = assessSkillTransferOrigin({
|
|
773
|
+
baseUrl: config.skillTransferBaseUrl,
|
|
774
|
+
relaysThroughServer: skillType === "local",
|
|
775
|
+
requireAuthentication,
|
|
776
|
+
});
|
|
777
|
+
if (transferOrigin.kind === "loopback-hosted") {
|
|
778
|
+
logger.warn("skill artifact transfer lane mints capability URLs on the server's own loopback while the server requires authentication; pushes above the gRPC message cap and sandbox skill downloads will fail — set SKILL_TRANSFER_BASE_URL to the origin callers reach this server on", { baseUrl: transferOrigin.baseUrl });
|
|
779
|
+
}
|
|
749
780
|
// The console lane (lane 4, DD-012): present only when a static export
|
|
750
781
|
// is bundled (slim artifacts) or configured (STIGMER_CONSOLE_DIR) —
|
|
751
782
|
// "not bundled" is a modeled state, logged once, with the router
|
|
@@ -1163,14 +1194,11 @@ export async function composeServer(options) {
|
|
|
1163
1194
|
// The agentexecution blob store (server.go:362-363) — read side of
|
|
1164
1195
|
// pushFromExecutionArtifact.
|
|
1165
1196
|
executionArtifactStorage: artifactStorage,
|
|
1166
|
-
|
|
1167
|
-
slots: skillUploadSlots,
|
|
1168
|
-
baseUrl: config.skillTransferBaseUrl,
|
|
1169
|
-
},
|
|
1197
|
+
staging: skillArchiveStaging,
|
|
1170
1198
|
});
|
|
1171
1199
|
// Plugins materialise their members through the in-process lane as
|
|
1172
1200
|
// the installing caller; the lazy provider resolves the clients built
|
|
1173
|
-
// from these same routes after boot. The
|
|
1201
|
+
// from these same routes after boot. The staging port is the skill
|
|
1174
1202
|
// lane's: one upload surface for every archive.
|
|
1175
1203
|
registerPluginServices(router, {
|
|
1176
1204
|
store,
|
|
@@ -1179,10 +1207,7 @@ export async function composeServer(options) {
|
|
|
1179
1207
|
authorizationLifecycle,
|
|
1180
1208
|
artifactStorage: pluginArtifactStorage,
|
|
1181
1209
|
materializerProvider: () => requireInProcess().pluginMaterializer,
|
|
1182
|
-
|
|
1183
|
-
slots: skillUploadSlots,
|
|
1184
|
-
baseUrl: config.skillTransferBaseUrl,
|
|
1185
|
-
},
|
|
1210
|
+
staging: skillArchiveStaging,
|
|
1186
1211
|
});
|
|
1187
1212
|
// Artifact CRUD shares the ONE blob store with agentexecution's
|
|
1188
1213
|
// attachment lanes (Go server.go 347–374).
|