@synopackageland/cli 0.4.1 → 0.5.3
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/README.md +7 -3
- package/dist/authorization-sdk.d.ts +5 -0
- package/dist/authorization-sdk.js +5 -0
- package/dist/build-spk/delete-app-data.d.ts +27 -7
- package/dist/build-spk/delete-app-data.js +35 -34
- package/dist/build-spk/dsm-arch.d.ts +6 -1
- package/dist/build-spk/dsm-arch.js +25 -1
- package/dist/build-spk/dsm-version.d.ts +14 -0
- package/dist/build-spk/dsm-version.js +47 -0
- package/dist/build-spk/gateway.d.ts +31 -0
- package/dist/build-spk/gateway.js +55 -0
- package/dist/build-spk/generator.d.ts +5 -0
- package/dist/build-spk/generator.js +103 -107
- package/dist/build-spk/install-wizard.d.ts +20 -0
- package/dist/build-spk/install-wizard.js +76 -0
- package/dist/build-spk/native-lifecycle.d.ts +5 -0
- package/dist/build-spk/native-lifecycle.js +12 -2
- package/dist/build-spk/resource-worker.d.ts +9 -4
- package/dist/build-spk/resource-worker.js +15 -6
- package/dist/build-spk/share-combobox.d.ts +3 -0
- package/dist/build-spk/share-combobox.js +27 -0
- package/dist/build-spk/uninstall-wizard.d.ts +14 -0
- package/dist/build-spk/uninstall-wizard.js +33 -0
- package/dist/build-spk/wizard-i18n.d.ts +18 -0
- package/dist/build-spk/wizard-i18n.js +38 -0
- package/dist/build-spk/wizard-messages.d.ts +388 -0
- package/dist/build-spk/wizard-messages.js +387 -0
- package/dist/cli.js +132 -32
- package/dist/compose/analyze.d.ts +20 -0
- package/dist/compose/analyze.js +75 -11
- package/dist/contract/validate.js +33 -1
- package/dist/contract/web-launch.d.ts +22 -0
- package/dist/contract/web-launch.js +37 -0
- package/dist/deploy/deploy.d.ts +3 -0
- package/dist/deploy/deploy.js +11 -2
- package/dist/error-registry.js +62 -3
- package/dist/host/dsm-port-profile.d.ts +1 -1
- package/dist/host/dsm-port-profile.js +1 -1
- package/dist/host/open-url.d.ts +2 -0
- package/dist/host/open-url.js +4 -1
- package/dist/images/pin.d.ts +52 -0
- package/dist/images/pin.js +249 -0
- package/dist/init.d.ts +27 -3
- package/dist/init.js +126 -16
- package/dist/inspect.d.ts +3 -0
- package/dist/inspect.js +15 -3
- package/dist/standalone/authorization-window.d.ts +2 -0
- package/dist/standalone/authorization-window.js +28 -0
- package/dist/standalone/authorization.d.ts +48 -0
- package/dist/standalone/authorization.js +116 -0
- package/dist/standalone/background.d.ts +21 -0
- package/dist/standalone/background.js +52 -0
- package/dist/standalone/binary.d.ts +1 -0
- package/dist/standalone/binary.js +1 -1
- package/dist/standalone/build.d.ts +2 -0
- package/dist/standalone/build.js +54 -10
- package/dist/standalone/dsm-window.js +10 -3
- package/dist/standalone/helper-inventory.d.ts +15 -0
- package/dist/standalone/helper-inventory.js +9 -0
- package/dist/standalone/helper.d.ts +1 -0
- package/dist/standalone/helper.js +29 -11
- package/dist/standalone/host-adapter.d.ts +1 -1
- package/dist/standalone/host-adapter.js +33 -15
- package/dist/standalone/host-file-navigation.d.ts +7 -0
- package/dist/standalone/host-file-navigation.js +172 -0
- package/dist/standalone/inspect-helper.js +21 -6
- package/dist/standalone/inspect-spk.d.ts +1 -1
- package/dist/standalone/inspect-spk.js +211 -7
- package/dist/standalone/job-diagnostics.d.ts +1 -0
- package/dist/standalone/job-diagnostics.js +49 -0
- package/dist/standalone/lifecycle-helper.d.ts +1 -1
- package/dist/standalone/lifecycle-helper.js +2 -2
- package/dist/standalone/lifecycle.d.ts +1 -1
- package/dist/standalone/lifecycle.js +14 -4
- package/dist/standalone/manifest.d.ts +15 -2
- package/dist/standalone/manifest.js +37 -6
- package/dist/standalone/native-layout.d.ts +74 -0
- package/dist/standalone/native-layout.js +318 -0
- package/dist/standalone/resource.d.ts +11 -0
- package/dist/standalone/resource.js +13 -0
- package/dist/standalone/root-ops.d.ts +2 -0
- package/dist/standalone/root-ops.js +10 -0
- package/dist/standalone/root-window.d.ts +3 -1
- package/dist/standalone/root-window.js +156 -38
- package/dist/standalone/shared-folder.d.ts +39 -0
- package/dist/standalone/shared-folder.js +141 -0
- package/dist/standalone/spk.d.ts +4 -0
- package/dist/standalone/spk.js +47 -3
- package/dist/standalone/worker-contract-json.d.ts +8 -0
- package/dist/standalone/worker-contract-json.js +141 -0
- package/dist/standalone/worker-contract.d.ts +189 -0
- package/dist/standalone/worker-contract.js +175 -0
- package/dist/standalone/worker-registry.d.ts +40 -0
- package/dist/standalone/worker-registry.js +167 -0
- package/dist/templates/_authorization/main.go +104 -0
- package/dist/templates/_authorization/main_test.go +35 -0
- package/dist/templates/_daemon/go.mod +2 -0
- package/dist/templates/_gateway/auth.go +101 -0
- package/dist/templates/_gateway/auth_test.go +216 -0
- package/dist/templates/_gateway/cgi.go +133 -0
- package/dist/templates/_gateway/cgi_test.go +156 -0
- package/dist/templates/_gateway/csrf.go +73 -0
- package/dist/templates/_gateway/csrf_test.go +155 -0
- package/dist/templates/_gateway/directory.go +108 -0
- package/dist/templates/_gateway/directory_test.go +202 -0
- package/dist/templates/_gateway/gateway.go +412 -0
- package/dist/templates/_gateway/gateway_test.go +676 -0
- package/dist/templates/_gateway/go.mod +3 -0
- package/dist/templates/_gateway/groups.go +66 -0
- package/dist/templates/_gateway/main.go +45 -0
- package/dist/templates/binary/synology-app.yaml +1 -1
- package/dist/templates/compose-import/compose.yaml +1 -1
- package/dist/templates/compose-import/synology-app.yaml +1 -1
- package/dist/templates/hello-files/compose.yaml +1 -1
- package/dist/templates/hello-files/synology-app.yaml +1 -1
- package/dist/templates/native-go/README.md +118 -5
- package/dist/templates/native-go/backend/THIRD_PARTY_NOTICES.txt +3 -1
- package/dist/templates/native-go/backend/cmd/app/main.go +25 -6
- package/dist/templates/native-go/backend/cmd/app/sdk_main.go +62 -0
- package/dist/templates/native-go/backend/cmd/background-worker/main.go +38 -0
- package/dist/templates/native-go/backend/cmd/helper/main.go +27 -1
- package/dist/templates/native-go/backend/cmd/helper/sdk_registry.go +19 -0
- package/dist/templates/native-go/backend/go.mod +5 -3
- package/dist/templates/native-go/backend/go.sum +4 -4
- package/dist/templates/native-go/backend/internal/api/registry.go +17 -6
- package/dist/templates/native-go/backend/internal/api/server.go +7 -1
- package/dist/templates/native-go/backend/internal/app/authorization_none.go +5 -0
- package/dist/templates/native-go/backend/internal/app/background.go +270 -0
- package/dist/templates/native-go/backend/internal/app/background_none.go +8 -0
- package/dist/templates/native-go/backend/internal/app/background_owner.go +59 -0
- package/dist/templates/native-go/backend/internal/app/background_owner_test.go +145 -0
- package/dist/templates/native-go/backend/internal/app/background_schedule.go +74 -0
- package/dist/templates/native-go/backend/internal/app/background_schedule_test.go +62 -0
- package/dist/templates/native-go/backend/internal/app/background_test.go +346 -0
- package/dist/templates/native-go/backend/internal/app/integration_state.go +16 -0
- package/dist/templates/native-go/backend/internal/app/migrations.go +41 -0
- package/dist/templates/native-go/backend/internal/app/migrations_test.go +41 -0
- package/dist/templates/native-go/backend/internal/app/nas_cgi_artifact_test.go +8 -0
- package/dist/templates/native-go/backend/internal/app/routes.go +22 -5
- package/dist/templates/native-go/backend/internal/app/routes_test.go +20 -3
- package/dist/templates/native-go/backend/internal/app/sdk_jobs.go +70 -0
- package/dist/templates/native-go/backend/internal/app/sdk_jobs_test.go +116 -0
- package/dist/templates/native-go/backend/internal/app/sdk_routes.go +177 -0
- package/dist/templates/native-go/backend/internal/app/session_files.go +15 -0
- package/dist/templates/native-go/backend/internal/app/session_files_test.go +26 -0
- package/dist/templates/native-go/backend/internal/app/shared_folder.go +144 -0
- package/dist/templates/native-go/backend/internal/app/shared_folder_test.go +158 -0
- package/dist/templates/native-go/backend/internal/background/access.go +57 -0
- package/dist/templates/native-go/backend/internal/background/owner_test.go +126 -0
- package/dist/templates/native-go/backend/internal/background/runner.go +185 -0
- package/dist/templates/native-go/backend/internal/background/runner_test.go +209 -0
- package/dist/templates/native-go/backend/internal/background/schedule.go +300 -0
- package/dist/templates/native-go/backend/internal/background/schedule_test.go +335 -0
- package/dist/templates/native-go/backend/internal/background/store.go +807 -0
- package/dist/templates/native-go/backend/internal/background/store_test.go +407 -0
- package/dist/templates/native-go/backend/internal/datamigrate/migrate.go +191 -0
- package/dist/templates/native-go/backend/internal/datamigrate/migrate_test.go +177 -0
- package/dist/templates/native-go/backend/internal/filestation/browse_test.go +67 -0
- package/dist/templates/native-go/backend/internal/filestation/client.go +251 -0
- package/dist/templates/native-go/backend/internal/filestation/client_test.go +155 -0
- package/dist/templates/native-go/backend/internal/filestation/doc.go +4 -0
- package/dist/templates/native-go/backend/internal/filestation/read_file_test.go +90 -0
- package/dist/templates/native-go/backend/internal/filestation/repository.go +207 -0
- package/dist/templates/native-go/backend/internal/filestation/repository_test.go +104 -0
- package/dist/templates/native-go/backend/internal/filestation/sdk_session.go +241 -0
- package/dist/templates/native-go/backend/internal/filestation/sdk_session_test.go +183 -0
- package/dist/templates/native-go/backend/internal/filestation/service.go +254 -0
- package/dist/templates/native-go/backend/internal/filestation/service_test.go +94 -0
- package/dist/templates/native-go/backend/internal/filestation/session_semantics_test.go +383 -0
- package/dist/templates/native-go/backend/internal/filestation/write.go +72 -0
- package/dist/templates/native-go/backend/internal/filestation/write_test.go +123 -0
- package/dist/templates/native-go/backend/internal/helper/background_proof.go +163 -0
- package/dist/templates/native-go/backend/internal/helper/background_proof_contract.go +46 -0
- package/dist/templates/native-go/backend/internal/helper/background_proof_test.go +161 -0
- package/dist/templates/native-go/backend/internal/helper/data_contract.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/data_protocol.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/data_protocol_test.go +1 -1
- package/dist/templates/native-go/backend/internal/helper/grant_authority.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/grant_authority_test.go +1 -1
- package/dist/templates/native-go/backend/internal/helper/grant_repository_linux.go +2 -1
- package/dist/templates/native-go/backend/internal/helper/grant_repository_linux_test.go +4 -3
- package/dist/templates/native-go/backend/internal/helper/grant_snapshot.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/bindings.go +48 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/contract_test.go +436 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/decode.go +185 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/digest.go +55 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/registry.go +85 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/registry_test.go +73 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/result.go +53 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/stub.go +8 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/testdata/input-digests.json +127 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/types.go +234 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/types_test.go +29 -0
- package/dist/templates/native-go/backend/internal/helper/jobcontract/validate.go +462 -0
- package/dist/templates/native-go/backend/internal/helper/legacy_authority_schema_linux_test.go +34 -0
- package/dist/templates/native-go/backend/internal/helper/legacy_authority_schema_test.go +6 -0
- package/dist/templates/native-go/backend/internal/helper/management.go +86 -0
- package/dist/templates/native-go/backend/internal/helper/observation.go +42 -2
- package/dist/templates/native-go/backend/internal/helper/observation_health_test.go +13 -1
- package/dist/templates/native-go/backend/internal/helper/observer_diagnostic.go +56 -10
- package/dist/templates/native-go/backend/internal/helper/observer_diagnostic_linux_test.go +6 -0
- package/dist/templates/native-go/backend/internal/helper/observer_diagnostic_writer.go +40 -0
- package/dist/templates/native-go/backend/internal/helper/process_linux.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/purge.go +115 -0
- package/dist/templates/native-go/backend/internal/helper/purge_test.go +59 -0
- package/dist/templates/native-go/backend/internal/helper/query_deadline_linux_test.go +115 -0
- package/dist/templates/native-go/backend/internal/helper/query_pending_diagnostic_test.go +254 -0
- package/dist/templates/native-go/backend/internal/helper/relaxed_invalidation.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/revoke.go +109 -0
- package/dist/templates/native-go/backend/internal/helper/revoke_test.go +121 -0
- package/dist/templates/native-go/backend/internal/helper/s1r_actor_races_linux_test.go +23 -4
- package/dist/templates/native-go/backend/internal/helper/sdk_assembly_linux.go +51 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_attach.go +83 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_attach_contract.go +32 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_attach_test.go +184 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_authority_schema_test.go +6 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_authority.go +832 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_authority_test.go +714 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_invalidation.go +218 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_lease.go +218 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_snapshot.go +110 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_store_linux_test.go +261 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_background_store_test.go +58 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_bindings.go +60 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_data_contract.go +251 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_data_protocol.go +424 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_dispatch_absence_test.go +51 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_display.go +488 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_display_contract.go +121 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_display_test.go +459 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_grant_authority.go +559 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_grant_repository_linux.go +417 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_grant_snapshot.go +94 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_history.go +80 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_history_test.go +76 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job.go +697 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job_child_linux.go +309 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job_contract.go +122 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job_linux_test.go +159 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job_process_linux.go +327 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job_test.go +501 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_job_vm_linux_test.go +343 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_journal.go +77 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_journal_linux.go +244 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_journal_linux_test.go +295 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_journal_test.go +71 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_picker_test.go +50 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_process_linux.go +184 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_public_vm_linux_test.go +129 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_relaxed_invalidation.go +242 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_rpc.go +299 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_rpc_contract.go +70 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_rpc_test.go +135 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_server_linux.go +161 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_session.go +677 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_session_contract.go +72 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_session_fence_test.go +215 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_session_test.go +475 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_supervisor_frame.go +78 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_supervisor_linux.go +414 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_transport.go +79 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_transport_linux.go +82 -0
- package/dist/templates/native-go/backend/internal/helper/sdk_transport_test.go +64 -0
- package/dist/templates/native-go/backend/internal/helper/server_linux.go +14 -2
- package/dist/templates/native-go/backend/internal/helper/stale_management_linux_test.go +126 -0
- package/dist/templates/native-go/backend/internal/helper/stale_management_test.go +122 -0
- package/dist/templates/native-go/backend/internal/helper/startup_diagnostic.go +68 -0
- package/dist/templates/native-go/backend/internal/helper/startup_diagnostic_linux_test.go +126 -0
- package/dist/templates/native-go/backend/internal/helper/startup_diagnostic_test.go +117 -0
- package/dist/templates/native-go/backend/internal/helper/status.go +22 -13
- package/dist/templates/native-go/backend/internal/helper/status_test.go +45 -0
- package/dist/templates/native-go/backend/internal/helper/supervision.go +1 -1
- package/dist/templates/native-go/backend/internal/helper/supervisor_frame.go +3 -0
- package/dist/templates/native-go/backend/internal/helper/supervisor_linux.go +6 -2
- package/dist/templates/native-go/backend/internal/helper/unit_connection_test.go +22 -4
- package/dist/templates/native-go/backend/internal/helper/unit_linux.go +7 -3
- package/dist/templates/native-go/backend/internal/helper/unit_query_linux.go +5 -1
- package/dist/templates/native-go/backend/internal/helper/write_files_linux.go +7 -4
- package/dist/templates/native-go/backend/internal/helper/write_files_linux_test.go +26 -0
- package/dist/templates/native-go/dsm-package.yaml +2 -2
- package/dist/templates/native-go-authorization/backend/internal/app/authorization.go +298 -0
- package/dist/templates/native-go-authorization/backend/internal/app/authorization_test.go +96 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/AuthorizationGate.vue +89 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/de.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/en.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/es.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/fr.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/index.ts +15 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/it.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/ja.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/ko.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/zh-CN.json +36 -0
- package/dist/templates/native-go-authorization/frontend/src/authorization/i18n/zh-TW.json +36 -0
- package/dist/templates/native-go-authorization/frontend/test/authorization-preview.html +14 -0
- package/dist/templates/native-go-authorization/frontend/test/authorization.test.ts +59 -0
- package/dist/templates/native-go-background/BACKGROUND.md +111 -0
- package/dist/templates/native-go-background/backend/internal/app/background_on.go +7 -0
- package/dist/templates/native-go-background/backend/internal/app/background_routes_test.go +32 -0
- package/dist/templates/native-go-background/frontend/src/background/BackgroundPanel.vue +178 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/de.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/en.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/es.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/fr.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/it.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/ja.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/ko.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/zh-CN.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n/zh-TW.json +83 -0
- package/dist/templates/native-go-background/frontend/src/background/i18n.ts +19 -0
- package/dist/templates/native-go-background/frontend/src/background/picker-provider.ts +13 -0
- package/dist/templates/native-go-background/frontend/test/background.test.ts +179 -0
- package/dist/templates/native-go-integration/backend/internal/app/personal.go +2 -2
- package/dist/templates/native-go-integration/backend/internal/app/personal_test.go +37 -0
- package/dist/templates/native-go-vue/README.md +38 -7
- package/dist/templates/native-go-vue/frontend/DESIGN.md +15 -3
- package/dist/templates/native-go-vue/frontend/README-JOBS.md +75 -0
- package/dist/templates/native-go-vue/frontend/README-M2.md +64 -0
- package/dist/templates/native-go-vue/frontend/package-lock.json +5 -4
- package/dist/templates/native-go-vue/frontend/package.json +1 -1
- package/dist/templates/native-go-vue/frontend/src/App.vue +39 -11
- package/dist/templates/native-go-vue/frontend/src/M2App.vue +57 -0
- package/dist/templates/native-go-vue/frontend/src/SDKApp.vue +203 -0
- package/dist/templates/native-go-vue/frontend/src/context.ts +3 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/InteractiveJobForm.vue +70 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/JobsAdminPanel.vue +33 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/JobsPanel.vue +135 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/connected-provider.ts +179 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/de.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/en.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/es.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/fr.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/it.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/ja.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/ko.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/zh-CN.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n/zh-TW.json +62 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/i18n.ts +15 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/mock-provider.ts +67 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/provider.ts +60 -0
- package/dist/templates/native-go-vue/frontend/src/jobs/validate.ts +44 -0
- package/dist/templates/native-go-vue/frontend/src/m2-main.ts +21 -0
- package/dist/templates/native-go-vue/frontend/src/m2-style.css +7 -0
- package/dist/templates/native-go-vue/frontend/src/nas/M2Files.vue +94 -0
- package/dist/templates/native-go-vue/frontend/src/nas/M2PathPicker.vue +70 -0
- package/dist/templates/native-go-vue/frontend/src/nas/M2Settings.vue +69 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/de.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/en.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/es.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/fr.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/it.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/ja.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/ko.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/zh-CN.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/i18n/m2/zh-TW.json +56 -0
- package/dist/templates/native-go-vue/frontend/src/nas/m2-contract.ts +33 -0
- package/dist/templates/native-go-vue/frontend/src/nas/m2-i18n.ts +24 -0
- package/dist/templates/native-go-vue/frontend/src/nas/m2-provider.ts +104 -0
- package/dist/templates/native-go-vue/frontend/src/nas/use-m2-request.ts +18 -0
- package/dist/templates/native-go-vue/frontend/src/sdk-main.ts +39 -0
- package/dist/templates/native-go-vue/frontend/src/shell/AppShell.vue +48 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/de.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/en.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/es.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/fr.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/it.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/ja.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/ko.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/zh-CN.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n/zh-TW.json +10 -0
- package/dist/templates/native-go-vue/frontend/src/shell/i18n.ts +17 -0
- package/dist/templates/native-go-vue/frontend/src/shell/pages.ts +34 -0
- package/dist/templates/native-go-vue/frontend/src/style.css +2 -6
- package/dist/templates/native-go-vue/frontend/test/apps.test.ts +21 -0
- package/dist/templates/native-go-vue/frontend/test/jobs-connected.test.ts +163 -0
- package/dist/templates/native-go-vue/frontend/test/jobs-preview.html +22 -0
- package/dist/templates/native-go-vue/frontend/test/jobs.test.ts +176 -0
- package/dist/templates/native-go-vue/frontend/test/m2-preview.html +27 -0
- package/dist/templates/native-go-vue/frontend/test/m2-provider.test.ts +87 -0
- package/dist/templates/native-go-vue/frontend/test/m2-ui.test.ts +209 -0
- package/dist/templates/native-go-vue/frontend/test/native-controls.test.ts +27 -0
- package/dist/templates/native-go-vue/frontend/test/picker-wire.test.ts +110 -0
- package/dist/templates/native-go-vue/frontend/test/shell-preview.html +19 -0
- package/dist/templates/native-go-vue/frontend/test/shell-sdk.test.ts +73 -0
- package/dist/templates/native-go-vue/frontend/test/shell-ui.test.ts +114 -0
- package/dist/templates/native-go-vue/frontend/test/shell.test.ts +45 -0
- package/dist/templates/native-go-vue/frontend/vite.config.ts +2 -2
- package/dist/types.d.ts +1 -1
- package/dist/validate.js +6 -3
- package/package.json +5 -2
- package/schema/synology-app.schema.json +19 -0
- package/skills/reference/create.md +6 -2
- package/templates/_authorization/main.go +104 -0
- package/templates/_authorization/main_test.go +35 -0
- package/templates/_daemon/go.mod +2 -0
- package/templates/_gateway/auth.go +101 -0
- package/templates/_gateway/auth_test.go +216 -0
- package/templates/_gateway/cgi.go +133 -0
- package/templates/_gateway/cgi_test.go +156 -0
- package/templates/_gateway/csrf.go +73 -0
- package/templates/_gateway/csrf_test.go +155 -0
- package/templates/_gateway/directory.go +108 -0
- package/templates/_gateway/directory_test.go +202 -0
- package/templates/_gateway/gateway.go +412 -0
- package/templates/_gateway/gateway_test.go +676 -0
- package/templates/_gateway/go.mod +3 -0
- package/templates/_gateway/groups.go +66 -0
- package/templates/_gateway/main.go +45 -0
- package/templates/binary/synology-app.yaml +1 -1
- package/templates/compose-import/compose.yaml +1 -1
- package/templates/compose-import/synology-app.yaml +1 -1
- package/templates/hello-files/compose.yaml +1 -1
- package/templates/hello-files/synology-app.yaml +1 -1
- package/templates/native-go/README.md +118 -5
- package/templates/native-go/backend/THIRD_PARTY_NOTICES.txt +3 -1
- package/templates/native-go/backend/cmd/app/main.go +25 -6
- package/templates/native-go/backend/cmd/app/sdk_main.go +62 -0
- package/templates/native-go/backend/cmd/background-worker/main.go +38 -0
- package/templates/native-go/backend/cmd/helper/main.go +27 -1
- package/templates/native-go/backend/cmd/helper/sdk_registry.go +19 -0
- package/templates/native-go/backend/go.mod +5 -3
- package/templates/native-go/backend/go.sum +4 -4
- package/templates/native-go/backend/internal/api/registry.go +17 -6
- package/templates/native-go/backend/internal/api/server.go +7 -1
- package/templates/native-go/backend/internal/app/authorization_none.go +5 -0
- package/templates/native-go/backend/internal/app/background.go +270 -0
- package/templates/native-go/backend/internal/app/background_none.go +8 -0
- package/templates/native-go/backend/internal/app/background_owner.go +59 -0
- package/templates/native-go/backend/internal/app/background_owner_test.go +145 -0
- package/templates/native-go/backend/internal/app/background_schedule.go +74 -0
- package/templates/native-go/backend/internal/app/background_schedule_test.go +62 -0
- package/templates/native-go/backend/internal/app/background_test.go +346 -0
- package/templates/native-go/backend/internal/app/integration_state.go +16 -0
- package/templates/native-go/backend/internal/app/migrations.go +41 -0
- package/templates/native-go/backend/internal/app/migrations_test.go +41 -0
- package/templates/native-go/backend/internal/app/nas_cgi_artifact_test.go +8 -0
- package/templates/native-go/backend/internal/app/routes.go +22 -5
- package/templates/native-go/backend/internal/app/routes_test.go +20 -3
- package/templates/native-go/backend/internal/app/sdk_jobs.go +70 -0
- package/templates/native-go/backend/internal/app/sdk_jobs_test.go +116 -0
- package/templates/native-go/backend/internal/app/sdk_routes.go +177 -0
- package/templates/native-go/backend/internal/app/session_files.go +15 -0
- package/templates/native-go/backend/internal/app/session_files_test.go +26 -0
- package/templates/native-go/backend/internal/app/shared_folder.go +144 -0
- package/templates/native-go/backend/internal/app/shared_folder_test.go +158 -0
- package/templates/native-go/backend/internal/background/access.go +57 -0
- package/templates/native-go/backend/internal/background/owner_test.go +126 -0
- package/templates/native-go/backend/internal/background/runner.go +185 -0
- package/templates/native-go/backend/internal/background/runner_test.go +209 -0
- package/templates/native-go/backend/internal/background/schedule.go +300 -0
- package/templates/native-go/backend/internal/background/schedule_test.go +335 -0
- package/templates/native-go/backend/internal/background/store.go +807 -0
- package/templates/native-go/backend/internal/background/store_test.go +407 -0
- package/templates/native-go/backend/internal/datamigrate/migrate.go +191 -0
- package/templates/native-go/backend/internal/datamigrate/migrate_test.go +177 -0
- package/templates/native-go/backend/internal/filestation/browse_test.go +67 -0
- package/templates/native-go/backend/internal/filestation/client.go +251 -0
- package/templates/native-go/backend/internal/filestation/client_test.go +155 -0
- package/templates/native-go/backend/internal/filestation/doc.go +4 -0
- package/templates/native-go/backend/internal/filestation/read_file_test.go +90 -0
- package/templates/native-go/backend/internal/filestation/repository.go +207 -0
- package/templates/native-go/backend/internal/filestation/repository_test.go +104 -0
- package/templates/native-go/backend/internal/filestation/sdk_session.go +241 -0
- package/templates/native-go/backend/internal/filestation/sdk_session_test.go +183 -0
- package/templates/native-go/backend/internal/filestation/service.go +254 -0
- package/templates/native-go/backend/internal/filestation/service_test.go +94 -0
- package/templates/native-go/backend/internal/filestation/session_semantics_test.go +383 -0
- package/templates/native-go/backend/internal/filestation/write.go +72 -0
- package/templates/native-go/backend/internal/filestation/write_test.go +123 -0
- package/templates/native-go/backend/internal/helper/background_proof.go +163 -0
- package/templates/native-go/backend/internal/helper/background_proof_contract.go +46 -0
- package/templates/native-go/backend/internal/helper/background_proof_test.go +161 -0
- package/templates/native-go/backend/internal/helper/data_contract.go +3 -0
- package/templates/native-go/backend/internal/helper/data_protocol.go +3 -0
- package/templates/native-go/backend/internal/helper/data_protocol_test.go +1 -1
- package/templates/native-go/backend/internal/helper/grant_authority.go +3 -0
- package/templates/native-go/backend/internal/helper/grant_authority_test.go +1 -1
- package/templates/native-go/backend/internal/helper/grant_repository_linux.go +2 -1
- package/templates/native-go/backend/internal/helper/grant_repository_linux_test.go +4 -3
- package/templates/native-go/backend/internal/helper/grant_snapshot.go +3 -0
- package/templates/native-go/backend/internal/helper/jobcontract/bindings.go +48 -0
- package/templates/native-go/backend/internal/helper/jobcontract/contract_test.go +436 -0
- package/templates/native-go/backend/internal/helper/jobcontract/decode.go +185 -0
- package/templates/native-go/backend/internal/helper/jobcontract/digest.go +55 -0
- package/templates/native-go/backend/internal/helper/jobcontract/registry.go +85 -0
- package/templates/native-go/backend/internal/helper/jobcontract/registry_test.go +73 -0
- package/templates/native-go/backend/internal/helper/jobcontract/result.go +53 -0
- package/templates/native-go/backend/internal/helper/jobcontract/stub.go +8 -0
- package/templates/native-go/backend/internal/helper/jobcontract/testdata/input-digests.json +127 -0
- package/templates/native-go/backend/internal/helper/jobcontract/types.go +234 -0
- package/templates/native-go/backend/internal/helper/jobcontract/types_test.go +29 -0
- package/templates/native-go/backend/internal/helper/jobcontract/validate.go +462 -0
- package/templates/native-go/backend/internal/helper/legacy_authority_schema_linux_test.go +34 -0
- package/templates/native-go/backend/internal/helper/legacy_authority_schema_test.go +6 -0
- package/templates/native-go/backend/internal/helper/management.go +86 -0
- package/templates/native-go/backend/internal/helper/observation.go +42 -2
- package/templates/native-go/backend/internal/helper/observation_health_test.go +13 -1
- package/templates/native-go/backend/internal/helper/observer_diagnostic.go +56 -10
- package/templates/native-go/backend/internal/helper/observer_diagnostic_linux_test.go +6 -0
- package/templates/native-go/backend/internal/helper/observer_diagnostic_writer.go +40 -0
- package/templates/native-go/backend/internal/helper/process_linux.go +3 -0
- package/templates/native-go/backend/internal/helper/purge.go +115 -0
- package/templates/native-go/backend/internal/helper/purge_test.go +59 -0
- package/templates/native-go/backend/internal/helper/query_deadline_linux_test.go +115 -0
- package/templates/native-go/backend/internal/helper/query_pending_diagnostic_test.go +254 -0
- package/templates/native-go/backend/internal/helper/relaxed_invalidation.go +3 -0
- package/templates/native-go/backend/internal/helper/revoke.go +109 -0
- package/templates/native-go/backend/internal/helper/revoke_test.go +121 -0
- package/templates/native-go/backend/internal/helper/s1r_actor_races_linux_test.go +23 -4
- package/templates/native-go/backend/internal/helper/sdk_assembly_linux.go +51 -0
- package/templates/native-go/backend/internal/helper/sdk_attach.go +83 -0
- package/templates/native-go/backend/internal/helper/sdk_attach_contract.go +32 -0
- package/templates/native-go/backend/internal/helper/sdk_attach_test.go +184 -0
- package/templates/native-go/backend/internal/helper/sdk_authority_schema_test.go +6 -0
- package/templates/native-go/backend/internal/helper/sdk_background_authority.go +832 -0
- package/templates/native-go/backend/internal/helper/sdk_background_authority_test.go +714 -0
- package/templates/native-go/backend/internal/helper/sdk_background_invalidation.go +218 -0
- package/templates/native-go/backend/internal/helper/sdk_background_lease.go +218 -0
- package/templates/native-go/backend/internal/helper/sdk_background_snapshot.go +110 -0
- package/templates/native-go/backend/internal/helper/sdk_background_store_linux_test.go +261 -0
- package/templates/native-go/backend/internal/helper/sdk_background_store_test.go +58 -0
- package/templates/native-go/backend/internal/helper/sdk_bindings.go +60 -0
- package/templates/native-go/backend/internal/helper/sdk_data_contract.go +251 -0
- package/templates/native-go/backend/internal/helper/sdk_data_protocol.go +424 -0
- package/templates/native-go/backend/internal/helper/sdk_dispatch_absence_test.go +51 -0
- package/templates/native-go/backend/internal/helper/sdk_display.go +488 -0
- package/templates/native-go/backend/internal/helper/sdk_display_contract.go +121 -0
- package/templates/native-go/backend/internal/helper/sdk_display_test.go +459 -0
- package/templates/native-go/backend/internal/helper/sdk_grant_authority.go +559 -0
- package/templates/native-go/backend/internal/helper/sdk_grant_repository_linux.go +417 -0
- package/templates/native-go/backend/internal/helper/sdk_grant_snapshot.go +94 -0
- package/templates/native-go/backend/internal/helper/sdk_history.go +80 -0
- package/templates/native-go/backend/internal/helper/sdk_history_test.go +76 -0
- package/templates/native-go/backend/internal/helper/sdk_job.go +697 -0
- package/templates/native-go/backend/internal/helper/sdk_job_child_linux.go +309 -0
- package/templates/native-go/backend/internal/helper/sdk_job_contract.go +122 -0
- package/templates/native-go/backend/internal/helper/sdk_job_linux_test.go +159 -0
- package/templates/native-go/backend/internal/helper/sdk_job_process_linux.go +327 -0
- package/templates/native-go/backend/internal/helper/sdk_job_test.go +501 -0
- package/templates/native-go/backend/internal/helper/sdk_job_vm_linux_test.go +343 -0
- package/templates/native-go/backend/internal/helper/sdk_journal.go +77 -0
- package/templates/native-go/backend/internal/helper/sdk_journal_linux.go +244 -0
- package/templates/native-go/backend/internal/helper/sdk_journal_linux_test.go +295 -0
- package/templates/native-go/backend/internal/helper/sdk_journal_test.go +71 -0
- package/templates/native-go/backend/internal/helper/sdk_picker_test.go +50 -0
- package/templates/native-go/backend/internal/helper/sdk_process_linux.go +184 -0
- package/templates/native-go/backend/internal/helper/sdk_public_vm_linux_test.go +129 -0
- package/templates/native-go/backend/internal/helper/sdk_relaxed_invalidation.go +242 -0
- package/templates/native-go/backend/internal/helper/sdk_rpc.go +299 -0
- package/templates/native-go/backend/internal/helper/sdk_rpc_contract.go +70 -0
- package/templates/native-go/backend/internal/helper/sdk_rpc_test.go +135 -0
- package/templates/native-go/backend/internal/helper/sdk_server_linux.go +161 -0
- package/templates/native-go/backend/internal/helper/sdk_session.go +677 -0
- package/templates/native-go/backend/internal/helper/sdk_session_contract.go +72 -0
- package/templates/native-go/backend/internal/helper/sdk_session_fence_test.go +215 -0
- package/templates/native-go/backend/internal/helper/sdk_session_test.go +475 -0
- package/templates/native-go/backend/internal/helper/sdk_supervisor_frame.go +78 -0
- package/templates/native-go/backend/internal/helper/sdk_supervisor_linux.go +414 -0
- package/templates/native-go/backend/internal/helper/sdk_transport.go +79 -0
- package/templates/native-go/backend/internal/helper/sdk_transport_linux.go +82 -0
- package/templates/native-go/backend/internal/helper/sdk_transport_test.go +64 -0
- package/templates/native-go/backend/internal/helper/server_linux.go +14 -2
- package/templates/native-go/backend/internal/helper/stale_management_linux_test.go +126 -0
- package/templates/native-go/backend/internal/helper/stale_management_test.go +122 -0
- package/templates/native-go/backend/internal/helper/startup_diagnostic.go +68 -0
- package/templates/native-go/backend/internal/helper/startup_diagnostic_linux_test.go +126 -0
- package/templates/native-go/backend/internal/helper/startup_diagnostic_test.go +117 -0
- package/templates/native-go/backend/internal/helper/status.go +22 -13
- package/templates/native-go/backend/internal/helper/status_test.go +45 -0
- package/templates/native-go/backend/internal/helper/supervision.go +1 -1
- package/templates/native-go/backend/internal/helper/supervisor_frame.go +3 -0
- package/templates/native-go/backend/internal/helper/supervisor_linux.go +6 -2
- package/templates/native-go/backend/internal/helper/unit_connection_test.go +22 -4
- package/templates/native-go/backend/internal/helper/unit_linux.go +7 -3
- package/templates/native-go/backend/internal/helper/unit_query_linux.go +5 -1
- package/templates/native-go/backend/internal/helper/write_files_linux.go +7 -4
- package/templates/native-go/backend/internal/helper/write_files_linux_test.go +26 -0
- package/templates/native-go/dsm-package.yaml +2 -2
- package/templates/native-go-authorization/backend/internal/app/authorization.go +298 -0
- package/templates/native-go-authorization/backend/internal/app/authorization_test.go +96 -0
- package/templates/native-go-authorization/frontend/src/authorization/AuthorizationGate.vue +89 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/de.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/en.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/es.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/fr.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/index.ts +15 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/it.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/ja.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/ko.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/zh-CN.json +36 -0
- package/templates/native-go-authorization/frontend/src/authorization/i18n/zh-TW.json +36 -0
- package/templates/native-go-authorization/frontend/test/authorization-preview.html +14 -0
- package/templates/native-go-authorization/frontend/test/authorization.test.ts +59 -0
- package/templates/native-go-background/BACKGROUND.md +111 -0
- package/templates/native-go-background/backend/internal/app/background_on.go +7 -0
- package/templates/native-go-background/backend/internal/app/background_routes_test.go +32 -0
- package/templates/native-go-background/frontend/src/background/BackgroundPanel.vue +178 -0
- package/templates/native-go-background/frontend/src/background/i18n/de.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/en.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/es.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/fr.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/it.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/ja.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/ko.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/zh-CN.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n/zh-TW.json +83 -0
- package/templates/native-go-background/frontend/src/background/i18n.ts +19 -0
- package/templates/native-go-background/frontend/src/background/picker-provider.ts +13 -0
- package/templates/native-go-background/frontend/test/background.test.ts +179 -0
- package/templates/native-go-integration/backend/internal/app/personal.go +2 -2
- package/templates/native-go-integration/backend/internal/app/personal_test.go +37 -0
- package/templates/native-go-vue/README.md +38 -7
- package/templates/native-go-vue/frontend/DESIGN.md +15 -3
- package/templates/native-go-vue/frontend/README-JOBS.md +75 -0
- package/templates/native-go-vue/frontend/README-M2.md +64 -0
- package/templates/native-go-vue/frontend/package-lock.json +5 -4
- package/templates/native-go-vue/frontend/package.json +1 -1
- package/templates/native-go-vue/frontend/src/App.vue +39 -11
- package/templates/native-go-vue/frontend/src/M2App.vue +57 -0
- package/templates/native-go-vue/frontend/src/SDKApp.vue +203 -0
- package/templates/native-go-vue/frontend/src/context.ts +3 -0
- package/templates/native-go-vue/frontend/src/jobs/InteractiveJobForm.vue +70 -0
- package/templates/native-go-vue/frontend/src/jobs/JobsAdminPanel.vue +33 -0
- package/templates/native-go-vue/frontend/src/jobs/JobsPanel.vue +135 -0
- package/templates/native-go-vue/frontend/src/jobs/connected-provider.ts +179 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/de.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/en.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/es.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/fr.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/it.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/ja.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/ko.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/zh-CN.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n/zh-TW.json +62 -0
- package/templates/native-go-vue/frontend/src/jobs/i18n.ts +15 -0
- package/templates/native-go-vue/frontend/src/jobs/mock-provider.ts +67 -0
- package/templates/native-go-vue/frontend/src/jobs/provider.ts +60 -0
- package/templates/native-go-vue/frontend/src/jobs/validate.ts +44 -0
- package/templates/native-go-vue/frontend/src/m2-main.ts +21 -0
- package/templates/native-go-vue/frontend/src/m2-style.css +7 -0
- package/templates/native-go-vue/frontend/src/nas/M2Files.vue +94 -0
- package/templates/native-go-vue/frontend/src/nas/M2PathPicker.vue +70 -0
- package/templates/native-go-vue/frontend/src/nas/M2Settings.vue +69 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/de.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/en.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/es.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/fr.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/it.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/ja.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/ko.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/zh-CN.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/i18n/m2/zh-TW.json +56 -0
- package/templates/native-go-vue/frontend/src/nas/m2-contract.ts +33 -0
- package/templates/native-go-vue/frontend/src/nas/m2-i18n.ts +24 -0
- package/templates/native-go-vue/frontend/src/nas/m2-provider.ts +104 -0
- package/templates/native-go-vue/frontend/src/nas/use-m2-request.ts +18 -0
- package/templates/native-go-vue/frontend/src/sdk-main.ts +39 -0
- package/templates/native-go-vue/frontend/src/shell/AppShell.vue +48 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/de.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/en.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/es.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/fr.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/it.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/ja.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/ko.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/zh-CN.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n/zh-TW.json +10 -0
- package/templates/native-go-vue/frontend/src/shell/i18n.ts +17 -0
- package/templates/native-go-vue/frontend/src/shell/pages.ts +34 -0
- package/templates/native-go-vue/frontend/src/style.css +2 -6
- package/templates/native-go-vue/frontend/test/apps.test.ts +21 -0
- package/templates/native-go-vue/frontend/test/jobs-connected.test.ts +163 -0
- package/templates/native-go-vue/frontend/test/jobs-preview.html +22 -0
- package/templates/native-go-vue/frontend/test/jobs.test.ts +176 -0
- package/templates/native-go-vue/frontend/test/m2-preview.html +27 -0
- package/templates/native-go-vue/frontend/test/m2-provider.test.ts +87 -0
- package/templates/native-go-vue/frontend/test/m2-ui.test.ts +209 -0
- package/templates/native-go-vue/frontend/test/native-controls.test.ts +27 -0
- package/templates/native-go-vue/frontend/test/picker-wire.test.ts +110 -0
- package/templates/native-go-vue/frontend/test/shell-preview.html +19 -0
- package/templates/native-go-vue/frontend/test/shell-sdk.test.ts +73 -0
- package/templates/native-go-vue/frontend/test/shell-ui.test.ts +114 -0
- package/templates/native-go-vue/frontend/test/shell.test.ts +45 -0
- package/templates/native-go-vue/frontend/vite.config.ts +2 -2
- package/dist/templates/hello-web/compose.yaml +0 -21
- package/dist/templates/hello-web/html/app.js +0 -1
- package/dist/templates/hello-web/html/index.html +0 -13
- package/dist/templates/hello-web/synology-app.yaml +0 -13
- package/dist/templates/hello-web-page/compose.yaml +0 -21
- package/dist/templates/hello-web-page/html/app.js +0 -1
- package/dist/templates/hello-web-page/html/index.html +0 -13
- package/dist/templates/hello-web-page/synology-app.yaml +0 -13
- package/templates/hello-web/compose.yaml +0 -21
- package/templates/hello-web/html/app.js +0 -1
- package/templates/hello-web/html/index.html +0 -13
- package/templates/hello-web/synology-app.yaml +0 -13
- package/templates/hello-web-page/compose.yaml +0 -21
- package/templates/hello-web-page/html/app.js +0 -1
- package/templates/hello-web-page/html/index.html +0 -13
- package/templates/hello-web-page/synology-app.yaml +0 -13
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
export class WorkerContractError extends Error {
|
|
2
|
+
code;
|
|
3
|
+
constructor(code) {
|
|
4
|
+
super(code);
|
|
5
|
+
this.code = code;
|
|
6
|
+
this.name = "WorkerContractError";
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export function fail(code = "invalid-request") { throw new WorkerContractError(code); }
|
|
10
|
+
export function validUnicode(s) {
|
|
11
|
+
for (let i = 0; i < s.length; i++) {
|
|
12
|
+
const c = s.charCodeAt(i);
|
|
13
|
+
if (c >= 0xdc00 && c <= 0xdfff)
|
|
14
|
+
return false;
|
|
15
|
+
if (c >= 0xd800 && c <= 0xdbff) {
|
|
16
|
+
const low = s.charCodeAt(++i);
|
|
17
|
+
if (!(low >= 0xdc00 && low <= 0xdfff))
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
// JSON.parse alone loses duplicate keys and silently accepts unpaired Unicode.
|
|
24
|
+
// This bounded parser keeps keys until checked; numbers are exact unsigned
|
|
25
|
+
// decimal integers (the Go uint JSON contract rejects fractions/exponents).
|
|
26
|
+
export function strictJSON(raw, cap) {
|
|
27
|
+
let text;
|
|
28
|
+
if (typeof raw === "string") {
|
|
29
|
+
if (!validUnicode(raw))
|
|
30
|
+
fail();
|
|
31
|
+
text = raw;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
if (raw.byteLength > cap)
|
|
35
|
+
fail("limit-exceeded");
|
|
36
|
+
try {
|
|
37
|
+
text = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(raw);
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return fail();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (Buffer.byteLength(text) > cap)
|
|
44
|
+
fail("limit-exceeded");
|
|
45
|
+
let i = 0;
|
|
46
|
+
const space = () => { while (/[ \r\n\t]/.test(text[i] ?? "x"))
|
|
47
|
+
i++; };
|
|
48
|
+
const string = () => {
|
|
49
|
+
const start = i++;
|
|
50
|
+
while (i < text.length) {
|
|
51
|
+
const c = text[i++];
|
|
52
|
+
if (c === "\\") {
|
|
53
|
+
i++;
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (c === '"') {
|
|
57
|
+
let value;
|
|
58
|
+
try {
|
|
59
|
+
value = JSON.parse(text.slice(start, i));
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return fail();
|
|
63
|
+
}
|
|
64
|
+
if (typeof value !== "string" || !validUnicode(value))
|
|
65
|
+
fail();
|
|
66
|
+
return value;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return fail();
|
|
70
|
+
};
|
|
71
|
+
const value = (depth) => {
|
|
72
|
+
if (depth > 64)
|
|
73
|
+
fail();
|
|
74
|
+
space();
|
|
75
|
+
const c = text[i];
|
|
76
|
+
if (c === '"')
|
|
77
|
+
return string();
|
|
78
|
+
if (c === "{") {
|
|
79
|
+
i++;
|
|
80
|
+
space();
|
|
81
|
+
const object = Object.create(null);
|
|
82
|
+
const seen = new Set();
|
|
83
|
+
if (text[i] !== "}")
|
|
84
|
+
for (;;) {
|
|
85
|
+
if (text[i] !== '"')
|
|
86
|
+
fail();
|
|
87
|
+
const key = string();
|
|
88
|
+
if (seen.has(key))
|
|
89
|
+
fail();
|
|
90
|
+
seen.add(key);
|
|
91
|
+
space();
|
|
92
|
+
if (text[i++] !== ":")
|
|
93
|
+
fail();
|
|
94
|
+
object[key] = value(depth + 1);
|
|
95
|
+
space();
|
|
96
|
+
if (text[i] === "}")
|
|
97
|
+
break;
|
|
98
|
+
if (text[i++] !== ",")
|
|
99
|
+
fail();
|
|
100
|
+
space();
|
|
101
|
+
}
|
|
102
|
+
i++;
|
|
103
|
+
return object;
|
|
104
|
+
}
|
|
105
|
+
if (c === "[") {
|
|
106
|
+
i++;
|
|
107
|
+
space();
|
|
108
|
+
const array = [];
|
|
109
|
+
if (text[i] !== "]")
|
|
110
|
+
for (;;) {
|
|
111
|
+
array.push(value(depth + 1));
|
|
112
|
+
space();
|
|
113
|
+
if (text[i] === "]")
|
|
114
|
+
break;
|
|
115
|
+
if (text[i++] !== ",")
|
|
116
|
+
fail();
|
|
117
|
+
}
|
|
118
|
+
i++;
|
|
119
|
+
return array;
|
|
120
|
+
}
|
|
121
|
+
for (const [word, result] of [["true", true], ["false", false]]) {
|
|
122
|
+
if (text.startsWith(word, i)) {
|
|
123
|
+
i += word.length;
|
|
124
|
+
return result;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const token = /^(0|[1-9][0-9]*)/.exec(text.slice(i));
|
|
128
|
+
if (!token)
|
|
129
|
+
return fail(); // null, negative and invalid primitives
|
|
130
|
+
i += token[0].length;
|
|
131
|
+
const n = Number(token[0]);
|
|
132
|
+
if (!Number.isSafeInteger(n))
|
|
133
|
+
fail();
|
|
134
|
+
return n;
|
|
135
|
+
};
|
|
136
|
+
const result = value(0);
|
|
137
|
+
space();
|
|
138
|
+
if (i !== text.length)
|
|
139
|
+
fail();
|
|
140
|
+
return result;
|
|
141
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
export { WorkerContractError } from "./worker-contract-json.js";
|
|
2
|
+
export declare const WORKER_CONTRACT: {
|
|
3
|
+
readonly dataProtocol: 2;
|
|
4
|
+
readonly jobSchema: 1;
|
|
5
|
+
readonly registrySchema: 2;
|
|
6
|
+
readonly backgroundSchema: 2;
|
|
7
|
+
readonly productionAvailability: "unavailable";
|
|
8
|
+
readonly maxSafeInteger: number;
|
|
9
|
+
readonly maxControlBytes: 16384;
|
|
10
|
+
readonly maxInputBytes: 8192;
|
|
11
|
+
readonly maxSteps: 16;
|
|
12
|
+
readonly maxWorkers: 16;
|
|
13
|
+
readonly maxInertWorkerBytes: 1048576;
|
|
14
|
+
readonly maxChildren: 4;
|
|
15
|
+
readonly maxUIDChildren: 2;
|
|
16
|
+
readonly maxBackgroundChildren: 2;
|
|
17
|
+
readonly maxUIDBackgroundChildren: 1;
|
|
18
|
+
readonly maxPending: 16;
|
|
19
|
+
readonly maxUIDPending: 2;
|
|
20
|
+
readonly maxRetryAfterMs: 1000;
|
|
21
|
+
readonly maxAuthorityRecords: 256;
|
|
22
|
+
readonly maxSnapshotBytes: 1048576;
|
|
23
|
+
readonly maxExecutionKeys: 256;
|
|
24
|
+
readonly maxArtifactBytes: 16384;
|
|
25
|
+
readonly maxMutationControls: 256;
|
|
26
|
+
readonly maxProgressBytes: 1024;
|
|
27
|
+
readonly maxProgressPerSecond: 1;
|
|
28
|
+
readonly maxProgressPackets: 128;
|
|
29
|
+
readonly maxProgressRing: 32;
|
|
30
|
+
readonly maxStatusBytes: 16384;
|
|
31
|
+
readonly maxStatusJobs: 10;
|
|
32
|
+
readonly maxStatusConcurrent: 8;
|
|
33
|
+
readonly maxUIDStatusPerSecond: 2;
|
|
34
|
+
readonly intentTTLMS: 30000;
|
|
35
|
+
readonly defaultBackgroundTTLMS: 86400000;
|
|
36
|
+
readonly maxBackgroundTTLMS: 604800000;
|
|
37
|
+
readonly nativeProofFreshnessMS: 2000;
|
|
38
|
+
readonly drainMS: 2000;
|
|
39
|
+
readonly terminateGraceMS: 1000;
|
|
40
|
+
};
|
|
41
|
+
export type WorkerMode = "interactive" | "background";
|
|
42
|
+
export type WorkerAction = "nas.files.list" | "nas.files.stat" | "nas.files.read" | "nas.files.read-stream";
|
|
43
|
+
export type JobState = "pending" | "running" | "cancel-requested" | "draining" | "succeeded" | "failed" | "canceled" | "interrupted" | "cleanup-required";
|
|
44
|
+
export type WorkerSafeReason = "invalid-request" | "incompatible" | "unsupported" | "replay" | "stale" | "expired" | "denied" | "unavailable" | "suspended" | "revoked" | "fenced" | "busy" | "limit-exceeded" | "canceled" | "timeout" | "partial" | "commit-uncertain" | "cleanup-required" | "internal";
|
|
45
|
+
export interface WorkerInventory {
|
|
46
|
+
package: string;
|
|
47
|
+
version: string;
|
|
48
|
+
protocol: 2;
|
|
49
|
+
payloadDigest: string;
|
|
50
|
+
registryDigest: string;
|
|
51
|
+
dataAccess: "relaxed";
|
|
52
|
+
}
|
|
53
|
+
export interface WorkerLimits {
|
|
54
|
+
inputBytes: number;
|
|
55
|
+
steps: number;
|
|
56
|
+
totalMs: number;
|
|
57
|
+
idleMs: number;
|
|
58
|
+
metadataMs: number;
|
|
59
|
+
boundedMs: number;
|
|
60
|
+
boundedBytes: number;
|
|
61
|
+
streamBytes: number;
|
|
62
|
+
chunkBytes: number;
|
|
63
|
+
outstandingLeases: number;
|
|
64
|
+
}
|
|
65
|
+
export interface WorkerDescriptor {
|
|
66
|
+
registrySchema: 2;
|
|
67
|
+
workerId: string;
|
|
68
|
+
workerRevision: number;
|
|
69
|
+
kind: "sdk-read-plan";
|
|
70
|
+
handlerBinding: string;
|
|
71
|
+
inputSchemaDigest: string;
|
|
72
|
+
outputSchemaDigest: string;
|
|
73
|
+
actions: WorkerAction[];
|
|
74
|
+
modes: WorkerMode[];
|
|
75
|
+
checkpoints: ("before-step" | "before-chunk" | "before-result")[];
|
|
76
|
+
limits: WorkerLimits;
|
|
77
|
+
}
|
|
78
|
+
export type WorkerStep = {
|
|
79
|
+
action: "nas.files.list";
|
|
80
|
+
segments: string[];
|
|
81
|
+
limit: number;
|
|
82
|
+
} | {
|
|
83
|
+
action: "nas.files.stat";
|
|
84
|
+
segments: string[];
|
|
85
|
+
} | {
|
|
86
|
+
action: "nas.files.read" | "nas.files.read-stream";
|
|
87
|
+
segments: string[];
|
|
88
|
+
maxBytes: number;
|
|
89
|
+
};
|
|
90
|
+
export interface WorkerInput {
|
|
91
|
+
steps: WorkerStep[];
|
|
92
|
+
}
|
|
93
|
+
export interface WorkerRevisionRef {
|
|
94
|
+
id: string;
|
|
95
|
+
revision: number;
|
|
96
|
+
}
|
|
97
|
+
export interface WorkerBindingBase {
|
|
98
|
+
inventory: WorkerInventory;
|
|
99
|
+
jobSchema: 1;
|
|
100
|
+
epoch: string;
|
|
101
|
+
job: WorkerRevisionRef;
|
|
102
|
+
worker: WorkerRevisionRef;
|
|
103
|
+
parentGrant: WorkerRevisionRef;
|
|
104
|
+
approvalBinding: string;
|
|
105
|
+
capabilityDigest: string;
|
|
106
|
+
inputSchemaDigest: string;
|
|
107
|
+
inputDigest: string;
|
|
108
|
+
}
|
|
109
|
+
export type WorkerBinding = WorkerBindingBase & ({
|
|
110
|
+
mode: "interactive";
|
|
111
|
+
delegation?: never;
|
|
112
|
+
} | {
|
|
113
|
+
mode: "background";
|
|
114
|
+
delegation: WorkerRevisionRef;
|
|
115
|
+
});
|
|
116
|
+
export interface WorkerPrincipal {
|
|
117
|
+
identityBasis: "uid-username";
|
|
118
|
+
uid: number;
|
|
119
|
+
username: string;
|
|
120
|
+
}
|
|
121
|
+
export type WorkerPrivateBinding = {
|
|
122
|
+
binding: WorkerBindingBase & {
|
|
123
|
+
mode: "interactive";
|
|
124
|
+
delegation?: never;
|
|
125
|
+
};
|
|
126
|
+
actor: WorkerPrincipal;
|
|
127
|
+
sessionRef: string;
|
|
128
|
+
} | {
|
|
129
|
+
binding: WorkerBindingBase & {
|
|
130
|
+
mode: "background";
|
|
131
|
+
delegation: WorkerRevisionRef;
|
|
132
|
+
};
|
|
133
|
+
actor: WorkerPrincipal;
|
|
134
|
+
sessionRef?: never;
|
|
135
|
+
};
|
|
136
|
+
export interface WorkerIntent {
|
|
137
|
+
jobSchema: 1;
|
|
138
|
+
intentId: string;
|
|
139
|
+
intentRevision: number;
|
|
140
|
+
binding: WorkerPrivateBinding;
|
|
141
|
+
input: WorkerInput;
|
|
142
|
+
summaryDigest: string;
|
|
143
|
+
createdAt: number;
|
|
144
|
+
expiresAt: number;
|
|
145
|
+
}
|
|
146
|
+
export interface WorkerBackgroundRecord {
|
|
147
|
+
backgroundSchema: 2;
|
|
148
|
+
binding: Extract<WorkerPrivateBinding, {
|
|
149
|
+
sessionRef?: never;
|
|
150
|
+
}>;
|
|
151
|
+
issuer: WorkerPrincipal;
|
|
152
|
+
createdAt: number;
|
|
153
|
+
expiresAt: number;
|
|
154
|
+
notBefore: number;
|
|
155
|
+
state: "active" | "consumed" | "expired" | "revoked" | "suspended";
|
|
156
|
+
reason?: WorkerSafeReason;
|
|
157
|
+
executionKey?: string;
|
|
158
|
+
}
|
|
159
|
+
export interface WorkerProgress {
|
|
160
|
+
sequence: number;
|
|
161
|
+
phase: "starting" | "metadata" | "reading" | "finishing";
|
|
162
|
+
completedUnits: number;
|
|
163
|
+
totalUnits?: number;
|
|
164
|
+
bytesRead: number;
|
|
165
|
+
bytesWritten: number;
|
|
166
|
+
}
|
|
167
|
+
export interface WorkerJob {
|
|
168
|
+
binding: WorkerBinding;
|
|
169
|
+
state: JobState;
|
|
170
|
+
safeReason?: WorkerSafeReason;
|
|
171
|
+
progress: WorkerProgress;
|
|
172
|
+
acceptedAt: number;
|
|
173
|
+
startedAt?: number;
|
|
174
|
+
finishedAt?: number;
|
|
175
|
+
cancelRequested: boolean;
|
|
176
|
+
drained: boolean;
|
|
177
|
+
effectsUnknown: boolean;
|
|
178
|
+
}
|
|
179
|
+
export interface WorkerControl {
|
|
180
|
+
op: "jobs.submit" | "jobs.cancel" | "background.revoke";
|
|
181
|
+
binding: WorkerBinding;
|
|
182
|
+
intent: WorkerRevisionRef;
|
|
183
|
+
nonce: string;
|
|
184
|
+
ticket: string;
|
|
185
|
+
}
|
|
186
|
+
export declare function decodeWorkerInput(raw: string | Uint8Array): WorkerInput;
|
|
187
|
+
export declare function workerInputDigest(input: WorkerInput, schemaDigest: string): string;
|
|
188
|
+
export declare function decodeWorkerControl(raw: string | Uint8Array): WorkerControl;
|
|
189
|
+
export declare function compareWorkerBinding(got: WorkerBinding, expected: WorkerBinding): void;
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { isDeepStrictEqual } from "node:util";
|
|
3
|
+
import { fail, strictJSON, validUnicode } from "./worker-contract-json.js";
|
|
4
|
+
export { WorkerContractError } from "./worker-contract-json.js";
|
|
5
|
+
// M3 S0 only: no CLI command, runtime route, registry or execution is enabled.
|
|
6
|
+
export const WORKER_CONTRACT = {
|
|
7
|
+
dataProtocol: 2, jobSchema: 1, registrySchema: 2, backgroundSchema: 2,
|
|
8
|
+
productionAvailability: "unavailable",
|
|
9
|
+
maxSafeInteger: Number.MAX_SAFE_INTEGER,
|
|
10
|
+
maxControlBytes: 16384, maxInputBytes: 8192, maxSteps: 16,
|
|
11
|
+
maxWorkers: 16, maxInertWorkerBytes: 1048576,
|
|
12
|
+
maxChildren: 4, maxUIDChildren: 2, maxBackgroundChildren: 2, maxUIDBackgroundChildren: 1,
|
|
13
|
+
maxPending: 16, maxUIDPending: 2, maxRetryAfterMs: 1000,
|
|
14
|
+
maxAuthorityRecords: 256, maxSnapshotBytes: 1048576,
|
|
15
|
+
maxExecutionKeys: 256, maxArtifactBytes: 16384, maxMutationControls: 256,
|
|
16
|
+
maxProgressBytes: 1024, maxProgressPerSecond: 1, maxProgressPackets: 128, maxProgressRing: 32,
|
|
17
|
+
maxStatusBytes: 16384, maxStatusJobs: 10, maxStatusConcurrent: 8, maxUIDStatusPerSecond: 2,
|
|
18
|
+
intentTTLMS: 30000, defaultBackgroundTTLMS: 86400000, maxBackgroundTTLMS: 604800000,
|
|
19
|
+
nativeProofFreshnessMS: 2000, drainMS: 2000, terminateGraceMS: 1000,
|
|
20
|
+
};
|
|
21
|
+
const digestPattern = /^[a-f0-9]{64}$/;
|
|
22
|
+
const referencePattern = /^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$/;
|
|
23
|
+
const positive = (n) => typeof n === "number" && Number.isSafeInteger(n) && n > 0;
|
|
24
|
+
function object(value, required, optional = []) {
|
|
25
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
26
|
+
return fail();
|
|
27
|
+
const o = value;
|
|
28
|
+
if (required.some(k => !Object.hasOwn(o, k)) || Object.keys(o).some(k => !required.includes(k) && !optional.includes(k)))
|
|
29
|
+
fail();
|
|
30
|
+
return o;
|
|
31
|
+
}
|
|
32
|
+
function stringValue(value) {
|
|
33
|
+
if (typeof value !== "string" || !validUnicode(value))
|
|
34
|
+
return fail();
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
function reference(value) {
|
|
38
|
+
const s = stringValue(value);
|
|
39
|
+
if (!referencePattern.test(s))
|
|
40
|
+
fail();
|
|
41
|
+
return s;
|
|
42
|
+
}
|
|
43
|
+
function digestValue(value) {
|
|
44
|
+
const s = stringValue(value);
|
|
45
|
+
if (!digestPattern.test(s))
|
|
46
|
+
fail();
|
|
47
|
+
return s;
|
|
48
|
+
}
|
|
49
|
+
function revisionRef(value, worker = false) {
|
|
50
|
+
const o = object(value, ["id", "revision"]);
|
|
51
|
+
if (!positive(o.revision))
|
|
52
|
+
fail();
|
|
53
|
+
return { id: worker ? reference(o.id) : digestValue(o.id), revision: o.revision };
|
|
54
|
+
}
|
|
55
|
+
function segments(value, root) {
|
|
56
|
+
if (!Array.isArray(value) || !root && value.length === 0)
|
|
57
|
+
return fail();
|
|
58
|
+
if (value.length > 32)
|
|
59
|
+
fail("limit-exceeded");
|
|
60
|
+
let bytes = 0;
|
|
61
|
+
return value.map((s, i) => {
|
|
62
|
+
const segment = stringValue(s);
|
|
63
|
+
const size = Buffer.byteLength(segment);
|
|
64
|
+
if (size > 255)
|
|
65
|
+
fail("limit-exceeded");
|
|
66
|
+
if (!segment || segment === "." || segment === ".." || /[/\\\x00]/.test(segment))
|
|
67
|
+
fail();
|
|
68
|
+
bytes += size + (i > 0 ? 1 : 0);
|
|
69
|
+
if (bytes > 4096)
|
|
70
|
+
fail("limit-exceeded");
|
|
71
|
+
return segment;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function validatedInput(value) {
|
|
75
|
+
const o = object(value, ["steps"]);
|
|
76
|
+
if (!Array.isArray(o.steps) || o.steps.length === 0)
|
|
77
|
+
return fail();
|
|
78
|
+
if (o.steps.length > WORKER_CONTRACT.maxSteps)
|
|
79
|
+
fail("limit-exceeded");
|
|
80
|
+
let bounded = 0, total = 0;
|
|
81
|
+
const steps = o.steps.map((value) => {
|
|
82
|
+
const s = object(value, ["action", "segments"], ["limit", "maxBytes"]);
|
|
83
|
+
switch (s.action) {
|
|
84
|
+
case "nas.files.list":
|
|
85
|
+
if (!positive(s.limit) || Object.hasOwn(s, "maxBytes"))
|
|
86
|
+
return fail();
|
|
87
|
+
if (s.limit > 200)
|
|
88
|
+
fail("limit-exceeded");
|
|
89
|
+
return { action: s.action, segments: segments(s.segments, true), limit: s.limit };
|
|
90
|
+
case "nas.files.stat":
|
|
91
|
+
if (Object.hasOwn(s, "limit") || Object.hasOwn(s, "maxBytes"))
|
|
92
|
+
fail();
|
|
93
|
+
return { action: s.action, segments: segments(s.segments, true) };
|
|
94
|
+
case "nas.files.read":
|
|
95
|
+
case "nas.files.read-stream": {
|
|
96
|
+
if (!positive(s.maxBytes) || Object.hasOwn(s, "limit"))
|
|
97
|
+
return fail();
|
|
98
|
+
const ceiling = s.action === "nas.files.read" ? 1 << 20 : 64 << 20;
|
|
99
|
+
if (s.maxBytes > ceiling)
|
|
100
|
+
fail("limit-exceeded");
|
|
101
|
+
total += s.maxBytes;
|
|
102
|
+
if (s.action === "nas.files.read")
|
|
103
|
+
bounded += s.maxBytes;
|
|
104
|
+
if (total > 64 << 20 || bounded > 1 << 20)
|
|
105
|
+
fail("limit-exceeded");
|
|
106
|
+
return { action: s.action, segments: segments(s.segments, false), maxBytes: s.maxBytes };
|
|
107
|
+
}
|
|
108
|
+
default: return fail("unsupported");
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
const input = { steps };
|
|
112
|
+
if (encodeInput(input, "0".repeat(64)).byteLength > WORKER_CONTRACT.maxInputBytes)
|
|
113
|
+
fail("limit-exceeded");
|
|
114
|
+
return input;
|
|
115
|
+
}
|
|
116
|
+
export function decodeWorkerInput(raw) {
|
|
117
|
+
return validatedInput(strictJSON(raw, WORKER_CONTRACT.maxInputBytes));
|
|
118
|
+
}
|
|
119
|
+
// Identical to Go input v1: domain NUL, 32 schema bytes, big-endian counts,
|
|
120
|
+
// length-prefixed UTF-8 strings, and one uint64 action parameter per step.
|
|
121
|
+
function encodeInput(input, schemaDigest) {
|
|
122
|
+
const chunks = [Buffer.from("synopkgland/m3/input/v1\0"), Buffer.from(schemaDigest, "hex")];
|
|
123
|
+
const u32 = (n) => { const b = Buffer.alloc(4); b.writeUInt32BE(n); chunks.push(b); };
|
|
124
|
+
const text = (s) => { const b = Buffer.from(s); u32(b.byteLength); chunks.push(b); };
|
|
125
|
+
u32(input.steps.length);
|
|
126
|
+
for (const step of input.steps) {
|
|
127
|
+
text(step.action);
|
|
128
|
+
u32(step.segments.length);
|
|
129
|
+
for (const segment of step.segments)
|
|
130
|
+
text(segment);
|
|
131
|
+
const b = Buffer.alloc(8);
|
|
132
|
+
b.writeBigUInt64BE(BigInt("limit" in step ? step.limit : "maxBytes" in step ? step.maxBytes : 0));
|
|
133
|
+
chunks.push(b);
|
|
134
|
+
}
|
|
135
|
+
return Buffer.concat(chunks);
|
|
136
|
+
}
|
|
137
|
+
export function workerInputDigest(input, schemaDigest) {
|
|
138
|
+
digestValue(schemaDigest);
|
|
139
|
+
return createHash("sha256").update(encodeInput(validatedInput(input), schemaDigest)).digest("hex");
|
|
140
|
+
}
|
|
141
|
+
function validatedBinding(value) {
|
|
142
|
+
const b = object(value, ["inventory", "jobSchema", "epoch", "job", "worker", "parentGrant", "approvalBinding", "capabilityDigest", "inputSchemaDigest", "inputDigest", "mode"], ["delegation"]);
|
|
143
|
+
const i = object(b.inventory, ["package", "version", "protocol", "payloadDigest", "registryDigest", "dataAccess"]);
|
|
144
|
+
if (i.protocol !== 2 || b.jobSchema !== 1 || i.dataAccess !== "relaxed")
|
|
145
|
+
fail("incompatible");
|
|
146
|
+
const packageId = stringValue(i.package), version = stringValue(i.version);
|
|
147
|
+
if (!/^[A-Za-z][A-Za-z0-9]{1,63}$/.test(packageId) || !/^\d+(\.\d+){0,3}-\d{4}$/.test(version))
|
|
148
|
+
fail();
|
|
149
|
+
const base = {
|
|
150
|
+
inventory: { package: packageId, version, protocol: 2, payloadDigest: digestValue(i.payloadDigest), registryDigest: digestValue(i.registryDigest), dataAccess: "relaxed" },
|
|
151
|
+
jobSchema: 1, epoch: digestValue(b.epoch), job: revisionRef(b.job), worker: revisionRef(b.worker, true), parentGrant: revisionRef(b.parentGrant),
|
|
152
|
+
approvalBinding: digestValue(b.approvalBinding), capabilityDigest: digestValue(b.capabilityDigest), inputSchemaDigest: digestValue(b.inputSchemaDigest), inputDigest: digestValue(b.inputDigest),
|
|
153
|
+
};
|
|
154
|
+
if (b.mode === "interactive") {
|
|
155
|
+
if (Object.hasOwn(b, "delegation"))
|
|
156
|
+
fail();
|
|
157
|
+
return { ...base, mode: "interactive" };
|
|
158
|
+
}
|
|
159
|
+
if (b.mode === "background")
|
|
160
|
+
return { ...base, mode: "background", delegation: revisionRef(b.delegation) };
|
|
161
|
+
return fail("incompatible");
|
|
162
|
+
}
|
|
163
|
+
export function decodeWorkerControl(raw) {
|
|
164
|
+
const r = object(strictJSON(raw, WORKER_CONTRACT.maxControlBytes), ["op", "binding", "intent", "nonce", "ticket"]);
|
|
165
|
+
const binding = validatedBinding(r.binding);
|
|
166
|
+
if (r.op !== "jobs.submit" && r.op !== "jobs.cancel" && r.op !== "background.revoke")
|
|
167
|
+
fail("unsupported");
|
|
168
|
+
if (r.op === "background.revoke" && binding.mode !== "background")
|
|
169
|
+
fail("incompatible");
|
|
170
|
+
return { op: r.op, binding, intent: revisionRef(r.intent), nonce: digestValue(r.nonce), ticket: digestValue(r.ticket) };
|
|
171
|
+
}
|
|
172
|
+
export function compareWorkerBinding(got, expected) {
|
|
173
|
+
if (!isDeepStrictEqual(validatedBinding(got), validatedBinding(expected)))
|
|
174
|
+
fail("incompatible");
|
|
175
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type WorkerAction, type WorkerDescriptor, type WorkerLimits, type WorkerMode, type WorkerSafeReason } from "./worker-contract.js";
|
|
2
|
+
export interface SDKWorkerConfig {
|
|
3
|
+
kind: "sdk-read-plan";
|
|
4
|
+
workerRevision: number;
|
|
5
|
+
actions: WorkerAction[];
|
|
6
|
+
modes: WorkerMode[];
|
|
7
|
+
limits: WorkerLimits;
|
|
8
|
+
}
|
|
9
|
+
export interface SDKRegistry {
|
|
10
|
+
registrySchema: 2;
|
|
11
|
+
productionAvailability: "unavailable";
|
|
12
|
+
inert: {
|
|
13
|
+
id: string;
|
|
14
|
+
digest: string;
|
|
15
|
+
}[];
|
|
16
|
+
sdk: WorkerDescriptor[];
|
|
17
|
+
}
|
|
18
|
+
export interface WorkerSourceBindings {
|
|
19
|
+
handlerBinding: string;
|
|
20
|
+
inputSchemaDigest: string;
|
|
21
|
+
outputSchemaDigest: string;
|
|
22
|
+
}
|
|
23
|
+
export interface WorkerResult {
|
|
24
|
+
resultSchema: 1;
|
|
25
|
+
completedSteps: number;
|
|
26
|
+
entries: number;
|
|
27
|
+
bytesRead: number;
|
|
28
|
+
safeReason?: WorkerSafeReason;
|
|
29
|
+
}
|
|
30
|
+
/** Manifest metadata only; never accepts a source path or a caller-chosen digest. */
|
|
31
|
+
export declare function parseSDKWorkers(value: unknown, inertIDs?: readonly string[]): Record<string, SDKWorkerConfig>;
|
|
32
|
+
/** Must match jobcontract/bindings.go; filenames and exact source bytes are bound. */
|
|
33
|
+
export declare function sourceWorkerBindings(backend: string): WorkerSourceBindings;
|
|
34
|
+
export declare function buildWorkerRegistry(inert: readonly {
|
|
35
|
+
id: string;
|
|
36
|
+
digest: string;
|
|
37
|
+
}[], sdkWorkers: Record<string, SDKWorkerConfig> | undefined, backend: string): string;
|
|
38
|
+
/** Structural/artifact inspection only; the compiled Go consumer checks source bindings. */
|
|
39
|
+
export declare function decodeSDKRegistry(raw: string | Uint8Array): SDKRegistry;
|
|
40
|
+
export declare function decodeWorkerResult(raw: string | Uint8Array): WorkerResult;
|