dsh-jobs 0.1.0 → 0.1.2
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/client.js +212 -117
- package/icon.svg +20 -5
- package/index.js +1 -1
- package/lib/jobs-engine.cjs +202 -34
- package/lib/remote.js +49 -5
- package/lib/tools.js +40 -19
- package/package.json +2 -3
package/client.js
CHANGED
|
@@ -41,57 +41,100 @@ __export(index_exports, {
|
|
|
41
41
|
inject: () => inject
|
|
42
42
|
});
|
|
43
43
|
module.exports = __toCommonJS(index_exports);
|
|
44
|
-
var
|
|
44
|
+
var React3 = __toESM(require("react"), 1);
|
|
45
45
|
|
|
46
46
|
// src/client/styles.css
|
|
47
|
-
var styles_default = ".dsh-jobs-root {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 0;\n background: var(--dsw-alias-bg-base, #ffffff);\n color: var(--dsw-alias-label-primary, #111827);\n font-family: inherit;\n font-size: 13px;\n}\n\n.dsh-jobs-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n padding: 14px 20px;\n border-bottom: 1px solid var(--dsw-alias-border-l1, rgba(128, 128, 128, 0.18));\n flex-shrink: 0;\n}\n\n.dsh-jobs-title-group {\n display: flex;\n align-items: center;\n gap: 10px;\n}\n\n.dsh-jobs-title {\n font-size: 16px;\n font-weight: 600;\n margin: 0;\n}\n\n.dsh-jobs-subtitle {\n font-size: 12px;\n color: var(--dsw-alias-label-secondary, #6b7280);\n}\n\n.dsh-jobs-tabs {\n display: flex;\n gap: 6px;\n}\n\n.dsh-jobs-tab {\n padding: 6px 12px;\n border-radius: 8px;\n border: 1px solid transparent;\n background: transparent;\n color: var(--dsw-alias-label-secondary, #6b7280);\n cursor: pointer;\n font-size: 13px;\n font-weight: 500;\n}\n\n.dsh-jobs-tab:hover {\n background: var(--dsw-alias-bg-elevated, rgba(128, 128, 128, 0.08));\n color: var(--dsw-alias-label-primary, #111827);\n}\n\n.dsh-jobs-tab.is-active {\n background: var(--dsw-alias-brand-primary, #111827);\n color: var(--dsw-alias-label-primary-foreground, #ffffff);\n}\n\n.dsh-jobs-body {\n flex: 1;\n min-height: 0;\n overflow-y: auto;\n padding: 18px 20px 28px;\n display: flex;\n flex-direction: column;\n gap: 16px;\n}\n\n.dsh-jobs-card {\n border: 1px solid var(--dsw-alias-border-l1, rgba(128, 128, 128, 0.2));\n border-radius: 12px;\n padding: 14px 16px;\n background: var(--dsw-alias-bg-elevated, rgba(128, 128, 128, 0.04));\n}\n\n.dsh-jobs-row {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 10px;\n}\n\n.dsh-jobs-input {\n padding: 7px 10px;\n border-radius: 8px;\n border: 1px solid var(--dsw-alias-border-l2, rgba(128, 128, 128, 0.28));\n background: var(--dsw-alias-bg-base, #ffffff);\n color: var(--dsw-alias-label-primary, #111827);\n font-size: 13px;\n min-width: 140px;\n}\n\n.dsh-jobs-btn {\n padding: 7px 14px;\n border-radius: 8px;\n border: 1px solid var(--dsw-alias-border-l2, rgba(128, 128, 128, 0.28));\n background: var(--dsw-alias-bg-base, #ffffff);\n color: var(--dsw-alias-label-primary, #111827);\n cursor: pointer;\n font-size: 13px;\n font-weight: 500;\n}\n\n.dsh-jobs-btn:disabled {\n opacity: 0.55;\n cursor: not-allowed;\n}\n\n.dsh-jobs-btn.is-primary {\n background: var(--dsw-alias-brand-primary, #111827);\n color: var(--dsw-alias-label-primary-foreground, #ffffff);\n border-color: transparent;\n}\n\n.dsh-jobs-pill {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 3px 9px;\n border-radius: 999px;\n font-size: 12px;\n border: 1px solid var(--dsw-alias-border-l1, rgba(128, 128, 128, 0.22));\n}\n\n.dsh-jobs-pill.is-ok {\n color: var(--dsw-alias-state-success-primary, #15803d);\n border-color: var(--dsw-alias-state-success-primary, #15803d);\n}\n\n.dsh-jobs-pill.is-warn {\n color: var(--dsw-alias-state-warn-primary, #b45309);\n border-color: var(--dsw-alias-state-warn-primary, #b45309);\n}\n\n.dsh-jobs-pill.is-danger {\n color: var(--dsw-alias-state-danger-primary, #b91c1c);\n border-color: var(--dsw-alias-state-danger-primary, #b91c1c);\n}\n\n.dsh-jobs-list {\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n\n.dsh-jobs-item {\n border: 1px solid var(--dsw-alias-border-l1, rgba(128, 128, 128, 0.18));\n border-radius: 10px;\n padding: 12px 14px;\n background: var(--dsw-alias-bg-base, #ffffff);\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n gap: 12px;\n}\n\n.dsh-jobs-item-title {\n font-size: 14px;\n font-weight: 600;\n margin: 0 0 4px;\n}\n\n.dsh-jobs-item-meta {\n font-size: 12px;\n color: var(--dsw-alias-label-secondary, #6b7280);\n display: flex;\n flex-wrap: wrap;\n gap: 10px;\n}\n\n.dsh-jobs-salary {\n color: var(--dsw-alias-state-warn-primary, #b45309);\n font-weight: 600;\n}\n\n.dsh-jobs-detail-box {\n white-space: pre-wrap;\n line-height: 1.55;\n font-size: 13px;\n max-height: 300px;\n overflow-y: auto;\n margin-top: 10px;\n padding-top: 10px;\n border-top: 1px solid var(--dsw-alias-border-l1, rgba(128, 128, 128, 0.16));\n}\n\n.dsh-jobs-entry-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border: none;\n background: transparent;\n color: inherit;\n cursor: pointer;\n padding: 0;\n}\n";
|
|
47
|
+
var styles_default = "/**\n * dsh-jobs \u2014 native DSH Web UI styles.\n *\n * Strictly uses DSH host `--dsw-alias-*` design tokens so light/dark themes\n * match the shell seamlessly. Stays in normal flex flow (flex: 1; min-height: 0).\n */\n\n.dj-entrymark {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n line-height: 0;\n}\n\n.dsh-jobs-root {\n position: relative;\n flex: 1;\n min-width: 0;\n min-height: 0;\n height: 100%;\n display: flex;\n flex-direction: column;\n background: var(--dsw-alias-bg-base);\n color: var(--dsw-alias-label-primary);\n font-family: var(--dsw-font-family, inherit);\n font-size: 13px;\n -webkit-font-smoothing: antialiased;\n}\n\n/* \u2500\u2500 Topbar (44px, mirrors DSH shell chrome) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.dj-topbar {\n flex: none;\n height: 44px;\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 0 16px;\n border-bottom: 1px solid var(--dsw-alias-border-l1);\n background: var(--dsw-alias-bg-layer-1);\n}\n\n.dj-brand {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n font-size: 13.5px;\n font-weight: 600;\n letter-spacing: -0.01em;\n color: var(--dsw-alias-label-primary);\n flex: none;\n}\n\n.dj-brand-icon {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n border-radius: 6px;\n background: linear-gradient(135deg, #0f2034 0%, #0a1522 100%);\n color: #38bdf8;\n}\n\n.dj-seg {\n display: inline-flex;\n align-items: center;\n gap: 2px;\n padding: 2px;\n border-radius: 7px;\n background: var(--dsw-alias-bg-layer-2);\n border: 1px solid var(--dsw-alias-border-l1);\n}\n\n.dj-seg-btn {\n border: 0;\n background: transparent;\n color: var(--dsw-alias-label-secondary);\n padding: 4px 11px;\n border-radius: 5px;\n font: inherit;\n font-size: 12px;\n font-weight: 500;\n cursor: pointer;\n transition: background 120ms ease, color 120ms ease;\n}\n\n.dj-seg-btn:hover {\n color: var(--dsw-alias-label-primary);\n}\n\n.dj-seg-btn.is-active {\n background: var(--dsw-alias-bg-base);\n color: var(--dsw-alias-label-primary);\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);\n}\n\n.dj-spacer {\n flex: 1;\n}\n\n/* \u2500\u2500 Status pill & buttons \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.dj-status-btn {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n height: 28px;\n padding: 0 10px;\n border-radius: 999px;\n border: 1px solid var(--dsw-alias-border-l1);\n background: var(--dsw-alias-bg-layer-2);\n color: var(--dsw-alias-label-secondary);\n font: inherit;\n font-size: 12px;\n cursor: pointer;\n transition: border-color 120ms ease, color 120ms ease;\n}\n\n.dj-status-btn:hover {\n border-color: var(--dsw-alias-brand-primary);\n color: var(--dsw-alias-label-primary);\n}\n\n.dj-dot {\n width: 6px;\n height: 6px;\n border-radius: 50%;\n flex: none;\n background: var(--dsw-alias-label-tertiary, #9ca3af);\n}\n\n.dj-dot.is-ok { background: var(--dsw-alias-state-success-primary, #16a34a); }\n.dj-dot.is-warn { background: var(--dsw-alias-state-warn-primary, #d97706); }\n.dj-dot.is-err { background: var(--dsw-alias-state-error-primary, #dc2626); }\n\n.dj-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 5px;\n height: 30px;\n padding: 0 12px;\n border-radius: 7px;\n border: 1px solid var(--dsw-alias-border-l1);\n background: var(--dsw-alias-bg-layer-1);\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 12.5px;\n font-weight: 500;\n cursor: pointer;\n text-decoration: none;\n white-space: nowrap;\n transition: background 120ms ease, border-color 120ms ease;\n}\n\n.dj-btn:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover);\n border-color: var(--dsw-alias-border-l2);\n}\n\n.dj-btn:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.dj-btn.is-primary {\n background: var(--dsw-alias-brand-primary);\n color: var(--dsw-alias-label-primary-foreground);\n border-color: transparent;\n}\n\n.dj-btn.is-primary:hover:not(:disabled) {\n opacity: 0.9;\n}\n\n.dj-btn.is-sm {\n height: 24px;\n padding: 0 8px;\n font-size: 11.5px;\n border-radius: 5px;\n}\n\n.dj-btn.is-ghost {\n background: transparent;\n border-color: transparent;\n color: var(--dsw-alias-label-secondary);\n}\n\n.dj-btn.is-ghost:hover:not(:disabled) {\n background: var(--dsw-alias-interactive-bg-hover);\n color: var(--dsw-alias-label-primary);\n}\n\n/* \u2500\u2500 Compact search bar \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.dj-searchbar {\n flex: none;\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding: 10px 16px;\n border-bottom: 1px solid var(--dsw-alias-border-l1);\n background: var(--dsw-alias-bg-base);\n}\n\n.dj-search-row {\n display: flex;\n align-items: center;\n gap: 8px;\n flex-wrap: wrap;\n}\n\n.dj-input-group {\n display: inline-flex;\n align-items: center;\n flex: 1 1 240px;\n max-width: 440px;\n height: 32px;\n border-radius: 7px;\n border: 1px solid var(--dsw-alias-border-l1);\n background: var(--dsw-alias-bg-layer-1);\n overflow: hidden;\n}\n\n.dj-input-group:focus-within {\n border-color: var(--dsw-alias-brand-primary);\n}\n\n.dj-input {\n height: 100%;\n border: 0;\n outline: none;\n background: transparent;\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 13px;\n padding: 0 10px;\n min-width: 0;\n}\n\n.dj-input.is-kw {\n flex: 1;\n}\n\n.dj-input.is-city {\n width: 84px;\n border-left: 1px solid var(--dsw-alias-border-l1);\n text-align: center;\n}\n\n.dj-input-standalone {\n height: 28px;\n padding: 0 9px;\n border-radius: 6px;\n border: 1px solid var(--dsw-alias-border-l1);\n background: var(--dsw-alias-bg-layer-1);\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 12px;\n width: 120px;\n outline: none;\n}\n\n.dj-input-standalone:focus {\n border-color: var(--dsw-alias-brand-primary);\n}\n\n.dj-platforms {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n}\n\n.dj-chip {\n height: 26px;\n padding: 0 9px;\n border-radius: 6px;\n border: 1px solid var(--dsw-alias-border-l1);\n background: transparent;\n color: var(--dsw-alias-label-secondary);\n font: inherit;\n font-size: 11.5px;\n cursor: pointer;\n transition: all 120ms ease;\n}\n\n.dj-chip:hover {\n color: var(--dsw-alias-label-primary);\n border-color: var(--dsw-alias-border-l2);\n}\n\n.dj-chip.is-on {\n background: var(--dsw-alias-bg-layer-2);\n color: var(--dsw-alias-label-primary);\n border-color: var(--dsw-alias-border-l2);\n font-weight: 500;\n}\n\n/* \u2500\u2500 Coverage strip \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.dj-coverage {\n flex: none;\n display: flex;\n align-items: center;\n gap: 8px;\n flex-wrap: wrap;\n padding: 6px 16px;\n border-bottom: 1px solid var(--dsw-alias-border-l1);\n background: var(--dsw-alias-bg-layer-1);\n font-size: 12px;\n}\n\n.dj-cov-tag {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n padding: 2px 8px;\n border-radius: 999px;\n border: 1px solid var(--dsw-alias-border-l1);\n background: var(--dsw-alias-bg-base);\n color: var(--dsw-alias-label-secondary);\n font-size: 11.5px;\n}\n\n.dj-cov-action {\n border: 0;\n background: transparent;\n color: var(--dsw-alias-brand-primary);\n font: inherit;\n font-size: 11px;\n font-weight: 500;\n cursor: pointer;\n padding: 0 2px;\n text-decoration: underline;\n}\n\n/* \u2500\u2500 Banner / Toast \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.dj-banner {\n flex: none;\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 10px;\n padding: 7px 16px;\n font-size: 12px;\n border-bottom: 1px solid var(--dsw-alias-border-l1);\n background: var(--dsw-alias-bg-layer-2);\n color: var(--dsw-alias-label-primary);\n}\n\n.dj-banner.is-err {\n color: var(--dsw-alias-state-error-primary, #dc2626);\n}\n\n/* \u2500\u2500 Master-Detail split workspace \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.dj-split {\n flex: 1;\n min-height: 0;\n display: flex;\n}\n\n.dj-list-pane {\n width: 360px;\n min-width: 260px;\n max-width: 44%;\n flex: 0 0 auto;\n border-right: 1px solid var(--dsw-alias-border-l1);\n overflow-y: auto;\n background: var(--dsw-alias-bg-base);\n}\n\n.dj-job-row {\n padding: 11px 14px;\n border-bottom: 1px solid var(--dsw-alias-border-l1);\n border-left: 2px solid transparent;\n cursor: pointer;\n transition: background 100ms ease;\n}\n\n.dj-job-row:hover {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n.dj-job-row.is-selected {\n background: var(--dsw-alias-bg-layer-1);\n border-left-color: var(--dsw-alias-brand-primary);\n}\n\n.dj-job-head {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: 8px;\n margin-bottom: 4px;\n}\n\n.dj-job-title {\n font-size: 13px;\n font-weight: 600;\n color: var(--dsw-alias-label-primary);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.dj-job-salary {\n flex: none;\n font-size: 12.5px;\n font-weight: 600;\n font-variant-numeric: tabular-nums;\n color: var(--dsw-alias-state-warn-primary, #d97706);\n}\n\n.dj-job-sub {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 11.5px;\n color: var(--dsw-alias-label-secondary);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.dj-source-badge {\n flex: none;\n padding: 0 5px;\n border-radius: 4px;\n background: var(--dsw-alias-bg-layer-2);\n color: var(--dsw-alias-label-secondary);\n font-size: 10.5px;\n line-height: 18px;\n}\n\n/* \u2500\u2500 Detail pane \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.dj-detail-pane {\n flex: 1;\n min-width: 0;\n overflow-y: auto;\n padding: 20px 24px 32px;\n background: var(--dsw-alias-bg-base);\n}\n\n.dj-detail-head {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: 16px;\n padding-bottom: 14px;\n border-bottom: 1px solid var(--dsw-alias-border-l1);\n}\n\n.dj-detail-title {\n margin: 0 0 6px;\n font-size: 17px;\n font-weight: 650;\n letter-spacing: -0.01em;\n}\n\n.dj-detail-meta {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 10px;\n font-size: 12.5px;\n color: var(--dsw-alias-label-secondary);\n}\n\n.dj-detail-actions {\n display: flex;\n align-items: center;\n gap: 8px;\n flex: none;\n}\n\n.dj-jd-body {\n margin-top: 16px;\n white-space: pre-wrap;\n line-height: 1.65;\n font-size: 13px;\n color: var(--dsw-alias-label-primary);\n}\n\n/* \u2500\u2500 Single-column views (Watch / Applications) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.dj-scroll-pane {\n flex: 1;\n min-height: 0;\n overflow-y: auto;\n padding: 16px 20px 28px;\n}\n\n.dj-section-bar {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 10px;\n flex-wrap: wrap;\n margin-bottom: 12px;\n}\n\n.dj-table {\n width: 100%;\n border-collapse: collapse;\n font-size: 12.5px;\n}\n\n.dj-table th {\n text-align: left;\n padding: 8px 10px;\n font-size: 11.5px;\n font-weight: 500;\n color: var(--dsw-alias-label-secondary);\n border-bottom: 1px solid var(--dsw-alias-border-l1);\n}\n\n.dj-table td {\n padding: 10px 10px;\n border-bottom: 1px solid var(--dsw-alias-border-l1);\n vertical-align: middle;\n}\n\n.dj-table tr:hover td {\n background: var(--dsw-alias-interactive-bg-hover);\n}\n\n/* \u2500\u2500 Empty state \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.dj-empty {\n flex: 1;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 10px;\n padding: 40px 24px;\n text-align: center;\n color: var(--dsw-alias-label-secondary);\n}\n\n.dj-empty-title {\n font-size: 14px;\n font-weight: 600;\n color: var(--dsw-alias-label-primary);\n}\n\n.dj-empty-sub {\n font-size: 12.5px;\n max-width: 380px;\n line-height: 1.55;\n}\n\n.dj-quick-chips {\n display: flex;\n flex-wrap: wrap;\n justify-content: center;\n gap: 6px;\n margin-top: 4px;\n}\n\n/* \u2500\u2500 Browser / Login Modal \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.dj-modal-mask {\n position: fixed;\n inset: 0;\n z-index: 9999;\n background: rgba(0, 0, 0, 0.42);\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 20px;\n}\n\n.dj-modal {\n width: min(480px, 100%);\n border-radius: 12px;\n border: 1px solid var(--dsw-alias-border-l1);\n background: var(--dsw-alias-bg-base);\n color: var(--dsw-alias-label-primary);\n box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);\n overflow: hidden;\n}\n\n.dj-modal-head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 12px 16px;\n border-bottom: 1px solid var(--dsw-alias-border-l1);\n background: var(--dsw-alias-bg-layer-1);\n font-weight: 600;\n font-size: 13.5px;\n}\n\n.dj-modal-body {\n padding: 14px 16px 16px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n\n.dj-platform-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 10px;\n padding: 8px 10px;\n border-radius: 8px;\n border: 1px solid var(--dsw-alias-border-l1);\n background: var(--dsw-alias-bg-layer-1);\n}\n";
|
|
48
48
|
|
|
49
49
|
// src/client/app.tsx
|
|
50
|
+
var React2 = __toESM(require("react"), 1);
|
|
51
|
+
|
|
52
|
+
// src/client/brand-mark.tsx
|
|
50
53
|
var React = __toESM(require("react"), 1);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
function JobsMark({ size = 18 }) {
|
|
55
|
+
return /* @__PURE__ */ React.createElement(
|
|
56
|
+
"svg",
|
|
57
|
+
{
|
|
58
|
+
width: size,
|
|
59
|
+
height: size,
|
|
60
|
+
viewBox: "0 0 24 24",
|
|
61
|
+
fill: "none",
|
|
62
|
+
stroke: "currentColor",
|
|
63
|
+
strokeWidth: "1.75",
|
|
64
|
+
strokeLinecap: "round",
|
|
65
|
+
strokeLinejoin: "round",
|
|
66
|
+
"aria-hidden": "true"
|
|
67
|
+
},
|
|
68
|
+
/* @__PURE__ */ React.createElement("circle", { cx: "12", cy: "12", r: "8.5" }),
|
|
69
|
+
/* @__PURE__ */ React.createElement("polygon", { points: "15.8 8.2 13.4 13.4 8.2 15.8 10.6 10.6 15.8 8.2", fill: "currentColor", stroke: "none" }),
|
|
70
|
+
/* @__PURE__ */ React.createElement("circle", { cx: "12", cy: "12", r: "1.1", fill: "var(--dsw-alias-bg-base, #ffffff)", stroke: "none" })
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
function PanelEntry(props) {
|
|
74
|
+
return /* @__PURE__ */ React.createElement("span", { className: "dj-entrymark" }, /* @__PURE__ */ React.createElement(JobsMark, { size: props?.size ?? 18 }));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// src/client/app.tsx
|
|
78
|
+
var PLATFORMS = [
|
|
79
|
+
{ id: "zhipin", short: "BOSS", label: "BOSS \u76F4\u8058" },
|
|
80
|
+
{ id: "liepin", short: "\u730E\u8058", label: "\u730E\u8058" },
|
|
81
|
+
{ id: "51job", short: "51job", label: "\u524D\u7A0B\u65E0\u5FE7" },
|
|
82
|
+
{ id: "zhaopin", short: "\u667A\u8054", label: "\u667A\u8054\u62DB\u8058" }
|
|
83
|
+
];
|
|
84
|
+
var QUICK_SEARCHES = [
|
|
85
|
+
{ keyword: "FDE", city: "\u5317\u4EAC" },
|
|
86
|
+
{ keyword: "AI Agent \u5DE5\u7A0B\u5E08", city: "\u4E0A\u6D77" },
|
|
87
|
+
{ keyword: "\u524D\u7AEF\u67B6\u6784\u5E08", city: "\u676D\u5DDE" },
|
|
88
|
+
{ keyword: "\u4EA7\u54C1\u7ECF\u7406 AI", city: "\u6DF1\u5733" }
|
|
56
89
|
];
|
|
57
|
-
function
|
|
58
|
-
|
|
90
|
+
function platformShort(id) {
|
|
91
|
+
return PLATFORMS.find((p) => p.id === id)?.short ?? id;
|
|
92
|
+
}
|
|
93
|
+
function sourceStatusInfo(src) {
|
|
94
|
+
const st = String(src?.status ?? "unknown");
|
|
59
95
|
if (st === "ok") {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
tone: "ok"
|
|
63
|
-
};
|
|
96
|
+
const tag = src?.coverage === "rendered_dom" ? "DOM " : "";
|
|
97
|
+
return { text: `${tag}${src.count ?? 0}`, tone: "ok" };
|
|
64
98
|
}
|
|
65
|
-
if (st === "empty") return {
|
|
99
|
+
if (st === "empty") return { text: "0", tone: "ok" };
|
|
100
|
+
if (st === "login_required") return { text: "\u9700\u767B\u5F55", tone: "err", actionKind: "login" };
|
|
101
|
+
if (st === "access_restricted") return { text: "\u9700\u9A8C\u8BC1", tone: "warn", actionKind: "verify" };
|
|
66
102
|
if (st === "capture_timeout" || st === "capture_failed" || st === "parse_empty") {
|
|
67
|
-
return {
|
|
103
|
+
return { text: st === "capture_timeout" ? "\u6293\u5305\u8D85\u65F6" : "\u672A\u6355\u83B7", tone: "warn", actionKind: "retry" };
|
|
68
104
|
}
|
|
69
|
-
if (st === "
|
|
70
|
-
|
|
71
|
-
if (st === "rate_limited") return { label: "\u89E6\u53D1\u9891\u63A7", tone: "warn" };
|
|
72
|
-
return { label: st, tone: "warn" };
|
|
105
|
+
if (st === "rate_limited") return { text: "\u9891\u63A7", tone: "warn", actionKind: "retry" };
|
|
106
|
+
return { text: st, tone: "warn", actionKind: "retry" };
|
|
73
107
|
}
|
|
74
108
|
function JobsApp({ callRpc }) {
|
|
75
|
-
const [tab, setTab] =
|
|
76
|
-
const [keyword, setKeyword] =
|
|
77
|
-
const [city, setCity] =
|
|
78
|
-
const [salary, setSalary] =
|
|
79
|
-
const [workYear, setWorkYear] =
|
|
80
|
-
const [
|
|
81
|
-
const [
|
|
82
|
-
const [
|
|
83
|
-
const [
|
|
84
|
-
const [
|
|
85
|
-
const [
|
|
86
|
-
const [
|
|
87
|
-
const [
|
|
88
|
-
const [
|
|
89
|
-
const [
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
109
|
+
const [tab, setTab] = React2.useState("search");
|
|
110
|
+
const [keyword, setKeyword] = React2.useState("");
|
|
111
|
+
const [city, setCity] = React2.useState("\u5317\u4EAC");
|
|
112
|
+
const [salary, setSalary] = React2.useState("");
|
|
113
|
+
const [workYear, setWorkYear] = React2.useState("");
|
|
114
|
+
const [showFilters, setShowFilters] = React2.useState(false);
|
|
115
|
+
const [selectedPlatforms, setSelectedPlatforms] = React2.useState(["zhipin", "liepin", "51job", "zhaopin"]);
|
|
116
|
+
const [loading, setLoading] = React2.useState(false);
|
|
117
|
+
const [detailLoading, setDetailLoading] = React2.useState(false);
|
|
118
|
+
const [error, setError] = React2.useState(null);
|
|
119
|
+
const [notice, setNotice] = React2.useState(null);
|
|
120
|
+
const [searchRes, setSearchRes] = React2.useState(null);
|
|
121
|
+
const [selectedUrl, setSelectedUrl] = React2.useState(null);
|
|
122
|
+
const [detailCache, setDetailCache] = React2.useState({});
|
|
123
|
+
const [watchRes, setWatchRes] = React2.useState(null);
|
|
124
|
+
const [appPlatform, setAppPlatform] = React2.useState("zhipin");
|
|
125
|
+
const [appsRes, setAppsRes] = React2.useState(null);
|
|
126
|
+
const [profileRes, setProfileRes] = React2.useState(null);
|
|
127
|
+
const [showBrowserModal, setShowBrowserModal] = React2.useState(false);
|
|
128
|
+
const refreshProfile = React2.useCallback(async () => {
|
|
129
|
+
try {
|
|
130
|
+
const res = await callRpc("profileStatus", {});
|
|
131
|
+
setProfileRes(res);
|
|
132
|
+
} catch {
|
|
133
|
+
}
|
|
134
|
+
}, [callRpc]);
|
|
135
|
+
React2.useEffect(() => {
|
|
136
|
+
void refreshProfile();
|
|
137
|
+
}, [refreshProfile]);
|
|
95
138
|
const runAction = async (fn) => {
|
|
96
139
|
setLoading(true);
|
|
97
140
|
setError(null);
|
|
@@ -104,19 +147,62 @@ function JobsApp({ callRpc }) {
|
|
|
104
147
|
setLoading(false);
|
|
105
148
|
}
|
|
106
149
|
};
|
|
107
|
-
const
|
|
150
|
+
const executeSearch = (override) => runAction(async () => {
|
|
151
|
+
const kw = (override?.keyword ?? keyword).trim();
|
|
152
|
+
const c = (override?.city ?? city).trim();
|
|
153
|
+
const plats = override?.platforms ?? selectedPlatforms;
|
|
154
|
+
if (!kw) return;
|
|
155
|
+
if (override?.keyword !== void 0) setKeyword(override.keyword);
|
|
156
|
+
if (override?.city !== void 0) setCity(override.city);
|
|
108
157
|
const res = await callRpc("search", {
|
|
109
|
-
keyword:
|
|
110
|
-
city:
|
|
111
|
-
platforms:
|
|
158
|
+
keyword: kw,
|
|
159
|
+
city: c || void 0,
|
|
160
|
+
platforms: plats,
|
|
112
161
|
...salary.trim() ? { salary: salary.trim() } : {},
|
|
113
162
|
...workYear.trim() ? { workYear: workYear.trim() } : {}
|
|
114
163
|
});
|
|
115
|
-
setSearchRes(
|
|
164
|
+
setSearchRes((prev) => {
|
|
165
|
+
if (override?.platforms && prev?.jobs) {
|
|
166
|
+
const replaced = new Set(override.platforms);
|
|
167
|
+
const keptJobs = (prev.jobs ?? []).filter((j) => !replaced.has(j.source));
|
|
168
|
+
const keptSources = (prev.sources ?? []).filter((s) => !replaced.has(s.source));
|
|
169
|
+
return {
|
|
170
|
+
...res,
|
|
171
|
+
jobs: [...res.jobs ?? [], ...keptJobs],
|
|
172
|
+
sources: [...keptSources, ...res.sources ?? []]
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
return res;
|
|
176
|
+
});
|
|
177
|
+
if (res?.jobs?.length) setSelectedUrl(res.jobs[0].jobDetail);
|
|
178
|
+
void refreshProfile();
|
|
179
|
+
});
|
|
180
|
+
const handleReadDetail = async (url) => {
|
|
181
|
+
setDetailLoading(true);
|
|
182
|
+
setError(null);
|
|
183
|
+
try {
|
|
184
|
+
const res = await callRpc("detail", { url });
|
|
185
|
+
setDetailCache((prev) => ({ ...prev, [url]: res }));
|
|
186
|
+
} catch (err) {
|
|
187
|
+
setError(String(err?.message ?? err));
|
|
188
|
+
} finally {
|
|
189
|
+
setDetailLoading(false);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
const handlePrepareApply = (job) => runAction(async () => {
|
|
193
|
+
const res = await callRpc("prepareApply", {
|
|
194
|
+
platform: job.source,
|
|
195
|
+
url: job.jobDetail,
|
|
196
|
+
title: job.title,
|
|
197
|
+
company: job.company
|
|
198
|
+
});
|
|
199
|
+
setNotice(res?.application?.status === "already_tracked" ? "\u8BE5\u5C97\u4F4D\u5DF2\u5728\u6295\u9012\u5217\u8868\u4E2D" : `\u5DF2\u52A0\u5165\u5F85\u6295\uFF1A${job.title}`);
|
|
116
200
|
});
|
|
117
201
|
const handleWatchCheck = () => runAction(async () => {
|
|
202
|
+
const kw = keyword.trim() || "FDE";
|
|
203
|
+
if (!keyword.trim()) setKeyword(kw);
|
|
118
204
|
const res = await callRpc("watchCheck", {
|
|
119
|
-
keyword:
|
|
205
|
+
keyword: kw,
|
|
120
206
|
city: city.trim() || void 0,
|
|
121
207
|
platforms: selectedPlatforms
|
|
122
208
|
});
|
|
@@ -127,50 +213,90 @@ function JobsApp({ callRpc }) {
|
|
|
127
213
|
const res = await callRpc("applications", { platform });
|
|
128
214
|
setAppsRes(res);
|
|
129
215
|
});
|
|
130
|
-
const handleLoadProfile = () => runAction(async () => {
|
|
131
|
-
const res = await callRpc("profileStatus", {});
|
|
132
|
-
setProfileRes(res);
|
|
133
|
-
});
|
|
134
|
-
const handlePrepareApply = (job) => runAction(async () => {
|
|
135
|
-
const res = await callRpc("prepareApply", {
|
|
136
|
-
platform: job.source,
|
|
137
|
-
url: job.jobDetail,
|
|
138
|
-
title: job.title,
|
|
139
|
-
company: job.company
|
|
140
|
-
});
|
|
141
|
-
setNotice(res?.application?.status === "already_tracked" ? "\u8BE5\u5C97\u4F4D\u5DF2\u5728\u672C\u5730\u8FFD\u8E2A\u5217\u8868\u4E2D" : `\u5DF2\u5EFA\u6863\u5F85\u6295\uFF1A${job.title}`);
|
|
142
|
-
});
|
|
143
|
-
const handleReadDetail = (url) => runAction(async () => {
|
|
144
|
-
const res = await callRpc("detail", { url });
|
|
145
|
-
setDetailRes({ url, data: res });
|
|
146
|
-
});
|
|
147
216
|
const handleLoginPlatform = (platform) => runAction(async () => {
|
|
148
217
|
const res = await callRpc("login", { platform, waitSeconds: 60 });
|
|
149
|
-
setNotice(`${platform}
|
|
150
|
-
|
|
151
|
-
setProfileRes(refreshed);
|
|
218
|
+
setNotice(`${platformShort(platform)}\uFF1A${res?.detail || res?.status || "\u5DF2\u5B8C\u6210"}`);
|
|
219
|
+
await refreshProfile();
|
|
152
220
|
});
|
|
153
221
|
const handleOpenBrowser = (platform, url) => runAction(async () => {
|
|
154
222
|
const res = await callRpc("openBrowser", { ...platform ? { platform } : {}, ...url ? { url } : {} });
|
|
155
|
-
setNotice(res?.detail || res?.status || "\u5DF2\
|
|
156
|
-
|
|
157
|
-
setProfileRes(refreshed);
|
|
223
|
+
setNotice(res?.detail || res?.status || "\u5DF2\u6253\u5F00\u6301\u4E45\u5316\u6D4F\u89C8\u5668");
|
|
224
|
+
await refreshProfile();
|
|
158
225
|
});
|
|
159
|
-
|
|
160
|
-
if (tab === "browser" && !profileRes) void handleLoadProfile();
|
|
226
|
+
React2.useEffect(() => {
|
|
161
227
|
if (tab === "applications" && !appsRes) void handleLoadApps(appPlatform);
|
|
162
228
|
}, [tab]);
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
229
|
+
const jobs = searchRes?.jobs ?? [];
|
|
230
|
+
const selectedJob = jobs.find((j) => j.jobDetail === selectedUrl) ?? jobs[0] ?? null;
|
|
231
|
+
const activeDetail = selectedJob ? detailCache[selectedJob.jobDetail] : null;
|
|
232
|
+
const browserConnected = Boolean(profileRes?.managedChromeRunning ?? searchRes?.browserConnected);
|
|
233
|
+
const togglePlatform = (p) => {
|
|
234
|
+
setSelectedPlatforms(
|
|
235
|
+
(prev) => prev.includes(p) ? prev.length > 1 ? prev.filter((x) => x !== p) : prev : [...prev, p]
|
|
236
|
+
);
|
|
237
|
+
};
|
|
238
|
+
return /* @__PURE__ */ React2.createElement("div", { className: "dsh-jobs-root" }, /* @__PURE__ */ React2.createElement("div", { className: "dj-topbar" }, /* @__PURE__ */ React2.createElement("div", { className: "dj-brand" }, /* @__PURE__ */ React2.createElement("span", { className: "dj-brand-icon" }, /* @__PURE__ */ React2.createElement(JobsMark, { size: 15 })), /* @__PURE__ */ React2.createElement("span", null, "\u627E\u5DE5\u4F5C")), /* @__PURE__ */ React2.createElement("div", { className: "dj-seg", role: "tablist" }, /* @__PURE__ */ React2.createElement("button", { className: `dj-seg-btn ${tab === "search" ? "is-active" : ""}`, onClick: () => setTab("search") }, "\u641C\u804C\u4F4D"), /* @__PURE__ */ React2.createElement("button", { className: `dj-seg-btn ${tab === "watch" ? "is-active" : ""}`, onClick: () => setTab("watch") }, "\u65B0\u5C97\u5DE1\u68C0"), /* @__PURE__ */ React2.createElement("button", { className: `dj-seg-btn ${tab === "applications" ? "is-active" : ""}`, onClick: () => setTab("applications") }, "\u6295\u9012\u8FFD\u8E2A")), /* @__PURE__ */ React2.createElement("div", { className: "dj-spacer" }), /* @__PURE__ */ React2.createElement("button", { className: "dj-status-btn", onClick: () => {
|
|
239
|
+
setShowBrowserModal(true);
|
|
240
|
+
void refreshProfile();
|
|
241
|
+
}, title: "\u67E5\u770B\u672C\u673A\u6D4F\u89C8\u5668\u8FDE\u63A5\u4E0E\u56DB\u7AD9\u767B\u5F55\u72B6\u6001" }, /* @__PURE__ */ React2.createElement("span", { className: `dj-dot ${browserConnected ? "is-ok" : "is-warn"}` }), /* @__PURE__ */ React2.createElement("span", null, browserConnected ? "\u6D4F\u89C8\u5668\u5DF2\u8FDE\u63A5" : "\u672A\u8FDE\u6D4F\u89C8\u5668"))), error && /* @__PURE__ */ React2.createElement("div", { className: "dj-banner is-err" }, /* @__PURE__ */ React2.createElement("span", null, error), /* @__PURE__ */ React2.createElement("button", { className: "dj-btn is-sm is-ghost", onClick: () => setError(null) }, "\u5173\u95ED")), notice && /* @__PURE__ */ React2.createElement("div", { className: "dj-banner" }, /* @__PURE__ */ React2.createElement("span", null, notice), /* @__PURE__ */ React2.createElement("button", { className: "dj-btn is-sm is-ghost", onClick: () => setNotice(null) }, "\u5173\u95ED")), tab === "search" && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("div", { className: "dj-searchbar" }, /* @__PURE__ */ React2.createElement("div", { className: "dj-search-row" }, /* @__PURE__ */ React2.createElement("div", { className: "dj-input-group" }, /* @__PURE__ */ React2.createElement(
|
|
242
|
+
"input",
|
|
243
|
+
{
|
|
244
|
+
className: "dj-input is-kw",
|
|
245
|
+
value: keyword,
|
|
246
|
+
onChange: (e) => setKeyword(e.target.value),
|
|
247
|
+
onKeyDown: (e) => {
|
|
248
|
+
if (e.key === "Enter" && keyword.trim() && !loading) void executeSearch();
|
|
249
|
+
},
|
|
250
|
+
placeholder: "\u8F93\u5165\u804C\u4F4D\u5173\u952E\u8BCD\uFF0C\u56DE\u8F66\u641C\u7D22\u2026"
|
|
251
|
+
}
|
|
252
|
+
), /* @__PURE__ */ React2.createElement(
|
|
253
|
+
"input",
|
|
254
|
+
{
|
|
255
|
+
className: "dj-input is-city",
|
|
256
|
+
value: city,
|
|
257
|
+
onChange: (e) => setCity(e.target.value),
|
|
258
|
+
onKeyDown: (e) => {
|
|
259
|
+
if (e.key === "Enter" && keyword.trim() && !loading) void executeSearch();
|
|
260
|
+
},
|
|
261
|
+
placeholder: "\u57CE\u5E02"
|
|
262
|
+
}
|
|
263
|
+
)), /* @__PURE__ */ React2.createElement("div", { className: "dj-platforms" }, PLATFORMS.map((p) => /* @__PURE__ */ React2.createElement(
|
|
264
|
+
"button",
|
|
265
|
+
{
|
|
266
|
+
key: p.id,
|
|
267
|
+
type: "button",
|
|
268
|
+
className: `dj-chip ${selectedPlatforms.includes(p.id) ? "is-on" : ""}`,
|
|
269
|
+
onClick: () => togglePlatform(p.id)
|
|
270
|
+
},
|
|
271
|
+
p.short
|
|
272
|
+
))), /* @__PURE__ */ React2.createElement("button", { className: "dj-btn is-ghost", onClick: () => setShowFilters((v) => !v) }, showFilters ? "\u6536\u8D77\u7B5B\u9009" : "\u7B5B\u9009"), /* @__PURE__ */ React2.createElement("button", { className: "dj-btn is-primary", disabled: loading || !keyword.trim(), onClick: () => void executeSearch() }, loading ? "\u68C0\u7D22\u4E2D\u2026" : "\u641C\u7D22")), showFilters && /* @__PURE__ */ React2.createElement("div", { className: "dj-search-row" }, /* @__PURE__ */ React2.createElement("input", { className: "dj-input-standalone", value: salary, onChange: (e) => setSalary(e.target.value), placeholder: "\u85AA\u8D44 \u5982 30-50K" }), /* @__PURE__ */ React2.createElement("input", { className: "dj-input-standalone", value: workYear, onChange: (e) => setWorkYear(e.target.value), placeholder: "\u7ECF\u9A8C \u5982 5-10\u5E74" }))), searchRes && /* @__PURE__ */ React2.createElement("div", { className: "dj-coverage" }, /* @__PURE__ */ React2.createElement("span", { style: { fontWeight: 600 } }, searchRes.coverageSummary?.status === "full" ? "\u5B8C\u6574\u8986\u76D6" : searchRes.coverageSummary?.status === "partial" ? "\u90E8\u5206\u8986\u76D6" : "\u672A\u8986\u76D6", " \xB7 ", jobs.length, " \u6761"), (searchRes.sources ?? []).map((src) => {
|
|
273
|
+
const info = sourceStatusInfo(src);
|
|
274
|
+
const diagTip = src.diagnostics ? `\u8017\u65F6 ${src.diagnostics.waitMs ?? 0}ms \xB7 \u5339\u914D ${src.diagnostics.matchedRequestCount ?? 0} \xB7 ${src.diagnostics.reason ?? ""}` : src.action;
|
|
275
|
+
return /* @__PURE__ */ React2.createElement("span", { key: src.source, className: "dj-cov-tag", title: diagTip }, /* @__PURE__ */ React2.createElement("span", { className: `dj-dot is-${info.tone}` }), /* @__PURE__ */ React2.createElement("span", null, platformShort(src.source), " ", info.text), info.actionKind === "login" && /* @__PURE__ */ React2.createElement("button", { className: "dj-cov-action", onClick: () => void handleLoginPlatform(src.source) }, "\u53BB\u767B\u5F55"), info.actionKind === "verify" && /* @__PURE__ */ React2.createElement("button", { className: "dj-cov-action", onClick: () => void handleOpenBrowser(src.source, src.openUrl) }, "\u53BB\u9A8C\u8BC1"), info.actionKind === "retry" && /* @__PURE__ */ React2.createElement("button", { className: "dj-cov-action", onClick: () => void executeSearch({ platforms: [src.source] }) }, "\u91CD\u8BD5"));
|
|
276
|
+
})), jobs.length === 0 ? /* @__PURE__ */ React2.createElement("div", { className: "dj-empty" }, /* @__PURE__ */ React2.createElement("div", { className: "dj-brand-icon", style: { width: 38, height: 38, borderRadius: 10 } }, /* @__PURE__ */ React2.createElement(JobsMark, { size: 22 })), /* @__PURE__ */ React2.createElement("div", { className: "dj-empty-title" }, searchRes ? "\u672C\u6B21\u672A\u627E\u5230\u5339\u914D\u804C\u4F4D" : "\u5168\u7F51\u5B9E\u65F6\u641C\u5C97"), /* @__PURE__ */ React2.createElement("div", { className: "dj-empty-sub" }, searchRes ? "\u53EF\u68C0\u67E5\u4E0A\u65B9\u5404\u5E73\u53F0\u8986\u76D6\u72B6\u6001\uFF0C\u70B9\u51FB\u300C\u91CD\u8BD5\u300D\u6216\u300C\u53BB\u767B\u5F55\u300D\u8865\u9F50\u7F3A\u5931\u6765\u6E90\u3002" : "\u590D\u7528\u672C\u673A\u771F\u5B9E\u6D4F\u89C8\u5668\u88F8 CDP \u76F4\u8FDE BOSS\u3001\u730E\u8058\u300151job\u3001\u667A\u8054\uFF0C\u652F\u6301\u5DF2\u6E32\u67D3 DOM \u964D\u7EA7\u4E0E\u6295\u9012\u8FFD\u8E2A\u3002"), !searchRes && /* @__PURE__ */ React2.createElement("div", { className: "dj-quick-chips" }, QUICK_SEARCHES.map((q) => /* @__PURE__ */ React2.createElement("button", { key: q.keyword, className: "dj-chip", onClick: () => void executeSearch(q) }, q.city, " \xB7 ", q.keyword)))) : /* @__PURE__ */ React2.createElement("div", { className: "dj-split" }, /* @__PURE__ */ React2.createElement("div", { className: "dj-list-pane" }, jobs.map((job) => {
|
|
277
|
+
const isSel = selectedJob?.jobDetail === job.jobDetail;
|
|
278
|
+
return /* @__PURE__ */ React2.createElement(
|
|
279
|
+
"div",
|
|
280
|
+
{
|
|
281
|
+
key: job.jobDetail,
|
|
282
|
+
className: `dj-job-row ${isSel ? "is-selected" : ""}`,
|
|
283
|
+
onClick: () => setSelectedUrl(job.jobDetail)
|
|
284
|
+
},
|
|
285
|
+
/* @__PURE__ */ React2.createElement("div", { className: "dj-job-head" }, /* @__PURE__ */ React2.createElement("span", { className: "dj-job-title" }, job.title), job.salary && /* @__PURE__ */ React2.createElement("span", { className: "dj-job-salary" }, job.salary)),
|
|
286
|
+
/* @__PURE__ */ React2.createElement("div", { className: "dj-job-sub" }, /* @__PURE__ */ React2.createElement("span", { className: "dj-source-badge" }, platformShort(job.source)), job.company && /* @__PURE__ */ React2.createElement("span", null, job.company), job.address && /* @__PURE__ */ React2.createElement("span", null, "\xB7 ", job.address))
|
|
287
|
+
);
|
|
288
|
+
})), /* @__PURE__ */ React2.createElement("div", { className: "dj-detail-pane" }, selectedJob && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("div", { className: "dj-detail-head" }, /* @__PURE__ */ React2.createElement("div", null, /* @__PURE__ */ React2.createElement("h2", { className: "dj-detail-title" }, selectedJob.title), /* @__PURE__ */ React2.createElement("div", { className: "dj-detail-meta" }, /* @__PURE__ */ React2.createElement("span", { className: "dj-source-badge" }, platformShort(selectedJob.source)), selectedJob.salary && /* @__PURE__ */ React2.createElement("span", { className: "dj-job-salary" }, selectedJob.salary), selectedJob.company && /* @__PURE__ */ React2.createElement("span", null, selectedJob.company), selectedJob.address && /* @__PURE__ */ React2.createElement("span", null, selectedJob.address))), /* @__PURE__ */ React2.createElement("div", { className: "dj-detail-actions" }, /* @__PURE__ */ React2.createElement("button", { className: "dj-btn is-primary", disabled: detailLoading, onClick: () => void handleReadDetail(selectedJob.jobDetail) }, detailLoading ? "\u8BFB\u53D6\u4E2D\u2026" : activeDetail ? "\u5237\u65B0 JD" : "\u8BFB\u53D6\u5B8C\u6574 JD"), /* @__PURE__ */ React2.createElement("button", { className: "dj-btn", disabled: loading, onClick: () => void handlePrepareApply(selectedJob) }, "\u52A0\u5165\u5F85\u6295"), /* @__PURE__ */ React2.createElement("a", { className: "dj-btn", href: selectedJob.jobDetail, target: "_blank", rel: "noreferrer" }, "\u539F\u7AD9\u6253\u5F00 \u2197"))), activeDetail ? /* @__PURE__ */ React2.createElement("div", { className: "dj-jd-body" }, activeDetail.jobDescription || activeDetail.detail || JSON.stringify(activeDetail, null, 2)) : /* @__PURE__ */ React2.createElement("div", { className: "dj-empty", style: { paddingTop: 64 } }, /* @__PURE__ */ React2.createElement("div", { className: "dj-empty-sub" }, "\u70B9\u51FB\u53F3\u4E0A\u89D2\u300C\u8BFB\u53D6\u5B8C\u6574 JD\u300D\u901A\u8FC7\u771F\u5B9E\u6D4F\u89C8\u5668\u62C9\u53D6\u539F\u7AD9\u5C97\u4F4D\u8981\u6C42\uFF0C\u6216\u76F4\u63A5\u70B9\u51FB\u300C\u539F\u7AD9\u6253\u5F00\u300D\u67E5\u770B\u3002")))))), tab === "watch" && /* @__PURE__ */ React2.createElement("div", { className: "dj-scroll-pane" }, /* @__PURE__ */ React2.createElement("div", { className: "dj-section-bar" }, /* @__PURE__ */ React2.createElement("div", { className: "dj-input-group", style: { maxWidth: 360 } }, /* @__PURE__ */ React2.createElement("input", { className: "dj-input is-kw", value: keyword, onChange: (e) => setKeyword(e.target.value), placeholder: "\u5DE1\u68C0\u5173\u952E\u8BCD\uFF0C\u5982 FDE" }), /* @__PURE__ */ React2.createElement("input", { className: "dj-input is-city", value: city, onChange: (e) => setCity(e.target.value), placeholder: "\u57CE\u5E02" })), /* @__PURE__ */ React2.createElement("button", { className: "dj-btn is-primary", disabled: loading, onClick: () => void handleWatchCheck() }, loading ? "\u5DE1\u68C0\u4E2D\u2026" : "\u7ACB\u5373\u5DE1\u68C0\u65B0\u5C97\u4F4D")), watchRes ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("div", { className: "dj-coverage", style: { borderRadius: 8, border: "1px solid var(--dsw-alias-border-l1)", marginBottom: 14 } }, /* @__PURE__ */ React2.createElement("span", { style: { fontWeight: 600 } }, watchRes.baseline ? "\u9996\u6B21\u57FA\u7EBF\u5DF2\u5EFA\u7ACB" : `\u65B0\u589E ${watchRes.newCount ?? 0} \u6761`, " \xB7 ", watchRes.coverageSummary?.status === "full" ? "\u5B8C\u6574\u8986\u76D6" : watchRes.coverageSummary?.status === "partial" ? "\u90E8\u5206\u8986\u76D6" : "\u672A\u8986\u76D6"), (watchRes.sources ?? []).map((src) => {
|
|
289
|
+
const info = sourceStatusInfo(src);
|
|
290
|
+
return /* @__PURE__ */ React2.createElement("span", { key: src.source, className: "dj-cov-tag" }, /* @__PURE__ */ React2.createElement("span", { className: `dj-dot is-${info.tone}` }), /* @__PURE__ */ React2.createElement("span", null, platformShort(src.source), " ", info.text));
|
|
291
|
+
})), (watchRes.newJobs ?? []).length > 0 ? /* @__PURE__ */ React2.createElement("table", { className: "dj-table" }, /* @__PURE__ */ React2.createElement("thead", null, /* @__PURE__ */ React2.createElement("tr", null, /* @__PURE__ */ React2.createElement("th", null, "\u804C\u4F4D"), /* @__PURE__ */ React2.createElement("th", null, "\u516C\u53F8"), /* @__PURE__ */ React2.createElement("th", null, "\u85AA\u8D44"), /* @__PURE__ */ React2.createElement("th", null, "\u6765\u6E90"), /* @__PURE__ */ React2.createElement("th", { style: { textAlign: "right" } }, "\u64CD\u4F5C"))), /* @__PURE__ */ React2.createElement("tbody", null, (watchRes.newJobs ?? []).map((job) => /* @__PURE__ */ React2.createElement("tr", { key: job.jobDetail }, /* @__PURE__ */ React2.createElement("td", { style: { fontWeight: 600 } }, job.title), /* @__PURE__ */ React2.createElement("td", null, job.company || "\u2014"), /* @__PURE__ */ React2.createElement("td", { className: "dj-job-salary" }, job.salary || "\u2014"), /* @__PURE__ */ React2.createElement("td", null, /* @__PURE__ */ React2.createElement("span", { className: "dj-source-badge" }, platformShort(job.source))), /* @__PURE__ */ React2.createElement("td", { style: { textAlign: "right" } }, /* @__PURE__ */ React2.createElement("button", { className: "dj-btn is-sm", style: { marginRight: 6 }, onClick: () => void handlePrepareApply(job) }, "\u5F85\u6295"), /* @__PURE__ */ React2.createElement("a", { className: "dj-btn is-sm", href: job.jobDetail, target: "_blank", rel: "noreferrer" }, "\u539F\u7AD9 \u2197")))))) : /* @__PURE__ */ React2.createElement("div", { className: "dj-empty" }, /* @__PURE__ */ React2.createElement("div", { className: "dj-empty-sub" }, watchRes.coverageSummary?.status === "partial" ? `\u672C\u8F6E\u4EC5\u90E8\u5206\u8986\u76D6\uFF08\u672A\u8986\u76D6\uFF1A${(watchRes.coverageSummary?.uncoveredPlatforms ?? []).join(", ")}\uFF09\uFF0C\u5DF2\u8986\u76D6\u5E73\u53F0\u6682\u65E0\u65B0\u589E\u3002` : "\u5DF2\u8986\u76D6\u5E73\u53F0\u672C\u8F6E\u6682\u65E0\u65B0\u589E\u5C97\u4F4D\u3002"))) : /* @__PURE__ */ React2.createElement("div", { className: "dj-empty" }, /* @__PURE__ */ React2.createElement("div", { className: "dj-empty-title" }, "\u65B0\u5C97\u589E\u91CF\u5DE1\u68C0"), /* @__PURE__ */ React2.createElement("div", { className: "dj-empty-sub" }, "\u9996\u6B21\u8FD0\u884C\u5EFA\u7ACB\u57FA\u7EBF\uFF0C\u4E4B\u540E\u4EC5\u63D0\u9192\u65B0\u589E\u5C97\u4F4D\uFF0C\u5E76\u4E25\u683C\u6807\u6CE8\u300C\u5B8C\u6574\u8986\u76D6 / \u90E8\u5206\u8986\u76D6\u300D\uFF0C\u7EDD\u4E0D\u5C06\u6293\u5305\u5931\u8D25\u8BEF\u62A5\u4E3A\u65E0\u65B0\u589E\u3002"))), tab === "applications" && /* @__PURE__ */ React2.createElement("div", { className: "dj-scroll-pane" }, /* @__PURE__ */ React2.createElement("div", { className: "dj-section-bar" }, /* @__PURE__ */ React2.createElement("div", { className: "dj-platforms" }, PLATFORMS.map((p) => /* @__PURE__ */ React2.createElement("button", { key: p.id, className: `dj-chip ${appPlatform === p.id ? "is-on" : ""}`, onClick: () => void handleLoadApps(p.id) }, p.label))), /* @__PURE__ */ React2.createElement("button", { className: "dj-btn is-sm", disabled: loading, onClick: () => void handleLoadApps(appPlatform) }, "\u5237\u65B0")), (appsRes?.applications ?? []).length === 0 ? /* @__PURE__ */ React2.createElement("div", { className: "dj-empty" }, /* @__PURE__ */ React2.createElement("div", { className: "dj-empty-title" }, "\u6682\u65E0\u672C\u5730\u6295\u9012\u8BB0\u5F55"), /* @__PURE__ */ React2.createElement("div", { className: "dj-empty-sub" }, "\u5728\u300C\u641C\u804C\u4F4D\u300D\u9009\u4E2D\u610F\u5411\u5C97\u4F4D\u540E\u70B9\u51FB\u300C\u52A0\u5165\u5F85\u6295\u300D\uFF0C\u5373\u53EF\u5728\u6B64\u7EDF\u4E00\u8FFD\u8E2A\u3002")) : /* @__PURE__ */ React2.createElement("table", { className: "dj-table" }, /* @__PURE__ */ React2.createElement("thead", null, /* @__PURE__ */ React2.createElement("tr", null, /* @__PURE__ */ React2.createElement("th", null, "\u804C\u4F4D"), /* @__PURE__ */ React2.createElement("th", null, "\u516C\u53F8"), /* @__PURE__ */ React2.createElement("th", null, "\u72B6\u6001"), /* @__PURE__ */ React2.createElement("th", null, "\u66F4\u65B0\u65F6\u95F4"), /* @__PURE__ */ React2.createElement("th", { style: { textAlign: "right" } }, "\u539F\u7AD9"))), /* @__PURE__ */ React2.createElement("tbody", null, (appsRes.applications ?? []).map((app) => /* @__PURE__ */ React2.createElement("tr", { key: app.url }, /* @__PURE__ */ React2.createElement("td", { style: { fontWeight: 600 } }, app.title || app.url), /* @__PURE__ */ React2.createElement("td", null, app.company || "\u2014"), /* @__PURE__ */ React2.createElement("td", null, /* @__PURE__ */ React2.createElement("span", { className: "dj-source-badge" }, app.status)), /* @__PURE__ */ React2.createElement("td", { style: { color: "var(--dsw-alias-label-secondary)" } }, app.updatedAt ? String(app.updatedAt).slice(0, 16).replace("T", " ") : "\u2014"), /* @__PURE__ */ React2.createElement("td", { style: { textAlign: "right" } }, /* @__PURE__ */ React2.createElement("a", { className: "dj-btn is-sm", href: app.url, target: "_blank", rel: "noreferrer" }, "\u6253\u5F00 \u2197"))))))), showBrowserModal && /* @__PURE__ */ React2.createElement("div", { className: "dj-modal-mask", onClick: () => setShowBrowserModal(false) }, /* @__PURE__ */ React2.createElement("div", { className: "dj-modal", onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ React2.createElement("div", { className: "dj-modal-head" }, /* @__PURE__ */ React2.createElement("span", null, "\u6D4F\u89C8\u5668\u4E0E\u56DB\u7AD9\u767B\u5F55"), /* @__PURE__ */ React2.createElement("button", { className: "dj-btn is-sm is-ghost", onClick: () => setShowBrowserModal(false) }, "\u2715")), /* @__PURE__ */ React2.createElement("div", { className: "dj-modal-body" }, /* @__PURE__ */ React2.createElement("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8 } }, /* @__PURE__ */ React2.createElement("div", { style: { display: "flex", alignItems: "center", gap: 6 } }, /* @__PURE__ */ React2.createElement("span", { className: `dj-dot ${browserConnected ? "is-ok" : "is-warn"}` }), /* @__PURE__ */ React2.createElement("strong", null, browserConnected ? "\u5DF2\u8FDE\u63A5\u6301\u4E45\u5316\u6D4F\u89C8\u5668" : "\u5C1A\u672A\u8FDE\u63A5\u6D4F\u89C8\u5668")), /* @__PURE__ */ React2.createElement("div", { style: { display: "flex", gap: 6 } }, /* @__PURE__ */ React2.createElement("button", { className: "dj-btn is-sm is-primary", disabled: loading, onClick: () => void handleOpenBrowser() }, "\u6253\u5F00 / \u91CD\u5F00"), /* @__PURE__ */ React2.createElement("button", { className: "dj-btn is-sm", disabled: loading, onClick: () => runAction(async () => {
|
|
170
292
|
await callRpc("closeBrowser", {});
|
|
171
|
-
setNotice("\u5DF2\
|
|
172
|
-
await
|
|
173
|
-
}) }, "\
|
|
293
|
+
setNotice("\u5DF2\u4F18\u96C5\u5173\u95ED\u4E13\u7528\u6D4F\u89C8\u5668");
|
|
294
|
+
await refreshProfile();
|
|
295
|
+
}) }, "\u5173\u95ED"))), profileRes?.profileDir && /* @__PURE__ */ React2.createElement("div", { style: { fontSize: 11.5, color: "var(--dsw-alias-label-secondary)", wordBreak: "break-all" } }, "Profile\uFF1A", profileRes.profileDir, "\uFF08Cookie \u4EC5\u4E3A\u672C\u5730\u7EBF\u7D22\uFF0C\u7AD9\u70B9\u767B\u5F55\u6001\u4EE5\u9875\u9762\u6E32\u67D3\u4E3A\u51C6\uFF09"), /* @__PURE__ */ React2.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 6 } }, PLATFORMS.map((p) => {
|
|
296
|
+
const info = (profileRes?.platforms ?? []).find((x) => x.platform === p.id);
|
|
297
|
+
const hasCookie = info?.sessionEvidence === "credential_present" || info?.sessionEvidence === "valid";
|
|
298
|
+
return /* @__PURE__ */ React2.createElement("div", { key: p.id, className: "dj-platform-row" }, /* @__PURE__ */ React2.createElement("div", { style: { display: "flex", alignItems: "center", gap: 8 } }, /* @__PURE__ */ React2.createElement("span", { className: `dj-dot ${hasCookie ? "is-ok" : "is-warn"}` }), /* @__PURE__ */ React2.createElement("span", { style: { fontWeight: 500 } }, p.label), /* @__PURE__ */ React2.createElement("span", { style: { fontSize: 11.5, color: "var(--dsw-alias-label-secondary)" } }, info?.sessionEvidence ?? "\u672A\u68C0\u6D4B")), /* @__PURE__ */ React2.createElement("button", { className: "dj-btn is-sm", disabled: loading, onClick: () => void handleLoginPlatform(p.id) }, "\u767B\u5F55 / \u76D1\u542C"));
|
|
299
|
+
}))))));
|
|
174
300
|
}
|
|
175
301
|
|
|
176
302
|
// src/client/index.tsx
|
|
@@ -179,43 +305,12 @@ var inject = ["connection", "slots", "locale", "theme", "layout"];
|
|
|
179
305
|
function createRpcCaller(ctx) {
|
|
180
306
|
return async (method, payload) => {
|
|
181
307
|
const conn = ctx.get("connection");
|
|
182
|
-
if (!conn
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
if (typeof conn.rpc === "function") return conn.rpc(fullMethod, payload ?? {});
|
|
187
|
-
const remote = conn.remote?.jobs;
|
|
188
|
-
if (remote && typeof remote[method] === "function") return remote[method](payload ?? {});
|
|
189
|
-
throw new Error(`\u65E0\u6CD5\u8C03\u7528\u8FDC\u7AEF\u65B9\u6CD5 ${fullMethod}`);
|
|
308
|
+
if (!conn?.rpc || typeof conn.rpc.call !== "function") {
|
|
309
|
+
throw new Error("\u8FDE\u63A5\u670D\u52A1\u5C1A\u672A\u5C31\u7EEA");
|
|
310
|
+
}
|
|
311
|
+
return conn.rpc.call("/api", `jobsearch/${method}`, payload ?? {});
|
|
190
312
|
};
|
|
191
313
|
}
|
|
192
|
-
function PanelEntry(props) {
|
|
193
|
-
return React2.createElement(
|
|
194
|
-
"button",
|
|
195
|
-
{
|
|
196
|
-
type: "button",
|
|
197
|
-
className: "dsh-jobs-entry-btn",
|
|
198
|
-
title: "\u627E\u5DE5\u4F5C\u5DE5\u4F5C\u53F0 (dsh-jobs)",
|
|
199
|
-
onClick: props?.onClick
|
|
200
|
-
},
|
|
201
|
-
React2.createElement(
|
|
202
|
-
"svg",
|
|
203
|
-
{
|
|
204
|
-
width: 18,
|
|
205
|
-
height: 18,
|
|
206
|
-
viewBox: "0 0 24 24",
|
|
207
|
-
fill: "none",
|
|
208
|
-
stroke: "currentColor",
|
|
209
|
-
strokeWidth: 1.8,
|
|
210
|
-
strokeLinecap: "round",
|
|
211
|
-
strokeLinejoin: "round"
|
|
212
|
-
},
|
|
213
|
-
React2.createElement("rect", { x: 3, y: 7, width: 18, height: 13, rx: 2 }),
|
|
214
|
-
React2.createElement("path", { d: "M8 7V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }),
|
|
215
|
-
React2.createElement("path", { d: "M3 12h18" })
|
|
216
|
-
)
|
|
217
|
-
);
|
|
218
|
-
}
|
|
219
314
|
function apply(ctx) {
|
|
220
315
|
const callRpc = createRpcCaller(ctx);
|
|
221
316
|
ctx.effect(() => {
|
|
@@ -231,11 +326,11 @@ function apply(ctx) {
|
|
|
231
326
|
if (slots) {
|
|
232
327
|
ctx.effect(() => slots.inject("main", () => slots.register(
|
|
233
328
|
{ name: "main", key: NS, registrant: NS },
|
|
234
|
-
() =>
|
|
329
|
+
() => React3.createElement(JobsApp, { callRpc })
|
|
235
330
|
)), `${NS}: main panel`);
|
|
236
331
|
ctx.effect(() => slots.inject("sidebar.panellist", () => slots.register(
|
|
237
332
|
{ name: "sidebar.panellist", id: NS, order: 25, label: () => "\u627E\u5DE5\u4F5C", registrant: NS },
|
|
238
|
-
(props) =>
|
|
333
|
+
(props) => React3.createElement(PanelEntry, props)
|
|
239
334
|
)), `${NS}: panel entry`);
|
|
240
335
|
}
|
|
241
336
|
const layout = ctx.get("layout");
|
package/icon.svg
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0
|
|
2
|
-
<rect
|
|
3
|
-
<
|
|
4
|
-
<path d="
|
|
5
|
-
<path d="
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="none">
|
|
2
|
+
<rect width="64" height="64" rx="16" fill="url(#dj_bg)" />
|
|
3
|
+
<circle cx="32" cy="32" r="19" stroke="url(#dj_ring)" stroke-width="2.5" stroke-opacity="0.85" />
|
|
4
|
+
<path d="M32 10v5M32 49v5M10 32h5M49 32h5" stroke="#7DD3FC" stroke-width="2.2" stroke-linecap="round" stroke-opacity="0.6" />
|
|
5
|
+
<path d="M41.5 22.5L35.2 35.2L22.5 41.5L28.8 28.8L41.5 22.5Z" fill="url(#dj_needle)" />
|
|
6
|
+
<circle cx="32" cy="32" r="2.6" fill="#0B1929" />
|
|
7
|
+
<defs>
|
|
8
|
+
<linearGradient id="dj_bg" x1="0" y1="0" x2="64" y2="64" gradientUnits="userSpaceOnUse">
|
|
9
|
+
<stop stop-color="#0F2034" />
|
|
10
|
+
<stop offset="1" stop-color="#0A1522" />
|
|
11
|
+
</linearGradient>
|
|
12
|
+
<linearGradient id="dj_ring" x1="13" y1="13" x2="51" y2="51" gradientUnits="userSpaceOnUse">
|
|
13
|
+
<stop stop-color="#38BDF8" />
|
|
14
|
+
<stop offset="1" stop-color="#34D399" />
|
|
15
|
+
</linearGradient>
|
|
16
|
+
<linearGradient id="dj_needle" x1="22.5" y1="41.5" x2="41.5" y2="22.5" gradientUnits="userSpaceOnUse">
|
|
17
|
+
<stop stop-color="#34D399" />
|
|
18
|
+
<stop offset="1" stop-color="#38BDF8" />
|
|
19
|
+
</linearGradient>
|
|
20
|
+
</defs>
|
|
6
21
|
</svg>
|
package/index.js
CHANGED
|
@@ -64,7 +64,7 @@ export function apply(ctx, config = {}) {
|
|
|
64
64
|
const removeCmd = commands.register({
|
|
65
65
|
name: 'jobs',
|
|
66
66
|
description: '检查求职浏览器连接状态或快速搜岗:/jobs [status|doctor|<关键词>]',
|
|
67
|
-
async
|
|
67
|
+
async handler(invocation) {
|
|
68
68
|
const raw = String(invocation?.rawInput ?? '').trim()
|
|
69
69
|
if (!raw || raw === 'status') {
|
|
70
70
|
const st = await remote.profileStatus({})
|
package/lib/jobs-engine.cjs
CHANGED
|
@@ -918,10 +918,6 @@ async function rawCaptureJsonDetailed(cdpUrl, roleKey, targetUrl, responsePatter
|
|
|
918
918
|
});
|
|
919
919
|
});
|
|
920
920
|
}
|
|
921
|
-
async function rawCaptureJson(cdpUrl, roleKey, targetUrl, responsePattern, timeoutMs, signal, validate) {
|
|
922
|
-
const outcome = await rawCaptureJsonDetailed(cdpUrl, roleKey, targetUrl, responsePattern, timeoutMs, signal, validate);
|
|
923
|
-
return outcome.data;
|
|
924
|
-
}
|
|
925
921
|
async function rawCaptureDocument(cdpUrl, roleKey, targetUrl, timeoutMs, signal) {
|
|
926
922
|
if (signal?.aborted) return null;
|
|
927
923
|
const entry = await rawEnsurePage(cdpUrl, roleKey, targetUrl);
|
|
@@ -1415,17 +1411,18 @@ function harvestJobs(root3, platform, base) {
|
|
|
1415
1411
|
const plan = FIELD_PLANS[platform];
|
|
1416
1412
|
const jobs = [];
|
|
1417
1413
|
const seen = /* @__PURE__ */ new Set();
|
|
1418
|
-
const visit = (value, depth) => {
|
|
1414
|
+
const visit = (value, depth, inheritedCompany = "") => {
|
|
1419
1415
|
if (depth > 8 || !value) return;
|
|
1420
1416
|
if (Array.isArray(value)) {
|
|
1421
|
-
for (const entry of value) visit(entry, depth + 1);
|
|
1417
|
+
for (const entry of value) visit(entry, depth + 1, inheritedCompany);
|
|
1422
1418
|
return;
|
|
1423
1419
|
}
|
|
1424
1420
|
if (typeof value !== "object") return;
|
|
1425
1421
|
const item = value;
|
|
1422
|
+
const ownCompany = pickCompany(item, plan.company) || inheritedCompany;
|
|
1426
1423
|
const title = pickText(item, plan.title);
|
|
1427
1424
|
if (!title) {
|
|
1428
|
-
for (const child of Object.values(item)) visit(child, depth + 1);
|
|
1425
|
+
for (const child of Object.values(item)) visit(child, depth + 1, ownCompany);
|
|
1429
1426
|
return;
|
|
1430
1427
|
}
|
|
1431
1428
|
let link = pickText(item, plan.link);
|
|
@@ -1443,7 +1440,7 @@ function harvestJobs(root3, platform, base) {
|
|
|
1443
1440
|
jobs.push({
|
|
1444
1441
|
title,
|
|
1445
1442
|
jobDetail: link,
|
|
1446
|
-
company:
|
|
1443
|
+
company: ownCompany || void 0,
|
|
1447
1444
|
salary: pickText(item, plan.salary) || void 0,
|
|
1448
1445
|
address: pickText(item, plan.address) || void 0,
|
|
1449
1446
|
...item
|
|
@@ -15092,6 +15089,23 @@ function inspectRenderedDom(html3, platform, finalUrl) {
|
|
|
15092
15089
|
addJob({ title: a.text(), href: a.attr("href") });
|
|
15093
15090
|
});
|
|
15094
15091
|
}
|
|
15092
|
+
} else if (platform === "51job") {
|
|
15093
|
+
$2('.joblist-item, [class*="joblist-item"], [class*="job-card"]').each((_, el) => {
|
|
15094
|
+
const card = $2(el);
|
|
15095
|
+
const link = card.find('a[href*="jobs.51job.com/"], a[href*="we.51job.com/"]').first();
|
|
15096
|
+
const href = link.attr("href");
|
|
15097
|
+
const title = card.find('.jname, [class*="job-name"], [class*="jname"]').first().text() || link.text();
|
|
15098
|
+
const salary = card.find('.sal, [class*="salary"]').first().text();
|
|
15099
|
+
const company = card.find('.cname, [class*="comp-name"], [class*="company"]').first().text();
|
|
15100
|
+
const address = card.find('.area, [class*="area"]').first().text();
|
|
15101
|
+
addJob({ title, href, salary, company, address });
|
|
15102
|
+
});
|
|
15103
|
+
if (!seen.size) {
|
|
15104
|
+
$2('a[href*="jobs.51job.com/"]').each((_, el) => {
|
|
15105
|
+
const a = $2(el);
|
|
15106
|
+
addJob({ title: a.text(), href: a.attr("href") });
|
|
15107
|
+
});
|
|
15108
|
+
}
|
|
15095
15109
|
}
|
|
15096
15110
|
const jobs = [...seen.values()];
|
|
15097
15111
|
const accessRestricted = jobs.length === 0 && VERIFY_TEXT_PATTERN.test(`${pageTitle} ${bodyText}`);
|
|
@@ -15356,6 +15370,50 @@ async function snapshotProfile() {
|
|
|
15356
15370
|
// src/platforms/zhaopin.ts
|
|
15357
15371
|
var INITIAL_STATE_MARKER = "__INITIAL_STATE__=";
|
|
15358
15372
|
var ZHAOPIN_API_PATTERN = /(?:cgate[^/]*\/[^?#]*getKeyWordCompanySearch|fe-api[^/]*\/[^?#]*\/search\/(?:base\/data|positions|position)|sou\.zhaopin\.com\/api\/)/i;
|
|
15373
|
+
var ZHAOPIN_CITY_CODES = {
|
|
15374
|
+
"\u5168\u56FD": "489",
|
|
15375
|
+
"\u5317\u4EAC": "530",
|
|
15376
|
+
"\u5929\u6D25": "531",
|
|
15377
|
+
"\u4E0A\u6D77": "538",
|
|
15378
|
+
"\u91CD\u5E86": "551",
|
|
15379
|
+
"\u77F3\u5BB6\u5E84": "565",
|
|
15380
|
+
"\u592A\u539F": "576",
|
|
15381
|
+
"\u6C88\u9633": "599",
|
|
15382
|
+
"\u5927\u8FDE": "600",
|
|
15383
|
+
"\u957F\u6625": "613",
|
|
15384
|
+
"\u54C8\u5C14\u6EE8": "622",
|
|
15385
|
+
"\u5357\u4EAC": "635",
|
|
15386
|
+
"\u65E0\u9521": "636",
|
|
15387
|
+
"\u82CF\u5DDE": "639",
|
|
15388
|
+
"\u676D\u5DDE": "653",
|
|
15389
|
+
"\u5B81\u6CE2": "654",
|
|
15390
|
+
"\u5408\u80A5": "664",
|
|
15391
|
+
"\u798F\u5DDE": "681",
|
|
15392
|
+
"\u53A6\u95E8": "682",
|
|
15393
|
+
"\u5357\u660C": "691",
|
|
15394
|
+
"\u6D4E\u5357": "702",
|
|
15395
|
+
"\u9752\u5C9B": "703",
|
|
15396
|
+
"\u90D1\u5DDE": "719",
|
|
15397
|
+
"\u6B66\u6C49": "736",
|
|
15398
|
+
"\u957F\u6C99": "749",
|
|
15399
|
+
"\u5E7F\u5DDE": "763",
|
|
15400
|
+
"\u6DF1\u5733": "765",
|
|
15401
|
+
"\u73E0\u6D77": "766",
|
|
15402
|
+
"\u4F5B\u5C71": "768",
|
|
15403
|
+
"\u4E1C\u839E": "779",
|
|
15404
|
+
"\u5357\u5B81": "785",
|
|
15405
|
+
"\u6D77\u53E3": "799",
|
|
15406
|
+
"\u6210\u90FD": "801",
|
|
15407
|
+
"\u8D35\u9633": "822",
|
|
15408
|
+
"\u6606\u660E": "831",
|
|
15409
|
+
"\u897F\u5B89": "854",
|
|
15410
|
+
"\u5170\u5DDE": "864"
|
|
15411
|
+
};
|
|
15412
|
+
function resolveZhaopinCityCode(city) {
|
|
15413
|
+
if (!city) return void 0;
|
|
15414
|
+
const clean = city.trim().replace(/市$/, "");
|
|
15415
|
+
return ZHAOPIN_CITY_CODES[clean];
|
|
15416
|
+
}
|
|
15359
15417
|
function extractZhaopinState(html3) {
|
|
15360
15418
|
const start = html3.indexOf(INITIAL_STATE_MARKER);
|
|
15361
15419
|
if (start < 0) return null;
|
|
@@ -15373,7 +15431,9 @@ async function searchZhaopin(keyword, city, page, signal, timeoutMs = 22e3, filt
|
|
|
15373
15431
|
return { status: "login_required", jobs: [], note: "\u672A\u53D1\u73B0\u7528\u6237\u6D4F\u89C8\u5668\u8C03\u8BD5\u7AEF\u53E3\u3002\u8C03\u7528\u767B\u5F55\u6D41\u7A0B\u81EA\u52A8\u62C9\u8D77\u771F\u5B9E\u6D4F\u89C8\u5668\u5E76\u76D1\u542C\u667A\u8054\u767B\u5F55\u72B6\u6001" };
|
|
15374
15432
|
}
|
|
15375
15433
|
const query = new URLSearchParams({ kw: keyword });
|
|
15376
|
-
|
|
15434
|
+
const cityCode = resolveZhaopinCityCode(city);
|
|
15435
|
+
if (cityCode) query.set("jl", cityCode);
|
|
15436
|
+
else if (city) query.set("jl", city.replace(/市$/, ""));
|
|
15377
15437
|
if (page > 1) query.set("p", String(page));
|
|
15378
15438
|
const targetUrl = `https://www.zhaopin.com/jobs?${query.toString()}`;
|
|
15379
15439
|
const outcome = await rawCaptureJsonDetailed(
|
|
@@ -16157,7 +16217,40 @@ function solveAcwScV3(arg1) {
|
|
|
16157
16217
|
}
|
|
16158
16218
|
return output;
|
|
16159
16219
|
}
|
|
16160
|
-
|
|
16220
|
+
var JOB51_CITY_CODES = {
|
|
16221
|
+
"\u5168\u56FD": "000000",
|
|
16222
|
+
"\u5317\u4EAC": "010000",
|
|
16223
|
+
"\u4E0A\u6D77": "020000",
|
|
16224
|
+
"\u5E7F\u5DDE": "030200",
|
|
16225
|
+
"\u6DF1\u5733": "040000",
|
|
16226
|
+
"\u5929\u6D25": "050000",
|
|
16227
|
+
"\u91CD\u5E86": "060000",
|
|
16228
|
+
"\u5357\u4EAC": "070200",
|
|
16229
|
+
"\u82CF\u5DDE": "070300",
|
|
16230
|
+
"\u65E0\u9521": "070400",
|
|
16231
|
+
"\u676D\u5DDE": "080200",
|
|
16232
|
+
"\u5B81\u6CE2": "080300",
|
|
16233
|
+
"\u6210\u90FD": "090200",
|
|
16234
|
+
"\u798F\u5DDE": "110200",
|
|
16235
|
+
"\u53A6\u95E8": "110300",
|
|
16236
|
+
"\u6D4E\u5357": "120200",
|
|
16237
|
+
"\u9752\u5C9B": "120300",
|
|
16238
|
+
"\u5408\u80A5": "150200",
|
|
16239
|
+
"\u90D1\u5DDE": "170200",
|
|
16240
|
+
"\u6B66\u6C49": "180200",
|
|
16241
|
+
"\u957F\u6C99": "190200",
|
|
16242
|
+
"\u897F\u5B89": "200200",
|
|
16243
|
+
"\u6C88\u9633": "230200",
|
|
16244
|
+
"\u5927\u8FDE": "230300",
|
|
16245
|
+
"\u4E1C\u839E": "030800",
|
|
16246
|
+
"\u4F5B\u5C71": "030600"
|
|
16247
|
+
};
|
|
16248
|
+
function resolve51jobCityCode(city) {
|
|
16249
|
+
if (!city) return "000000";
|
|
16250
|
+
const clean = city.trim().replace(/市$/, "");
|
|
16251
|
+
return JOB51_CITY_CODES[clean] ?? "000000";
|
|
16252
|
+
}
|
|
16253
|
+
function signedQuery(keyword, page, jobArea = "000000") {
|
|
16161
16254
|
const timestamp2 = Math.floor(Date.now() / 1e3);
|
|
16162
16255
|
const requestId = nodeCrypto.randomBytes(16).toString("hex");
|
|
16163
16256
|
const query = new URLSearchParams({
|
|
@@ -16165,7 +16258,7 @@ function signedQuery(keyword, page) {
|
|
|
16165
16258
|
timestamp: String(timestamp2),
|
|
16166
16259
|
keyword,
|
|
16167
16260
|
searchType: "2",
|
|
16168
|
-
jobArea
|
|
16261
|
+
jobArea,
|
|
16169
16262
|
pageNum: String(page),
|
|
16170
16263
|
pageSize: "20",
|
|
16171
16264
|
requestId,
|
|
@@ -16177,15 +16270,15 @@ function signedQuery(keyword, page) {
|
|
|
16177
16270
|
const sign = nodeCrypto.createHmac("sha256", JOB51_SIGN_KEY).update(pathWithQuery).digest("hex");
|
|
16178
16271
|
return { pathWithQuery, sign };
|
|
16179
16272
|
}
|
|
16180
|
-
async function search51job(keyword, city, page, signal, timeoutMs =
|
|
16181
|
-
void city;
|
|
16273
|
+
async function search51job(keyword, city, page, signal, timeoutMs = 2e4, filters2) {
|
|
16182
16274
|
void filters2;
|
|
16183
|
-
const
|
|
16275
|
+
const jobArea = resolve51jobCityCode(city);
|
|
16276
|
+
const { pathWithQuery, sign } = signedQuery(keyword, page, jobArea);
|
|
16184
16277
|
const apiPath = `https://we.51job.com${pathWithQuery}`;
|
|
16185
16278
|
const headers = {
|
|
16186
16279
|
sign,
|
|
16187
16280
|
"user-agent": CHROME_UA,
|
|
16188
|
-
referer: `https://we.51job.com/pc/search?keyword=${encodeURIComponent(keyword)}&searchType=2`,
|
|
16281
|
+
referer: `https://we.51job.com/pc/search?jobArea=${jobArea}&keyword=${encodeURIComponent(keyword)}&searchType=2`,
|
|
16189
16282
|
accept: "application/json, text/plain, */*"
|
|
16190
16283
|
};
|
|
16191
16284
|
const first2 = await first51jobHop(apiPath, headers, signal);
|
|
@@ -16194,28 +16287,58 @@ async function search51job(keyword, city, page, signal, timeoutMs = 15e3, filter
|
|
|
16194
16287
|
const cookie = `${first2.cookieName}=${first2.cookieValue}`;
|
|
16195
16288
|
const retry = await fetch(apiPath, { headers: { ...headers, cookie }, signal: signal ?? void 0 }).catch(() => null);
|
|
16196
16289
|
if (retry) {
|
|
16197
|
-
const
|
|
16198
|
-
if (
|
|
16290
|
+
const json = await retry.json().catch(() => null);
|
|
16291
|
+
if (json && typeof json === "object") return finish51job(json);
|
|
16199
16292
|
}
|
|
16200
16293
|
}
|
|
16201
16294
|
const cdpUrl = await resolveCdpUrl();
|
|
16202
16295
|
if (!cdpUrl) {
|
|
16203
16296
|
return { status: "access_restricted", jobs: [] };
|
|
16204
16297
|
}
|
|
16205
|
-
const pageUrl = `https://we.51job.com/pc/search?keyword=${encodeURIComponent(keyword)}`;
|
|
16206
|
-
const
|
|
16298
|
+
const pageUrl = `https://we.51job.com/pc/search?jobArea=${jobArea}&keyword=${encodeURIComponent(keyword)}&searchType=2`;
|
|
16299
|
+
const outcome = await rawCaptureJsonDetailed(
|
|
16207
16300
|
cdpUrl,
|
|
16208
16301
|
"51job-search",
|
|
16209
16302
|
pageUrl,
|
|
16210
16303
|
/\/api\/job\/search-pc\?/,
|
|
16211
|
-
Math.max(timeoutMs
|
|
16304
|
+
Math.max(timeoutMs, 18e3),
|
|
16212
16305
|
signal,
|
|
16213
|
-
|
|
16214
|
-
(json2) => Array.isArray(json2?.data) || JSON.stringify(json2).includes('"jobName"')
|
|
16306
|
+
(json) => Array.isArray(json?.data) || JSON.stringify(json).includes('"jobName"')
|
|
16215
16307
|
);
|
|
16216
16308
|
if (signal?.aborted) return null;
|
|
16217
|
-
|
|
16218
|
-
|
|
16309
|
+
let diagnostics = {
|
|
16310
|
+
waitMs: outcome.waitMs,
|
|
16311
|
+
matchedRequestCount: outcome.matchedRequestCount,
|
|
16312
|
+
bodyLength: outcome.bodyLength,
|
|
16313
|
+
finalUrl: outcome.finalUrl,
|
|
16314
|
+
reason: outcome.reason
|
|
16315
|
+
};
|
|
16316
|
+
if (outcome.data) {
|
|
16317
|
+
const res = finish51job(outcome.data);
|
|
16318
|
+
return { ...res, coverage: "search_api", diagnostics };
|
|
16319
|
+
}
|
|
16320
|
+
const snapshot = await rawCaptureDomSnapshot(cdpUrl, "51job-search", pageUrl);
|
|
16321
|
+
if (snapshot) {
|
|
16322
|
+
const inspected = inspectRenderedDom(snapshot.html, "51job", snapshot.url);
|
|
16323
|
+
diagnostics = {
|
|
16324
|
+
...diagnostics,
|
|
16325
|
+
finalUrl: snapshot.url,
|
|
16326
|
+
pageTitle: inspected.pageTitle || snapshot.title,
|
|
16327
|
+
bodyLength: Math.max(diagnostics.bodyLength ?? 0, inspected.bodyLength),
|
|
16328
|
+
fallbackUsed: true
|
|
16329
|
+
};
|
|
16330
|
+
if (inspected.jobs.length) {
|
|
16331
|
+
return { status: "ok", coverage: "rendered_dom", jobs: inspected.jobs, diagnostics: { ...diagnostics, reason: "rendered_dom_fallback" } };
|
|
16332
|
+
}
|
|
16333
|
+
if (inspected.accessRestricted) return { status: "access_restricted", jobs: [], diagnostics };
|
|
16334
|
+
if (inspected.loginWall) return { status: "login_required", jobs: [], diagnostics };
|
|
16335
|
+
}
|
|
16336
|
+
return {
|
|
16337
|
+
status: outcome.matchedRequestCount > 0 ? "parse_empty" : "capture_timeout",
|
|
16338
|
+
jobs: [],
|
|
16339
|
+
diagnostics,
|
|
16340
|
+
note: `51job \u5DF2\u8FDE\u63A5\u6D4F\u89C8\u5668\u4F46\u672A\u6355\u83B7\u5230\u804C\u4F4D\u6570\u636E\uFF08waitMs=${diagnostics.waitMs ?? 0}\uFF0Cmatched=${diagnostics.matchedRequestCount ?? 0}\uFF09\uFF0C\u5E76\u975E\u767B\u5F55\u5931\u6548`
|
|
16341
|
+
};
|
|
16219
16342
|
}
|
|
16220
16343
|
function finish51job(json) {
|
|
16221
16344
|
const envelope = json;
|
|
@@ -16242,13 +16365,45 @@ async function first51jobHop(url, headers, signal) {
|
|
|
16242
16365
|
|
|
16243
16366
|
// src/platforms/liepin.ts
|
|
16244
16367
|
var LIEPIN_SEARCH_API_PATTERN = /(?:api-c\.liepin\.com\/api\/com\.liepin\.searchfront4c\.pc-search-job|pc-search-job)(?!-cond-init)(?:\?|$|\/)/i;
|
|
16245
|
-
|
|
16368
|
+
var LIEPIN_CITY_CODES = {
|
|
16369
|
+
"\u5317\u4EAC": "010",
|
|
16370
|
+
"\u4E0A\u6D77": "020",
|
|
16371
|
+
"\u5929\u6D25": "030",
|
|
16372
|
+
"\u91CD\u5E86": "040",
|
|
16373
|
+
"\u5E7F\u5DDE": "050020",
|
|
16374
|
+
"\u6DF1\u5733": "050090",
|
|
16375
|
+
"\u4E1C\u839E": "050040",
|
|
16376
|
+
"\u4F5B\u5C71": "050050",
|
|
16377
|
+
"\u5357\u4EAC": "060020",
|
|
16378
|
+
"\u82CF\u5DDE": "060080",
|
|
16379
|
+
"\u65E0\u9521": "060100",
|
|
16380
|
+
"\u676D\u5DDE": "070020",
|
|
16381
|
+
"\u5B81\u6CE2": "070030",
|
|
16382
|
+
"\u5408\u80A5": "080020",
|
|
16383
|
+
"\u798F\u5DDE": "090020",
|
|
16384
|
+
"\u53A6\u95E8": "090040",
|
|
16385
|
+
"\u6D4E\u5357": "250020",
|
|
16386
|
+
"\u9752\u5C9B": "250070",
|
|
16387
|
+
"\u90D1\u5DDE": "150020",
|
|
16388
|
+
"\u6B66\u6C49": "170020",
|
|
16389
|
+
"\u957F\u6C99": "180020",
|
|
16390
|
+
"\u6210\u90FD": "280020",
|
|
16391
|
+
"\u897F\u5B89": "270020",
|
|
16392
|
+
"\u6C88\u9633": "210020",
|
|
16393
|
+
"\u5927\u8FDE": "210040"
|
|
16394
|
+
};
|
|
16395
|
+
async function searchLiepin(keyword, page, signal, timeoutMs = 22e3, filters2, city) {
|
|
16246
16396
|
const cdpUrl = await resolveCdpUrl();
|
|
16247
16397
|
if (!cdpUrl) {
|
|
16248
16398
|
return { status: "login_required", jobs: [], note: "\u672A\u53D1\u73B0\u7528\u6237\u6D4F\u89C8\u5668\u8C03\u8BD5\u7AEF\u53E3\u3002\u8C03\u7528\u767B\u5F55\u6D41\u7A0B\u81EA\u52A8\u62C9\u8D77\u771F\u5B9E\u6D4F\u89C8\u5668\u5E76\u76D1\u542C\u730E\u8058\u767B\u5F55\u72B6\u6001" };
|
|
16249
16399
|
}
|
|
16250
16400
|
const native = liepinNativeFilters(filters2 ?? {});
|
|
16251
16401
|
const query = new URLSearchParams({ key: keyword, currentPage: String(page) });
|
|
16402
|
+
const cityCode = city ? LIEPIN_CITY_CODES[city.trim().replace(/市$/, "")] : void 0;
|
|
16403
|
+
if (cityCode) {
|
|
16404
|
+
query.set("city", cityCode);
|
|
16405
|
+
query.set("dq", cityCode);
|
|
16406
|
+
}
|
|
16252
16407
|
for (const [key, value] of Object.entries(native)) query.set(key, value);
|
|
16253
16408
|
const target = `https://www.liepin.com/zhaopin/?${query.toString()}`;
|
|
16254
16409
|
const outcome = await rawCaptureJsonDetailed(
|
|
@@ -16315,10 +16470,10 @@ function classifyLiepinError(code) {
|
|
|
16315
16470
|
// src/platforms/registry.ts
|
|
16316
16471
|
var PLATFORM_SEARCH = {
|
|
16317
16472
|
zhipin: searchZhipin,
|
|
16318
|
-
liepin: (keyword,
|
|
16473
|
+
liepin: (keyword, city, page, signal, timeoutMs, filters2) => searchLiepin(keyword, page, signal, timeoutMs, filters2, city),
|
|
16319
16474
|
zhaopin: searchZhaopin,
|
|
16320
|
-
// 51job
|
|
16321
|
-
...process.env.
|
|
16475
|
+
// 51job 默认启用(免登录签名直连 + CDP 旁听 + DOM 降级);仅当显式设置 MCP_JOBS_DISABLE_51JOB_API=1 时关闭
|
|
16476
|
+
...process.env.MCP_JOBS_DISABLE_51JOB_API === "1" ? {} : { "51job": (keyword, city, page, signal, timeoutMs, filters2) => search51job(keyword, city, page, signal, timeoutMs, filters2) }
|
|
16322
16477
|
};
|
|
16323
16478
|
var inflight = /* @__PURE__ */ new Map();
|
|
16324
16479
|
async function platformApiSearch(platform, params, signal, timeoutMs = 15e3) {
|
|
@@ -16523,13 +16678,26 @@ function buildBrowserSearchUrl(platform, term, cityName = "") {
|
|
|
16523
16678
|
if (code) params.set("city", code);
|
|
16524
16679
|
return "https://www.zhipin.com/web/geek/jobs?" + params.toString();
|
|
16525
16680
|
}
|
|
16526
|
-
case "liepin":
|
|
16527
|
-
|
|
16528
|
-
|
|
16529
|
-
|
|
16681
|
+
case "liepin": {
|
|
16682
|
+
const params = new URLSearchParams({ key: term });
|
|
16683
|
+
const code = cityName ? LIEPIN_CITY_CODES[cityName] : void 0;
|
|
16684
|
+
if (code) {
|
|
16685
|
+
params.set("city", code);
|
|
16686
|
+
params.set("dq", code);
|
|
16687
|
+
}
|
|
16688
|
+
return "https://www.liepin.com/zhaopin/?" + params.toString();
|
|
16689
|
+
}
|
|
16690
|
+
case "51job": {
|
|
16691
|
+
const params = new URLSearchParams({ keyword: term, searchType: "2" });
|
|
16692
|
+
const area = resolve51jobCityCode(cityName);
|
|
16693
|
+
if (area !== "000000") params.set("jobArea", area);
|
|
16694
|
+
return "https://we.51job.com/pc/search?" + params.toString();
|
|
16695
|
+
}
|
|
16530
16696
|
case "zhaopin": {
|
|
16531
16697
|
const params = new URLSearchParams({ kw: term });
|
|
16532
|
-
|
|
16698
|
+
const code = resolveZhaopinCityCode(cityName);
|
|
16699
|
+
if (code) params.set("jl", code);
|
|
16700
|
+
else if (cityName) params.set("jl", cityName);
|
|
16533
16701
|
return "https://www.zhaopin.com/jobs?" + params.toString();
|
|
16534
16702
|
}
|
|
16535
16703
|
}
|
|
@@ -16716,7 +16884,7 @@ async function searchWorkBuddy(args = {}, parent2, take = 25) {
|
|
|
16716
16884
|
}
|
|
16717
16885
|
};
|
|
16718
16886
|
}
|
|
16719
|
-
if (!lastStatus
|
|
16887
|
+
if (!lastStatus) {
|
|
16720
16888
|
return {
|
|
16721
16889
|
jobs: [],
|
|
16722
16890
|
source: {
|
package/lib/remote.js
CHANGED
|
@@ -39,13 +39,14 @@ function markRemoteMethod(prototype, method) {
|
|
|
39
39
|
if (!prototype || !method) return
|
|
40
40
|
const decorator = typert?.Remote?.(method)
|
|
41
41
|
if (!decorator) return
|
|
42
|
+
// The decorator schedules its marker through `addInitializer`; call it
|
|
43
|
+
// immediately on a prototype-backed object so the marker lands on the
|
|
44
|
+
// prototype descriptor the Gateway reads (source-mode discovery).
|
|
42
45
|
decorator(undefined, {
|
|
43
|
-
kind: 'method',
|
|
44
46
|
name: method,
|
|
45
|
-
static: false,
|
|
46
47
|
private: false,
|
|
47
|
-
|
|
48
|
-
addInitializer() {},
|
|
48
|
+
static: false,
|
|
49
|
+
addInitializer(fn) { fn.call(Object.create(prototype)) },
|
|
49
50
|
})
|
|
50
51
|
}
|
|
51
52
|
|
|
@@ -140,13 +141,41 @@ const REMOTE_METHODS = [
|
|
|
140
141
|
'myProfile',
|
|
141
142
|
]
|
|
142
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Typert strict-claim contribution describing the `jobsearch` Remote namespace,
|
|
146
|
+
* so the API Gateway and client-side remote access recognize every endpoint.
|
|
147
|
+
* Mirrors dsh-qiye's `companyTypertContribution`; without it the namespace
|
|
148
|
+
* exists but the wire refuses invocations.
|
|
149
|
+
*
|
|
150
|
+
* NOTE: the namespace must NOT be `jobs` — DSH itself registers a Cordis
|
|
151
|
+
* Service named `jobs` (the abstract background job registry), so a Typert
|
|
152
|
+
* Remote bound to that key fails to mount and the Gateway rejects the
|
|
153
|
+
* endpoint. `jobsearch` is free.
|
|
154
|
+
*/
|
|
155
|
+
export function jobsTypertContribution({ methods = REMOTE_METHODS } = {}) {
|
|
156
|
+
return {
|
|
157
|
+
package: 'dsh-jobs',
|
|
158
|
+
face: 'host',
|
|
159
|
+
schemas: [],
|
|
160
|
+
invocations: methods.map((method) => ({
|
|
161
|
+
id: `dsh-jobs#jobsearch/${method}`,
|
|
162
|
+
service: 'jobsearch',
|
|
163
|
+
namespace: 'jobsearch',
|
|
164
|
+
method,
|
|
165
|
+
invocation: { kind: 'direct' },
|
|
166
|
+
parameters: [{ name: 'request', wire: 'request', source: 'json', codec: { mode: 'src-json' } }],
|
|
167
|
+
result: { mode: 'src-json' },
|
|
168
|
+
})),
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
143
172
|
export function installJobsRemote(ctx, engine) {
|
|
144
173
|
const core = new JobsRemoteCore(engine)
|
|
145
174
|
if (!typert?.TypertRemoteService || !ctx) return core
|
|
146
175
|
|
|
147
176
|
class JobsTypertRemote extends typert.TypertRemoteService {
|
|
148
177
|
constructor(c) {
|
|
149
|
-
super(c, '
|
|
178
|
+
super(c, 'jobsearch')
|
|
150
179
|
this._core = core
|
|
151
180
|
}
|
|
152
181
|
}
|
|
@@ -161,5 +190,20 @@ export function installJobsRemote(ctx, engine) {
|
|
|
161
190
|
} catch (err) {
|
|
162
191
|
ctx.logger?.warn?.(`[dsh-jobs] 注册 Typert Remote 失败:${String(err?.message ?? err)}`)
|
|
163
192
|
}
|
|
193
|
+
|
|
194
|
+
// Strict claim: register the namespace description with the Typert registry
|
|
195
|
+
// so the Gateway admits `jobs/*` calls from the web panel. The registry's
|
|
196
|
+
// `register` already binds the claim's lifecycle to the Typert root context
|
|
197
|
+
// via its own `ctx.effect`, so wrapping it in another plugin-fiber effect
|
|
198
|
+
// would withdraw the claim whenever THIS fiber stops — and Typert's
|
|
199
|
+
// `hasSeen` history then blocks SRC fallback forever. Register bare.
|
|
200
|
+
const typertService = typeof ctx.get === 'function' ? ctx.get('typert') : undefined
|
|
201
|
+
if (typertService !== undefined && typeof typertService.register === 'function') {
|
|
202
|
+
try {
|
|
203
|
+
typertService.register(jobsTypertContribution())
|
|
204
|
+
} catch (err) {
|
|
205
|
+
ctx.logger?.warn?.(`[dsh-jobs] Typert contribution 注册失败:${String(err?.message ?? err)}`)
|
|
206
|
+
}
|
|
207
|
+
}
|
|
164
208
|
return core
|
|
165
209
|
}
|
package/lib/tools.js
CHANGED
|
@@ -4,19 +4,24 @@
|
|
|
4
4
|
* Exposes job search, detail, browser/profile status, login monitor,
|
|
5
5
|
* application tracking, and watch-loop tools directly to DSH agents.
|
|
6
6
|
*
|
|
7
|
+
* Tool contract follows the current DSH host (0.2.x): every definition must
|
|
8
|
+
* declare `parameters` plus `output: { schema, render }`, and `execute`
|
|
9
|
+
* returns the canonical value (validated against `output.schema`); `render`
|
|
10
|
+
* projects it into content blocks for the model. Definitions without
|
|
11
|
+
* `output` make `tools.register` throw and the plugin fiber fails.
|
|
12
|
+
*
|
|
7
13
|
* @module lib/tools.js
|
|
8
14
|
*/
|
|
9
15
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
16
|
+
const OUTPUT_SCHEMA = { type: 'object', additionalProperties: true }
|
|
17
|
+
const renderJson = (args, value) => [{ type: 'text', text: JSON.stringify(value, null, 2) }]
|
|
13
18
|
|
|
14
19
|
export function buildToolDefinitions(remote) {
|
|
15
20
|
return [
|
|
16
21
|
{
|
|
17
22
|
name: 'jobs_search',
|
|
18
23
|
description: '从 BOSS 直聘、猎聘、51job、智联招聘原站实时搜索职位(裸 CDP 复用用户真实浏览器,零 Playwright;自动区分 login_required 与 capture_timeout/parse_empty,抓包失败时自动降级读取已渲染 DOM)。',
|
|
19
|
-
|
|
24
|
+
parameters: {
|
|
20
25
|
type: 'object',
|
|
21
26
|
properties: {
|
|
22
27
|
keyword: { type: 'string', description: '搜索关键词,如 "FDE"、"前端架构师"' },
|
|
@@ -35,42 +40,48 @@ export function buildToolDefinitions(remote) {
|
|
|
35
40
|
},
|
|
36
41
|
required: ['keyword'],
|
|
37
42
|
},
|
|
43
|
+
output: { schema: OUTPUT_SCHEMA, render: renderJson },
|
|
44
|
+
timeoutMs: 120_000,
|
|
38
45
|
async execute(input) {
|
|
39
|
-
return
|
|
46
|
+
return await remote.search(input)
|
|
40
47
|
},
|
|
41
48
|
},
|
|
42
49
|
{
|
|
43
50
|
name: 'jobs_detail',
|
|
44
51
|
description: '读取指定官方职位链接的完整 JD 详情(复用真实浏览器裸 CDP)。',
|
|
45
|
-
|
|
52
|
+
parameters: {
|
|
46
53
|
type: 'object',
|
|
47
54
|
properties: {
|
|
48
55
|
url: { type: 'string', description: '官方职位详情 URL' },
|
|
49
56
|
},
|
|
50
57
|
required: ['url'],
|
|
51
58
|
},
|
|
59
|
+
output: { schema: OUTPUT_SCHEMA, render: renderJson },
|
|
60
|
+
timeoutMs: 60_000,
|
|
52
61
|
async execute(input) {
|
|
53
|
-
return
|
|
62
|
+
return await remote.detail(input)
|
|
54
63
|
},
|
|
55
64
|
},
|
|
56
65
|
{
|
|
57
66
|
name: 'jobs_profile_status',
|
|
58
67
|
description: '查看本机真实浏览器 CDP 连接状态、持久化 profile 以及四站 Cookie 线索(注意:Cookie 线索不是最终仲裁,页面真实渲染状态优先)。',
|
|
59
|
-
|
|
68
|
+
parameters: {
|
|
60
69
|
type: 'object',
|
|
61
70
|
properties: {
|
|
62
71
|
platform: { type: 'string', enum: ['zhipin', 'liepin', '51job', 'zhaopin'] },
|
|
63
72
|
accountId: { type: 'string' },
|
|
64
73
|
},
|
|
65
74
|
},
|
|
75
|
+
output: { schema: OUTPUT_SCHEMA, render: renderJson },
|
|
76
|
+
timeoutMs: 30_000,
|
|
66
77
|
async execute(input) {
|
|
67
|
-
return
|
|
78
|
+
return await remote.profileStatus(input ?? {})
|
|
68
79
|
},
|
|
69
80
|
},
|
|
70
81
|
{
|
|
71
82
|
name: 'jobs_login',
|
|
72
83
|
description: '在持久化 profile 的真实浏览器中打开招聘平台官方登录页并监听登录完成(仅前台交互使用,定时任务禁止阻塞调用)。',
|
|
73
|
-
|
|
84
|
+
parameters: {
|
|
74
85
|
type: 'object',
|
|
75
86
|
properties: {
|
|
76
87
|
platform: { type: 'string', enum: ['zhipin', 'liepin', '51job', 'zhaopin'] },
|
|
@@ -78,14 +89,16 @@ export function buildToolDefinitions(remote) {
|
|
|
78
89
|
},
|
|
79
90
|
required: ['platform'],
|
|
80
91
|
},
|
|
92
|
+
output: { schema: OUTPUT_SCHEMA, render: renderJson },
|
|
93
|
+
timeoutMs: 620_000,
|
|
81
94
|
async execute(input) {
|
|
82
|
-
return
|
|
95
|
+
return await remote.login(input)
|
|
83
96
|
},
|
|
84
97
|
},
|
|
85
98
|
{
|
|
86
99
|
name: 'jobs_open_browser',
|
|
87
100
|
description: '按原持久化 profile 打开或置前真实浏览器,用于重开已关闭的浏览器或处理原站安全验证。',
|
|
88
|
-
|
|
101
|
+
parameters: {
|
|
89
102
|
type: 'object',
|
|
90
103
|
properties: {
|
|
91
104
|
platform: { type: 'string', enum: ['zhipin', 'liepin', '51job', 'zhaopin'] },
|
|
@@ -93,14 +106,16 @@ export function buildToolDefinitions(remote) {
|
|
|
93
106
|
purpose: { type: 'string' },
|
|
94
107
|
},
|
|
95
108
|
},
|
|
109
|
+
output: { schema: OUTPUT_SCHEMA, render: renderJson },
|
|
110
|
+
timeoutMs: 60_000,
|
|
96
111
|
async execute(input) {
|
|
97
|
-
return
|
|
112
|
+
return await remote.openBrowser(input ?? {})
|
|
98
113
|
},
|
|
99
114
|
},
|
|
100
115
|
{
|
|
101
116
|
name: 'jobs_applications',
|
|
102
117
|
description: '查看本地投递追踪列表(按平台与 accountId 分页读取)。',
|
|
103
|
-
|
|
118
|
+
parameters: {
|
|
104
119
|
type: 'object',
|
|
105
120
|
properties: {
|
|
106
121
|
platform: { type: 'string', enum: ['zhipin', 'liepin', '51job', 'zhaopin'] },
|
|
@@ -109,14 +124,16 @@ export function buildToolDefinitions(remote) {
|
|
|
109
124
|
},
|
|
110
125
|
required: ['platform'],
|
|
111
126
|
},
|
|
127
|
+
output: { schema: OUTPUT_SCHEMA, render: renderJson },
|
|
128
|
+
timeoutMs: 30_000,
|
|
112
129
|
async execute(input) {
|
|
113
|
-
return
|
|
130
|
+
return await remote.applications(input)
|
|
114
131
|
},
|
|
115
132
|
},
|
|
116
133
|
{
|
|
117
134
|
name: 'jobs_prepare_apply',
|
|
118
135
|
description: '为目标岗位在本地建档待投递(prepared),便于后续在原站核对提交与追踪。',
|
|
119
|
-
|
|
136
|
+
parameters: {
|
|
120
137
|
type: 'object',
|
|
121
138
|
properties: {
|
|
122
139
|
platform: { type: 'string', enum: ['zhipin', 'liepin', '51job', 'zhaopin'] },
|
|
@@ -128,14 +145,16 @@ export function buildToolDefinitions(remote) {
|
|
|
128
145
|
},
|
|
129
146
|
required: ['platform', 'url', 'title'],
|
|
130
147
|
},
|
|
148
|
+
output: { schema: OUTPUT_SCHEMA, render: renderJson },
|
|
149
|
+
timeoutMs: 30_000,
|
|
131
150
|
async execute(input) {
|
|
132
|
-
return
|
|
151
|
+
return await remote.prepareApply(input)
|
|
133
152
|
},
|
|
134
153
|
},
|
|
135
154
|
{
|
|
136
155
|
name: 'jobs_watch_check',
|
|
137
156
|
description: '按关键词、城市和平台检查新职位变化(首次建立基线,之后增量提醒;返回 coverageSummary 标明完整/部分覆盖及未覆盖平台)。',
|
|
138
|
-
|
|
157
|
+
parameters: {
|
|
139
158
|
type: 'object',
|
|
140
159
|
properties: {
|
|
141
160
|
keyword: { type: 'string' },
|
|
@@ -147,8 +166,10 @@ export function buildToolDefinitions(remote) {
|
|
|
147
166
|
},
|
|
148
167
|
required: ['keyword'],
|
|
149
168
|
},
|
|
169
|
+
output: { schema: OUTPUT_SCHEMA, render: renderJson },
|
|
170
|
+
timeoutMs: 120_000,
|
|
150
171
|
async execute(input) {
|
|
151
|
-
return
|
|
172
|
+
return await remote.watchCheck(input)
|
|
152
173
|
},
|
|
153
174
|
},
|
|
154
175
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-jobs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "All-site job-search, application tracker, and watch-loop workbench for the DeepSeek Harness (dsh) across BOSS Zhipin, Liepin, 51job, and Zhaopin — with native DSH web UI, agent tools, and raw-CDP browser capture.",
|
|
5
5
|
"icon": "./icon.svg",
|
|
6
6
|
"type": "module",
|
|
@@ -87,8 +87,7 @@
|
|
|
87
87
|
"@deepseek-ai/dsh-client-connection",
|
|
88
88
|
"@deepseek-ai/dsh-client-locale",
|
|
89
89
|
"@deepseek-ai/dsh-client-ui-theme",
|
|
90
|
-
"@deepseek-ai/dsh-client-ui-layout"
|
|
91
|
-
"@deepseek-ai/dsh-client-ui-slots"
|
|
90
|
+
"@deepseek-ai/dsh-client-ui-layout"
|
|
92
91
|
]
|
|
93
92
|
}
|
|
94
93
|
}
|