@aigne/aos 0.2.0-beta
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/CHANGELOG.md +49 -0
- package/LICENSE.md +26 -0
- package/dist/agent-dsl.cjs +116 -0
- package/dist/agent-dsl.d.cts +31 -0
- package/dist/agent-dsl.d.cts.map +1 -0
- package/dist/agent-dsl.d.mts +31 -0
- package/dist/agent-dsl.d.mts.map +1 -0
- package/dist/agent-dsl.mjs +115 -0
- package/dist/agent-dsl.mjs.map +1 -0
- package/dist/arc-compat.cjs +125 -0
- package/dist/arc-compat.d.cts +17 -0
- package/dist/arc-compat.d.cts.map +1 -0
- package/dist/arc-compat.d.mts +17 -0
- package/dist/arc-compat.d.mts.map +1 -0
- package/dist/arc-compat.mjs +123 -0
- package/dist/arc-compat.mjs.map +1 -0
- package/dist/auto-surface/compiler.cjs +36 -0
- package/dist/auto-surface/compiler.d.cts +7 -0
- package/dist/auto-surface/compiler.d.cts.map +1 -0
- package/dist/auto-surface/compiler.d.mts +7 -0
- package/dist/auto-surface/compiler.d.mts.map +1 -0
- package/dist/auto-surface/compiler.mjs +37 -0
- package/dist/auto-surface/compiler.mjs.map +1 -0
- package/dist/auto-surface/definition-dsl.cjs +333 -0
- package/dist/auto-surface/definition-dsl.d.cts +41 -0
- package/dist/auto-surface/definition-dsl.d.cts.map +1 -0
- package/dist/auto-surface/definition-dsl.d.mts +41 -0
- package/dist/auto-surface/definition-dsl.d.mts.map +1 -0
- package/dist/auto-surface/definition-dsl.mjs +332 -0
- package/dist/auto-surface/definition-dsl.mjs.map +1 -0
- package/dist/auto-surface/fragments.cjs +177 -0
- package/dist/auto-surface/fragments.d.cts +23 -0
- package/dist/auto-surface/fragments.d.cts.map +1 -0
- package/dist/auto-surface/fragments.d.mts +23 -0
- package/dist/auto-surface/fragments.d.mts.map +1 -0
- package/dist/auto-surface/fragments.mjs +175 -0
- package/dist/auto-surface/fragments.mjs.map +1 -0
- package/dist/auto-surface/index.d.mts +9 -0
- package/dist/auto-surface/layering.cjs +43 -0
- package/dist/auto-surface/layering.d.cts +7 -0
- package/dist/auto-surface/layering.d.cts.map +1 -0
- package/dist/auto-surface/layering.d.mts +7 -0
- package/dist/auto-surface/layering.d.mts.map +1 -0
- package/dist/auto-surface/layering.mjs +43 -0
- package/dist/auto-surface/layering.mjs.map +1 -0
- package/dist/auto-surface/projection.cjs +11 -0
- package/dist/auto-surface/projection.d.cts +11 -0
- package/dist/auto-surface/projection.d.cts.map +1 -0
- package/dist/auto-surface/projection.d.mts +11 -0
- package/dist/auto-surface/projection.d.mts.map +1 -0
- package/dist/auto-surface/projection.mjs +12 -0
- package/dist/auto-surface/projection.mjs.map +1 -0
- package/dist/auto-surface/projectors/settings-shell.cjs +114 -0
- package/dist/auto-surface/projectors/settings-shell.d.cts +10 -0
- package/dist/auto-surface/projectors/settings-shell.d.cts.map +1 -0
- package/dist/auto-surface/projectors/settings-shell.d.mts +10 -0
- package/dist/auto-surface/projectors/settings-shell.d.mts.map +1 -0
- package/dist/auto-surface/projectors/settings-shell.mjs +114 -0
- package/dist/auto-surface/projectors/settings-shell.mjs.map +1 -0
- package/dist/auto-surface/scenario.cjs +38 -0
- package/dist/auto-surface/scenario.d.cts +31 -0
- package/dist/auto-surface/scenario.d.cts.map +1 -0
- package/dist/auto-surface/scenario.d.mts +31 -0
- package/dist/auto-surface/scenario.d.mts.map +1 -0
- package/dist/auto-surface/scenario.mjs +37 -0
- package/dist/auto-surface/scenario.mjs.map +1 -0
- package/dist/auto-surface/types.cjs +9 -0
- package/dist/auto-surface/types.d.cts +153 -0
- package/dist/auto-surface/types.d.cts.map +1 -0
- package/dist/auto-surface/types.d.mts +153 -0
- package/dist/auto-surface/types.d.mts.map +1 -0
- package/dist/auto-surface/types.mjs +9 -0
- package/dist/auto-surface/types.mjs.map +1 -0
- package/dist/auto-surface/value-dsl.cjs +80 -0
- package/dist/auto-surface/value-dsl.d.cts +24 -0
- package/dist/auto-surface/value-dsl.d.cts.map +1 -0
- package/dist/auto-surface/value-dsl.d.mts +24 -0
- package/dist/auto-surface/value-dsl.d.mts.map +1 -0
- package/dist/auto-surface/value-dsl.mjs +79 -0
- package/dist/auto-surface/value-dsl.mjs.map +1 -0
- package/dist/blocklet/activation.cjs +94 -0
- package/dist/blocklet/activation.d.cts +30 -0
- package/dist/blocklet/activation.d.cts.map +1 -0
- package/dist/blocklet/activation.d.mts +30 -0
- package/dist/blocklet/activation.d.mts.map +1 -0
- package/dist/blocklet/activation.mjs +94 -0
- package/dist/blocklet/activation.mjs.map +1 -0
- package/dist/blocklet/did-space-registry.cjs +282 -0
- package/dist/blocklet/did-space-registry.d.cts +82 -0
- package/dist/blocklet/did-space-registry.d.cts.map +1 -0
- package/dist/blocklet/did-space-registry.d.mts +82 -0
- package/dist/blocklet/did-space-registry.d.mts.map +1 -0
- package/dist/blocklet/did-space-registry.mjs +281 -0
- package/dist/blocklet/did-space-registry.mjs.map +1 -0
- package/dist/blocklet/handlers.cjs +66 -0
- package/dist/blocklet/handlers.d.cts +16 -0
- package/dist/blocklet/handlers.d.cts.map +1 -0
- package/dist/blocklet/handlers.d.mts +16 -0
- package/dist/blocklet/handlers.d.mts.map +1 -0
- package/dist/blocklet/handlers.mjs +65 -0
- package/dist/blocklet/handlers.mjs.map +1 -0
- package/dist/blocklet/index.d.mts +7 -0
- package/dist/blocklet/manifest.d.cts +2 -0
- package/dist/blocklet/manifest.d.mts +2 -0
- package/dist/blocklet/manifest.mjs +3 -0
- package/dist/blocklet/registry.cjs +447 -0
- package/dist/blocklet/registry.d.cts +197 -0
- package/dist/blocklet/registry.d.cts.map +1 -0
- package/dist/blocklet/registry.d.mts +197 -0
- package/dist/blocklet/registry.d.mts.map +1 -0
- package/dist/blocklet/registry.mjs +441 -0
- package/dist/blocklet/registry.mjs.map +1 -0
- package/dist/blocklet/static-render.cjs +183 -0
- package/dist/blocklet/static-render.d.cts +55 -0
- package/dist/blocklet/static-render.d.cts.map +1 -0
- package/dist/blocklet/static-render.d.mts +55 -0
- package/dist/blocklet/static-render.d.mts.map +1 -0
- package/dist/blocklet/static-render.mjs +181 -0
- package/dist/blocklet/static-render.mjs.map +1 -0
- package/dist/blocklet/types.d.cts +70 -0
- package/dist/blocklet/types.d.cts.map +1 -0
- package/dist/blocklet/types.d.mts +70 -0
- package/dist/blocklet/types.d.mts.map +1 -0
- package/dist/devices/chain.cjs +127 -0
- package/dist/devices/chain.d.cts +48 -0
- package/dist/devices/chain.d.cts.map +1 -0
- package/dist/devices/chain.d.mts +48 -0
- package/dist/devices/chain.d.mts.map +1 -0
- package/dist/devices/chain.mjs +125 -0
- package/dist/devices/chain.mjs.map +1 -0
- package/dist/dsl-shared.cjs +290 -0
- package/dist/dsl-shared.d.cts +54 -0
- package/dist/dsl-shared.d.cts.map +1 -0
- package/dist/dsl-shared.d.mts +54 -0
- package/dist/dsl-shared.d.mts.map +1 -0
- package/dist/dsl-shared.mjs +287 -0
- package/dist/dsl-shared.mjs.map +1 -0
- package/dist/http/afs-mcp.cjs +85 -0
- package/dist/http/afs-mcp.d.cts +14 -0
- package/dist/http/afs-mcp.d.cts.map +1 -0
- package/dist/http/afs-mcp.d.mts +14 -0
- package/dist/http/afs-mcp.d.mts.map +1 -0
- package/dist/http/afs-mcp.mjs +86 -0
- package/dist/http/afs-mcp.mjs.map +1 -0
- package/dist/http/afs-raw.cjs +264 -0
- package/dist/http/afs-raw.d.cts +31 -0
- package/dist/http/afs-raw.d.cts.map +1 -0
- package/dist/http/afs-raw.d.mts +31 -0
- package/dist/http/afs-raw.d.mts.map +1 -0
- package/dist/http/afs-raw.mjs +264 -0
- package/dist/http/afs-raw.mjs.map +1 -0
- package/dist/http/afs-rest.cjs +30 -0
- package/dist/http/afs-rest.d.cts +21 -0
- package/dist/http/afs-rest.d.cts.map +1 -0
- package/dist/http/afs-rest.d.mts +21 -0
- package/dist/http/afs-rest.d.mts.map +1 -0
- package/dist/http/afs-rest.mjs +31 -0
- package/dist/http/afs-rest.mjs.map +1 -0
- package/dist/http/afs-rpc-wire.cjs +271 -0
- package/dist/http/afs-rpc-wire.d.cts +195 -0
- package/dist/http/afs-rpc-wire.d.cts.map +1 -0
- package/dist/http/afs-rpc-wire.d.mts +195 -0
- package/dist/http/afs-rpc-wire.d.mts.map +1 -0
- package/dist/http/afs-rpc-wire.mjs +262 -0
- package/dist/http/afs-rpc-wire.mjs.map +1 -0
- package/dist/http/afs-rpc.cjs +729 -0
- package/dist/http/afs-rpc.d.cts +103 -0
- package/dist/http/afs-rpc.d.cts.map +1 -0
- package/dist/http/afs-rpc.d.mts +103 -0
- package/dist/http/afs-rpc.d.mts.map +1 -0
- package/dist/http/afs-rpc.mjs +729 -0
- package/dist/http/afs-rpc.mjs.map +1 -0
- package/dist/http/afs-upload.cjs +116 -0
- package/dist/http/afs-upload.d.cts +40 -0
- package/dist/http/afs-upload.d.cts.map +1 -0
- package/dist/http/afs-upload.d.mts +40 -0
- package/dist/http/afs-upload.d.mts.map +1 -0
- package/dist/http/afs-upload.mjs +116 -0
- package/dist/http/afs-upload.mjs.map +1 -0
- package/dist/http/aup-client.cjs +60 -0
- package/dist/http/aup-client.d.cts +22 -0
- package/dist/http/aup-client.d.cts.map +1 -0
- package/dist/http/aup-client.d.mts +22 -0
- package/dist/http/aup-client.d.mts.map +1 -0
- package/dist/http/aup-client.mjs +59 -0
- package/dist/http/aup-client.mjs.map +1 -0
- package/dist/http/aup-event.cjs +100 -0
- package/dist/http/aup-event.d.cts +38 -0
- package/dist/http/aup-event.d.cts.map +1 -0
- package/dist/http/aup-event.d.mts +38 -0
- package/dist/http/aup-event.d.mts.map +1 -0
- package/dist/http/aup-event.mjs +101 -0
- package/dist/http/aup-event.mjs.map +1 -0
- package/dist/http/auth-context.cjs +66 -0
- package/dist/http/auth-context.d.cts +64 -0
- package/dist/http/auth-context.d.cts.map +1 -0
- package/dist/http/auth-context.d.mts +64 -0
- package/dist/http/auth-context.d.mts.map +1 -0
- package/dist/http/auth-context.mjs +66 -0
- package/dist/http/auth-context.mjs.map +1 -0
- package/dist/http/csrf.cjs +50 -0
- package/dist/http/csrf.d.cts +8 -0
- package/dist/http/csrf.d.cts.map +1 -0
- package/dist/http/csrf.d.mts +8 -0
- package/dist/http/csrf.d.mts.map +1 -0
- package/dist/http/csrf.mjs +49 -0
- package/dist/http/csrf.mjs.map +1 -0
- package/dist/http/handlers.cjs +106 -0
- package/dist/http/handlers.d.cts +39 -0
- package/dist/http/handlers.d.cts.map +1 -0
- package/dist/http/handlers.d.mts +39 -0
- package/dist/http/handlers.d.mts.map +1 -0
- package/dist/http/handlers.mjs +104 -0
- package/dist/http/handlers.mjs.map +1 -0
- package/dist/http/index.d.mts +1 -0
- package/dist/http/ingest-facade.cjs +315 -0
- package/dist/http/ingest-facade.mjs +314 -0
- package/dist/http/ingest-facade.mjs.map +1 -0
- package/dist/http/raw-url.cjs +136 -0
- package/dist/http/raw-url.d.cts +54 -0
- package/dist/http/raw-url.d.cts.map +1 -0
- package/dist/http/raw-url.d.mts +54 -0
- package/dist/http/raw-url.d.mts.map +1 -0
- package/dist/http/raw-url.mjs +136 -0
- package/dist/http/raw-url.mjs.map +1 -0
- package/dist/http/request-context.cjs +178 -0
- package/dist/http/request-context.d.cts +76 -0
- package/dist/http/request-context.d.cts.map +1 -0
- package/dist/http/request-context.d.mts +76 -0
- package/dist/http/request-context.d.mts.map +1 -0
- package/dist/http/request-context.mjs +179 -0
- package/dist/http/request-context.mjs.map +1 -0
- package/dist/index.cjs +197 -0
- package/dist/index.d.cts +63 -0
- package/dist/index.d.mts +68 -0
- package/dist/index.mjs +61 -0
- package/dist/mcp/index.cjs +9 -0
- package/dist/mcp/index.d.cts +5 -0
- package/dist/mcp/index.d.mts +5 -0
- package/dist/mcp/index.mjs +6 -0
- package/dist/mcp/prompts.cjs +17 -0
- package/dist/mcp/prompts.d.cts +8 -0
- package/dist/mcp/prompts.d.cts.map +1 -0
- package/dist/mcp/prompts.d.mts +8 -0
- package/dist/mcp/prompts.d.mts.map +1 -0
- package/dist/mcp/prompts.mjs +17 -0
- package/dist/mcp/prompts.mjs.map +1 -0
- package/dist/mcp/resources.cjs +22 -0
- package/dist/mcp/resources.d.cts +8 -0
- package/dist/mcp/resources.d.cts.map +1 -0
- package/dist/mcp/resources.d.mts +8 -0
- package/dist/mcp/resources.d.mts.map +1 -0
- package/dist/mcp/resources.mjs +22 -0
- package/dist/mcp/resources.mjs.map +1 -0
- package/dist/mcp/server.cjs +51 -0
- package/dist/mcp/server.d.cts +20 -0
- package/dist/mcp/server.d.cts.map +1 -0
- package/dist/mcp/server.d.mts +20 -0
- package/dist/mcp/server.d.mts.map +1 -0
- package/dist/mcp/server.mjs +52 -0
- package/dist/mcp/server.mjs.map +1 -0
- package/dist/mcp/tools.cjs +218 -0
- package/dist/mcp/tools.d.cts +8 -0
- package/dist/mcp/tools.d.cts.map +1 -0
- package/dist/mcp/tools.d.mts +8 -0
- package/dist/mcp/tools.d.mts.map +1 -0
- package/dist/mcp/tools.mjs +219 -0
- package/dist/mcp/tools.mjs.map +1 -0
- package/dist/mcp/utils.cjs +75 -0
- package/dist/mcp/utils.mjs +69 -0
- package/dist/mcp/utils.mjs.map +1 -0
- package/dist/mount/index.cjs +4 -0
- package/dist/mount/index.d.cts +3 -0
- package/dist/mount/index.d.mts +3 -0
- package/dist/mount/index.mjs +3 -0
- package/dist/mount/materializer.cjs +167 -0
- package/dist/mount/materializer.d.cts +97 -0
- package/dist/mount/materializer.d.cts.map +1 -0
- package/dist/mount/materializer.d.mts +97 -0
- package/dist/mount/materializer.d.mts.map +1 -0
- package/dist/mount/materializer.mjs +167 -0
- package/dist/mount/materializer.mjs.map +1 -0
- package/dist/mount/types.d.cts +90 -0
- package/dist/mount/types.d.cts.map +1 -0
- package/dist/mount/types.d.mts +90 -0
- package/dist/mount/types.d.mts.map +1 -0
- package/dist/mount-config.cjs +61 -0
- package/dist/mount-config.d.cts +19 -0
- package/dist/mount-config.d.cts.map +1 -0
- package/dist/mount-config.d.mts +19 -0
- package/dist/mount-config.d.mts.map +1 -0
- package/dist/mount-config.mjs +61 -0
- package/dist/mount-config.mjs.map +1 -0
- package/dist/projectors/aup-projector.cjs +190 -0
- package/dist/projectors/aup-projector.d.cts +59 -0
- package/dist/projectors/aup-projector.d.cts.map +1 -0
- package/dist/projectors/aup-projector.d.mts +59 -0
- package/dist/projectors/aup-projector.d.mts.map +1 -0
- package/dist/projectors/aup-projector.mjs +188 -0
- package/dist/projectors/aup-projector.mjs.map +1 -0
- package/dist/projectors/index.cjs +6 -0
- package/dist/projectors/index.d.cts +2 -0
- package/dist/projectors/index.d.mts +2 -0
- package/dist/projectors/index.mjs +3 -0
- package/dist/scaffold/afs.cjs +195 -0
- package/dist/scaffold/afs.d.cts +16 -0
- package/dist/scaffold/afs.d.cts.map +1 -0
- package/dist/scaffold/afs.d.mts +16 -0
- package/dist/scaffold/afs.d.mts.map +1 -0
- package/dist/scaffold/afs.mjs +195 -0
- package/dist/scaffold/afs.mjs.map +1 -0
- package/dist/scaffold/composition.cjs +92 -0
- package/dist/scaffold/composition.d.cts +10 -0
- package/dist/scaffold/composition.d.cts.map +1 -0
- package/dist/scaffold/composition.d.mts +10 -0
- package/dist/scaffold/composition.d.mts.map +1 -0
- package/dist/scaffold/composition.mjs +92 -0
- package/dist/scaffold/composition.mjs.map +1 -0
- package/dist/scaffold/dsl-error.cjs +21 -0
- package/dist/scaffold/dsl-error.d.cts +11 -0
- package/dist/scaffold/dsl-error.d.cts.map +1 -0
- package/dist/scaffold/dsl-error.d.mts +11 -0
- package/dist/scaffold/dsl-error.d.mts.map +1 -0
- package/dist/scaffold/dsl-error.mjs +20 -0
- package/dist/scaffold/dsl-error.mjs.map +1 -0
- package/dist/scaffold/index.d.mts +12 -0
- package/dist/scaffold/manifest-dsl.cjs +188 -0
- package/dist/scaffold/manifest-dsl.d.cts +8 -0
- package/dist/scaffold/manifest-dsl.d.cts.map +1 -0
- package/dist/scaffold/manifest-dsl.d.mts +8 -0
- package/dist/scaffold/manifest-dsl.d.mts.map +1 -0
- package/dist/scaffold/manifest-dsl.mjs +188 -0
- package/dist/scaffold/manifest-dsl.mjs.map +1 -0
- package/dist/scaffold/module-dsl.cjs +284 -0
- package/dist/scaffold/module-dsl.d.cts +8 -0
- package/dist/scaffold/module-dsl.d.cts.map +1 -0
- package/dist/scaffold/module-dsl.d.mts +8 -0
- package/dist/scaffold/module-dsl.d.mts.map +1 -0
- package/dist/scaffold/module-dsl.mjs +284 -0
- package/dist/scaffold/module-dsl.mjs.map +1 -0
- package/dist/scaffold/resolver.cjs +156 -0
- package/dist/scaffold/resolver.d.cts +7 -0
- package/dist/scaffold/resolver.d.cts.map +1 -0
- package/dist/scaffold/resolver.d.mts +7 -0
- package/dist/scaffold/resolver.d.mts.map +1 -0
- package/dist/scaffold/resolver.mjs +156 -0
- package/dist/scaffold/resolver.mjs.map +1 -0
- package/dist/scaffold/runtime.cjs +24 -0
- package/dist/scaffold/runtime.d.cts +19 -0
- package/dist/scaffold/runtime.d.cts.map +1 -0
- package/dist/scaffold/runtime.d.mts +19 -0
- package/dist/scaffold/runtime.d.mts.map +1 -0
- package/dist/scaffold/runtime.mjs +25 -0
- package/dist/scaffold/runtime.mjs.map +1 -0
- package/dist/scaffold/shell-dsl.cjs +279 -0
- package/dist/scaffold/shell-dsl.d.cts +8 -0
- package/dist/scaffold/shell-dsl.d.cts.map +1 -0
- package/dist/scaffold/shell-dsl.d.mts +8 -0
- package/dist/scaffold/shell-dsl.d.mts.map +1 -0
- package/dist/scaffold/shell-dsl.mjs +279 -0
- package/dist/scaffold/shell-dsl.mjs.map +1 -0
- package/dist/scaffold/surface-dsl.cjs +182 -0
- package/dist/scaffold/surface-dsl.d.cts +8 -0
- package/dist/scaffold/surface-dsl.d.cts.map +1 -0
- package/dist/scaffold/surface-dsl.d.mts +8 -0
- package/dist/scaffold/surface-dsl.d.mts.map +1 -0
- package/dist/scaffold/surface-dsl.mjs +182 -0
- package/dist/scaffold/surface-dsl.mjs.map +1 -0
- package/dist/scaffold/surfaces.cjs +84 -0
- package/dist/scaffold/surfaces.d.cts +23 -0
- package/dist/scaffold/surfaces.d.cts.map +1 -0
- package/dist/scaffold/surfaces.d.mts +24 -0
- package/dist/scaffold/surfaces.d.mts.map +1 -0
- package/dist/scaffold/surfaces.mjs +84 -0
- package/dist/scaffold/surfaces.mjs.map +1 -0
- package/dist/scaffold/types.d.cts +264 -0
- package/dist/scaffold/types.d.cts.map +1 -0
- package/dist/scaffold/types.d.mts +265 -0
- package/dist/scaffold/types.d.mts.map +1 -0
- package/dist/scaffold/workspace-dsl.cjs +339 -0
- package/dist/scaffold/workspace-dsl.d.cts +49 -0
- package/dist/scaffold/workspace-dsl.d.cts.map +1 -0
- package/dist/scaffold/workspace-dsl.d.mts +49 -0
- package/dist/scaffold/workspace-dsl.d.mts.map +1 -0
- package/dist/scaffold/workspace-dsl.mjs +337 -0
- package/dist/scaffold/workspace-dsl.mjs.map +1 -0
- package/dist/scope/index.d.mts +3 -0
- package/dist/scope/read-blocklet-scope.cjs +29 -0
- package/dist/scope/read-blocklet-scope.d.cts +8 -0
- package/dist/scope/read-blocklet-scope.d.cts.map +1 -0
- package/dist/scope/read-blocklet-scope.d.mts +8 -0
- package/dist/scope/read-blocklet-scope.d.mts.map +1 -0
- package/dist/scope/read-blocklet-scope.mjs +30 -0
- package/dist/scope/read-blocklet-scope.mjs.map +1 -0
- package/dist/scope/resolve-scoped-afs.cjs +87 -0
- package/dist/scope/resolve-scoped-afs.d.cts +7 -0
- package/dist/scope/resolve-scoped-afs.d.cts.map +1 -0
- package/dist/scope/resolve-scoped-afs.d.mts +7 -0
- package/dist/scope/resolve-scoped-afs.d.mts.map +1 -0
- package/dist/scope/resolve-scoped-afs.mjs +88 -0
- package/dist/scope/resolve-scoped-afs.mjs.map +1 -0
- package/dist/scope/types.d.cts +25 -0
- package/dist/scope/types.d.cts.map +1 -0
- package/dist/scope/types.d.mts +25 -0
- package/dist/scope/types.d.mts.map +1 -0
- package/dist/session/backends.cjs +90 -0
- package/dist/session/backends.d.cts +35 -0
- package/dist/session/backends.d.cts.map +1 -0
- package/dist/session/backends.d.mts +35 -0
- package/dist/session/backends.d.mts.map +1 -0
- package/dist/session/backends.mjs +89 -0
- package/dist/session/backends.mjs.map +1 -0
- package/dist/session/replication-resolver.cjs +323 -0
- package/dist/session/replication-resolver.d.cts +71 -0
- package/dist/session/replication-resolver.d.cts.map +1 -0
- package/dist/session/replication-resolver.d.mts +71 -0
- package/dist/session/replication-resolver.d.mts.map +1 -0
- package/dist/session/replication-resolver.mjs +323 -0
- package/dist/session/replication-resolver.mjs.map +1 -0
- package/dist/session/role-level.cjs +36 -0
- package/dist/session/role-level.d.cts +24 -0
- package/dist/session/role-level.d.cts.map +1 -0
- package/dist/session/role-level.d.mts +24 -0
- package/dist/session/role-level.d.mts.map +1 -0
- package/dist/session/role-level.mjs +35 -0
- package/dist/session/role-level.mjs.map +1 -0
- package/dist/session/session-dir-providers.cjs +254 -0
- package/dist/session/session-dir-providers.d.cts +32 -0
- package/dist/session/session-dir-providers.d.cts.map +1 -0
- package/dist/session/session-dir-providers.d.mts +32 -0
- package/dist/session/session-dir-providers.d.mts.map +1 -0
- package/dist/session/session-dir-providers.mjs +252 -0
- package/dist/session/session-dir-providers.mjs.map +1 -0
- package/dist/session/session-id.cjs +20 -0
- package/dist/session/session-id.d.cts +15 -0
- package/dist/session/session-id.d.cts.map +1 -0
- package/dist/session/session-id.d.mts +15 -0
- package/dist/session/session-id.d.mts.map +1 -0
- package/dist/session/session-id.mjs +20 -0
- package/dist/session/session-id.mjs.map +1 -0
- package/dist/session/session-user-afs.cjs +899 -0
- package/dist/session/session-user-afs.d.cts +296 -0
- package/dist/session/session-user-afs.d.cts.map +1 -0
- package/dist/session/session-user-afs.d.mts +296 -0
- package/dist/session/session-user-afs.d.mts.map +1 -0
- package/dist/session/session-user-afs.mjs +896 -0
- package/dist/session/session-user-afs.mjs.map +1 -0
- package/dist/session/settings-cascade.cjs +69 -0
- package/dist/session/settings-cascade.d.cts +81 -0
- package/dist/session/settings-cascade.d.cts.map +1 -0
- package/dist/session/settings-cascade.d.mts +81 -0
- package/dist/session/settings-cascade.d.mts.map +1 -0
- package/dist/session/settings-cascade.mjs +69 -0
- package/dist/session/settings-cascade.mjs.map +1 -0
- package/dist/session/settings-resolver.cjs +770 -0
- package/dist/session/settings-resolver.d.cts +177 -0
- package/dist/session/settings-resolver.d.cts.map +1 -0
- package/dist/session/settings-resolver.d.mts +177 -0
- package/dist/session/settings-resolver.d.mts.map +1 -0
- package/dist/session/settings-resolver.mjs +771 -0
- package/dist/session/settings-resolver.mjs.map +1 -0
- package/dist/session/settings-schema-store.cjs +0 -0
- package/dist/session/settings-schema-store.d.cts +72 -0
- package/dist/session/settings-schema-store.d.cts.map +1 -0
- package/dist/session/settings-schema-store.d.mts +72 -0
- package/dist/session/settings-schema-store.d.mts.map +1 -0
- package/dist/session/settings-schema-store.mjs +0 -0
- package/dist/session/settings-schema-store.mjs.map +1 -0
- package/dist/system-mounts/index.cjs +14 -0
- package/dist/system-mounts/index.d.cts +6 -0
- package/dist/system-mounts/index.d.mts +6 -0
- package/dist/system-mounts/index.mjs +6 -0
- package/dist/system-mounts/install.cjs +101 -0
- package/dist/system-mounts/install.d.cts +36 -0
- package/dist/system-mounts/install.d.cts.map +1 -0
- package/dist/system-mounts/install.d.mts +37 -0
- package/dist/system-mounts/install.d.mts.map +1 -0
- package/dist/system-mounts/install.mjs +102 -0
- package/dist/system-mounts/install.mjs.map +1 -0
- package/dist/system-mounts/installers.cjs +247 -0
- package/dist/system-mounts/installers.d.cts +13 -0
- package/dist/system-mounts/installers.d.cts.map +1 -0
- package/dist/system-mounts/installers.d.mts +14 -0
- package/dist/system-mounts/installers.d.mts.map +1 -0
- package/dist/system-mounts/installers.mjs +244 -0
- package/dist/system-mounts/installers.mjs.map +1 -0
- package/dist/system-mounts/lists.cjs +122 -0
- package/dist/system-mounts/lists.d.cts +34 -0
- package/dist/system-mounts/lists.d.cts.map +1 -0
- package/dist/system-mounts/lists.d.mts +34 -0
- package/dist/system-mounts/lists.d.mts.map +1 -0
- package/dist/system-mounts/lists.mjs +122 -0
- package/dist/system-mounts/lists.mjs.map +1 -0
- package/dist/system-mounts/types.d.cts +124 -0
- package/dist/system-mounts/types.d.cts.map +1 -0
- package/dist/system-mounts/types.d.mts +125 -0
- package/dist/system-mounts/types.d.mts.map +1 -0
- package/dist/system-mounts/validate.cjs +56 -0
- package/dist/system-mounts/validate.d.cts +34 -0
- package/dist/system-mounts/validate.d.cts.map +1 -0
- package/dist/system-mounts/validate.d.mts +34 -0
- package/dist/system-mounts/validate.d.mts.map +1 -0
- package/dist/system-mounts/validate.mjs +56 -0
- package/dist/system-mounts/validate.mjs.map +1 -0
- package/dist/terminal-llm.cjs +90 -0
- package/dist/terminal-llm.d.cts +50 -0
- package/dist/terminal-llm.d.cts.map +1 -0
- package/dist/terminal-llm.d.mts +50 -0
- package/dist/terminal-llm.d.mts.map +1 -0
- package/dist/terminal-llm.mjs +90 -0
- package/dist/terminal-llm.mjs.map +1 -0
- package/dist/terminal-repl.cjs +371 -0
- package/dist/terminal-repl.d.cts +69 -0
- package/dist/terminal-repl.d.cts.map +1 -0
- package/dist/terminal-repl.d.mts +69 -0
- package/dist/terminal-repl.d.mts.map +1 -0
- package/dist/terminal-repl.mjs +370 -0
- package/dist/terminal-repl.mjs.map +1 -0
- package/dist/transport/idle-timer.cjs +136 -0
- package/dist/transport/idle-timer.d.cts +92 -0
- package/dist/transport/idle-timer.d.cts.map +1 -0
- package/dist/transport/idle-timer.d.mts +92 -0
- package/dist/transport/idle-timer.d.mts.map +1 -0
- package/dist/transport/idle-timer.mjs +132 -0
- package/dist/transport/idle-timer.mjs.map +1 -0
- package/dist/web-component-dsl.cjs +153 -0
- package/dist/web-component-dsl.d.cts +27 -0
- package/dist/web-component-dsl.d.cts.map +1 -0
- package/dist/web-component-dsl.d.mts +27 -0
- package/dist/web-component-dsl.d.mts.map +1 -0
- package/dist/web-component-dsl.mjs +152 -0
- package/dist/web-component-dsl.mjs.map +1 -0
- package/package.json +81 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
let _aigne_afs = require("@aigne/afs");
|
|
2
|
+
|
|
3
|
+
//#region src/session/session-dir-providers.ts
|
|
4
|
+
/**
|
|
5
|
+
* Session dir sub-providers — factory functions that compose the per-session
|
|
6
|
+
* directory schema documented in S.3:
|
|
7
|
+
*
|
|
8
|
+
* instance/sessions/<id>/meta.json readonly (daemon-driven)
|
|
9
|
+
* instance/sessions/<id>/messages/ append-only (NNNNNN.json)
|
|
10
|
+
* instance/sessions/<id>/state.json atomic readwrite
|
|
11
|
+
* instance/sessions/<id>/blocklet-state/ free readwrite KV
|
|
12
|
+
* instance/sessions/<id>/tmp/ session scratch
|
|
13
|
+
*
|
|
14
|
+
* Each factory returns a small in-memory AFSModule. Persistence (if/when
|
|
15
|
+
* added) is an implementation detail swap — the surface stays identical.
|
|
16
|
+
*/
|
|
17
|
+
const MESSAGE_FILENAME_RE = /^\d{6}\.json$/;
|
|
18
|
+
const norm = (p) => p.startsWith("/") ? p : `/${p}`;
|
|
19
|
+
/**
|
|
20
|
+
* Readonly single-file provider exposing daemon-authored session metadata as
|
|
21
|
+
* `/` (the mount root). Writes rejected at every op. Content updates happen
|
|
22
|
+
* out-of-band via BlockletManager.updateSessionMeta (unmount → rebuild →
|
|
23
|
+
* remount) so there's no backdoor writer path.
|
|
24
|
+
*/
|
|
25
|
+
function createSessionMetaProvider(name, meta) {
|
|
26
|
+
const content = JSON.stringify(meta, null, 2);
|
|
27
|
+
const assertRoot = (p) => {
|
|
28
|
+
if (norm(p) !== "/") throw new _aigne_afs.AFSNotFoundError(p);
|
|
29
|
+
};
|
|
30
|
+
return {
|
|
31
|
+
name,
|
|
32
|
+
accessMode: "readonly",
|
|
33
|
+
async stat(path) {
|
|
34
|
+
assertRoot(path);
|
|
35
|
+
return { data: {
|
|
36
|
+
path: "/",
|
|
37
|
+
type: "file",
|
|
38
|
+
size: content.length,
|
|
39
|
+
mimeType: "application/json"
|
|
40
|
+
} };
|
|
41
|
+
},
|
|
42
|
+
async list(path) {
|
|
43
|
+
assertRoot(path);
|
|
44
|
+
return { data: [] };
|
|
45
|
+
},
|
|
46
|
+
async read(path) {
|
|
47
|
+
assertRoot(path);
|
|
48
|
+
return { data: {
|
|
49
|
+
path: "/",
|
|
50
|
+
content,
|
|
51
|
+
mimeType: "application/json"
|
|
52
|
+
} };
|
|
53
|
+
},
|
|
54
|
+
async write() {
|
|
55
|
+
throw new _aigne_afs.AFSAccessModeError("readonly", "write");
|
|
56
|
+
},
|
|
57
|
+
async delete() {
|
|
58
|
+
throw new _aigne_afs.AFSAccessModeError("readonly", "delete");
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Append-only messages provider. Filenames must match `/^\d{6}\.json$/`,
|
|
64
|
+
* writes to existing keys are rejected, and path segments containing `..`
|
|
65
|
+
* are rejected (path-traversal guard; AFS should reject these upstream, but
|
|
66
|
+
* this provider fails closed regardless).
|
|
67
|
+
*/
|
|
68
|
+
function createSessionMessagesProvider(name) {
|
|
69
|
+
const files = /* @__PURE__ */ new Map();
|
|
70
|
+
const assertSafeKey = (path) => {
|
|
71
|
+
const p = norm(path);
|
|
72
|
+
if (p === "/") return p;
|
|
73
|
+
const rel = p.slice(1);
|
|
74
|
+
if (rel.includes("..") || rel.includes("/")) throw new _aigne_afs.AFSPathError(`Invalid messages path: ${path}`, path);
|
|
75
|
+
if (!MESSAGE_FILENAME_RE.test(rel)) throw new _aigne_afs.AFSPathError(`messages filename must match /^\\d{6}\\.json$/ (got ${JSON.stringify(rel)})`, path);
|
|
76
|
+
return p;
|
|
77
|
+
};
|
|
78
|
+
return {
|
|
79
|
+
name,
|
|
80
|
+
accessMode: "readwrite",
|
|
81
|
+
async stat(path) {
|
|
82
|
+
if (norm(path) === "/") return { data: {
|
|
83
|
+
path: "/",
|
|
84
|
+
type: "directory",
|
|
85
|
+
childrenCount: files.size
|
|
86
|
+
} };
|
|
87
|
+
const key = assertSafeKey(path);
|
|
88
|
+
const content = files.get(key);
|
|
89
|
+
if (content === void 0) throw new _aigne_afs.AFSNotFoundError(path);
|
|
90
|
+
return { data: {
|
|
91
|
+
path: key,
|
|
92
|
+
type: "file",
|
|
93
|
+
size: content.length
|
|
94
|
+
} };
|
|
95
|
+
},
|
|
96
|
+
async list(path) {
|
|
97
|
+
if (norm(path) !== "/") throw new _aigne_afs.AFSNotFoundError(path);
|
|
98
|
+
return { data: [...files.keys()].sort().map((key) => ({
|
|
99
|
+
path: key,
|
|
100
|
+
type: "file",
|
|
101
|
+
size: files.get(key)?.length ?? 0
|
|
102
|
+
})) };
|
|
103
|
+
},
|
|
104
|
+
async read(path) {
|
|
105
|
+
const key = assertSafeKey(path);
|
|
106
|
+
const content = files.get(key);
|
|
107
|
+
if (content === void 0) throw new _aigne_afs.AFSNotFoundError(path);
|
|
108
|
+
return { data: {
|
|
109
|
+
path: key,
|
|
110
|
+
content,
|
|
111
|
+
mimeType: "application/json"
|
|
112
|
+
} };
|
|
113
|
+
},
|
|
114
|
+
async write(path, payload) {
|
|
115
|
+
const key = assertSafeKey(path);
|
|
116
|
+
if (files.has(key)) throw new _aigne_afs.AFSAccessModeError("append-only", "overwrite");
|
|
117
|
+
const content = typeof payload?.content === "string" ? payload.content : payload?.content ? new TextDecoder("utf-8", { fatal: false }).decode(payload.content) : "";
|
|
118
|
+
files.set(key, content);
|
|
119
|
+
return { data: {
|
|
120
|
+
path: key,
|
|
121
|
+
bytesWritten: content.length
|
|
122
|
+
} };
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Single-file readwrite provider for `state.json`. Overwrites are allowed
|
|
128
|
+
* (semantics: atomic snapshot replace). Reads before first write throw
|
|
129
|
+
* AFSNotFoundError so daemons can distinguish "never written" from "empty".
|
|
130
|
+
*/
|
|
131
|
+
function createSessionStateProvider(name) {
|
|
132
|
+
let content;
|
|
133
|
+
const assertRoot = (p) => {
|
|
134
|
+
if (norm(p) !== "/") throw new _aigne_afs.AFSNotFoundError(p);
|
|
135
|
+
};
|
|
136
|
+
return {
|
|
137
|
+
name,
|
|
138
|
+
accessMode: "readwrite",
|
|
139
|
+
async stat(path) {
|
|
140
|
+
assertRoot(path);
|
|
141
|
+
if (content === void 0) throw new _aigne_afs.AFSNotFoundError(path);
|
|
142
|
+
return { data: {
|
|
143
|
+
path: "/",
|
|
144
|
+
type: "file",
|
|
145
|
+
size: content.length,
|
|
146
|
+
mimeType: "application/json"
|
|
147
|
+
} };
|
|
148
|
+
},
|
|
149
|
+
async list(path) {
|
|
150
|
+
assertRoot(path);
|
|
151
|
+
return { data: [] };
|
|
152
|
+
},
|
|
153
|
+
async read(path) {
|
|
154
|
+
assertRoot(path);
|
|
155
|
+
if (content === void 0) throw new _aigne_afs.AFSNotFoundError(path);
|
|
156
|
+
return { data: {
|
|
157
|
+
path: "/",
|
|
158
|
+
content,
|
|
159
|
+
mimeType: "application/json"
|
|
160
|
+
} };
|
|
161
|
+
},
|
|
162
|
+
async write(path, payload) {
|
|
163
|
+
assertRoot(path);
|
|
164
|
+
const next = typeof payload?.content === "string" ? payload.content : payload?.content ? new TextDecoder("utf-8", { fatal: false }).decode(payload.content) : "";
|
|
165
|
+
content = next;
|
|
166
|
+
return { data: {
|
|
167
|
+
path: "/",
|
|
168
|
+
bytesWritten: next.length
|
|
169
|
+
} };
|
|
170
|
+
},
|
|
171
|
+
async delete(path) {
|
|
172
|
+
assertRoot(path);
|
|
173
|
+
const existed = content !== void 0;
|
|
174
|
+
content = void 0;
|
|
175
|
+
return { data: {
|
|
176
|
+
path: "/",
|
|
177
|
+
deleted: existed
|
|
178
|
+
} };
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Free readwrite KV for blocklet-authored state. Flat namespace (no nested
|
|
184
|
+
* directories). Keys must not contain `..` or `/` so there's no traversal
|
|
185
|
+
* surface even if an upstream guard is misconfigured.
|
|
186
|
+
*/
|
|
187
|
+
function createBlockletStateProvider(name) {
|
|
188
|
+
const files = /* @__PURE__ */ new Map();
|
|
189
|
+
const assertSafeKey = (path) => {
|
|
190
|
+
const p = norm(path);
|
|
191
|
+
if (p === "/") return p;
|
|
192
|
+
const rel = p.slice(1);
|
|
193
|
+
if (rel.length === 0 || rel.includes("..") || rel.includes("/")) throw new _aigne_afs.AFSPathError(`Invalid blocklet-state path: ${path}`, path);
|
|
194
|
+
return p;
|
|
195
|
+
};
|
|
196
|
+
return {
|
|
197
|
+
name,
|
|
198
|
+
accessMode: "readwrite",
|
|
199
|
+
async stat(path) {
|
|
200
|
+
if (norm(path) === "/") return { data: {
|
|
201
|
+
path: "/",
|
|
202
|
+
type: "directory",
|
|
203
|
+
childrenCount: files.size
|
|
204
|
+
} };
|
|
205
|
+
const key = assertSafeKey(path);
|
|
206
|
+
const content = files.get(key);
|
|
207
|
+
if (content === void 0) throw new _aigne_afs.AFSNotFoundError(path);
|
|
208
|
+
return { data: {
|
|
209
|
+
path: key,
|
|
210
|
+
type: "file",
|
|
211
|
+
size: content.length
|
|
212
|
+
} };
|
|
213
|
+
},
|
|
214
|
+
async list(path) {
|
|
215
|
+
if (norm(path) !== "/") throw new _aigne_afs.AFSNotFoundError(path);
|
|
216
|
+
return { data: [...files.keys()].sort().map((key) => ({
|
|
217
|
+
path: key,
|
|
218
|
+
type: "file",
|
|
219
|
+
size: files.get(key)?.length ?? 0
|
|
220
|
+
})) };
|
|
221
|
+
},
|
|
222
|
+
async read(path) {
|
|
223
|
+
const key = assertSafeKey(path);
|
|
224
|
+
const content = files.get(key);
|
|
225
|
+
if (content === void 0) throw new _aigne_afs.AFSNotFoundError(path);
|
|
226
|
+
return { data: {
|
|
227
|
+
path: key,
|
|
228
|
+
content
|
|
229
|
+
} };
|
|
230
|
+
},
|
|
231
|
+
async write(path, payload) {
|
|
232
|
+
const key = assertSafeKey(path);
|
|
233
|
+
const next = typeof payload?.content === "string" ? payload.content : payload?.content ? new TextDecoder("utf-8", { fatal: false }).decode(payload.content) : "";
|
|
234
|
+
files.set(key, next);
|
|
235
|
+
return { data: {
|
|
236
|
+
path: key,
|
|
237
|
+
bytesWritten: next.length
|
|
238
|
+
} };
|
|
239
|
+
},
|
|
240
|
+
async delete(path) {
|
|
241
|
+
const key = assertSafeKey(path);
|
|
242
|
+
return { data: {
|
|
243
|
+
path: key,
|
|
244
|
+
deleted: files.delete(key)
|
|
245
|
+
} };
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
//#endregion
|
|
251
|
+
exports.createBlockletStateProvider = createBlockletStateProvider;
|
|
252
|
+
exports.createSessionMessagesProvider = createSessionMessagesProvider;
|
|
253
|
+
exports.createSessionMetaProvider = createSessionMetaProvider;
|
|
254
|
+
exports.createSessionStateProvider = createSessionStateProvider;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AFSModule } from "@aigne/afs";
|
|
2
|
+
|
|
3
|
+
//#region src/session/session-dir-providers.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Readonly single-file provider exposing daemon-authored session metadata as
|
|
6
|
+
* `/` (the mount root). Writes rejected at every op. Content updates happen
|
|
7
|
+
* out-of-band via BlockletManager.updateSessionMeta (unmount → rebuild →
|
|
8
|
+
* remount) so there's no backdoor writer path.
|
|
9
|
+
*/
|
|
10
|
+
declare function createSessionMetaProvider(name: string, meta: Record<string, unknown>): AFSModule;
|
|
11
|
+
/**
|
|
12
|
+
* Append-only messages provider. Filenames must match `/^\d{6}\.json$/`,
|
|
13
|
+
* writes to existing keys are rejected, and path segments containing `..`
|
|
14
|
+
* are rejected (path-traversal guard; AFS should reject these upstream, but
|
|
15
|
+
* this provider fails closed regardless).
|
|
16
|
+
*/
|
|
17
|
+
declare function createSessionMessagesProvider(name: string): AFSModule;
|
|
18
|
+
/**
|
|
19
|
+
* Single-file readwrite provider for `state.json`. Overwrites are allowed
|
|
20
|
+
* (semantics: atomic snapshot replace). Reads before first write throw
|
|
21
|
+
* AFSNotFoundError so daemons can distinguish "never written" from "empty".
|
|
22
|
+
*/
|
|
23
|
+
declare function createSessionStateProvider(name: string): AFSModule;
|
|
24
|
+
/**
|
|
25
|
+
* Free readwrite KV for blocklet-authored state. Flat namespace (no nested
|
|
26
|
+
* directories). Keys must not contain `..` or `/` so there's no traversal
|
|
27
|
+
* surface even if an upstream guard is misconfigured.
|
|
28
|
+
*/
|
|
29
|
+
declare function createBlockletStateProvider(name: string): AFSModule;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { createBlockletStateProvider, createSessionMessagesProvider, createSessionMetaProvider, createSessionStateProvider };
|
|
32
|
+
//# sourceMappingURL=session-dir-providers.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-dir-providers.d.cts","names":[],"sources":["../../src/session/session-dir-providers.ts"],"mappings":";;;;;;;AAsIA;;iBA5GgB,yBAAA,CAA0B,IAAA,UAAc,IAAA,EAAM,MAAA,oBAA0B,SAAA;;;AAkKxF;;;;iBAxHgB,6BAAA,CAA8B,IAAA,WAAe,SAAA;;;;;;iBAkE7C,0BAAA,CAA2B,IAAA,WAAe,SAAA;;;;;;iBAsD1C,2BAAA,CAA4B,IAAA,WAAe,SAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AFSModule } from "@aigne/afs";
|
|
2
|
+
|
|
3
|
+
//#region src/session/session-dir-providers.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Readonly single-file provider exposing daemon-authored session metadata as
|
|
6
|
+
* `/` (the mount root). Writes rejected at every op. Content updates happen
|
|
7
|
+
* out-of-band via BlockletManager.updateSessionMeta (unmount → rebuild →
|
|
8
|
+
* remount) so there's no backdoor writer path.
|
|
9
|
+
*/
|
|
10
|
+
declare function createSessionMetaProvider(name: string, meta: Record<string, unknown>): AFSModule;
|
|
11
|
+
/**
|
|
12
|
+
* Append-only messages provider. Filenames must match `/^\d{6}\.json$/`,
|
|
13
|
+
* writes to existing keys are rejected, and path segments containing `..`
|
|
14
|
+
* are rejected (path-traversal guard; AFS should reject these upstream, but
|
|
15
|
+
* this provider fails closed regardless).
|
|
16
|
+
*/
|
|
17
|
+
declare function createSessionMessagesProvider(name: string): AFSModule;
|
|
18
|
+
/**
|
|
19
|
+
* Single-file readwrite provider for `state.json`. Overwrites are allowed
|
|
20
|
+
* (semantics: atomic snapshot replace). Reads before first write throw
|
|
21
|
+
* AFSNotFoundError so daemons can distinguish "never written" from "empty".
|
|
22
|
+
*/
|
|
23
|
+
declare function createSessionStateProvider(name: string): AFSModule;
|
|
24
|
+
/**
|
|
25
|
+
* Free readwrite KV for blocklet-authored state. Flat namespace (no nested
|
|
26
|
+
* directories). Keys must not contain `..` or `/` so there's no traversal
|
|
27
|
+
* surface even if an upstream guard is misconfigured.
|
|
28
|
+
*/
|
|
29
|
+
declare function createBlockletStateProvider(name: string): AFSModule;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { createBlockletStateProvider, createSessionMessagesProvider, createSessionMetaProvider, createSessionStateProvider };
|
|
32
|
+
//# sourceMappingURL=session-dir-providers.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-dir-providers.d.mts","names":[],"sources":["../../src/session/session-dir-providers.ts"],"mappings":";;;;;;;AAsIA;;iBA5GgB,yBAAA,CAA0B,IAAA,UAAc,IAAA,EAAM,MAAA,oBAA0B,SAAA;;;AAkKxF;;;;iBAxHgB,6BAAA,CAA8B,IAAA,WAAe,SAAA;;;;;;iBAkE7C,0BAAA,CAA2B,IAAA,WAAe,SAAA;;;;;;iBAsD1C,2BAAA,CAA4B,IAAA,WAAe,SAAA"}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { AFSAccessModeError, AFSNotFoundError, AFSPathError } from "@aigne/afs";
|
|
2
|
+
|
|
3
|
+
//#region src/session/session-dir-providers.ts
|
|
4
|
+
/**
|
|
5
|
+
* Session dir sub-providers — factory functions that compose the per-session
|
|
6
|
+
* directory schema documented in S.3:
|
|
7
|
+
*
|
|
8
|
+
* instance/sessions/<id>/meta.json readonly (daemon-driven)
|
|
9
|
+
* instance/sessions/<id>/messages/ append-only (NNNNNN.json)
|
|
10
|
+
* instance/sessions/<id>/state.json atomic readwrite
|
|
11
|
+
* instance/sessions/<id>/blocklet-state/ free readwrite KV
|
|
12
|
+
* instance/sessions/<id>/tmp/ session scratch
|
|
13
|
+
*
|
|
14
|
+
* Each factory returns a small in-memory AFSModule. Persistence (if/when
|
|
15
|
+
* added) is an implementation detail swap — the surface stays identical.
|
|
16
|
+
*/
|
|
17
|
+
const MESSAGE_FILENAME_RE = /^\d{6}\.json$/;
|
|
18
|
+
const norm = (p) => p.startsWith("/") ? p : `/${p}`;
|
|
19
|
+
/**
|
|
20
|
+
* Readonly single-file provider exposing daemon-authored session metadata as
|
|
21
|
+
* `/` (the mount root). Writes rejected at every op. Content updates happen
|
|
22
|
+
* out-of-band via BlockletManager.updateSessionMeta (unmount → rebuild →
|
|
23
|
+
* remount) so there's no backdoor writer path.
|
|
24
|
+
*/
|
|
25
|
+
function createSessionMetaProvider(name, meta) {
|
|
26
|
+
const content = JSON.stringify(meta, null, 2);
|
|
27
|
+
const assertRoot = (p) => {
|
|
28
|
+
if (norm(p) !== "/") throw new AFSNotFoundError(p);
|
|
29
|
+
};
|
|
30
|
+
return {
|
|
31
|
+
name,
|
|
32
|
+
accessMode: "readonly",
|
|
33
|
+
async stat(path) {
|
|
34
|
+
assertRoot(path);
|
|
35
|
+
return { data: {
|
|
36
|
+
path: "/",
|
|
37
|
+
type: "file",
|
|
38
|
+
size: content.length,
|
|
39
|
+
mimeType: "application/json"
|
|
40
|
+
} };
|
|
41
|
+
},
|
|
42
|
+
async list(path) {
|
|
43
|
+
assertRoot(path);
|
|
44
|
+
return { data: [] };
|
|
45
|
+
},
|
|
46
|
+
async read(path) {
|
|
47
|
+
assertRoot(path);
|
|
48
|
+
return { data: {
|
|
49
|
+
path: "/",
|
|
50
|
+
content,
|
|
51
|
+
mimeType: "application/json"
|
|
52
|
+
} };
|
|
53
|
+
},
|
|
54
|
+
async write() {
|
|
55
|
+
throw new AFSAccessModeError("readonly", "write");
|
|
56
|
+
},
|
|
57
|
+
async delete() {
|
|
58
|
+
throw new AFSAccessModeError("readonly", "delete");
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Append-only messages provider. Filenames must match `/^\d{6}\.json$/`,
|
|
64
|
+
* writes to existing keys are rejected, and path segments containing `..`
|
|
65
|
+
* are rejected (path-traversal guard; AFS should reject these upstream, but
|
|
66
|
+
* this provider fails closed regardless).
|
|
67
|
+
*/
|
|
68
|
+
function createSessionMessagesProvider(name) {
|
|
69
|
+
const files = /* @__PURE__ */ new Map();
|
|
70
|
+
const assertSafeKey = (path) => {
|
|
71
|
+
const p = norm(path);
|
|
72
|
+
if (p === "/") return p;
|
|
73
|
+
const rel = p.slice(1);
|
|
74
|
+
if (rel.includes("..") || rel.includes("/")) throw new AFSPathError(`Invalid messages path: ${path}`, path);
|
|
75
|
+
if (!MESSAGE_FILENAME_RE.test(rel)) throw new AFSPathError(`messages filename must match /^\\d{6}\\.json$/ (got ${JSON.stringify(rel)})`, path);
|
|
76
|
+
return p;
|
|
77
|
+
};
|
|
78
|
+
return {
|
|
79
|
+
name,
|
|
80
|
+
accessMode: "readwrite",
|
|
81
|
+
async stat(path) {
|
|
82
|
+
if (norm(path) === "/") return { data: {
|
|
83
|
+
path: "/",
|
|
84
|
+
type: "directory",
|
|
85
|
+
childrenCount: files.size
|
|
86
|
+
} };
|
|
87
|
+
const key = assertSafeKey(path);
|
|
88
|
+
const content = files.get(key);
|
|
89
|
+
if (content === void 0) throw new AFSNotFoundError(path);
|
|
90
|
+
return { data: {
|
|
91
|
+
path: key,
|
|
92
|
+
type: "file",
|
|
93
|
+
size: content.length
|
|
94
|
+
} };
|
|
95
|
+
},
|
|
96
|
+
async list(path) {
|
|
97
|
+
if (norm(path) !== "/") throw new AFSNotFoundError(path);
|
|
98
|
+
return { data: [...files.keys()].sort().map((key) => ({
|
|
99
|
+
path: key,
|
|
100
|
+
type: "file",
|
|
101
|
+
size: files.get(key)?.length ?? 0
|
|
102
|
+
})) };
|
|
103
|
+
},
|
|
104
|
+
async read(path) {
|
|
105
|
+
const key = assertSafeKey(path);
|
|
106
|
+
const content = files.get(key);
|
|
107
|
+
if (content === void 0) throw new AFSNotFoundError(path);
|
|
108
|
+
return { data: {
|
|
109
|
+
path: key,
|
|
110
|
+
content,
|
|
111
|
+
mimeType: "application/json"
|
|
112
|
+
} };
|
|
113
|
+
},
|
|
114
|
+
async write(path, payload) {
|
|
115
|
+
const key = assertSafeKey(path);
|
|
116
|
+
if (files.has(key)) throw new AFSAccessModeError("append-only", "overwrite");
|
|
117
|
+
const content = typeof payload?.content === "string" ? payload.content : payload?.content ? new TextDecoder("utf-8", { fatal: false }).decode(payload.content) : "";
|
|
118
|
+
files.set(key, content);
|
|
119
|
+
return { data: {
|
|
120
|
+
path: key,
|
|
121
|
+
bytesWritten: content.length
|
|
122
|
+
} };
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Single-file readwrite provider for `state.json`. Overwrites are allowed
|
|
128
|
+
* (semantics: atomic snapshot replace). Reads before first write throw
|
|
129
|
+
* AFSNotFoundError so daemons can distinguish "never written" from "empty".
|
|
130
|
+
*/
|
|
131
|
+
function createSessionStateProvider(name) {
|
|
132
|
+
let content;
|
|
133
|
+
const assertRoot = (p) => {
|
|
134
|
+
if (norm(p) !== "/") throw new AFSNotFoundError(p);
|
|
135
|
+
};
|
|
136
|
+
return {
|
|
137
|
+
name,
|
|
138
|
+
accessMode: "readwrite",
|
|
139
|
+
async stat(path) {
|
|
140
|
+
assertRoot(path);
|
|
141
|
+
if (content === void 0) throw new AFSNotFoundError(path);
|
|
142
|
+
return { data: {
|
|
143
|
+
path: "/",
|
|
144
|
+
type: "file",
|
|
145
|
+
size: content.length,
|
|
146
|
+
mimeType: "application/json"
|
|
147
|
+
} };
|
|
148
|
+
},
|
|
149
|
+
async list(path) {
|
|
150
|
+
assertRoot(path);
|
|
151
|
+
return { data: [] };
|
|
152
|
+
},
|
|
153
|
+
async read(path) {
|
|
154
|
+
assertRoot(path);
|
|
155
|
+
if (content === void 0) throw new AFSNotFoundError(path);
|
|
156
|
+
return { data: {
|
|
157
|
+
path: "/",
|
|
158
|
+
content,
|
|
159
|
+
mimeType: "application/json"
|
|
160
|
+
} };
|
|
161
|
+
},
|
|
162
|
+
async write(path, payload) {
|
|
163
|
+
assertRoot(path);
|
|
164
|
+
const next = typeof payload?.content === "string" ? payload.content : payload?.content ? new TextDecoder("utf-8", { fatal: false }).decode(payload.content) : "";
|
|
165
|
+
content = next;
|
|
166
|
+
return { data: {
|
|
167
|
+
path: "/",
|
|
168
|
+
bytesWritten: next.length
|
|
169
|
+
} };
|
|
170
|
+
},
|
|
171
|
+
async delete(path) {
|
|
172
|
+
assertRoot(path);
|
|
173
|
+
const existed = content !== void 0;
|
|
174
|
+
content = void 0;
|
|
175
|
+
return { data: {
|
|
176
|
+
path: "/",
|
|
177
|
+
deleted: existed
|
|
178
|
+
} };
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Free readwrite KV for blocklet-authored state. Flat namespace (no nested
|
|
184
|
+
* directories). Keys must not contain `..` or `/` so there's no traversal
|
|
185
|
+
* surface even if an upstream guard is misconfigured.
|
|
186
|
+
*/
|
|
187
|
+
function createBlockletStateProvider(name) {
|
|
188
|
+
const files = /* @__PURE__ */ new Map();
|
|
189
|
+
const assertSafeKey = (path) => {
|
|
190
|
+
const p = norm(path);
|
|
191
|
+
if (p === "/") return p;
|
|
192
|
+
const rel = p.slice(1);
|
|
193
|
+
if (rel.length === 0 || rel.includes("..") || rel.includes("/")) throw new AFSPathError(`Invalid blocklet-state path: ${path}`, path);
|
|
194
|
+
return p;
|
|
195
|
+
};
|
|
196
|
+
return {
|
|
197
|
+
name,
|
|
198
|
+
accessMode: "readwrite",
|
|
199
|
+
async stat(path) {
|
|
200
|
+
if (norm(path) === "/") return { data: {
|
|
201
|
+
path: "/",
|
|
202
|
+
type: "directory",
|
|
203
|
+
childrenCount: files.size
|
|
204
|
+
} };
|
|
205
|
+
const key = assertSafeKey(path);
|
|
206
|
+
const content = files.get(key);
|
|
207
|
+
if (content === void 0) throw new AFSNotFoundError(path);
|
|
208
|
+
return { data: {
|
|
209
|
+
path: key,
|
|
210
|
+
type: "file",
|
|
211
|
+
size: content.length
|
|
212
|
+
} };
|
|
213
|
+
},
|
|
214
|
+
async list(path) {
|
|
215
|
+
if (norm(path) !== "/") throw new AFSNotFoundError(path);
|
|
216
|
+
return { data: [...files.keys()].sort().map((key) => ({
|
|
217
|
+
path: key,
|
|
218
|
+
type: "file",
|
|
219
|
+
size: files.get(key)?.length ?? 0
|
|
220
|
+
})) };
|
|
221
|
+
},
|
|
222
|
+
async read(path) {
|
|
223
|
+
const key = assertSafeKey(path);
|
|
224
|
+
const content = files.get(key);
|
|
225
|
+
if (content === void 0) throw new AFSNotFoundError(path);
|
|
226
|
+
return { data: {
|
|
227
|
+
path: key,
|
|
228
|
+
content
|
|
229
|
+
} };
|
|
230
|
+
},
|
|
231
|
+
async write(path, payload) {
|
|
232
|
+
const key = assertSafeKey(path);
|
|
233
|
+
const next = typeof payload?.content === "string" ? payload.content : payload?.content ? new TextDecoder("utf-8", { fatal: false }).decode(payload.content) : "";
|
|
234
|
+
files.set(key, next);
|
|
235
|
+
return { data: {
|
|
236
|
+
path: key,
|
|
237
|
+
bytesWritten: next.length
|
|
238
|
+
} };
|
|
239
|
+
},
|
|
240
|
+
async delete(path) {
|
|
241
|
+
const key = assertSafeKey(path);
|
|
242
|
+
return { data: {
|
|
243
|
+
path: key,
|
|
244
|
+
deleted: files.delete(key)
|
|
245
|
+
} };
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
//#endregion
|
|
251
|
+
export { createBlockletStateProvider, createSessionMessagesProvider, createSessionMetaProvider, createSessionStateProvider };
|
|
252
|
+
//# sourceMappingURL=session-dir-providers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-dir-providers.mjs","names":[],"sources":["../../src/session/session-dir-providers.ts"],"sourcesContent":["/**\n * Session dir sub-providers — factory functions that compose the per-session\n * directory schema documented in S.3:\n *\n * instance/sessions/<id>/meta.json readonly (daemon-driven)\n * instance/sessions/<id>/messages/ append-only (NNNNNN.json)\n * instance/sessions/<id>/state.json atomic readwrite\n * instance/sessions/<id>/blocklet-state/ free readwrite KV\n * instance/sessions/<id>/tmp/ session scratch\n *\n * Each factory returns a small in-memory AFSModule. Persistence (if/when\n * added) is an implementation detail swap — the surface stays identical.\n */\n\nimport { AFSAccessModeError, type AFSModule, AFSNotFoundError, AFSPathError } from \"@aigne/afs\";\n\nconst MESSAGE_FILENAME_RE = /^\\d{6}\\.json$/;\n\nconst norm = (p: string) => (p.startsWith(\"/\") ? p : `/${p}`);\n\n/**\n * Readonly single-file provider exposing daemon-authored session metadata as\n * `/` (the mount root). Writes rejected at every op. Content updates happen\n * out-of-band via BlockletManager.updateSessionMeta (unmount → rebuild →\n * remount) so there's no backdoor writer path.\n */\nexport function createSessionMetaProvider(name: string, meta: Record<string, unknown>): AFSModule {\n const content = JSON.stringify(meta, null, 2);\n const assertRoot = (p: string) => {\n if (norm(p) !== \"/\") throw new AFSNotFoundError(p);\n };\n return {\n name,\n accessMode: \"readonly\",\n async stat(path: string) {\n assertRoot(path);\n return {\n data: {\n path: \"/\",\n type: \"file\" as const,\n size: content.length,\n mimeType: \"application/json\",\n },\n };\n },\n async list(path: string) {\n assertRoot(path);\n return { data: [] };\n },\n async read(path: string) {\n assertRoot(path);\n return { data: { path: \"/\", content, mimeType: \"application/json\" } };\n },\n async write() {\n throw new AFSAccessModeError(\"readonly\", \"write\");\n },\n async delete() {\n throw new AFSAccessModeError(\"readonly\", \"delete\");\n },\n } as unknown as AFSModule;\n}\n\n/**\n * Append-only messages provider. Filenames must match `/^\\d{6}\\.json$/`,\n * writes to existing keys are rejected, and path segments containing `..`\n * are rejected (path-traversal guard; AFS should reject these upstream, but\n * this provider fails closed regardless).\n */\nexport function createSessionMessagesProvider(name: string): AFSModule {\n const files = new Map<string, string>();\n const assertSafeKey = (path: string): string => {\n const p = norm(path);\n if (p === \"/\") return p;\n const rel = p.slice(1);\n if (rel.includes(\"..\") || rel.includes(\"/\")) {\n throw new AFSPathError(`Invalid messages path: ${path}`, path);\n }\n if (!MESSAGE_FILENAME_RE.test(rel)) {\n throw new AFSPathError(\n `messages filename must match /^\\\\d{6}\\\\.json$/ (got ${JSON.stringify(rel)})`,\n path,\n );\n }\n return p;\n };\n return {\n name,\n accessMode: \"readwrite\" as const,\n async stat(path: string) {\n const p = norm(path);\n if (p === \"/\") {\n return { data: { path: \"/\", type: \"directory\" as const, childrenCount: files.size } };\n }\n const key = assertSafeKey(path);\n const content = files.get(key);\n if (content === undefined) throw new AFSNotFoundError(path);\n return { data: { path: key, type: \"file\" as const, size: content.length } };\n },\n async list(path: string) {\n const p = norm(path);\n if (p !== \"/\") throw new AFSNotFoundError(path);\n const entries = [...files.keys()]\n .sort()\n .map((key) => ({ path: key, type: \"file\" as const, size: files.get(key)?.length ?? 0 }));\n return { data: entries };\n },\n async read(path: string) {\n const key = assertSafeKey(path);\n const content = files.get(key);\n if (content === undefined) throw new AFSNotFoundError(path);\n return { data: { path: key, content, mimeType: \"application/json\" } };\n },\n async write(path: string, payload: { content?: string | Uint8Array }) {\n const key = assertSafeKey(path);\n if (files.has(key)) {\n throw new AFSAccessModeError(\"append-only\", \"overwrite\");\n }\n const content =\n typeof payload?.content === \"string\"\n ? payload.content\n : payload?.content\n ? new TextDecoder(\"utf-8\", { fatal: false }).decode(payload.content)\n : \"\";\n files.set(key, content);\n return { data: { path: key, bytesWritten: content.length } };\n },\n } as unknown as AFSModule;\n}\n\n/**\n * Single-file readwrite provider for `state.json`. Overwrites are allowed\n * (semantics: atomic snapshot replace). Reads before first write throw\n * AFSNotFoundError so daemons can distinguish \"never written\" from \"empty\".\n */\nexport function createSessionStateProvider(name: string): AFSModule {\n let content: string | undefined;\n const assertRoot = (p: string) => {\n if (norm(p) !== \"/\") throw new AFSNotFoundError(p);\n };\n return {\n name,\n accessMode: \"readwrite\" as const,\n async stat(path: string) {\n assertRoot(path);\n if (content === undefined) throw new AFSNotFoundError(path);\n return {\n data: {\n path: \"/\",\n type: \"file\" as const,\n size: content.length,\n mimeType: \"application/json\",\n },\n };\n },\n async list(path: string) {\n assertRoot(path);\n return { data: [] };\n },\n async read(path: string) {\n assertRoot(path);\n if (content === undefined) throw new AFSNotFoundError(path);\n return { data: { path: \"/\", content, mimeType: \"application/json\" } };\n },\n async write(path: string, payload: { content?: string | Uint8Array }) {\n assertRoot(path);\n const next =\n typeof payload?.content === \"string\"\n ? payload.content\n : payload?.content\n ? new TextDecoder(\"utf-8\", { fatal: false }).decode(payload.content)\n : \"\";\n content = next;\n return { data: { path: \"/\", bytesWritten: next.length } };\n },\n async delete(path: string) {\n assertRoot(path);\n const existed = content !== undefined;\n content = undefined;\n return { data: { path: \"/\", deleted: existed } };\n },\n } as unknown as AFSModule;\n}\n\n/**\n * Free readwrite KV for blocklet-authored state. Flat namespace (no nested\n * directories). Keys must not contain `..` or `/` so there's no traversal\n * surface even if an upstream guard is misconfigured.\n */\nexport function createBlockletStateProvider(name: string): AFSModule {\n const files = new Map<string, string>();\n const assertSafeKey = (path: string): string => {\n const p = norm(path);\n if (p === \"/\") return p;\n const rel = p.slice(1);\n if (rel.length === 0 || rel.includes(\"..\") || rel.includes(\"/\")) {\n throw new AFSPathError(`Invalid blocklet-state path: ${path}`, path);\n }\n return p;\n };\n return {\n name,\n accessMode: \"readwrite\" as const,\n async stat(path: string) {\n const p = norm(path);\n if (p === \"/\") {\n return { data: { path: \"/\", type: \"directory\" as const, childrenCount: files.size } };\n }\n const key = assertSafeKey(path);\n const content = files.get(key);\n if (content === undefined) throw new AFSNotFoundError(path);\n return { data: { path: key, type: \"file\" as const, size: content.length } };\n },\n async list(path: string) {\n const p = norm(path);\n if (p !== \"/\") throw new AFSNotFoundError(path);\n return {\n data: [...files.keys()].sort().map((key) => ({\n path: key,\n type: \"file\" as const,\n size: files.get(key)?.length ?? 0,\n })),\n };\n },\n async read(path: string) {\n const key = assertSafeKey(path);\n const content = files.get(key);\n if (content === undefined) throw new AFSNotFoundError(path);\n return { data: { path: key, content } };\n },\n async write(path: string, payload: { content?: string | Uint8Array }) {\n const key = assertSafeKey(path);\n const next =\n typeof payload?.content === \"string\"\n ? payload.content\n : payload?.content\n ? new TextDecoder(\"utf-8\", { fatal: false }).decode(payload.content)\n : \"\";\n files.set(key, next);\n return { data: { path: key, bytesWritten: next.length } };\n },\n async delete(path: string) {\n const key = assertSafeKey(path);\n const existed = files.delete(key);\n return { data: { path: key, deleted: existed } };\n },\n } as unknown as AFSModule;\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/session/session-id.ts
|
|
3
|
+
/**
|
|
4
|
+
* Shared session-id validator. A session id keys both the per-session `/tmp`
|
|
5
|
+
* provider and the `${blockletName}<NUL>${sessionId}` caches, and is
|
|
6
|
+
* interpolated into physical sub-paths (`/sessions/<sid>/tmp`).
|
|
7
|
+
* Rejecting `..`, path separators, and the NUL cache-key separator keeps those
|
|
8
|
+
* uses safe. Every runtime (Node daemon, CF DO) and every consumer
|
|
9
|
+
* (BlockletManager, session-tmp backend) MUST share this one predicate so
|
|
10
|
+
* they can't drift — historically the afs-loader guard checked a space char
|
|
11
|
+
* while BlockletManager checked NUL, an inconsistency this consolidation ends.
|
|
12
|
+
*/
|
|
13
|
+
function isValidSessionId(id) {
|
|
14
|
+
if (typeof id !== "string" || id.length === 0) return false;
|
|
15
|
+
if (id.includes("..") || id.includes("/") || id.includes("\\")) return false;
|
|
16
|
+
return !id.includes("\0");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
exports.isValidSessionId = isValidSessionId;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/session/session-id.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Shared session-id validator. A session id keys both the per-session `/tmp`
|
|
4
|
+
* provider and the `${blockletName}<NUL>${sessionId}` caches, and is
|
|
5
|
+
* interpolated into physical sub-paths (`/sessions/<sid>/tmp`).
|
|
6
|
+
* Rejecting `..`, path separators, and the NUL cache-key separator keeps those
|
|
7
|
+
* uses safe. Every runtime (Node daemon, CF DO) and every consumer
|
|
8
|
+
* (BlockletManager, session-tmp backend) MUST share this one predicate so
|
|
9
|
+
* they can't drift — historically the afs-loader guard checked a space char
|
|
10
|
+
* while BlockletManager checked NUL, an inconsistency this consolidation ends.
|
|
11
|
+
*/
|
|
12
|
+
declare function isValidSessionId(id: unknown): id is string;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { isValidSessionId };
|
|
15
|
+
//# sourceMappingURL=session-id.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-id.d.cts","names":[],"sources":["../../src/session/session-id.ts"],"mappings":";;AAUA;;;;;;;;;iBAAgB,gBAAA,CAAiB,EAAA,YAAc,EAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/session/session-id.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Shared session-id validator. A session id keys both the per-session `/tmp`
|
|
4
|
+
* provider and the `${blockletName}<NUL>${sessionId}` caches, and is
|
|
5
|
+
* interpolated into physical sub-paths (`/sessions/<sid>/tmp`).
|
|
6
|
+
* Rejecting `..`, path separators, and the NUL cache-key separator keeps those
|
|
7
|
+
* uses safe. Every runtime (Node daemon, CF DO) and every consumer
|
|
8
|
+
* (BlockletManager, session-tmp backend) MUST share this one predicate so
|
|
9
|
+
* they can't drift — historically the afs-loader guard checked a space char
|
|
10
|
+
* while BlockletManager checked NUL, an inconsistency this consolidation ends.
|
|
11
|
+
*/
|
|
12
|
+
declare function isValidSessionId(id: unknown): id is string;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { isValidSessionId };
|
|
15
|
+
//# sourceMappingURL=session-id.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-id.d.mts","names":[],"sources":["../../src/session/session-id.ts"],"mappings":";;AAUA;;;;;;;;;iBAAgB,gBAAA,CAAiB,EAAA,YAAc,EAAA"}
|