opensoma 0.5.0 → 0.6.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.
- package/dist/package.json +5 -1
- package/dist/src/agent-browser-launcher.d.ts +43 -0
- package/dist/src/agent-browser-launcher.d.ts.map +1 -0
- package/dist/src/agent-browser-launcher.js +97 -0
- package/dist/src/agent-browser-launcher.js.map +1 -0
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +3 -2
- package/dist/src/cli.js.map +1 -1
- package/dist/src/client.d.ts +36 -7
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/client.js +231 -63
- package/dist/src/client.js.map +1 -1
- package/dist/src/commands/agent-browser.d.ts +3 -0
- package/dist/src/commands/agent-browser.d.ts.map +1 -0
- package/dist/src/commands/agent-browser.js +27 -0
- package/dist/src/commands/agent-browser.js.map +1 -0
- package/dist/src/commands/auth.d.ts +1 -1
- package/dist/src/commands/auth.d.ts.map +1 -1
- package/dist/src/commands/auth.js +4 -2
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/dashboard.d.ts +13 -0
- package/dist/src/commands/dashboard.d.ts.map +1 -1
- package/dist/src/commands/dashboard.js +10 -18
- package/dist/src/commands/dashboard.js.map +1 -1
- package/dist/src/commands/helpers.d.ts +1 -1
- package/dist/src/commands/helpers.d.ts.map +1 -1
- package/dist/src/commands/helpers.js +2 -2
- package/dist/src/commands/helpers.js.map +1 -1
- package/dist/src/commands/index.d.ts +2 -1
- package/dist/src/commands/index.d.ts.map +1 -1
- package/dist/src/commands/index.js +2 -1
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/mentoring.d.ts.map +1 -1
- package/dist/src/commands/mentoring.js +54 -29
- package/dist/src/commands/mentoring.js.map +1 -1
- package/dist/src/commands/notice.d.ts.map +1 -1
- package/dist/src/commands/notice.js +2 -1
- package/dist/src/commands/notice.js.map +1 -1
- package/dist/src/commands/report.d.ts.map +1 -1
- package/dist/src/commands/report.js +4 -2
- package/dist/src/commands/report.js.map +1 -1
- package/dist/src/commands/room.d.ts.map +1 -1
- package/dist/src/commands/room.js +125 -2
- package/dist/src/commands/room.js.map +1 -1
- package/dist/src/commands/schedule.d.ts +3 -0
- package/dist/src/commands/schedule.d.ts.map +1 -0
- package/dist/src/commands/schedule.js +27 -0
- package/dist/src/commands/schedule.js.map +1 -0
- package/dist/src/commands/team.d.ts.map +1 -1
- package/dist/src/commands/team.js +55 -4
- package/dist/src/commands/team.js.map +1 -1
- package/dist/src/constants.d.ts +5 -5
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +20 -8
- package/dist/src/constants.js.map +1 -1
- package/dist/src/credential-manager.d.ts +9 -0
- package/dist/src/credential-manager.d.ts.map +1 -1
- package/dist/src/credential-manager.js +24 -0
- package/dist/src/credential-manager.js.map +1 -1
- package/dist/src/formatters.d.ts +11 -3
- package/dist/src/formatters.d.ts.map +1 -1
- package/dist/src/formatters.js +281 -52
- package/dist/src/formatters.js.map +1 -1
- package/dist/src/http.d.ts +8 -0
- package/dist/src/http.d.ts.map +1 -1
- package/dist/src/http.js +29 -1
- package/dist/src/http.js.map +1 -1
- package/dist/src/index.d.ts +4 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/shared/utils/swmaestro.d.ts +34 -1
- package/dist/src/shared/utils/swmaestro.d.ts.map +1 -1
- package/dist/src/shared/utils/swmaestro.js +102 -43
- package/dist/src/shared/utils/swmaestro.js.map +1 -1
- package/dist/src/shared/utils/team-action-params.d.ts +3 -0
- package/dist/src/shared/utils/team-action-params.d.ts.map +1 -0
- package/dist/src/shared/utils/team-action-params.js +10 -0
- package/dist/src/shared/utils/team-action-params.js.map +1 -0
- package/dist/src/shared/utils/team-params.d.ts +12 -0
- package/dist/src/shared/utils/team-params.d.ts.map +1 -0
- package/dist/src/shared/utils/team-params.js +38 -0
- package/dist/src/shared/utils/team-params.js.map +1 -0
- package/dist/src/types.d.ts +147 -10
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +74 -6
- package/dist/src/types.js.map +1 -1
- package/package.json +5 -1
- package/src/agent-browser-launcher.test.ts +263 -0
- package/src/agent-browser-launcher.ts +159 -0
- package/src/cli.ts +4 -2
- package/src/client.test.ts +801 -140
- package/src/client.ts +293 -79
- package/src/commands/agent-browser.ts +33 -0
- package/src/commands/auth.test.ts +83 -32
- package/src/commands/auth.ts +5 -3
- package/src/commands/dashboard.test.ts +57 -0
- package/src/commands/dashboard.ts +22 -19
- package/src/commands/helpers.test.ts +79 -32
- package/src/commands/helpers.ts +3 -3
- package/src/commands/index.ts +2 -1
- package/src/commands/mentoring.ts +60 -29
- package/src/commands/notice.ts +2 -1
- package/src/commands/report.test.ts +7 -7
- package/src/commands/report.ts +4 -2
- package/src/commands/room.ts +160 -1
- package/src/commands/schedule.ts +32 -0
- package/src/commands/team.ts +73 -5
- package/src/constants.ts +20 -8
- package/src/credential-manager.test.ts +49 -5
- package/src/credential-manager.ts +27 -0
- package/src/formatters.test.ts +548 -53
- package/src/formatters.ts +309 -55
- package/src/http.test.ts +108 -39
- package/src/http.ts +41 -2
- package/src/index.ts +10 -1
- package/src/shared/utils/mentoring-params.test.ts +16 -16
- package/src/shared/utils/swmaestro.test.ts +326 -11
- package/src/shared/utils/swmaestro.ts +150 -52
- package/src/shared/utils/team-action-params.test.ts +32 -0
- package/src/shared/utils/team-action-params.ts +10 -0
- package/src/shared/utils/team-params.test.ts +141 -0
- package/src/shared/utils/team-params.ts +53 -0
- package/src/shared/utils/toz.test.ts +12 -7
- package/src/token-extractor.test.ts +12 -12
- package/src/toz-http.test.ts +11 -11
- package/src/types.test.ts +235 -206
- package/src/types.ts +87 -7
- package/dist/src/commands/event.d.ts +0 -3
- package/dist/src/commands/event.d.ts.map +0 -1
- package/dist/src/commands/event.js +0 -58
- package/dist/src/commands/event.js.map +0 -1
- package/src/commands/event.ts +0 -73
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterEach, describe, expect,
|
|
1
|
+
import { afterEach, describe, expect, it } from 'bun:test'
|
|
2
2
|
import { mkdtemp, readFile, rm, stat } from 'node:fs/promises'
|
|
3
3
|
import { tmpdir } from 'node:os'
|
|
4
4
|
import { join } from 'node:path'
|
|
@@ -15,7 +15,7 @@ afterEach(async () => {
|
|
|
15
15
|
})
|
|
16
16
|
|
|
17
17
|
describe('CredentialManager', () => {
|
|
18
|
-
|
|
18
|
+
it('loads an empty config when the credentials file does not exist', async () => {
|
|
19
19
|
const dir = await makeTempDir()
|
|
20
20
|
const manager = new CredentialManager(dir)
|
|
21
21
|
|
|
@@ -23,7 +23,7 @@ describe('CredentialManager', () => {
|
|
|
23
23
|
await expect(manager.getCredentials()).resolves.toBeNull()
|
|
24
24
|
})
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
it('saves and loads credentials with secure file permissions', async () => {
|
|
27
27
|
const dir = await makeTempDir()
|
|
28
28
|
const manager = new CredentialManager(dir)
|
|
29
29
|
|
|
@@ -53,7 +53,7 @@ describe('CredentialManager', () => {
|
|
|
53
53
|
expect(keyFileStat.mode & 0o777).toBe(0o600)
|
|
54
54
|
})
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
it('removes the credentials file', async () => {
|
|
57
57
|
const dir = await makeTempDir()
|
|
58
58
|
const manager = new CredentialManager(dir)
|
|
59
59
|
|
|
@@ -66,7 +66,51 @@ describe('CredentialManager', () => {
|
|
|
66
66
|
await expect(manager.getCredentials()).resolves.toBeNull()
|
|
67
67
|
})
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
it('clearSessionState preserves username and password but wipes session fields', async () => {
|
|
70
|
+
const dir = await makeTempDir()
|
|
71
|
+
const manager = new CredentialManager(dir)
|
|
72
|
+
|
|
73
|
+
await manager.setCredentials({
|
|
74
|
+
sessionCookie: 'session-value',
|
|
75
|
+
csrfToken: 'csrf-value',
|
|
76
|
+
username: 'mentor@example.com',
|
|
77
|
+
password: 'secret-password',
|
|
78
|
+
loggedInAt: '2026-04-09T00:00:00.000Z',
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
await manager.clearSessionState()
|
|
82
|
+
|
|
83
|
+
await expect(manager.getCredentials()).resolves.toEqual({
|
|
84
|
+
sessionCookie: '',
|
|
85
|
+
csrfToken: '',
|
|
86
|
+
username: 'mentor@example.com',
|
|
87
|
+
password: 'secret-password',
|
|
88
|
+
})
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
it('clearSessionState removes the file when no recovery material is stored', async () => {
|
|
92
|
+
const dir = await makeTempDir()
|
|
93
|
+
const manager = new CredentialManager(dir)
|
|
94
|
+
|
|
95
|
+
await manager.setCredentials({
|
|
96
|
+
sessionCookie: 'session-value',
|
|
97
|
+
csrfToken: 'csrf-value',
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
await manager.clearSessionState()
|
|
101
|
+
|
|
102
|
+
await expect(manager.getCredentials()).resolves.toBeNull()
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
it('clearSessionState is a no-op when no credentials file exists', async () => {
|
|
106
|
+
const dir = await makeTempDir()
|
|
107
|
+
const manager = new CredentialManager(dir)
|
|
108
|
+
|
|
109
|
+
await expect(manager.clearSessionState()).resolves.toBeUndefined()
|
|
110
|
+
await expect(manager.getCredentials()).resolves.toBeNull()
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
it('preserves session credentials but drops the password when the encryption key is missing', async () => {
|
|
70
114
|
const dir = await makeTempDir()
|
|
71
115
|
const manager = new CredentialManager(dir)
|
|
72
116
|
|
|
@@ -76,6 +76,33 @@ export class CredentialManager {
|
|
|
76
76
|
await rm(this.encryptionKeyPath, { force: true })
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Wipe ephemeral session fields (sessionCookie, csrfToken, loggedInAt) while
|
|
81
|
+
* preserving long-term re-login material (username, password). Used when the
|
|
82
|
+
* server-side session expired but we still want automatic recovery on the
|
|
83
|
+
* next run via `recoverSession()`.
|
|
84
|
+
*
|
|
85
|
+
* No-op when no credentials file exists or no recovery material is stored.
|
|
86
|
+
*/
|
|
87
|
+
async clearSessionState(): Promise<void> {
|
|
88
|
+
const current = await this.getCredentials()
|
|
89
|
+
if (!current) {
|
|
90
|
+
return
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (!current.username && !current.password) {
|
|
94
|
+
await this.remove()
|
|
95
|
+
return
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
await this.setCredentials({
|
|
99
|
+
sessionCookie: '',
|
|
100
|
+
csrfToken: '',
|
|
101
|
+
username: current.username,
|
|
102
|
+
password: current.password,
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
|
|
79
106
|
private async hydrateCredentials(credentials: StoredCredentials): Promise<Credentials> {
|
|
80
107
|
if (!credentials.encryptedPassword) {
|
|
81
108
|
return credentials
|