@stigmer/server 3.22.1-dev.20260922095755 → 3.23.0
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 +8 -4
- package/dist/authorization/authorizer.d.ts.map +1 -1
- package/dist/authorization/authorizer.js +9 -5
- package/dist/authorization/authorizer.js.map +1 -1
- package/dist/authorization/derived-tuples.d.ts.map +1 -1
- package/dist/authorization/derived-tuples.js +25 -10
- package/dist/authorization/derived-tuples.js.map +1 -1
- package/dist/authorization/evaluator.d.ts +8 -7
- package/dist/authorization/evaluator.d.ts.map +1 -1
- package/dist/authorization/evaluator.js +20 -4
- 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 +9 -5
- 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 +5 -4
- 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 +4 -3
- package/dist/authorization/model/plugin.js.map +1 -1
- package/dist/authorization/model/rewrite.d.ts +10 -8
- package/dist/authorization/model/rewrite.d.ts.map +1 -1
- package/dist/authorization/model/rewrite.js +3 -0
- 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 +3 -2
- package/dist/authorization/organization-directory.js.map +1 -1
- package/dist/authorization/store-test-kit.d.ts +6 -0
- package/dist/authorization/store-test-kit.d.ts.map +1 -1
- package/dist/authorization/store-test-kit.js +62 -16
- package/dist/authorization/store-test-kit.js.map +1 -1
- package/dist/authorization/tuples.d.ts +32 -13
- package/dist/authorization/tuples.d.ts.map +1 -1
- package/dist/authorization/tuples.js +11 -3
- 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 +1 -3
- 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 +1 -3
- 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 +4 -3
- package/dist/domain/agentinstance/controller.js.map +1 -1
- package/dist/domain/agentshare/constants.d.ts +11 -6
- package/dist/domain/agentshare/constants.d.ts.map +1 -1
- package/dist/domain/agentshare/constants.js +16 -8
- 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 +1 -3
- package/dist/domain/agentshare/controller.js.map +1 -1
- package/dist/domain/agentshare/steps.d.ts +25 -18
- package/dist/domain/agentshare/steps.d.ts.map +1 -1
- package/dist/domain/agentshare/steps.js +142 -41
- 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 +3 -2
- 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 +1 -2
- 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 +4 -3
- 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 +11 -9
- package/dist/domain/plugin/controller.js.map +1 -1
- package/dist/domain/plugin/push.d.ts +5 -7
- package/dist/domain/plugin/push.d.ts.map +1 -1
- package/dist/domain/plugin/push.js +14 -8
- 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 +1 -3
- 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 +2 -3
- 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 +35 -22
- 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/controller.d.ts.map +1 -1
- package/dist/domain/workflow/controller.js +6 -14
- 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 +1 -10
- package/dist/domain/workflow/validation/task-config-constraints.d.ts.map +1 -1
- package/dist/domain/workflow/validation/task-config-constraints.js +2 -3
- 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 +2 -4
- 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 +4 -3
- package/dist/domain/workflowinstance/controller.js.map +1 -1
- package/dist/extensions/authorization-queries.d.ts +5 -6
- 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 +2 -3
- package/dist/extensions/resource-authorization.d.ts.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/dist/pipeline/apiresource-meta.d.ts +3 -12
- package/dist/pipeline/apiresource-meta.d.ts.map +1 -1
- package/dist/pipeline/apiresource-meta.js +10 -21
- package/dist/pipeline/apiresource-meta.js.map +1 -1
- package/dist/pipeline/steps/authorization-tuples.d.ts +3 -9
- package/dist/pipeline/steps/authorization-tuples.d.ts.map +1 -1
- package/dist/pipeline/steps/authorization-tuples.js +11 -9
- package/dist/pipeline/steps/authorization-tuples.js.map +1 -1
- package/dist/pipeline/steps/references.d.ts +20 -178
- package/dist/pipeline/steps/references.d.ts.map +1 -1
- package/dist/pipeline/steps/references.js +43 -344
- 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/pipeline/steps/visibility-gates.d.ts +27 -0
- package/dist/pipeline/steps/visibility-gates.d.ts.map +1 -0
- package/dist/pipeline/steps/visibility-gates.js +139 -0
- package/dist/pipeline/steps/visibility-gates.js.map +1 -0
- package/dist/query/search/controller.js +1 -0
- package/dist/query/search/controller.js.map +1 -1
- package/dist/query/search/criteria.d.ts +5 -1
- package/dist/query/search/criteria.d.ts.map +1 -1
- package/dist/query/search/criteria.js +13 -3
- package/dist/query/search/criteria.js.map +1 -1
- package/dist/query/search/handler.d.ts +4 -5
- package/dist/query/search/handler.d.ts.map +1 -1
- package/dist/query/search/handler.js +6 -7
- 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 +2 -0
- package/dist/query/search/query-store.js.map +1 -1
- package/dist/store/interface.d.ts +6 -3
- package/dist/store/interface.d.ts.map +1 -1
- package/dist/store/interface.js.map +1 -1
- package/dist/store/postgres/migrations.d.ts +1 -3
- package/dist/store/postgres/migrations.d.ts.map +1 -1
- package/dist/store/postgres/migrations.js +1 -35
- 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 +9 -4
- package/dist/store/postgres/store.js.map +1 -1
- package/dist/store/sqlite/migrations.d.ts +1 -3
- package/dist/store/sqlite/migrations.d.ts.map +1 -1
- package/dist/store/sqlite/migrations.js +1 -36
- 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 +8 -4
- 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 +26 -24
- package/src/authorization/__tests__/authorizer.test.ts +9 -10
- package/src/authorization/__tests__/derived-tuples.test.ts +11 -4
- package/src/authorization/__tests__/evaluator.test.ts +73 -14
- package/src/authorization/__tests__/facts.test.ts +2 -2
- package/src/authorization/__tests__/fixtures/fga/agent-instance-creation.fga.yaml +185 -0
- package/src/authorization/__tests__/fixtures/fga/blueprint-private-visibility.fga.yaml +98 -6
- package/src/authorization/__tests__/fixtures/fga/cross-org-share-creation.fga.yaml +98 -0
- package/src/authorization/__tests__/fixtures/fga/default-instance-inheritance.fga.yaml +61 -4
- package/src/authorization/__tests__/fixtures/fga/mcp-server-authoring.fga.yaml +143 -0
- package/src/authorization/__tests__/fixtures/fga/org-admin-owner-inheritance.fga.yaml +21 -1
- package/src/authorization/__tests__/fixtures/fga/platform-visibility.fga.yaml +25 -1
- package/src/authorization/__tests__/fixtures/fga/public-visibility-setter.fga.yaml +52 -0
- package/src/authorization/__tests__/fixtures/fga/workflow-execution-sharing.fga.yaml +3 -1
- package/src/authorization/__tests__/list-read-scope.test.ts +17 -18
- package/src/authorization/__tests__/store-tests.test.ts +8 -1
- package/src/authorization/__tests__/tuples.test.ts +11 -12
- package/src/authorization/authorizer.ts +9 -4
- package/src/authorization/derived-tuples.ts +31 -14
- package/src/authorization/evaluator.ts +44 -8
- package/src/authorization/list-read-scope.ts +11 -5
- package/src/authorization/model/agent.ts +5 -2
- package/src/authorization/model/agent_instance.ts +2 -0
- package/src/authorization/model/mcp_server.ts +2 -0
- package/src/authorization/model/plugin.ts +4 -1
- package/src/authorization/model/rewrite.ts +13 -8
- package/src/authorization/model/skill.ts +2 -0
- package/src/authorization/model/workflow.ts +2 -0
- package/src/authorization/model/workflow_instance.ts +2 -0
- package/src/authorization/organization-directory.ts +3 -1
- package/src/authorization/store-test-kit.ts +75 -16
- package/src/authorization/tuples.ts +39 -16
- 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 +4 -11
- package/src/domain/agent/controller.ts +7 -7
- package/src/domain/agentchannel/__tests__/agentchannel.test.ts +48 -223
- package/src/domain/agentchannel/controller.ts +1 -6
- package/src/domain/agentexecution/controller.ts +1 -6
- package/src/domain/agentinstance/controller.ts +12 -6
- package/src/domain/agentshare/__tests__/agentshare.test.ts +172 -196
- package/src/domain/agentshare/__tests__/create-authorization.test.ts +31 -16
- package/src/domain/agentshare/constants.ts +26 -14
- package/src/domain/agentshare/controller.ts +1 -6
- package/src/domain/agentshare/steps.ts +194 -41
- package/src/domain/environment/controller.ts +8 -5
- package/src/domain/executioncontext/controller.ts +1 -5
- package/src/domain/mcpserver/__tests__/mcpserver.test.ts +28 -115
- package/src/domain/mcpserver/__tests__/oauth-handshake.test.ts +18 -53
- package/src/domain/mcpserver/controller.ts +12 -6
- package/src/domain/plugin/controller.ts +23 -18
- package/src/domain/plugin/push.ts +16 -8
- package/src/domain/schedule/controller.ts +1 -6
- package/src/domain/session/controller.ts +4 -12
- 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 +51 -35
- 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/controller.ts +10 -28
- package/src/domain/workflow/registry/data/task-kind-registry.json +1 -1
- package/src/domain/workflow/validation/task-config-constraints.ts +3 -7
- package/src/domain/workflowexecution/controller.ts +2 -7
- package/src/domain/workflowinstance/controller.ts +12 -6
- package/src/extensions/__tests__/built-in-authorization-composed.test.ts +19 -32
- package/src/extensions/__tests__/extension-composition.test.ts +4 -4
- package/src/extensions/__tests__/list-read-scope-composed.test.ts +6 -9
- package/src/extensions/authorization-queries.ts +5 -6
- package/src/extensions/list-read-scope.ts +1 -1
- package/src/extensions/resource-authorization.ts +5 -3
- package/src/index.ts +14 -0
- package/src/pipeline/apiresource-meta.ts +10 -21
- package/src/pipeline/steps/__tests__/authorization-tuples.test.ts +31 -18
- package/src/pipeline/steps/__tests__/visibility-gates.test.ts +187 -0
- package/src/pipeline/steps/authorization-tuples.ts +11 -9
- package/src/pipeline/steps/references.ts +70 -578
- package/src/pipeline/steps/resolve-artifact-source.ts +20 -13
- package/src/pipeline/steps/visibility-gates.ts +174 -0
- package/src/query/search/__tests__/criteria.test.ts +4 -0
- package/src/query/search/__tests__/query-store.test.ts +40 -11
- package/src/query/search/controller.ts +1 -0
- package/src/query/search/criteria.ts +14 -0
- package/src/query/search/handler.ts +7 -6
- package/src/query/search/query-store.ts +2 -0
- package/src/store/__tests__/store-contract.ts +51 -6
- package/src/store/interface.ts +6 -3
- package/src/store/postgres/__tests__/migrations.test.ts +6 -187
- package/src/store/postgres/__tests__/store-contract.test.ts +2 -0
- package/src/store/postgres/migrations.ts +1 -48
- package/src/store/postgres/store.ts +11 -4
- package/src/store/sqlite/__tests__/migrations.test.ts +5 -191
- package/src/store/sqlite/migrations.ts +1 -45
- package/src/store/sqlite/store.ts +10 -4
- package/src/transport/registry/__tests__/lanes.test.ts +1 -1
- package/dist/domain/workflow/agent-call-references.d.ts +0 -54
- package/dist/domain/workflow/agent-call-references.d.ts.map +0 -1
- package/dist/domain/workflow/agent-call-references.js +0 -97
- package/dist/domain/workflow/agent-call-references.js.map +0 -1
- package/dist/store/public-visibility-retired.d.ts +0 -67
- package/dist/store/public-visibility-retired.d.ts.map +0 -1
- package/dist/store/public-visibility-retired.js +0 -55
- package/dist/store/public-visibility-retired.js.map +0 -1
- package/src/domain/workflow/__tests__/agent-call-references.test.ts +0 -222
- package/src/domain/workflow/agent-call-references.ts +0 -157
- package/src/pipeline/__tests__/supports-visibility.test.ts +0 -112
- package/src/pipeline/steps/__tests__/references.test.ts +0 -703
- package/src/store/__tests__/public-visibility-retired.test.ts +0 -127
- package/src/store/public-visibility-retired.ts +0 -119
|
@@ -41,12 +41,14 @@
|
|
|
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
|
-
*
|
|
49
|
-
*
|
|
44
|
+
* Context. A check's `context.allow` is the `allow_public` parameter
|
|
45
|
+
* (tuples.ts). A check without a context runs with `allow: false`, the
|
|
46
|
+
* listing posture: OpenFGA itself would fault on a conditional tuple it
|
|
47
|
+
* reached with the parameter missing, so the cloud's documents never do
|
|
48
|
+
* that — their CI would already fail — and the choice cannot change an
|
|
49
|
+
* answer the oracle gives. The parser is strict on purpose: an unknown
|
|
50
|
+
* key anywhere is a thrown fault, so a change to the format upstream is
|
|
51
|
+
* loud here rather than half-run.
|
|
50
52
|
*/
|
|
51
53
|
import assert from "node:assert/strict";
|
|
52
54
|
import { checkRelation } from "./evaluator.js";
|
|
@@ -70,12 +72,28 @@ export function parseStoreTestDocument(value, sourceName) {
|
|
|
70
72
|
};
|
|
71
73
|
}
|
|
72
74
|
function parseTuple(value, where) {
|
|
73
|
-
const entry = record(value, where, [
|
|
74
|
-
|
|
75
|
+
const entry = record(value, where, [
|
|
76
|
+
"user",
|
|
77
|
+
"relation",
|
|
78
|
+
"object",
|
|
79
|
+
"condition",
|
|
80
|
+
]);
|
|
81
|
+
const tuple = {
|
|
75
82
|
user: text(entry["user"], `${where}.user`),
|
|
76
83
|
relation: text(entry["relation"], `${where}.relation`),
|
|
77
84
|
object: text(entry["object"], `${where}.object`),
|
|
78
85
|
};
|
|
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
|
+
};
|
|
79
97
|
}
|
|
80
98
|
function parseTest(value, where) {
|
|
81
99
|
const entry = record(value, where, ["name", "check", "list_objects"]);
|
|
@@ -86,7 +104,12 @@ function parseTest(value, where) {
|
|
|
86
104
|
};
|
|
87
105
|
}
|
|
88
106
|
function parseCheck(value, where) {
|
|
89
|
-
const entry = record(value, where, [
|
|
107
|
+
const entry = record(value, where, [
|
|
108
|
+
"user",
|
|
109
|
+
"object",
|
|
110
|
+
"context",
|
|
111
|
+
"assertions",
|
|
112
|
+
]);
|
|
90
113
|
const assertions = record(entry["assertions"], `${where}.assertions`);
|
|
91
114
|
const parsed = {};
|
|
92
115
|
for (const [relation, expected] of Object.entries(assertions)) {
|
|
@@ -95,25 +118,39 @@ function parseCheck(value, where) {
|
|
|
95
118
|
}
|
|
96
119
|
parsed[relation] = expected;
|
|
97
120
|
}
|
|
121
|
+
const context = parseContext(entry["context"], `${where}.context`);
|
|
98
122
|
return {
|
|
99
123
|
user: text(entry["user"], `${where}.user`),
|
|
100
124
|
object: text(entry["object"], `${where}.object`),
|
|
125
|
+
...(context === undefined ? {} : { context }),
|
|
101
126
|
assertions: parsed,
|
|
102
127
|
};
|
|
103
128
|
}
|
|
104
129
|
function parseListObjects(value, where) {
|
|
105
|
-
const entry = record(value, where, ["user", "type", "assertions"]);
|
|
130
|
+
const entry = record(value, where, ["user", "type", "context", "assertions"]);
|
|
106
131
|
const assertions = record(entry["assertions"], `${where}.assertions`);
|
|
107
132
|
const parsed = {};
|
|
108
133
|
for (const [relation, expected] of Object.entries(assertions)) {
|
|
109
134
|
parsed[relation] = list(expected, `${where}.assertions.${relation}`).map((item, index) => text(item, `${where}.assertions.${relation}[${index}]`));
|
|
110
135
|
}
|
|
136
|
+
const context = parseContext(entry["context"], `${where}.context`);
|
|
111
137
|
return {
|
|
112
138
|
user: text(entry["user"], `${where}.user`),
|
|
113
139
|
type: text(entry["type"], `${where}.type`),
|
|
140
|
+
...(context === undefined ? {} : { context }),
|
|
114
141
|
assertions: parsed,
|
|
115
142
|
};
|
|
116
143
|
}
|
|
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
|
+
}
|
|
117
154
|
function record(value, where, allowedKeys) {
|
|
118
155
|
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
119
156
|
throw new Error(`${where}: expected a mapping`);
|
|
@@ -143,6 +180,8 @@ function text(value, where) {
|
|
|
143
180
|
}
|
|
144
181
|
return value;
|
|
145
182
|
}
|
|
183
|
+
/** The listing posture, for a check the document leaves without a context (the module header). */
|
|
184
|
+
const CONTEXT_WHEN_ABSENT = { allow: false };
|
|
146
185
|
/**
|
|
147
186
|
* The document's tests as runnable cases over `model`, plus every
|
|
148
187
|
* assertion group the kit does not run.
|
|
@@ -186,9 +225,10 @@ export function storeTestCases(document, model) {
|
|
|
186
225
|
for (const item of runnable) {
|
|
187
226
|
const object = parseObjectRef(item.object);
|
|
188
227
|
const person = personOf(item.user);
|
|
228
|
+
const context = item.context ?? CONTEXT_WHEN_ABSENT;
|
|
189
229
|
for (const [relation, expected] of Object.entries(item.assertions)) {
|
|
190
230
|
const recording = recordUndeclaredTypes(source, model);
|
|
191
|
-
const actual = await checkRelation({ model, source: recording }, object, relation, person);
|
|
231
|
+
const actual = await checkRelation({ model, source: recording }, object, relation, person, context);
|
|
192
232
|
if (recording.reached.size > 0) {
|
|
193
233
|
skipped.push({
|
|
194
234
|
document: document.name,
|
|
@@ -201,7 +241,7 @@ export function storeTestCases(document, model) {
|
|
|
201
241
|
});
|
|
202
242
|
continue;
|
|
203
243
|
}
|
|
204
|
-
assert.equal(actual, expected, `${document.name} :: ${test.name}: ${item.user} ${relation} ${item.object} expected ${String(expected)}, got ${String(actual)}`);
|
|
244
|
+
assert.equal(actual, expected, `${document.name} :: ${test.name}: ${item.user} ${relation} ${item.object} (allow: ${String(context.allow)}) expected ${String(expected)}, got ${String(actual)}`);
|
|
205
245
|
}
|
|
206
246
|
}
|
|
207
247
|
},
|
|
@@ -212,9 +252,10 @@ export function storeTestCases(document, model) {
|
|
|
212
252
|
/**
|
|
213
253
|
* A view of `inner` that records, for one walk, every subject type the
|
|
214
254
|
* evaluator read that `model` does not declare. A person
|
|
215
|
-
* (`identity_account:<id
|
|
216
|
-
* type it resolves, so it is not a "reach" whatever
|
|
217
|
-
* userset or a parent object of an undeclared
|
|
255
|
+
* (`identity_account:<id>`, the wildcard) is a subject the evaluator
|
|
256
|
+
* compares, never a type it resolves, so it is not a "reach" whatever
|
|
257
|
+
* the model declares; a userset or a parent object of an undeclared
|
|
258
|
+
* type is.
|
|
218
259
|
*/
|
|
219
260
|
function recordUndeclaredTypes(inner, model) {
|
|
220
261
|
const reached = new Set();
|
|
@@ -241,6 +282,8 @@ function resolvedTypeOf(subject) {
|
|
|
241
282
|
: subject.object.type;
|
|
242
283
|
case "userset":
|
|
243
284
|
return subject.object.type;
|
|
285
|
+
case "wildcard":
|
|
286
|
+
return undefined;
|
|
244
287
|
default: {
|
|
245
288
|
const exhaustive = subject;
|
|
246
289
|
throw new Error(`unknown subject form: ${JSON.stringify(exhaustive)}`);
|
|
@@ -248,10 +291,13 @@ function resolvedTypeOf(subject) {
|
|
|
248
291
|
}
|
|
249
292
|
}
|
|
250
293
|
function tupleOf(entry) {
|
|
294
|
+
const subject = parseSubject(entry.user);
|
|
251
295
|
return {
|
|
252
296
|
object: parseObjectRef(entry.object),
|
|
253
297
|
relation: entry.relation,
|
|
254
|
-
subject:
|
|
298
|
+
subject: subject.form === "wildcard" && entry.condition !== undefined
|
|
299
|
+
? { ...subject, condition: entry.condition.name }
|
|
300
|
+
: subject,
|
|
255
301
|
};
|
|
256
302
|
}
|
|
257
303
|
/** 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE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
|
3
3
|
* the cloud's model is written in (object, relation, subject; a subject
|
|
4
|
-
* being an object
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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
|
|
4
|
+
* being an object, a userset `type:id#relation`, or the public wildcard
|
|
5
|
+
* `type:*` under a condition), typed once so the evaluator, the
|
|
6
|
+
* derivation and the store-test kit speak one language. Nothing here is
|
|
9
7
|
* stored: open source derives every tuple from a row (derived-tuples.ts)
|
|
10
8
|
* or reads it from an IamPolicy row, and this module only names what a
|
|
11
9
|
* tuple IS.
|
|
@@ -20,16 +18,25 @@
|
|
|
20
18
|
* The type is named here; the construction (`personFor`, `resolvePerson`)
|
|
21
19
|
* is person.ts's, so this module stays vocabulary with no I/O.
|
|
22
20
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* and
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
21
|
+
* `CheckContext` is the FGA condition context. The one condition the
|
|
22
|
+
* model declares is `allow_public(allow: bool)` on the public wildcard,
|
|
23
|
+
* and the cloud's own posture (stigmer-cloud authorizer/fga-authorizer.ts,
|
|
24
|
+
* the Java BuildCheckRequest) is `allow: true` on a point check — a public
|
|
25
|
+
* resource reads for any authenticated caller — and `allow: false` in a
|
|
26
|
+
* listing, which keeps a public wildcard from flooding an organization's
|
|
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.
|
|
29
34
|
*/
|
|
30
35
|
import type { Message } from "@bufbuild/protobuf";
|
|
31
36
|
/** The FGA type name of the kind every person is: `identity_account:<id>`. */
|
|
32
37
|
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";
|
|
33
40
|
/** `type:id` — an object of the model. */
|
|
34
41
|
export interface ObjectRef {
|
|
35
42
|
readonly type: string;
|
|
@@ -47,6 +54,12 @@ export type Subject =
|
|
|
47
54
|
readonly form: "userset";
|
|
48
55
|
readonly object: ObjectRef;
|
|
49
56
|
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;
|
|
50
63
|
};
|
|
51
64
|
export interface Tuple {
|
|
52
65
|
readonly object: ObjectRef;
|
|
@@ -78,12 +91,18 @@ export interface Person {
|
|
|
78
91
|
/** Every string a creator stamp may carry for this person; always contains `accountId`. */
|
|
79
92
|
readonly aliases: ReadonlySet<string>;
|
|
80
93
|
}
|
|
94
|
+
/** The condition parameters of a check (the module header). */
|
|
95
|
+
export interface CheckContext {
|
|
96
|
+
readonly allow: boolean;
|
|
97
|
+
}
|
|
81
98
|
/** `type:id` → ObjectRef; the id may itself contain `:` (issuer subjects do). */
|
|
82
99
|
export declare function parseObjectRef(text: string): ObjectRef;
|
|
83
100
|
export declare function formatObjectRef(object: ObjectRef): string;
|
|
84
101
|
/**
|
|
85
|
-
* `type:id
|
|
86
|
-
*
|
|
102
|
+
* `type:id`, `type:id#relation` or `type:*` → Subject. A wildcard parsed
|
|
103
|
+
* from text carries no condition; the caller attaches one when its source
|
|
104
|
+
* says so (the store tests carry it on the tuple, the derivation attaches
|
|
105
|
+
* the model's).
|
|
87
106
|
*/
|
|
88
107
|
export declare function parseSubject(text: string): Subject;
|
|
89
108
|
export declare function formatSubject(subject: Subject): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tuples.d.ts","sourceRoot":"","sources":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AAG,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;CAC9E;AAED,8GAA8G;AAC9G,MAAM,WAAW,SAAS;IACxB,oFAAoF;IACpF,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC;CACvD;AAED,yCAAyC;AACzC,MAAM,WAAW,MAAM;IACrB,sCAAsC;IACtC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,2FAA2F;IAC3F,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACvC;AAED,+DAA+D;AAC/D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAMD,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAMtD;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAEzD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAclD;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAetD;AAED,4EAA4E;AAC5E,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAEhD;AAED,8DAA8D;AAC9D,wBAAgB,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,2FAA2F;AAC3F,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,GAC3B,WAAW,CAgBb"}
|
|
@@ -1,5 +1,7 @@
|
|
|
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";
|
|
3
5
|
// ---------------------------------------------------------------------------
|
|
4
6
|
// The string notation.
|
|
5
7
|
// ---------------------------------------------------------------------------
|
|
@@ -15,8 +17,10 @@ export function formatObjectRef(object) {
|
|
|
15
17
|
return `${object.type}:${object.id}`;
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
|
-
* `type:id
|
|
19
|
-
*
|
|
20
|
+
* `type:id`, `type:id#relation` or `type:*` → Subject. A wildcard parsed
|
|
21
|
+
* from text carries no condition; the caller attaches one when its source
|
|
22
|
+
* says so (the store tests carry it on the tuple, the derivation attaches
|
|
23
|
+
* the model's).
|
|
20
24
|
*/
|
|
21
25
|
export function parseSubject(text) {
|
|
22
26
|
const hash = text.indexOf("#");
|
|
@@ -29,7 +33,7 @@ export function parseSubject(text) {
|
|
|
29
33
|
}
|
|
30
34
|
const object = parseObjectRef(text);
|
|
31
35
|
if (object.id === "*") {
|
|
32
|
-
|
|
36
|
+
return { form: "wildcard", type: object.type, condition: undefined };
|
|
33
37
|
}
|
|
34
38
|
return { form: "object", object };
|
|
35
39
|
}
|
|
@@ -39,6 +43,10 @@ export function formatSubject(subject) {
|
|
|
39
43
|
return formatObjectRef(subject.object);
|
|
40
44
|
case "userset":
|
|
41
45
|
return `${formatObjectRef(subject.object)}#${subject.relation}`;
|
|
46
|
+
case "wildcard":
|
|
47
|
+
return subject.condition === undefined
|
|
48
|
+
? `${subject.type}:*`
|
|
49
|
+
: `${subject.type}:* with ${subject.condition}`;
|
|
42
50
|
default: {
|
|
43
51
|
const exhaustive = subject;
|
|
44
52
|
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":"AAoCA,8EAA8E;AAC9E,MAAM,CAAC,MAAM,YAAY,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AC3B,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,MAAM,2BAA2B,CAA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G;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).
|