@proletariat/cli 0.3.50 → 0.3.52

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 (87) hide show
  1. package/dist/commands/agent/status.js +1 -0
  2. package/dist/commands/asana/connect.d.ts +15 -0
  3. package/dist/commands/asana/connect.js +267 -0
  4. package/dist/commands/asana/sync.d.ts +15 -0
  5. package/dist/commands/asana/sync.js +189 -0
  6. package/dist/commands/config/index.js +7 -1
  7. package/dist/commands/execution/list.js +3 -0
  8. package/dist/commands/execution/view.js +10 -0
  9. package/dist/commands/monday/connect.d.ts +16 -0
  10. package/dist/commands/monday/connect.js +212 -0
  11. package/dist/commands/monday/sync.d.ts +14 -0
  12. package/dist/commands/monday/sync.js +178 -0
  13. package/dist/commands/orchestrator/start.d.ts +6 -0
  14. package/dist/commands/orchestrator/start.js +149 -11
  15. package/dist/commands/session/list.js +6 -5
  16. package/dist/commands/work/index.js +7 -0
  17. package/dist/commands/work/jira.d.ts +28 -0
  18. package/dist/commands/work/jira.js +225 -0
  19. package/dist/commands/work/source/set.d.ts +12 -0
  20. package/dist/commands/work/source/set.js +52 -0
  21. package/dist/commands/work/source.d.ts +11 -0
  22. package/dist/commands/work/source.js +53 -0
  23. package/dist/commands/work/spawn.d.ts +1 -0
  24. package/dist/commands/work/spawn.js +73 -8
  25. package/dist/commands/work/start.d.ts +8 -0
  26. package/dist/commands/work/start.js +241 -3
  27. package/dist/lib/asana/client.d.ts +15 -0
  28. package/dist/lib/asana/client.js +120 -0
  29. package/dist/lib/asana/config.d.ts +9 -0
  30. package/dist/lib/asana/config.js +61 -0
  31. package/dist/lib/asana/index.d.ts +5 -0
  32. package/dist/lib/asana/index.js +4 -0
  33. package/dist/lib/asana/mapper.d.ts +13 -0
  34. package/dist/lib/asana/mapper.js +70 -0
  35. package/dist/lib/asana/sync.d.ts +13 -0
  36. package/dist/lib/asana/sync.js +36 -0
  37. package/dist/lib/asana/types.d.ts +40 -0
  38. package/dist/lib/asana/types.js +1 -0
  39. package/dist/lib/database/drizzle-schema.d.ts +393 -0
  40. package/dist/lib/database/drizzle-schema.js +45 -0
  41. package/dist/lib/execution/config.d.ts +10 -0
  42. package/dist/lib/execution/config.js +19 -0
  43. package/dist/lib/execution/runners.d.ts +10 -0
  44. package/dist/lib/execution/runners.js +110 -1
  45. package/dist/lib/execution/spawner.js +26 -0
  46. package/dist/lib/execution/storage.d.ts +4 -0
  47. package/dist/lib/execution/storage.js +8 -3
  48. package/dist/lib/execution/types.d.ts +4 -0
  49. package/dist/lib/external-issues/adapters.d.ts +18 -1
  50. package/dist/lib/external-issues/adapters.js +49 -1
  51. package/dist/lib/external-issues/index.d.ts +4 -1
  52. package/dist/lib/external-issues/index.js +5 -0
  53. package/dist/lib/external-issues/jira.d.ts +23 -0
  54. package/dist/lib/external-issues/jira.js +223 -0
  55. package/dist/lib/external-issues/linear.js +4 -3
  56. package/dist/lib/external-issues/mapper.d.ts +3 -2
  57. package/dist/lib/external-issues/mapper.js +5 -2
  58. package/dist/lib/external-issues/mapping-store.d.ts +12 -0
  59. package/dist/lib/external-issues/mapping-store.js +164 -0
  60. package/dist/lib/external-issues/types.d.ts +34 -0
  61. package/dist/lib/external-issues/validation.js +11 -0
  62. package/dist/lib/external-issues/work-start.d.ts +10 -0
  63. package/dist/lib/external-issues/work-start.js +12 -0
  64. package/dist/lib/linear/mapper.d.ts +2 -0
  65. package/dist/lib/linear/mapper.js +66 -2
  66. package/dist/lib/monday/client.d.ts +14 -0
  67. package/dist/lib/monday/client.js +113 -0
  68. package/dist/lib/monday/config.d.ts +10 -0
  69. package/dist/lib/monday/config.js +64 -0
  70. package/dist/lib/monday/index.d.ts +5 -0
  71. package/dist/lib/monday/index.js +4 -0
  72. package/dist/lib/monday/mapper.d.ts +14 -0
  73. package/dist/lib/monday/mapper.js +89 -0
  74. package/dist/lib/monday/sync.d.ts +13 -0
  75. package/dist/lib/monday/sync.js +45 -0
  76. package/dist/lib/monday/types.d.ts +38 -0
  77. package/dist/lib/monday/types.js +4 -0
  78. package/dist/lib/pmo/schema.d.ts +10 -1
  79. package/dist/lib/pmo/schema.js +73 -0
  80. package/dist/lib/pmo/storage/base.js +32 -0
  81. package/dist/lib/prompt-json.d.ts +11 -0
  82. package/dist/lib/work-source/config.d.ts +14 -0
  83. package/dist/lib/work-source/config.js +70 -0
  84. package/dist/lib/work-source/index.d.ts +1 -0
  85. package/dist/lib/work-source/index.js +1 -0
  86. package/oclif.manifest.json +2531 -1964
  87. package/package.json +1 -1
@@ -0,0 +1,36 @@
1
+ export class AsanaSync {
2
+ client;
3
+ mapper;
4
+ constructor(client, mapper) {
5
+ this.client = client;
6
+ this.mapper = mapper;
7
+ }
8
+ buildTaskName(ticket) {
9
+ return `${ticket.id}: ${ticket.title}`;
10
+ }
11
+ buildTaskNotes(ticket) {
12
+ const parts = [ticket.description?.trim() || '', '', '---', `Synced from PMO ticket ${ticket.id}`];
13
+ return parts.join('\n').trim();
14
+ }
15
+ isCompletedStatus(ticket) {
16
+ return ticket.statusCategory === 'completed' || ticket.statusCategory === 'canceled';
17
+ }
18
+ async createTaskForTicket(ticket, projectGid) {
19
+ const task = await this.client.createTask({
20
+ name: this.buildTaskName(ticket),
21
+ notes: this.buildTaskNotes(ticket),
22
+ completed: this.isCompletedStatus(ticket),
23
+ projects: [projectGid],
24
+ });
25
+ this.mapper.createOrUpdateMapping(ticket.id, task.gid, projectGid);
26
+ return task.gid;
27
+ }
28
+ async syncTicket(ticket, taskGid) {
29
+ await this.client.updateTask(taskGid, {
30
+ name: this.buildTaskName(ticket),
31
+ notes: this.buildTaskNotes(ticket),
32
+ completed: this.isCompletedStatus(ticket),
33
+ });
34
+ this.mapper.updateSyncTimestamp(ticket.id);
35
+ }
36
+ }
@@ -0,0 +1,40 @@
1
+ export interface AsanaConfig {
2
+ accessToken: string;
3
+ workspaceGid?: string;
4
+ workspaceName?: string;
5
+ projectGid?: string;
6
+ projectName?: string;
7
+ }
8
+ export interface AsanaWorkspace {
9
+ gid: string;
10
+ name: string;
11
+ }
12
+ export interface AsanaProject {
13
+ gid: string;
14
+ name: string;
15
+ }
16
+ export interface AsanaUser {
17
+ gid: string;
18
+ name: string;
19
+ email?: string;
20
+ workspaces: AsanaWorkspace[];
21
+ }
22
+ export interface AsanaTask {
23
+ gid: string;
24
+ name: string;
25
+ completed: boolean;
26
+ notes?: string;
27
+ }
28
+ export interface AsanaTaskMap {
29
+ pmoTicketId: string;
30
+ asanaTaskGid: string;
31
+ asanaProjectGid?: string;
32
+ lastSyncedAt?: Date;
33
+ createdAt: Date;
34
+ }
35
+ export interface AsanaTaskUpsertInput {
36
+ name: string;
37
+ notes?: string;
38
+ completed?: boolean;
39
+ projects?: string[];
40
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -3684,6 +3684,74 @@ export declare const pmoAgentWork: import("drizzle-orm/sqlite-core").SQLiteTable
3684
3684
  identity: undefined;
3685
3685
  generated: undefined;
3686
3686
  }, object>;
3687
+ externalSource: import("drizzle-orm/sqlite-core").SQLiteColumn<{
3688
+ name: "external_source";
3689
+ tableName: "agent_work";
3690
+ dataType: "string";
3691
+ columnType: "SQLiteText";
3692
+ data: string;
3693
+ driverParam: string;
3694
+ notNull: false;
3695
+ hasDefault: false;
3696
+ isPrimaryKey: false;
3697
+ isAutoincrement: false;
3698
+ hasRuntimeDefault: false;
3699
+ enumValues: [string, ...string[]];
3700
+ baseColumn: never;
3701
+ identity: undefined;
3702
+ generated: undefined;
3703
+ }, object>;
3704
+ externalKey: import("drizzle-orm/sqlite-core").SQLiteColumn<{
3705
+ name: "external_key";
3706
+ tableName: "agent_work";
3707
+ dataType: "string";
3708
+ columnType: "SQLiteText";
3709
+ data: string;
3710
+ driverParam: string;
3711
+ notNull: false;
3712
+ hasDefault: false;
3713
+ isPrimaryKey: false;
3714
+ isAutoincrement: false;
3715
+ hasRuntimeDefault: false;
3716
+ enumValues: [string, ...string[]];
3717
+ baseColumn: never;
3718
+ identity: undefined;
3719
+ generated: undefined;
3720
+ }, object>;
3721
+ externalId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
3722
+ name: "external_id";
3723
+ tableName: "agent_work";
3724
+ dataType: "string";
3725
+ columnType: "SQLiteText";
3726
+ data: string;
3727
+ driverParam: string;
3728
+ notNull: false;
3729
+ hasDefault: false;
3730
+ isPrimaryKey: false;
3731
+ isAutoincrement: false;
3732
+ hasRuntimeDefault: false;
3733
+ enumValues: [string, ...string[]];
3734
+ baseColumn: never;
3735
+ identity: undefined;
3736
+ generated: undefined;
3737
+ }, object>;
3738
+ externalUrl: import("drizzle-orm/sqlite-core").SQLiteColumn<{
3739
+ name: "external_url";
3740
+ tableName: "agent_work";
3741
+ dataType: "string";
3742
+ columnType: "SQLiteText";
3743
+ data: string;
3744
+ driverParam: string;
3745
+ notNull: false;
3746
+ hasDefault: false;
3747
+ isPrimaryKey: false;
3748
+ isAutoincrement: false;
3749
+ hasRuntimeDefault: false;
3750
+ enumValues: [string, ...string[]];
3751
+ baseColumn: never;
3752
+ identity: undefined;
3753
+ generated: undefined;
3754
+ }, object>;
3687
3755
  startedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
3688
3756
  name: "started_at";
3689
3757
  tableName: "agent_work";
@@ -3901,6 +3969,325 @@ export declare const pmoContainers: import("drizzle-orm/sqlite-core").SQLiteTabl
3901
3969
  };
3902
3970
  dialect: "sqlite";
3903
3971
  }>;
3972
+ /**
3973
+ * Provider-agnostic external issue ↔ execution mapping.
3974
+ */
3975
+ export declare const pmoExternalExecutionMap: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
3976
+ name: "pmo_external_execution_map";
3977
+ schema: undefined;
3978
+ columns: {
3979
+ provider: import("drizzle-orm/sqlite-core").SQLiteColumn<{
3980
+ name: "provider";
3981
+ tableName: "pmo_external_execution_map";
3982
+ dataType: "string";
3983
+ columnType: "SQLiteText";
3984
+ data: "linear" | "jira" | "asana" | "monday" | "pmo";
3985
+ driverParam: string;
3986
+ notNull: true;
3987
+ hasDefault: false;
3988
+ isPrimaryKey: false;
3989
+ isAutoincrement: false;
3990
+ hasRuntimeDefault: false;
3991
+ enumValues: ["linear", "jira", "asana", "monday", "pmo"];
3992
+ baseColumn: never;
3993
+ identity: undefined;
3994
+ generated: undefined;
3995
+ }, object>;
3996
+ externalId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
3997
+ name: "external_id";
3998
+ tableName: "pmo_external_execution_map";
3999
+ dataType: "string";
4000
+ columnType: "SQLiteText";
4001
+ data: string;
4002
+ driverParam: string;
4003
+ notNull: true;
4004
+ hasDefault: false;
4005
+ isPrimaryKey: false;
4006
+ isAutoincrement: false;
4007
+ hasRuntimeDefault: false;
4008
+ enumValues: [string, ...string[]];
4009
+ baseColumn: never;
4010
+ identity: undefined;
4011
+ generated: undefined;
4012
+ }, object>;
4013
+ externalKey: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4014
+ name: "external_key";
4015
+ tableName: "pmo_external_execution_map";
4016
+ dataType: "string";
4017
+ columnType: "SQLiteText";
4018
+ data: string;
4019
+ driverParam: string;
4020
+ notNull: false;
4021
+ hasDefault: false;
4022
+ isPrimaryKey: false;
4023
+ isAutoincrement: false;
4024
+ hasRuntimeDefault: false;
4025
+ enumValues: [string, ...string[]];
4026
+ baseColumn: never;
4027
+ identity: undefined;
4028
+ generated: undefined;
4029
+ }, object>;
4030
+ canonicalUrl: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4031
+ name: "canonical_url";
4032
+ tableName: "pmo_external_execution_map";
4033
+ dataType: "string";
4034
+ columnType: "SQLiteText";
4035
+ data: string;
4036
+ driverParam: string;
4037
+ notNull: false;
4038
+ hasDefault: false;
4039
+ isPrimaryKey: false;
4040
+ isAutoincrement: false;
4041
+ hasRuntimeDefault: false;
4042
+ enumValues: [string, ...string[]];
4043
+ baseColumn: never;
4044
+ identity: undefined;
4045
+ generated: undefined;
4046
+ }, object>;
4047
+ latestStateSnapshot: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4048
+ name: "latest_state_snapshot";
4049
+ tableName: "pmo_external_execution_map";
4050
+ dataType: "string";
4051
+ columnType: "SQLiteText";
4052
+ data: string;
4053
+ driverParam: string;
4054
+ notNull: false;
4055
+ hasDefault: false;
4056
+ isPrimaryKey: false;
4057
+ isAutoincrement: false;
4058
+ hasRuntimeDefault: false;
4059
+ enumValues: [string, ...string[]];
4060
+ baseColumn: never;
4061
+ identity: undefined;
4062
+ generated: undefined;
4063
+ }, object>;
4064
+ lastSyncedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4065
+ name: "last_synced_at";
4066
+ tableName: "pmo_external_execution_map";
4067
+ dataType: "string";
4068
+ columnType: "SQLiteText";
4069
+ data: string;
4070
+ driverParam: string;
4071
+ notNull: false;
4072
+ hasDefault: false;
4073
+ isPrimaryKey: false;
4074
+ isAutoincrement: false;
4075
+ hasRuntimeDefault: false;
4076
+ enumValues: [string, ...string[]];
4077
+ baseColumn: never;
4078
+ identity: undefined;
4079
+ generated: undefined;
4080
+ }, object>;
4081
+ lastSpawnedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4082
+ name: "last_spawned_at";
4083
+ tableName: "pmo_external_execution_map";
4084
+ dataType: "string";
4085
+ columnType: "SQLiteText";
4086
+ data: string;
4087
+ driverParam: string;
4088
+ notNull: false;
4089
+ hasDefault: false;
4090
+ isPrimaryKey: false;
4091
+ isAutoincrement: false;
4092
+ hasRuntimeDefault: false;
4093
+ enumValues: [string, ...string[]];
4094
+ baseColumn: never;
4095
+ identity: undefined;
4096
+ generated: undefined;
4097
+ }, object>;
4098
+ createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4099
+ name: "created_at";
4100
+ tableName: "pmo_external_execution_map";
4101
+ dataType: "string";
4102
+ columnType: "SQLiteText";
4103
+ data: string;
4104
+ driverParam: string;
4105
+ notNull: false;
4106
+ hasDefault: true;
4107
+ isPrimaryKey: false;
4108
+ isAutoincrement: false;
4109
+ hasRuntimeDefault: false;
4110
+ enumValues: [string, ...string[]];
4111
+ baseColumn: never;
4112
+ identity: undefined;
4113
+ generated: undefined;
4114
+ }, object>;
4115
+ updatedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4116
+ name: "updated_at";
4117
+ tableName: "pmo_external_execution_map";
4118
+ dataType: "string";
4119
+ columnType: "SQLiteText";
4120
+ data: string;
4121
+ driverParam: string;
4122
+ notNull: false;
4123
+ hasDefault: true;
4124
+ isPrimaryKey: false;
4125
+ isAutoincrement: false;
4126
+ hasRuntimeDefault: false;
4127
+ enumValues: [string, ...string[]];
4128
+ baseColumn: never;
4129
+ identity: undefined;
4130
+ generated: undefined;
4131
+ }, object>;
4132
+ };
4133
+ dialect: "sqlite";
4134
+ }>;
4135
+ /**
4136
+ * Linked execution IDs for external mappings.
4137
+ */
4138
+ export declare const pmoExternalExecutionLinks: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
4139
+ name: "pmo_external_execution_links";
4140
+ schema: undefined;
4141
+ columns: {
4142
+ provider: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4143
+ name: "provider";
4144
+ tableName: "pmo_external_execution_links";
4145
+ dataType: "string";
4146
+ columnType: "SQLiteText";
4147
+ data: string;
4148
+ driverParam: string;
4149
+ notNull: true;
4150
+ hasDefault: false;
4151
+ isPrimaryKey: false;
4152
+ isAutoincrement: false;
4153
+ hasRuntimeDefault: false;
4154
+ enumValues: [string, ...string[]];
4155
+ baseColumn: never;
4156
+ identity: undefined;
4157
+ generated: undefined;
4158
+ }, object>;
4159
+ externalId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4160
+ name: "external_id";
4161
+ tableName: "pmo_external_execution_links";
4162
+ dataType: "string";
4163
+ columnType: "SQLiteText";
4164
+ data: string;
4165
+ driverParam: string;
4166
+ notNull: true;
4167
+ hasDefault: false;
4168
+ isPrimaryKey: false;
4169
+ isAutoincrement: false;
4170
+ hasRuntimeDefault: false;
4171
+ enumValues: [string, ...string[]];
4172
+ baseColumn: never;
4173
+ identity: undefined;
4174
+ generated: undefined;
4175
+ }, object>;
4176
+ executionId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4177
+ name: "execution_id";
4178
+ tableName: "pmo_external_execution_links";
4179
+ dataType: "string";
4180
+ columnType: "SQLiteText";
4181
+ data: string;
4182
+ driverParam: string;
4183
+ notNull: true;
4184
+ hasDefault: false;
4185
+ isPrimaryKey: false;
4186
+ isAutoincrement: false;
4187
+ hasRuntimeDefault: false;
4188
+ enumValues: [string, ...string[]];
4189
+ baseColumn: never;
4190
+ identity: undefined;
4191
+ generated: undefined;
4192
+ }, object>;
4193
+ linkedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4194
+ name: "linked_at";
4195
+ tableName: "pmo_external_execution_links";
4196
+ dataType: "string";
4197
+ columnType: "SQLiteText";
4198
+ data: string;
4199
+ driverParam: string;
4200
+ notNull: false;
4201
+ hasDefault: true;
4202
+ isPrimaryKey: false;
4203
+ isAutoincrement: false;
4204
+ hasRuntimeDefault: false;
4205
+ enumValues: [string, ...string[]];
4206
+ baseColumn: never;
4207
+ identity: undefined;
4208
+ generated: undefined;
4209
+ }, object>;
4210
+ };
4211
+ dialect: "sqlite";
4212
+ }>;
4213
+ /**
4214
+ * Linked PR URLs for external mappings.
4215
+ */
4216
+ export declare const pmoExternalExecutionPrs: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
4217
+ name: "pmo_external_execution_prs";
4218
+ schema: undefined;
4219
+ columns: {
4220
+ provider: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4221
+ name: "provider";
4222
+ tableName: "pmo_external_execution_prs";
4223
+ dataType: "string";
4224
+ columnType: "SQLiteText";
4225
+ data: string;
4226
+ driverParam: string;
4227
+ notNull: true;
4228
+ hasDefault: false;
4229
+ isPrimaryKey: false;
4230
+ isAutoincrement: false;
4231
+ hasRuntimeDefault: false;
4232
+ enumValues: [string, ...string[]];
4233
+ baseColumn: never;
4234
+ identity: undefined;
4235
+ generated: undefined;
4236
+ }, object>;
4237
+ externalId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4238
+ name: "external_id";
4239
+ tableName: "pmo_external_execution_prs";
4240
+ dataType: "string";
4241
+ columnType: "SQLiteText";
4242
+ data: string;
4243
+ driverParam: string;
4244
+ notNull: true;
4245
+ hasDefault: false;
4246
+ isPrimaryKey: false;
4247
+ isAutoincrement: false;
4248
+ hasRuntimeDefault: false;
4249
+ enumValues: [string, ...string[]];
4250
+ baseColumn: never;
4251
+ identity: undefined;
4252
+ generated: undefined;
4253
+ }, object>;
4254
+ prUrl: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4255
+ name: "pr_url";
4256
+ tableName: "pmo_external_execution_prs";
4257
+ dataType: "string";
4258
+ columnType: "SQLiteText";
4259
+ data: string;
4260
+ driverParam: string;
4261
+ notNull: true;
4262
+ hasDefault: false;
4263
+ isPrimaryKey: false;
4264
+ isAutoincrement: false;
4265
+ hasRuntimeDefault: false;
4266
+ enumValues: [string, ...string[]];
4267
+ baseColumn: never;
4268
+ identity: undefined;
4269
+ generated: undefined;
4270
+ }, object>;
4271
+ linkedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4272
+ name: "linked_at";
4273
+ tableName: "pmo_external_execution_prs";
4274
+ dataType: "string";
4275
+ columnType: "SQLiteText";
4276
+ data: string;
4277
+ driverParam: string;
4278
+ notNull: false;
4279
+ hasDefault: true;
4280
+ isPrimaryKey: false;
4281
+ isAutoincrement: false;
4282
+ hasRuntimeDefault: false;
4283
+ enumValues: [string, ...string[]];
4284
+ baseColumn: never;
4285
+ identity: undefined;
4286
+ generated: undefined;
4287
+ }, object>;
4288
+ };
4289
+ dialect: "sqlite";
4290
+ }>;
3904
4291
  /**
3905
4292
  * ID sequence counters
3906
4293
  */
@@ -5489,3 +5876,9 @@ export type DbPmoBoardView = typeof pmoBoardViews.$inferSelect;
5489
5876
  export type NewDbPmoBoardView = typeof pmoBoardViews.$inferInsert;
5490
5877
  export type DbPmoAgentWorkRecord = typeof pmoAgentWork.$inferSelect;
5491
5878
  export type NewDbPmoAgentWorkRecord = typeof pmoAgentWork.$inferInsert;
5879
+ export type DbPmoExternalExecutionMap = typeof pmoExternalExecutionMap.$inferSelect;
5880
+ export type NewDbPmoExternalExecutionMap = typeof pmoExternalExecutionMap.$inferInsert;
5881
+ export type DbPmoExternalExecutionLink = typeof pmoExternalExecutionLinks.$inferSelect;
5882
+ export type NewDbPmoExternalExecutionLink = typeof pmoExternalExecutionLinks.$inferInsert;
5883
+ export type DbPmoExternalExecutionPr = typeof pmoExternalExecutionPrs.$inferSelect;
5884
+ export type NewDbPmoExternalExecutionPr = typeof pmoExternalExecutionPrs.$inferInsert;
@@ -436,6 +436,10 @@ export const pmoAgentWork = sqliteTable('agent_work', {
436
436
  sessionId: text('session_id'),
437
437
  host: text('host'),
438
438
  logPath: text('log_path'),
439
+ externalSource: text('external_source'),
440
+ externalKey: text('external_key'),
441
+ externalId: text('external_id'),
442
+ externalUrl: text('external_url'),
439
443
  startedAt: text('started_at').default(sql `CURRENT_TIMESTAMP`),
440
444
  completedAt: text('completed_at'),
441
445
  exitCode: integer('exit_code'),
@@ -462,6 +466,47 @@ export const pmoContainers = sqliteTable('containers', {
462
466
  idxDockerId: index('idx_containers_docker_id').on(table.dockerId),
463
467
  idxStatus: index('idx_containers_status').on(table.status),
464
468
  }));
469
+ /**
470
+ * Provider-agnostic external issue ↔ execution mapping.
471
+ */
472
+ export const pmoExternalExecutionMap = sqliteTable('pmo_external_execution_map', {
473
+ provider: text('provider', { enum: ['linear', 'jira', 'asana', 'monday', 'pmo'] }).notNull(),
474
+ externalId: text('external_id').notNull(),
475
+ externalKey: text('external_key'),
476
+ canonicalUrl: text('canonical_url'),
477
+ latestStateSnapshot: text('latest_state_snapshot'),
478
+ lastSyncedAt: text('last_synced_at'),
479
+ lastSpawnedAt: text('last_spawned_at'),
480
+ createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
481
+ updatedAt: text('updated_at').default(sql `CURRENT_TIMESTAMP`),
482
+ }, (table) => ({
483
+ pk: primaryKey({ columns: [table.provider, table.externalId] }),
484
+ idxExternalKey: index('idx_pmo_external_execution_map_external_key').on(table.provider, table.externalKey),
485
+ }));
486
+ /**
487
+ * Linked execution IDs for external mappings.
488
+ */
489
+ export const pmoExternalExecutionLinks = sqliteTable('pmo_external_execution_links', {
490
+ provider: text('provider').notNull(),
491
+ externalId: text('external_id').notNull(),
492
+ executionId: text('execution_id').notNull(),
493
+ linkedAt: text('linked_at').default(sql `CURRENT_TIMESTAMP`),
494
+ }, (table) => ({
495
+ pk: primaryKey({ columns: [table.provider, table.externalId, table.executionId] }),
496
+ idxExecutionId: index('idx_pmo_external_execution_links_execution_id').on(table.executionId),
497
+ }));
498
+ /**
499
+ * Linked PR URLs for external mappings.
500
+ */
501
+ export const pmoExternalExecutionPrs = sqliteTable('pmo_external_execution_prs', {
502
+ provider: text('provider').notNull(),
503
+ externalId: text('external_id').notNull(),
504
+ prUrl: text('pr_url').notNull(),
505
+ linkedAt: text('linked_at').default(sql `CURRENT_TIMESTAMP`),
506
+ }, (table) => ({
507
+ pk: primaryKey({ columns: [table.provider, table.externalId, table.prUrl] }),
508
+ idxPrUrl: index('idx_pmo_external_execution_prs_pr_url').on(table.prUrl),
509
+ }));
465
510
  /**
466
511
  * ID sequence counters
467
512
  */
@@ -31,6 +31,7 @@ declare const CONFIG_KEYS: {
31
31
  coderName: string;
32
32
  authMethod: string;
33
33
  createPrDefault: string;
34
+ mirrorToPmoDefault: string;
34
35
  };
35
36
  /**
36
37
  * Load execution config from database, merging with defaults
@@ -84,6 +85,15 @@ export declare function getCreatePrDefault(db: Database.Database): boolean | nul
84
85
  * Save PR creation default preference.
85
86
  */
86
87
  export declare function saveCreatePrDefault(db: Database.Database, createPr: boolean): void;
88
+ /**
89
+ * Get saved external issue mirror default preference.
90
+ * Returns null if no preference has been saved.
91
+ */
92
+ export declare function getMirrorToPmoDefault(db: Database.Database): boolean | null;
93
+ /**
94
+ * Save external issue mirror default preference.
95
+ */
96
+ export declare function saveMirrorToPmoDefault(db: Database.Database, mirrorToPmo: boolean): void;
87
97
  /**
88
98
  * Check if terminal app preference has been set
89
99
  */
@@ -35,6 +35,7 @@ const CONFIG_KEYS = {
35
35
  coderName: 'coder.name',
36
36
  authMethod: 'execution.auth_method',
37
37
  createPrDefault: 'execution.create_pr_default',
38
+ mirrorToPmoDefault: 'execution.mirror_to_pmo_default',
38
39
  };
39
40
  /**
40
41
  * Get a setting value from the database
@@ -267,6 +268,24 @@ export function getCreatePrDefault(db) {
267
268
  export function saveCreatePrDefault(db, createPr) {
268
269
  setSetting(db, CONFIG_KEYS.createPrDefault, createPr.toString());
269
270
  }
271
+ /**
272
+ * Get saved external issue mirror default preference.
273
+ * Returns null if no preference has been saved.
274
+ */
275
+ export function getMirrorToPmoDefault(db) {
276
+ const value = getSetting(db, CONFIG_KEYS.mirrorToPmoDefault);
277
+ if (value === 'true')
278
+ return true;
279
+ if (value === 'false')
280
+ return false;
281
+ return null;
282
+ }
283
+ /**
284
+ * Save external issue mirror default preference.
285
+ */
286
+ export function saveMirrorToPmoDefault(db, mirrorToPmo) {
287
+ setSetting(db, CONFIG_KEYS.mirrorToPmoDefault, mirrorToPmo.toString());
288
+ }
270
289
  /**
271
290
  * Check if terminal app preference has been set
272
291
  */
@@ -63,6 +63,16 @@ export declare function getDockerCredentialInfo(): {
63
63
  expiresAt: Date;
64
64
  subscriptionType?: string;
65
65
  } | null;
66
+ /**
67
+ * Check if Claude Code authentication is available on the host system.
68
+ * Returns true if either:
69
+ * 1. OAuth credentials exist in ~/.claude/.credentials.json, OR
70
+ * 2. ANTHROPIC_API_KEY environment variable is set
71
+ *
72
+ * This is used to validate auth before spawning host sessions (e.g., orchestrator)
73
+ * to avoid creating stuck sessions when the keychain is locked (SSH contexts).
74
+ */
75
+ export declare function hostCredentialsExist(): boolean;
66
76
  export declare function getExecutorCommand(executor: ExecutorType, prompt: string, skipPermissions?: boolean): {
67
77
  cmd: string;
68
78
  args: string[];