@workjournal/shared 0.13.0 → 0.28.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 (38) hide show
  1. package/README.md +2 -2
  2. package/dist/__tests__/credentials-migration.test.d.ts +2 -0
  3. package/dist/__tests__/credentials-migration.test.d.ts.map +1 -0
  4. package/dist/__tests__/credentials-migration.test.js +105 -0
  5. package/dist/__tests__/credentials-migration.test.js.map +1 -0
  6. package/dist/__tests__/support-labels.test.d.ts +2 -0
  7. package/dist/__tests__/support-labels.test.d.ts.map +1 -0
  8. package/dist/__tests__/support-labels.test.js +69 -0
  9. package/dist/__tests__/support-labels.test.js.map +1 -0
  10. package/dist/constants.d.ts +19 -11
  11. package/dist/constants.d.ts.map +1 -1
  12. package/dist/constants.js +19 -11
  13. package/dist/constants.js.map +1 -1
  14. package/dist/credentials.d.ts +45 -0
  15. package/dist/credentials.d.ts.map +1 -1
  16. package/dist/credentials.js +91 -2
  17. package/dist/credentials.js.map +1 -1
  18. package/dist/default-prompt.d.ts +10 -0
  19. package/dist/default-prompt.d.ts.map +1 -0
  20. package/dist/default-prompt.js +31 -0
  21. package/dist/default-prompt.js.map +1 -0
  22. package/dist/index.d.ts +5 -2
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +3 -1
  25. package/dist/index.js.map +1 -1
  26. package/dist/slug.d.ts.map +1 -1
  27. package/dist/slug.js +3 -0
  28. package/dist/slug.js.map +1 -1
  29. package/dist/support-labels.d.ts +28 -0
  30. package/dist/support-labels.d.ts.map +1 -0
  31. package/dist/support-labels.js +44 -0
  32. package/dist/support-labels.js.map +1 -0
  33. package/dist/tiers.d.ts +1 -1
  34. package/dist/tiers.d.ts.map +1 -1
  35. package/dist/tiers.js.map +1 -1
  36. package/dist/types.d.ts +58 -5
  37. package/dist/types.d.ts.map +1 -1
  38. package/package.json +3 -4
package/README.md CHANGED
@@ -8,7 +8,7 @@ This package isn't intended for direct consumption — it's a workspace dependen
8
8
 
9
9
  | Subpath | Contents |
10
10
  |---|---|
11
- | `@workjournal/shared` | Types (`Entry`, `Journal`, `JournalMember`, `Invitation`, …), API path builders, error codes, opaque-token codec |
11
+ | `@workjournal/shared` | Types (`Entry`, `Journal`, `JournalContributor`, `Invitation`, …), API path builders, error codes, opaque-token codec |
12
12
  | `@workjournal/shared/credentials` | Node-only credential file I/O + `/v1/auth/refresh` client (used by CLI + MCP server) |
13
13
 
14
14
  The default entry has zero runtime dependencies and works in any JavaScript runtime (Node, Cloudflare Workers, browsers). The `credentials` subpath imports `node:fs` / `node:os` and is Node-only.
@@ -16,4 +16,4 @@ The default entry has zero runtime dependencies and works in any JavaScript runt
16
16
  ## Links
17
17
 
18
18
  - [Workjournal](https://workjournal.pro)
19
- - [GitHub](https://github.com/workjournal-pro/workjournal)
19
+ - [GitHub](https://github.com/workjournal-pro)
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=credentials-migration.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials-migration.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/credentials-migration.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,105 @@
1
+ import { existsSync, mkdirSync, mkdtempSync, readdirSync, rmSync, writeFileSync } from 'node:fs';
2
+ import { tmpdir } from 'node:os';
3
+ import { join } from 'node:path';
4
+ import { afterEach, beforeEach, describe, expect, it } from 'vitest';
5
+ import { resolveDefaultConfigDir, tryMigrateConfigDir } from '../credentials.js';
6
+ describe('resolveDefaultConfigDir', () => {
7
+ it('returns ~/.config/workjournal on linux when XDG_CONFIG_HOME is unset', () => {
8
+ expect(resolveDefaultConfigDir({ platform: 'linux', env: {}, homeDir: '/home/me' })).toBe('/home/me/.config/workjournal');
9
+ });
10
+ it('honours XDG_CONFIG_HOME on linux when set', () => {
11
+ expect(resolveDefaultConfigDir({
12
+ platform: 'linux',
13
+ env: { XDG_CONFIG_HOME: '/custom/xdg' },
14
+ homeDir: '/home/me',
15
+ })).toBe('/custom/xdg/workjournal');
16
+ });
17
+ it('treats an empty XDG_CONFIG_HOME as unset (per spec)', () => {
18
+ expect(resolveDefaultConfigDir({
19
+ platform: 'linux',
20
+ env: { XDG_CONFIG_HOME: '' },
21
+ homeDir: '/home/me',
22
+ })).toBe('/home/me/.config/workjournal');
23
+ });
24
+ it('uses XDG on macOS, not ~/Library/Preferences', () => {
25
+ expect(resolveDefaultConfigDir({ platform: 'darwin', env: {}, homeDir: '/Users/me' })).toBe('/Users/me/.config/workjournal');
26
+ });
27
+ it('honours XDG_CONFIG_HOME on macOS too', () => {
28
+ expect(resolveDefaultConfigDir({
29
+ platform: 'darwin',
30
+ env: { XDG_CONFIG_HOME: '/Users/me/.config-alt' },
31
+ homeDir: '/Users/me',
32
+ })).toBe('/Users/me/.config-alt/workjournal');
33
+ });
34
+ it('uses %APPDATA% on win32 when set', () => {
35
+ expect(resolveDefaultConfigDir({
36
+ platform: 'win32',
37
+ env: { APPDATA: 'C:\\Users\\me\\AppData\\Roaming' },
38
+ homeDir: 'C:\\Users\\me',
39
+ })).toBe(join('C:\\Users\\me\\AppData\\Roaming', 'workjournal'));
40
+ });
41
+ it('falls back to ~/AppData/Roaming on win32 when APPDATA is unset', () => {
42
+ expect(resolveDefaultConfigDir({
43
+ platform: 'win32',
44
+ env: {},
45
+ homeDir: 'C:\\Users\\me',
46
+ })).toBe(join('C:\\Users\\me', 'AppData', 'Roaming', 'workjournal'));
47
+ });
48
+ });
49
+ describe('tryMigrateConfigDir', () => {
50
+ let work;
51
+ let legacy;
52
+ let target;
53
+ beforeEach(() => {
54
+ work = mkdtempSync(join(tmpdir(), 'wj-mig-'));
55
+ legacy = join(work, 'home', '.workjournal');
56
+ target = join(work, 'home', '.config', 'workjournal');
57
+ mkdirSync(join(work, 'home'), { recursive: true });
58
+ });
59
+ afterEach(() => {
60
+ rmSync(work, { recursive: true, force: true });
61
+ });
62
+ it('moves the legacy directory and all its files atomically', () => {
63
+ mkdirSync(legacy, { recursive: true });
64
+ writeFileSync(join(legacy, 'credentials.json'), '{"access_token":"a"}');
65
+ writeFileSync(join(legacy, 'cli-login-state.json'), '{"verifier":"v"}');
66
+ writeFileSync(join(legacy, 'config.json'), '{"workspaceSlug":"ws"}');
67
+ const moved = tryMigrateConfigDir(legacy, target);
68
+ expect(moved).toBe(true);
69
+ expect(existsSync(legacy)).toBe(false);
70
+ expect(existsSync(target)).toBe(true);
71
+ expect(readdirSync(target).sort()).toEqual([
72
+ 'cli-login-state.json',
73
+ 'config.json',
74
+ 'credentials.json',
75
+ ]);
76
+ });
77
+ it('is a no-op when the legacy directory does not exist', () => {
78
+ const moved = tryMigrateConfigDir(legacy, target);
79
+ expect(moved).toBe(false);
80
+ });
81
+ it('is a no-op when the target already exists (legacy left in place)', () => {
82
+ mkdirSync(legacy, { recursive: true });
83
+ writeFileSync(join(legacy, 'credentials.json'), '{"access_token":"old"}');
84
+ mkdirSync(target, { recursive: true });
85
+ writeFileSync(join(target, 'credentials.json'), '{"access_token":"new"}');
86
+ const moved = tryMigrateConfigDir(legacy, target);
87
+ expect(moved).toBe(false);
88
+ expect(readdirSync(legacy)).toContain('credentials.json');
89
+ expect(readdirSync(target)).toContain('credentials.json');
90
+ });
91
+ it('is a no-op when legacy === target', () => {
92
+ mkdirSync(legacy, { recursive: true });
93
+ const moved = tryMigrateConfigDir(legacy, legacy);
94
+ expect(moved).toBe(false);
95
+ });
96
+ it('creates the parent directory of the target if missing', () => {
97
+ const deepTarget = join(work, 'home', 'deeply', 'nested', 'path', 'workjournal');
98
+ mkdirSync(legacy, { recursive: true });
99
+ writeFileSync(join(legacy, 'credentials.json'), '{}');
100
+ const moved = tryMigrateConfigDir(legacy, deepTarget);
101
+ expect(moved).toBe(true);
102
+ expect(readdirSync(deepTarget)).toContain('credentials.json');
103
+ });
104
+ });
105
+ //# sourceMappingURL=credentials-migration.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials-migration.test.js","sourceRoot":"","sources":["../../src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IAC3B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uDAAuD,EAAE,GAAG,EAAE;QAChE,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;QACjF,SAAS,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACvC,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAAE,IAAI,CAAC,CAAC;QAEtD,MAAM,KAAK,GAAG,mBAAmB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QAEtD,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzB,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=support-labels.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"support-labels.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/support-labels.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,69 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { CLIENT_OPTIONS, INTERFACE_OPTIONS, isClientOption, isInterfaceOption, } from '../support-labels.js';
3
+ describe('INTERFACE_OPTIONS', () => {
4
+ it('starts with i-dont-know so it can be the default option in dropdowns', () => {
5
+ expect(INTERFACE_OPTIONS[0]).toBe('i-dont-know');
6
+ });
7
+ it('covers every Workjournal surface that can originate a support request', () => {
8
+ expect(INTERFACE_OPTIONS).toEqual(['i-dont-know', 'web', 'cli', 'mcp', 'skill', 'api']);
9
+ });
10
+ it('uses kebab-case so values can become GitHub labels verbatim', () => {
11
+ for (const value of INTERFACE_OPTIONS) {
12
+ expect(value).toMatch(/^[a-z][a-z0-9-]*$/);
13
+ }
14
+ });
15
+ });
16
+ describe('CLIENT_OPTIONS', () => {
17
+ it('starts with i-dont-know so it can be the default option in dropdowns', () => {
18
+ expect(CLIENT_OPTIONS[0]).toBe('i-dont-know');
19
+ });
20
+ it('uses kebab-case so values can become GitHub labels verbatim', () => {
21
+ for (const value of CLIENT_OPTIONS) {
22
+ expect(value).toMatch(/^[a-z][a-z0-9-]*$/);
23
+ }
24
+ });
25
+ it('uses chatgpt (not chatgtp) so the labels are spelled correctly forever', () => {
26
+ const chatgpt = CLIENT_OPTIONS.filter((v) => v.includes('openai-chatgpt'));
27
+ const typo = CLIENT_OPTIONS.filter((v) => v.includes('openai-chatgtp'));
28
+ expect(chatgpt.length).toBeGreaterThan(0);
29
+ expect(typo).toEqual([]);
30
+ });
31
+ it('includes web-browser-direct for users who hit /support without an AI client', () => {
32
+ expect(CLIENT_OPTIONS).toContain('web-browser-direct');
33
+ });
34
+ });
35
+ describe('isInterfaceOption', () => {
36
+ it('accepts every literal value', () => {
37
+ for (const value of INTERFACE_OPTIONS) {
38
+ expect(isInterfaceOption(value)).toBe(true);
39
+ }
40
+ });
41
+ it('rejects off-vocabulary strings', () => {
42
+ expect(isInterfaceOption('desktop')).toBe(false);
43
+ expect(isInterfaceOption('')).toBe(false);
44
+ expect(isInterfaceOption('Web')).toBe(false); // case-sensitive
45
+ });
46
+ it('rejects non-string inputs', () => {
47
+ expect(isInterfaceOption(null)).toBe(false);
48
+ expect(isInterfaceOption(undefined)).toBe(false);
49
+ expect(isInterfaceOption(42)).toBe(false);
50
+ expect(isInterfaceOption({})).toBe(false);
51
+ });
52
+ });
53
+ describe('isClientOption', () => {
54
+ it('accepts every literal value', () => {
55
+ for (const value of CLIENT_OPTIONS) {
56
+ expect(isClientOption(value)).toBe(true);
57
+ }
58
+ });
59
+ it('rejects off-vocabulary strings', () => {
60
+ expect(isClientOption('claude')).toBe(false);
61
+ expect(isClientOption('ai-anthropic-claude-watch')).toBe(false);
62
+ });
63
+ it('rejects non-string inputs', () => {
64
+ expect(isClientOption(null)).toBe(false);
65
+ expect(isClientOption(undefined)).toBe(false);
66
+ expect(isClientOption(0)).toBe(false);
67
+ });
68
+ });
69
+ //# sourceMappingURL=support-labels.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"support-labels.test.js","sourceRoot":"","sources":["../../src/__tests__/support-labels.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACN,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,iBAAiB,GACjB,MAAM,sBAAsB,CAAC;AAE9B,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IAClC,EAAE,CAAC,sEAAsE,EAAE,GAAG,EAAE;QAC/E,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uEAAuE,EAAE,GAAG,EAAE;QAChF,MAAM,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;IACzF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6DAA6D,EAAE,GAAG,EAAE;QACtE,KAAK,MAAM,KAAK,IAAI,iBAAiB,EAAE,CAAC;YACvC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;QAC5C,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,sEAAsE,EAAE,GAAG,EAAE;QAC/E,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC/C,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AC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzC,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC9C,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -1,11 +1,11 @@
1
1
  export declare const API_VERSION: "v1";
2
2
  /**
3
3
  * @breaking-change-pending
4
- * The journal/entries/members/invitations/export helpers below still produce
5
- * UUID-shaped paths from before the slug-routes cutover (PR #185, issue #172).
6
- * The API now serves only `/v1/workspaces/:workspaceSlug/...` — these
7
- * helpers will 404 against the live API. CLI (#176) and MCP (#177) update
8
- * both the call sites and these helpers as part of their own breaking
4
+ * The journal/entries/contributors/invitations/export helpers below still
5
+ * produce UUID-shaped paths from before the slug-routes cutover (PR #185,
6
+ * issue #172). The API now serves only `/v1/workspaces/:workspaceSlug/...` —
7
+ * these helpers will 404 against the live API. CLI (#176) and MCP (#177)
8
+ * update both the call sites and these helpers as part of their own breaking
9
9
  * releases. Web (#175) uses `WS_API_PATHS` below instead.
10
10
  */
11
11
  export declare const API_PATHS: {
@@ -17,8 +17,8 @@ export declare const API_PATHS: {
17
17
  readonly entries: (journalId: string) => string;
18
18
  readonly entry: (journalId: string, index: number | string) => string;
19
19
  readonly searchEntries: (journalId: string) => string;
20
- readonly members: (journalId: string) => string;
21
- readonly member: (journalId: string, userId: string) => string;
20
+ readonly contributors: (journalId: string) => string;
21
+ readonly contributor: (journalId: string, userId: string) => string;
22
22
  readonly invitations: (journalId: string) => string;
23
23
  readonly invitation: (journalId: string, invitationId: string) => string;
24
24
  readonly acceptInvitation: "/v1/invitations/accept";
@@ -37,15 +37,21 @@ export declare const WS_API_PATHS: {
37
37
  readonly entries: (workspaceSlug: string, journalSlug: string) => string;
38
38
  readonly entry: (workspaceSlug: string, journalSlug: string, index: number | string) => string;
39
39
  readonly searchEntries: (workspaceSlug: string, journalSlug: string) => string;
40
- readonly members: (workspaceSlug: string, journalSlug: string) => string;
41
- readonly member: (workspaceSlug: string, journalSlug: string, userId: string) => string;
40
+ readonly contributors: (workspaceSlug: string, journalSlug: string) => string;
41
+ readonly contributor: (workspaceSlug: string, journalSlug: string, userId: string) => string;
42
42
  readonly invitations: (workspaceSlug: string, journalSlug: string) => string;
43
43
  readonly invitation: (workspaceSlug: string, journalSlug: string, invitationId: string) => string;
44
+ readonly resendInvitation: (workspaceSlug: string, journalSlug: string, invitationId: string) => string;
44
45
  readonly acceptInvitation: "/v1/invitations/accept";
46
+ readonly invitationByToken: (token: string) => string;
45
47
  readonly exportJournal: (workspaceSlug: string, journalSlug: string) => string;
46
48
  readonly publicJournal: (slug: string) => string;
47
49
  readonly publicEntries: (slug: string) => string;
48
50
  readonly sharedWithMeJournals: "/v1/shared-with-me/journals";
51
+ readonly prompts: (workspaceSlug: string) => string;
52
+ readonly prompt: (workspaceSlug: string, promptSlug: string) => string;
53
+ readonly journalPrompt: (workspaceSlug: string, journalSlug: string, promptSlug: string) => string;
54
+ readonly supportContact: (workspaceSlug: string) => string;
49
55
  };
50
56
  /**
51
57
  * Reserved virtual-workspace slug exposed in user-facing surfaces (CLI, MCP,
@@ -74,6 +80,8 @@ export declare const ERROR_CODES: {
74
80
  export type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];
75
81
  export declare const MAX_SUMMARY_LENGTH = 500;
76
82
  export declare const MAX_TITLE_LENGTH = 80;
83
+ export declare const MAX_PROMPT_NAME_LENGTH = 80;
84
+ export declare const MAX_PROMPT_BODY_LENGTH = 10000;
77
85
  /** @deprecated Use `MAX_NAME_LENGTH` (20) from `./slug.ts`. Kept as an alias
78
86
  * for backward compat until the breaking CLI/MCP releases (#176, #177) drop it. */
79
87
  export declare const MAX_JOURNAL_NAME_LENGTH = 20;
@@ -89,6 +97,6 @@ export declare const PUBLIC_SLUG_LENGTH = 12;
89
97
  * stale. Keep in sync with the `version:` field in the corresponding
90
98
  * `apps/landing/src/pages/*.md` frontmatter.
91
99
  */
92
- export declare const CURRENT_TOS_VERSION: "0.1";
93
- export declare const CURRENT_PRIVACY_VERSION: "0.1";
100
+ export declare const CURRENT_TOS_VERSION: "0.2";
101
+ export declare const CURRENT_PRIVACY_VERSION: "0.2";
94
102
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,EAAG,IAAa,CAAC;AAEzC;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS;;;6BAGL,MAAM;;2BAER,MAAM;kCACC,MAAM;gCACR,MAAM,SAAS,MAAM,GAAG,MAAM;wCAEtB,MAAM;kCACZ,MAAM;iCACP,MAAM,UAAU,MAAM;sCAEjB,MAAM;qCACP,MAAM,gBAAgB,MAAM;;wCAGzB,MAAM;mCACX,MAAM;mCACN,MAAM;CACnB,CAAC;AAeX,eAAO,MAAM,YAAY;;;wCAGG,MAAM;;uCAEP,MAAM;sCACP,MAAM,eAAe,MAAM;+CAClB,MAAM;sCACf,MAAM,eAAe,MAAM;oCAE7B,MAAM,eAAe,MAAM,SAAS,MAAM,GAAG,MAAM;4CAE3C,MAAM,eAAe,MAAM;sCAEjC,MAAM,eAAe,MAAM;qCAE5B,MAAM,eAAe,MAAM,UAAU,MAAM;0CAEtC,MAAM,eAAe,MAAM;yCAE5B,MAAM,eAAe,MAAM,gBAAgB,MAAM;;4CAG9C,MAAM,eAAe,MAAM;mCAEpC,MAAM;mCACN,MAAM;;CAEnB,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAG,gBAAyB,CAAC;AAE7D,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;CAgBd,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WA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;mCACN,MAAM;;sCAEH,MAAM;qCACP,MAAM,cAAc,MAAM;4CAEnB,MAAM,eAAe,MAAM,cAAc,MAAM;6CAE9C,MAAM;CAC7B,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAG,gBAAyB,CAAC;AAE7D,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;CAgBd,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAEvE,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,eAAO,MAAM,sBAAsB,QAAS,CAAC;AAC7C;mFACmF;AACnF,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAEpC,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,EAAG,KAAc,CAAC;AAClD,eAAO,MAAM,uBAAuB,EAAG,KAAc,CAAC"}
package/dist/constants.js CHANGED
@@ -1,11 +1,11 @@
1
1
  export const API_VERSION = 'v1';
2
2
  /**
3
3
  * @breaking-change-pending
4
- * The journal/entries/members/invitations/export helpers below still produce
5
- * UUID-shaped paths from before the slug-routes cutover (PR #185, issue #172).
6
- * The API now serves only `/v1/workspaces/:workspaceSlug/...` — these
7
- * helpers will 404 against the live API. CLI (#176) and MCP (#177) update
8
- * both the call sites and these helpers as part of their own breaking
4
+ * The journal/entries/contributors/invitations/export helpers below still
5
+ * produce UUID-shaped paths from before the slug-routes cutover (PR #185,
6
+ * issue #172). The API now serves only `/v1/workspaces/:workspaceSlug/...` —
7
+ * these helpers will 404 against the live API. CLI (#176) and MCP (#177)
8
+ * update both the call sites and these helpers as part of their own breaking
9
9
  * releases. Web (#175) uses `WS_API_PATHS` below instead.
10
10
  */
11
11
  export const API_PATHS = {
@@ -17,8 +17,8 @@ export const API_PATHS = {
17
17
  entries: (journalId) => `/${API_VERSION}/journals/${journalId}/entries`,
18
18
  entry: (journalId, index) => `/${API_VERSION}/journals/${encodeURIComponent(journalId)}/entries/${encodeURIComponent(String(index))}`,
19
19
  searchEntries: (journalId) => `/${API_VERSION}/journals/${journalId}/entries/search`,
20
- members: (journalId) => `/${API_VERSION}/journals/${journalId}/members`,
21
- member: (journalId, userId) => `/${API_VERSION}/journals/${journalId}/members/${userId}`,
20
+ contributors: (journalId) => `/${API_VERSION}/journals/${journalId}/contributors`,
21
+ contributor: (journalId, userId) => `/${API_VERSION}/journals/${journalId}/contributors/${userId}`,
22
22
  invitations: (journalId) => `/${API_VERSION}/journals/${journalId}/invitations`,
23
23
  invitation: (journalId, invitationId) => `/${API_VERSION}/journals/${journalId}/invitations/${invitationId}`,
24
24
  acceptInvitation: `/${API_VERSION}/invitations/accept`,
@@ -47,15 +47,21 @@ export const WS_API_PATHS = {
47
47
  entries: (workspaceSlug, journalSlug) => `${jr(workspaceSlug, journalSlug)}/entries`,
48
48
  entry: (workspaceSlug, journalSlug, index) => `${jr(workspaceSlug, journalSlug)}/entries/${encodeURIComponent(String(index))}`,
49
49
  searchEntries: (workspaceSlug, journalSlug) => `${jr(workspaceSlug, journalSlug)}/entries/search`,
50
- members: (workspaceSlug, journalSlug) => `${jr(workspaceSlug, journalSlug)}/members`,
51
- member: (workspaceSlug, journalSlug, userId) => `${jr(workspaceSlug, journalSlug)}/members/${encodeURIComponent(userId)}`,
50
+ contributors: (workspaceSlug, journalSlug) => `${jr(workspaceSlug, journalSlug)}/contributors`,
51
+ contributor: (workspaceSlug, journalSlug, userId) => `${jr(workspaceSlug, journalSlug)}/contributors/${encodeURIComponent(userId)}`,
52
52
  invitations: (workspaceSlug, journalSlug) => `${jr(workspaceSlug, journalSlug)}/invitations`,
53
53
  invitation: (workspaceSlug, journalSlug, invitationId) => `${jr(workspaceSlug, journalSlug)}/invitations/${encodeURIComponent(invitationId)}`,
54
+ resendInvitation: (workspaceSlug, journalSlug, invitationId) => `${jr(workspaceSlug, journalSlug)}/invitations/${encodeURIComponent(invitationId)}/resend`,
54
55
  acceptInvitation: `/${API_VERSION}/invitations/accept`,
56
+ invitationByToken: (token) => `/${API_VERSION}/invitations/${encodeURIComponent(token)}`,
55
57
  exportJournal: (workspaceSlug, journalSlug) => `${jr(workspaceSlug, journalSlug)}/export`,
56
58
  publicJournal: (slug) => `/${API_VERSION}/public/${encodeURIComponent(slug)}`,
57
59
  publicEntries: (slug) => `/${API_VERSION}/public/${encodeURIComponent(slug)}/entries`,
58
60
  sharedWithMeJournals: `/${API_VERSION}/shared-with-me/journals`,
61
+ prompts: (workspaceSlug) => `${ws(workspaceSlug)}/prompts`,
62
+ prompt: (workspaceSlug, promptSlug) => `${ws(workspaceSlug)}/prompts/${encodeURIComponent(promptSlug)}`,
63
+ journalPrompt: (workspaceSlug, journalSlug, promptSlug) => `${jr(workspaceSlug, journalSlug)}/prompts/${encodeURIComponent(promptSlug)}`,
64
+ supportContact: (workspaceSlug) => `${ws(workspaceSlug)}/support/contact`,
59
65
  };
60
66
  /**
61
67
  * Reserved virtual-workspace slug exposed in user-facing surfaces (CLI, MCP,
@@ -83,6 +89,8 @@ export const ERROR_CODES = {
83
89
  };
84
90
  export const MAX_SUMMARY_LENGTH = 500;
85
91
  export const MAX_TITLE_LENGTH = 80;
92
+ export const MAX_PROMPT_NAME_LENGTH = 80;
93
+ export const MAX_PROMPT_BODY_LENGTH = 10_000;
86
94
  /** @deprecated Use `MAX_NAME_LENGTH` (20) from `./slug.ts`. Kept as an alias
87
95
  * for backward compat until the breaking CLI/MCP releases (#176, #177) drop it. */
88
96
  export const MAX_JOURNAL_NAME_LENGTH = 20;
@@ -98,6 +106,6 @@ export const PUBLIC_SLUG_LENGTH = 12;
98
106
  * stale. Keep in sync with the `version:` field in the corresponding
99
107
  * `apps/landing/src/pages/*.md` frontmatter.
100
108
  */
101
- export const CURRENT_TOS_VERSION = '0.1';
102
- export const CURRENT_PRIVACY_VERSION = '0.1';
109
+ export const CURRENT_TOS_VERSION = '0.2';
110
+ export const CURRENT_PRIVACY_VERSION = '0.2';
103
111
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,IAAa,CAAC;AAEzC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACxB,MAAM,EAAE,IAAI,WAAW,SAAS;IAChC,UAAU,EAAE,IAAI,WAAW,aAAa;IACxC,SAAS,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,WAAW,eAAe,EAAE,EAAE;IAC7D,QAAQ,EAAE,IAAI,WAAW,WAAW;IACpC,OAAO,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,WAAW,aAAa,EAAE,EAAE;IACzD,OAAO,EAAE,CAAC,SAAiB,EAAE,EAAE,CAAC,IAAI,WAAW,aAAa,SAAS,UAAU;IAC/E,KAAK,EAAE,CAAC,SAAiB,EAAE,KAAsB,EAAE,EAAE,CACpD,IAAI,WAAW,aAAa,kBAAkB,CAAC,SAAS,CAAC,YAAY,kBAAkB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE;IACzG,aAAa,EAAE,CAAC,SAAiB,EAAE,EAAE,CAAC,IAAI,WAAW,aAAa,SAAS,iBAAiB;IAC5F,OAAO,EAAE,CAAC,SAAiB,EAAE,EAAE,CAAC,IAAI,WAAW,aAAa,SAAS,UAAU;IAC/E,MAAM,EAAE,CAAC,SAAiB,EAAE,MAAc,EAAE,EAAE,CAC7C,IAAI,WAAW,aAAa,SAAS,YAAY,MAAM,EAAE;IAC1D,WAAW,EAAE,CAAC,SAAiB,EA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,GAAG,EAAE,CAAC;AAC1C,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAEpC,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AACrC,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC;AAElC,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAc,CAAC;AAClD,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAc,CAAC"}
@@ -3,12 +3,47 @@ export interface StoredCredentials {
3
3
  refresh_token?: string;
4
4
  expires_at: string;
5
5
  }
6
+ /**
7
+ * Resolve the platform-default config directory.
8
+ *
9
+ * - Windows → `%APPDATA%\workjournal\` (falling back to `~/AppData/Roaming/workjournal\`).
10
+ * - Everywhere else (Linux, macOS, BSD, WSL2-Linux-Node) → `${XDG_CONFIG_HOME:-$HOME/.config}/workjournal/`.
11
+ *
12
+ * macOS deliberately uses XDG rather than `~/Library/Preferences/` because every
13
+ * modern CLI tool (`gh`, `git`, `kubectl`, `helm`) does the same — `~/Library/Preferences`
14
+ * is for plists managed via `NSUserDefaults`/`defaults`, not app-managed JSON.
15
+ *
16
+ * Exported for tests; production callers go through {@link CONFIG_DIR}.
17
+ */
18
+ export declare function resolveDefaultConfigDir(opts: {
19
+ platform: NodeJS.Platform;
20
+ env: NodeJS.ProcessEnv;
21
+ homeDir: string;
22
+ }): string;
6
23
  export declare const CONFIG_DIR: string;
7
24
  export interface LoginState {
8
25
  verifier: string;
9
26
  challenge: string;
10
27
  created_at: string;
11
28
  }
29
+ /**
30
+ * Move `legacy` → `target` atomically if all of these hold:
31
+ * - `legacy` exists
32
+ * - `target` does not exist
33
+ * - the two paths differ
34
+ *
35
+ * Returns `true` when a rename actually happened. Pure with respect to its
36
+ * arguments — no env or platform checks. Exported for tests.
37
+ */
38
+ export declare function tryMigrateConfigDir(legacy: string, target: string): boolean;
39
+ /**
40
+ * One-shot migration of the legacy `~/.workjournal/` directory to the resolved
41
+ * platform-standard {@link CONFIG_DIR}. Idempotent within a process via a
42
+ * module-scoped flag. Skipped entirely when `WORKJOURNAL_CONFIG_DIR` is set.
43
+ * The atomic directory rename moves all on-disk files (`credentials.json`,
44
+ * `cli-login-state.json`, `config.json`) together.
45
+ */
46
+ export declare function ensureMigrated(): void;
12
47
  export declare function readCredentials(): StoredCredentials | null;
13
48
  export declare function writeCredentials(creds: StoredCredentials): void;
14
49
  export declare function clearCredentials(): void;
@@ -27,4 +62,14 @@ export declare function refreshAccessToken(refreshToken: string): Promise<Stored
27
62
  * Returns null if no credentials are stored.
28
63
  */
29
64
  export declare function getAccessToken(): Promise<string | null>;
65
+ /**
66
+ * Unconditional refresh — used by API clients on a 401 response when the
67
+ * pre-flight {@link getAccessToken} returned a token the server still
68
+ * rejected (clock skew, mid-flight expiry, server-side revocation).
69
+ *
70
+ * Returns null when no credentials are on disk, no refresh token is stored,
71
+ * or the refresh request itself fails. Callers treat null as "no recovery
72
+ * possible" and surface an auth-required error to the user.
73
+ */
74
+ export declare function forceRefreshAccessToken(): Promise<string | null>;
30
75
  //# sourceMappingURL=credentials.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,iBAAiB;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,UAAU,QAA2E,CAAC;AAOnG,MAAM,WAAW,UAAU;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACnB;AAQD,wBAAgB,eAAe,IAAI,iBAAiB,GAAG,IAAI,CAU1D;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAI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,CAQrC;AAQD,wBAAgB,eAAe,IAAI,iBAAiB,GAAG,IAAI,CAW1D;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAK/D;AAED,wBAAgB,gBAAgB,IAAI,IAAI,CAKvC;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAKvD;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,UAAU,GAAG,IAAI,CA2BlD;AAED,wBAAgB,eAAe,IAAI,IAAI,CAKtC;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAI9D;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAE3D;AAID,wBAAsB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA0BzF;AAED;;;GAGG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAiB7D;AAED;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAStE"}
@@ -1,18 +1,81 @@
1
1
  import { existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync, } from 'node:fs';
2
2
  import { homedir } from 'node:os';
3
- import { join } from 'node:path';
4
- export const CONFIG_DIR = process.env['WORKJOURNAL_CONFIG_DIR'] ?? join(homedir(), '.workjournal');
3
+ import { dirname, join } from 'node:path';
4
+ /**
5
+ * Resolve the platform-default config directory.
6
+ *
7
+ * - Windows → `%APPDATA%\workjournal\` (falling back to `~/AppData/Roaming/workjournal\`).
8
+ * - Everywhere else (Linux, macOS, BSD, WSL2-Linux-Node) → `${XDG_CONFIG_HOME:-$HOME/.config}/workjournal/`.
9
+ *
10
+ * macOS deliberately uses XDG rather than `~/Library/Preferences/` because every
11
+ * modern CLI tool (`gh`, `git`, `kubectl`, `helm`) does the same — `~/Library/Preferences`
12
+ * is for plists managed via `NSUserDefaults`/`defaults`, not app-managed JSON.
13
+ *
14
+ * Exported for tests; production callers go through {@link CONFIG_DIR}.
15
+ */
16
+ export function resolveDefaultConfigDir(opts) {
17
+ if (opts.platform === 'win32') {
18
+ const appData = opts.env['APPDATA'] ?? join(opts.homeDir, 'AppData', 'Roaming');
19
+ return join(appData, 'workjournal');
20
+ }
21
+ const xdgConfig = opts.env['XDG_CONFIG_HOME'];
22
+ if (xdgConfig && xdgConfig.length > 0)
23
+ return join(xdgConfig, 'workjournal');
24
+ return join(opts.homeDir, '.config', 'workjournal');
25
+ }
26
+ export const CONFIG_DIR = process.env['WORKJOURNAL_CONFIG_DIR'] ??
27
+ resolveDefaultConfigDir({ platform: process.platform, env: process.env, homeDir: homedir() });
5
28
  const CREDENTIALS_PATH = join(CONFIG_DIR, 'credentials.json');
6
29
  const CREDENTIALS_TMP_PATH = `${CREDENTIALS_PATH}.tmp`;
7
30
  const LOGIN_STATE_PATH = join(CONFIG_DIR, 'cli-login-state.json');
8
31
  const LOGIN_STATE_TMP_PATH = `${LOGIN_STATE_PATH}.tmp`;
9
32
  const LOGIN_STATE_TTL_MS = 10 * 60 * 1000;
33
+ /**
34
+ * Move `legacy` → `target` atomically if all of these hold:
35
+ * - `legacy` exists
36
+ * - `target` does not exist
37
+ * - the two paths differ
38
+ *
39
+ * Returns `true` when a rename actually happened. Pure with respect to its
40
+ * arguments — no env or platform checks. Exported for tests.
41
+ */
42
+ export function tryMigrateConfigDir(legacy, target) {
43
+ if (legacy === target)
44
+ return false;
45
+ if (existsSync(target))
46
+ return false;
47
+ if (!existsSync(legacy))
48
+ return false;
49
+ mkdirSync(dirname(target), { recursive: true });
50
+ renameSync(legacy, target);
51
+ return true;
52
+ }
53
+ let migrated = false;
54
+ /**
55
+ * One-shot migration of the legacy `~/.workjournal/` directory to the resolved
56
+ * platform-standard {@link CONFIG_DIR}. Idempotent within a process via a
57
+ * module-scoped flag. Skipped entirely when `WORKJOURNAL_CONFIG_DIR` is set.
58
+ * The atomic directory rename moves all on-disk files (`credentials.json`,
59
+ * `cli-login-state.json`, `config.json`) together.
60
+ */
61
+ export function ensureMigrated() {
62
+ if (migrated)
63
+ return;
64
+ migrated = true;
65
+ if (process.env['WORKJOURNAL_CONFIG_DIR'])
66
+ return;
67
+ const legacy = join(homedir(), '.workjournal');
68
+ if (tryMigrateConfigDir(legacy, CONFIG_DIR)) {
69
+ process.stderr.write(`workjournal: moved config from ${legacy} to ${CONFIG_DIR}\n`);
70
+ }
71
+ }
10
72
  function ensureConfigDir() {
11
73
  if (!existsSync(CONFIG_DIR)) {
12
74
  mkdirSync(CONFIG_DIR, { mode: 0o700, recursive: true });
13
75
  }
14
76
  }
15
77
  export function readCredentials() {
78
+ ensureMigrated();
16
79
  if (!existsSync(CREDENTIALS_PATH)) {
17
80
  return null;
18
81
  }
@@ -25,16 +88,19 @@ export function readCredentials() {
25
88
  }
26
89
  }
27
90
  export function writeCredentials(creds) {
91
+ ensureMigrated();
28
92
  ensureConfigDir();
29
93
  writeFileSync(CREDENTIALS_TMP_PATH, `${JSON.stringify(creds, null, '\t')}\n`, { mode: 0o600 });
30
94
  renameSync(CREDENTIALS_TMP_PATH, CREDENTIALS_PATH);
31
95
  }
32
96
  export function clearCredentials() {
97
+ ensureMigrated();
33
98
  if (existsSync(CREDENTIALS_PATH)) {
34
99
  unlinkSync(CREDENTIALS_PATH);
35
100
  }
36
101
  }
37
102
  export function writeLoginState(state) {
103
+ ensureMigrated();
38
104
  ensureConfigDir();
39
105
  writeFileSync(LOGIN_STATE_TMP_PATH, `${JSON.stringify(state, null, '\t')}\n`, { mode: 0o600 });
40
106
  renameSync(LOGIN_STATE_TMP_PATH, LOGIN_STATE_PATH);
@@ -44,6 +110,7 @@ export function writeLoginState(state) {
44
110
  * Does NOT enforce TTL — callers should check `created_at` against `LOGIN_STATE_TTL_MS`.
45
111
  */
46
112
  export function readLoginState() {
113
+ ensureMigrated();
47
114
  if (!existsSync(LOGIN_STATE_PATH)) {
48
115
  return null;
49
116
  }
@@ -70,6 +137,7 @@ export function readLoginState() {
70
137
  }
71
138
  }
72
139
  export function clearLoginState() {
140
+ ensureMigrated();
73
141
  if (existsSync(LOGIN_STATE_PATH)) {
74
142
  unlinkSync(LOGIN_STATE_PATH);
75
143
  }
@@ -122,4 +190,25 @@ export async function getAccessToken() {
122
190
  }
123
191
  return creds.access_token;
124
192
  }
193
+ /**
194
+ * Unconditional refresh — used by API clients on a 401 response when the
195
+ * pre-flight {@link getAccessToken} returned a token the server still
196
+ * rejected (clock skew, mid-flight expiry, server-side revocation).
197
+ *
198
+ * Returns null when no credentials are on disk, no refresh token is stored,
199
+ * or the refresh request itself fails. Callers treat null as "no recovery
200
+ * possible" and surface an auth-required error to the user.
201
+ */
202
+ export async function forceRefreshAccessToken() {
203
+ const creds = readCredentials();
204
+ if (!creds?.refresh_token)
205
+ return null;
206
+ try {
207
+ const refreshed = await refreshAccessToken(creds.refresh_token);
208
+ return refreshed.access_token;
209
+ }
210
+ catch {
211
+ return null;
212
+ }
213
+ }
125
214
  //# sourceMappingURL=credentials.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,UAAU,EACV,SAAS,EACT,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAQjC,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,cAAc,CAAC,CAAC;AACnG,MAAM,gBAAgB,GAAG,IAAI,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC;AAC9D,MAAM,oBAAoB,GAAG,GAAG,gBAAgB,MAAM,CAAC;AACvD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I,CAAC;IACb,CAAC;AACF,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * System default prompt — returned by the journal-fetch endpoint when no
3
+ * custom prompt is assigned to the journal. Agents read `prompt.body` from
4
+ * the response without knowing whether it's the default or a custom one.
5
+ *
6
+ * Edit content directly in this file. The journal-fetch surface (issue #240)
7
+ * relays this verbatim, so changes ship with the next API deploy.
8
+ */
9
+ export declare const DEFAULT_JOURNAL_PROMPT = "You are writing a development journal entry capturing a session of work.\n\nGoals\n- Make the entry useful to a future engineer (often yourself) who needs to understand *why* a decision was made, not just *what* changed.\n- Capture trade-offs that were considered and rejected \u2014 these are usually more valuable than the option that was picked.\n- Link to related work: prior journal entries, GitHub issues/PRs, external docs.\n\nWhat to include\n- A concise title (3\u20138 words) that names the *outcome*, not the process.\n- A 1\u20133 sentence summary that another engineer could read in a list and decide whether to open the full entry.\n- The detailed body: file paths touched, commits/PRs, decisions and their rationale, dead ends worth recording, follow-up items left for next time.\n\nWhat to skip\n- Generic narrations of every command you ran.\n- Restating what the diff already shows; explain why, not what.\n- Speculation about future work that isn't already grounded in the session.\n\nVoice\n- Past tense, factual (\"Added X, decided Y because Z\"). No hedging fluff.\n- Tables for structured data (decision matrices, file-change summaries).\n- Short paragraphs over long ones; bullet lists for sequential findings.\n";
10
+ //# sourceMappingURL=default-prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-prompt.d.ts","sourceRoot":"","sources":["../src/default-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,ytCAqBlC,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * System default prompt — returned by the journal-fetch endpoint when no
3
+ * custom prompt is assigned to the journal. Agents read `prompt.body` from
4
+ * the response without knowing whether it's the default or a custom one.
5
+ *
6
+ * Edit content directly in this file. The journal-fetch surface (issue #240)
7
+ * relays this verbatim, so changes ship with the next API deploy.
8
+ */
9
+ export const DEFAULT_JOURNAL_PROMPT = `You are writing a development journal entry capturing a session of work.
10
+
11
+ Goals
12
+ - Make the entry useful to a future engineer (often yourself) who needs to understand *why* a decision was made, not just *what* changed.
13
+ - Capture trade-offs that were considered and rejected — these are usually more valuable than the option that was picked.
14
+ - Link to related work: prior journal entries, GitHub issues/PRs, external docs.
15
+
16
+ What to include
17
+ - A concise title (3–8 words) that names the *outcome*, not the process.
18
+ - A 1–3 sentence summary that another engineer could read in a list and decide whether to open the full entry.
19
+ - The detailed body: file paths touched, commits/PRs, decisions and their rationale, dead ends worth recording, follow-up items left for next time.
20
+
21
+ What to skip
22
+ - Generic narrations of every command you ran.
23
+ - Restating what the diff already shows; explain why, not what.
24
+ - Speculation about future work that isn't already grounded in the session.
25
+
26
+ Voice
27
+ - Past tense, factual ("Added X, decided Y because Z"). No hedging fluff.
28
+ - Tables for structured data (decision matrices, file-change summaries).
29
+ - Short paragraphs over long ones; bullet lists for sequential findings.
30
+ `;
31
+ //# sourceMappingURL=default-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-prompt.js","sourceRoot":"","sources":["../src/default-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;CAqBrC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,10 +1,13 @@
1
1
  export type { ErrorCode } from './constants.js';
2
- export { API_PATHS, API_VERSION, CURRENT_PRIVACY_VERSION, CURRENT_TOS_VERSION, DEFAULT_PAGE_LIMIT, ERROR_CODES, MAX_EMAIL_LENGTH, MAX_JOURNAL_NAME_LENGTH, MAX_PAGE_LIMIT, MAX_SUMMARY_LENGTH, MAX_TITLE_LENGTH, SHARED_WITH_ME_SLUG, WS_API_PATHS, } from './constants.js';
2
+ export { API_PATHS, API_VERSION, CURRENT_PRIVACY_VERSION, CURRENT_TOS_VERSION, DEFAULT_PAGE_LIMIT, ERROR_CODES, MAX_EMAIL_LENGTH, MAX_JOURNAL_NAME_LENGTH, MAX_PAGE_LIMIT, MAX_PROMPT_BODY_LENGTH, MAX_PROMPT_NAME_LENGTH, MAX_SUMMARY_LENGTH, MAX_TITLE_LENGTH, SHARED_WITH_ME_SLUG, WS_API_PATHS, } from './constants.js';
3
+ export { DEFAULT_JOURNAL_PROMPT } from './default-prompt.js';
3
4
  export type { BearerResolution, WrappedPayload } from './opaque-token.js';
4
5
  export { AAD_STRING, isOpaqueToken, KEY_LEN, NONCE_LEN, resolveBearer, TAG_LEN, unwrapToken, WJTK_PREFIX, wrapToken, } from './opaque-token.js';
5
6
  export { proposeWorkspaceNameFromEmail } from './propose-workspace-name.js';
6
7
  export { isReservedSlug, MAX_NAME_LENGTH, MAX_SLUG_LENGTH, RESERVED_SLUGS, slugify, } from './slug.js';
8
+ export type { ClientOption, InterfaceOption } from './support-labels.js';
9
+ export { CLIENT_OPTIONS, INTERFACE_OPTIONS, isClientOption, isInterfaceOption, } from './support-labels.js';
7
10
  export type { FeatureFlag } from './tiers.js';
8
11
  export { canUseFeature, canUseFeatureForCode } from './tiers.js';
9
- export type { AcceptInvitationRequest, AcceptLegalRequest, ApiError, CreateEntryRequest, CreateInvitationRequest, CreateJournalRequest, CreateWorkspaceRequest, Entry, EntrySummary, Invitation, Journal, JournalMember, PaginatedResponse, SharedJournal, Tier, TierCode, UpdateEntryRequest, UpdateJournalRequest, UserProfile, Workspace, } from './types.js';
12
+ export type { AcceptInvitationRequest, AcceptLegalRequest, ApiError, CreateEntryRequest, CreateInvitationRequest, CreateJournalRequest, CreatePromptRequest, CreateWorkspaceRequest, Entry, EntrySummary, Invitation, Journal, JournalContributor, JournalContributorRow, JournalContributorWithEmail, JournalPromptInfo, PaginatedResponse, Prompt, SharedJournal, Tier, TierCode, UpdateEntryRequest, UpdateJournalRequest, UpdatePromptRequest, UserProfile, Workspace, } from './types.js';
10
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EACN,SAAS,EACT,WAAW,EACX,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,GACZ,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EACN,UAAU,EACV,aAAa,EACb,OAAO,EACP,SAAS,EACT,aAAa,EACb,OAAO,EACP,WAAW,EACX,WAAW,EACX,SAAS,GACT,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EACN,cAAc,EACd,eAAe,EACf,eAAe,EACf,cAAc,EACd,OAAO,GACP,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACjE,YAAY,EACX,uBAAuB,EACvB,kBAAkB,EAClB,QAAQ,EACR,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACpB,sBAAsB,EACtB,KAAK,EACL,YAAY,EACZ,UAAU,EACV,OAAO,EACP,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,IAAI,EACJ,QAAQ,EACR,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,EACX,SAAS,GACT,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EACN,SAAS,EACT,WAAW,EACX,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,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{ API_PATHS, API_VERSION, CURRENT_PRIVACY_VERSION, CURRENT_TOS_VERSION, DEFAULT_PAGE_LIMIT, ERROR_CODES, MAX_EMAIL_LENGTH, MAX_JOURNAL_NAME_LENGTH, MAX_PAGE_LIMIT, MAX_SUMMARY_LENGTH, MAX_TITLE_LENGTH, SHARED_WITH_ME_SLUG, WS_API_PATHS, } from './constants.js';
1
+ export { API_PATHS, API_VERSION, CURRENT_PRIVACY_VERSION, CURRENT_TOS_VERSION, DEFAULT_PAGE_LIMIT, ERROR_CODES, MAX_EMAIL_LENGTH, MAX_JOURNAL_NAME_LENGTH, MAX_PAGE_LIMIT, MAX_PROMPT_BODY_LENGTH, MAX_PROMPT_NAME_LENGTH, MAX_SUMMARY_LENGTH, MAX_TITLE_LENGTH, SHARED_WITH_ME_SLUG, WS_API_PATHS, } from './constants.js';
2
+ export { DEFAULT_JOURNAL_PROMPT } from './default-prompt.js';
2
3
  export { AAD_STRING, isOpaqueToken, KEY_LEN, NONCE_LEN, resolveBearer, TAG_LEN, unwrapToken, WJTK_PREFIX, wrapToken, } from './opaque-token.js';
3
4
  export { proposeWorkspaceNameFromEmail } from './propose-workspace-name.js';
4
5
  export { isReservedSlug, MAX_NAME_LENGTH, MAX_SLUG_LENGTH, RESERVED_SLUGS, slugify, } from './slug.js';
6
+ export { CLIENT_OPTIONS, INTERFACE_OPTIONS, isClientOption, isInterfaceOption, } from './support-labels.js';
5
7
  export { canUseFeature, canUseFeatureForCode } from './tiers.js';
6
8
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,SAAS,EACT,WAAW,EACX,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,GACZ,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACN,UAAU,EACV,aAAa,EACb,OAAO,EACP,SAAS,EACT,aAAa,EACb,OAAO,EACP,WAAW,EACX,WAAW,EACX,SAAS,GACT,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EACN,cAAc,EACd,eAAe,EACf,eAAe,EACf,cAAc,EACd,OAAO,GACP,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,SAAS,EACT,WAAW,EACX,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACX,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACd,sBAAsB,EACtB,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,YAAY,GACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EACN,UAAU,EACV,aAAa,EACb,OAAO,EACP,SAAS,EACT,aAAa,EACb,OAAO,EACP,WAAW,EACX,WAAW,EACX,SAAS,GACT,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EACN,cAAc,EACd,eAAe,EACf,eAAe,EACf,cAAc,EACd,OAAO,GACP,MAAM,WAAW,CAAC;AAEnB,OAAO,EACN,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,iBAAiB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"slug.d.ts","sourceRoot":"","sources":["../src/slug.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,WAAW,CAAC,MAAM,CAoB7C,CAAC;AAEH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAgB7C"}
1
+ {"version":3,"file":"slug.d.ts","sourceRoot":"","sources":["../src/slug.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,WAAW,CAAC,MAAM,CAuB7C,CAAC;AAEH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAgB7C"}
package/dist/slug.js CHANGED
@@ -14,6 +14,7 @@ export const RESERVED_SLUGS = new Set([
14
14
  'shares',
15
15
  'shared-with-me',
16
16
  'members',
17
+ 'contributors',
17
18
  'invitations',
18
19
  'invites',
19
20
  'check-slug',
@@ -25,6 +26,8 @@ export const RESERVED_SLUGS = new Set([
25
26
  'login',
26
27
  'logout',
27
28
  'authorize',
29
+ 'prompt',
30
+ 'prompts',
28
31
  ]);
29
32
  export function isReservedSlug(slug) {
30
33
  return RESERVED_SLUGS.has(slug);
package/dist/slug.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"slug.js","sourceRoot":"","sources":["../src/slug.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAClC,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAElC;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,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GAAG,CAAC,CAAC,EAAE,CAAC;QAClD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;IACpC,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Closed enums used by the in-product support form (`/support`) and the
3
+ * GitHub bug-template form on `workjournal-pro/feedback`. Both surfaces
4
+ * present the same dropdowns so triage labels are uniform regardless of
5
+ * where a report originates.
6
+ *
7
+ * - `INTERFACE_OPTIONS` — which Workjournal surface the user was using
8
+ * when the issue arose. Always required on either form.
9
+ * - `CLIENT_OPTIONS` — which client (typically an AI agent) was driving
10
+ * the surface. Required on the web form (with `i-dont-know` as the
11
+ * default) so support emails carry usable triage context.
12
+ *
13
+ * Both sets include `i-dont-know` as a real value rather than free-text
14
+ * "Other" — explicit about user confidence and avoids unstructured
15
+ * drift in the triage labels.
16
+ *
17
+ * The kebab-case literal values are what end up on GitHub as label names
18
+ * and inside the support email body. The shared API and the web form
19
+ * validate inbound submissions against these whitelists so off-vocabulary
20
+ * values can't leak into triage.
21
+ */
22
+ export declare const INTERFACE_OPTIONS: readonly ["i-dont-know", "web", "cli", "mcp", "skill", "api"];
23
+ export declare const CLIENT_OPTIONS: readonly ["i-dont-know", "ai-anthropic-claude-desktop", "ai-anthropic-claude-mobile", "ai-anthropic-claude-web", "ai-anthropic-claude-code", "ai-openai-chatgpt-web", "ai-openai-chatgpt-desktop", "ai-openai-chatgpt-mobile", "ai-openai-codex", "ai-perplexity-desktop", "ai-perplexity-mobile", "ai-perplexity-web", "web-browser-direct"];
24
+ export type InterfaceOption = (typeof INTERFACE_OPTIONS)[number];
25
+ export type ClientOption = (typeof CLIENT_OPTIONS)[number];
26
+ export declare function isInterfaceOption(value: unknown): value is InterfaceOption;
27
+ export declare function isClientOption(value: unknown): value is ClientOption;
28
+ //# sourceMappingURL=support-labels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"support-labels.d.ts","sourceRoot":"","sources":["../src/support-labels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,eAAO,MAAM,iBAAiB,+DAAgE,CAAC;AAE/F,eAAO,MAAM,cAAc,+UAcjB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AACjE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAE1E;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAEpE"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Closed enums used by the in-product support form (`/support`) and the
3
+ * GitHub bug-template form on `workjournal-pro/feedback`. Both surfaces
4
+ * present the same dropdowns so triage labels are uniform regardless of
5
+ * where a report originates.
6
+ *
7
+ * - `INTERFACE_OPTIONS` — which Workjournal surface the user was using
8
+ * when the issue arose. Always required on either form.
9
+ * - `CLIENT_OPTIONS` — which client (typically an AI agent) was driving
10
+ * the surface. Required on the web form (with `i-dont-know` as the
11
+ * default) so support emails carry usable triage context.
12
+ *
13
+ * Both sets include `i-dont-know` as a real value rather than free-text
14
+ * "Other" — explicit about user confidence and avoids unstructured
15
+ * drift in the triage labels.
16
+ *
17
+ * The kebab-case literal values are what end up on GitHub as label names
18
+ * and inside the support email body. The shared API and the web form
19
+ * validate inbound submissions against these whitelists so off-vocabulary
20
+ * values can't leak into triage.
21
+ */
22
+ export const INTERFACE_OPTIONS = ['i-dont-know', 'web', 'cli', 'mcp', 'skill', 'api'];
23
+ export const CLIENT_OPTIONS = [
24
+ 'i-dont-know',
25
+ 'ai-anthropic-claude-desktop',
26
+ 'ai-anthropic-claude-mobile',
27
+ 'ai-anthropic-claude-web',
28
+ 'ai-anthropic-claude-code',
29
+ 'ai-openai-chatgpt-web',
30
+ 'ai-openai-chatgpt-desktop',
31
+ 'ai-openai-chatgpt-mobile',
32
+ 'ai-openai-codex',
33
+ 'ai-perplexity-desktop',
34
+ 'ai-perplexity-mobile',
35
+ 'ai-perplexity-web',
36
+ 'web-browser-direct',
37
+ ];
38
+ export function isInterfaceOption(value) {
39
+ return typeof value === 'string' && INTERFACE_OPTIONS.includes(value);
40
+ }
41
+ export function isClientOption(value) {
42
+ return typeof value === 'string' && CLIENT_OPTIONS.includes(value);
43
+ }
44
+ //# sourceMappingURL=support-labels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"support-labels.js","sourceRoot":"","sources":["../src/support-labels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAU,CAAC;AAE/F,MAAM,CAAC,MAAM,cAAc,GAAG;IAC7B,aAAa;IACb,6BAA6B;IAC7B,4BAA4B;IAC5B,yBAAyB;IACzB,0BAA0B;IAC1B,uBAAuB;IACvB,2BAA2B;IAC3B,0BAA0B;IAC1B,iBAAiB;IACjB,uBAAuB;IACvB,sBAAsB;IACtB,mBAAmB;IACnB,oBAAoB;CACX,CAAC;AAKX,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC/C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,iBAAuC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC9F,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAc;IAC5C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,cAAoC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC3F,CAAC"}
package/dist/tiers.d.ts CHANGED
@@ -8,7 +8,7 @@ import type { Tier } from './types.js';
8
8
  * Never gate by calling `workspace.tier_code === 'PRO'` — the feature matrix
9
9
  * is the source of truth; tiers are just a bundle of features.
10
10
  */
11
- export type FeatureFlag = 'can_export' | 'can_public_share' | 'can_private_share' | 'can_per_share_permissions' | 'can_word_search' | 'can_rag_search' | 'can_webhooks';
11
+ export type FeatureFlag = 'can_export' | 'can_public_share' | 'can_private_share' | 'can_per_share_permissions' | 'can_word_search' | 'can_rag_search' | 'can_api_tokens' | 'can_webhooks' | 'custom_prompt' | 'prompt_templates' | 'support_access' | 'tags';
12
12
  export declare function canUseFeature(tier: Tier, feature: FeatureFlag): boolean;
13
13
  /** Safe fallback: treat unknown tier as FREE-equivalent (no premium features). */
14
14
  export declare function canUseFeatureForCode(tier: Tier | null | undefined, feature: FeatureFlag): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"tiers.d.ts","sourceRoot":"","sources":["../src/tiers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GACpB,YAAY,GACZ,kBAAkB,GAClB,mBAAmB,GACnB,2BAA2B,GAC3B,iBAAiB,GACjB,gBAAgB,GAChB,cAAc,CAAC;AAElB,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAEvE;AAED,kFAAkF;AAClF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAGjG"}
1
+ {"version":3,"file":"tiers.d.ts","sourceRoot":"","sources":["../src/tiers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GACpB,YAAY,GACZ,kBAAkB,GAClB,mBAAmB,GACnB,2BAA2B,GAC3B,iBAAiB,GACjB,gBAAgB,GAChB,gBAAgB,GAChB,cAAc,GACd,eAAe,GACf,kBAAkB,GAClB,gBAAgB,GAChB,MAAM,CAAC;AAEV,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAEvE;AAED,kFAAkF;AAClF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAGjG"}
package/dist/tiers.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tiers.js","sourceRoot":"","sources":["../src/tiers.ts"],"names":[],"mappings":"AAoBA,MAAM,UAAU,aAAa,CAAC,IAAU,EAAE,OAAoB;IAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;AAC/B,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,oBAAoB,CAAC,IAA6B,EAAE,OAAoB;IACvF,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACxB,OAAO,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACrC,CAAC"}
1
+ {"version":3,"file":"tiers.js","sourceRoot":"","sources":["../src/tiers.ts"],"names":[],"mappings":"AAyBA,MAAM,UAAU,aAAa,CAAC,IAAU,EAAE,OAAoB;IAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;AAC/B,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,oBAAoB,CAAC,IAA6B,EAAE,OAAoB;IACvF,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACxB,OAAO,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACrC,CAAC"}
package/dist/types.d.ts CHANGED
@@ -34,6 +34,8 @@ export interface Workspace {
34
34
  name: string;
35
35
  slug: string;
36
36
  tier_code: TierCode;
37
+ /** Joined Tier row. Populated by GET endpoints; absent on listing rows. */
38
+ tier?: Tier;
37
39
  created_at: string;
38
40
  updated_at: string;
39
41
  }
@@ -48,13 +50,19 @@ export interface Tier {
48
50
  sort_order: number;
49
51
  max_journals: number;
50
52
  max_entries_per_journal: number;
53
+ max_contributors_per_journal: number;
51
54
  can_export: boolean;
52
55
  can_public_share: boolean;
53
56
  can_private_share: boolean;
54
57
  can_per_share_permissions: boolean;
55
58
  can_word_search: boolean;
56
59
  can_rag_search: boolean;
60
+ can_api_tokens: boolean;
57
61
  can_webhooks: boolean;
62
+ custom_prompt: boolean;
63
+ prompt_templates: boolean;
64
+ support_access: boolean;
65
+ tags: boolean;
58
66
  paddle_product_id: string | null;
59
67
  created_at: string;
60
68
  updated_at: string;
@@ -72,13 +80,26 @@ export interface Journal {
72
80
  updated_at: string;
73
81
  }
74
82
  /** Access control record linking a user to a journal with a role. */
75
- export interface JournalMember {
83
+ export interface JournalContributor {
76
84
  id: string;
77
85
  journal_id: string;
78
86
  user_id: string;
79
- role: 'owner' | 'member';
87
+ role: 'owner' | 'contributor';
80
88
  created_at: string;
81
89
  }
90
+ /** Contributor row enriched with the user's email — returned by GET /contributors. */
91
+ export interface JournalContributorWithEmail extends JournalContributor {
92
+ email: string | null;
93
+ }
94
+ /**
95
+ * Slim contributor shape that the journal-list and journal-detail endpoints
96
+ * inline next to a Journal — only the role and join date, not the full
97
+ * `JournalContributor` row. Use this when the consumer only needs to know who
98
+ * the caller is to a given journal (e.g. badge rendering, owner gate); use the
99
+ * full `JournalContributor` only for the contributor-management endpoints
100
+ * (`GET /contributors`, etc.) that return the entire row.
101
+ */
102
+ export type JournalContributorRow = Pick<JournalContributor, 'role' | 'created_at'>;
82
103
  /** Journal entry scoped to a journal. Identified user-facing by `index`. */
83
104
  export interface Entry {
84
105
  id: string;
@@ -103,8 +124,8 @@ export interface EntrySummary {
103
124
  }
104
125
  /**
105
126
  * Listing row from `GET /v1/shared-with-me/journals`. A journal is "shared
106
- * with me" when the caller has a `journal_members` row but does not own the
107
- * containing workspace. Each row carries enough context for a flat table
127
+ * with me" when the caller has a `journal_contributors` row but does not own
128
+ * the containing workspace. Each row carries enough context for a flat table
108
129
  * view across workspaces (issue #236).
109
130
  */
110
131
  export interface SharedJournal {
@@ -121,7 +142,7 @@ export interface SharedJournal {
121
142
  owner: {
122
143
  email: string | null;
123
144
  };
124
- role: 'owner' | 'member';
145
+ role: 'owner' | 'contributor';
125
146
  created_at: string;
126
147
  }
127
148
  /** Email-based invitation for journal sharing. */
@@ -165,6 +186,38 @@ export interface CreateInvitationRequest {
165
186
  export interface AcceptInvitationRequest {
166
187
  token: string;
167
188
  }
189
+ /** Workspace-scoped prompt (issue #238). */
190
+ export interface Prompt {
191
+ id: string;
192
+ workspace_id: string;
193
+ slug: string;
194
+ name: string;
195
+ body: string;
196
+ created_at: string;
197
+ updated_at: string;
198
+ created_by: string | null;
199
+ }
200
+ export interface CreatePromptRequest {
201
+ name: string;
202
+ body: string;
203
+ slug?: string | undefined;
204
+ }
205
+ export interface UpdatePromptRequest {
206
+ name?: string | undefined;
207
+ body?: string | undefined;
208
+ }
209
+ /**
210
+ * Prompt block returned on `GET /v1/workspaces/:ws/journals/:j` (issue #240).
211
+ * Always populated — `source: 'default'` falls back to the constant in
212
+ * `packages/shared/src/default-prompt.ts`. Agents read `body` directly.
213
+ */
214
+ export interface JournalPromptInfo {
215
+ source: 'custom' | 'default';
216
+ name: string | null;
217
+ slug: string | null;
218
+ body: string;
219
+ used_by_count: number | null;
220
+ }
168
221
  export interface PaginatedResponse<T> {
169
222
  data: T[];
170
223
  total: number;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,CAAC;AAEzD;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,wBAAwB,EAA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AAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workjournal/shared",
3
- "version": "0.13.0",
3
+ "version": "0.28.0",
4
4
  "description": "Shared types, constants, and credential helpers for the Workjournal CLI and MCP server.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -27,11 +27,10 @@
27
27
  },
28
28
  "repository": {
29
29
  "type": "git",
30
- "url": "https://github.com/workjournal-pro/workjournal.git",
31
- "directory": "packages/shared"
30
+ "url": "https://github.com/workjournal-pro"
32
31
  },
33
32
  "bugs": {
34
- "url": "https://github.com/workjournal-pro/workjournal/issues"
33
+ "url": "https://github.com/workjournal-pro/feedback/issues"
35
34
  },
36
35
  "homepage": "https://workjournal.pro",
37
36
  "keywords": [