@stigmer/server 3.24.0 → 3.26.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/authorization/authorizer.d.ts +10 -4
- package/dist/authorization/authorizer.d.ts.map +1 -1
- package/dist/authorization/authorizer.js +11 -4
- package/dist/authorization/authorizer.js.map +1 -1
- package/dist/authorization/model/index.d.ts +4 -4
- package/dist/authorization/model/index.d.ts.map +1 -1
- package/dist/authorization/model/index.js +2 -0
- package/dist/authorization/model/index.js.map +1 -1
- package/dist/authorization/model/oauth_app.d.ts.map +1 -1
- package/dist/authorization/model/oauth_app.js +3 -2
- package/dist/authorization/model/oauth_app.js.map +1 -1
- package/dist/authorization/model/platform_client.d.ts +2 -0
- package/dist/authorization/model/platform_client.d.ts.map +1 -0
- package/dist/authorization/model/platform_client.js +31 -0
- package/dist/authorization/model/platform_client.js.map +1 -0
- package/dist/boot/compose.d.ts.map +1 -1
- package/dist/boot/compose.js +99 -13
- package/dist/boot/compose.js.map +1 -1
- package/dist/boot/list-indexes.d.ts +3 -0
- package/dist/boot/list-indexes.d.ts.map +1 -0
- package/dist/boot/list-indexes.js +24 -0
- package/dist/boot/list-indexes.js.map +1 -0
- package/dist/boot/route-shadowing.d.ts +25 -0
- package/dist/boot/route-shadowing.d.ts.map +1 -0
- package/dist/boot/route-shadowing.js +17 -0
- package/dist/boot/route-shadowing.js.map +1 -0
- package/dist/domain/agentexecution/controller.d.ts.map +1 -1
- package/dist/domain/agentexecution/controller.js +6 -8
- package/dist/domain/agentexecution/controller.js.map +1 -1
- package/dist/domain/agentexecution/list-index.d.ts +2 -0
- package/dist/domain/agentexecution/list-index.d.ts.map +1 -0
- package/dist/domain/agentexecution/list-index.js +23 -0
- package/dist/domain/agentexecution/list-index.js.map +1 -0
- package/dist/domain/agentexecution/steps.d.ts +17 -33
- package/dist/domain/agentexecution/steps.d.ts.map +1 -1
- package/dist/domain/agentexecution/steps.js +94 -95
- package/dist/domain/agentexecution/steps.js.map +1 -1
- package/dist/domain/agentexecution/usage.d.ts.map +1 -1
- package/dist/domain/agentexecution/usage.js +37 -14
- package/dist/domain/agentexecution/usage.js.map +1 -1
- package/dist/domain/artifact/controller.d.ts.map +1 -1
- package/dist/domain/artifact/controller.js +27 -15
- package/dist/domain/artifact/controller.js.map +1 -1
- package/dist/domain/artifact/list-index.d.ts +2 -0
- package/dist/domain/artifact/list-index.d.ts.map +1 -0
- package/dist/domain/artifact/list-index.js +21 -0
- package/dist/domain/artifact/list-index.js.map +1 -0
- package/dist/domain/iampolicy/membership.d.ts +6 -1
- package/dist/domain/iampolicy/membership.d.ts.map +1 -1
- package/dist/domain/iampolicy/membership.js +8 -2
- package/dist/domain/iampolicy/membership.js.map +1 -1
- package/dist/domain/identityaccount/constants.d.ts +13 -0
- package/dist/domain/identityaccount/constants.d.ts.map +1 -1
- package/dist/domain/identityaccount/constants.js +17 -0
- package/dist/domain/identityaccount/constants.js.map +1 -1
- package/dist/domain/identityaccount/controller.d.ts +3 -1
- package/dist/domain/identityaccount/controller.d.ts.map +1 -1
- package/dist/domain/identityaccount/controller.js +15 -6
- package/dist/domain/identityaccount/controller.js.map +1 -1
- package/dist/domain/identityaccount/operator.d.ts.map +1 -1
- package/dist/domain/identityaccount/operator.js +1 -0
- package/dist/domain/identityaccount/operator.js.map +1 -1
- package/dist/domain/identityaccount/provisioning.d.ts +18 -0
- package/dist/domain/identityaccount/provisioning.d.ts.map +1 -1
- package/dist/domain/identityaccount/provisioning.js +1 -0
- package/dist/domain/identityaccount/provisioning.js.map +1 -1
- package/dist/domain/identityaccount/resource-store.js +9 -5
- package/dist/domain/identityaccount/resource-store.js.map +1 -1
- package/dist/domain/identityaccount/steps.d.ts +11 -2
- package/dist/domain/identityaccount/steps.d.ts.map +1 -1
- package/dist/domain/identityaccount/steps.js +42 -4
- package/dist/domain/identityaccount/steps.js.map +1 -1
- package/dist/domain/identityaccount/store-contract.d.ts.map +1 -1
- package/dist/domain/identityaccount/store-contract.js +33 -0
- package/dist/domain/identityaccount/store-contract.js.map +1 -1
- package/dist/domain/identityaccount/store.d.ts +7 -5
- package/dist/domain/identityaccount/store.d.ts.map +1 -1
- package/dist/domain/identityaccount/store.js.map +1 -1
- package/dist/domain/platform/controller.d.ts +10 -0
- package/dist/domain/platform/controller.d.ts.map +1 -1
- package/dist/domain/platform/controller.js +2 -1
- package/dist/domain/platform/controller.js.map +1 -1
- package/dist/domain/platformclient/constants.d.ts +60 -0
- package/dist/domain/platformclient/constants.d.ts.map +1 -0
- package/dist/domain/platformclient/constants.js +78 -0
- package/dist/domain/platformclient/constants.js.map +1 -0
- package/dist/domain/platformclient/controller.d.ts +59 -0
- package/dist/domain/platformclient/controller.d.ts.map +1 -0
- package/dist/domain/platformclient/controller.js +191 -0
- package/dist/domain/platformclient/controller.js.map +1 -0
- package/dist/domain/platformclient/credentials.d.ts +13 -0
- package/dist/domain/platformclient/credentials.d.ts.map +1 -0
- package/dist/domain/platformclient/credentials.js +56 -0
- package/dist/domain/platformclient/credentials.js.map +1 -0
- package/dist/domain/platformclient/mint.d.ts +23 -0
- package/dist/domain/platformclient/mint.d.ts.map +1 -0
- package/dist/domain/platformclient/mint.js +254 -0
- package/dist/domain/platformclient/mint.js.map +1 -0
- package/dist/domain/platformclient/origin-guard.d.ts +9 -0
- package/dist/domain/platformclient/origin-guard.d.ts.map +1 -0
- package/dist/domain/platformclient/origin-guard.js +81 -0
- package/dist/domain/platformclient/origin-guard.js.map +1 -0
- package/dist/domain/platformclient/resource-store.d.ts +4 -0
- package/dist/domain/platformclient/resource-store.d.ts.map +1 -0
- package/dist/domain/platformclient/resource-store.js +117 -0
- package/dist/domain/platformclient/resource-store.js.map +1 -0
- package/dist/domain/platformclient/steps.d.ts +51 -0
- package/dist/domain/platformclient/steps.d.ts.map +1 -0
- package/dist/domain/platformclient/steps.js +339 -0
- package/dist/domain/platformclient/steps.js.map +1 -0
- package/dist/domain/platformclient/store-contract.d.ts +8 -0
- package/dist/domain/platformclient/store-contract.d.ts.map +1 -0
- package/dist/domain/platformclient/store-contract.js +208 -0
- package/dist/domain/platformclient/store-contract.js.map +1 -0
- package/dist/domain/platformclient/store.d.ts +58 -0
- package/dist/domain/platformclient/store.d.ts.map +1 -0
- package/dist/domain/platformclient/store.js +13 -0
- package/dist/domain/platformclient/store.js.map +1 -0
- package/dist/domain/platformclient/system-managed.d.ts +18 -0
- package/dist/domain/platformclient/system-managed.d.ts.map +1 -0
- package/dist/domain/platformclient/system-managed.js +80 -0
- package/dist/domain/platformclient/system-managed.js.map +1 -0
- package/dist/domain/platformclient/token-controller.d.ts +11 -0
- package/dist/domain/platformclient/token-controller.d.ts.map +1 -0
- package/dist/domain/platformclient/token-controller.js +32 -0
- package/dist/domain/platformclient/token-controller.js.map +1 -0
- package/dist/domain/platformclient/verifier.d.ts +10 -0
- package/dist/domain/platformclient/verifier.d.ts.map +1 -0
- package/dist/domain/platformclient/verifier.js +76 -0
- package/dist/domain/platformclient/verifier.js.map +1 -0
- package/dist/domain/session/list-index.d.ts +4 -0
- package/dist/domain/session/list-index.d.ts.map +1 -0
- package/dist/domain/session/list-index.js +26 -0
- package/dist/domain/session/list-index.js.map +1 -0
- package/dist/domain/session/steps.d.ts +7 -8
- package/dist/domain/session/steps.d.ts.map +1 -1
- package/dist/domain/session/steps.js +76 -78
- package/dist/domain/session/steps.js.map +1 -1
- package/dist/domain/workflowexecution/controller.d.ts.map +1 -1
- package/dist/domain/workflowexecution/controller.js +53 -55
- package/dist/domain/workflowexecution/controller.js.map +1 -1
- package/dist/domain/workflowexecution/execution-filter.d.ts +4 -0
- package/dist/domain/workflowexecution/execution-filter.d.ts.map +1 -1
- package/dist/domain/workflowexecution/execution-filter.js +11 -5
- package/dist/domain/workflowexecution/execution-filter.js.map +1 -1
- package/dist/domain/workflowexecution/get-execution-summary.d.ts.map +1 -1
- package/dist/domain/workflowexecution/get-execution-summary.js +23 -17
- package/dist/domain/workflowexecution/get-execution-summary.js.map +1 -1
- package/dist/domain/workflowexecution/list-index.d.ts +2 -0
- package/dist/domain/workflowexecution/list-index.d.ts.map +1 -0
- package/dist/domain/workflowexecution/list-index.js +21 -0
- package/dist/domain/workflowexecution/list-index.js.map +1 -0
- package/dist/domain/workflowexecution/list-pending-approvals.d.ts.map +1 -1
- package/dist/domain/workflowexecution/list-pending-approvals.js +69 -32
- package/dist/domain/workflowexecution/list-pending-approvals.js.map +1 -1
- package/dist/domain/workflowexecution/queries.d.ts +30 -4
- package/dist/domain/workflowexecution/queries.d.ts.map +1 -1
- package/dist/domain/workflowexecution/queries.js +76 -22
- package/dist/domain/workflowexecution/queries.js.map +1 -1
- package/dist/encryption/key-manager.d.ts +20 -3
- package/dist/encryption/key-manager.d.ts.map +1 -1
- package/dist/encryption/key-manager.js +64 -42
- package/dist/encryption/key-manager.js.map +1 -1
- package/dist/extensions/caller-guards.d.ts +8 -3
- package/dist/extensions/caller-guards.d.ts.map +1 -1
- package/dist/extensions/drivers.d.ts +37 -0
- package/dist/extensions/drivers.d.ts.map +1 -1
- package/dist/extensions/guest-token-minting.d.ts +26 -0
- package/dist/extensions/guest-token-minting.d.ts.map +1 -0
- package/dist/extensions/guest-token-minting.js +2 -0
- package/dist/extensions/guest-token-minting.js.map +1 -0
- package/dist/extensions/identity.d.ts +6 -4
- package/dist/extensions/identity.d.ts.map +1 -1
- package/dist/extensions/identity.js.map +1 -1
- package/dist/extensions/list-read-scope.d.ts +9 -12
- package/dist/extensions/list-read-scope.d.ts.map +1 -1
- package/dist/extensions/list-read-scope.js.map +1 -1
- package/dist/extensions/registry.d.ts +30 -1
- package/dist/extensions/registry.d.ts.map +1 -1
- package/dist/extensions/registry.js +34 -1
- package/dist/extensions/registry.js.map +1 -1
- package/dist/index.d.ts +15 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/pipeline/interceptors/auth.d.ts +14 -0
- package/dist/pipeline/interceptors/auth.d.ts.map +1 -1
- package/dist/pipeline/interceptors/auth.js +24 -0
- package/dist/pipeline/interceptors/auth.js.map +1 -1
- package/dist/pipeline/steps/build-update-state.d.ts +11 -1
- package/dist/pipeline/steps/build-update-state.d.ts.map +1 -1
- package/dist/pipeline/steps/build-update-state.js +5 -2
- package/dist/pipeline/steps/build-update-state.js.map +1 -1
- package/dist/pipeline/steps/list-page.d.ts +63 -0
- package/dist/pipeline/steps/list-page.d.ts.map +1 -0
- package/dist/pipeline/steps/list-page.js +187 -0
- package/dist/pipeline/steps/list-page.js.map +1 -0
- package/dist/platformtoken/envelope.d.ts +100 -0
- package/dist/platformtoken/envelope.d.ts.map +1 -0
- package/dist/platformtoken/envelope.js +184 -0
- package/dist/platformtoken/envelope.js.map +1 -0
- package/dist/platformtoken/key-ring.d.ts +85 -0
- package/dist/platformtoken/key-ring.d.ts.map +1 -0
- package/dist/platformtoken/key-ring.js +164 -0
- package/dist/platformtoken/key-ring.js.map +1 -0
- package/dist/query/activity/handler.d.ts +6 -7
- package/dist/query/activity/handler.d.ts.map +1 -1
- package/dist/query/activity/handler.js +42 -59
- package/dist/query/activity/handler.js.map +1 -1
- package/dist/store/interface.d.ts +29 -0
- package/dist/store/interface.d.ts.map +1 -1
- package/dist/store/interface.js.map +1 -1
- package/dist/store/list-index.d.ts +123 -0
- package/dist/store/list-index.d.ts.map +1 -0
- package/dist/store/list-index.js +277 -0
- package/dist/store/list-index.js.map +1 -0
- package/dist/store/logger.d.ts +3 -0
- package/dist/store/logger.d.ts.map +1 -1
- package/dist/store/logger.js +5 -1
- package/dist/store/logger.js.map +1 -1
- package/dist/store/postgres/migrations.d.ts +10 -6
- package/dist/store/postgres/migrations.d.ts.map +1 -1
- package/dist/store/postgres/migrations.js +64 -6
- package/dist/store/postgres/migrations.js.map +1 -1
- package/dist/store/postgres/store.d.ts +26 -5
- package/dist/store/postgres/store.d.ts.map +1 -1
- package/dist/store/postgres/store.js +377 -22
- package/dist/store/postgres/store.js.map +1 -1
- package/dist/store/sqlite/migrations.d.ts +11 -5
- package/dist/store/sqlite/migrations.d.ts.map +1 -1
- package/dist/store/sqlite/migrations.js +50 -4
- package/dist/store/sqlite/migrations.js.map +1 -1
- package/dist/store/sqlite/store.d.ts +18 -3
- package/dist/store/sqlite/store.d.ts.map +1 -1
- package/dist/store/sqlite/store.js +321 -15
- package/dist/store/sqlite/store.js.map +1 -1
- package/package.json +6 -6
- package/src/authorization/README.md +1 -1
- package/src/authorization/__tests__/authorizer.test.ts +6 -2
- package/src/authorization/__tests__/drivers.ts +6 -1
- package/src/authorization/__tests__/wire-permissions.test.ts +1 -0
- package/src/authorization/authorizer.ts +11 -4
- package/src/authorization/model/__tests__/registry.test.ts +8 -1
- package/src/authorization/model/index.ts +6 -4
- package/src/authorization/model/oauth_app.ts +3 -2
- package/src/authorization/model/platform_client.ts +43 -0
- package/src/boot/__tests__/auth-enabled-composition.test.ts +2 -1
- package/src/boot/__tests__/list-indexes.test.ts +65 -0
- package/src/boot/__tests__/route-shadowing.test.ts +67 -0
- package/src/boot/compose.ts +113 -18
- package/src/boot/list-indexes.ts +25 -0
- package/src/boot/route-shadowing.ts +47 -0
- package/src/domain/agentexecution/__tests__/agentexecution.test.ts +85 -3
- package/src/domain/agentexecution/controller.ts +8 -10
- package/src/domain/agentexecution/list-index.ts +24 -0
- package/src/domain/agentexecution/steps.ts +118 -115
- package/src/domain/agentexecution/usage.ts +38 -17
- package/src/domain/artifact/controller.ts +28 -18
- package/src/domain/artifact/list-index.ts +22 -0
- package/src/domain/iampolicy/__tests__/membership.test.ts +7 -0
- package/src/domain/iampolicy/membership.ts +8 -2
- package/src/domain/identityaccount/__tests__/platform-client-accounts.test.ts +124 -0
- package/src/domain/identityaccount/__tests__/resource-store.test.ts +1 -0
- package/src/domain/identityaccount/constants.ts +20 -0
- package/src/domain/identityaccount/controller.ts +16 -4
- package/src/domain/identityaccount/operator.ts +1 -0
- package/src/domain/identityaccount/provisioning.ts +17 -0
- package/src/domain/identityaccount/resource-store.ts +9 -5
- package/src/domain/identityaccount/steps.ts +58 -3
- package/src/domain/identityaccount/store-contract.ts +51 -0
- package/src/domain/identityaccount/store.ts +7 -5
- package/src/domain/platform/__tests__/platform.test.ts +7 -1
- package/src/domain/platform/controller.ts +12 -1
- package/src/domain/platformclient/__tests__/controller.test.ts +397 -0
- package/src/domain/platformclient/__tests__/credentials.test.ts +46 -0
- package/src/domain/platformclient/__tests__/mint.test.ts +415 -0
- package/src/domain/platformclient/__tests__/resource-store.test.ts +140 -0
- package/src/domain/platformclient/__tests__/system-managed.test.ts +101 -0
- package/src/domain/platformclient/__tests__/verifier-and-guard.test.ts +207 -0
- package/src/domain/platformclient/constants.ts +120 -0
- package/src/domain/platformclient/controller.ts +449 -0
- package/src/domain/platformclient/credentials.ts +68 -0
- package/src/domain/platformclient/mint.ts +412 -0
- package/src/domain/platformclient/origin-guard.ts +117 -0
- package/src/domain/platformclient/resource-store.ts +150 -0
- package/src/domain/platformclient/steps.ts +472 -0
- package/src/domain/platformclient/store-contract.ts +318 -0
- package/src/domain/platformclient/store.ts +63 -0
- package/src/domain/platformclient/system-managed.ts +115 -0
- package/src/domain/platformclient/token-controller.ts +49 -0
- package/src/domain/platformclient/verifier.ts +106 -0
- package/src/domain/session/list-index.ts +28 -0
- package/src/domain/session/steps.ts +108 -123
- package/src/domain/workflowexecution/__tests__/list-read-scope-summaries.test.ts +155 -99
- package/src/domain/workflowexecution/__tests__/workflowexecution.test.ts +193 -31
- package/src/domain/workflowexecution/controller.ts +54 -82
- package/src/domain/workflowexecution/execution-filter.ts +20 -7
- package/src/domain/workflowexecution/get-execution-summary.ts +31 -24
- package/src/domain/workflowexecution/list-index.ts +22 -0
- package/src/domain/workflowexecution/list-pending-approvals.ts +82 -25
- package/src/domain/workflowexecution/queries.ts +134 -23
- package/src/encryption/key-manager.ts +87 -44
- package/src/extensions/__tests__/extension-composition.test.ts +3 -2
- package/src/extensions/__tests__/platform-client-composed.test.ts +288 -0
- package/src/extensions/__tests__/registry.test.ts +4 -1
- package/src/extensions/__tests__/tier-truthfulness.test.ts +8 -0
- package/src/extensions/caller-guards.ts +8 -3
- package/src/extensions/drivers.ts +37 -0
- package/src/extensions/guest-token-minting.ts +32 -0
- package/src/extensions/identity.ts +6 -4
- package/src/extensions/list-read-scope.ts +9 -12
- package/src/extensions/registry.ts +77 -3
- package/src/index.ts +65 -1
- package/src/pipeline/interceptors/auth.ts +27 -0
- package/src/pipeline/steps/__tests__/list-page.test.ts +186 -0
- package/src/pipeline/steps/__tests__/references.test.ts +2 -0
- package/src/pipeline/steps/build-update-state.ts +5 -2
- package/src/pipeline/steps/list-page.ts +284 -0
- package/src/platformtoken/__tests__/envelope.test.ts +277 -0
- package/src/platformtoken/__tests__/key-ring.test.ts +205 -0
- package/src/platformtoken/envelope.ts +276 -0
- package/src/platformtoken/key-ring.ts +266 -0
- package/src/query/activity/handler.ts +57 -78
- package/src/runnerauth/__tests__/runner-subject-composed.test.ts +9 -3
- package/src/store/README.md +51 -32
- package/src/store/__tests__/list-index.measure.test.ts +293 -0
- package/src/store/__tests__/list-index.test.ts +328 -0
- package/src/store/__tests__/store-contract.ts +346 -3
- package/src/store/interface.ts +39 -0
- package/src/store/list-index.ts +465 -0
- package/src/store/logger.ts +8 -1
- package/src/store/postgres/__tests__/list-index-repair.test.ts +133 -0
- package/src/store/postgres/__tests__/migrations.test.ts +27 -19
- package/src/store/postgres/__tests__/store-contract.test.ts +50 -3
- package/src/store/postgres/migrations.ts +69 -7
- package/src/store/postgres/store.ts +485 -29
- package/src/store/sqlite/__tests__/migrations.test.ts +51 -7
- package/src/store/sqlite/__tests__/store-contract.test.ts +70 -16
- package/src/store/sqlite/__tests__/support.ts +12 -3
- package/src/store/sqlite/migrations.ts +57 -6
- package/src/store/sqlite/store.ts +462 -21
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
Harness,
|
|
30
30
|
} from "@stigmer/protos/ai/stigmer/agentic/session/v1/enum_pb";
|
|
31
31
|
import { SessionListSchema } from "@stigmer/protos/ai/stigmer/agentic/session/v1/io_pb";
|
|
32
|
+
import type { SessionList } from "@stigmer/protos/ai/stigmer/agentic/session/v1/io_pb";
|
|
32
33
|
import { SessionQueryController } from "@stigmer/protos/ai/stigmer/agentic/session/v1/query_pb";
|
|
33
34
|
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
34
35
|
import { IamPermission } from "@stigmer/protos/ai/stigmer/iam/v1/enum_pb";
|
|
@@ -42,27 +43,28 @@ import {
|
|
|
42
43
|
} from "../../pipeline/errors.js";
|
|
43
44
|
import type { PipelineStep } from "../../pipeline/pipeline.js";
|
|
44
45
|
import type { Authorizer } from "../../extensions/authorizer.js";
|
|
46
|
+
import type { CallerIdentity } from "../../extensions/identity.js";
|
|
45
47
|
import type { ListReadScope } from "../../extensions/list-read-scope.js";
|
|
46
48
|
import { restrictListByReadScope } from "../../extensions/list-read-scope.js";
|
|
47
49
|
import { newAuthorizeResolvedTargetStep } from "../../pipeline/steps/authorize-resolved-target.js";
|
|
48
50
|
import type { RequestContext } from "../../pipeline/request-context.js";
|
|
49
51
|
import { RESOURCE_ID_KEY } from "../../pipeline/steps/delete.js";
|
|
50
|
-
import {
|
|
52
|
+
import {
|
|
53
|
+
listPageFingerprint,
|
|
54
|
+
readListPage,
|
|
55
|
+
} from "../../pipeline/steps/list-page.js";
|
|
56
|
+
import type { ListPageRequest } from "../../pipeline/steps/list-page.js";
|
|
51
57
|
import { EXISTING_RESOURCE_KEY } from "../../pipeline/steps/load-existing.js";
|
|
52
58
|
import type { Store } from "../../store/interface.js";
|
|
59
|
+
import type { ListIndexQuery, ListIndexRow } from "../../store/list-index.js";
|
|
60
|
+
import { agentExecutionListIndex } from "../agentexecution/list-index.js";
|
|
61
|
+
import { sessionListIndex } from "./list-index.js";
|
|
53
62
|
|
|
54
63
|
type SessionDesc = typeof SessionSchema;
|
|
55
64
|
|
|
56
65
|
/** Context key for the list result (Go listResultKey). */
|
|
57
66
|
export const LIST_RESULT_KEY = "listResult";
|
|
58
67
|
|
|
59
|
-
/**
|
|
60
|
-
* The session label the channel runtime stamps at create time to record
|
|
61
|
-
* which agent channel originated the conversation. Mirrors
|
|
62
|
-
* ChannelRuntimeConstants.CHANNEL_ID_METADATA_KEY in Stigmer Cloud.
|
|
63
|
-
*/
|
|
64
|
-
const CHANNEL_ID_LABEL_KEY = "stigmer.ai/channel-id";
|
|
65
|
-
|
|
66
68
|
// ---------------------------------------------------------------------------
|
|
67
69
|
// ValidateHarnessImmutability — validate_harness_immutability.go: rejects
|
|
68
70
|
// session updates that attempt to change the harness after the session has
|
|
@@ -273,35 +275,33 @@ function isActiveExecutionPhase(phase: ExecutionPhase): boolean {
|
|
|
273
275
|
}
|
|
274
276
|
|
|
275
277
|
/**
|
|
276
|
-
*
|
|
277
|
-
* session
|
|
278
|
-
* cascade steps (Go
|
|
278
|
+
* Every agent execution of the given session, through the list index's
|
|
279
|
+
* session key (exact whoever wrote the rows, store/interface.ts); malformed
|
|
280
|
+
* rows warn and are skipped. Shared by the guard and cascade steps (Go
|
|
281
|
+
* listExecutionsBySession).
|
|
279
282
|
*/
|
|
280
283
|
async function listExecutionsBySession(
|
|
281
284
|
store: Store,
|
|
282
285
|
logger: Logger,
|
|
283
286
|
sessionId: string,
|
|
284
287
|
): Promise<AgentExecution[]> {
|
|
285
|
-
let rows:
|
|
288
|
+
let rows: ListIndexRow[];
|
|
286
289
|
try {
|
|
287
|
-
rows = await store.
|
|
290
|
+
rows = await store.queryResources(agentExecutionListIndex, {
|
|
291
|
+
anyKey: [{ name: "session", value: sessionId }],
|
|
292
|
+
});
|
|
288
293
|
} catch (error) {
|
|
289
294
|
throw internalError(error, "failed to list agent executions");
|
|
290
295
|
}
|
|
291
296
|
|
|
292
297
|
const executions: AgentExecution[] = [];
|
|
293
|
-
for (const
|
|
294
|
-
let execution: AgentExecution;
|
|
298
|
+
for (const row of rows) {
|
|
295
299
|
try {
|
|
296
|
-
|
|
300
|
+
executions.push(fromBinary(AgentExecutionSchema, row.data));
|
|
297
301
|
} catch (error) {
|
|
298
302
|
logger.warn("Failed to unmarshal execution, skipping", {
|
|
299
303
|
error: error instanceof Error ? error.message : String(error),
|
|
300
304
|
});
|
|
301
|
-
continue;
|
|
302
|
-
}
|
|
303
|
-
if ((execution.spec?.sessionId ?? "") === sessionId) {
|
|
304
|
-
executions.push(execution);
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
307
|
return executions;
|
|
@@ -427,19 +427,19 @@ function requireSessionId<Desc extends DescMessage>(
|
|
|
427
427
|
}
|
|
428
428
|
|
|
429
429
|
// ---------------------------------------------------------------------------
|
|
430
|
-
// List steps — list.go and the steps/ package.
|
|
431
|
-
//
|
|
432
|
-
//
|
|
433
|
-
// (
|
|
430
|
+
// List steps — list.go and the steps/ package. Each lane reads its page
|
|
431
|
+
// through the list index (pipeline/steps/list-page.ts): the store narrows
|
|
432
|
+
// by the request's organization or parent key and orders newest first
|
|
433
|
+
// (spec-audit created_at, unstamped last, ties by id); the read scope, when
|
|
434
|
+
// composed, narrows each batch to the caller's authorized sessions last —
|
|
434
435
|
// the Java list handlers' FGA-ids pattern, guest cookie rule included
|
|
435
|
-
// driver-side
|
|
436
|
-
// session
|
|
436
|
+
// driver-side. No scope composed = the OSS single-user posture, every
|
|
437
|
+
// matching session.
|
|
437
438
|
// ---------------------------------------------------------------------------
|
|
438
439
|
|
|
439
440
|
/**
|
|
440
|
-
* ListAllSessions —
|
|
441
|
-
*
|
|
442
|
-
* Malformed rows warn and are skipped.
|
|
441
|
+
* ListAllSessions — one page of sessions, the request's organization when
|
|
442
|
+
* it names one, newest first. Malformed rows warn and are skipped.
|
|
443
443
|
*/
|
|
444
444
|
export function newListAllSessionsStep(
|
|
445
445
|
store: Store,
|
|
@@ -451,34 +451,30 @@ export function newListAllSessionsStep(
|
|
|
451
451
|
async execute(
|
|
452
452
|
ctx: RequestContext<typeof SessionQueryController.method.list.input>,
|
|
453
453
|
): Promise<void> {
|
|
454
|
-
const
|
|
454
|
+
const input = ctx.input;
|
|
455
|
+
const page = await readSessionPage(
|
|
456
|
+
store,
|
|
457
|
+
logger,
|
|
455
458
|
listReadScope,
|
|
456
459
|
ctx.callerIdentity,
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
),
|
|
467
|
-
);
|
|
468
|
-
|
|
469
|
-
logger.info("Loaded sessions from database", { count: sessions.length });
|
|
470
|
-
|
|
471
|
-
ctx.set(
|
|
472
|
-
LIST_RESULT_KEY,
|
|
473
|
-
create(SessionListSchema, { entries: sessions }),
|
|
460
|
+
ctx.input,
|
|
461
|
+
{
|
|
462
|
+
query: { org: input.org },
|
|
463
|
+
fingerprint: {
|
|
464
|
+
lane: "session.list",
|
|
465
|
+
org: input.org,
|
|
466
|
+
tags: input.tags,
|
|
467
|
+
},
|
|
468
|
+
},
|
|
474
469
|
);
|
|
470
|
+
ctx.set(LIST_RESULT_KEY, page);
|
|
475
471
|
},
|
|
476
472
|
};
|
|
477
473
|
}
|
|
478
474
|
|
|
479
475
|
/**
|
|
480
|
-
* FilterByAgentInstance — steps/filter_by_agent_instance.go:
|
|
481
|
-
* whose spec.agent_instance_id matches
|
|
476
|
+
* FilterByAgentInstance — steps/filter_by_agent_instance.go: one page of
|
|
477
|
+
* the sessions whose spec.agent_instance_id matches, newest first.
|
|
482
478
|
*/
|
|
483
479
|
export function newFilterByAgentInstanceStep(
|
|
484
480
|
store: Store,
|
|
@@ -499,34 +495,22 @@ export function newFilterByAgentInstanceStep(
|
|
|
499
495
|
throw invalidArgumentError("agent_instance_id is required");
|
|
500
496
|
}
|
|
501
497
|
|
|
502
|
-
// The instance's sessions
|
|
503
|
-
// composed driver is asked about one instance's rows
|
|
504
|
-
const
|
|
498
|
+
// The instance's sessions through its key, the scope last (census
|
|
499
|
+
// lane 2): a composed driver is asked about one instance's rows.
|
|
500
|
+
const page = await readSessionPage(
|
|
505
501
|
store,
|
|
506
502
|
logger,
|
|
507
|
-
ctx.apiResourceKind,
|
|
508
|
-
);
|
|
509
|
-
const filtered = await restrictListByReadScope(
|
|
510
503
|
listReadScope,
|
|
511
504
|
ctx.callerIdentity,
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
logger.info("Filtered sessions by agent instance", {
|
|
521
|
-
agentInstanceId,
|
|
522
|
-
totalSessions: sessions.length,
|
|
523
|
-
filteredSessions: filtered.length,
|
|
524
|
-
});
|
|
525
|
-
|
|
526
|
-
ctx.set(
|
|
527
|
-
LIST_RESULT_KEY,
|
|
528
|
-
create(SessionListSchema, { entries: filtered }),
|
|
505
|
+
ctx.input,
|
|
506
|
+
{
|
|
507
|
+
query: {
|
|
508
|
+
anyKey: [{ name: "agent_instance", value: agentInstanceId }],
|
|
509
|
+
},
|
|
510
|
+
fingerprint: { lane: "session.listByAgentInstance", agentInstanceId },
|
|
511
|
+
},
|
|
529
512
|
);
|
|
513
|
+
ctx.set(LIST_RESULT_KEY, page);
|
|
530
514
|
},
|
|
531
515
|
};
|
|
532
516
|
}
|
|
@@ -563,9 +547,9 @@ export function newAuthorizeChannelAccessStep(
|
|
|
563
547
|
}
|
|
564
548
|
|
|
565
549
|
/**
|
|
566
|
-
* FilterByChannel — steps/filter_by_channel.go: sessions
|
|
567
|
-
* metadata.labels carry the channel's stigmer.ai/channel-id stamp
|
|
568
|
-
*
|
|
550
|
+
* FilterByChannel — steps/filter_by_channel.go: one page of the sessions
|
|
551
|
+
* whose metadata.labels carry the channel's stigmer.ai/channel-id stamp,
|
|
552
|
+
* newest first. Channel sessions are created by the cloud channel runtime
|
|
569
553
|
* (Slack/WhatsApp inbound turns), which stamps the label at create time;
|
|
570
554
|
* the OSS runtime has no channel broker, so this filter typically matches
|
|
571
555
|
* nothing — the RPC exists for contract parity with Stigmer Cloud (which
|
|
@@ -589,63 +573,64 @@ export function newFilterByChannelStep(
|
|
|
589
573
|
throw invalidArgumentError("channel_id is required");
|
|
590
574
|
}
|
|
591
575
|
|
|
592
|
-
// The channel's sessions
|
|
593
|
-
const
|
|
576
|
+
// The channel's sessions through its key, the scope last (census lane 3).
|
|
577
|
+
const page = await readSessionPage(
|
|
594
578
|
store,
|
|
595
579
|
logger,
|
|
596
|
-
ctx.apiResourceKind,
|
|
597
|
-
);
|
|
598
|
-
const filtered = await restrictListByReadScope(
|
|
599
580
|
listReadScope,
|
|
600
581
|
ctx.callerIdentity,
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
),
|
|
607
|
-
"",
|
|
608
|
-
);
|
|
609
|
-
|
|
610
|
-
logger.info("Filtered sessions by channel", {
|
|
611
|
-
channelId,
|
|
612
|
-
totalSessions: sessions.length,
|
|
613
|
-
filteredSessions: filtered.length,
|
|
614
|
-
});
|
|
615
|
-
|
|
616
|
-
ctx.set(
|
|
617
|
-
LIST_RESULT_KEY,
|
|
618
|
-
create(SessionListSchema, { entries: filtered }),
|
|
582
|
+
ctx.input,
|
|
583
|
+
{
|
|
584
|
+
query: { anyKey: [{ name: "channel", value: channelId }] },
|
|
585
|
+
fingerprint: { lane: "session.listByChannel", channelId },
|
|
586
|
+
},
|
|
619
587
|
);
|
|
588
|
+
ctx.set(LIST_RESULT_KEY, page);
|
|
620
589
|
},
|
|
621
590
|
};
|
|
622
591
|
}
|
|
623
592
|
|
|
624
|
-
/**
|
|
625
|
-
async function
|
|
593
|
+
/** The three session lanes' shared read: one page, the scope last, as a SessionList. */
|
|
594
|
+
async function readSessionPage(
|
|
626
595
|
store: Store,
|
|
627
596
|
logger: Logger,
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
})
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
597
|
+
listReadScope: ListReadScope | undefined,
|
|
598
|
+
caller: CallerIdentity,
|
|
599
|
+
request: ListPageRequest,
|
|
600
|
+
lane: {
|
|
601
|
+
readonly query: ListIndexQuery<"agent_instance" | "channel">;
|
|
602
|
+
readonly fingerprint: Readonly<Record<string, unknown>>;
|
|
603
|
+
},
|
|
604
|
+
): Promise<SessionList> {
|
|
605
|
+
const page = await readListPage({
|
|
606
|
+
store,
|
|
607
|
+
declaration: sessionListIndex,
|
|
608
|
+
query: lane.query,
|
|
609
|
+
request,
|
|
610
|
+
fingerprint: listPageFingerprint(lane.fingerprint),
|
|
611
|
+
decode: (data) => {
|
|
612
|
+
try {
|
|
613
|
+
return fromBinary(SessionSchema, data);
|
|
614
|
+
} catch (error) {
|
|
615
|
+
logger.warn("Failed to unmarshal session, skipping", {
|
|
616
|
+
error: error instanceof Error ? error.message : String(error),
|
|
617
|
+
});
|
|
618
|
+
return undefined;
|
|
619
|
+
}
|
|
620
|
+
},
|
|
621
|
+
scope: (sessions) =>
|
|
622
|
+
restrictListByReadScope(
|
|
623
|
+
listReadScope,
|
|
624
|
+
caller,
|
|
625
|
+
ApiResourceKind.session,
|
|
626
|
+
sessions,
|
|
627
|
+
"",
|
|
628
|
+
),
|
|
629
|
+
failure: "failed to list sessions",
|
|
630
|
+
});
|
|
631
|
+
return create(SessionListSchema, {
|
|
632
|
+
entries: page.entries,
|
|
633
|
+
nextPageToken: page.nextPageToken,
|
|
634
|
+
totalPages: page.nextPageToken === "" ? 1 : 0,
|
|
635
|
+
});
|
|
651
636
|
}
|