@highstate/backend 0.16.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/dist/{chunk-4JUMOKLV.js → chunk-JT4KWE3B.js} +10 -8
  2. package/dist/chunk-JT4KWE3B.js.map +1 -0
  3. package/dist/{chunk-VB4YL327.js → chunk-X2WG3WGL.js} +9 -2
  4. package/dist/chunk-X2WG3WGL.js.map +1 -0
  5. package/dist/highstate.manifest.json +4 -5
  6. package/dist/index.js +256 -287
  7. package/dist/index.js.map +1 -1
  8. package/dist/library/worker/main.js +1 -1
  9. package/dist/shared/index.js +1 -1
  10. package/package.json +9 -10
  11. package/prisma/backend/postgresql/main.prisma +0 -2
  12. package/prisma/backend/sqlite/main.prisma +0 -2
  13. package/prisma/project/instance.prisma +12 -0
  14. package/prisma/project/main.prisma +0 -1
  15. package/prisma/project/migrations/20260123000000_add_instance_state_self_hash/migration.sql +2 -0
  16. package/src/business/instance-state.test.ts +1 -0
  17. package/src/business/instance-state.ts +3 -0
  18. package/src/business/project.ts +1 -2
  19. package/src/common/utils.ts +9 -0
  20. package/src/database/_generated/backend/postgresql/browser.ts +54 -0
  21. package/src/database/_generated/backend/postgresql/client.ts +7 -8
  22. package/src/database/_generated/backend/postgresql/commonInputTypes.ts +3 -2
  23. package/src/database/_generated/backend/postgresql/enums.ts +3 -1
  24. package/src/database/_generated/backend/postgresql/internal/class.ts +24 -71
  25. package/src/database/_generated/backend/postgresql/internal/prismaNamespace.ts +41 -43
  26. package/src/database/_generated/backend/postgresql/internal/prismaNamespaceBrowser.ts +191 -0
  27. package/src/database/_generated/backend/postgresql/models/BackendUnlockMethod.ts +12 -11
  28. package/src/database/_generated/backend/postgresql/models/Library.ts +29 -28
  29. package/src/database/_generated/backend/postgresql/models/Project.ts +69 -68
  30. package/src/database/_generated/backend/postgresql/models/ProjectModelStorage.ts +29 -28
  31. package/src/database/_generated/backend/postgresql/models/ProjectSpace.ts +26 -25
  32. package/src/database/_generated/backend/postgresql/models/PulumiBackend.ts +29 -28
  33. package/src/database/_generated/backend/postgresql/models/UserWorkspaceLayout.ts +12 -11
  34. package/src/database/_generated/backend/postgresql/models.ts +2 -1
  35. package/src/database/_generated/backend/postgresql/pjtg.ts +1 -0
  36. package/src/database/_generated/backend/sqlite/browser.ts +54 -0
  37. package/src/database/_generated/backend/sqlite/client.ts +7 -8
  38. package/src/database/_generated/backend/sqlite/commonInputTypes.ts +3 -2
  39. package/src/database/_generated/backend/sqlite/enums.ts +3 -1
  40. package/src/database/_generated/backend/sqlite/internal/class.ts +24 -71
  41. package/src/database/_generated/backend/sqlite/internal/prismaNamespace.ts +41 -43
  42. package/src/database/_generated/backend/sqlite/internal/prismaNamespaceBrowser.ts +188 -0
  43. package/src/database/_generated/backend/sqlite/models/BackendUnlockMethod.ts +12 -11
  44. package/src/database/_generated/backend/sqlite/models/Library.ts +29 -28
  45. package/src/database/_generated/backend/sqlite/models/Project.ts +69 -68
  46. package/src/database/_generated/backend/sqlite/models/ProjectModelStorage.ts +29 -28
  47. package/src/database/_generated/backend/sqlite/models/ProjectSpace.ts +26 -25
  48. package/src/database/_generated/backend/sqlite/models/PulumiBackend.ts +29 -28
  49. package/src/database/_generated/backend/sqlite/models/UserWorkspaceLayout.ts +12 -11
  50. package/src/database/_generated/backend/sqlite/models.ts +2 -1
  51. package/src/database/_generated/backend/sqlite/pjtg.ts +1 -0
  52. package/src/database/_generated/project/browser.ts +1 -0
  53. package/src/database/_generated/project/client.ts +4 -5
  54. package/src/database/_generated/project/commonInputTypes.ts +1 -0
  55. package/src/database/_generated/project/enums.ts +1 -0
  56. package/src/database/_generated/project/internal/class.ts +21 -63
  57. package/src/database/_generated/project/internal/prismaNamespace.ts +41 -36
  58. package/src/database/_generated/project/internal/prismaNamespaceBrowser.ts +10 -6
  59. package/src/database/_generated/project/models/ApiKey.ts +1 -0
  60. package/src/database/_generated/project/models/Artifact.ts +1 -0
  61. package/src/database/_generated/project/models/HubModel.ts +1 -0
  62. package/src/database/_generated/project/models/InstanceCustomStatus.ts +1 -0
  63. package/src/database/_generated/project/models/InstanceEvaluationState.ts +1 -0
  64. package/src/database/_generated/project/models/InstanceLock.ts +1 -0
  65. package/src/database/_generated/project/models/InstanceModel.ts +1 -0
  66. package/src/database/_generated/project/models/InstanceOperationState.ts +1 -0
  67. package/src/database/_generated/project/models/InstanceState.ts +108 -1
  68. package/src/database/_generated/project/models/Operation.ts +1 -0
  69. package/src/database/_generated/project/models/OperationLog.ts +1 -0
  70. package/src/database/_generated/project/models/Page.ts +1 -0
  71. package/src/database/_generated/project/models/Secret.ts +1 -0
  72. package/src/database/_generated/project/models/ServiceAccount.ts +1 -0
  73. package/src/database/_generated/project/models/Terminal.ts +1 -0
  74. package/src/database/_generated/project/models/TerminalSession.ts +1 -0
  75. package/src/database/_generated/project/models/TerminalSessionLog.ts +1 -0
  76. package/src/database/_generated/project/models/Trigger.ts +1 -0
  77. package/src/database/_generated/project/models/UnlockMethod.ts +1 -0
  78. package/src/database/_generated/project/models/UserCompositeViewport.ts +1 -0
  79. package/src/database/_generated/project/models/UserProjectViewport.ts +1 -0
  80. package/src/database/_generated/project/models/Worker.ts +1 -0
  81. package/src/database/_generated/project/models/WorkerUnitRegistration.ts +1 -0
  82. package/src/database/_generated/project/models/WorkerVersion.ts +1 -0
  83. package/src/database/_generated/project/models/WorkerVersionLog.ts +1 -0
  84. package/src/database/_generated/project/models.ts +1 -0
  85. package/src/database/abstractions.ts +1 -7
  86. package/src/database/index.ts +1 -0
  87. package/src/database/local/backend.ts +19 -30
  88. package/src/database/local/project.ts +4 -9
  89. package/src/database/manager.ts +28 -34
  90. package/src/database/migration.ts +126 -0
  91. package/src/orchestrator/operation.cancel.test.ts +112 -0
  92. package/src/orchestrator/operation.composite.test.ts +123 -0
  93. package/src/orchestrator/operation.destroy.test.ts +77 -0
  94. package/src/orchestrator/operation.preview.test.ts +95 -0
  95. package/src/orchestrator/operation.refresh.test.ts +77 -0
  96. package/src/orchestrator/operation.test-utils.ts +646 -0
  97. package/src/orchestrator/operation.ts +91 -3
  98. package/src/orchestrator/operation.update.failure.test.ts +88 -0
  99. package/src/orchestrator/operation.update.skip.test.ts +95 -0
  100. package/src/orchestrator/operation.update.test.ts +117 -0
  101. package/src/orchestrator/plan-test-builder.ts +1 -0
  102. package/src/runner/abstractions.ts +5 -0
  103. package/src/runner/local.ts +1 -0
  104. package/src/shared/resolvers/input-hash.ts +10 -6
  105. package/src/terminal/manager.ts +0 -3
  106. package/src/test-utils/database.ts +28 -14
  107. package/dist/chunk-4JUMOKLV.js.map +0 -1
  108. package/dist/chunk-VB4YL327.js.map +0 -1
  109. package/dist/database/local/prisma.config.js +0 -26
  110. package/dist/database/local/prisma.config.js.map +0 -1
  111. package/src/database/local/prisma.config.ts +0 -25
  112. package/src/database/migrate.ts +0 -35
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { AccessError, BackendUnlockMethodNotFoundError, CannotDeleteLastBackendUnlockMethodError, InstanceLockLostError, globalProjectSpace, codebaseLibrary, hostPulumiBackend, codebaseProjectModelStorage, databaseProjectModelStorage, ProjectLockedError, ProjectNotFoundError, BackendError, forSchema, projectOutputSchema, InstanceStateNotFoundError, InstanceLockedError, waitAll, OperationNotFoundError, InputResolver, CannotDeleteLastUnlockMethodError, InvalidInstanceKindError, operationOutputSchema, terminalOutputSchema, toTerminalOutput, terminalDetailsOutputSchema, toTerminalDetailsOutput, serviceAccountOutputSchema, apiKeyOutputSchema, toApiKeyOutput, workerOutputSchema, toWorkerOutput, workerVersionOutputSchema, toWorkerVersionOutput, pageDetailsOutputSchema, toPageOutput, secretOutputSchema, toSecretOutput, artifactOutputSchema, triggerOutputSchema, unlockMethodOutputSchema, pageOutputSchema, toTerminalSessionOutput, extractDigestFromImage, getWorkerIdentity, WorkerVersionNotFoundError, createAsyncBatcher, operationOptionsSchema, finalOperationStatuses, finalInstanceOperationStatuses, diffLibraries, isTransientInstanceOperationStatus, InputHashResolver, PromiseTracker, workerUnitRegistrationEventSchema, terminalSessionOutputSchema, operationEventSchema, projectModelEventSchema, instanceLockEventSchema, instanceStateEventSchema, projectUnlockStateSchema, isVirtualGhostInstance } from './chunk-4JUMOKLV.js';
2
- import { codebaseConfig, stringArrayType, createProjectLogger, isAbortErrorLike, getCodebaseHighstatePath, resolveMainLocalProject, errorToString, AbortError, waitForAbort, renderTree, runWithRetryOnError } from './chunk-VB4YL327.js';
1
+ import { AccessError, BackendUnlockMethodNotFoundError, CannotDeleteLastBackendUnlockMethodError, InstanceLockLostError, BackendError, globalProjectSpace, codebaseLibrary, hostPulumiBackend, codebaseProjectModelStorage, databaseProjectModelStorage, ProjectLockedError, ProjectNotFoundError, forSchema, projectOutputSchema, InstanceStateNotFoundError, InstanceLockedError, waitAll, OperationNotFoundError, InputResolver, CannotDeleteLastUnlockMethodError, InvalidInstanceKindError, operationOutputSchema, terminalOutputSchema, toTerminalOutput, terminalDetailsOutputSchema, toTerminalDetailsOutput, serviceAccountOutputSchema, apiKeyOutputSchema, toApiKeyOutput, workerOutputSchema, toWorkerOutput, workerVersionOutputSchema, toWorkerVersionOutput, pageDetailsOutputSchema, toPageOutput, secretOutputSchema, toSecretOutput, artifactOutputSchema, triggerOutputSchema, unlockMethodOutputSchema, pageOutputSchema, toTerminalSessionOutput, extractDigestFromImage, getWorkerIdentity, WorkerVersionNotFoundError, createAsyncBatcher, operationOptionsSchema, finalOperationStatuses, finalInstanceOperationStatuses, diffLibraries, isTransientInstanceOperationStatus, InputHashResolver, PromiseTracker, workerUnitRegistrationEventSchema, terminalSessionOutputSchema, operationEventSchema, projectModelEventSchema, instanceLockEventSchema, instanceStateEventSchema, projectUnlockStateSchema, isVirtualGhostInstance } from './chunk-JT4KWE3B.js';
2
+ import { codebaseConfig, stringArrayType, createProjectLogger, isAbortErrorLike, getCodebaseHighstatePath, resolveMainLocalProject, errorToString, AbortError, waitForAbort, renderTree, runWithRetryOnError } from './chunk-X2WG3WGL.js';
3
3
  import { __using, __callDispose } from './chunk-I7BWSAN6.js';
4
4
  import { randomBytes, createHash } from 'node:crypto';
5
5
  import { createId } from '@paralleldrive/cuid2';
@@ -8,17 +8,15 @@ import { omit, isNonNullish, groupBy, mapValues, unique, join as join$1, omitBy
8
8
  import z4, { z } from 'zod';
9
9
  import * as os from 'node:os';
10
10
  import { tmpdir, hostname } from 'node:os';
11
- import { PrismaLibSQL } from '@prisma/adapter-libsql';
11
+ import { PrismaLibSql } from '@prisma/adapter-libsql';
12
12
  import { generateIdentity, armor, Decrypter, Encrypter, identityToRecipient } from 'age-encryption';
13
13
  import * as path4 from 'node:path';
14
- import path4__default, { join, resolve as resolve$1, dirname, isAbsolute } from 'node:path';
14
+ import path4__default, { join, dirname, resolve as resolve$1, isAbsolute } from 'node:path';
15
15
  import { fileURLToPath } from 'node:url';
16
- import * as runtime2 from '@prisma/client/runtime/client';
16
+ import * as runtime8 from '@prisma/client/runtime/client';
17
17
  import { PrismaClientKnownRequestError } from '@prisma/client/runtime/client';
18
- import { execa } from 'execa';
19
- import { resolve } from 'import-meta-resolve';
20
- import { detectPackageManager, runScript, addDependency, ensureDependencyInstalled } from 'nypm';
21
18
  import { readFile, mkdir, writeFile, access, unlink, readdir, rm, mkdtemp } from 'node:fs/promises';
19
+ import { resolve } from 'import-meta-resolve';
22
20
  import { findCredentialsAsync, AsyncEntry } from '@napi-rs/keyring';
23
21
  import { stringify, parse } from 'yaml';
24
22
  import { LRUCache } from 'lru-cache';
@@ -31,12 +29,14 @@ import { EventEmitter, on } from 'node:events';
31
29
  import { Worker } from 'node:worker_threads';
32
30
  import { decode, encode } from '@msgpack/msgpack';
33
31
  import { glob } from 'glob';
32
+ import { runScript, addDependency, ensureDependencyInstalled } from 'nypm';
34
33
  import PQueue from 'p-queue';
35
34
  import { readPackageJSON, resolvePackageJSON } from 'pkg-types';
36
35
  import Watcher from 'watcher';
37
36
  import { crc32 } from 'node:zlib';
38
37
  import { sha256 } from '@noble/hashes/sha2';
39
38
  import { pipeline } from 'node:stream/promises';
39
+ import { execa } from 'execa';
40
40
  import { PassThrough, Readable } from 'node:stream';
41
41
  import spawn from 'nano-spawn';
42
42
  import { v7 } from 'uuid';
@@ -576,122 +576,131 @@ var InstanceLockService = class {
576
576
  }
577
577
  }
578
578
  };
579
-
580
- // src/database/abstractions.ts
581
- var backendDatabaseVersion = 1;
582
- var projectDatabaseVersion = 1;
583
579
  var config = {
584
- "generator": {
585
- "name": "client",
586
- "provider": {
587
- "fromEnvVar": null,
588
- "value": "prisma-client"
589
- },
590
- "output": {
591
- "value": "/home/exeteres/Projects/personal/highstate/packages/platform/backend/src/database/_generated/backend/sqlite",
592
- "fromEnvVar": null
593
- },
594
- "config": {
595
- "moduleFormat": "esm",
596
- "generatedFileExtension": "ts",
597
- "importFileExtension": "ts",
598
- "engineType": "client"
599
- },
600
- "binaryTargets": [
601
- {
602
- "fromEnvVar": null,
603
- "value": "linux-nixos",
604
- "native": true
605
- }
606
- ],
607
- "previewFeatures": [
608
- "driverAdapters",
609
- "queryCompiler"
610
- ],
611
- "sourceFilePath": "/home/exeteres/Projects/personal/highstate/packages/platform/backend/prisma/backend/sqlite/main.prisma",
612
- "isCustomOutput": true
613
- },
614
- "relativePath": "../../../../../prisma/backend/sqlite",
615
- "clientVersion": "6.14.0",
616
- "engineVersion": "717184b7b35ea05dfa71a3236b7af656013e1e49",
617
- "datasourceNames": [
618
- "db"
619
- ],
580
+ "previewFeatures": [],
581
+ "clientVersion": "7.3.0",
582
+ "engineVersion": "9d6ad21cbbceab97458517b147a6a09ff43aa735",
620
583
  "activeProvider": "sqlite",
621
- "postinstall": false,
622
- "inlineDatasources": {
623
- "db": {
624
- "url": {
625
- "fromEnvVar": "HIGHSTATE_MIGRATION_DATABASE_URL",
626
- "value": null
627
- }
628
- }
629
- },
630
- "inlineSchema": 'model UserWorkspaceLayout {\n /// The opaque ID of the user to which this layout belongs.\n userId String @id\n\n /// The layout of the user workspace managed by the frontend.\n ///\n /// ![unknown]\n layout Json\n}\n\nmodel Library {\n /// The CUIDv2 of the library.\n id String @id @default(cuid(2))\n\n /// The metadata of the library managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The spec of the library.\n ///\n /// [LibrarySpec]\n spec Json\n\n /// The projects using this library.\n projects Project[]\n}\n\nmodel Project {\n /// The CUIDv2 of the project.\n id String @id @default(cuid(2))\n\n /// Project meta managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The name of the project within the space.\n name String\n\n /// The ID of the project space this project belongs to.\n spaceId String\n\n /// The ID of the project model storage this project uses.\n modelStorageId String\n\n /// The ID of the library used by this project.\n libraryId String\n\n /// The ID of the Pulumi backend used by this project.\n pulumiBackendId String\n\n /// Encrypted project master key in AGE format.\n encryptedMasterKey String\n\n /// The unlock suite for this project.\n ///\n /// [ProjectUnlockSuite]\n unlockSuite Json\n\n /// The current version of the project database.\n /// This is used to determine if the project needs to be migrated.\n databaseVersion Int\n\n /// The time when the project was created.\n createdAt DateTime @default(now())\n\n /// The time when the project was last updated.\n updatedAt DateTime @updatedAt\n\n /// The project space this project belongs to.\n space ProjectSpace @relation(fields: [spaceId], references: [id])\n\n /// The project model storage this project uses.\n modelStorage ProjectModelStorage @relation(fields: [modelStorageId], references: [id])\n\n /// The library used by this project.\n library Library @relation(fields: [libraryId], references: [id])\n\n /// The Pulumi backend used by this project.\n pulumiBackend PulumiBackend @relation(fields: [pulumiBackendId], references: [id])\n\n @@unique([spaceId, name])\n}\n\nmodel ProjectSpace {\n /// The CUIDv2 of the project space.\n id String @id @default(cuid(2))\n\n /// The name of the project space within the parent space.\n ///\n /// Will be null for the global project space.\n name String?\n\n /// The ID of the parent project space, if any.\n parentId String?\n\n /// The metadata of the project space managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The projects in this project space.\n projects Project[]\n\n /// The parent project space, if any.\n parent ProjectSpace? @relation("ProjectSpaceHierarchy", fields: [parentId], references: [id])\n\n /// The child project spaces, if any.\n children ProjectSpace[] @relation("ProjectSpaceHierarchy")\n\n @@unique([parentId, name])\n}\n\nmodel ProjectModelStorage {\n /// The CUIDv2 of the project model storage.\n id String @id @default(cuid(2))\n\n /// The metadata of the project model storage managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The specification of the project model storage.\n ///\n /// [ProjectModelStorageSpec]\n spec Json\n\n /// The projects using this model storage.\n projects Project[]\n}\n\nmodel PulumiBackend {\n /// The CUIDv2 of the Pulumi backend.\n id String @id @default(cuid(2))\n\n /// The backend meta managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The spec of the Pulumi backend.\n ///\n /// [PulumiBackendSpec]\n spec Json\n\n /// The projects using this backend.\n projects Project[]\n}\n\n/// Unlock methods describe trusted identities that can decrypt the backend master key.\nmodel BackendUnlockMethod {\n /// The CUIDv2 of the unlock method.\n id String @id @default(cuid(2))\n\n /// The metadata of the unlock method managed by the backend.\n /// \n /// [BackendUnlockMethodMeta]\n meta Json\n\n /// The AGE recipient for this unlock method.\n recipient String @unique\n\n /// The time when the unlock method was created.\n createdAt DateTime @default(now())\n\n /// The time when the unlock method was last updated.\n updatedAt DateTime @updatedAt\n}\n\ndatasource db {\n provider = "sqlite"\n url = env("HIGHSTATE_MIGRATION_DATABASE_URL")\n}\n\ngenerator client {\n provider = "prisma-client"\n previewFeatures = ["queryCompiler", "driverAdapters"]\n output = "../../../src/database/_generated/backend/sqlite"\n moduleFormat = "esm"\n generatedFileExtension = "ts"\n importFileExtension = "ts"\n}\n\ngenerator json {\n provider = "prisma-json-types-generator"\n}\n',
631
- "inlineSchemaHash": "a1ceaf17c7e387f39b598365de3b12cae9e6d31f021d9ab4f958f2c85bb34129",
632
- "copyEngine": true,
584
+ "inlineSchema": 'model UserWorkspaceLayout {\n /// The opaque ID of the user to which this layout belongs.\n userId String @id\n\n /// The layout of the user workspace managed by the frontend.\n ///\n /// ![unknown]\n layout Json\n}\n\nmodel Library {\n /// The CUIDv2 of the library.\n id String @id @default(cuid(2))\n\n /// The metadata of the library managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The spec of the library.\n ///\n /// [LibrarySpec]\n spec Json\n\n /// The projects using this library.\n projects Project[]\n}\n\nmodel Project {\n /// The CUIDv2 of the project.\n id String @id @default(cuid(2))\n\n /// Project meta managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The name of the project within the space.\n name String\n\n /// The ID of the project space this project belongs to.\n spaceId String\n\n /// The ID of the project model storage this project uses.\n modelStorageId String\n\n /// The ID of the library used by this project.\n libraryId String\n\n /// The ID of the Pulumi backend used by this project.\n pulumiBackendId String\n\n /// Encrypted project master key in AGE format.\n encryptedMasterKey String\n\n /// The unlock suite for this project.\n ///\n /// [ProjectUnlockSuite]\n unlockSuite Json\n\n /// The current version of the project database.\n /// This is used to determine if the project needs to be migrated.\n databaseVersion Int\n\n /// The time when the project was created.\n createdAt DateTime @default(now())\n\n /// The time when the project was last updated.\n updatedAt DateTime @updatedAt\n\n /// The project space this project belongs to.\n space ProjectSpace @relation(fields: [spaceId], references: [id])\n\n /// The project model storage this project uses.\n modelStorage ProjectModelStorage @relation(fields: [modelStorageId], references: [id])\n\n /// The library used by this project.\n library Library @relation(fields: [libraryId], references: [id])\n\n /// The Pulumi backend used by this project.\n pulumiBackend PulumiBackend @relation(fields: [pulumiBackendId], references: [id])\n\n @@unique([spaceId, name])\n}\n\nmodel ProjectSpace {\n /// The CUIDv2 of the project space.\n id String @id @default(cuid(2))\n\n /// The name of the project space within the parent space.\n ///\n /// Will be null for the global project space.\n name String?\n\n /// The ID of the parent project space, if any.\n parentId String?\n\n /// The metadata of the project space managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The projects in this project space.\n projects Project[]\n\n /// The parent project space, if any.\n parent ProjectSpace? @relation("ProjectSpaceHierarchy", fields: [parentId], references: [id])\n\n /// The child project spaces, if any.\n children ProjectSpace[] @relation("ProjectSpaceHierarchy")\n\n @@unique([parentId, name])\n}\n\nmodel ProjectModelStorage {\n /// The CUIDv2 of the project model storage.\n id String @id @default(cuid(2))\n\n /// The metadata of the project model storage managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The specification of the project model storage.\n ///\n /// [ProjectModelStorageSpec]\n spec Json\n\n /// The projects using this model storage.\n projects Project[]\n}\n\nmodel PulumiBackend {\n /// The CUIDv2 of the Pulumi backend.\n id String @id @default(cuid(2))\n\n /// The backend meta managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The spec of the Pulumi backend.\n ///\n /// [PulumiBackendSpec]\n spec Json\n\n /// The projects using this backend.\n projects Project[]\n}\n\n/// Unlock methods describe trusted identities that can decrypt the backend master key.\nmodel BackendUnlockMethod {\n /// The CUIDv2 of the unlock method.\n id String @id @default(cuid(2))\n\n /// The metadata of the unlock method managed by the backend.\n /// \n /// [BackendUnlockMethodMeta]\n meta Json\n\n /// The AGE recipient for this unlock method.\n recipient String @unique\n\n /// The time when the unlock method was created.\n createdAt DateTime @default(now())\n\n /// The time when the unlock method was last updated.\n updatedAt DateTime @updatedAt\n}\n\ndatasource db {\n provider = "sqlite"\n}\n\ngenerator client {\n provider = "prisma-client"\n output = "../../../src/database/_generated/backend/sqlite"\n moduleFormat = "esm"\n generatedFileExtension = "ts"\n importFileExtension = "ts"\n}\n\ngenerator json {\n provider = "prisma-json-types-generator"\n}\n',
633
585
  "runtimeDataModel": {
634
586
  "models": {},
635
587
  "enums": {},
636
588
  "types": {}
637
- },
638
- "dirname": ""
589
+ }
639
590
  };
640
591
  config.runtimeDataModel = JSON.parse('{"models":{"UserWorkspaceLayout":{"fields":[{"name":"userId","kind":"scalar","type":"String"},{"name":"layout","kind":"scalar","type":"Json"}],"dbName":null},"Library":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"projects","kind":"object","type":"Project","relationName":"LibraryToProject"}],"dbName":null},"Project":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"name","kind":"scalar","type":"String"},{"name":"spaceId","kind":"scalar","type":"String"},{"name":"modelStorageId","kind":"scalar","type":"String"},{"name":"libraryId","kind":"scalar","type":"String"},{"name":"pulumiBackendId","kind":"scalar","type":"String"},{"name":"encryptedMasterKey","kind":"scalar","type":"String"},{"name":"unlockSuite","kind":"scalar","type":"Json"},{"name":"databaseVersion","kind":"scalar","type":"Int"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"space","kind":"object","type":"ProjectSpace","relationName":"ProjectToProjectSpace"},{"name":"modelStorage","kind":"object","type":"ProjectModelStorage","relationName":"ProjectToProjectModelStorage"},{"name":"library","kind":"object","type":"Library","relationName":"LibraryToProject"},{"name":"pulumiBackend","kind":"object","type":"PulumiBackend","relationName":"ProjectToPulumiBackend"}],"dbName":null},"ProjectSpace":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"parentId","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"projects","kind":"object","type":"Project","relationName":"ProjectToProjectSpace"},{"name":"parent","kind":"object","type":"ProjectSpace","relationName":"ProjectSpaceHierarchy"},{"name":"children","kind":"object","type":"ProjectSpace","relationName":"ProjectSpaceHierarchy"}],"dbName":null},"ProjectModelStorage":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"projects","kind":"object","type":"Project","relationName":"ProjectToProjectModelStorage"}],"dbName":null},"PulumiBackend":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"projects","kind":"object","type":"Project","relationName":"ProjectToPulumiBackend"}],"dbName":null},"BackendUnlockMethod":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"recipient","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"}],"dbName":null}},"enums":{},"types":{}}');
641
- config.engineWasm = void 0;
642
592
  async function decodeBase64AsWasm(wasmBase64) {
643
593
  const { Buffer: Buffer2 } = await import('node:buffer');
644
- const base64Data = wasmBase64.replace("data:application/wasm;base64,", "");
645
- const wasmArray = new Uint8Array(Buffer2.from(base64Data, "base64"));
594
+ const wasmArray = Buffer2.from(wasmBase64, "base64");
646
595
  return new WebAssembly.Module(wasmArray);
647
596
  }
648
597
  config.compilerWasm = {
649
- getRuntime: async () => await import('@prisma/client/runtime/query_compiler_bg.sqlite.mjs'),
598
+ getRuntime: async () => await import('@prisma/client/runtime/query_compiler_fast_bg.sqlite.mjs'),
650
599
  getQueryCompilerWasmModule: async () => {
651
- const { wasm } = await import('@prisma/client/runtime/query_compiler_bg.sqlite.wasm-base64.mjs');
600
+ const { wasm } = await import('@prisma/client/runtime/query_compiler_fast_bg.sqlite.wasm-base64.mjs');
652
601
  return await decodeBase64AsWasm(wasm);
653
- }
602
+ },
603
+ importName: "./query_compiler_fast_bg.js"
654
604
  };
655
- function getPrismaClientClass(dirname5) {
656
- config.dirname = dirname5;
657
- return runtime2.getPrismaClient(config);
605
+ function getPrismaClientClass() {
606
+ return runtime8.getPrismaClient(config);
658
607
  }
659
- runtime2.Public.validator;
660
- runtime2.Extensions.getExtensionContext;
608
+ runtime8.Extensions.getExtensionContext;
661
609
  ({
662
- DbNull: runtime2.objectEnumValues.classes.DbNull,
663
- JsonNull: runtime2.objectEnumValues.classes.JsonNull,
664
- AnyNull: runtime2.objectEnumValues.classes.AnyNull
610
+ DbNull: runtime8.NullTypes.DbNull,
611
+ JsonNull: runtime8.NullTypes.JsonNull,
612
+ AnyNull: runtime8.NullTypes.AnyNull
665
613
  });
666
- runtime2.objectEnumValues.instances.DbNull;
667
- runtime2.objectEnumValues.instances.JsonNull;
668
- runtime2.objectEnumValues.instances.AnyNull;
669
- runtime2.makeStrictEnum({
614
+ runtime8.makeStrictEnum({
670
615
  Serializable: "Serializable"
671
616
  });
672
- runtime2.Extensions.defineExtension;
617
+ runtime8.Extensions.defineExtension;
673
618
 
674
619
  // src/database/_generated/backend/sqlite/client.ts
675
- var __dirname2 = path4.dirname(fileURLToPath(import.meta.url));
676
- var PrismaClient = getPrismaClientClass(__dirname2);
677
- async function migrateDatabase(databaseUrl, schemaPath, masterKey, logger) {
678
- logger.info("applying database migrations");
620
+ globalThis["__dirname"] = path4.dirname(fileURLToPath(import.meta.url));
621
+ var PrismaClient = getPrismaClientClass();
622
+ var migrationPacks = {
623
+ "backend/sqlite": {
624
+ type: "backend",
625
+ schemaPath: "backend/sqlite",
626
+ migrationNames: [
627
+ //
628
+ "20250928124105_initial_migration"
629
+ ]
630
+ },
631
+ project: {
632
+ type: "project",
633
+ schemaPath: "project",
634
+ migrationNames: [
635
+ //
636
+ "20250928130725_initial_migration",
637
+ "20260123000000_add_instance_state_self_hash"
638
+ ]
639
+ }
640
+ };
641
+ var backendDatabaseVersion = migrationPacks["backend/sqlite"].migrationNames.length;
642
+ var projectDatabaseVersion = migrationPacks.project.migrationNames.length;
643
+ async function migrateDatabase(client, migrationPack, currentVersion, writeVersion, logger) {
644
+ const { type, schemaPath, migrationNames } = migrationPack;
645
+ const targetVersion = migrationNames.length;
679
646
  const backendIndexPath = resolve("@highstate/backend", import.meta.url);
680
- const backendRootPath = join(fileURLToPath(backendIndexPath), "..");
681
- const packageManager = await detectPackageManager(backendRootPath);
682
- if (!packageManager) {
683
- throw new Error("Could not detect package manager to run migrations");
684
- }
685
- const hasCorepack = await execa`"corepack" --version`.then(() => true).catch(() => false);
686
- const command = hasCorepack ? `corepack ${packageManager.command}` : packageManager.command;
687
- await execa({
688
- cwd: backendRootPath,
689
- env: {
690
- HIGHSTATE_MIGRATION_DATABASE_SCHEMA_PATH: schemaPath,
691
- HIGHSTATE_MIGRATION_DATABASE_URL: databaseUrl,
692
- HIGHSTATE_MIGRATION_DATABASE_ENCRYPTION_KEY: masterKey ?? ""
693
- }
694
- })`${command} migrate`;
647
+ const backendRootPath = join(dirname(fileURLToPath(backendIndexPath)), "..");
648
+ const migrationsDir = resolve$1(backendRootPath, `prisma`, schemaPath, "migrations");
649
+ logger.debug(`migrations dir: "%s"`, migrationsDir);
650
+ if (currentVersion > targetVersion) {
651
+ throw new BackendError(
652
+ `The version of the ${type} database (${currentVersion}) is newer than expected (${targetVersion}). Do you need to upgrade Highstate?`
653
+ );
654
+ }
655
+ for (let version = currentVersion; version < migrationNames.length; version++) {
656
+ const nextVersion = version + 1;
657
+ const nextMigrationName = migrationNames[nextVersion - 1];
658
+ logger.info(
659
+ `applying migration for %s database, %d -> %d: %s`,
660
+ type,
661
+ version,
662
+ nextVersion,
663
+ nextMigrationName
664
+ );
665
+ const migrationPath = join(migrationsDir, nextMigrationName, "migration.sql");
666
+ const content = await readFile(migrationPath, "utf-8");
667
+ const statements = splitToStatements(content);
668
+ await client.$transaction(async (tx) => {
669
+ for (const statement of statements) {
670
+ await tx.$executeRawUnsafe(statement);
671
+ }
672
+ await writeVersion(nextVersion);
673
+ });
674
+ }
675
+ logger.info(`database is up to date at version %d`, migrationNames.length);
676
+ }
677
+ function splitToStatements(sql) {
678
+ const statements = [];
679
+ let currentStatement = "";
680
+ let insideString = false;
681
+ let stringChar = "";
682
+ for (let i = 0; i < sql.length; i++) {
683
+ const char = sql[i];
684
+ if ((char === "'" || char === '"') && !insideString) {
685
+ insideString = true;
686
+ stringChar = char;
687
+ } else if (char === stringChar && insideString) {
688
+ insideString = false;
689
+ stringChar = "";
690
+ }
691
+ if (char === ";" && !insideString) {
692
+ if (currentStatement.trim().length > 0) {
693
+ statements.push(currentStatement.trim());
694
+ }
695
+ currentStatement = "";
696
+ } else {
697
+ currentStatement += char;
698
+ }
699
+ }
700
+ if (currentStatement.trim().length > 0) {
701
+ statements.push(currentStatement.trim());
702
+ }
703
+ return statements;
695
704
  }
696
705
 
697
706
  // src/database/well-known.ts
@@ -855,25 +864,18 @@ async function ensureDatabaseInitialized(databasePath, encryptionEnabled, config
855
864
  logger.info("creating new database");
856
865
  const masterKey2 = encryptionEnabled ? await createMasterKey(config4, logger) : void 0;
857
866
  const metaFile = {
858
- version: backendDatabaseVersion,
867
+ version: 0,
859
868
  masterKey: masterKey2?.armoredMasterKey
860
869
  };
861
870
  return {
862
- shouldMigrate: true,
863
871
  masterKey: masterKey2?.masterKey,
864
872
  metaFile,
865
873
  created: true,
866
874
  initialRecipient: masterKey2?.recipient
867
875
  };
868
876
  }
869
- if (meta.version > backendDatabaseVersion) {
870
- throw new Error(
871
- `Database version (${meta.version}) is newer than expected (${backendDatabaseVersion}). You likely need to update the Highstate.`
872
- );
873
- }
874
877
  if (!encryptionEnabled) {
875
878
  return {
876
- shouldMigrate: meta.version < backendDatabaseVersion,
877
879
  masterKey: void 0,
878
880
  metaFile: meta,
879
881
  created: false
@@ -890,7 +892,6 @@ async function ensureDatabaseInitialized(databasePath, encryptionEnabled, config
890
892
  const encryptedMasterKey = armor.decode(meta.masterKey);
891
893
  const masterKey = await decrypter.decrypt(encryptedMasterKey, "text");
892
894
  return {
893
- shouldMigrate: meta.version < backendDatabaseVersion,
894
895
  masterKey,
895
896
  metaFile: meta,
896
897
  created: false
@@ -902,29 +903,31 @@ async function createLocalBackendDatabaseBackend(config4, logger) {
902
903
  }
903
904
  let databasePath = config4.HIGHSTATE_BACKEND_DATABASE_LOCAL_PATH;
904
905
  databasePath ??= await getCodebaseHighstatePath(config4, logger);
905
- const { shouldMigrate, masterKey, metaFile, created, initialRecipient } = await ensureDatabaseInitialized(
906
+ const { masterKey, metaFile, created, initialRecipient } = await ensureDatabaseInitialized(
906
907
  databasePath,
907
908
  config4.HIGHSTATE_ENCRYPTION_ENABLED,
908
909
  config4,
909
910
  logger
910
911
  );
911
912
  const databaseUrl = `file:${databasePath}/backend.db`;
912
- if (shouldMigrate) {
913
- await migrateDatabase(databaseUrl, "backend/sqlite", masterKey, logger);
914
- await writeMetaFile(databasePath, { ...metaFile, version: backendDatabaseVersion });
915
- }
916
- const adapter = new PrismaLibSQL({
913
+ const adapter = new PrismaLibSql({
917
914
  url: databaseUrl,
918
915
  encryptionKey: masterKey
919
916
  });
920
917
  const prismaClient = new PrismaClient({
921
918
  adapter
922
919
  });
920
+ await migrateDatabase(
921
+ prismaClient,
922
+ migrationPacks["backend/sqlite"],
923
+ metaFile.version,
924
+ async (version) => await writeMetaFile(databasePath, { ...metaFile, version }),
925
+ logger
926
+ );
923
927
  const database = prismaClient;
924
928
  await ensureWellKnownEntitiesCreated(database);
925
929
  const backendLogger = logger.child({ service: "LocalBackendDatabaseBackend" });
926
930
  await ensureInitialUnlockMethod(database, created, initialRecipient, backendLogger);
927
- backendLogger.info("database is ready");
928
931
  return new LocalBackendDatabaseBackend(
929
932
  database,
930
933
  databasePath,
@@ -956,190 +959,95 @@ async function ensureInitialUnlockMethod(database, created, initialRecipient, lo
956
959
  );
957
960
  }
958
961
  var config2 = {
959
- "generator": {
960
- "name": "client",
961
- "provider": {
962
- "fromEnvVar": null,
963
- "value": "prisma-client"
964
- },
965
- "output": {
966
- "value": "/home/exeteres/Projects/personal/highstate/packages/platform/backend/src/database/_generated/backend/postgresql",
967
- "fromEnvVar": null
968
- },
969
- "config": {
970
- "moduleFormat": "esm",
971
- "generatedFileExtension": "ts",
972
- "importFileExtension": "ts",
973
- "engineType": "client"
974
- },
975
- "binaryTargets": [
976
- {
977
- "fromEnvVar": null,
978
- "value": "linux-nixos",
979
- "native": true
980
- }
981
- ],
982
- "previewFeatures": [
983
- "driverAdapters",
984
- "queryCompiler"
985
- ],
986
- "sourceFilePath": "/home/exeteres/Projects/personal/highstate/packages/platform/backend/prisma/backend/postgresql/main.prisma",
987
- "isCustomOutput": true
988
- },
989
- "relativePath": "../../../../../prisma/backend/postgresql",
990
- "clientVersion": "6.14.0",
991
- "engineVersion": "717184b7b35ea05dfa71a3236b7af656013e1e49",
992
- "datasourceNames": [
993
- "db"
994
- ],
962
+ "previewFeatures": [],
963
+ "clientVersion": "7.3.0",
964
+ "engineVersion": "9d6ad21cbbceab97458517b147a6a09ff43aa735",
995
965
  "activeProvider": "postgresql",
996
- "postinstall": false,
997
- "inlineDatasources": {
998
- "db": {
999
- "url": {
1000
- "fromEnvVar": "HIGHSTATE_MIGRATION_DATABASE_URL",
1001
- "value": null
1002
- }
1003
- }
1004
- },
1005
- "inlineSchema": 'model UserWorkspaceLayout {\n /// The opaque ID of the user to which this layout belongs.\n userId String @id\n\n /// The layout of the user workspace managed by the frontend.\n ///\n /// ![unknown]\n layout Json\n}\n\nmodel Library {\n /// The CUIDv2 of the library.\n id String @id @default(cuid(2))\n\n /// The metadata of the library managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The spec of the library.\n ///\n /// [LibrarySpec]\n spec Json\n\n /// The projects using this library.\n projects Project[]\n}\n\nmodel Project {\n /// The CUIDv2 of the project.\n id String @id @default(cuid(2))\n\n /// Project meta managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The name of the project within the space.\n name String\n\n /// The ID of the project space this project belongs to.\n spaceId String\n\n /// The ID of the project model storage this project uses.\n modelStorageId String\n\n /// The ID of the library used by this project.\n libraryId String\n\n /// The ID of the Pulumi backend used by this project.\n pulumiBackendId String\n\n /// Encrypted project master key in AGE format.\n encryptedMasterKey String\n\n /// The unlock suite for this project.\n ///\n /// [ProjectUnlockSuite]\n unlockSuite Json\n\n /// The current version of the project database.\n /// This is used to determine if the project needs to be migrated.\n databaseVersion Int\n\n /// The time when the project was created.\n createdAt DateTime @default(now())\n\n /// The time when the project was last updated.\n updatedAt DateTime @updatedAt\n\n /// The project space this project belongs to.\n space ProjectSpace @relation(fields: [spaceId], references: [id])\n\n /// The project model storage this project uses.\n modelStorage ProjectModelStorage @relation(fields: [modelStorageId], references: [id])\n\n /// The library used by this project.\n library Library @relation(fields: [libraryId], references: [id])\n\n /// The Pulumi backend used by this project.\n pulumiBackend PulumiBackend @relation(fields: [pulumiBackendId], references: [id])\n\n @@unique([spaceId, name])\n}\n\nmodel ProjectSpace {\n /// The CUIDv2 of the project space.\n id String @id @default(cuid(2))\n\n /// The name of the project space within the parent space.\n ///\n /// Will be null for the global project space.\n name String?\n\n /// The ID of the parent project space, if any.\n parentId String?\n\n /// The metadata of the project space managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The projects in this project space.\n projects Project[]\n\n /// The parent project space, if any.\n parent ProjectSpace? @relation("ProjectSpaceHierarchy", fields: [parentId], references: [id])\n\n /// The child project spaces, if any.\n children ProjectSpace[] @relation("ProjectSpaceHierarchy")\n\n @@unique([parentId, name])\n}\n\nmodel ProjectModelStorage {\n /// The CUIDv2 of the project model storage.\n id String @id @default(cuid(2))\n\n /// The metadata of the project model storage managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The specification of the project model storage.\n ///\n /// [ProjectModelStorageSpec]\n spec Json\n\n /// The projects using this model storage.\n projects Project[]\n}\n\nmodel PulumiBackend {\n /// The CUIDv2 of the Pulumi backend.\n id String @id @default(cuid(2))\n\n /// The backend meta managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The spec of the Pulumi backend.\n ///\n /// [PulumiBackendSpec]\n spec Json\n\n /// The projects using this backend.\n projects Project[]\n}\n\n/// Unlock methods describe trusted identities that can decrypt the backend master key.\nmodel BackendUnlockMethod {\n /// The CUIDv2 of the unlock method.\n id String @id @default(cuid(2))\n\n /// The metadata of the unlock method managed by the backend.\n /// \n /// [BackendUnlockMethodMeta]\n meta Json\n\n /// The AGE recipient for this unlock method.\n recipient String @unique\n\n /// The time when the unlock method was created.\n createdAt DateTime @default(now())\n\n /// The time when the unlock method was last updated.\n updatedAt DateTime @updatedAt\n}\n\ndatasource db {\n provider = "postgresql"\n url = env("HIGHSTATE_MIGRATION_DATABASE_URL")\n}\n\ngenerator client {\n provider = "prisma-client"\n previewFeatures = ["queryCompiler", "driverAdapters"]\n output = "../../../src/database/_generated/backend/postgresql"\n moduleFormat = "esm"\n generatedFileExtension = "ts"\n importFileExtension = "ts"\n}\n\ngenerator json {\n provider = "prisma-json-types-generator"\n}\n',
1006
- "inlineSchemaHash": "da1dbb64b6c731ded11a88c53a02bc985f6d5732acc37035289eded446f9fbcc",
1007
- "copyEngine": true,
966
+ "inlineSchema": 'model UserWorkspaceLayout {\n /// The opaque ID of the user to which this layout belongs.\n userId String @id\n\n /// The layout of the user workspace managed by the frontend.\n ///\n /// ![unknown]\n layout Json\n}\n\nmodel Library {\n /// The CUIDv2 of the library.\n id String @id @default(cuid(2))\n\n /// The metadata of the library managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The spec of the library.\n ///\n /// [LibrarySpec]\n spec Json\n\n /// The projects using this library.\n projects Project[]\n}\n\nmodel Project {\n /// The CUIDv2 of the project.\n id String @id @default(cuid(2))\n\n /// Project meta managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The name of the project within the space.\n name String\n\n /// The ID of the project space this project belongs to.\n spaceId String\n\n /// The ID of the project model storage this project uses.\n modelStorageId String\n\n /// The ID of the library used by this project.\n libraryId String\n\n /// The ID of the Pulumi backend used by this project.\n pulumiBackendId String\n\n /// Encrypted project master key in AGE format.\n encryptedMasterKey String\n\n /// The unlock suite for this project.\n ///\n /// [ProjectUnlockSuite]\n unlockSuite Json\n\n /// The current version of the project database.\n /// This is used to determine if the project needs to be migrated.\n databaseVersion Int\n\n /// The time when the project was created.\n createdAt DateTime @default(now())\n\n /// The time when the project was last updated.\n updatedAt DateTime @updatedAt\n\n /// The project space this project belongs to.\n space ProjectSpace @relation(fields: [spaceId], references: [id])\n\n /// The project model storage this project uses.\n modelStorage ProjectModelStorage @relation(fields: [modelStorageId], references: [id])\n\n /// The library used by this project.\n library Library @relation(fields: [libraryId], references: [id])\n\n /// The Pulumi backend used by this project.\n pulumiBackend PulumiBackend @relation(fields: [pulumiBackendId], references: [id])\n\n @@unique([spaceId, name])\n}\n\nmodel ProjectSpace {\n /// The CUIDv2 of the project space.\n id String @id @default(cuid(2))\n\n /// The name of the project space within the parent space.\n ///\n /// Will be null for the global project space.\n name String?\n\n /// The ID of the parent project space, if any.\n parentId String?\n\n /// The metadata of the project space managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The projects in this project space.\n projects Project[]\n\n /// The parent project space, if any.\n parent ProjectSpace? @relation("ProjectSpaceHierarchy", fields: [parentId], references: [id])\n\n /// The child project spaces, if any.\n children ProjectSpace[] @relation("ProjectSpaceHierarchy")\n\n @@unique([parentId, name])\n}\n\nmodel ProjectModelStorage {\n /// The CUIDv2 of the project model storage.\n id String @id @default(cuid(2))\n\n /// The metadata of the project model storage managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The specification of the project model storage.\n ///\n /// [ProjectModelStorageSpec]\n spec Json\n\n /// The projects using this model storage.\n projects Project[]\n}\n\nmodel PulumiBackend {\n /// The CUIDv2 of the Pulumi backend.\n id String @id @default(cuid(2))\n\n /// The backend meta managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The spec of the Pulumi backend.\n ///\n /// [PulumiBackendSpec]\n spec Json\n\n /// The projects using this backend.\n projects Project[]\n}\n\n/// Unlock methods describe trusted identities that can decrypt the backend master key.\nmodel BackendUnlockMethod {\n /// The CUIDv2 of the unlock method.\n id String @id @default(cuid(2))\n\n /// The metadata of the unlock method managed by the backend.\n /// \n /// [BackendUnlockMethodMeta]\n meta Json\n\n /// The AGE recipient for this unlock method.\n recipient String @unique\n\n /// The time when the unlock method was created.\n createdAt DateTime @default(now())\n\n /// The time when the unlock method was last updated.\n updatedAt DateTime @updatedAt\n}\n\ndatasource db {\n provider = "postgresql"\n}\n\ngenerator client {\n provider = "prisma-client"\n output = "../../../src/database/_generated/backend/postgresql"\n moduleFormat = "esm"\n generatedFileExtension = "ts"\n importFileExtension = "ts"\n}\n\ngenerator json {\n provider = "prisma-json-types-generator"\n}\n',
1008
967
  "runtimeDataModel": {
1009
968
  "models": {},
1010
969
  "enums": {},
1011
970
  "types": {}
1012
- },
1013
- "dirname": ""
971
+ }
1014
972
  };
1015
973
  config2.runtimeDataModel = JSON.parse('{"models":{"UserWorkspaceLayout":{"fields":[{"name":"userId","kind":"scalar","type":"String"},{"name":"layout","kind":"scalar","type":"Json"}],"dbName":null},"Library":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"projects","kind":"object","type":"Project","relationName":"LibraryToProject"}],"dbName":null},"Project":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"name","kind":"scalar","type":"String"},{"name":"spaceId","kind":"scalar","type":"String"},{"name":"modelStorageId","kind":"scalar","type":"String"},{"name":"libraryId","kind":"scalar","type":"String"},{"name":"pulumiBackendId","kind":"scalar","type":"String"},{"name":"encryptedMasterKey","kind":"scalar","type":"String"},{"name":"unlockSuite","kind":"scalar","type":"Json"},{"name":"databaseVersion","kind":"scalar","type":"Int"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"space","kind":"object","type":"ProjectSpace","relationName":"ProjectToProjectSpace"},{"name":"modelStorage","kind":"object","type":"ProjectModelStorage","relationName":"ProjectToProjectModelStorage"},{"name":"library","kind":"object","type":"Library","relationName":"LibraryToProject"},{"name":"pulumiBackend","kind":"object","type":"PulumiBackend","relationName":"ProjectToPulumiBackend"}],"dbName":null},"ProjectSpace":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"parentId","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"projects","kind":"object","type":"Project","relationName":"ProjectToProjectSpace"},{"name":"parent","kind":"object","type":"ProjectSpace","relationName":"ProjectSpaceHierarchy"},{"name":"children","kind":"object","type":"ProjectSpace","relationName":"ProjectSpaceHierarchy"}],"dbName":null},"ProjectModelStorage":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"projects","kind":"object","type":"Project","relationName":"ProjectToProjectModelStorage"}],"dbName":null},"PulumiBackend":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"projects","kind":"object","type":"Project","relationName":"ProjectToPulumiBackend"}],"dbName":null},"BackendUnlockMethod":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"recipient","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"}],"dbName":null}},"enums":{},"types":{}}');
1016
- config2.engineWasm = void 0;
1017
974
  async function decodeBase64AsWasm2(wasmBase64) {
1018
975
  const { Buffer: Buffer2 } = await import('node:buffer');
1019
- const base64Data = wasmBase64.replace("data:application/wasm;base64,", "");
1020
- const wasmArray = new Uint8Array(Buffer2.from(base64Data, "base64"));
976
+ const wasmArray = Buffer2.from(wasmBase64, "base64");
1021
977
  return new WebAssembly.Module(wasmArray);
1022
978
  }
1023
979
  config2.compilerWasm = {
1024
- getRuntime: async () => await import('@prisma/client/runtime/query_compiler_bg.postgresql.mjs'),
980
+ getRuntime: async () => await import('@prisma/client/runtime/query_compiler_fast_bg.postgresql.mjs'),
1025
981
  getQueryCompilerWasmModule: async () => {
1026
- const { wasm } = await import('@prisma/client/runtime/query_compiler_bg.postgresql.wasm-base64.mjs');
982
+ const { wasm } = await import('@prisma/client/runtime/query_compiler_fast_bg.postgresql.wasm-base64.mjs');
1027
983
  return await decodeBase64AsWasm2(wasm);
1028
- }
984
+ },
985
+ importName: "./query_compiler_fast_bg.js"
1029
986
  };
1030
- function getPrismaClientClass2(dirname5) {
1031
- config2.dirname = dirname5;
1032
- return runtime2.getPrismaClient(config2);
987
+ function getPrismaClientClass2() {
988
+ return runtime8.getPrismaClient(config2);
1033
989
  }
1034
- runtime2.Public.validator;
1035
- runtime2.Extensions.getExtensionContext;
990
+ runtime8.Extensions.getExtensionContext;
1036
991
  ({
1037
- DbNull: runtime2.objectEnumValues.classes.DbNull,
1038
- JsonNull: runtime2.objectEnumValues.classes.JsonNull,
1039
- AnyNull: runtime2.objectEnumValues.classes.AnyNull
992
+ DbNull: runtime8.NullTypes.DbNull,
993
+ JsonNull: runtime8.NullTypes.JsonNull,
994
+ AnyNull: runtime8.NullTypes.AnyNull
1040
995
  });
1041
- runtime2.objectEnumValues.instances.DbNull;
1042
- runtime2.objectEnumValues.instances.JsonNull;
1043
- runtime2.objectEnumValues.instances.AnyNull;
1044
- runtime2.makeStrictEnum({
996
+ runtime8.makeStrictEnum({
1045
997
  ReadUncommitted: "ReadUncommitted",
1046
998
  ReadCommitted: "ReadCommitted",
1047
999
  RepeatableRead: "RepeatableRead",
1048
1000
  Serializable: "Serializable"
1049
1001
  });
1050
- runtime2.Extensions.defineExtension;
1002
+ runtime8.Extensions.defineExtension;
1051
1003
 
1052
1004
  // src/database/_generated/backend/postgresql/client.ts
1053
- var __dirname3 = path4.dirname(fileURLToPath(import.meta.url));
1054
- var PrismaClient2 = getPrismaClientClass2(__dirname3);
1005
+ globalThis["__dirname"] = path4.dirname(fileURLToPath(import.meta.url));
1006
+ var PrismaClient2 = getPrismaClientClass2();
1055
1007
  var config3 = {
1056
- "generator": {
1057
- "name": "client",
1058
- "provider": {
1059
- "fromEnvVar": null,
1060
- "value": "prisma-client"
1061
- },
1062
- "output": {
1063
- "value": "/home/exeteres/Projects/personal/highstate/packages/platform/backend/src/database/_generated/project",
1064
- "fromEnvVar": null
1065
- },
1066
- "config": {
1067
- "importFileExtension": "ts",
1068
- "moduleFormat": "esm",
1069
- "generatedFileExtension": "ts",
1070
- "engineType": "client"
1071
- },
1072
- "binaryTargets": [
1073
- {
1074
- "fromEnvVar": null,
1075
- "value": "linux-nixos",
1076
- "native": true
1077
- }
1078
- ],
1079
- "previewFeatures": [],
1080
- "sourceFilePath": "/home/exeteres/Projects/personal/highstate/packages/platform/backend/prisma/project/main.prisma",
1081
- "isCustomOutput": true
1082
- },
1083
- "relativePath": "../../../../prisma/project",
1084
- "clientVersion": "6.17.1",
1085
- "engineVersion": "272a37d34178c2894197e17273bf937f25acdeac",
1086
- "datasourceNames": [
1087
- "db"
1088
- ],
1008
+ "previewFeatures": [],
1009
+ "clientVersion": "7.3.0",
1010
+ "engineVersion": "9d6ad21cbbceab97458517b147a6a09ff43aa735",
1089
1011
  "activeProvider": "sqlite",
1090
- "inlineDatasources": {
1091
- "db": {
1092
- "url": {
1093
- "fromEnvVar": "HIGHSTATE_MIGRATION_DATABASE_URL",
1094
- "value": null
1095
- }
1096
- }
1097
- },
1098
- "inlineSchema": '/// The API key provides authentication tokens for accessing the platform API.\n///\n/// Each API key impersonates a service account, inheriting its permissions and access scope.\n/// Keys are automatically created for worker versions and can be manually created for\n/// external integrations. The token is a 32-byte random hex string that can be regenerated.\nmodel ApiKey {\n /// The CUIDv2 of the API key.\n id String @id @default(cuid(2))\n\n /// The metadata of the API key managed by the backend.\n ///\n /// [ApiKeyMeta]\n meta Json\n\n /// The ID of the service account impersonated by this API key.\n serviceAccountId String\n\n /// The API token for authentication.\n ///\n /// Should be treated as a secret and only shown once at creation/regeneration.\n token String @unique\n\n /// The time when the API key was created.\n createdAt DateTime @default(now())\n\n /// The time when the API key was last updated.\n updatedAt DateTime @updatedAt\n\n /// The worker version that owns this API key.\n worker WorkerVersion?\n\n /// The service account which this API key impersonates.\n serviceAccount ServiceAccount @relation(fields: [serviceAccountId], references: [id])\n}\n\n/// The artifact represents a file or folder stored in the system.\n///\n/// It can be produced by units or manually uploaded via API by service accounts.\n///\n/// Since different actors can produce the same artifact with the same content and hash,\n/// there is the ownership/usage concept to track which entities produce or use the artifact.\n/// The "ownership" and "usage" are synonymous in this context and often referred to as "usage".\n///\n/// When no usages are present, the artifact will be automatically garbage collected after a certain period.\nmodel Artifact {\n /// The CUIDv2 of the artifact.\n id String @id @default(cuid(2))\n\n /// The metadata of the artifact managed by the backend.\n ///\n /// Since multiple actors can produce the same artifact,\n /// this metadata is the last one provided by any actor.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The SHA256 hash of the artifact content.\n hash String @unique\n\n /// The size of the compressed artifact content in bytes.\n ///\n /// Does not represent the size of the original file or folder,\n /// but the size used to store the artifact in the system.\n size Int\n\n /// The chunk size of the artifact content in bytes.\n /// Used to split the artifact into smaller chunks for storage.\n chunkSize Int\n\n /// The time when the artifact first appeared in the system.\n createdAt DateTime @default(now())\n\n /// The time when the artifact was last updated.\n updatedAt DateTime @updatedAt\n\n /// The service accounts using this artifact.\n serviceAccounts ServiceAccount[]\n\n /// The instances using this artifact.\n instances InstanceState[]\n\n /// The terminals using this artifact.\n terminals Terminal[]\n\n /// The pages using this artifact.\n pages Page[]\n}\n\nmodel InstanceCustomStatus {\n /// The ID of the instance state this status belongs to.\n stateId String\n\n /// The ID of the service account which attached this custom status.\n serviceAccountId String\n\n /// The name of the custom status unique within the instance and service account.\n name String\n\n /// The metadata of the custom status managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The status value of the custom status.\n value String\n\n /// The message describing the instance\'s custom status.\n /// \n /// Can be used to provide additional context or information about the status.\n ///\n /// The message will be displayed in the 800x600 ANSI terminal in the UI,\n /// so different TUI elements should be drawn within this area.\n message String?\n\n /// The order of the custom status in the list of statuses.\n ///\n /// Should be values from 0 to 100, where 0 is the highest priority.\n /// By default, the order is 50.\n order Int @default(50)\n\n /// The time when the custom status was first attached to the instance.\n createdAt DateTime @default(now())\n\n /// The time when the custom status was last updated.\n updatedAt DateTime @updatedAt\n\n /// The instance this custom status belongs to.\n state InstanceState @relation(fields: [stateId], references: [id])\n\n /// The service account this custom status belongs to.\n serviceAccount ServiceAccount @relation(fields: [serviceAccountId], references: [id])\n\n @@id([stateId, serviceAccountId, name]) // the name must be unique within the instance and service account\n}\n\nenum InstanceEvaluationStatus {\n /// transient statuses (not persisted in the database)\n evaluating\n\n /// stable statuses\n evaluated\n error\n}\n\n/// The evaluation state tracks the result of evaluating composite instances to produce virtual instances.\n///\n/// Composite instances are template components that generate other instances (virtual instances) when evaluated.\n/// The evaluation process executes the composite\'s create function with resolved inputs to produce a tree\n/// of child instances. These virtual instances exist in the source "virtual" state and can be units\n/// (mapping to Pulumi resources) or other composites (producing more virtual instances recursively).\n///\n/// Evaluation happens automatically after project unlock and library reloads to keep virtual instances\n/// synchronized with their composite definitions. Evaluation state persists the produced instance model\n/// and tracks success/error status with descriptive messages showing the instance tree or error details.\nmodel InstanceEvaluationState {\n /// The ID of the state of the instance.\n stateId String @id\n\n /// The status of the instance evaluation.\n status InstanceEvaluationStatus\n\n /// The message describing the evaluation status.\n /// If the evaluation is failed, this message will contain the error description.\n message String?\n\n /// The model produced by the evaluation.\n ///\n /// Will be `null` if the evaluation is failed.\n ///\n /// Can be set for both: real composite instances and virtual instances produced by the evaluation.\n ///\n /// [InstanceModel]\n model Json?\n\n /// The time when the last evaluation was finished.\n evaluatedAt DateTime @updatedAt\n\n /// The instance this state belongs to.\n state InstanceState @relation(fields: [stateId], references: [id])\n}\n\nenum InstanceStatus {\n /// The instance is exists in the model (resident or virtual), but not yet deployed or was completely destroyed.\n ///\n /// "attempted", "deployed" and "failed" instances can be transitioned back to "undeployed" after\n /// successful "destroy" operation.\n undeployed\n\n /// The instance is attempted, but not yet fully deployed.\n ///\n /// Normally, this status is very short-lived, and here to indicate that the instance\n /// cannot be safely deleted from the the model until it will be completely destroyed.\n attempted\n\n /// The initial deployment of the instance was successful.\n ///\n /// The transition of "deployed -> failed" is not possible, so consequent failed operations\n /// will not affect this status.\n ///\n /// Like "attempted", that instance cannot be safely deleted from the model until it will be completely destroyed.\n deployed\n\n /// The initial deployment of the instance failed.\n /// It can still be transitioned to "deployed" by a successful operation\n ///\n /// Like "attempted", that instance cannot be safely deleted from the model until it will be completely destroyed.\n failed\n}\n\nenum InstanceSource {\n /// The instance is defined in the project model.\n resident\n\n /// The instance is produced by evaluation of composite instance.\n virtual\n}\n\nmodel InstanceState {\n /// The surrogate CUIDv2 primary key of the instance to allow renaming instances.\n id String @id @default(cuid(2))\n\n /// The ID of the instance managed by the system.\n ///\n /// [InstanceId]\n instanceId String @unique\n\n /// The status of the instance.\n status InstanceStatus\n\n /// The source of the instance.\n source InstanceSource\n\n /// The kind of the instance.\n ///\n /// [InstanceKind]\n kind String\n\n /// The ID of the parent instance state, if this instance is a child of another composite instance.\n parentId String?\n\n /// The 32-bit nonce used to invalidate the input hash when secrets are updated.\n inputHashNonce Int?\n\n /// The calculated instance CRC32 input hash at the moment of last operation completion.\n ///\n /// This hash covers:\n /// - the instance\'s configuration (name, args, secret hashes);\n /// - component definition hash;\n /// - the unit\'s source hash (if applicable);\n /// - the input hashes and output hashes of all input instances.\n inputHash Int?\n\n /// The CRC32 of the SHA256 of the output produced by the instance at the moment of last operation completion.\n ///\n /// Does not depend on anything except the instance\'s output.\n outputHash Int?\n\n /// The calculated CRC32 dependency output hash at the moment of last operation completion.\n ///\n /// This hash is calculated as combination of output hashes of all input instances and nothing else.\n ///\n /// The primary use case of this hash is to "short-circuit" execution:\n /// if the outputs of input instances have not changed, dependent instances can skip execution,\n /// even if their input hashes changed due to upstream config changes.\n /// This prevents unnecessary re-execution of the entire dependency graph when only non-output-affecting inputs are modified.\n dependencyOutputHash Int?\n\n /// The mapping of instance output names to artifact IDs passed via them.\n ///\n /// Used to authorize access to artifacts for other instances connected to these outputs.\n ///\n /// [InstanceArtifactIds]\n exportedArtifactIds Json?\n\n /// The snapshot of the instance model at the moment of last non-preview operation start.\n ///\n /// Null if the instance was never operated on.\n ///\n /// [InstanceModel]\n model Json?\n\n /// The snapshot of the resolved inputs at the moment of last non-preview operation start.\n ///\n /// Null if the instance was never operated on.\n ///\n /// [InstanceResolvedInputs]\n resolvedInputs Json?\n\n /// The count of Pulumi resources currently managed by this instance.\n currentResourceCount Int?\n\n /// The status fields produced by the last operation.\n ///\n /// [InstanceStatusFields]\n statusFields Json?\n\n /// The parent instance.\n parent InstanceState? @relation("InstanceHierarchy", fields: [parentId], references: [id])\n\n /// The child instances, if any.\n children InstanceState[] @relation("InstanceHierarchy")\n\n /// The evaluation state of this instance.\n evaluationState InstanceEvaluationState?\n\n /// The operation states associated with this instance.\n operationStates InstanceOperationState[]\n\n /// The secrets associated with this instance.\n secrets Secret[]\n\n /// The terminals associated with this instance.\n terminals Terminal[]\n\n /// The pages associated with this instance.\n pages Page[]\n\n /// The triggers associated with this instance.\n triggers Trigger[]\n\n /// Custom statuses for this instance.\n customStatuses InstanceCustomStatus[]\n\n /// The lock that is currently held on this instance.\n lock InstanceLock?\n\n /// Worker registrations associated with this instance.\n workerRegistrations WorkerUnitRegistration[]\n\n /// The artifacts produced or used by this instance.\n artifacts Artifact[]\n\n /// The operation logs associated with this instance.\n operationLogs OperationLog[]\n\n /// The user viewports associated with this instance.\n userViewports UserCompositeViewport[]\n}\n\nmodel UserProjectViewport {\n /// The opaque ID of the user to which this viewport belongs.\n userId String @id\n\n /// The viewport of the user project managed by the frontend.\n ///\n /// ![unknown]\n viewport Json\n}\n\nmodel UserCompositeViewport {\n /// The opaque ID of the user to which this viewport belongs.\n userId String\n\n /// The ID of the state of the composite instance to which this viewport belongs.\n stateId String\n\n /// The viewport of the user composite instance managed by the frontend.\n ///\n /// ![unknown]\n viewport Json\n\n /// The instance state to which this viewport belongs.\n state InstanceState @relation(fields: [stateId], references: [id])\n\n @@id([userId, stateId])\n}\n\nmodel InstanceLock {\n /// The ID of the instance state being locked.\n stateId String @id\n\n /// The metadata of the lock managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The CUIDv2 token to ensure ownership of the lock.\n token String\n\n /// The time when the lock was acquired.\n acquiredAt DateTime @default(now())\n\n /// The instance being locked.\n state InstanceState @relation(fields: [stateId], references: [id])\n}\n\ndatasource db {\n provider = "sqlite"\n url = env("HIGHSTATE_MIGRATION_DATABASE_URL")\n}\n\ngenerator client {\n provider = "prisma-client"\n engineType = "client"\n output = "../../src/database/_generated/project"\n moduleFormat = "esm"\n generatedFileExtension = "ts"\n importFileExtension = "ts"\n}\n\ngenerator json {\n provider = "prisma-json-types-generator"\n}\n\n/// The container for project instances. \n///\n/// Only used when "database" project model storage is used.\nmodel InstanceModel {\n /// The ID of the instance in the format of `{type}:{name}`.\n id String @id\n\n /// The model of the instance managed by the backend.\n ///\n /// [InstanceModel]\n model Json\n\n /// The time when the instance model was created.\n createdAt DateTime @default(now())\n\n /// The time when the instance model was last updated.\n updatedAt DateTime @updatedAt\n}\n\n/// The container for project hubs.\n///\n/// Only used when "database" project model storage is used.\nmodel HubModel {\n /// The CUIDv2 of the hub.\n id String @id\n\n /// The model of the hub managed by the backend.\n ///\n /// [HubModel]\n model Json\n\n /// The time when the hub model was created.\n createdAt DateTime @default(now())\n\n /// The time when the hub model was last updated.\n updatedAt DateTime @updatedAt\n}\n\nenum OperationStatus {\n // transient statuses\n pending\n running\n failing\n cancelling\n\n // stable statuses\n completed\n failed\n cancelled\n}\n\nenum OperationType {\n update\n preview\n destroy\n recreate\n refresh\n}\n\nenum InstanceOperationStatus {\n // transient statuses\n updating\n processing_triggers\n previewing\n destroying\n refreshing\n pending\n cancelling\n\n // stable statuses\n updated\n previewed\n skipped\n destroyed\n refreshed\n cancelled\n failed\n}\n\nmodel Operation {\n /// The CUIDv2 of the operation.\n id String @id @default(cuid(2))\n\n /// The metadata of the operation.\n ///\n /// [OperationMeta]\n meta Json\n\n /// The type of the operation.\n type OperationType\n\n /// The status of the operation.\n status OperationStatus @default(pending)\n\n /// The options of the operation.\n ///\n /// [OperationOptions]\n options Json\n\n /// The IDs of the instances that were exlicitly requested to operate on.\n ///\n /// [InstanceIds]\n requestedInstanceIds Json\n\n /// The execution phases of the operation.\n ///\n /// [OperationPhase[]]\n phases Json?\n\n /// The time when the operation started.\n startedAt DateTime @default(now())\n\n /// The time when the operation was last updated.\n updatedAt DateTime @updatedAt\n\n /// The time when the operation finished.\n finishedAt DateTime?\n\n /// The operation states associated with this operation.\n operationStates InstanceOperationState[]\n\n /// The logs of the operation.\n logs OperationLog[]\n}\n\nmodel InstanceOperationState {\n /// The ID of the operation this state belongs to.\n operationId String\n\n /// The ID of the instance state affected by the operation.\n stateId String\n\n /// The enum representing the current status of the instance from the operation perspective.\n status InstanceOperationStatus\n\n /// The current count of the Pulumi resources being managed by this instance.\n currentResourceCount Int?\n\n /// The total count of the Pulumi resources that this instance is expected to manage.\n totalResourceCount Int?\n\n /// The snapshot of the instance model at the moment of operation start.\n ///\n /// [InstanceModel]\n model Json\n\n /// The snapshot of the resolved inputs at the moment of operation start.\n ///\n /// [InstanceResolvedInputs]\n resolvedInputs Json\n\n /// The time when the operation on this instance started.\n /// Not populated on create, even if the instance is ready to start immediately.\n startedAt DateTime?\n\n /// The time when the operation on this instance finished.\n finishedAt DateTime?\n\n /// The operation this state belongs to.\n operation Operation @relation(fields: [operationId], references: [id])\n\n /// The instance this state belongs to.\n state InstanceState @relation(fields: [stateId], references: [id])\n\n @@id([operationId, stateId])\n}\n\nmodel OperationLog {\n /// The ULID of the log. Also used to extract the timestamp.\n id String @id\n\n /// The ID of the operation this log belongs to.\n operationId String\n\n /// The ID of the instance state this log produced by.\n /// Can be `null` if the log is not associated with any instance.\n stateId String?\n\n /// Whether this log is a system/runtime message (vs unit output).\n isSystem Boolean @default(false)\n\n /// The content of the log.\n content String\n\n /// The operation this log belongs to.\n operation Operation @relation(fields: [operationId], references: [id])\n\n /// The instance this log produced by.\n /// Can be `null` if the log is not associated with any instance.\n state InstanceState? @relation(fields: [stateId], references: [id])\n}\n\n/// The page provides custom UI content for instances and service accounts.\n///\n/// Pages can be created by units to display instance-specific information or by service accounts.\n/// The content consists of blocks that support markdown text, QR codes with optional content display,\n/// and file attachments (inline or artifact references). Instance pages are explicitly deleted\n/// when instances are destroyed.\nmodel Page {\n /// The CUIDv2 of the page.\n id String @id @default(cuid(2))\n\n /// The metadata of the page managed by the backend.\n ///\n /// [GlobalCommonObjectMeta]\n meta Json\n\n /// The ID of the instance state that owns this page.\n stateId String?\n\n /// The name of the page within the instance.\n /// Will be null if the page is not owned by an instance.\n name String?\n\n /// The ID of the service account that owns this page.\n serviceAccountId String?\n\n /// The content of the page as an array of blocks.\n ///\n /// Supports markdown, QR codes, and file blocks.\n ///\n /// [PageContent]\n content Json\n\n /// The time when the page was created.\n createdAt DateTime @default(now())\n\n /// The time when the page was last updated.\n updatedAt DateTime @updatedAt\n\n /// The instance this page belongs to if any.\n state InstanceState? @relation(fields: [stateId], references: [id])\n\n /// The service account this page belongs to if any. \n serviceAccount ServiceAccount? @relation(fields: [serviceAccountId], references: [id])\n\n /// The artifacts used by this page.\n artifacts Artifact[]\n\n @@unique([stateId, name]) // the name is unique within the instance\n}\n\n/// The secret stores sensitive configuration values for instances, service accounts, and system components.\n///\n/// Secrets can be instance-owned (for unit configuration), service account-owned, or system-level\n/// (like Pulumi passwords). \n///\n/// Secrets persist through normal destroy (recreate) operations\n/// and are only deleted when explicitly forgetting instance state with the deleteSecrets flag or when manually deleted.\n///\n/// Secret updates invalidate instance input hashes via inputHashNonce, triggering re-execution\n/// during operations. But the content of the secrets itself do not contribute to the input hash.\n///\n/// System secrets like Pulumi passwords are created on-demand and persist for the whole project lifetime.\nmodel Secret {\n /// The CUIDv2 of the secret.\n id String @id @default(cuid(2))\n\n /// The metadata of the secret managed by the backend.\n ///\n /// [GlobalCommonObjectMeta]\n meta Json\n\n /// The ID of the state of the instance owning this secret.\n stateId String?\n\n /// The name of the secret within the instance.\n ///\n /// Will be null if the secret is not owned by an instance.\n name String?\n\n /// The name of the secret within the project if the secret is a system secret.\n systemName String? @unique\n\n /// The ID of the service account owning this secret.\n serviceAccountId String?\n\n /// The content of the secret.\n ///\n /// ![unknown]\n content Json\n\n /// The time when the secret was created.\n createdAt DateTime @default(now())\n\n /// The time when the secret was last updated.\n updatedAt DateTime @updatedAt\n\n /// The instance this secret belongs to.\n state InstanceState? @relation(fields: [stateId], references: [id])\n\n /// The service account this secret belongs to.\n serviceAccount ServiceAccount? @relation(fields: [serviceAccountId], references: [id])\n\n @@unique([stateId, name]) // the name must be unique within the instance\n}\n\n/// The service account represents an identity for non-human actors in the system.\n///\n/// Service accounts are automatically created for workers and can be manually created\n/// for external integrations. They define the access scope for resources like artifacts,\n/// secrets, terminals, and pages. Multiple API keys can impersonate the same service account,\n/// allowing different authentication tokens to share the same permissions.\nmodel ServiceAccount {\n /// The CUIDv2 of the service account.\n id String @id @default(cuid(2))\n\n /// The metadata of the service account managed by the backend.\n ///\n /// [ServiceAccountMeta]\n meta Json\n\n /// The time when the service account was created.\n createdAt DateTime @default(now())\n\n /// The time when the service account was last updated.\n updatedAt DateTime @updatedAt\n\n /// The workers using this service account.\n workers Worker[]\n\n /// The artifacts used by this service account.\n artifacts Artifact[]\n\n /// The secrets owned by this service account.\n secrets Secret[]\n\n /// The terminals owned by this service account.\n terminals Terminal[]\n\n /// The pages owned by this service account.\n pages Page[]\n\n /// The instance custom statuses attached by this service account.\n customStatuses InstanceCustomStatus[]\n\n /// The API keys impersonating this service account.\n apiKeys ApiKey[]\n}\n\n/// The terminal status indicates whether a terminal can accept new connections.\nenum TerminalStatus {\n /// The terminal is currently active and can create new sessions.\n active\n\n /// The instance was destroyed and the terminal is no longer available, but here for historical purposes.\n unavailable\n}\n\n/// The terminal provides interactive shell access to infrastructure resources.\n///\n/// Terminals can be created by units (owned by instances) or by service accounts.\n/// Each terminal maintains a specification for creating containers that power the terminal,\n/// including image, command, environment, and mounted files.\n///\n/// Instance-owned terminals are marked unavailable when the instance is destroyed, preserving session history.\n/// Service account terminals persist independently.\nmodel Terminal {\n /// The CUIDv2 of the terminal.\n id String @id @default(cuid(2))\n\n /// The metadata of the terminal managed by the backend.\n ///\n /// [GlobalCommonObjectMeta]\n meta Json\n\n /// The status of the terminal.\n status TerminalStatus @default(active)\n\n /// The specification for creating the container that powers this terminal.\n ///\n /// Includes image, command, working directory, environment variables, and files.\n ///\n /// [TerminalSpec]\n spec Json\n\n /// The ID of the instance state owning this terminal.\n stateId String?\n\n /// The name of the terminal within the instance.\n ///\n /// Will be null if the terminal is not owned by an instance.\n name String?\n\n /// The ID of the service account owning this terminal.\n serviceAccountId String?\n\n /// The time when the terminal was created.\n createdAt DateTime @default(now())\n\n /// The time when the terminal was last updated.\n updatedAt DateTime @updatedAt\n\n /// The instance this terminal belongs to.\n state InstanceState? @relation(fields: [stateId], references: [id])\n\n /// The service account this terminal belongs to.\n serviceAccount ServiceAccount? @relation(fields: [serviceAccountId], references: [id])\n\n /// The terminal sessions associated with this terminal.\n sessions TerminalSession[]\n\n /// The artifacts used by this terminal.\n artifacts Artifact[]\n\n @@unique([stateId, name]) // the name is unique within the instance\n}\n\n/// The terminal session represents a single interactive connection to a terminal.\n///\n/// Each session tracks when it started and finished. All session output is preserved in logs.\nmodel TerminalSession {\n /// The CUIDv2 of the terminal session.\n id String @id @default(cuid(2))\n\n /// The ID of the terminal this session belongs to.\n terminalId String\n\n /// The time when the terminal session started.\n startedAt DateTime @default(now())\n\n /// The time when the terminal session finished.\n finishedAt DateTime?\n\n /// The terminal this session belongs to.\n terminal Terminal @relation(fields: [terminalId], references: [id], onDelete: Cascade)\n\n /// The logs of the terminal session.\n logs TerminalSessionLog[]\n}\n\n/// The terminal session log captures all input and output from a terminal session.\n///\n/// Logs are stored with ULID identifiers for timestamp ordering.\nmodel TerminalSessionLog {\n /// The ULID of the session log. Also used to extract the timestamp.\n id String @id\n\n /// The ID of the terminal session this log belongs to.\n sessionId String\n\n /// The content of the log.\n content String\n\n /// The terminal session this log belongs to.\n session TerminalSession @relation(fields: [sessionId], references: [id], onDelete: Cascade)\n}\n\n/// The trigger defines automated actions that execute in response to specific events.\n///\n/// Triggers are created by units to perform actions at defined points in the instance lifecycle\n/// or on schedule. The spec field determines the trigger type and behavior - currently supporting\n/// before-destroy triggers, with planned support for additional types like cron scheduling.\n/// Triggers are deleted along with their instance.\nmodel Trigger {\n /// The CUIDv2 of the trigger.\n id String @id @default(cuid(2))\n\n /// The metadata of the trigger managed by the backend.\n ///\n /// [GlobalCommonObjectMeta]\n meta Json\n\n /// The ID of the instance state this trigger belongs to.\n stateId String\n\n /// The name of the trigger within the instance.\n name String\n\n /// The specification of the trigger describing its type and behavior.\n ///\n /// [TriggerSpec]\n spec Json\n\n /// The time when the trigger was created.\n createdAt DateTime @default(now())\n\n /// The time when the trigger was last updated.\n updatedAt DateTime @updatedAt\n\n /// The instance this trigger belongs to.\n state InstanceState @relation(fields: [stateId], references: [id])\n\n @@unique([stateId, name]) // the name is unique within the instance\n}\n\n/// The unlock method type determines how users authenticate to decrypt project databases.\nenum UnlockMethodType {\n /// The password is used to unlock the project.\n password\n\n /// The passkey (via WebAuthn) is used to unlock the project.\n passkey\n}\n\n/// The unlock method enables decryption of project databases through user authentication.\n///\n/// Each project database is encrypted with a master key, which is then encrypted for each\n/// unlock method\'s recipient using AGE encryption. Users authenticate (password or passkey)\n/// to decrypt their specific AGE identity, which then decrypts the master key.\n///\n/// Multiple unlock methods can exist per project, allowing different authentication paths\n/// to the same encrypted database. When unlock methods are added/removed, the master key\n/// is re-encrypted for the new set of recipients.\n///\n/// The encryptedIdentity contains the AGE identity encrypted with the user\'s authentication\n/// method (password-derived key or WebAuthn), while the recipient is the public key\n/// corresponding to that identity.\nmodel UnlockMethod {\n /// The CUIDv2 of the unlock method.\n id String @id @default(cuid(2))\n\n /// The metadata of the unlock method managed by the backend.\n /// \n /// [UnlockMethodMeta]\n meta Json\n\n /// The type of unlock method.\n type UnlockMethodType\n\n /// The AGE identity encrypted and armored also with AGE.\n encryptedIdentity String\n\n /// The AGE recipient for this unlock method.\n recipient String @unique\n\n /// The time when the unlock method was created.\n createdAt DateTime @default(now())\n\n /// The time when the unlock method was last updated.\n updatedAt DateTime @updatedAt\n}\n\n/// The worker represents a containerized application that extends unit capabilities beyond Pulumi execution.\n///\n/// Workers enable units to perform runtime operations after Pulumi program completion,\n/// such as attaching custom statuses, monitoring resources, or triggering unit reconfigurations.\n/// Since Pulumi programs cannot affect instances after execution, workers bypass this limitation\n/// by providing persistent runtime behavior.\n///\n/// The worker identity (fully qualified image name) indicates the same publisher/party and services as natural authentication mechanism.\n/// All versions of a worker share the same service account, meaning they operate over\n/// the same resources and have the same access scope within the platform.\nmodel Worker {\n /// The CUIDv2 of the worker.\n id String @id @default(cuid(2))\n\n /// The identity of the worker derived from the container image.\n ///\n /// This is the fully qualified image name without the tag or digest.\n /// The format is `{<registry>/}[<namespace>/]<name>`.\n ///\n /// For example: `ghcr.io/highstate/worker` or `docker.io/library/ubuntu`.\n identity String @unique\n\n /// The ID of the service account this worker uses.\n serviceAccountId String @unique\n\n /// The time this worker first appeared in the system.\n createdAt DateTime @default(now())\n\n /// The service account impersonating this worker.\n serviceAccount ServiceAccount @relation(fields: [serviceAccountId], references: [id])\n\n /// The versions of this worker.\n versions WorkerVersion[]\n}\n\nenum WorkerVersionStatus {\n /// The status is unknown.\n unknown\n\n /// The worker is being started by one of the runtimes.\n starting\n\n /// The worker is running and serving registrations.\n running\n\n /// The worker is being stopping (after was starting/running and was disabled).\n stopping\n\n /// The worker is stopped and not serving registrations.\n stopped\n\n /// The worker failed to start/crashed more than the allowed number of times.\n error\n}\n\n/// The worker version represents a specific container image digest of a worker.\n///\n/// Each version corresponds to an immutable container image identified by its SHA256 digest.\n/// Versions are automatically created when units reference new image digests and deleted\n/// when no longer referenced by any unit registrations.\n///\n/// Each version has its own API key for isolation, but all versions of a worker\n/// share the same service account and thus the same access scope within the platform.\n/// The runtime starts containers when registrations exist and stops them when removed.\nmodel WorkerVersion {\n /// The CUIDv2 of the worker version.\n id String @id @default(cuid(2))\n\n /// The metadata of the worker version managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The current status of the worker version reported by the runtime.\n status WorkerVersionStatus @default(unknown)\n\n /// Whether this worker version is enabled and will be launched when project is unclocked.\n enabled Boolean @default(true)\n\n /// The ID of the runtime where this worker version currently runs.\n runtimeId String?\n\n /// The ID of the worker this version belongs to.\n workerId String\n\n /// The digest of the worker version used to identify it.\n /// The format is raw SHA256 digest without the `sha256:` prefix in lowercase hex.\n digest String @unique\n\n /// The ID of the API key this worker version uses.\n apiKeyId String @unique\n\n /// The time this worker version was created.\n createdAt DateTime @default(now())\n\n /// The time this worker version was last updated.\n updatedAt DateTime @updatedAt\n\n /// The worker this version belongs to.\n worker Worker @relation(fields: [workerId], references: [id])\n\n /// The API key this worker version uses.\n apiKey ApiKey @relation(fields: [apiKeyId], references: [id])\n\n /// The unit registrations for this worker version.\n unitRegistrations WorkerUnitRegistration[]\n\n /// The logs produced by this worker version.\n logs WorkerVersionLog[]\n}\n\n/// The worker unit registration tracks which unit instances require specific worker versions.\n///\n/// Units declare worker dependencies through their outputs, creating registrations that\n/// trigger the runtime to start corresponding worker containers. Each registration\n/// includes parameters passed to the worker for unit-specific configuration.\n///\n/// Registrations are managed during operation execution - created when units declare workers\n/// and removed when units are destroyed. Worker versions without registrations are garbage collected.\nmodel WorkerUnitRegistration {\n /// The ID of the state of the unit instance requesting the registration.\n stateId String\n\n /// The name of the worker within the instance.\n name String\n\n /// The parameters of the registration passed by the unit.\n ///\n /// [WorkerUnitRegistrationParams]\n params Json\n\n /// The ID of the worker version this registration currently uses.\n workerVersionId String\n\n /// The time this registration was created.\n createdAt DateTime @default(now())\n\n /// The time this registration was last updated.\n updatedAt DateTime @updatedAt\n\n /// The unit instance requesting the registration.\n state InstanceState @relation(fields: [stateId], references: [id])\n\n /// The worker version this registration currently uses.\n workerVersion WorkerVersion @relation(fields: [workerVersionId], references: [id])\n\n @@id([stateId, name]) // the registration is identified by the instance and name\n}\n\n/// The worker version log captures output from running worker containers.\n///\n/// Logs include both worker-generated output and system messages from the runtime.\n/// The ULID identifier provides timestamp ordering. Logs are deleted with the worker version.\nmodel WorkerVersionLog {\n /// The ULID of the worker log. Also used to extract the timestamp.\n id String @id @default(ulid())\n\n /// The ID of the worker version that produced this log.\n workerVersionId String\n\n /// The log content.\n content String\n\n /// Whether this log is a system/runtime message (vs worker output).\n isSystem Boolean @default(false)\n\n /// The worker version that produced this log.\n workerVersion WorkerVersion @relation(fields: [workerVersionId], references: [id], onDelete: Cascade)\n}\n',
1099
- "inlineSchemaHash": "fc5ea844a808f0d7f4166fedc540677a419261e61b6e3707c9a567599945adab",
1100
- "copyEngine": true,
1012
+ "inlineSchema": '/// The API key provides authentication tokens for accessing the platform API.\n///\n/// Each API key impersonates a service account, inheriting its permissions and access scope.\n/// Keys are automatically created for worker versions and can be manually created for\n/// external integrations. The token is a 32-byte random hex string that can be regenerated.\nmodel ApiKey {\n /// The CUIDv2 of the API key.\n id String @id @default(cuid(2))\n\n /// The metadata of the API key managed by the backend.\n ///\n /// [ApiKeyMeta]\n meta Json\n\n /// The ID of the service account impersonated by this API key.\n serviceAccountId String\n\n /// The API token for authentication.\n ///\n /// Should be treated as a secret and only shown once at creation/regeneration.\n token String @unique\n\n /// The time when the API key was created.\n createdAt DateTime @default(now())\n\n /// The time when the API key was last updated.\n updatedAt DateTime @updatedAt\n\n /// The worker version that owns this API key.\n worker WorkerVersion?\n\n /// The service account which this API key impersonates.\n serviceAccount ServiceAccount @relation(fields: [serviceAccountId], references: [id])\n}\n\n/// The artifact represents a file or folder stored in the system.\n///\n/// It can be produced by units or manually uploaded via API by service accounts.\n///\n/// Since different actors can produce the same artifact with the same content and hash,\n/// there is the ownership/usage concept to track which entities produce or use the artifact.\n/// The "ownership" and "usage" are synonymous in this context and often referred to as "usage".\n///\n/// When no usages are present, the artifact will be automatically garbage collected after a certain period.\nmodel Artifact {\n /// The CUIDv2 of the artifact.\n id String @id @default(cuid(2))\n\n /// The metadata of the artifact managed by the backend.\n ///\n /// Since multiple actors can produce the same artifact,\n /// this metadata is the last one provided by any actor.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The SHA256 hash of the artifact content.\n hash String @unique\n\n /// The size of the compressed artifact content in bytes.\n ///\n /// Does not represent the size of the original file or folder,\n /// but the size used to store the artifact in the system.\n size Int\n\n /// The chunk size of the artifact content in bytes.\n /// Used to split the artifact into smaller chunks for storage.\n chunkSize Int\n\n /// The time when the artifact first appeared in the system.\n createdAt DateTime @default(now())\n\n /// The time when the artifact was last updated.\n updatedAt DateTime @updatedAt\n\n /// The service accounts using this artifact.\n serviceAccounts ServiceAccount[]\n\n /// The instances using this artifact.\n instances InstanceState[]\n\n /// The terminals using this artifact.\n terminals Terminal[]\n\n /// The pages using this artifact.\n pages Page[]\n}\n\nmodel InstanceCustomStatus {\n /// The ID of the instance state this status belongs to.\n stateId String\n\n /// The ID of the service account which attached this custom status.\n serviceAccountId String\n\n /// The name of the custom status unique within the instance and service account.\n name String\n\n /// The metadata of the custom status managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The status value of the custom status.\n value String\n\n /// The message describing the instance\'s custom status.\n /// \n /// Can be used to provide additional context or information about the status.\n ///\n /// The message will be displayed in the 800x600 ANSI terminal in the UI,\n /// so different TUI elements should be drawn within this area.\n message String?\n\n /// The order of the custom status in the list of statuses.\n ///\n /// Should be values from 0 to 100, where 0 is the highest priority.\n /// By default, the order is 50.\n order Int @default(50)\n\n /// The time when the custom status was first attached to the instance.\n createdAt DateTime @default(now())\n\n /// The time when the custom status was last updated.\n updatedAt DateTime @updatedAt\n\n /// The instance this custom status belongs to.\n state InstanceState @relation(fields: [stateId], references: [id])\n\n /// The service account this custom status belongs to.\n serviceAccount ServiceAccount @relation(fields: [serviceAccountId], references: [id])\n\n @@id([stateId, serviceAccountId, name]) // the name must be unique within the instance and service account\n}\n\nenum InstanceEvaluationStatus {\n /// transient statuses (not persisted in the database)\n evaluating\n\n /// stable statuses\n evaluated\n error\n}\n\n/// The evaluation state tracks the result of evaluating composite instances to produce virtual instances.\n///\n/// Composite instances are template components that generate other instances (virtual instances) when evaluated.\n/// The evaluation process executes the composite\'s create function with resolved inputs to produce a tree\n/// of child instances. These virtual instances exist in the source "virtual" state and can be units\n/// (mapping to Pulumi resources) or other composites (producing more virtual instances recursively).\n///\n/// Evaluation happens automatically after project unlock and library reloads to keep virtual instances\n/// synchronized with their composite definitions. Evaluation state persists the produced instance model\n/// and tracks success/error status with descriptive messages showing the instance tree or error details.\nmodel InstanceEvaluationState {\n /// The ID of the state of the instance.\n stateId String @id\n\n /// The status of the instance evaluation.\n status InstanceEvaluationStatus\n\n /// The message describing the evaluation status.\n /// If the evaluation is failed, this message will contain the error description.\n message String?\n\n /// The model produced by the evaluation.\n ///\n /// Will be `null` if the evaluation is failed.\n ///\n /// Can be set for both: real composite instances and virtual instances produced by the evaluation.\n ///\n /// [InstanceModel]\n model Json?\n\n /// The time when the last evaluation was finished.\n evaluatedAt DateTime @updatedAt\n\n /// The instance this state belongs to.\n state InstanceState @relation(fields: [stateId], references: [id])\n}\n\nenum InstanceStatus {\n /// The instance is exists in the model (resident or virtual), but not yet deployed or was completely destroyed.\n ///\n /// "attempted", "deployed" and "failed" instances can be transitioned back to "undeployed" after\n /// successful "destroy" operation.\n undeployed\n\n /// The instance is attempted, but not yet fully deployed.\n ///\n /// Normally, this status is very short-lived, and here to indicate that the instance\n /// cannot be safely deleted from the the model until it will be completely destroyed.\n attempted\n\n /// The initial deployment of the instance was successful.\n ///\n /// The transition of "deployed -> failed" is not possible, so consequent failed operations\n /// will not affect this status.\n ///\n /// Like "attempted", that instance cannot be safely deleted from the model until it will be completely destroyed.\n deployed\n\n /// The initial deployment of the instance failed.\n /// It can still be transitioned to "deployed" by a successful operation\n ///\n /// Like "attempted", that instance cannot be safely deleted from the model until it will be completely destroyed.\n failed\n}\n\nenum InstanceSource {\n /// The instance is defined in the project model.\n resident\n\n /// The instance is produced by evaluation of composite instance.\n virtual\n}\n\nmodel InstanceState {\n /// The surrogate CUIDv2 primary key of the instance to allow renaming instances.\n id String @id @default(cuid(2))\n\n /// The ID of the instance managed by the system.\n ///\n /// [InstanceId]\n instanceId String @unique\n\n /// The status of the instance.\n status InstanceStatus\n\n /// The source of the instance.\n source InstanceSource\n\n /// The kind of the instance.\n ///\n /// [InstanceKind]\n kind String\n\n /// The ID of the parent instance state, if this instance is a child of another composite instance.\n parentId String?\n\n /// The 32-bit nonce used to invalidate the input hash when secrets are updated.\n inputHashNonce Int?\n\n /// The calculated CRC32 hash of the instance\'s own configuration at the moment of last operation completion.\n ///\n /// This hash covers:\n /// - component definition hash;\n /// - the unit\'s source hash (if applicable);\n /// - the instance\'s configuration (name, args, secret hashes / nonce).\n ///\n /// It does not include hashes of dependencies.\n ///\n /// Used together with `dependencyOutputHash` to short-circuit execution at runtime.\n selfHash Int?\n\n /// The calculated instance CRC32 input hash at the moment of last operation completion.\n ///\n /// This hash covers:\n /// - the instance\'s configuration (name, args, secret hashes);\n /// - component definition hash;\n /// - the unit\'s source hash (if applicable);\n /// - the input hashes and output hashes of all input instances.\n inputHash Int?\n\n /// The CRC32 of the SHA256 of the output produced by the instance at the moment of last operation completion.\n ///\n /// Does not depend on anything except the instance\'s output.\n outputHash Int?\n\n /// The calculated CRC32 dependency output hash at the moment of last operation completion.\n ///\n /// This hash is calculated as combination of output hashes of all input instances and nothing else.\n ///\n /// The primary use case of this hash is to "short-circuit" execution:\n /// if the outputs of input instances have not changed, dependent instances can skip execution,\n /// even if their input hashes changed due to upstream config changes.\n /// This prevents unnecessary re-execution of the entire dependency graph when only non-output-affecting inputs are modified.\n dependencyOutputHash Int?\n\n /// The mapping of instance output names to artifact IDs passed via them.\n ///\n /// Used to authorize access to artifacts for other instances connected to these outputs.\n ///\n /// [InstanceArtifactIds]\n exportedArtifactIds Json?\n\n /// The snapshot of the instance model at the moment of last non-preview operation start.\n ///\n /// Null if the instance was never operated on.\n ///\n /// [InstanceModel]\n model Json?\n\n /// The snapshot of the resolved inputs at the moment of last non-preview operation start.\n ///\n /// Null if the instance was never operated on.\n ///\n /// [InstanceResolvedInputs]\n resolvedInputs Json?\n\n /// The count of Pulumi resources currently managed by this instance.\n currentResourceCount Int?\n\n /// The status fields produced by the last operation.\n ///\n /// [InstanceStatusFields]\n statusFields Json?\n\n /// The parent instance.\n parent InstanceState? @relation("InstanceHierarchy", fields: [parentId], references: [id])\n\n /// The child instances, if any.\n children InstanceState[] @relation("InstanceHierarchy")\n\n /// The evaluation state of this instance.\n evaluationState InstanceEvaluationState?\n\n /// The operation states associated with this instance.\n operationStates InstanceOperationState[]\n\n /// The secrets associated with this instance.\n secrets Secret[]\n\n /// The terminals associated with this instance.\n terminals Terminal[]\n\n /// The pages associated with this instance.\n pages Page[]\n\n /// The triggers associated with this instance.\n triggers Trigger[]\n\n /// Custom statuses for this instance.\n customStatuses InstanceCustomStatus[]\n\n /// The lock that is currently held on this instance.\n lock InstanceLock?\n\n /// Worker registrations associated with this instance.\n workerRegistrations WorkerUnitRegistration[]\n\n /// The artifacts produced or used by this instance.\n artifacts Artifact[]\n\n /// The operation logs associated with this instance.\n operationLogs OperationLog[]\n\n /// The user viewports associated with this instance.\n userViewports UserCompositeViewport[]\n}\n\nmodel UserProjectViewport {\n /// The opaque ID of the user to which this viewport belongs.\n userId String @id\n\n /// The viewport of the user project managed by the frontend.\n ///\n /// ![unknown]\n viewport Json\n}\n\nmodel UserCompositeViewport {\n /// The opaque ID of the user to which this viewport belongs.\n userId String\n\n /// The ID of the state of the composite instance to which this viewport belongs.\n stateId String\n\n /// The viewport of the user composite instance managed by the frontend.\n ///\n /// ![unknown]\n viewport Json\n\n /// The instance state to which this viewport belongs.\n state InstanceState @relation(fields: [stateId], references: [id])\n\n @@id([userId, stateId])\n}\n\nmodel InstanceLock {\n /// The ID of the instance state being locked.\n stateId String @id\n\n /// The metadata of the lock managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The CUIDv2 token to ensure ownership of the lock.\n token String\n\n /// The time when the lock was acquired.\n acquiredAt DateTime @default(now())\n\n /// The instance being locked.\n state InstanceState @relation(fields: [stateId], references: [id])\n}\n\ndatasource db {\n provider = "sqlite"\n}\n\ngenerator client {\n provider = "prisma-client"\n engineType = "client"\n output = "../../src/database/_generated/project"\n moduleFormat = "esm"\n generatedFileExtension = "ts"\n importFileExtension = "ts"\n}\n\ngenerator json {\n provider = "prisma-json-types-generator"\n}\n\n/// The container for project instances. \n///\n/// Only used when "database" project model storage is used.\nmodel InstanceModel {\n /// The ID of the instance in the format of `{type}:{name}`.\n id String @id\n\n /// The model of the instance managed by the backend.\n ///\n /// [InstanceModel]\n model Json\n\n /// The time when the instance model was created.\n createdAt DateTime @default(now())\n\n /// The time when the instance model was last updated.\n updatedAt DateTime @updatedAt\n}\n\n/// The container for project hubs.\n///\n/// Only used when "database" project model storage is used.\nmodel HubModel {\n /// The CUIDv2 of the hub.\n id String @id\n\n /// The model of the hub managed by the backend.\n ///\n /// [HubModel]\n model Json\n\n /// The time when the hub model was created.\n createdAt DateTime @default(now())\n\n /// The time when the hub model was last updated.\n updatedAt DateTime @updatedAt\n}\n\nenum OperationStatus {\n // transient statuses\n pending\n running\n failing\n cancelling\n\n // stable statuses\n completed\n failed\n cancelled\n}\n\nenum OperationType {\n update\n preview\n destroy\n recreate\n refresh\n}\n\nenum InstanceOperationStatus {\n // transient statuses\n updating\n processing_triggers\n previewing\n destroying\n refreshing\n pending\n cancelling\n\n // stable statuses\n updated\n previewed\n skipped\n destroyed\n refreshed\n cancelled\n failed\n}\n\nmodel Operation {\n /// The CUIDv2 of the operation.\n id String @id @default(cuid(2))\n\n /// The metadata of the operation.\n ///\n /// [OperationMeta]\n meta Json\n\n /// The type of the operation.\n type OperationType\n\n /// The status of the operation.\n status OperationStatus @default(pending)\n\n /// The options of the operation.\n ///\n /// [OperationOptions]\n options Json\n\n /// The IDs of the instances that were exlicitly requested to operate on.\n ///\n /// [InstanceIds]\n requestedInstanceIds Json\n\n /// The execution phases of the operation.\n ///\n /// [OperationPhase[]]\n phases Json?\n\n /// The time when the operation started.\n startedAt DateTime @default(now())\n\n /// The time when the operation was last updated.\n updatedAt DateTime @updatedAt\n\n /// The time when the operation finished.\n finishedAt DateTime?\n\n /// The operation states associated with this operation.\n operationStates InstanceOperationState[]\n\n /// The logs of the operation.\n logs OperationLog[]\n}\n\nmodel InstanceOperationState {\n /// The ID of the operation this state belongs to.\n operationId String\n\n /// The ID of the instance state affected by the operation.\n stateId String\n\n /// The enum representing the current status of the instance from the operation perspective.\n status InstanceOperationStatus\n\n /// The current count of the Pulumi resources being managed by this instance.\n currentResourceCount Int?\n\n /// The total count of the Pulumi resources that this instance is expected to manage.\n totalResourceCount Int?\n\n /// The snapshot of the instance model at the moment of operation start.\n ///\n /// [InstanceModel]\n model Json\n\n /// The snapshot of the resolved inputs at the moment of operation start.\n ///\n /// [InstanceResolvedInputs]\n resolvedInputs Json\n\n /// The time when the operation on this instance started.\n /// Not populated on create, even if the instance is ready to start immediately.\n startedAt DateTime?\n\n /// The time when the operation on this instance finished.\n finishedAt DateTime?\n\n /// The operation this state belongs to.\n operation Operation @relation(fields: [operationId], references: [id])\n\n /// The instance this state belongs to.\n state InstanceState @relation(fields: [stateId], references: [id])\n\n @@id([operationId, stateId])\n}\n\nmodel OperationLog {\n /// The ULID of the log. Also used to extract the timestamp.\n id String @id\n\n /// The ID of the operation this log belongs to.\n operationId String\n\n /// The ID of the instance state this log produced by.\n /// Can be `null` if the log is not associated with any instance.\n stateId String?\n\n /// Whether this log is a system/runtime message (vs unit output).\n isSystem Boolean @default(false)\n\n /// The content of the log.\n content String\n\n /// The operation this log belongs to.\n operation Operation @relation(fields: [operationId], references: [id])\n\n /// The instance this log produced by.\n /// Can be `null` if the log is not associated with any instance.\n state InstanceState? @relation(fields: [stateId], references: [id])\n}\n\n/// The page provides custom UI content for instances and service accounts.\n///\n/// Pages can be created by units to display instance-specific information or by service accounts.\n/// The content consists of blocks that support markdown text, QR codes with optional content display,\n/// and file attachments (inline or artifact references). Instance pages are explicitly deleted\n/// when instances are destroyed.\nmodel Page {\n /// The CUIDv2 of the page.\n id String @id @default(cuid(2))\n\n /// The metadata of the page managed by the backend.\n ///\n /// [GlobalCommonObjectMeta]\n meta Json\n\n /// The ID of the instance state that owns this page.\n stateId String?\n\n /// The name of the page within the instance.\n /// Will be null if the page is not owned by an instance.\n name String?\n\n /// The ID of the service account that owns this page.\n serviceAccountId String?\n\n /// The content of the page as an array of blocks.\n ///\n /// Supports markdown, QR codes, and file blocks.\n ///\n /// [PageContent]\n content Json\n\n /// The time when the page was created.\n createdAt DateTime @default(now())\n\n /// The time when the page was last updated.\n updatedAt DateTime @updatedAt\n\n /// The instance this page belongs to if any.\n state InstanceState? @relation(fields: [stateId], references: [id])\n\n /// The service account this page belongs to if any. \n serviceAccount ServiceAccount? @relation(fields: [serviceAccountId], references: [id])\n\n /// The artifacts used by this page.\n artifacts Artifact[]\n\n @@unique([stateId, name]) // the name is unique within the instance\n}\n\n/// The secret stores sensitive configuration values for instances, service accounts, and system components.\n///\n/// Secrets can be instance-owned (for unit configuration), service account-owned, or system-level\n/// (like Pulumi passwords). \n///\n/// Secrets persist through normal destroy (recreate) operations\n/// and are only deleted when explicitly forgetting instance state with the deleteSecrets flag or when manually deleted.\n///\n/// Secret updates invalidate instance input hashes via inputHashNonce, triggering re-execution\n/// during operations. But the content of the secrets itself do not contribute to the input hash.\n///\n/// System secrets like Pulumi passwords are created on-demand and persist for the whole project lifetime.\nmodel Secret {\n /// The CUIDv2 of the secret.\n id String @id @default(cuid(2))\n\n /// The metadata of the secret managed by the backend.\n ///\n /// [GlobalCommonObjectMeta]\n meta Json\n\n /// The ID of the state of the instance owning this secret.\n stateId String?\n\n /// The name of the secret within the instance.\n ///\n /// Will be null if the secret is not owned by an instance.\n name String?\n\n /// The name of the secret within the project if the secret is a system secret.\n systemName String? @unique\n\n /// The ID of the service account owning this secret.\n serviceAccountId String?\n\n /// The content of the secret.\n ///\n /// ![unknown]\n content Json\n\n /// The time when the secret was created.\n createdAt DateTime @default(now())\n\n /// The time when the secret was last updated.\n updatedAt DateTime @updatedAt\n\n /// The instance this secret belongs to.\n state InstanceState? @relation(fields: [stateId], references: [id])\n\n /// The service account this secret belongs to.\n serviceAccount ServiceAccount? @relation(fields: [serviceAccountId], references: [id])\n\n @@unique([stateId, name]) // the name must be unique within the instance\n}\n\n/// The service account represents an identity for non-human actors in the system.\n///\n/// Service accounts are automatically created for workers and can be manually created\n/// for external integrations. They define the access scope for resources like artifacts,\n/// secrets, terminals, and pages. Multiple API keys can impersonate the same service account,\n/// allowing different authentication tokens to share the same permissions.\nmodel ServiceAccount {\n /// The CUIDv2 of the service account.\n id String @id @default(cuid(2))\n\n /// The metadata of the service account managed by the backend.\n ///\n /// [ServiceAccountMeta]\n meta Json\n\n /// The time when the service account was created.\n createdAt DateTime @default(now())\n\n /// The time when the service account was last updated.\n updatedAt DateTime @updatedAt\n\n /// The workers using this service account.\n workers Worker[]\n\n /// The artifacts used by this service account.\n artifacts Artifact[]\n\n /// The secrets owned by this service account.\n secrets Secret[]\n\n /// The terminals owned by this service account.\n terminals Terminal[]\n\n /// The pages owned by this service account.\n pages Page[]\n\n /// The instance custom statuses attached by this service account.\n customStatuses InstanceCustomStatus[]\n\n /// The API keys impersonating this service account.\n apiKeys ApiKey[]\n}\n\n/// The terminal status indicates whether a terminal can accept new connections.\nenum TerminalStatus {\n /// The terminal is currently active and can create new sessions.\n active\n\n /// The instance was destroyed and the terminal is no longer available, but here for historical purposes.\n unavailable\n}\n\n/// The terminal provides interactive shell access to infrastructure resources.\n///\n/// Terminals can be created by units (owned by instances) or by service accounts.\n/// Each terminal maintains a specification for creating containers that power the terminal,\n/// including image, command, environment, and mounted files.\n///\n/// Instance-owned terminals are marked unavailable when the instance is destroyed, preserving session history.\n/// Service account terminals persist independently.\nmodel Terminal {\n /// The CUIDv2 of the terminal.\n id String @id @default(cuid(2))\n\n /// The metadata of the terminal managed by the backend.\n ///\n /// [GlobalCommonObjectMeta]\n meta Json\n\n /// The status of the terminal.\n status TerminalStatus @default(active)\n\n /// The specification for creating the container that powers this terminal.\n ///\n /// Includes image, command, working directory, environment variables, and files.\n ///\n /// [TerminalSpec]\n spec Json\n\n /// The ID of the instance state owning this terminal.\n stateId String?\n\n /// The name of the terminal within the instance.\n ///\n /// Will be null if the terminal is not owned by an instance.\n name String?\n\n /// The ID of the service account owning this terminal.\n serviceAccountId String?\n\n /// The time when the terminal was created.\n createdAt DateTime @default(now())\n\n /// The time when the terminal was last updated.\n updatedAt DateTime @updatedAt\n\n /// The instance this terminal belongs to.\n state InstanceState? @relation(fields: [stateId], references: [id])\n\n /// The service account this terminal belongs to.\n serviceAccount ServiceAccount? @relation(fields: [serviceAccountId], references: [id])\n\n /// The terminal sessions associated with this terminal.\n sessions TerminalSession[]\n\n /// The artifacts used by this terminal.\n artifacts Artifact[]\n\n @@unique([stateId, name]) // the name is unique within the instance\n}\n\n/// The terminal session represents a single interactive connection to a terminal.\n///\n/// Each session tracks when it started and finished. All session output is preserved in logs.\nmodel TerminalSession {\n /// The CUIDv2 of the terminal session.\n id String @id @default(cuid(2))\n\n /// The ID of the terminal this session belongs to.\n terminalId String\n\n /// The time when the terminal session started.\n startedAt DateTime @default(now())\n\n /// The time when the terminal session finished.\n finishedAt DateTime?\n\n /// The terminal this session belongs to.\n terminal Terminal @relation(fields: [terminalId], references: [id], onDelete: Cascade)\n\n /// The logs of the terminal session.\n logs TerminalSessionLog[]\n}\n\n/// The terminal session log captures all input and output from a terminal session.\n///\n/// Logs are stored with ULID identifiers for timestamp ordering.\nmodel TerminalSessionLog {\n /// The ULID of the session log. Also used to extract the timestamp.\n id String @id\n\n /// The ID of the terminal session this log belongs to.\n sessionId String\n\n /// The content of the log.\n content String\n\n /// The terminal session this log belongs to.\n session TerminalSession @relation(fields: [sessionId], references: [id], onDelete: Cascade)\n}\n\n/// The trigger defines automated actions that execute in response to specific events.\n///\n/// Triggers are created by units to perform actions at defined points in the instance lifecycle\n/// or on schedule. The spec field determines the trigger type and behavior - currently supporting\n/// before-destroy triggers, with planned support for additional types like cron scheduling.\n/// Triggers are deleted along with their instance.\nmodel Trigger {\n /// The CUIDv2 of the trigger.\n id String @id @default(cuid(2))\n\n /// The metadata of the trigger managed by the backend.\n ///\n /// [GlobalCommonObjectMeta]\n meta Json\n\n /// The ID of the instance state this trigger belongs to.\n stateId String\n\n /// The name of the trigger within the instance.\n name String\n\n /// The specification of the trigger describing its type and behavior.\n ///\n /// [TriggerSpec]\n spec Json\n\n /// The time when the trigger was created.\n createdAt DateTime @default(now())\n\n /// The time when the trigger was last updated.\n updatedAt DateTime @updatedAt\n\n /// The instance this trigger belongs to.\n state InstanceState @relation(fields: [stateId], references: [id])\n\n @@unique([stateId, name]) // the name is unique within the instance\n}\n\n/// The unlock method type determines how users authenticate to decrypt project databases.\nenum UnlockMethodType {\n /// The password is used to unlock the project.\n password\n\n /// The passkey (via WebAuthn) is used to unlock the project.\n passkey\n}\n\n/// The unlock method enables decryption of project databases through user authentication.\n///\n/// Each project database is encrypted with a master key, which is then encrypted for each\n/// unlock method\'s recipient using AGE encryption. Users authenticate (password or passkey)\n/// to decrypt their specific AGE identity, which then decrypts the master key.\n///\n/// Multiple unlock methods can exist per project, allowing different authentication paths\n/// to the same encrypted database. When unlock methods are added/removed, the master key\n/// is re-encrypted for the new set of recipients.\n///\n/// The encryptedIdentity contains the AGE identity encrypted with the user\'s authentication\n/// method (password-derived key or WebAuthn), while the recipient is the public key\n/// corresponding to that identity.\nmodel UnlockMethod {\n /// The CUIDv2 of the unlock method.\n id String @id @default(cuid(2))\n\n /// The metadata of the unlock method managed by the backend.\n /// \n /// [UnlockMethodMeta]\n meta Json\n\n /// The type of unlock method.\n type UnlockMethodType\n\n /// The AGE identity encrypted and armored also with AGE.\n encryptedIdentity String\n\n /// The AGE recipient for this unlock method.\n recipient String @unique\n\n /// The time when the unlock method was created.\n createdAt DateTime @default(now())\n\n /// The time when the unlock method was last updated.\n updatedAt DateTime @updatedAt\n}\n\n/// The worker represents a containerized application that extends unit capabilities beyond Pulumi execution.\n///\n/// Workers enable units to perform runtime operations after Pulumi program completion,\n/// such as attaching custom statuses, monitoring resources, or triggering unit reconfigurations.\n/// Since Pulumi programs cannot affect instances after execution, workers bypass this limitation\n/// by providing persistent runtime behavior.\n///\n/// The worker identity (fully qualified image name) indicates the same publisher/party and services as natural authentication mechanism.\n/// All versions of a worker share the same service account, meaning they operate over\n/// the same resources and have the same access scope within the platform.\nmodel Worker {\n /// The CUIDv2 of the worker.\n id String @id @default(cuid(2))\n\n /// The identity of the worker derived from the container image.\n ///\n /// This is the fully qualified image name without the tag or digest.\n /// The format is `{<registry>/}[<namespace>/]<name>`.\n ///\n /// For example: `ghcr.io/highstate/worker` or `docker.io/library/ubuntu`.\n identity String @unique\n\n /// The ID of the service account this worker uses.\n serviceAccountId String @unique\n\n /// The time this worker first appeared in the system.\n createdAt DateTime @default(now())\n\n /// The service account impersonating this worker.\n serviceAccount ServiceAccount @relation(fields: [serviceAccountId], references: [id])\n\n /// The versions of this worker.\n versions WorkerVersion[]\n}\n\nenum WorkerVersionStatus {\n /// The status is unknown.\n unknown\n\n /// The worker is being started by one of the runtimes.\n starting\n\n /// The worker is running and serving registrations.\n running\n\n /// The worker is being stopping (after was starting/running and was disabled).\n stopping\n\n /// The worker is stopped and not serving registrations.\n stopped\n\n /// The worker failed to start/crashed more than the allowed number of times.\n error\n}\n\n/// The worker version represents a specific container image digest of a worker.\n///\n/// Each version corresponds to an immutable container image identified by its SHA256 digest.\n/// Versions are automatically created when units reference new image digests and deleted\n/// when no longer referenced by any unit registrations.\n///\n/// Each version has its own API key for isolation, but all versions of a worker\n/// share the same service account and thus the same access scope within the platform.\n/// The runtime starts containers when registrations exist and stops them when removed.\nmodel WorkerVersion {\n /// The CUIDv2 of the worker version.\n id String @id @default(cuid(2))\n\n /// The metadata of the worker version managed by the backend.\n ///\n /// [CommonObjectMeta]\n meta Json\n\n /// The current status of the worker version reported by the runtime.\n status WorkerVersionStatus @default(unknown)\n\n /// Whether this worker version is enabled and will be launched when project is unclocked.\n enabled Boolean @default(true)\n\n /// The ID of the runtime where this worker version currently runs.\n runtimeId String?\n\n /// The ID of the worker this version belongs to.\n workerId String\n\n /// The digest of the worker version used to identify it.\n /// The format is raw SHA256 digest without the `sha256:` prefix in lowercase hex.\n digest String @unique\n\n /// The ID of the API key this worker version uses.\n apiKeyId String @unique\n\n /// The time this worker version was created.\n createdAt DateTime @default(now())\n\n /// The time this worker version was last updated.\n updatedAt DateTime @updatedAt\n\n /// The worker this version belongs to.\n worker Worker @relation(fields: [workerId], references: [id])\n\n /// The API key this worker version uses.\n apiKey ApiKey @relation(fields: [apiKeyId], references: [id])\n\n /// The unit registrations for this worker version.\n unitRegistrations WorkerUnitRegistration[]\n\n /// The logs produced by this worker version.\n logs WorkerVersionLog[]\n}\n\n/// The worker unit registration tracks which unit instances require specific worker versions.\n///\n/// Units declare worker dependencies through their outputs, creating registrations that\n/// trigger the runtime to start corresponding worker containers. Each registration\n/// includes parameters passed to the worker for unit-specific configuration.\n///\n/// Registrations are managed during operation execution - created when units declare workers\n/// and removed when units are destroyed. Worker versions without registrations are garbage collected.\nmodel WorkerUnitRegistration {\n /// The ID of the state of the unit instance requesting the registration.\n stateId String\n\n /// The name of the worker within the instance.\n name String\n\n /// The parameters of the registration passed by the unit.\n ///\n /// [WorkerUnitRegistrationParams]\n params Json\n\n /// The ID of the worker version this registration currently uses.\n workerVersionId String\n\n /// The time this registration was created.\n createdAt DateTime @default(now())\n\n /// The time this registration was last updated.\n updatedAt DateTime @updatedAt\n\n /// The unit instance requesting the registration.\n state InstanceState @relation(fields: [stateId], references: [id])\n\n /// The worker version this registration currently uses.\n workerVersion WorkerVersion @relation(fields: [workerVersionId], references: [id])\n\n @@id([stateId, name]) // the registration is identified by the instance and name\n}\n\n/// The worker version log captures output from running worker containers.\n///\n/// Logs include both worker-generated output and system messages from the runtime.\n/// The ULID identifier provides timestamp ordering. Logs are deleted with the worker version.\nmodel WorkerVersionLog {\n /// The ULID of the worker log. Also used to extract the timestamp.\n id String @id @default(ulid())\n\n /// The ID of the worker version that produced this log.\n workerVersionId String\n\n /// The log content.\n content String\n\n /// Whether this log is a system/runtime message (vs worker output).\n isSystem Boolean @default(false)\n\n /// The worker version that produced this log.\n workerVersion WorkerVersion @relation(fields: [workerVersionId], references: [id], onDelete: Cascade)\n}\n',
1101
1013
  "runtimeDataModel": {
1102
1014
  "models": {},
1103
1015
  "enums": {},
1104
1016
  "types": {}
1105
- },
1106
- "dirname": ""
1017
+ }
1107
1018
  };
1108
- config3.runtimeDataModel = JSON.parse('{"models":{"ApiKey":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"serviceAccountId","kind":"scalar","type":"String"},{"name":"token","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"worker","kind":"object","type":"WorkerVersion","relationName":"ApiKeyToWorkerVersion"},{"name":"serviceAccount","kind":"object","type":"ServiceAccount","relationName":"ApiKeyToServiceAccount"}],"dbName":null},"Artifact":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"hash","kind":"scalar","type":"String"},{"name":"size","kind":"scalar","type":"Int"},{"name":"chunkSize","kind":"scalar","type":"Int"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"serviceAccounts","kind":"object","type":"ServiceAccount","relationName":"ArtifactToServiceAccount"},{"name":"instances","kind":"object","type":"InstanceState","relationName":"ArtifactToInstanceState"},{"name":"terminals","kind":"object","type":"Terminal","relationName":"ArtifactToTerminal"},{"name":"pages","kind":"object","type":"Page","relationName":"ArtifactToPage"}],"dbName":null},"InstanceCustomStatus":{"fields":[{"name":"stateId","kind":"scalar","type":"String"},{"name":"serviceAccountId","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"value","kind":"scalar","type":"String"},{"name":"message","kind":"scalar","type":"String"},{"name":"order","kind":"scalar","type":"Int"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceCustomStatusToInstanceState"},{"name":"serviceAccount","kind":"object","type":"ServiceAccount","relationName":"InstanceCustomStatusToServiceAccount"}],"dbName":null},"InstanceEvaluationState":{"fields":[{"name":"stateId","kind":"scalar","type":"String"},{"name":"status","kind":"enum","type":"InstanceEvaluationStatus"},{"name":"message","kind":"scalar","type":"String"},{"name":"model","kind":"scalar","type":"Json"},{"name":"evaluatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceEvaluationStateToInstanceState"}],"dbName":null},"InstanceState":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"instanceId","kind":"scalar","type":"String"},{"name":"status","kind":"enum","type":"InstanceStatus"},{"name":"source","kind":"enum","type":"InstanceSource"},{"name":"kind","kind":"scalar","type":"String"},{"name":"parentId","kind":"scalar","type":"String"},{"name":"inputHashNonce","kind":"scalar","type":"Int"},{"name":"inputHash","kind":"scalar","type":"Int"},{"name":"outputHash","kind":"scalar","type":"Int"},{"name":"dependencyOutputHash","kind":"scalar","type":"Int"},{"name":"exportedArtifactIds","kind":"scalar","type":"Json"},{"name":"model","kind":"scalar","type":"Json"},{"name":"resolvedInputs","kind":"scalar","type":"Json"},{"name":"currentResourceCount","kind":"scalar","type":"Int"},{"name":"statusFields","kind":"scalar","type":"Json"},{"name":"parent","kind":"object","type":"InstanceState","relationName":"InstanceHierarchy"},{"name":"children","kind":"object","type":"InstanceState","relationName":"InstanceHierarchy"},{"name":"evaluationState","kind":"object","type":"InstanceEvaluationState","relationName":"InstanceEvaluationStateToInstanceState"},{"name":"operationStates","kind":"object","type":"InstanceOperationState","relationName":"InstanceOperationStateToInstanceState"},{"name":"secrets","kind":"object","type":"Secret","relationName":"InstanceStateToSecret"},{"name":"terminals","kind":"object","type":"Terminal","relationName":"InstanceStateToTerminal"},{"name":"pages","kind":"object","type":"Page","relationName":"InstanceStateToPage"},{"name":"triggers","kind":"object","type":"Trigger","relationName":"InstanceStateToTrigger"},{"name":"customStatuses","kind":"object","type":"InstanceCustomStatus","relationName":"InstanceCustomStatusToInstanceState"},{"name":"lock","kind":"object","type":"InstanceLock","relationName":"InstanceLockToInstanceState"},{"name":"workerRegistrations","kind":"object","type":"WorkerUnitRegistration","relationName":"InstanceStateToWorkerUnitRegistration"},{"name":"artifacts","kind":"object","type":"Artifact","relationName":"ArtifactToInstanceState"},{"name":"operationLogs","kind":"object","type":"OperationLog","relationName":"InstanceStateToOperationLog"},{"name":"userViewports","kind":"object","type":"UserCompositeViewport","relationName":"InstanceStateToUserCompositeViewport"}],"dbName":null},"UserProjectViewport":{"fields":[{"name":"userId","kind":"scalar","type":"String"},{"name":"viewport","kind":"scalar","type":"Json"}],"dbName":null},"UserCompositeViewport":{"fields":[{"name":"userId","kind":"scalar","type":"String"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"viewport","kind":"scalar","type":"Json"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToUserCompositeViewport"}],"dbName":null},"InstanceLock":{"fields":[{"name":"stateId","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"token","kind":"scalar","type":"String"},{"name":"acquiredAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceLockToInstanceState"}],"dbName":null},"InstanceModel":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"model","kind":"scalar","type":"Json"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"}],"dbName":null},"HubModel":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"model","kind":"scalar","type":"Json"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"}],"dbName":null},"Operation":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"type","kind":"enum","type":"OperationType"},{"name":"status","kind":"enum","type":"OperationStatus"},{"name":"options","kind":"scalar","type":"Json"},{"name":"requestedInstanceIds","kind":"scalar","type":"Json"},{"name":"phases","kind":"scalar","type":"Json"},{"name":"startedAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"finishedAt","kind":"scalar","type":"DateTime"},{"name":"operationStates","kind":"object","type":"InstanceOperationState","relationName":"InstanceOperationStateToOperation"},{"name":"logs","kind":"object","type":"OperationLog","relationName":"OperationToOperationLog"}],"dbName":null},"InstanceOperationState":{"fields":[{"name":"operationId","kind":"scalar","type":"String"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"status","kind":"enum","type":"InstanceOperationStatus"},{"name":"currentResourceCount","kind":"scalar","type":"Int"},{"name":"totalResourceCount","kind":"scalar","type":"Int"},{"name":"model","kind":"scalar","type":"Json"},{"name":"resolvedInputs","kind":"scalar","type":"Json"},{"name":"startedAt","kind":"scalar","type":"DateTime"},{"name":"finishedAt","kind":"scalar","type":"DateTime"},{"name":"operation","kind":"object","type":"Operation","relationName":"InstanceOperationStateToOperation"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceOperationStateToInstanceState"}],"dbName":null},"OperationLog":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"operationId","kind":"scalar","type":"String"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"isSystem","kind":"scalar","type":"Boolean"},{"name":"content","kind":"scalar","type":"String"},{"name":"operation","kind":"object","type":"Operation","relationName":"OperationToOperationLog"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToOperationLog"}],"dbName":null},"Page":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"serviceAccountId","kind":"scalar","type":"String"},{"name":"content","kind":"scalar","type":"Json"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToPage"},{"name":"serviceAccount","kind":"object","type":"ServiceAccount","relationName":"PageToServiceAccount"},{"name":"artifacts","kind":"object","type":"Artifact","relationName":"ArtifactToPage"}],"dbName":null},"Secret":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"systemName","kind":"scalar","type":"String"},{"name":"serviceAccountId","kind":"scalar","type":"String"},{"name":"content","kind":"scalar","type":"Json"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToSecret"},{"name":"serviceAccount","kind":"object","type":"ServiceAccount","relationName":"SecretToServiceAccount"}],"dbName":null},"ServiceAccount":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"workers","kind":"object","type":"Worker","relationName":"ServiceAccountToWorker"},{"name":"artifacts","kind":"object","type":"Artifact","relationName":"ArtifactToServiceAccount"},{"name":"secrets","kind":"object","type":"Secret","relationName":"SecretToServiceAccount"},{"name":"terminals","kind":"object","type":"Terminal","relationName":"ServiceAccountToTerminal"},{"name":"pages","kind":"object","type":"Page","relationName":"PageToServiceAccount"},{"name":"customStatuses","kind":"object","type":"InstanceCustomStatus","relationName":"InstanceCustomStatusToServiceAccount"},{"name":"apiKeys","kind":"object","type":"ApiKey","relationName":"ApiKeyToServiceAccount"}],"dbName":null},"Terminal":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"status","kind":"enum","type":"TerminalStatus"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"serviceAccountId","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToTerminal"},{"name":"serviceAccount","kind":"object","type":"ServiceAccount","relationName":"ServiceAccountToTerminal"},{"name":"sessions","kind":"object","type":"TerminalSession","relationName":"TerminalToTerminalSession"},{"name":"artifacts","kind":"object","type":"Artifact","relationName":"ArtifactToTerminal"}],"dbName":null},"TerminalSession":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"terminalId","kind":"scalar","type":"String"},{"name":"startedAt","kind":"scalar","type":"DateTime"},{"name":"finishedAt","kind":"scalar","type":"DateTime"},{"name":"terminal","kind":"object","type":"Terminal","relationName":"TerminalToTerminalSession"},{"name":"logs","kind":"object","type":"TerminalSessionLog","relationName":"TerminalSessionToTerminalSessionLog"}],"dbName":null},"TerminalSessionLog":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"sessionId","kind":"scalar","type":"String"},{"name":"content","kind":"scalar","type":"String"},{"name":"session","kind":"object","type":"TerminalSession","relationName":"TerminalSessionToTerminalSessionLog"}],"dbName":null},"Trigger":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToTrigger"}],"dbName":null},"UnlockMethod":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"type","kind":"enum","type":"UnlockMethodType"},{"name":"encryptedIdentity","kind":"scalar","type":"String"},{"name":"recipient","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"}],"dbName":null},"Worker":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"identity","kind":"scalar","type":"String"},{"name":"serviceAccountId","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"serviceAccount","kind":"object","type":"ServiceAccount","relationName":"ServiceAccountToWorker"},{"name":"versions","kind":"object","type":"WorkerVersion","relationName":"WorkerToWorkerVersion"}],"dbName":null},"WorkerVersion":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"status","kind":"enum","type":"WorkerVersionStatus"},{"name":"enabled","kind":"scalar","type":"Boolean"},{"name":"runtimeId","kind":"scalar","type":"String"},{"name":"workerId","kind":"scalar","type":"String"},{"name":"digest","kind":"scalar","type":"String"},{"name":"apiKeyId","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"worker","kind":"object","type":"Worker","relationName":"WorkerToWorkerVersion"},{"name":"apiKey","kind":"object","type":"ApiKey","relationName":"ApiKeyToWorkerVersion"},{"name":"unitRegistrations","kind":"object","type":"WorkerUnitRegistration","relationName":"WorkerUnitRegistrationToWorkerVersion"},{"name":"logs","kind":"object","type":"WorkerVersionLog","relationName":"WorkerVersionToWorkerVersionLog"}],"dbName":null},"WorkerUnitRegistration":{"fields":[{"name":"stateId","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"params","kind":"scalar","type":"Json"},{"name":"workerVersionId","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToWorkerUnitRegistration"},{"name":"workerVersion","kind":"object","type":"WorkerVersion","relationName":"WorkerUnitRegistrationToWorkerVersion"}],"dbName":null},"WorkerVersionLog":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"workerVersionId","kind":"scalar","type":"String"},{"name":"content","kind":"scalar","type":"String"},{"name":"isSystem","kind":"scalar","type":"Boolean"},{"name":"workerVersion","kind":"object","type":"WorkerVersion","relationName":"WorkerVersionToWorkerVersionLog"}],"dbName":null}},"enums":{},"types":{}}');
1109
- config3.engineWasm = void 0;
1019
+ config3.runtimeDataModel = JSON.parse('{"models":{"ApiKey":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"serviceAccountId","kind":"scalar","type":"String"},{"name":"token","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"worker","kind":"object","type":"WorkerVersion","relationName":"ApiKeyToWorkerVersion"},{"name":"serviceAccount","kind":"object","type":"ServiceAccount","relationName":"ApiKeyToServiceAccount"}],"dbName":null},"Artifact":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"hash","kind":"scalar","type":"String"},{"name":"size","kind":"scalar","type":"Int"},{"name":"chunkSize","kind":"scalar","type":"Int"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"serviceAccounts","kind":"object","type":"ServiceAccount","relationName":"ArtifactToServiceAccount"},{"name":"instances","kind":"object","type":"InstanceState","relationName":"ArtifactToInstanceState"},{"name":"terminals","kind":"object","type":"Terminal","relationName":"ArtifactToTerminal"},{"name":"pages","kind":"object","type":"Page","relationName":"ArtifactToPage"}],"dbName":null},"InstanceCustomStatus":{"fields":[{"name":"stateId","kind":"scalar","type":"String"},{"name":"serviceAccountId","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"value","kind":"scalar","type":"String"},{"name":"message","kind":"scalar","type":"String"},{"name":"order","kind":"scalar","type":"Int"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceCustomStatusToInstanceState"},{"name":"serviceAccount","kind":"object","type":"ServiceAccount","relationName":"InstanceCustomStatusToServiceAccount"}],"dbName":null},"InstanceEvaluationState":{"fields":[{"name":"stateId","kind":"scalar","type":"String"},{"name":"status","kind":"enum","type":"InstanceEvaluationStatus"},{"name":"message","kind":"scalar","type":"String"},{"name":"model","kind":"scalar","type":"Json"},{"name":"evaluatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceEvaluationStateToInstanceState"}],"dbName":null},"InstanceState":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"instanceId","kind":"scalar","type":"String"},{"name":"status","kind":"enum","type":"InstanceStatus"},{"name":"source","kind":"enum","type":"InstanceSource"},{"name":"kind","kind":"scalar","type":"String"},{"name":"parentId","kind":"scalar","type":"String"},{"name":"inputHashNonce","kind":"scalar","type":"Int"},{"name":"selfHash","kind":"scalar","type":"Int"},{"name":"inputHash","kind":"scalar","type":"Int"},{"name":"outputHash","kind":"scalar","type":"Int"},{"name":"dependencyOutputHash","kind":"scalar","type":"Int"},{"name":"exportedArtifactIds","kind":"scalar","type":"Json"},{"name":"model","kind":"scalar","type":"Json"},{"name":"resolvedInputs","kind":"scalar","type":"Json"},{"name":"currentResourceCount","kind":"scalar","type":"Int"},{"name":"statusFields","kind":"scalar","type":"Json"},{"name":"parent","kind":"object","type":"InstanceState","relationName":"InstanceHierarchy"},{"name":"children","kind":"object","type":"InstanceState","relationName":"InstanceHierarchy"},{"name":"evaluationState","kind":"object","type":"InstanceEvaluationState","relationName":"InstanceEvaluationStateToInstanceState"},{"name":"operationStates","kind":"object","type":"InstanceOperationState","relationName":"InstanceOperationStateToInstanceState"},{"name":"secrets","kind":"object","type":"Secret","relationName":"InstanceStateToSecret"},{"name":"terminals","kind":"object","type":"Terminal","relationName":"InstanceStateToTerminal"},{"name":"pages","kind":"object","type":"Page","relationName":"InstanceStateToPage"},{"name":"triggers","kind":"object","type":"Trigger","relationName":"InstanceStateToTrigger"},{"name":"customStatuses","kind":"object","type":"InstanceCustomStatus","relationName":"InstanceCustomStatusToInstanceState"},{"name":"lock","kind":"object","type":"InstanceLock","relationName":"InstanceLockToInstanceState"},{"name":"workerRegistrations","kind":"object","type":"WorkerUnitRegistration","relationName":"InstanceStateToWorkerUnitRegistration"},{"name":"artifacts","kind":"object","type":"Artifact","relationName":"ArtifactToInstanceState"},{"name":"operationLogs","kind":"object","type":"OperationLog","relationName":"InstanceStateToOperationLog"},{"name":"userViewports","kind":"object","type":"UserCompositeViewport","relationName":"InstanceStateToUserCompositeViewport"}],"dbName":null},"UserProjectViewport":{"fields":[{"name":"userId","kind":"scalar","type":"String"},{"name":"viewport","kind":"scalar","type":"Json"}],"dbName":null},"UserCompositeViewport":{"fields":[{"name":"userId","kind":"scalar","type":"String"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"viewport","kind":"scalar","type":"Json"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToUserCompositeViewport"}],"dbName":null},"InstanceLock":{"fields":[{"name":"stateId","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"token","kind":"scalar","type":"String"},{"name":"acquiredAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceLockToInstanceState"}],"dbName":null},"InstanceModel":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"model","kind":"scalar","type":"Json"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"}],"dbName":null},"HubModel":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"model","kind":"scalar","type":"Json"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"}],"dbName":null},"Operation":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"type","kind":"enum","type":"OperationType"},{"name":"status","kind":"enum","type":"OperationStatus"},{"name":"options","kind":"scalar","type":"Json"},{"name":"requestedInstanceIds","kind":"scalar","type":"Json"},{"name":"phases","kind":"scalar","type":"Json"},{"name":"startedAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"finishedAt","kind":"scalar","type":"DateTime"},{"name":"operationStates","kind":"object","type":"InstanceOperationState","relationName":"InstanceOperationStateToOperation"},{"name":"logs","kind":"object","type":"OperationLog","relationName":"OperationToOperationLog"}],"dbName":null},"InstanceOperationState":{"fields":[{"name":"operationId","kind":"scalar","type":"String"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"status","kind":"enum","type":"InstanceOperationStatus"},{"name":"currentResourceCount","kind":"scalar","type":"Int"},{"name":"totalResourceCount","kind":"scalar","type":"Int"},{"name":"model","kind":"scalar","type":"Json"},{"name":"resolvedInputs","kind":"scalar","type":"Json"},{"name":"startedAt","kind":"scalar","type":"DateTime"},{"name":"finishedAt","kind":"scalar","type":"DateTime"},{"name":"operation","kind":"object","type":"Operation","relationName":"InstanceOperationStateToOperation"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceOperationStateToInstanceState"}],"dbName":null},"OperationLog":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"operationId","kind":"scalar","type":"String"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"isSystem","kind":"scalar","type":"Boolean"},{"name":"content","kind":"scalar","type":"String"},{"name":"operation","kind":"object","type":"Operation","relationName":"OperationToOperationLog"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToOperationLog"}],"dbName":null},"Page":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"serviceAccountId","kind":"scalar","type":"String"},{"name":"content","kind":"scalar","type":"Json"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToPage"},{"name":"serviceAccount","kind":"object","type":"ServiceAccount","relationName":"PageToServiceAccount"},{"name":"artifacts","kind":"object","type":"Artifact","relationName":"ArtifactToPage"}],"dbName":null},"Secret":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"systemName","kind":"scalar","type":"String"},{"name":"serviceAccountId","kind":"scalar","type":"String"},{"name":"content","kind":"scalar","type":"Json"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToSecret"},{"name":"serviceAccount","kind":"object","type":"ServiceAccount","relationName":"SecretToServiceAccount"}],"dbName":null},"ServiceAccount":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"workers","kind":"object","type":"Worker","relationName":"ServiceAccountToWorker"},{"name":"artifacts","kind":"object","type":"Artifact","relationName":"ArtifactToServiceAccount"},{"name":"secrets","kind":"object","type":"Secret","relationName":"SecretToServiceAccount"},{"name":"terminals","kind":"object","type":"Terminal","relationName":"ServiceAccountToTerminal"},{"name":"pages","kind":"object","type":"Page","relationName":"PageToServiceAccount"},{"name":"customStatuses","kind":"object","type":"InstanceCustomStatus","relationName":"InstanceCustomStatusToServiceAccount"},{"name":"apiKeys","kind":"object","type":"ApiKey","relationName":"ApiKeyToServiceAccount"}],"dbName":null},"Terminal":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"status","kind":"enum","type":"TerminalStatus"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"serviceAccountId","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToTerminal"},{"name":"serviceAccount","kind":"object","type":"ServiceAccount","relationName":"ServiceAccountToTerminal"},{"name":"sessions","kind":"object","type":"TerminalSession","relationName":"TerminalToTerminalSession"},{"name":"artifacts","kind":"object","type":"Artifact","relationName":"ArtifactToTerminal"}],"dbName":null},"TerminalSession":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"terminalId","kind":"scalar","type":"String"},{"name":"startedAt","kind":"scalar","type":"DateTime"},{"name":"finishedAt","kind":"scalar","type":"DateTime"},{"name":"terminal","kind":"object","type":"Terminal","relationName":"TerminalToTerminalSession"},{"name":"logs","kind":"object","type":"TerminalSessionLog","relationName":"TerminalSessionToTerminalSessionLog"}],"dbName":null},"TerminalSessionLog":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"sessionId","kind":"scalar","type":"String"},{"name":"content","kind":"scalar","type":"String"},{"name":"session","kind":"object","type":"TerminalSession","relationName":"TerminalSessionToTerminalSessionLog"}],"dbName":null},"Trigger":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"stateId","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"spec","kind":"scalar","type":"Json"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToTrigger"}],"dbName":null},"UnlockMethod":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"type","kind":"enum","type":"UnlockMethodType"},{"name":"encryptedIdentity","kind":"scalar","type":"String"},{"name":"recipient","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"}],"dbName":null},"Worker":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"identity","kind":"scalar","type":"String"},{"name":"serviceAccountId","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"serviceAccount","kind":"object","type":"ServiceAccount","relationName":"ServiceAccountToWorker"},{"name":"versions","kind":"object","type":"WorkerVersion","relationName":"WorkerToWorkerVersion"}],"dbName":null},"WorkerVersion":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"meta","kind":"scalar","type":"Json"},{"name":"status","kind":"enum","type":"WorkerVersionStatus"},{"name":"enabled","kind":"scalar","type":"Boolean"},{"name":"runtimeId","kind":"scalar","type":"String"},{"name":"workerId","kind":"scalar","type":"String"},{"name":"digest","kind":"scalar","type":"String"},{"name":"apiKeyId","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"worker","kind":"object","type":"Worker","relationName":"WorkerToWorkerVersion"},{"name":"apiKey","kind":"object","type":"ApiKey","relationName":"ApiKeyToWorkerVersion"},{"name":"unitRegistrations","kind":"object","type":"WorkerUnitRegistration","relationName":"WorkerUnitRegistrationToWorkerVersion"},{"name":"logs","kind":"object","type":"WorkerVersionLog","relationName":"WorkerVersionToWorkerVersionLog"}],"dbName":null},"WorkerUnitRegistration":{"fields":[{"name":"stateId","kind":"scalar","type":"String"},{"name":"name","kind":"scalar","type":"String"},{"name":"params","kind":"scalar","type":"Json"},{"name":"workerVersionId","kind":"scalar","type":"String"},{"name":"createdAt","kind":"scalar","type":"DateTime"},{"name":"updatedAt","kind":"scalar","type":"DateTime"},{"name":"state","kind":"object","type":"InstanceState","relationName":"InstanceStateToWorkerUnitRegistration"},{"name":"workerVersion","kind":"object","type":"WorkerVersion","relationName":"WorkerUnitRegistrationToWorkerVersion"}],"dbName":null},"WorkerVersionLog":{"fields":[{"name":"id","kind":"scalar","type":"String"},{"name":"workerVersionId","kind":"scalar","type":"String"},{"name":"content","kind":"scalar","type":"String"},{"name":"isSystem","kind":"scalar","type":"Boolean"},{"name":"workerVersion","kind":"object","type":"WorkerVersion","relationName":"WorkerVersionToWorkerVersionLog"}],"dbName":null}},"enums":{},"types":{}}');
1110
1020
  async function decodeBase64AsWasm3(wasmBase64) {
1111
1021
  const { Buffer: Buffer2 } = await import('node:buffer');
1112
1022
  const wasmArray = Buffer2.from(wasmBase64, "base64");
1113
1023
  return new WebAssembly.Module(wasmArray);
1114
1024
  }
1115
1025
  config3.compilerWasm = {
1116
- getRuntime: async () => await import('@prisma/client/runtime/query_compiler_bg.sqlite.mjs'),
1026
+ getRuntime: async () => await import('@prisma/client/runtime/query_compiler_fast_bg.sqlite.mjs'),
1117
1027
  getQueryCompilerWasmModule: async () => {
1118
- const { wasm } = await import('@prisma/client/runtime/query_compiler_bg.sqlite.wasm-base64.mjs');
1028
+ const { wasm } = await import('@prisma/client/runtime/query_compiler_fast_bg.sqlite.wasm-base64.mjs');
1119
1029
  return await decodeBase64AsWasm3(wasm);
1120
- }
1030
+ },
1031
+ importName: "./query_compiler_fast_bg.js"
1121
1032
  };
1122
- function getPrismaClientClass3(dirname5) {
1123
- config3.dirname = dirname5;
1124
- return runtime2.getPrismaClient(config3);
1033
+ function getPrismaClientClass3() {
1034
+ return runtime8.getPrismaClient(config3);
1125
1035
  }
1126
- runtime2.Extensions.getExtensionContext;
1036
+ runtime8.Extensions.getExtensionContext;
1127
1037
  ({
1128
- DbNull: runtime2.objectEnumValues.classes.DbNull,
1129
- JsonNull: runtime2.objectEnumValues.classes.JsonNull,
1130
- AnyNull: runtime2.objectEnumValues.classes.AnyNull
1038
+ DbNull: runtime8.NullTypes.DbNull,
1039
+ JsonNull: runtime8.NullTypes.JsonNull,
1040
+ AnyNull: runtime8.NullTypes.AnyNull
1131
1041
  });
1132
- var DbNull3 = runtime2.objectEnumValues.instances.DbNull;
1133
- runtime2.objectEnumValues.instances.JsonNull;
1134
- runtime2.objectEnumValues.instances.AnyNull;
1135
- runtime2.makeStrictEnum({
1042
+ var DbNull4 = runtime8.DbNull;
1043
+ runtime8.makeStrictEnum({
1136
1044
  Serializable: "Serializable"
1137
1045
  });
1138
- runtime2.Extensions.defineExtension;
1046
+ runtime8.Extensions.defineExtension;
1139
1047
 
1140
1048
  // src/database/_generated/project/client.ts
1141
1049
  globalThis["__dirname"] = path4.dirname(fileURLToPath(import.meta.url));
1142
- var PrismaClient3 = getPrismaClientClass3(__dirname);
1050
+ var PrismaClient3 = getPrismaClientClass3();
1143
1051
 
1144
1052
  // src/database/local/project.ts
1145
1053
  var LocalProjectDatabaseBackend = class _LocalProjectDatabaseBackend {
@@ -1150,12 +1058,11 @@ var LocalProjectDatabaseBackend = class _LocalProjectDatabaseBackend {
1150
1058
  const databasePath = `${this.highstatePath}/projects/${projectId}`;
1151
1059
  await mkdir(databasePath, { recursive: true });
1152
1060
  const databaseUrl = `file:${databasePath}/project.db`;
1153
- const adapter = new PrismaLibSQL({
1061
+ const adapter = new PrismaLibSql({
1154
1062
  url: databaseUrl,
1155
1063
  encryptionKey: masterKey
1156
1064
  });
1157
- const database = new PrismaClient3({ adapter });
1158
- return [database, databaseUrl];
1065
+ return new PrismaClient3({ adapter });
1159
1066
  }
1160
1067
  static async create(config4, logger) {
1161
1068
  const highstatePath = await getCodebaseHighstatePath(config4, logger);
@@ -1216,11 +1123,16 @@ var DatabaseManagerImpl = class {
1216
1123
  const logger = createProjectLogger(this.logger, projectId);
1217
1124
  const masterKey = await this.getProjectMasterKey(projectId);
1218
1125
  const hexMasterKey = masterKey?.toString("hex");
1219
- const [database, databaseUrl] = await this.projectDatabaseBackend.openProjectDatabase(
1220
- projectId,
1221
- hexMasterKey
1126
+ const database = await this.projectDatabaseBackend.openProjectDatabase(projectId, hexMasterKey);
1127
+ await migrateDatabase(
1128
+ database,
1129
+ migrationPacks.project,
1130
+ 0,
1131
+ // current version
1132
+ () => Promise.resolve(),
1133
+ // project will be created later
1134
+ logger
1222
1135
  );
1223
- await migrateDatabase(databaseUrl, "project", hexMasterKey, logger);
1224
1136
  this.projectDatabases.set(projectId, database);
1225
1137
  return database;
1226
1138
  }
@@ -1229,39 +1141,37 @@ var DatabaseManagerImpl = class {
1229
1141
  if (cachedDatabase) {
1230
1142
  return cachedDatabase;
1231
1143
  }
1144
+ const logger = createProjectLogger(this.logger, projectId);
1232
1145
  const masterKey = await this.getProjectMasterKey(projectId);
1233
1146
  const hexMasterKey = masterKey?.toString("hex");
1234
1147
  let database = await this.backend.$transaction(async (tx) => {
1235
- const databaseEntity = await tx.project.findUnique({
1148
+ const project = await tx.project.findUnique({
1236
1149
  where: { id: projectId },
1237
1150
  select: { databaseVersion: true }
1238
1151
  });
1239
- if (!databaseEntity) {
1152
+ if (!project) {
1240
1153
  throw new ProjectNotFoundError(projectId);
1241
1154
  }
1242
- if (databaseEntity.databaseVersion > projectDatabaseVersion) {
1243
- throw new BackendError(
1244
- `Project database version (${databaseEntity.databaseVersion}) is newer than expected (${projectDatabaseVersion}).`
1245
- );
1246
- }
1247
- if (databaseEntity.databaseVersion === projectDatabaseVersion) {
1248
- return;
1249
- }
1250
- const [database2, databaseUrl] = await this.projectDatabaseBackend.openProjectDatabase(
1155
+ const database2 = await this.projectDatabaseBackend.openProjectDatabase(
1251
1156
  projectId,
1252
1157
  hexMasterKey
1253
1158
  );
1254
- if (databaseEntity.databaseVersion < projectDatabaseVersion) {
1255
- await migrateDatabase(databaseUrl, "project", hexMasterKey, this.logger);
1256
- }
1257
- await tx.project.update({
1258
- where: { id: projectId },
1259
- data: { databaseVersion: projectDatabaseVersion }
1260
- });
1159
+ await migrateDatabase(
1160
+ database2,
1161
+ migrationPacks.project,
1162
+ project.databaseVersion,
1163
+ async (version) => {
1164
+ await tx.project.update({
1165
+ where: { id: projectId },
1166
+ data: { databaseVersion: version }
1167
+ });
1168
+ },
1169
+ logger
1170
+ );
1261
1171
  return database2;
1262
1172
  });
1263
1173
  if (!database) {
1264
- const [_database] = await this.projectDatabaseBackend.openProjectDatabase(
1174
+ const _database = await this.projectDatabaseBackend.openProjectDatabase(
1265
1175
  projectId,
1266
1176
  hexMasterKey
1267
1177
  );
@@ -1438,6 +1348,7 @@ var InstanceStateService = class {
1438
1348
  patch: {
1439
1349
  status: "undeployed",
1440
1350
  statusFields: null,
1351
+ selfHash: null,
1441
1352
  inputHash: null,
1442
1353
  outputHash: null,
1443
1354
  dependencyOutputHash: null,
@@ -1485,13 +1396,14 @@ var InstanceStateService = class {
1485
1396
  where: { id: state.id },
1486
1397
  data: {
1487
1398
  status: "undeployed",
1488
- statusFields: DbNull3,
1399
+ statusFields: DbNull4,
1400
+ selfHash: null,
1489
1401
  inputHash: null,
1490
1402
  outputHash: null,
1491
1403
  dependencyOutputHash: null,
1492
1404
  currentResourceCount: null,
1493
- model: DbNull3,
1494
- resolvedInputs: DbNull3
1405
+ model: DbNull4,
1406
+ resolvedInputs: DbNull4
1495
1407
  }
1496
1408
  });
1497
1409
  if (clearTerminalData) {
@@ -2017,7 +1929,7 @@ var ProjectEvaluationSubsystem = class _ProjectEvaluationSubsystem {
2017
1929
  stateId: instanceIdToStateMap.get(ei.instanceId).id,
2018
1930
  status: ei.status,
2019
1931
  message: ei.message,
2020
- model: ei.model ?? DbNull3
1932
+ model: ei.model ?? DbNull4
2021
1933
  };
2022
1934
  });
2023
1935
  const existingStates = await tx.instanceEvaluationState.findMany({
@@ -6110,6 +6022,7 @@ var LocalRunnerBackend = class _LocalRunnerBackend {
6110
6022
  const envVars = {
6111
6023
  HIGHSTATE_CACHE_DIR: this.cacheDir,
6112
6024
  HIGHSTATE_TEMP_PATH: unitTempPath,
6025
+ PULUMI_K8S_DELETE_UNREACHABLE: options.deleteUnreachable ? "true" : "",
6113
6026
  ...options.envVars
6114
6027
  };
6115
6028
  if (options.debug) {
@@ -6723,10 +6636,8 @@ var TerminalManager = class _TerminalManager {
6723
6636
  if (!terminal) {
6724
6637
  throw new Error(`Terminal "${terminalId}" not found`);
6725
6638
  }
6726
- const sessionId = v7();
6727
6639
  const session = await database.terminalSession.create({
6728
6640
  data: {
6729
- id: sessionId,
6730
6641
  terminalId
6731
6642
  }
6732
6643
  });
@@ -8443,7 +8354,7 @@ var RuntimeOperation = class {
8443
8354
  }
8444
8355
  },
8445
8356
  true,
8446
- // allow partial locks to allow independent free branches to run
8357
+ // allow partial locks to allow independent branches to run
8447
8358
  this.workset.abortController.signal,
8448
8359
  6e4,
8449
8360
  // wait up to 60 seconds for unlock events before retrying
@@ -8603,6 +8514,26 @@ ${errors.join("\n")}`
8603
8514
  if (this.operation.status === "failing") {
8604
8515
  throw new AbortError("The operation is failing, aborting current branch (still not failed)");
8605
8516
  }
8517
+ if (state.status === "deployed" && state.selfHash != null && state.dependencyOutputHash != null && // ignore explicitly requested updates
8518
+ !this.operation.requestedInstanceIds.includes(instance.id) && // ignore when side effects are requested
8519
+ !this.operation.options.refresh && !this.operation.options.deleteUnreachableResources && !this.operation.options.forceUpdateDependencies) {
8520
+ const expected = await this.context.getUpToDateInputHashOutput(instance);
8521
+ if (expected.selfHash === state.selfHash && expected.dependencyOutputHash === state.dependencyOutputHash) {
8522
+ logger.info("skipping unit update (short-circuit: no effective changes)");
8523
+ const now = /* @__PURE__ */ new Date();
8524
+ await this.workset.updateState(instance.id, {
8525
+ operationState: {
8526
+ status: "skipped",
8527
+ startedAt: now,
8528
+ finishedAt: now
8529
+ },
8530
+ instanceState: {
8531
+ inputHash: expected.inputHash
8532
+ }
8533
+ });
8534
+ return;
8535
+ }
8536
+ }
8606
8537
  logger.info("updating unit");
8607
8538
  await this.workset.updateState(instance.id, {
8608
8539
  operationState: {
@@ -8625,6 +8556,7 @@ ${errors.join("\n")}`
8625
8556
  instanceName: instance.name,
8626
8557
  config: config4,
8627
8558
  refresh: this.operation.options.refresh,
8559
+ deleteUnreachable: this.operation.options.deleteUnreachableResources,
8628
8560
  secrets,
8629
8561
  artifacts,
8630
8562
  signal,
@@ -8683,6 +8615,7 @@ ${errors.join("\n")}`
8683
8615
  instanceName: instance.name,
8684
8616
  config: this.prepareUnitConfig(instance, secrets, invokedTriggers),
8685
8617
  refresh: this.operation.options.refresh,
8618
+ deleteUnreachable: this.operation.options.deleteUnreachableResources,
8686
8619
  secrets,
8687
8620
  signal,
8688
8621
  forceSignal,
@@ -8799,13 +8732,47 @@ ${errors.join("\n")}`
8799
8732
  return {
8800
8733
  instanceId: instance.id,
8801
8734
  args: instance.args ?? {},
8802
- inputs: mapValues(resolvedInputs ?? {}, (input) => input.map((value) => value.input)),
8735
+ inputs: mapValues(
8736
+ resolvedInputs ?? {},
8737
+ (input, inputName) => input.map((value) => this.getUnitInputRef(inputName, value))
8738
+ ),
8803
8739
  invokedTriggers,
8804
8740
  secretNames: Object.keys(secrets),
8805
8741
  stateIdMap: this.context.getInstanceIdToStateIdMap(instance.id),
8806
8742
  importBasePath: this.libraryBackend.importPath
8807
8743
  };
8808
8744
  }
8745
+ getUnitInputRef(inputName, input) {
8746
+ const instance = this.context.getInstance(input.input.instanceId);
8747
+ const component = this.context.library.components[instance.type];
8748
+ const outputSpec = component.outputs[input.input.output];
8749
+ if (!outputSpec) {
8750
+ throw new Error(
8751
+ `Output "${input.input.output}" is not defined on component "${instance.type}"`
8752
+ );
8753
+ }
8754
+ const entity = this.context.library.entities[outputSpec.type];
8755
+ if (!entity) {
8756
+ throw new Error(`Entity type "${outputSpec.type}" is not defined in the library`);
8757
+ }
8758
+ if (input.type === outputSpec.type || entity.extensions?.includes(input.type)) {
8759
+ return {
8760
+ instanceId: input.input.instanceId,
8761
+ output: input.input.output
8762
+ };
8763
+ }
8764
+ const inclusion = entity.inclusions?.find((inc) => inc.type === input.type);
8765
+ if (!inclusion) {
8766
+ throw new Error(
8767
+ `Cannot use output "${input.input.output}" of type "${outputSpec.type}" from instance "${input.input.instanceId}" for input "${inputName}" of type "${input.type}": no matching inclusion found in entity "${entity.type}"`
8768
+ );
8769
+ }
8770
+ return {
8771
+ instanceId: input.input.instanceId,
8772
+ output: input.input.output,
8773
+ inclusion
8774
+ };
8775
+ }
8809
8776
  async handleUnitStateUpdate(update, state) {
8810
8777
  switch (update.type) {
8811
8778
  case "message":
@@ -8866,7 +8833,8 @@ ${errors.join("\n")}`
8866
8833
  const artifactIds = update.exportedArtifactIds ? Object.values(update.exportedArtifactIds).flat() : [];
8867
8834
  if (update.operationType !== "destroy") {
8868
8835
  state.outputHash = update.outputHash ?? null;
8869
- const { inputHash, dependencyOutputHash } = await this.context.getUpToDateInputHashOutput(instance);
8836
+ const { selfHash, inputHash, dependencyOutputHash } = await this.context.getUpToDateInputHashOutput(instance);
8837
+ data.selfHash = selfHash;
8870
8838
  data.inputHash = inputHash;
8871
8839
  data.dependencyOutputHash = dependencyOutputHash;
8872
8840
  data.outputHash = update.outputHash;
@@ -8878,6 +8846,7 @@ ${errors.join("\n")}`
8878
8846
  data.parentId = null;
8879
8847
  }
8880
8848
  } else {
8849
+ data.selfHash = null;
8881
8850
  data.inputHash = null;
8882
8851
  data.dependencyOutputHash = null;
8883
8852
  data.outputHash = null;
@@ -9509,6 +9478,6 @@ async function disposeServices(services) {
9509
9478
  await Promise.all(promises);
9510
9479
  }
9511
9480
 
9512
- export { ApiKeyService, ArtifactService, PrismaClient2 as BackendDatabase, BackendUnlockService, DatabaseManagerImpl, DbNull3 as DbNull, InstanceLockService, InstanceStateService, OperationManager, OperationService, PrismaClient3 as ProjectDatabase, ProjectModelService, ProjectService, ProjectUnlockService, SecretService, SettingsService, TerminalManager, TerminalSessionService, UnitExtraService, WorkerService, artifactChunkSize, backendDatabaseVersion, createBackendDatabaseBackend, createLibraryBackend, createProjectDatabaseBackend, createServices, createTerminalBackend, databaseConfig, databaseManagerConfig, disposeServices, ensureWellKnownEntitiesCreated, getOrCreateBackendIdentity, getSharedServices, includeForInstanceState, libraryBackendConfig, loadConfig, mapInstanceStateResult, projectDatabaseVersion, projectUnlockServiceConfig, terminalBackendConfig };
9481
+ export { ApiKeyService, ArtifactService, PrismaClient2 as BackendDatabase, BackendUnlockService, DatabaseManagerImpl, DbNull4 as DbNull, InstanceLockService, InstanceStateService, OperationManager, OperationService, PrismaClient3 as ProjectDatabase, ProjectModelService, ProjectService, ProjectUnlockService, SecretService, SettingsService, TerminalManager, TerminalSessionService, UnitExtraService, WorkerService, artifactChunkSize, backendDatabaseVersion, createBackendDatabaseBackend, createLibraryBackend, createProjectDatabaseBackend, createServices, createTerminalBackend, databaseConfig, databaseManagerConfig, disposeServices, ensureWellKnownEntitiesCreated, getOrCreateBackendIdentity, getSharedServices, includeForInstanceState, libraryBackendConfig, loadConfig, mapInstanceStateResult, migrateDatabase, migrationPacks, projectDatabaseVersion, projectUnlockServiceConfig, terminalBackendConfig };
9513
9482
  //# sourceMappingURL=index.js.map
9514
9483
  //# sourceMappingURL=index.js.map